@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.
Files changed (34) hide show
  1. package/dist/conversational-styles-BiL7hMhj.js +4 -0
  2. package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
  3. package/dist/conversational-ui-BYWN-x1R.js +579 -0
  4. package/dist/conversational-ui-N_aaTzqd.cjs +1 -0
  5. package/dist/core-Br8FqGd4.cjs +12 -0
  6. package/dist/{core-CzqULo6b.js → core-Cyu7gofl.js} +451 -458
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.d.ts +11 -0
  9. package/dist/core.js +2 -2
  10. package/dist/debounce-CMb8f7wh.js +9 -0
  11. package/dist/debounce-DsC7462b.cjs +1 -0
  12. package/dist/{getAttributedUrl-C1AsMcwH.cjs → getAttributedUrl-CJJ96Ihj.cjs} +6 -6
  13. package/dist/{getAttributedUrl-DUesmkhh.js → getAttributedUrl-C_5gL6aZ.js} +241 -244
  14. package/dist/index-BSk-C5b7.js +695 -0
  15. package/dist/index-MWKreg7C.cjs +1 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.js +2 -2
  19. package/dist/{metricsReporter-BChkCOLD.js → metricsReporter-B-oKhuWk.js} +1 -1
  20. package/dist/{metricsReporter-Bqy_vLyq.cjs → metricsReporter-Dc4CZlRc.cjs} +1 -1
  21. package/dist/replay.cjs +1 -1
  22. package/dist/replay.js +134 -138
  23. package/dist/view-BGlLLPXB.js +1503 -0
  24. package/dist/view-BGzeHt4l.cjs +1 -0
  25. package/package.json +1 -1
  26. package/dist/conversational-styles-CWNea3pP.js +0 -4
  27. package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
  28. package/dist/conversational-ui-D2Y5H9To.js +0 -610
  29. package/dist/conversational-ui-DJlCFQ-6.cjs +0 -1
  30. package/dist/core-CvM2f3CD.cjs +0 -12
  31. package/dist/index-D1_q2uph.cjs +0 -1
  32. package/dist/index-mshAF3wp.js +0 -709
  33. package/dist/view-C7XtFlCN.cjs +0 -1
  34. package/dist/view-afp9mz2J.js +0 -1491
