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