@sprig-technologies/sprig-browser 2.39.3 → 2.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-ui-loLw6bPe.cjs +1 -0
- package/dist/conversational-ui-sHjWeSW0.js +589 -0
- package/dist/core-BAdMqSxY.js +982 -0
- package/dist/core-DGzfRh0z.cjs +12 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +16 -0
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-CKXj5eVU.js → getAttributedUrl-5g_EQiGQ.js} +306 -297
- package/dist/{getAttributedUrl-Wrb2IVbi.cjs → getAttributedUrl-DmbhGoBX.cjs} +5 -5
- package/dist/index-DmjRxajT.cjs +1 -0
- package/dist/index-hWjFkOYS.js +688 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-1Oozsgva.js → metricsReporter-Chz3rKxD.js} +1 -1
- package/dist/{metricsReporter-CXdAqZlB.cjs → metricsReporter-DOjBAl52.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-BE-QqXV6.cjs +1 -0
- package/dist/{view-BTPuuKmm.js → view-CKY1RqAy.js} +490 -480
- package/package.json +1 -1
- package/dist/conversational-ui-BBEwlRyA.js +0 -586
- package/dist/conversational-ui-p-aTqz70.cjs +0 -1
- package/dist/core-D7GY8Q1p.cjs +0 -12
- package/dist/core-fXpU4mUJ.js +0 -963
- package/dist/index-2SxBb1Na.cjs +0 -1
- package/dist/index-C4JVn6IQ.js +0 -678
- package/dist/view-DrHm3QYY.cjs +0 -1
|
@@ -1,82 +1,85 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { i as
|
|
3
|
-
import { v as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
import { u, c as M, a as F, F as we, h as le, p as ae, _ as de, S as Me, g as ie, b as _e, d as Be } from "./view-CKY1RqAy.js";
|
|
2
|
+
import { g as Oe, i as He, A as Se, E as Ne, a as Ce } from "./core-BAdMqSxY.js";
|
|
3
|
+
import { v as Ve } from "./metricsReporter-Chz3rKxD.js";
|
|
4
|
+
const Ue = (e) => u("button", { ...e, className: M("ul-card-text__button", e.className), id: "ul-card-text__button" }), Fe = ({ html: e, ...n }) => {
|
|
5
|
+
const o = F((r) => r.enableCspTrustedTypes), t = we(() => Oe(e, o), [o, e]);
|
|
6
|
+
return u("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
7
|
+
}, ye = () => {
|
|
8
|
+
const { viewDocument: e } = F((t) => ({ viewDocument: t.viewDocument })), [n, o] = le(!1);
|
|
6
9
|
return ae(() => {
|
|
7
10
|
const t = e.querySelector(".sprig-question-body"), r = new ResizeObserver(() => {
|
|
8
11
|
window.requestAnimationFrame(() => {
|
|
9
|
-
|
|
12
|
+
o(!!(t && He(t) && t.scrollHeight > t.offsetHeight));
|
|
10
13
|
});
|
|
11
14
|
});
|
|
12
15
|
return t && r.observe(t), () => {
|
|
13
16
|
t && r.disconnect();
|
|
14
17
|
};
|
|
15
|
-
}, [e]),
|
|
16
|
-
}, ue = ({ plainText: e, richText:
|
|
17
|
-
const { cards: e, close:
|
|
18
|
-
return ["email", "link"].includes(t["userleap-platform"]) ||
|
|
19
|
-
s.key === "Enter" &&
|
|
20
|
-
}, role: "button", tabIndex: 0, children:
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
var
|
|
26
|
-
const { handleClickEmbedButton: t, hasViewedEmbed: r, headers:
|
|
18
|
+
}, [e]), n;
|
|
19
|
+
}, ue = ({ plainText: e, richText: n, id: o, className: t, isHeader: r, showAsterisk: l }) => n ? u(Fe, { className: t, html: n, id: o }) : e ? r ? u("h1", { className: t, id: o, children: [e, l && "*"] }) : u("p", { className: t, id: o, children: e }) : null, $e = () => {
|
|
20
|
+
const { cards: e, close: n, endCard: o, headers: t, index: r } = F((s) => ({ cards: s.cards, close: s.close, endCard: s.endCard, headers: s.headers, index: s.index, useMobileStyling: s.useMobileStyling })), l = e.length, a = we(() => () => n(Se), [n]);
|
|
21
|
+
return ["email", "link"].includes(t["userleap-platform"]) || o && r + 1 === l ? null : u("div", { "aria-label": "Close button", className: "close-btn", onClick: a, onKeyPress: (s) => {
|
|
22
|
+
s.key === "Enter" && a();
|
|
23
|
+
}, role: "button", tabIndex: 0, children: u("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: u("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
|
|
24
|
+
}, ln = ({ message: e, properties: n, isRequired: o }) => {
|
|
25
|
+
const t = de(null), r = n == null ? void 0 : n.captionText, l = ye();
|
|
26
|
+
return u("div", { className: M("question-header-container", "sprig-header-container", l ? "sprig-border-bottom" : null), ref: t, children: [u("div", { className: "question-header-button-container", children: [u(ue, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: n == null ? void 0 : n.questionHtml, showAsterisk: o }), u($e, {})] }), u(ue, { className: "ul-caption", id: "ul-caption", plainText: r, richText: n == null ? void 0 : n.captionHtml })] });
|
|
27
|
+
}, Ae = () => u("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: u("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), an = ({ isSubmitDisabled: e, handleSubmit: n }) => u("div", { className: "ul-card-longform__submit-button-container", children: u(Ue, { className: "ul-card-longform__submit-button", disabled: e, onClick: n, children: ["OK ", u(Ae, {})] }) }), ve = ({ buttonText: e = "View Prototype", handleClick: n }) => u("button", { className: "prototype-button", onClick: n, children: e }, "prototype-btn"), dn = ({ defaultBody: e, embeddedType: n = "prototype", properties: o }) => {
|
|
28
|
+
var E;
|
|
29
|
+
const { handleClickEmbedButton: t, hasViewedEmbed: r, headers: l, useDesktopPrototype: a } = F((C) => ({ handleClickEmbedButton: C.handleClickEmbedButton, hasViewedEmbed: C.hasViewedEmbed, headers: C.headers, useDesktopPrototype: C.useDesktopPrototype })), s = (o == null ? void 0 : o.conceptUrl) || ((E = o == null ? void 0 : o.consentDocument) == null ? void 0 : E.url), i = window.innerWidth < Ne, c = l["userleap-platform"], h = (C, T) => {
|
|
27
30
|
C.preventDefault(), t(T);
|
|
28
31
|
};
|
|
29
|
-
if (!
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
+
if (!a && i && !r && s && ["email", "link"].includes(c)) {
|
|
33
|
+
if (n === "prototype") return u(ve, { handleClick: (C) => {
|
|
34
|
+
h(C, "question.prototype.click");
|
|
32
35
|
} });
|
|
33
|
-
if (
|
|
34
|
-
|
|
36
|
+
if (n === "pdf") return u(ve, { buttonText: (o == null ? void 0 : o.viewDocumentText) || "View Document", handleClick: (C) => {
|
|
37
|
+
h(C, "question.agreement.click");
|
|
35
38
|
} });
|
|
36
39
|
}
|
|
37
40
|
return e();
|
|
38
|
-
},
|
|
39
|
-
const
|
|
41
|
+
}, xe = ({ isSelected: e, id: n, divId: o, themeColor: t, disabled: r = !1 }) => u("div", { "aria-checked": e, "aria-disabled": r, "aria-labelledby": `label-${n}`, className: "select-checkbox", id: o, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...r ? { opacity: 0.5 } : {} }, tabIndex: r ? -1 : 0, children: e && u(Me, {}) }), ze = (e, n) => {
|
|
42
|
+
const o = de(0);
|
|
40
43
|
return () => {
|
|
41
44
|
if (e.current) {
|
|
42
45
|
const t = e.current;
|
|
43
46
|
t.style.height = "1px";
|
|
44
|
-
const r = t.scrollHeight + (t.offsetHeight - t.clientHeight),
|
|
45
|
-
|
|
47
|
+
const r = t.scrollHeight + (t.offsetHeight - t.clientHeight), l = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), a = r <= l ? r : l;
|
|
48
|
+
o.current !== a && n(), o.current = a, t.style.height = `${a}px`;
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
|
-
},
|
|
49
|
-
const { styleNonce:
|
|
50
|
-
|
|
51
|
-
const P = ({ isSelected: y, userText:
|
|
52
|
-
k && k({ id: s, selected: y, value:
|
|
53
|
-
},
|
|
54
|
-
|
|
51
|
+
}, cn = ({ ariaLabel: e, border: n, choiceStyle: o = {}, label: t, isSelected: r, value: l, text: a, id: s, isRadio: i, useMobileStyling: c, error: h, allowTextEntry: E, noneOfTheAbove: C, promptText: T, disabled: v = !1, onUserInputChanged: k }) => {
|
|
52
|
+
const { styleNonce: m, viewDocument: x } = F((y) => ({ styleNonce: y.styleNonce, viewDocument: y.viewDocument })), [I, j] = le(!1);
|
|
53
|
+
Ze(x, n, m);
|
|
54
|
+
const P = ({ isSelected: y, userText: f }) => {
|
|
55
|
+
k && k({ id: s, selected: y, value: l, userText: f, noneOfTheAbove: C });
|
|
56
|
+
}, z = (y) => {
|
|
57
|
+
v || (y.stopPropagation(), P({ isSelected: i || !r, userText: a }), j(!1));
|
|
55
58
|
}, Y = () => {
|
|
56
|
-
I ||
|
|
59
|
+
I || j(!0);
|
|
57
60
|
}, _ = () => {
|
|
58
|
-
I &&
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
+
I && j(!1);
|
|
62
|
+
}, B = { onClick: (y) => z(y), onKeyPress: (y) => ((f) => {
|
|
63
|
+
v || f.key !== "Enter" && f.key !== " " || z(f);
|
|
61
64
|
})(y) };
|
|
62
|
-
"ontouchstart" in x.documentElement ? (
|
|
63
|
-
const W = i ? `radio-${s}` : `checkbox-${s}`,
|
|
64
|
-
return
|
|
65
|
-
},
|
|
66
|
-
const r = de(null), { update:
|
|
67
|
-
return ae(() => (
|
|
68
|
-
|
|
69
|
-
}), []),
|
|
70
|
-
|
|
65
|
+
"ontouchstart" in x.documentElement ? (B.onTouchStart = _, B.onTouchCancel = _, B.onTouchEnd = _) : (B.onMouseDown = Y, B.onMouseLeave = _);
|
|
66
|
+
const W = i ? `radio-${s}` : `checkbox-${s}`, p = r || I ? [Q] : [], b = [...h ? [Ee] : [], ...p, ...v ? ["ul-choice-disabled"] : []], g = t ? { "aria-labelledby": `label-${s}` } : { "aria-label": e };
|
|
67
|
+
return u("div", { className: M(ie("choice", c), ...b), id: `choice-div-${s}`, style: { ...o, ...h ? { borderColor: Ce } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : B, "aria-disabled": v, children: [u("div", { className: M("choice-label-container"), children: [i ? u("div", { ...g, className: M("select-radio", ...p), id: W, role: "radio", tabIndex: 0 }) : u(xe, { disabled: v, divId: W, id: s, isSelected: r, themeColor: n }), t && u("label", { className: M(ie("select-label", c)), htmlFor: W, id: `label-${s}`, children: t })] }), E && r && u("div", { className: M("choice-text-entry-container", ...p), children: u(qe, { onTextChange: (y) => P({ isSelected: r, userText: y }), promptText: T || "Please specify", textValue: a, useMobileStyling: c }) })] });
|
|
68
|
+
}, qe = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
|
|
69
|
+
const r = de(null), { update: l } = F((s) => ({ update: s.update })), a = ze(r, () => l());
|
|
70
|
+
return ae(() => (a(), r.current && r.current.focus(), () => {
|
|
71
|
+
l();
|
|
72
|
+
}), []), u("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: M(ie("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (s) => {
|
|
73
|
+
a(), s.stopPropagation(), o(s.currentTarget.value);
|
|
71
74
|
}, onClick: (s) => {
|
|
72
75
|
s.stopPropagation();
|
|
73
76
|
}, onKeyPress: (s) => {
|
|
74
77
|
s.stopPropagation();
|
|
75
|
-
}, placeholder: e, ref: r, role: "textbox", rows: 1, value:
|
|
76
|
-
}, he = "ul-select-style-element", Q = "ul-select-active-dynamic-style",
|
|
78
|
+
}, placeholder: e, ref: r, role: "textbox", rows: 1, value: n });
|
|
79
|
+
}, he = "ul-select-style-element", Q = "ul-select-active-dynamic-style", Ee = "ul-select-error-dynamic-style", Ze = (e, n, o) => {
|
|
77
80
|
let t = e.getElementById(he), r = !1;
|
|
78
|
-
t || (t = e.createElement("style"), r = !0), t.tagName.toLowerCase() === "style" && (t.id = he,
|
|
79
|
-
},
|
|
81
|
+
t || (t = e.createElement("style"), r = !0), t.tagName.toLowerCase() === "style" && (t.id = he, o && (t.nonce = o), t.textContent = Ge(n), r && e.head.appendChild(t));
|
|
82
|
+
}, Ge = (e) => `
|
|
80
83
|
.${Q} {
|
|
81
84
|
border-color: ${e};
|
|
82
85
|
}
|
|
@@ -84,13 +87,13 @@ const Ve = (e) => p("button", { ...e, className: R("ul-card-text__button", e.cla
|
|
|
84
87
|
border: 6px solid ${e};
|
|
85
88
|
box-shadow: none;
|
|
86
89
|
}
|
|
87
|
-
.${
|
|
88
|
-
border-color: ${
|
|
90
|
+
.${Ee} {
|
|
91
|
+
border-color: ${Ce};
|
|
89
92
|
}
|
|
90
|
-
`,
|
|
91
|
-
const
|
|
92
|
-
return
|
|
93
|
-
},
|
|
93
|
+
`, pn = ({ children: e }) => u("div", { className: "sprig-question-body", children: e }), un = ({ children: e }) => {
|
|
94
|
+
const n = ye(), { isConversationalUI: o } = F((t) => ({ isConversationalUI: t.isConversationalUI }));
|
|
95
|
+
return u("div", { className: M("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
|
|
96
|
+
}, G = "https://cdn.sprig.com", d = { document: void 0, videojs: void 0 }, ce = (e) => e + "-loading-spiner", D = "hidden", me = ".m3u8", ne = "questionId", oe = "ul-video-recorder-camera-off-button", te = "ul-recording-in-session", We = [{ type: "link", content: `${G}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${G}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${G}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${G}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${G}/userleap-web-upchunk-v2.2.2.js` }], je = [{ type: "link", content: `${G}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${G}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
|
|
94
97
|
.video-js .vjs-control {
|
|
95
98
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
96
99
|
}
|
|
@@ -747,330 +750,336 @@ span.ul-button-text {
|
|
|
747
750
|
.vjs-poster {
|
|
748
751
|
background-size: cover;
|
|
749
752
|
}
|
|
750
|
-
` }],
|
|
753
|
+
` }], ke = "-video-player", ge = "-secondary-video-player", Ie = "-video-recorder";
|
|
751
754
|
let S, be;
|
|
752
|
-
const
|
|
753
|
-
const
|
|
755
|
+
const A = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, metadata: l }) => {
|
|
756
|
+
const a = d.document.documentElement;
|
|
754
757
|
if (!t || !r) return;
|
|
755
|
-
const s = { event: `SDK - ${e}`, visitorId: t, environmentId: r, metadata: { ...
|
|
756
|
-
(await fetch(`${
|
|
757
|
-
}, U = async (e,
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
(await fetch(`${
|
|
761
|
-
},
|
|
762
|
-
if (e.length === 0) return
|
|
763
|
-
Promise.all(e.reduce((
|
|
764
|
-
let
|
|
765
|
-
|
|
766
|
-
s(
|
|
767
|
-
},
|
|
768
|
-
i(
|
|
769
|
-
},
|
|
770
|
-
}))(d.document.head, t)),
|
|
771
|
-
d.videojs = d.document.defaultView.videojs,
|
|
772
|
-
}).catch(function(
|
|
773
|
-
console.log(
|
|
758
|
+
const s = { event: `SDK - ${e}`, visitorId: t, environmentId: r, metadata: { ...l || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: window.location.href, language: navigator.language } };
|
|
759
|
+
(await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(s) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
|
|
760
|
+
}, U = async (e, n, o, t, r, l) => {
|
|
761
|
+
A({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId: r, envId: l, metadata: { errorMessage: e.message } });
|
|
762
|
+
const a = d.document.documentElement, s = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: window.location.href, language: navigator.language }, i = { action: n, err: { message: e.message, stack: e.stack }, meta: s, vid: r, envId: l };
|
|
763
|
+
(await fetch(`${o}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...t, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(i) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
|
|
764
|
+
}, De = (e, n) => {
|
|
765
|
+
if (e.length === 0) return n && n();
|
|
766
|
+
Promise.all(e.reduce((o, t) => (o.push(((r, { type: l, content: a }) => new Promise(function(s, i) {
|
|
767
|
+
let c;
|
|
768
|
+
l === "script" ? (c = d.document.createElement("script"), c.src = a) : l === "link" ? (c = d.document.createElement("link"), c.rel = "stylesheet", c.href = a, c.type = "text/css") : (c = d.document.createElement("style"), c.innerHTML = a), c.onload = function() {
|
|
769
|
+
s(a);
|
|
770
|
+
}, c.onerror = function() {
|
|
771
|
+
i(a);
|
|
772
|
+
}, c.async = !1, c.id = btoa(a), r.appendChild(c);
|
|
773
|
+
}))(d.document.head, t)), o), [])).then(() => {
|
|
774
|
+
d.videojs = d.document.defaultView.videojs, n && n();
|
|
775
|
+
}).catch(function(o) {
|
|
776
|
+
console.log(o + " failed to load");
|
|
774
777
|
});
|
|
775
|
-
}, fe = (e,
|
|
776
|
-
if (
|
|
777
|
-
else if (
|
|
778
|
+
}, fe = (e, n, o) => {
|
|
779
|
+
if (n === "start" && (e.style.visibility = "visible"), n === "none") e.style.visibility = D;
|
|
780
|
+
else if (n === "success") e.style.visibility = D, e.innerHTML = "Upload succeeded!";
|
|
778
781
|
else {
|
|
779
|
-
const t = Math.round(parseFloat(
|
|
782
|
+
const t = Math.round(parseFloat(o));
|
|
780
783
|
e.innerHTML = `Uploading <span class="ul-upload-progress-label__time">${t}%</span>`, e.style.background = `linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${t}%, #FCFCFD ${t}%, #FCFCFD 100%)`;
|
|
781
784
|
}
|
|
782
|
-
}, re = (e,
|
|
783
|
-
const
|
|
784
|
-
return
|
|
785
|
-
},
|
|
786
|
-
const
|
|
787
|
-
return
|
|
788
|
-
|
|
789
|
-
}),
|
|
790
|
-
},
|
|
791
|
-
e.children().forEach((
|
|
792
|
-
if (
|
|
793
|
-
const
|
|
794
|
-
|
|
785
|
+
}, re = (e, n) => {
|
|
786
|
+
const o = d.videojs(e.id());
|
|
787
|
+
return o == null ? void 0 : o.payload[n];
|
|
788
|
+
}, Te = (e, n) => {
|
|
789
|
+
const o = new (d.videojs.getComponent("Component"))(e);
|
|
790
|
+
return o.addClass("ul-buttons-panel"), n.map((t) => {
|
|
791
|
+
o.addChild(t);
|
|
792
|
+
}), Ye(o), o;
|
|
793
|
+
}, Ye = (e) => {
|
|
794
|
+
e.children().forEach((n) => {
|
|
795
|
+
if (R[n.name_]) {
|
|
796
|
+
const o = X(R[n.name_], `ul-${R[n.name_]}`);
|
|
797
|
+
n.el_.appendChild(o);
|
|
795
798
|
}
|
|
796
799
|
});
|
|
797
|
-
}, X = (e,
|
|
798
|
-
const
|
|
799
|
-
return
|
|
800
|
-
},
|
|
800
|
+
}, X = (e, n = "") => {
|
|
801
|
+
const o = d.document.createElement("span");
|
|
802
|
+
return o.className = "ul-button-text", o.innerHTML = e, o.id = n, o;
|
|
803
|
+
}, Le = (e, n, o, t, r = !1, l) => {
|
|
801
804
|
e.addClass("ul-video-player");
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
const s =
|
|
805
|
-
!
|
|
806
|
-
r || !
|
|
805
|
+
const a = new (d.videojs.getComponent("Component"))(e);
|
|
806
|
+
a.addClass("ul-control-panel"), e.progressBar = a.addChild("ProgressControl"), o && e.src(o), e.audioPlayerPlaceholder = new (d.videojs.getComponent("Component"))(e), e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
|
|
807
|
+
const s = o && o.src ? Qe(o.src) : null;
|
|
808
|
+
!o || !r && s ? (e.audioPlayerPlaceholder.hide(), d.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", s && e.poster(s)) : (e.children()[0].classList.add("vjs-hidden"), d.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
|
|
809
|
+
r || !o || s || Je(e), l == null || l.play();
|
|
807
810
|
}), e.on("pause", () => {
|
|
808
|
-
|
|
811
|
+
l == null || l.pause();
|
|
809
812
|
}), e.on("seeked", () => {
|
|
810
|
-
|
|
813
|
+
l == null || l.currentTime(e.currentTime());
|
|
811
814
|
}), e.on("ratechange", () => {
|
|
812
|
-
|
|
813
|
-
}), e.addChild(e.audioPlayerPlaceholder, {}, 1),
|
|
814
|
-
},
|
|
815
|
+
l == null || l.playbackRate(e.playbackRate());
|
|
816
|
+
}), e.addChild(e.audioPlayerPlaceholder, {}, 1), a.addChild(n), e.addChild(a), t && t(e);
|
|
817
|
+
}, Ke = (e, n, o, t, r, l, a, s = !1) => {
|
|
815
818
|
be = Date.now();
|
|
816
|
-
const i = ee(
|
|
819
|
+
const i = ee(n, { controls: !1, bigPlayButton: !1, fluid: !1, width: 1280, height: 720, playsinline: !0, plugins: { record: { audio: !0, video: { mandatory: { minWidth: 1280, minHeight: 720 } }, frameWidth: 1280, frameHeight: 720, maxLength: 600, autoMuteDevice: !0 } } });
|
|
817
820
|
if (!i) return;
|
|
818
|
-
i.payload =
|
|
819
|
-
const { surveyId:
|
|
820
|
-
let
|
|
821
|
-
const k = (
|
|
822
|
-
const
|
|
821
|
+
i.payload = o;
|
|
822
|
+
const { surveyId: c, questionId: h, responseGroupUid: E, visitorId: C, envId: T } = o;
|
|
823
|
+
let v;
|
|
824
|
+
const k = (p) => {
|
|
825
|
+
const b = oe, g = oe + "-audio-only";
|
|
823
826
|
fe(i.uploadProgressLabel, "none"), S && S.startTime >= be && S.abort();
|
|
824
827
|
const y = d.document.getElementById("ul-camera-button");
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((
|
|
828
|
-
|
|
828
|
+
p ? (i.children()[0].classList.add("vjs-hidden"), j.removeClass(b), j.addClass(g), y.innerHTML = R.TurnOnCamera, i.audioPlayerPlaceholder.removeClass("vjs-hidden"), v == null || v.getTracks().forEach((f) => {
|
|
829
|
+
f.stop();
|
|
830
|
+
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((f) => {
|
|
831
|
+
v = f, f.getVideoTracks().forEach((N) => {
|
|
829
832
|
N.enabled = !1;
|
|
830
|
-
}), i.record().onDeviceReady(
|
|
831
|
-
}).catch(i.record().onDeviceError.bind(i.record()))) : (
|
|
832
|
-
|
|
833
|
-
}), i.children()[0].classList.remove("vjs-hidden"), i.record().getDevice(),
|
|
834
|
-
},
|
|
835
|
-
|
|
833
|
+
}), i.record().onDeviceReady(f);
|
|
834
|
+
}).catch(i.record().onDeviceError.bind(i.record()))) : (v == null || v.getVideoTracks().forEach((f) => {
|
|
835
|
+
f.enabled = !0;
|
|
836
|
+
}), i.children()[0].classList.remove("vjs-hidden"), i.record().getDevice(), j.removeClass(g), j.addClass(b), y.innerHTML = R.TurnOffCamera, i.audioPlayerPlaceholder.addClass("vjs-hidden"));
|
|
837
|
+
}, m = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
|
|
838
|
+
m.hasClass(D) || (A({ event: "Video Delete Button Clicked", apiBase: t, headers: a, visitorId: C, envId: T, metadata: { questionId: h, responseGroupUid: E, surveyId: c } }), k(i.cameraOff), r(w.DELETE, {}), j.removeClass(D), m.addClass(D));
|
|
836
839
|
} });
|
|
837
|
-
|
|
838
|
-
const x = d.document.getElementById(
|
|
840
|
+
m.addClass("ul-video-recorder-delete-button"), m.el_.appendChild(X(R.DeleteButton, "ul-delete-button"));
|
|
841
|
+
const x = d.document.getElementById(n), I = () => {
|
|
839
842
|
x.classList.contains("vjs-fullscreen") && i.cameraOff ? x.style.display = "table" : x.style.display = "flex";
|
|
840
843
|
};
|
|
841
844
|
I();
|
|
842
|
-
const
|
|
843
|
-
i.record().isRecording() || (i.cameraOff = !i.cameraOff,
|
|
845
|
+
const j = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
|
|
846
|
+
i.record().isRecording() || (i.cameraOff = !i.cameraOff, A({ event: "Video Camera Button Clicked", apiBase: t, headers: a, visitorId: o.visitorId, envId: o.envId, metadata: { questionId: h, responseGroupUid: E, surveyId: c, cameraOff: i.cameraOff } }), k(i.cameraOff), !m.hasClass(D) && m.addClass(D), r(w.DELETE, {}), I());
|
|
844
847
|
} });
|
|
845
|
-
|
|
848
|
+
j.addClass(oe), j.el_.appendChild(X(R.TurnOffCamera, "ul-camera-button"));
|
|
846
849
|
const P = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
|
|
847
|
-
const
|
|
848
|
-
if (i.record().isRecording()) i.record().stop(),
|
|
850
|
+
const p = d.document.getElementById("ul-recorder-toggle");
|
|
851
|
+
if (i.record().isRecording()) i.record().stop(), p && (p.innerHTML = R.RecordButton), P.removeClass(te), m.removeClass(D);
|
|
849
852
|
else {
|
|
850
|
-
const
|
|
851
|
-
if (
|
|
853
|
+
const b = d.document.getElementById("ul-recording-countdown-screen");
|
|
854
|
+
if (b) b.remove(), p && (p.innerHTML = R.RecordButton), k(i.cameraOff), r(w.DELETE, {}), j.removeClass(D), m.addClass(D), P.removeClass(te), _.show();
|
|
852
855
|
else {
|
|
853
|
-
P.addClass(te), _.hide(),
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
+
P.addClass(te), _.hide(), j.addClass(D), m.addClass(D), p && (p.innerHTML = R.StopButton);
|
|
857
|
+
const g = d.document.createElement("div");
|
|
858
|
+
g.id = "ul-recording-countdown-screen", x.insertBefore(g, x.children[1]), g.style.height = `${x.offsetHeight}px`, Pe(i, 3);
|
|
856
859
|
}
|
|
857
860
|
}
|
|
858
861
|
} });
|
|
859
|
-
P.addClass("ul-video-recorder-toggle-button"), P.el_.appendChild(X(
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
const Y =
|
|
862
|
+
P.addClass("ul-video-recorder-toggle-button"), P.el_.appendChild(X(R.RecordButton, "ul-recorder-toggle"));
|
|
863
|
+
const z = d.document.createElement("p");
|
|
864
|
+
z.style.visibility = "hidden", z.className = "ul-upload-progress-label", e.appendChild(z), i.uploadProgressLabel = z;
|
|
865
|
+
const Y = Te(i, [m, j, "PlayToggle", P, "FullscreenToggle"]), _ = Y.children().find((p) => p.name_ === "FullscreenToggle");
|
|
863
866
|
_.hasClass("vjs-disabled") && _.hide();
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
P.hide(),
|
|
867
|
+
const B = Y.children().find((p) => p.name_ === "PlayToggle");
|
|
868
|
+
B.hide(), m.addClass(D), Le(i, Y, l, !1, s), i.on("stopRecord", () => {
|
|
869
|
+
P.hide(), B.show(), _.show(), m.removeClass(D);
|
|
867
870
|
}), i.on("deviceReady", () => {
|
|
868
|
-
P.show(),
|
|
869
|
-
}), ((
|
|
870
|
-
const { surveyId: N, responseGroupUid: q, visitorId: L, envId:
|
|
871
|
-
|
|
872
|
-
console.warn("device error: ",
|
|
873
|
-
}),
|
|
874
|
-
U(V ||
|
|
875
|
-
}),
|
|
876
|
-
y(
|
|
877
|
-
}),
|
|
878
|
-
y(
|
|
879
|
-
const
|
|
871
|
+
P.show(), B.hide(), m.addClass(D);
|
|
872
|
+
}), ((p, b, g, y, f) => {
|
|
873
|
+
const { surveyId: N, responseGroupUid: q, visitorId: L, envId: O } = p.payload;
|
|
874
|
+
p.on("deviceError", function() {
|
|
875
|
+
console.warn("device error: ", p.deviceErrorCode), p.deviceErrorCode.message === "Permission denied" ? (p.deviceButton.addClass("permission-denied"), g && g(w.ERROR, { type: w.PERMISSION_DENIED }), A({ event: "Video Permission Denied", apiBase: b, headers: f, visitorId: L, envId: O, metadata: { questionId: re(p, ne), responseGroupUid: q, surveyId: N } })) : (g && g(w.ERROR, { type: w.OTHER }), U(new Error(p.deviceErrorCode.message), "recorderDeviceError", b, f, L, O));
|
|
876
|
+
}), p.on("error", function(Z, V) {
|
|
877
|
+
U(V || p.error(), "recorderError", b, f, L, O);
|
|
878
|
+
}), p.on("startRecord", function(Z, V) {
|
|
879
|
+
y(p.uploadProgressLabel, "none"), A({ event: "Video Record Start", apiBase: b, headers: f, visitorId: L, envId: O, metadata: { questionId: re(p, ne), responseGroupUid: q, surveyId: N } });
|
|
880
|
+
}), p.on("finishRecord", async function() {
|
|
881
|
+
y(p.uploadProgressLabel, "start", 0);
|
|
882
|
+
const Z = re(p, ne);
|
|
880
883
|
if (!N) {
|
|
881
884
|
const H = "internal error: missing fields in payload";
|
|
882
|
-
return
|
|
885
|
+
return g && g(w.ERROR, { type: w.OTHER }), U(new Error(H), "finishRecord", b, f, L, O), null;
|
|
883
886
|
}
|
|
884
|
-
|
|
885
|
-
const V =
|
|
886
|
-
|
|
887
|
-
const K = { surveyId: N, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: V, mediaRecordingUid:
|
|
888
|
-
|
|
887
|
+
p.record().stopDevice();
|
|
888
|
+
const V = p.cameraOff ? w.MEDIA_TYPE_AUDIO : w.MEDIA_TYPE_VIDEO, $ = Ve();
|
|
889
|
+
A({ event: "Video Record Finish", apiBase: b, headers: f, visitorId: L, envId: O, metadata: { mediaRecordingUid: $, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: V } });
|
|
890
|
+
const K = { surveyId: N, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: V, mediaRecordingUid: $ };
|
|
891
|
+
Z && (K.questionId = Z), q && (K.responseGroupUid = q), L && (K.visitorId = L);
|
|
889
892
|
const J = await (async () => {
|
|
890
|
-
const H = await fetch(`${
|
|
893
|
+
const H = await fetch(`${b}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(K) });
|
|
891
894
|
if (H.ok) {
|
|
892
895
|
const pe = await H.json();
|
|
893
|
-
return
|
|
896
|
+
return g && g(w.UPLOAD_STARTED, { [w.UPLOAD_ID]: pe.upload.id, [w.MEDIA_TYPE]: V, [w.MEDIA_RECORDING_UID]: $ }), pe.upload.url;
|
|
894
897
|
}
|
|
895
|
-
return
|
|
898
|
+
return g && g(w.ERROR, { type: w.OTHER, response: H }), U(new Error("failed to get upload response with url"), "finishRecord", b, f, L, O), null;
|
|
896
899
|
})();
|
|
897
|
-
J && (S = d.document.defaultView.UpChunk.createUpload({ endpoint: J, file: new d.document.defaultView.File([
|
|
898
|
-
y(
|
|
900
|
+
J && (S = d.document.defaultView.UpChunk.createUpload({ endpoint: J, file: new d.document.defaultView.File([p.recordedData], `recording ${V} ${Date.now()}`), chunkSize: 5120 }), S.startTime = Date.now(), A({ event: "Video Upload Start", apiBase: b, headers: f, visitorId: L, envId: O, metadata: { mediaRecordingUid: $, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: V, url: J } }), S.on("error", (H) => {
|
|
901
|
+
y(p.uploadProgressLabel, "none"), g && g(w.UPLOAD_FINISHED, { [w.MEDIA_RECORDING_UID]: $ }), U(H, "finishRecord", b, f, L, O);
|
|
899
902
|
}), S.on("progress", (H) => {
|
|
900
|
-
|
|
903
|
+
g && g(w.UPLOAD_PROGRESS, { [w.MEDIA_RECORDING_UID]: $, [w.UPLOAD_PROGRESS_PCT]: H.detail }), y(p.uploadProgressLabel, "progress", H.detail);
|
|
901
904
|
}), S.on("success", () => {
|
|
902
|
-
y(
|
|
905
|
+
y(p.uploadProgressLabel, "success"), g && g(w.UPLOAD_FINISHED, { [w.MEDIA_RECORDING_UID]: $ }), A({ event: "Video Upload Success", apiBase: b, headers: f, visitorId: L, envId: O, metadata: { mediaRecordingUid: $, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: V, url: J, elapsedMs: S.startTime && Date.now() - S.startTime } });
|
|
903
906
|
}));
|
|
904
907
|
});
|
|
905
|
-
})(i, t, r, fe,
|
|
908
|
+
})(i, t, r, fe, a);
|
|
906
909
|
const W = [{ name: "microphone" }];
|
|
907
|
-
!i.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((
|
|
908
|
-
var
|
|
909
|
-
return (
|
|
910
|
-
})).then((
|
|
911
|
-
|
|
912
|
-
}).catch((
|
|
910
|
+
!i.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((p) => {
|
|
911
|
+
var b;
|
|
912
|
+
return (b = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : b.query(p);
|
|
913
|
+
})).then((p) => {
|
|
914
|
+
p.reduce((b, g) => b & g.state === "granted", !0) && i && (i.deviceButton && i.deviceButton.hide(), i.record().getDevice());
|
|
915
|
+
}).catch((p) => {
|
|
913
916
|
});
|
|
914
|
-
},
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
|
|
917
|
+
}, Pe = (e, n = 3) => {
|
|
918
|
+
const o = d.document.getElementById("ul-recording-countdown-screen");
|
|
919
|
+
o && n === 0 ? (o.remove(), e.record().start()) : o && (o.innerHTML = `<span class='ul-countdown-text'>Recording in... ${n}</span>`, setTimeout(() => {
|
|
920
|
+
Pe(e, n - 1);
|
|
918
921
|
}, 1e3));
|
|
919
|
-
},
|
|
920
|
-
const
|
|
921
|
-
return
|
|
922
|
+
}, Re = (e) => {
|
|
923
|
+
const n = d.document.createElement("div");
|
|
924
|
+
return n.className = "ul-video-container", n.appendChild(((o) => {
|
|
922
925
|
const t = d.document.createElement("div");
|
|
923
|
-
return t.className = "ul-video-player-loading", t.id = ce(
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
+
return t.className = "ul-video-player-loading", t.id = ce(o), ["first", "second", "third", "fourth"].map((r) => {
|
|
927
|
+
const l = d.document.createElement("div");
|
|
928
|
+
l.className = r, t.appendChild(l);
|
|
926
929
|
}), t;
|
|
927
|
-
})(e)),
|
|
928
|
-
}, se = (e,
|
|
929
|
-
const
|
|
930
|
-
|
|
930
|
+
})(e)), n;
|
|
931
|
+
}, se = (e, n) => {
|
|
932
|
+
const o = d.document.createElement("video");
|
|
933
|
+
o.id = e, o.className = "video-js vjs-default-skin ul-video-player-video";
|
|
931
934
|
const t = d.document.createElement("p");
|
|
932
935
|
t.className = "vjs-no-js", t.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
|
|
933
936
|
const r = d.document.createElement("a");
|
|
934
|
-
return r.href = "https://videojs.com/html5-video-support/", r.target = "_blank", r.innerHTML = "supports HTML5 video", t.appendChild(r),
|
|
935
|
-
},
|
|
937
|
+
return r.href = "https://videojs.com/html5-video-support/", r.target = "_blank", r.innerHTML = "supports HTML5 video", t.appendChild(r), o.appendChild(t), n.appendChild(o), n;
|
|
938
|
+
}, Je = (e, n) => {
|
|
936
939
|
e.children()[0].classList.remove("vjs-hidden"), e.audioPlayerPlaceholder.hide(), d.document.getElementById(`${e.id()}_html5_api`).style.height = "100%";
|
|
937
|
-
}, ee = (e,
|
|
938
|
-
d.document =
|
|
939
|
-
const i = e +
|
|
940
|
-
return d.document.addEventListener("securitypolicyviolation", (
|
|
941
|
-
U(new Error(`Voice & Video feature violates ${
|
|
942
|
-
}),
|
|
943
|
-
d.document.getElementById(ce(i)).remove(), se(i,
|
|
944
|
-
const
|
|
940
|
+
}, ee = (e, n) => d.document.getElementById(e) ? n ? d.videojs(e, n) : d.videojs(e) : (console.error(`Error in finding player element with ID, ${e}`), null), vn = (e, n, o, t = !1, r = "https://api.sprig.com", l = document, a = null, s = null) => {
|
|
941
|
+
d.document = l;
|
|
942
|
+
const i = e + ke, c = Re(i);
|
|
943
|
+
return d.document.addEventListener("securitypolicyviolation", (h) => {
|
|
944
|
+
U(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", r, {});
|
|
945
|
+
}), De(je, () => {
|
|
946
|
+
d.document.getElementById(ce(i)).remove(), se(i, c);
|
|
947
|
+
const h = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
|
|
945
948
|
try {
|
|
946
|
-
const
|
|
947
|
-
se(
|
|
948
|
-
const C = ee(i,
|
|
949
|
+
const E = e + ge;
|
|
950
|
+
se(E, c);
|
|
951
|
+
const C = ee(i, h), T = ee(E, { muted: !0, ...h });
|
|
949
952
|
if (!C || !T) return;
|
|
950
|
-
((
|
|
951
|
-
|
|
952
|
-
const
|
|
953
|
-
x &&
|
|
954
|
-
})(T,
|
|
955
|
-
const
|
|
956
|
-
k.hasClass("vjs-disabled") && k.hide(),
|
|
957
|
-
} catch (
|
|
958
|
-
return void U(new Error(`Error when creating video player object ${
|
|
953
|
+
((m, x, I) => {
|
|
954
|
+
m.addClass(`ul${ge}`);
|
|
955
|
+
const j = new (d.videojs.getComponent("Component"))(m);
|
|
956
|
+
x && m.src(x), m.addChild(j), I && I(m);
|
|
957
|
+
})(T, a, s), a || T.addClass(D);
|
|
958
|
+
const v = Te(C, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), k = v.children().find((m) => m.name_ === "FullscreenToggle");
|
|
959
|
+
k.hasClass("vjs-disabled") && k.hide(), Le(C, v, n, o, t, T);
|
|
960
|
+
} catch (E) {
|
|
961
|
+
return void U(new Error(`Error when creating video player object ${E}`), "playerDeviceError", r, {});
|
|
959
962
|
}
|
|
960
|
-
}),
|
|
961
|
-
},
|
|
963
|
+
}), c;
|
|
964
|
+
}, hn = (e, n = {}, o = "https://api.userleap.com", t, r, l, a = !1, s = document) => {
|
|
962
965
|
d.document = s;
|
|
963
|
-
const i = e +
|
|
964
|
-
return d.document.addEventListener("securitypolicyviolation", (
|
|
965
|
-
U(new Error(`Voice & Video feature violates ${
|
|
966
|
-
}),
|
|
967
|
-
se(i,
|
|
966
|
+
const i = e + Ie, c = Re(i);
|
|
967
|
+
return d.document.addEventListener("securitypolicyviolation", (h) => {
|
|
968
|
+
U(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", o, l, n.visitorId, n.envId);
|
|
969
|
+
}), De(je.concat(We), () => {
|
|
970
|
+
se(i, c), d.document.getElementById(ce(i)).remove();
|
|
968
971
|
try {
|
|
969
|
-
|
|
970
|
-
} catch (
|
|
971
|
-
return void U(new Error(`Error when creating video recorder player object ${
|
|
972
|
+
Ke(c, i, n, o, t, r, l, a);
|
|
973
|
+
} catch (h) {
|
|
974
|
+
return void U(new Error(`Error when creating video recorder player object ${h}`), "recorderDeviceError", o, l, n.visitorId, n.envId);
|
|
972
975
|
}
|
|
973
|
-
}),
|
|
974
|
-
},
|
|
975
|
-
const
|
|
976
|
-
if (d.document.getElementById(
|
|
976
|
+
}), c;
|
|
977
|
+
}, mn = (e) => {
|
|
978
|
+
const n = e + Ie;
|
|
979
|
+
if (d.document.getElementById(n) && d.videojs) {
|
|
977
980
|
try {
|
|
978
|
-
if (!d.videojs(
|
|
981
|
+
if (!d.videojs(n).record().stream) return;
|
|
979
982
|
} catch {
|
|
980
983
|
return;
|
|
981
984
|
}
|
|
982
|
-
d.videojs(
|
|
985
|
+
d.videojs(n).record().stop(), d.videojs(n).record().stopDevice();
|
|
983
986
|
}
|
|
984
|
-
},
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
},
|
|
987
|
+
}, gn = (e) => {
|
|
988
|
+
const n = ee(e + ke);
|
|
989
|
+
n == null || n.pause();
|
|
990
|
+
}, Qe = (e) => {
|
|
988
991
|
if (!e) return null;
|
|
989
|
-
const
|
|
990
|
-
let
|
|
991
|
-
return
|
|
992
|
-
},
|
|
993
|
-
var
|
|
994
|
-
const
|
|
995
|
-
const { themeColor:
|
|
996
|
-
return
|
|
997
|
-
return
|
|
998
|
-
r != null && r.includes(s) || (
|
|
999
|
-
}, role: "option", style: { ...r != null && r.includes(s) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t &&
|
|
992
|
+
const n = e.match(/https:\/\/stream.mux.com\/(.*)/);
|
|
993
|
+
let o = n ? n[1] : null;
|
|
994
|
+
return o.includes(me) && (o = o.replace(me, "")), o ? `https://image.mux.com/${o}/thumbnail.jpg?time=0` : null;
|
|
995
|
+
}, w = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, R = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" };
|
|
996
|
+
var Xe = ((e) => (e.CONTINUE = "CONTINUE", e.EXTERNAL = "EXTERNAL", e.NO_BUTTON = "NO_BUTTON", e))(Xe || {}), en = ((e) => (e.Unlimited = "Unlimited", e.Maximum = "Maximum", e.Range = "Range", e))(en || {});
|
|
997
|
+
const nn = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: r, dropdownFooter: l }) => {
|
|
998
|
+
const { themeColor: a } = F((s) => ({ doc: s.viewDocument, themeColor: s.border }));
|
|
999
|
+
return u("div", { className: "select-list", children: [e.map((s) => {
|
|
1000
|
+
return u("div", { "aria-disabled": r == null ? void 0 : r.includes(s), className: M("select-option", r != null && r.includes(s) ? "ul-choice-disabled" : ""), onClick: (c) => {
|
|
1001
|
+
r != null && r.includes(s) || (n(s), c.stopPropagation());
|
|
1002
|
+
}, role: "option", style: { ...r != null && r.includes(s) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && u(xe, { divId: (i = s.id, `checkbox-div-${i}`), id: s.id, isSelected: o.includes(s), themeColor: a }), s.label] }, s.id);
|
|
1000
1003
|
var i;
|
|
1001
|
-
}),
|
|
1002
|
-
},
|
|
1003
|
-
const [i,
|
|
1004
|
-
|
|
1004
|
+
}), l] });
|
|
1005
|
+
}, bn = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: o, options: t, placeholderText: r, value: l, disabledOptions: a = [], dropdownFooter: s }) => {
|
|
1006
|
+
const [i, c] = le(!1), { viewDocument: h, update: E } = F((v) => ({ viewDocument: v.viewDocument, update: v.update })), C = () => {
|
|
1007
|
+
c(!i), E();
|
|
1005
1008
|
};
|
|
1006
1009
|
ae(() => {
|
|
1007
1010
|
var k;
|
|
1008
|
-
const
|
|
1009
|
-
const x =
|
|
1010
|
-
(x == null ? void 0 : x.closest(".select-option.ul-choice-disabled")) || (
|
|
1011
|
+
const v = (m) => {
|
|
1012
|
+
const x = m.target;
|
|
1013
|
+
(x == null ? void 0 : x.closest(".select-option.ul-choice-disabled")) || (c(!1), E());
|
|
1011
1014
|
};
|
|
1012
|
-
|
|
1015
|
+
h.addEventListener("click", v);
|
|
1013
1016
|
try {
|
|
1014
|
-
(k = window.parent) == null || k.addEventListener("click",
|
|
1017
|
+
(k = window.parent) == null || k.addEventListener("click", v);
|
|
1015
1018
|
} catch {
|
|
1016
|
-
window.addEventListener("click",
|
|
1019
|
+
window.addEventListener("click", v);
|
|
1017
1020
|
}
|
|
1018
1021
|
return () => {
|
|
1019
|
-
var
|
|
1020
|
-
|
|
1022
|
+
var m;
|
|
1023
|
+
h.removeEventListener("click", v);
|
|
1021
1024
|
try {
|
|
1022
|
-
(
|
|
1025
|
+
(m = window.parent) == null || m.removeEventListener("click", v);
|
|
1023
1026
|
} catch {
|
|
1024
|
-
window.removeEventListener("click",
|
|
1027
|
+
window.removeEventListener("click", v);
|
|
1025
1028
|
}
|
|
1026
1029
|
};
|
|
1027
|
-
}, [
|
|
1028
|
-
const T =
|
|
1029
|
-
return
|
|
1030
|
-
|
|
1031
|
-
}, type: "button", children: [
|
|
1030
|
+
}, [h, E]);
|
|
1031
|
+
const T = l.length === 0 ? ["select-button-placeholder"] : [];
|
|
1032
|
+
return u(Be, { children: [u("button", { "aria-label": "choice dropdown button", className: M("select-button", ...T), onClick: (v) => {
|
|
1033
|
+
v.stopPropagation(), C();
|
|
1034
|
+
}, type: "button", children: [u("span", { children: l.length === 0 ? r : l.length === 1 ? l[0].label : `${l.length} ${n}` }), u(_e, {})] }), i && u(nn, { disabledOptions: a, dropdownFooter: s, options: t, selectedOptions: l, selectItem: (v) => {
|
|
1032
1035
|
var x;
|
|
1033
|
-
const k =
|
|
1034
|
-
var
|
|
1035
|
-
return (
|
|
1036
|
+
const k = l.some((I) => I.id === v.id), m = l.some((I) => {
|
|
1037
|
+
var j;
|
|
1038
|
+
return (j = I.optionProperties) == null ? void 0 : j.noneOfTheAbove;
|
|
1036
1039
|
});
|
|
1037
|
-
(x =
|
|
1040
|
+
(x = v.optionProperties) != null && x.noneOfTheAbove && !k ? o([v]) : e ? o(k ? l.filter((I) => I.id !== v.id) : m ? [v] : [...l, v]) : k || o([v]), e || C();
|
|
1038
1041
|
}, showCheckbox: e })] });
|
|
1039
|
-
},
|
|
1042
|
+
}, on = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, fn = (e = void 0, n = {}) => {
|
|
1040
1043
|
if (!e) return e;
|
|
1044
|
+
const o = ["http:", "https:", "itms-apps:", "market:"], t = ((a) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(a) ? a : `http://${a}`)(e);
|
|
1045
|
+
if (!t) return;
|
|
1041
1046
|
try {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
if (!l.protocol || l.protocol !== "http:" && l.protocol !== "https:") return;
|
|
1047
|
+
const a = new URL(t);
|
|
1048
|
+
if (!a.protocol || !o.includes(a.protocol)) return;
|
|
1045
1049
|
} catch {
|
|
1046
1050
|
return;
|
|
1047
1051
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
return
|
|
1052
|
+
const r = [], l = ((a, s, i) => {
|
|
1053
|
+
let c = a;
|
|
1054
|
+
for (const [h, E] of Object.entries(on)) if (c.toLowerCase().includes(h)) if (s[E]) {
|
|
1055
|
+
const C = new RegExp(h, "gi");
|
|
1056
|
+
c = c.replace(C, s[E]);
|
|
1057
|
+
} else i.push(h);
|
|
1058
|
+
return c;
|
|
1059
|
+
})(t, n, r);
|
|
1060
|
+
return r.length === 0 ? l : ((a, s) => {
|
|
1061
|
+
if (!a.includes("?")) return a;
|
|
1062
|
+
const i = a.slice(0, a.indexOf("?")), c = a.slice(a.indexOf("?") + 1).split("&").map((h) => h.split("=")).filter((h) => !s.includes(h[1]));
|
|
1063
|
+
return c.length === 0 ? i : `${i}?${c.map((h) => h.join("=")).join("&")}`;
|
|
1064
|
+
})(l, r);
|
|
1057
1065
|
};
|
|
1058
1066
|
export {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1067
|
+
Ue as B,
|
|
1068
|
+
Fe as H,
|
|
1069
|
+
an as L,
|
|
1070
|
+
dn as M,
|
|
1071
|
+
cn as O,
|
|
1072
|
+
Xe as P,
|
|
1073
|
+
un as Q,
|
|
1074
|
+
w as R,
|
|
1075
|
+
bn as S,
|
|
1076
|
+
pn as a,
|
|
1077
|
+
en as b,
|
|
1078
|
+
ln as c,
|
|
1079
|
+
hn as d,
|
|
1080
|
+
fn as g,
|
|
1081
|
+
gn as p,
|
|
1082
|
+
mn as s,
|
|
1083
|
+
ze as u,
|
|
1084
|
+
vn as v
|
|
1076
1085
|
};
|