@@ -1,16 +1,13 @@
1
- import { u, c as R, a as F, p as K, F as Ce, h as ae, _ as de, g as we, S as _e, b as se, y as Oe, d as Be } from "./view-afp9mz2J.js";
2
- import { g as He, i as Se, A as Ne, E as Ue, a as ye } from "./core-CzqULo6b.js";
3
- import { v as Ve } from "./metricsReporter-BChkCOLD.js";
4
- const Fe = (e) => u("button", { ...e, className: R("ul-card-text__button", e.className), id: "ul-card-text__button" }), Ae = ({ html: e, ...n }) => {
5
- const { enableCspTrustedTypes: o, update: t } = F((s) => ({ enableCspTrustedTypes: s.enableCspTrustedTypes, update: s.update }));
6
- K(() => {
7
- t();
8
- }, [t]);
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 K(() => {
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(Ae, { 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, $e = () => {
24
- const { cards: e, close: n, endCard: o, headers: t, index: r } = F((l) => ({ cards: l.cards, close: l.close, endCard: l.endCard, headers: l.headers, index: l.index, useMobileStyling: l.useMobileStyling })), s = e.length, a = Ce(() => () => n(Ne), [n]);
25
- return ["email", "link"].includes(t["userleap-platform"]) || o && r + 1 === s ? null : u("div", { "aria-label": "Close button", className: "close-btn", onClick: a, onKeyPress: (l) => {
26
- l.key === "Enter" && a();
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")), a = r <= s ? r : s;
56
- o.current !== a && requestAnimationFrame(() => {
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 = a, t.style.height = `${a}px`;
32
+ }), o.current = l, t.style.height = `${l}px`;
59
33
  }
60
34
  };
61
- }, pn = ({ ariaLabel: e, border: n, choiceStyle: o = {}, label: t, isSelected: r, value: s, text: a, id: l, isRadio: i, useMobileStyling: c, error: m, allowTextEntry: j, noneOfTheAbove: D, promptText: T, disabled: v = !1, onUserInputChanged: h }) => {
62
- const { styleNonce: g, viewDocument: E } = F((x) => ({ styleNonce: x.styleNonce, viewDocument: x.viewDocument })), [k, y] = ae(!1);
63
- Ge(E, n, g);
64
- const L = ({ isSelected: x, userText: C }) => {
65
- h && h({ id: l, selected: x, value: s, userText: C, noneOfTheAbove: D });
66
- }, z = (x) => {
67
- v || (x.stopPropagation(), L({ isSelected: i || !r, userText: a }), y(!1));
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
- k || y(!0);
70
- }, _ = () => {
71
- k && y(!1);
72
- }, O = { onClick: (x) => z(x), onKeyPress: (x) => ((C) => {
73
- v || C.key !== "Enter" && C.key !== " " || z(C);
74
- })(x) };
75
- "ontouchstart" in E.documentElement ? (O.onTouchStart = _, O.onTouchCancel = _, O.onTouchEnd = _) : (O.onMouseDown = Y, O.onMouseLeave = _);
76
- const W = i ? `radio-${l}` : `checkbox-${l}`, p = r || k ? [X] : [], f = [...m ? [je] : [], ...p, ...v ? ["ul-choice-disabled"] : []], b = t ? { "aria-labelledby": `label-${l}` } : { "aria-label": e };
77
- return u("div", { className: R(se("choice", c), ...f), id: `choice-div-${l}`, style: { ...o, ...m ? { borderColor: ye } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : O, "aria-disabled": v, children: [u("div", { className: R("choice-label-container"), children: [i ? u("div", { ...b, className: R("select-radio", ...p), id: W, role: "radio", tabIndex: 0 }) : u(Ee, { disabled: v, divId: W, id: l, isSelected: r, themeColor: n }), t && u("label", { className: R(se("select-label", c)), htmlFor: W, id: `label-${l}`, children: t })] }), j && r && u("div", { className: R("choice-text-entry-container", ...p), children: u(Ze, { onTextChange: (x) => L({ isSelected: r, userText: x }), promptText: T || "Please specify", textValue: a, useMobileStyling: c }) })] });
78
- }, Ze = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
79
- const r = de(null), { update: s } = F((l) => ({ update: l.update })), a = qe(r, () => s());
80
- return K(() => (a(), r.current && r.current.focus(), () => {
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: R(se("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (l) => {
83
- a(), l.stopPropagation(), o(l.currentTarget.value);
84
- }, onClick: (l) => {
85
- l.stopPropagation();
86
- }, onKeyPress: (l) => {
87
- l.stopPropagation();
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", X = "ul-select-active-dynamic-style", je = "ul-select-error-dynamic-style", Ge = (e, n, o) => {
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 = We(n), r && e.head.appendChild(t));
92
- }, We = (e) => `
93
- .${X} {
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
- .${X} .select-radio, .${X}.select-radio {
93
+ .${Q} .select-radio, .${Q}.select-radio {
97
94
  border: 6px solid ${e};
98
95
  box-shadow: none;
99
96
  }
100
- .${je} {
101
- border-color: ${ye};
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 = xe(), { isConversationalUI: o } = F((t) => ({ isConversationalUI: t.isConversationalUI }));
105
- return u("div", { className: R("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
106
- }, G = "https://cdn.sprig.com", d = { document: void 0, videojs: void 0 }, ce = (e) => e + "-loading-spiner", I = "hidden", me = ".m3u8", oe = "questionId", te = "ul-video-recorder-camera-off-button", re = "ul-recording-in-session", Ye = [{ 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` }], ke = [{ 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 */
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
- ` }], Ie = "-video-player", ge = "-secondary-video-player", De = "-video-recorder";
760
+ ` }], ke = "-video-player", ge = "-secondary-video-player", Ie = "-video-recorder";
764
761
  let S, be;
765
- const $ = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, metadata: s }) => {
766
- const a = d.document.documentElement;
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 l = { event: `SDK - ${e}`, visitorId: t, environmentId: r, metadata: { ...s || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: window.location.href, language: navigator.language } };
769
- (await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(l) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
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
- $({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId: r, envId: s, metadata: { errorMessage: e.message } });
772
- const a = d.document.documentElement, l = { 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: l, vid: r, envId: s };
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
- }, Te = (e, n) => {
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: a }) => new Promise(function(l, i) {
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 = a) : s === "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() {
779
- l(a);
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(a);
782
- }, c.async = !1, c.id = btoa(a), r.appendChild(c);
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 = I;
790
- else if (n === "success") e.style.visibility = I, e.innerHTML = "Upload succeeded!";
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
- }, Le = (e, n) => {
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
- }), Ke(o), o;
803
- }, Ke = (e) => {
799
+ }), Ye(o), o;
800
+ }, Ye = (e) => {
804
801
  e.children().forEach((n) => {
805
- if (M[n.name_]) {
806
- const o = ee(M[n.name_], `ul-${M[n.name_]}`);
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
- }, ee = (e, n = "") => {
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
- }, Pe = (e, n, o, t, r = !1, s) => {
810
+ }, Le = (e, n, o, t, r = !1, s) => {
814
811
  e.addClass("ul-video-player");
815
- const a = new (d.videojs.getComponent("Component"))(e);
816
- 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");
817
- const l = o && o.src ? Xe(o.src) : null;
818
- !o || !r && l ? (e.audioPlayerPlaceholder.hide(), d.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", l && e.poster(l)) : (e.children()[0].classList.add("vjs-hidden"), d.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
819
- r || !o || l || Qe(e), s == null || s.play();
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), a.addChild(n), e.addChild(a), t && t(e);
827
- }, Je = (e, n, o, t, r, s, a, l = !1) => {
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 = ne(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 } } });
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: j, visitorId: D, envId: T } = o;
833
- let v;
834
- const h = (p) => {
835
- const f = te, b = te + "-audio-only";
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 x = d.document.getElementById("ul-camera-button");
838
- p ? (i.children()[0].classList.add("vjs-hidden"), y.removeClass(f), y.addClass(b), x.innerHTML = M.TurnOnCamera, i.audioPlayerPlaceholder.removeClass("vjs-hidden"), v == null || v.getTracks().forEach((C) => {
839
- C.stop();
840
- }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((C) => {
841
- v = C, C.getVideoTracks().forEach((N) => {
842
- N.enabled = !1;
843
- }), i.record().onDeviceReady(C);
844
- }).catch(i.record().onDeviceError.bind(i.record()))) : (v == null || v.getVideoTracks().forEach((C) => {
845
- C.enabled = !0;
846
- }), i.children()[0].classList.remove("vjs-hidden"), i.record().getDevice(), y.removeClass(b), y.addClass(f), x.innerHTML = M.TurnOffCamera, i.audioPlayerPlaceholder.addClass("vjs-hidden"));
847
- }, g = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
848
- g.hasClass(I) || ($({ event: "Video Delete Button Clicked", apiBase: t, headers: a, visitorId: D, envId: T, metadata: { questionId: m, responseGroupUid: j, surveyId: c } }), h(i.cameraOff), r(w.DELETE, {}), y.removeClass(I), g.addClass(I));
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
- g.addClass("ul-video-recorder-delete-button"), g.el_.appendChild(ee(M.DeleteButton, "ul-delete-button"));
851
- const E = d.document.getElementById(n), k = () => {
852
- E.classList.contains("vjs-fullscreen") && i.cameraOff ? E.style.display = "table" : E.style.display = "flex";
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
- k();
855
- const y = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
856
- i.record().isRecording() || (i.cameraOff = !i.cameraOff, $({ event: "Video Camera Button Clicked", apiBase: t, headers: a, visitorId: o.visitorId, envId: o.envId, metadata: { questionId: m, responseGroupUid: j, surveyId: c, cameraOff: i.cameraOff } }), h(i.cameraOff), !g.hasClass(I) && g.addClass(I), r(w.DELETE, {}), k());
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
- y.addClass(te), y.el_.appendChild(ee(M.TurnOffCamera, "ul-camera-button"));
859
- const L = new (d.videojs.getComponent("Button"))(i, { clickHandler: () => {
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 = M.RecordButton), L.removeClass(re), g.removeClass(I);
858
+ if (i.record().isRecording()) i.record().stop(), p && (p.innerHTML = R.RecordButton), D.removeClass(re), h.removeClass(T);
862
859
  else {
863
- const f = d.document.getElementById("ul-recording-countdown-screen");
864
- if (f) f.remove(), p && (p.innerHTML = M.RecordButton), h(i.cameraOff), r(w.DELETE, {}), y.removeClass(I), g.addClass(I), L.removeClass(re), _.show();
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
- L.addClass(re), _.hide(), y.addClass(I), g.addClass(I), p && (p.innerHTML = M.StopButton);
867
- const b = d.document.createElement("div");
868
- b.id = "ul-recording-countdown-screen", E.insertBefore(b, E.children[1]), b.style.height = `${E.offsetHeight}px`, Me(i, 3);
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
- L.addClass("ul-video-recorder-toggle-button"), L.el_.appendChild(ee(M.RecordButton, "ul-recorder-toggle"));
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 = Le(i, [g, y, "PlayToggle", L, "FullscreenToggle"]), _ = Y.children().find((p) => p.name_ === "FullscreenToggle");
876
- _.hasClass("vjs-disabled") && _.hide();
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(), g.addClass(I), Pe(i, Y, s, !1, l), i.on("stopRecord", () => {
879
- L.hide(), O.show(), _.show(), g.removeClass(I);
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
- L.show(), O.hide(), g.addClass(I);
882
- }), ((p, f, b, x, C) => {
883
- const { surveyId: N, responseGroupUid: q, visitorId: P, envId: B } = p.payload;
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"), b && b(w.ERROR, { type: w.PERMISSION_DENIED }), $({ event: "Video Permission Denied", apiBase: f, headers: C, visitorId: P, envId: B, metadata: { questionId: ie(p, oe), responseGroupUid: q, surveyId: N } })) : (b && b(w.ERROR, { type: w.OTHER }), V(new Error(p.deviceErrorCode.message), "recorderDeviceError", f, C, P, B));
886
- }), p.on("error", function(Z, U) {
887
- V(U || p.error(), "recorderError", f, C, P, B);
888
- }), p.on("startRecord", function(Z, U) {
889
- x(p.uploadProgressLabel, "none"), $({ event: "Video Record Start", apiBase: f, headers: C, visitorId: P, envId: B, metadata: { questionId: ie(p, oe), responseGroupUid: q, surveyId: N } });
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
- x(p.uploadProgressLabel, "start", 0);
888
+ k(p.uploadProgressLabel, "start", 0);
892
889
  const Z = ie(p, oe);
893
- if (!N) {
890
+ if (!U) {
894
891
  const H = "internal error: missing fields in payload";
895
- return b && b(w.ERROR, { type: w.OTHER }), V(new Error(H), "finishRecord", f, C, P, B), null;
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 U = p.cameraOff ? w.MEDIA_TYPE_AUDIO : w.MEDIA_TYPE_VIDEO, A = Ve();
899
- $({ event: "Video Record Finish", apiBase: f, headers: C, visitorId: P, envId: B, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: U } });
900
- const J = { surveyId: N, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: U, mediaRecordingUid: A };
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 Q = await (async () => {
903
- const H = await fetch(`${f}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(J) });
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 b && b(w.UPLOAD_STARTED, { [w.UPLOAD_ID]: pe.upload.id, [w.MEDIA_TYPE]: U, [w.MEDIA_RECORDING_UID]: A }), pe.upload.url;
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 b && b(w.ERROR, { type: w.OTHER, response: H }), V(new Error("failed to get upload response with url"), "finishRecord", f, C, P, B), null;
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
- Q && (S = d.document.defaultView.UpChunk.createUpload({ endpoint: Q, file: new d.document.defaultView.File([p.recordedData], `recording ${U} ${Date.now()}`), chunkSize: 5120 }), S.startTime = Date.now(), $({ event: "Video Upload Start", apiBase: f, headers: C, visitorId: P, envId: B, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: U, url: Q } }), S.on("error", (H) => {
911
- x(p.uploadProgressLabel, "none"), b && b(w.UPLOAD_FINISHED, { [w.MEDIA_RECORDING_UID]: A }), V(H, "finishRecord", f, C, P, B);
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
- b && b(w.UPLOAD_PROGRESS, { [w.MEDIA_RECORDING_UID]: A, [w.UPLOAD_PROGRESS_PCT]: H.detail }), x(p.uploadProgressLabel, "progress", H.detail);
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
- x(p.uploadProgressLabel, "success"), b && b(w.UPLOAD_FINISHED, { [w.MEDIA_RECORDING_UID]: A }), $({ event: "Video Upload Success", apiBase: f, headers: C, visitorId: P, envId: B, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: N, mediaType: U, url: Q, elapsedMs: S.startTime && Date.now() - S.startTime } });
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, a);
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 f;
922
- return (f = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : f.query(p);
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((f, b) => f & b.state === "granted", !0) && i && (i.deviceButton && i.deviceButton.hide(), i.record().getDevice());
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
- }, Me = (e, n = 3) => {
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
- Me(e, n - 1);
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
- }, Qe = (e, n) => {
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
- }, ne = (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, a = null, l = null) => {
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 + Ie, c = Re(i);
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
- }), Te(ke, () => {
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 j = e + ge;
960
- le(j, c);
961
- const D = ne(i, m), T = ne(j, { muted: !0, ...m });
962
- if (!D || !T) return;
963
- ((g, E, k) => {
964
- g.addClass(`ul${ge}`);
965
- const y = new (d.videojs.getComponent("Component"))(g);
966
- E && g.src(E), g.addChild(y), k && k(g);
967
- })(T, a, l), a || T.addClass(I);
968
- const v = Le(D, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), h = v.children().find((g) => g.name_ === "FullscreenToggle");
969
- h.hasClass("vjs-disabled") && h.hide(), Pe(D, v, n, o, t, T);
970
- } catch (j) {
971
- return void V(new Error(`Error when creating video player object ${j}`), "playerDeviceError", r, {});
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, a = !1, l = document) => {
975
- d.document = l;
976
- const i = e + De, c = Re(i);
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
- }), Te(ke.concat(Ye), () => {
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, a);
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 + De;
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 = ne(e + Ie);
995
+ const n = ee(e + ke);
999
996
  n == null || n.pause();
1000
- }, Xe = (e) => {
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
- }, 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" }, M = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" };
1006
- var en = ((e) => (e.CONTINUE = "CONTINUE", e.EXTERNAL = "EXTERNAL", e.NO_BUTTON = "NO_BUTTON", e))(en || {}), nn = ((e) => (e.Unlimited = "Unlimited", e.Maximum = "Maximum", e.Range = "Range", e))(nn || {});
1007
- const on = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: r, dropdownFooter: s }) => {
1008
- const { themeColor: a } = F((l) => ({ doc: l.viewDocument, themeColor: l.border }));
1009
- return u("div", { className: "select-list", children: [e.map((l) => {
1010
- return u("div", { "aria-disabled": r == null ? void 0 : r.includes(l), className: R("select-option", r != null && r.includes(l) ? "ul-choice-disabled" : ""), onClick: (c) => {
1011
- r != null && r.includes(l) || (n(l), c.stopPropagation());
1012
- }, role: "option", style: { ...r != null && r.includes(l) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && u(Ee, { divId: (i = l.id, `checkbox-div-${i}`), id: l.id, isSelected: o.includes(l), themeColor: a }), l.label] }, l.id);
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: a = [], dropdownFooter: l }) => {
1016
- const [i, c] = ae(!1), { viewDocument: m, update: j, isConversationalUI: D } = F((h) => ({ viewDocument: h.viewDocument, update: h.update, isConversationalUI: h.isConversationalUI })), T = () => {
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
- D || j();
1021
- }, [i, D, j]), K(() => {
1022
- var g;
1023
- const h = (E) => {
1024
- const k = E.target;
1025
- (k == null ? void 0 : k.closest(".select-option.ul-choice-disabled")) || c(!1);
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", h);
1024
+ m.addEventListener("click", v);
1028
1025
  try {
1029
- (g = window.parent) == null || g.addEventListener("click", h);
1026
+ (h = window.parent) == null || h.addEventListener("click", v);
1030
1027
  } catch {
1031
- window.addEventListener("click", h);
1028
+ window.addEventListener("click", v);
1032
1029
  }
1033
1030
  return () => {
1034
- var E;
1035
- m.removeEventListener("click", h);
1031
+ var f;
1032
+ m.removeEventListener("click", v);
1036
1033
  try {
1037
- (E = window.parent) == null || E.removeEventListener("click", h);
1034
+ (f = window.parent) == null || f.removeEventListener("click", v);
1038
1035
  } catch {
1039
- window.removeEventListener("click", h);
1036
+ window.removeEventListener("click", v);
1040
1037
  }
1041
1038
  };
1042
1039
  }, [m]);
1043
- const v = s.length === 0 ? ["select-button-placeholder"] : [];
1044
- return u(we, { children: [u("button", { "aria-label": "choice dropdown button", className: R("select-button", ...v), onClick: (h) => {
1045
- h.stopPropagation(), T();
1046
- }, type: "button", children: [u("span", { children: s.length === 0 ? r : s.length === 1 ? s[0].label : `${s.length} ${n}` }), u(Be, {})] }), i && u(on, { disabledOptions: a, dropdownFooter: l, options: t, selectedOptions: s, selectItem: (h) => {
1047
- var k;
1048
- const g = s.some((y) => y.id === h.id), E = s.some((y) => {
1049
- var L;
1050
- return (L = y.optionProperties) == null ? void 0 : L.noneOfTheAbove;
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
- (k = h.optionProperties) != null && k.noneOfTheAbove && !g ? o([h]) : e ? o(g ? s.filter((y) => y.id !== h.id) : E ? [h] : [...s, h]) : g || o([h]), e || T();
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
- }, tn = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, Cn = (e = void 0, n = {}) => {
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 = ((a) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(a) ? a : `http://${a}`)(e);
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 a = new URL(t);
1060
- if (!a.protocol || !o.includes(a.protocol)) return;
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 = ((a, l, i) => {
1065
- let c = a;
1066
- for (const [m, j] of Object.entries(tn)) if (c.toLowerCase().includes(m)) if (l[j]) {
1067
- const D = new RegExp(m, "gi");
1068
- c = c.replace(D, l[j]);
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 : ((a, l) => {
1073
- if (!a.includes("?")) return a;
1074
- const i = a.slice(0, a.indexOf("?")), c = a.slice(a.indexOf("?") + 1).split("&").map((m) => m.split("=")).filter((m) => !l.includes(m[1]));
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
- Ae as H,
1077
+ $e as H,
1081
1078
  dn as L,
1082
1079
  cn as M,
1083
1080
  pn as O,
1084
- en as P,
1081
+ Xe as P,
1085
1082
  vn as Q,
1086
- w as R,
1083
+ x as R,
1087
1084
  fn as S,
1088
1085
  un as a,
1089
- nn as b,
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
- qe as u,
1092
+ ze as u,
1096
1093
  hn as v
1097
1094
  };