@sprig-technologies/sprig-browser 2.44.0 → 2.45.0

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.
@@ -1,50 +1,50 @@
1
- import { u as v, c as _, a as U, F as Me, h as de, p as J, _ as K, g as Ce, S as Oe, b as le, y as ue, d as Be } from "./view-MpYHLeMt.js";
2
- import { g as He, i as Se, E as Ve, b as ye } from "./core-CWHAsU-S.js";
1
+ import { u, c as _, a as $, F as Me, h as de, p as J, _ as K, g as Ce, S as Oe, b as le, y as ue, d as Be } from "./view-CDrJuRMn.js";
2
+ import { g as He, i as Se, E as Ve, b as ye } from "./core-YTxB8B8q.js";
3
3
  import { d as Ue } from "./debounce-CMb8f7wh.js";
4
- import { v as Fe } from "./metricsReporter-Bg5aC8mO.js";
5
- const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.className), id: "ul-card-text__button" }), $e = ({ html: e, ...n }) => {
6
- const { enableCspTrustedTypes: o } = U((r) => ({ enableCspTrustedTypes: r.enableCspTrustedTypes })), t = Me(() => He(e, o), [o, e]);
7
- return v("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
4
+ import { v as Fe } from "./metricsReporter-0HbKrvkx.js";
5
+ const Ne = (e) => u("button", { ...e, className: _("ul-card-text__button", e.className), id: "ul-card-text__button" }), $e = ({ html: e, ...n }) => {
6
+ const { enableCspTrustedTypes: o } = $((i) => ({ enableCspTrustedTypes: i.enableCspTrustedTypes })), t = Me(() => He(e, o), [o, e]);
7
+ return u("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
8
8
  }, xe = () => {
9
- const { viewDocument: e } = U((t) => ({ viewDocument: t.viewDocument })), [n, o] = de(!1);
9
+ const { viewDocument: e } = $((t) => ({ viewDocument: t.viewDocument })), [n, o] = de(!1);
10
10
  return J(() => {
11
- const t = e.querySelector(".sprig-question-body"), r = new ResizeObserver(() => {
11
+ const t = e.querySelector(".sprig-question-body"), i = new ResizeObserver(() => {
12
12
  window.requestAnimationFrame(() => {
13
13
  o(!!(t && Se(t) && t.scrollHeight > t.offsetHeight));
14
14
  });
15
15
  });
16
- return t && r.observe(t), () => {
17
- t && r.disconnect();
16
+ return t && i.observe(t), () => {
17
+ t && i.disconnect();
18
18
  };
19
19
  }, [e]), n;
20
- }, ve = ({ plainText: e, richText: n, id: o, className: t, isHeader: r, showAsterisk: s }) => n ? v($e, { className: t, html: n, id: o }) : e ? r ? v("h1", { className: t, id: o, children: [e, s && "*"] }) : v("p", { className: t, id: o, children: e }) : null, sn = ({ message: e, properties: n, isRequired: o }) => {
21
- const t = K(null), r = n == null ? void 0 : n.captionText, s = xe();
22
- return v("div", { className: _("question-header-container", "sprig-header-container", s ? "sprig-border-bottom" : null), ref: t, children: [v("div", { className: "question-header-button-container", children: v(ve, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: n == null ? void 0 : n.questionHtml, showAsterisk: o }) }), v(ve, { className: "ul-caption", id: "ul-caption", plainText: r, richText: n == null ? void 0 : n.captionHtml })] });
23
- }, Ae = () => v("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: v("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), ln = ({ isSubmitDisabled: e, handleSubmit: n }) => v("div", { className: "ul-card-longform__submit-button-container", children: v(Ne, { className: "ul-card-longform__submit-button", disabled: e, onClick: n, children: ["OK ", v(Ae, {})] }) }), ze = (e, n) => {
20
+ }, ve = ({ plainText: e, richText: n, id: o, className: t, isHeader: i, showAsterisk: s }) => n ? u($e, { className: t, html: n, id: o }) : e ? i ? u("h1", { className: t, id: o, children: [e, s && "*"] }) : u("p", { className: t, id: o, children: e }) : null, rn = ({ message: e, properties: n, isRequired: o }) => {
21
+ const t = K(null), i = n == null ? void 0 : n.captionText, s = xe();
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(ve, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: n == null ? void 0 : n.questionHtml, showAsterisk: o }) }), u(ve, { className: "ul-caption", id: "ul-caption", plainText: i, 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" }) }), sn = ({ isSubmitDisabled: e, handleSubmit: n }) => u("div", { className: "ul-card-longform__submit-button-container", children: u(Ne, { className: "ul-card-longform__submit-button", disabled: e, onClick: n, children: ["OK ", u(Ae, {})] }) }), ln = (e, n) => {
24
24
  const o = K(0);
25
25
  return () => {
26
26
  if (e.current) {
27
27
  const t = e.current;
28
28
  t.style.height = "1px";
29
- const r = t.scrollHeight + (t.offsetHeight - t.clientHeight), s = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), l = r <= s ? r : s;
29
+ const i = t.scrollHeight + (t.offsetHeight - t.clientHeight), s = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), l = i <= s ? i : s;
30
30
  o.current !== l && requestAnimationFrame(() => {
31
31
  n();
32
32
  }), o.current = l, t.style.height = `${l}px`;
33
33
  }
34
34
  };
35
35
  }, an = (e) => {
36
- const n = K(), { setAllResponsesRaw: o } = U((t) => ({ setAllResponsesRaw: t.setAllResponsesRaw }));
36
+ const n = K(), { setAllResponsesRaw: o } = $((t) => ({ setAllResponsesRaw: t.setAllResponsesRaw }));
37
37
  J(() => {
38
38
  const t = n.current;
39
- (!t || Object.keys(e).length !== Object.keys(t).length || Object.keys(e).some((r) => e[r] !== t[r])) && (o(e), n.current = e);
39
+ (!t || Object.keys(e).length !== Object.keys(t).length || Object.keys(e).some((i) => e[i] !== t[i])) && (o(e), n.current = e);
40
40
  }, [e, o]);
41
- }, he = ({ buttonText: e = "View Prototype", handleClick: n }) => v("button", { className: "prototype-button", onClick: n, children: e }, "prototype-btn"), dn = ({ embeddedType: e = "prototype", properties: n, children: o }) => {
41
+ }, he = ({ buttonText: e = "View Prototype", handleClick: n }) => u("button", { className: "prototype-button", onClick: n, children: e }, "prototype-btn"), dn = ({ embeddedType: e = "prototype", properties: n, children: o }) => {
42
42
  var I;
43
- const { handleClickEmbedButton: t, hasViewedEmbed: r, headers: s, useDesktopPrototype: l } = U((g) => ({ handleClickEmbedButton: g.handleClickEmbedButton, hasViewedEmbed: g.hasViewedEmbed, headers: g.headers, useDesktopPrototype: g.useDesktopPrototype })), c = (n == null ? void 0 : n.conceptUrl) || ((I = n == null ? void 0 : n.consentDocument) == null ? void 0 : I.url), i = window.innerWidth < Ve, p = s["userleap-platform"], h = (g, T) => {
43
+ const { handleClickEmbedButton: t, hasViewedEmbed: i, headers: s, useDesktopPrototype: l } = $((g) => ({ handleClickEmbedButton: g.handleClickEmbedButton, hasViewedEmbed: g.hasViewedEmbed, headers: g.headers, useDesktopPrototype: g.useDesktopPrototype })), v = (n == null ? void 0 : n.conceptUrl) || ((I = n == null ? void 0 : n.consentDocument) == null ? void 0 : I.url), r = window.innerWidth < Ve, c = s["userleap-platform"], h = (g, T) => {
44
44
  g.preventDefault(), t(T);
45
45
  };
46
46
  if ((() => {
47
- const { update: g, index: T, isConversationalUI: f, viewDocument: L } = U(({ update: w, index: j, isConversationalUI: b, viewDocument: k }) => ({ update: w, index: j, isConversationalUI: b, viewDocument: k })), d = Ue(g, 100);
47
+ const { update: g, index: T, isConversationalUI: f, viewDocument: L } = $(({ update: w, index: j, isConversationalUI: b, viewDocument: k }) => ({ update: w, index: j, isConversationalUI: b, viewDocument: k })), d = Ue(g, 100);
48
48
  J(() => {
49
49
  if (f) return;
50
50
  const w = new ResizeObserver(d), j = L.querySelector(".ul-card__container");
@@ -52,22 +52,22 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
52
52
  w.disconnect();
53
53
  };
54
54
  }, [d, g, T, f, L]);
55
- })(), !l && i && !r && c && ["email", "link"].includes(p)) {
56
- if (e === "prototype") return v(he, { handleClick: (g) => {
55
+ })(), !l && r && !i && v && ["email", "link"].includes(c)) {
56
+ if (e === "prototype") return u(he, { handleClick: (g) => {
57
57
  h(g, "question.prototype.click");
58
58
  } });
59
- if (e === "pdf") return v(he, { buttonText: (n == null ? void 0 : n.viewDocumentText) || "View Document", handleClick: (g) => {
59
+ if (e === "pdf") return u(he, { buttonText: (n == null ? void 0 : n.viewDocumentText) || "View Document", handleClick: (g) => {
60
60
  h(g, "question.agreement.click");
61
61
  } });
62
62
  }
63
- return v(Ce, { children: o });
64
- }, je = ({ isSelected: e, id: n, divId: o, themeColor: t, disabled: r = !1 }) => v("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 && v(Oe, {}) }), cn = ({ ariaLabel: e, border: n, choiceStyle: o = {}, label: t, isSelected: r, value: s, text: l, id: c, isRadio: i, useMobileStyling: p, error: h, allowTextEntry: I, noneOfTheAbove: g, promptText: T, disabled: f = !1, onUserInputChanged: L }) => {
65
- const { styleNonce: d, viewDocument: w } = U((E) => ({ styleNonce: E.styleNonce, viewDocument: E.viewDocument })), [j, b] = de(!1);
66
- Ze(w, n, d);
63
+ return u(Ce, { children: o });
64
+ }, je = ({ isSelected: e, id: n, divId: o, themeColor: t, disabled: i = !1 }) => u("div", { "aria-checked": e, "aria-disabled": i, "aria-labelledby": `label-${n}`, className: "select-checkbox", id: o, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...i ? { opacity: 0.5 } : {} }, tabIndex: i ? -1 : 0, children: e && u(Oe, {}) }), cn = ({ ariaLabel: e, border: n, choiceStyle: o = {}, label: t, isSelected: i, value: s, text: l, id: v, isRadio: r, useMobileStyling: c, error: h, allowTextEntry: I, noneOfTheAbove: g, promptText: T, disabled: f = !1, onUserInputChanged: L }) => {
65
+ const { styleNonce: d, viewDocument: w } = $((E) => ({ styleNonce: E.styleNonce, viewDocument: E.viewDocument })), [j, b] = de(!1);
66
+ qe(w, n, d);
67
67
  const k = ({ isSelected: E, userText: y }) => {
68
- L && L({ id: c, selected: E, value: s, userText: y, noneOfTheAbove: g });
68
+ L && L({ id: v, selected: E, value: s, userText: y, noneOfTheAbove: g });
69
69
  }, M = (E) => {
70
- f || (E.stopPropagation(), k({ isSelected: i || !r, userText: l }), b(!1));
70
+ f || (E.stopPropagation(), k({ isSelected: r || !i, userText: l }), b(!1));
71
71
  }, Y = () => {
72
72
  j || b(!0);
73
73
  }, O = () => {
@@ -76,23 +76,23 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
76
76
  f || y.key !== "Enter" && y.key !== " " || M(y);
77
77
  })(E) };
78
78
  "ontouchstart" in w.documentElement ? (B.onTouchStart = O, B.onTouchCancel = O, B.onTouchEnd = O) : (B.onMouseDown = Y, B.onMouseLeave = O);
79
- const W = i ? `radio-${c}` : `checkbox-${c}`, u = r || j ? [ee] : [], C = [...h ? [Ee] : [], ...u, ...f ? ["ul-choice-disabled"] : []], m = t ? { "aria-labelledby": `label-${c}` } : { "aria-label": e };
80
- return v("div", { className: _(le("choice", p), ...C), id: `choice-div-${c}`, style: { ...o, ...h ? { borderColor: ye } : {}, ...f ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...f ? {} : B, "aria-disabled": f, children: [v("div", { className: _("choice-label-container"), children: [i ? v("div", { ...m, className: _("select-radio", ...u), id: W, role: "radio", tabIndex: 0 }) : v(je, { disabled: f, divId: W, id: c, isSelected: r, themeColor: n }), t && v("label", { className: _(le("select-label", p)), htmlFor: W, id: `label-${c}`, children: t })] }), I && r && v("div", { className: _("choice-text-entry-container", ...u), children: v(qe, { onTextChange: (E) => k({ isSelected: r, userText: E }), promptText: T || "Please specify", textValue: l, useMobileStyling: p }) })] });
81
- }, qe = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
82
- const r = K(null), { update: s } = U((c) => ({ update: c.update })), l = ze(r, () => s());
83
- return J(() => (l(), r.current && r.current.focus(), () => {
84
- s();
85
- }), []), v("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: _(le("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (c) => {
86
- l(), c.stopPropagation(), o(c.currentTarget.value);
87
- }, onClick: (c) => {
88
- c.stopPropagation();
89
- }, onKeyPress: (c) => {
90
- c.stopPropagation();
91
- }, placeholder: e, ref: r, role: "textbox", rows: 1, value: n });
92
- }, me = "ul-select-style-element", ee = "ul-select-active-dynamic-style", Ee = "ul-select-error-dynamic-style", Ze = (e, n, o) => {
93
- let t = e.getElementById(me), r = !1;
94
- t || (t = e.createElement("style"), r = !0), t.tagName.toLowerCase() === "style" && (t.id = me, o && (t.nonce = o), t.textContent = Ge(n), r && e.head.appendChild(t));
95
- }, Ge = (e) => `
79
+ const W = r ? `radio-${v}` : `checkbox-${v}`, p = i || j ? [ee] : [], C = [...h ? [Ee] : [], ...p, ...f ? ["ul-choice-disabled"] : []], m = t ? { "aria-labelledby": `label-${v}` } : { "aria-label": e };
80
+ return u("div", { className: _(le("choice", c), ...C), id: `choice-div-${v}`, style: { ...o, ...h ? { borderColor: ye } : {}, ...f ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...f ? {} : B, "aria-disabled": f, children: [u("div", { className: _("choice-label-container"), children: [r ? u("div", { ...m, className: _("select-radio", ...p), id: W, role: "radio", tabIndex: 0 }) : u(je, { disabled: f, divId: W, id: v, isSelected: i, themeColor: n }), t && u("label", { className: _(le("select-label", c)), htmlFor: W, id: `label-${v}`, children: t })] }), I && i && u("div", { className: _("choice-text-entry-container", ...p), children: u(ze, { onTextChange: (E) => k({ isSelected: i, userText: E }), promptText: T || "Please specify", textValue: l, useMobileStyling: c }) })] });
81
+ }, ze = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
82
+ const i = K(null);
83
+ return J(() => {
84
+ i.current && i.current.focus();
85
+ }, []), u("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: _(le("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (s) => {
86
+ s.stopPropagation(), o(s.currentTarget.value);
87
+ }, onClick: (s) => {
88
+ s.stopPropagation();
89
+ }, onKeyPress: (s) => {
90
+ s.stopPropagation();
91
+ }, placeholder: e, ref: i, role: "textbox", rows: 1, value: n });
92
+ }, me = "ul-select-style-element", ee = "ul-select-active-dynamic-style", Ee = "ul-select-error-dynamic-style", qe = (e, n, o) => {
93
+ let t = e.getElementById(me), i = !1;
94
+ t || (t = e.createElement("style"), i = !0), t.tagName.toLowerCase() === "style" && (t.id = me, o && (t.nonce = o), t.textContent = Ze(n), i && e.head.appendChild(t));
95
+ }, Ze = (e) => `
96
96
  .${ee} {
97
97
  border-color: ${e};
98
98
  }
@@ -103,30 +103,30 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
103
103
  .${Ee} {
104
104
  border-color: ${ye};
105
105
  }
106
- `, pn = ({ children: e }) => v("div", { className: "sprig-question-body", children: e }), un = ({ children: e }) => {
107
- const n = xe(), { isConversationalUI: o } = U((t) => ({ isConversationalUI: t.isConversationalUI }));
108
- return v("div", { className: _("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
109
- }, We = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: r, dropdownFooter: s, panelRef: l }) => {
110
- const { themeColor: c } = U((i) => ({ doc: i.viewDocument, themeColor: i.border }));
111
- return v("div", { className: "select-list", ref: l, children: [e.map((i) => {
112
- return v("div", { "aria-disabled": r == null ? void 0 : r.includes(i), className: _("select-option", r != null && r.includes(i) ? "ul-choice-disabled" : ""), onClick: (h) => {
113
- r != null && r.includes(i) || (n(i), h.stopPropagation());
114
- }, role: "option", style: { ...r != null && r.includes(i) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && v(je, { divId: (p = i.id, `checkbox-div-${p}`), id: i.id, isSelected: o.includes(i), themeColor: c }), i.label] }, i.id);
115
- var p;
106
+ `, pn = ({ children: e }) => u("div", { className: "sprig-question-body", children: e }), un = ({ children: e }) => {
107
+ const n = xe(), { isConversationalUI: o } = $((t) => ({ isConversationalUI: t.isConversationalUI }));
108
+ return u("div", { className: _("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
109
+ }, Ge = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: i, dropdownFooter: s, panelRef: l }) => {
110
+ const { themeColor: v } = $((r) => ({ doc: r.viewDocument, themeColor: r.border }));
111
+ return u("div", { className: "select-list", ref: l, children: [e.map((r) => {
112
+ return u("div", { "aria-disabled": i == null ? void 0 : i.includes(r), className: _("select-option", i != null && i.includes(r) ? "ul-choice-disabled" : ""), onClick: (h) => {
113
+ i != null && i.includes(r) || (n(r), h.stopPropagation());
114
+ }, role: "option", style: { ...i != null && i.includes(r) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && u(je, { divId: (c = r.id, `checkbox-div-${c}`), id: r.id, isSelected: o.includes(r), themeColor: v }), r.label] }, r.id);
115
+ var c;
116
116
  }), s] });
117
- }, vn = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: o, options: t, placeholderText: r, value: s, disabledOptions: l = [], dropdownFooter: c }) => {
118
- const [i, p] = de(!1), h = K(null), { viewDocument: I, update: g, isConversationalUI: T } = U((d) => ({ viewDocument: d.viewDocument, update: d.update, isConversationalUI: d.isConversationalUI })), f = () => {
119
- p(!i);
117
+ }, vn = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: o, options: t, placeholderText: i, value: s, disabledOptions: l = [], dropdownFooter: v }) => {
118
+ const [r, c] = de(!1), h = K(null), { viewDocument: I, update: g, isConversationalUI: T } = $((d) => ({ viewDocument: d.viewDocument, update: d.update, isConversationalUI: d.isConversationalUI })), f = () => {
119
+ c(!r);
120
120
  };
121
121
  ue(() => {
122
122
  T || g();
123
- }, [i, T, g]), ue(() => {
124
- i && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
125
- }, [i]), J(() => {
123
+ }, [r, T, g]), ue(() => {
124
+ r && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
125
+ }, [r]), J(() => {
126
126
  var w;
127
127
  const d = (j) => {
128
128
  const b = j.target;
129
- (b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) || p(!1);
129
+ (b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) || c(!1);
130
130
  };
131
131
  I.addEventListener("click", d);
132
132
  try {
@@ -145,9 +145,9 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
145
145
  };
146
146
  }, [I]);
147
147
  const L = s.length === 0 ? ["select-button-placeholder"] : [];
148
- return v(Ce, { children: [v("button", { "aria-label": "choice dropdown button", className: _("select-button", ...L), onClick: (d) => {
148
+ return u(Ce, { children: [u("button", { "aria-label": "choice dropdown button", className: _("select-button", ...L), onClick: (d) => {
149
149
  d.stopPropagation(), f();
150
- }, type: "button", children: [v("span", { children: s.length === 0 ? r : s.length === 1 ? s[0].label : `${s.length} ${n}` }), v(Be, {})] }), i && v(We, { disabledOptions: l, dropdownFooter: c, options: t, panelRef: h, selectedOptions: s, selectItem: (d) => {
150
+ }, type: "button", children: [u("span", { children: s.length === 0 ? i : s.length === 1 ? s[0].label : `${s.length} ${n}` }), u(Be, {})] }), r && u(Ge, { disabledOptions: l, dropdownFooter: v, options: t, panelRef: h, selectedOptions: s, selectItem: (d) => {
151
151
  var b;
152
152
  const w = s.some((k) => k.id === d.id), j = s.some((k) => {
153
153
  var M;
@@ -155,7 +155,7 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
155
155
  });
156
156
  (b = d.optionProperties) != null && b.noneOfTheAbove && !w ? o([d]) : e ? o(w ? s.filter((k) => k.id !== d.id) : j ? [d] : [...s, d]) : w || o([d]), e || f();
157
157
  }, showCheckbox: e })] });
158
- }, Ye = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, hn = (e = void 0, n = {}) => {
158
+ }, We = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, hn = (e = void 0, n = {}) => {
159
159
  if (!e) return e;
160
160
  const o = ["http:", "https:", "itms-apps:", "market:"], t = ((l) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(l) ? l : `http://${l}`)(e);
161
161
  if (!t) return;
@@ -165,20 +165,20 @@ const Ne = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
165
165
  } catch {
166
166
  return;
167
167
  }
168
- const r = [], s = ((l, c, i) => {
169
- let p = l;
170
- for (const [h, I] of Object.entries(Ye)) if (p.toLowerCase().includes(h)) if (c[I]) {
168
+ const i = [], s = ((l, v, r) => {
169
+ let c = l;
170
+ for (const [h, I] of Object.entries(We)) if (c.toLowerCase().includes(h)) if (v[I]) {
171
171
  const g = new RegExp(h, "gi");
172
- p = p.replace(g, c[I]);
173
- } else i.push(h);
174
- return p;
175
- })(t, n, r);
176
- return r.length === 0 ? s : ((l, c) => {
172
+ c = c.replace(g, v[I]);
173
+ } else r.push(h);
174
+ return c;
175
+ })(t, n, i);
176
+ return i.length === 0 ? s : ((l, v) => {
177
177
  if (!l.includes("?")) return l;
178
- const i = l.slice(0, l.indexOf("?")), p = l.slice(l.indexOf("?") + 1).split("&").map((h) => h.split("=")).filter((h) => !c.includes(h[1]));
179
- return p.length === 0 ? i : `${i}?${p.map((h) => h.join("=")).join("&")}`;
180
- })(s, r);
181
- }, G = "https://cdn.sprig.com", a = { document: void 0, videojs: void 0 }, ce = (e) => e + "-loading-spiner", D = "hidden", ge = ".m3u8", te = "questionId", re = "ul-video-recorder-camera-off-button", ie = "ul-recording-in-session", Je = [{ 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 */
178
+ const r = l.slice(0, l.indexOf("?")), c = l.slice(l.indexOf("?") + 1).split("&").map((h) => h.split("=")).filter((h) => !v.includes(h[1]));
179
+ return c.length === 0 ? r : `${r}?${c.map((h) => h.join("=")).join("&")}`;
180
+ })(s, i);
181
+ }, G = "https://cdn.sprig.com", a = { document: void 0, videojs: void 0 }, ce = (e) => e + "-loading-spiner", D = "hidden", ge = ".m3u8", te = "questionId", re = "ul-video-recorder-camera-off-button", ie = "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 */
182
182
  .video-js .vjs-control {
183
183
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
184
184
  }
@@ -837,24 +837,24 @@ span.ul-button-text {
837
837
  }
838
838
  ` }], Ie = "-video-player", be = "-secondary-video-player", De = "-video-recorder";
839
839
  let V, fe;
840
- const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, metadata: s }) => {
840
+ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, metadata: s }) => {
841
841
  const l = a.document.documentElement;
842
- if (!t || !r) return;
843
- const c = { 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 } };
844
- (await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(c) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
845
- }, $ = async (e, n, o, t, r, s) => {
846
- z({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId: r, envId: s, metadata: { errorMessage: e.message } });
847
- const l = a.document.documentElement, c = { 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: c, vid: r, envId: s };
848
- (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);
842
+ if (!t || !i) return;
843
+ const v = { event: `SDK - ${e}`, visitorId: t, environmentId: i, metadata: { ...s || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language } };
844
+ (await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(v) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
845
+ }, N = async (e, n, o, t, i, s) => {
846
+ z({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId: i, envId: s, metadata: { errorMessage: e.message } });
847
+ const l = a.document.documentElement, v = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language }, r = { action: n, err: { message: e.message, stack: e.stack }, meta: v, vid: i, envId: s };
848
+ (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(r) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
849
849
  }, Te = (e, n) => {
850
850
  if (e.length === 0) return n && n();
851
- Promise.all(e.reduce((o, t) => (o.push(((r, { type: s, content: l }) => new Promise(function(c, i) {
852
- let p;
853
- s === "script" ? (p = a.document.createElement("script"), p.src = l) : s === "link" ? (p = a.document.createElement("link"), p.rel = "stylesheet", p.href = l, p.type = "text/css") : (p = a.document.createElement("style"), p.innerHTML = l), p.onload = function() {
854
- c(l);
855
- }, p.onerror = function() {
856
- i(l);
857
- }, p.async = !1, p.id = btoa(l), r.appendChild(p);
851
+ Promise.all(e.reduce((o, t) => (o.push(((i, { type: s, content: l }) => new Promise(function(v, r) {
852
+ let c;
853
+ s === "script" ? (c = a.document.createElement("script"), c.src = l) : s === "link" ? (c = a.document.createElement("link"), c.rel = "stylesheet", c.href = l, c.type = "text/css") : (c = a.document.createElement("style"), c.innerHTML = l), c.onload = function() {
854
+ v(l);
855
+ }, c.onerror = function() {
856
+ r(l);
857
+ }, c.async = !1, c.id = btoa(l), i.appendChild(c);
858
858
  }))(a.document.head, t)), o), [])).then(() => {
859
859
  a.videojs = a.document.defaultView.videojs, n && n();
860
860
  }).catch(function(o) {
@@ -874,8 +874,8 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
874
874
  const o = new (a.videojs.getComponent("Component"))(e);
875
875
  return o.addClass("ul-buttons-panel"), n.map((t) => {
876
876
  o.addChild(t);
877
- }), Ke(o), o;
878
- }, Ke = (e) => {
877
+ }), Je(o), o;
878
+ }, Je = (e) => {
879
879
  e.children().forEach((n) => {
880
880
  if (P[n.name_]) {
881
881
  const o = ne(P[n.name_], `ul-${P[n.name_]}`);
@@ -885,13 +885,13 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
885
885
  }, ne = (e, n = "") => {
886
886
  const o = a.document.createElement("span");
887
887
  return o.className = "ul-button-text", o.innerHTML = e, o.id = n, o;
888
- }, Re = (e, n, o, t, r = !1, s) => {
888
+ }, Re = (e, n, o, t, i = !1, s) => {
889
889
  e.addClass("ul-video-player");
890
890
  const l = new (a.videojs.getComponent("Component"))(e);
891
891
  l.addClass("ul-control-panel"), e.progressBar = l.addChild("ProgressControl"), o && e.src(o), e.audioPlayerPlaceholder = new (a.videojs.getComponent("Component"))(e), e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
892
- const c = o && o.src ? en(o.src) : null;
893
- !o || !r && c ? (e.audioPlayerPlaceholder.hide(), a.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", c && e.poster(c)) : (e.children()[0].classList.add("vjs-hidden"), a.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
894
- r || !o || c || Xe(e), s == null || s.play();
892
+ const v = o && o.src ? Xe(o.src) : null;
893
+ !o || !i && v ? (e.audioPlayerPlaceholder.hide(), a.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", v && e.poster(v)) : (e.children()[0].classList.add("vjs-hidden"), a.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
894
+ i || !o || v || Qe(e), s == null || s.play();
895
895
  }), e.on("pause", () => {
896
896
  s == null || s.pause();
897
897
  }), e.on("seeked", () => {
@@ -899,105 +899,105 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
899
899
  }), e.on("ratechange", () => {
900
900
  s == null || s.playbackRate(e.playbackRate());
901
901
  }), e.addChild(e.audioPlayerPlaceholder, {}, 1), l.addChild(n), e.addChild(l), t && t(e);
902
- }, Qe = (e, n, o, t, r, s, l, c = !1) => {
902
+ }, Ke = (e, n, o, t, i, s, l, v = !1) => {
903
903
  fe = Date.now();
904
- const i = oe(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 } } });
905
- if (!i) return;
906
- i.payload = o;
907
- const { surveyId: p, questionId: h, responseGroupUid: I, visitorId: g, envId: T } = o;
904
+ const r = oe(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 } } });
905
+ if (!r) return;
906
+ r.payload = o;
907
+ const { surveyId: c, questionId: h, responseGroupUid: I, visitorId: g, envId: T } = o;
908
908
  let f;
909
- const L = (u) => {
909
+ const L = (p) => {
910
910
  const C = re, m = re + "-audio-only";
911
- we(i.uploadProgressLabel, "none"), V && V.startTime >= fe && V.abort();
911
+ we(r.uploadProgressLabel, "none"), V && V.startTime >= fe && V.abort();
912
912
  const E = a.document.getElementById("ul-camera-button");
913
- u ? (i.children()[0].classList.add("vjs-hidden"), b.removeClass(C), b.addClass(m), E.innerHTML = P.TurnOnCamera, i.audioPlayerPlaceholder.removeClass("vjs-hidden"), f == null || f.getTracks().forEach((y) => {
913
+ p ? (r.children()[0].classList.add("vjs-hidden"), b.removeClass(C), b.addClass(m), E.innerHTML = P.TurnOnCamera, r.audioPlayerPlaceholder.removeClass("vjs-hidden"), f == null || f.getTracks().forEach((y) => {
914
914
  y.stop();
915
915
  }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((y) => {
916
- f = y, y.getVideoTracks().forEach((F) => {
917
- F.enabled = !1;
918
- }), i.record().onDeviceReady(y);
919
- }).catch(i.record().onDeviceError.bind(i.record()))) : (f == null || f.getVideoTracks().forEach((y) => {
916
+ f = y, y.getVideoTracks().forEach((U) => {
917
+ U.enabled = !1;
918
+ }), r.record().onDeviceReady(y);
919
+ }).catch(r.record().onDeviceError.bind(r.record()))) : (f == null || f.getVideoTracks().forEach((y) => {
920
920
  y.enabled = !0;
921
- }), i.children()[0].classList.remove("vjs-hidden"), i.record().getDevice(), b.removeClass(m), b.addClass(C), E.innerHTML = P.TurnOffCamera, i.audioPlayerPlaceholder.addClass("vjs-hidden"));
922
- }, d = new (a.videojs.getComponent("Button"))(i, { clickHandler: () => {
923
- d.hasClass(D) || (z({ event: "Video Delete Button Clicked", apiBase: t, headers: l, visitorId: g, envId: T, metadata: { questionId: h, responseGroupUid: I, surveyId: p } }), L(i.cameraOff), r(x.DELETE, {}), b.removeClass(D), d.addClass(D));
921
+ }), r.children()[0].classList.remove("vjs-hidden"), r.record().getDevice(), b.removeClass(m), b.addClass(C), E.innerHTML = P.TurnOffCamera, r.audioPlayerPlaceholder.addClass("vjs-hidden"));
922
+ }, d = new (a.videojs.getComponent("Button"))(r, { clickHandler: () => {
923
+ d.hasClass(D) || (z({ event: "Video Delete Button Clicked", apiBase: t, headers: l, visitorId: g, envId: T, metadata: { questionId: h, responseGroupUid: I, surveyId: c } }), L(r.cameraOff), i(x.DELETE, {}), b.removeClass(D), d.addClass(D));
924
924
  } });
925
925
  d.addClass("ul-video-recorder-delete-button"), d.el_.appendChild(ne(P.DeleteButton, "ul-delete-button"));
926
926
  const w = a.document.getElementById(n), j = () => {
927
- w.classList.contains("vjs-fullscreen") && i.cameraOff ? w.style.display = "table" : w.style.display = "flex";
927
+ w.classList.contains("vjs-fullscreen") && r.cameraOff ? w.style.display = "table" : w.style.display = "flex";
928
928
  };
929
929
  j();
930
- const b = new (a.videojs.getComponent("Button"))(i, { clickHandler: () => {
931
- i.record().isRecording() || (i.cameraOff = !i.cameraOff, z({ event: "Video Camera Button Clicked", apiBase: t, headers: l, visitorId: o.visitorId, envId: o.envId, metadata: { questionId: h, responseGroupUid: I, surveyId: p, cameraOff: i.cameraOff } }), L(i.cameraOff), !d.hasClass(D) && d.addClass(D), r(x.DELETE, {}), j());
930
+ const b = new (a.videojs.getComponent("Button"))(r, { clickHandler: () => {
931
+ r.record().isRecording() || (r.cameraOff = !r.cameraOff, z({ event: "Video Camera Button Clicked", apiBase: t, headers: l, visitorId: o.visitorId, envId: o.envId, metadata: { questionId: h, responseGroupUid: I, surveyId: c, cameraOff: r.cameraOff } }), L(r.cameraOff), !d.hasClass(D) && d.addClass(D), i(x.DELETE, {}), j());
932
932
  } });
933
933
  b.addClass(re), b.el_.appendChild(ne(P.TurnOffCamera, "ul-camera-button"));
934
- const k = new (a.videojs.getComponent("Button"))(i, { clickHandler: () => {
935
- const u = a.document.getElementById("ul-recorder-toggle");
936
- if (i.record().isRecording()) i.record().stop(), u && (u.innerHTML = P.RecordButton), k.removeClass(ie), d.removeClass(D);
934
+ const k = new (a.videojs.getComponent("Button"))(r, { clickHandler: () => {
935
+ const p = a.document.getElementById("ul-recorder-toggle");
936
+ if (r.record().isRecording()) r.record().stop(), p && (p.innerHTML = P.RecordButton), k.removeClass(ie), d.removeClass(D);
937
937
  else {
938
938
  const C = a.document.getElementById("ul-recording-countdown-screen");
939
- if (C) C.remove(), u && (u.innerHTML = P.RecordButton), L(i.cameraOff), r(x.DELETE, {}), b.removeClass(D), d.addClass(D), k.removeClass(ie), O.show();
939
+ if (C) C.remove(), p && (p.innerHTML = P.RecordButton), L(r.cameraOff), i(x.DELETE, {}), b.removeClass(D), d.addClass(D), k.removeClass(ie), O.show();
940
940
  else {
941
- k.addClass(ie), O.hide(), b.addClass(D), d.addClass(D), u && (u.innerHTML = P.StopButton);
941
+ k.addClass(ie), O.hide(), b.addClass(D), d.addClass(D), p && (p.innerHTML = P.StopButton);
942
942
  const m = a.document.createElement("div");
943
- m.id = "ul-recording-countdown-screen", w.insertBefore(m, w.children[1]), m.style.height = `${w.offsetHeight}px`, Pe(i, 3);
943
+ m.id = "ul-recording-countdown-screen", w.insertBefore(m, w.children[1]), m.style.height = `${w.offsetHeight}px`, Pe(r, 3);
944
944
  }
945
945
  }
946
946
  } });
947
947
  k.addClass("ul-video-recorder-toggle-button"), k.el_.appendChild(ne(P.RecordButton, "ul-recorder-toggle"));
948
948
  const M = a.document.createElement("p");
949
- M.style.visibility = "hidden", M.className = "ul-upload-progress-label", e.appendChild(M), i.uploadProgressLabel = M;
950
- const Y = Le(i, [d, b, "PlayToggle", k, "FullscreenToggle"]), O = Y.children().find((u) => u.name_ === "FullscreenToggle");
949
+ M.style.visibility = "hidden", M.className = "ul-upload-progress-label", e.appendChild(M), r.uploadProgressLabel = M;
950
+ const Y = Le(r, [d, b, "PlayToggle", k, "FullscreenToggle"]), O = Y.children().find((p) => p.name_ === "FullscreenToggle");
951
951
  O.hasClass("vjs-disabled") && O.hide();
952
- const B = Y.children().find((u) => u.name_ === "PlayToggle");
953
- B.hide(), d.addClass(D), Re(i, Y, s, !1, c), i.on("stopRecord", () => {
952
+ const B = Y.children().find((p) => p.name_ === "PlayToggle");
953
+ B.hide(), d.addClass(D), Re(r, Y, s, !1, v), r.on("stopRecord", () => {
954
954
  k.hide(), B.show(), O.show(), d.removeClass(D);
955
- }), i.on("deviceReady", () => {
955
+ }), r.on("deviceReady", () => {
956
956
  k.show(), B.hide(), d.addClass(D);
957
- }), ((u, C, m, E, y) => {
958
- const { surveyId: F, responseGroupUid: q, visitorId: R, envId: H } = u.payload;
959
- u.on("deviceError", function() {
960
- console.warn("device error: ", u.deviceErrorCode), u.deviceErrorCode.message === "Permission denied" ? (u.deviceButton.addClass("permission-denied"), m && m(x.ERROR, { type: x.PERMISSION_DENIED }), z({ event: "Video Permission Denied", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(u, te), responseGroupUid: q, surveyId: F } })) : (m && m(x.ERROR, { type: x.OTHER }), $(new Error(u.deviceErrorCode.message), "recorderDeviceError", C, y, R, H));
961
- }), u.on("error", function(Z, N) {
962
- $(N || u.error(), "recorderError", C, y, R, H);
963
- }), u.on("startRecord", function(Z, N) {
964
- E(u.uploadProgressLabel, "none"), z({ event: "Video Record Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(u, te), responseGroupUid: q, surveyId: F } });
965
- }), u.on("finishRecord", async function() {
966
- E(u.uploadProgressLabel, "start", 0);
967
- const Z = se(u, te);
968
- if (!F) {
957
+ }), ((p, C, m, E, y) => {
958
+ const { surveyId: U, responseGroupUid: q, visitorId: R, envId: H } = p.payload;
959
+ p.on("deviceError", function() {
960
+ console.warn("device error: ", p.deviceErrorCode), p.deviceErrorCode.message === "Permission denied" ? (p.deviceButton.addClass("permission-denied"), m && m(x.ERROR, { type: x.PERMISSION_DENIED }), z({ event: "Video Permission Denied", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(p, te), responseGroupUid: q, surveyId: U } })) : (m && m(x.ERROR, { type: x.OTHER }), N(new Error(p.deviceErrorCode.message), "recorderDeviceError", C, y, R, H));
961
+ }), p.on("error", function(Z, F) {
962
+ N(F || p.error(), "recorderError", C, y, R, H);
963
+ }), p.on("startRecord", function(Z, F) {
964
+ E(p.uploadProgressLabel, "none"), z({ event: "Video Record Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(p, te), responseGroupUid: q, surveyId: U } });
965
+ }), p.on("finishRecord", async function() {
966
+ E(p.uploadProgressLabel, "start", 0);
967
+ const Z = se(p, te);
968
+ if (!U) {
969
969
  const S = "internal error: missing fields in payload";
970
- return m && m(x.ERROR, { type: x.OTHER }), $(new Error(S), "finishRecord", C, y, R, H), null;
970
+ return m && m(x.ERROR, { type: x.OTHER }), N(new Error(S), "finishRecord", C, y, R, H), null;
971
971
  }
972
- u.record().stopDevice();
973
- const N = u.cameraOff ? x.MEDIA_TYPE_AUDIO : x.MEDIA_TYPE_VIDEO, A = Fe();
974
- z({ event: "Video Record Finish", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: F, mediaType: N } });
975
- const Q = { surveyId: F, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: N, mediaRecordingUid: A };
972
+ p.record().stopDevice();
973
+ const F = p.cameraOff ? x.MEDIA_TYPE_AUDIO : x.MEDIA_TYPE_VIDEO, A = Fe();
974
+ z({ event: "Video Record Finish", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F } });
975
+ const Q = { surveyId: U, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: F, mediaRecordingUid: A };
976
976
  Z && (Q.questionId = Z), q && (Q.responseGroupUid = q), R && (Q.visitorId = R);
977
977
  const X = await (async () => {
978
978
  const S = await fetch(`${C}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(Q) });
979
979
  if (S.ok) {
980
980
  const pe = await S.json();
981
- return m && m(x.UPLOAD_STARTED, { [x.UPLOAD_ID]: pe.upload.id, [x.MEDIA_TYPE]: N, [x.MEDIA_RECORDING_UID]: A }), pe.upload.url;
981
+ return m && m(x.UPLOAD_STARTED, { [x.UPLOAD_ID]: pe.upload.id, [x.MEDIA_TYPE]: F, [x.MEDIA_RECORDING_UID]: A }), pe.upload.url;
982
982
  }
983
- return m && m(x.ERROR, { type: x.OTHER, response: S }), $(new Error("failed to get upload response with url"), "finishRecord", C, y, R, H), null;
983
+ return m && m(x.ERROR, { type: x.OTHER, response: S }), N(new Error("failed to get upload response with url"), "finishRecord", C, y, R, H), null;
984
984
  })();
985
- X && (V = a.document.defaultView.UpChunk.createUpload({ endpoint: X, file: new a.document.defaultView.File([u.recordedData], `recording ${N} ${Date.now()}`), chunkSize: 5120 }), V.startTime = Date.now(), z({ event: "Video Upload Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: F, mediaType: N, url: X } }), V.on("error", (S) => {
986
- E(u.uploadProgressLabel, "none"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), $(S, "finishRecord", C, y, R, H);
985
+ X && (V = a.document.defaultView.UpChunk.createUpload({ endpoint: X, file: new a.document.defaultView.File([p.recordedData], `recording ${F} ${Date.now()}`), chunkSize: 5120 }), V.startTime = Date.now(), z({ event: "Video Upload Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F, url: X } }), V.on("error", (S) => {
986
+ E(p.uploadProgressLabel, "none"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), N(S, "finishRecord", C, y, R, H);
987
987
  }), V.on("progress", (S) => {
988
- m && m(x.UPLOAD_PROGRESS, { [x.MEDIA_RECORDING_UID]: A, [x.UPLOAD_PROGRESS_PCT]: S.detail }), E(u.uploadProgressLabel, "progress", S.detail);
988
+ m && m(x.UPLOAD_PROGRESS, { [x.MEDIA_RECORDING_UID]: A, [x.UPLOAD_PROGRESS_PCT]: S.detail }), E(p.uploadProgressLabel, "progress", S.detail);
989
989
  }), V.on("success", () => {
990
- E(u.uploadProgressLabel, "success"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), z({ event: "Video Upload Success", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: F, mediaType: N, url: X, elapsedMs: V.startTime && Date.now() - V.startTime } });
990
+ E(p.uploadProgressLabel, "success"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), z({ event: "Video Upload Success", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F, url: X, elapsedMs: V.startTime && Date.now() - V.startTime } });
991
991
  }));
992
992
  });
993
- })(i, t, r, we, l);
993
+ })(r, t, i, we, l);
994
994
  const W = [{ name: "microphone" }];
995
- !i.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((u) => {
995
+ !r.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((p) => {
996
996
  var C;
997
- return (C = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : C.query(u);
998
- })).then((u) => {
999
- u.reduce((C, m) => C & m.state === "granted", !0) && i && (i.deviceButton && i.deviceButton.hide(), i.record().getDevice());
1000
- }).catch((u) => {
997
+ return (C = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : C.query(p);
998
+ })).then((p) => {
999
+ p.reduce((C, m) => C & m.state === "granted", !0) && r && (r.deviceButton && r.deviceButton.hide(), r.record().getDevice());
1000
+ }).catch((p) => {
1001
1001
  });
1002
1002
  }, Pe = (e, n = 3) => {
1003
1003
  const o = a.document.getElementById("ul-recording-countdown-screen");
@@ -1008,9 +1008,9 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
1008
1008
  const n = a.document.createElement("div");
1009
1009
  return n.className = "ul-video-container", n.appendChild(((o) => {
1010
1010
  const t = a.document.createElement("div");
1011
- return t.className = "ul-video-player-loading", t.id = ce(o), ["first", "second", "third", "fourth"].map((r) => {
1011
+ return t.className = "ul-video-player-loading", t.id = ce(o), ["first", "second", "third", "fourth"].map((i) => {
1012
1012
  const s = a.document.createElement("div");
1013
- s.className = r, t.appendChild(s);
1013
+ s.className = i, t.appendChild(s);
1014
1014
  }), t;
1015
1015
  })(e)), n;
1016
1016
  }, ae = (e, n) => {
@@ -1018,47 +1018,47 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
1018
1018
  o.id = e, o.className = "video-js vjs-default-skin ul-video-player-video";
1019
1019
  const t = a.document.createElement("p");
1020
1020
  t.className = "vjs-no-js", t.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
1021
- const r = a.document.createElement("a");
1022
- 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;
1023
- }, Xe = (e, n) => {
1021
+ const i = a.document.createElement("a");
1022
+ return i.href = "https://videojs.com/html5-video-support/", i.target = "_blank", i.innerHTML = "supports HTML5 video", t.appendChild(i), o.appendChild(t), n.appendChild(o), n;
1023
+ }, Qe = (e, n) => {
1024
1024
  e.children()[0].classList.remove("vjs-hidden"), e.audioPlayerPlaceholder.hide(), a.document.getElementById(`${e.id()}_html5_api`).style.height = "100%";
1025
- }, oe = (e, n) => a.document.getElementById(e) ? n ? a.videojs(e, n) : a.videojs(e) : (console.error(`Error in finding player element with ID, ${e}`), null), mn = (e, n, o, t = !1, r = "https://api.sprig.com", s = document, l = null, c = null) => {
1025
+ }, oe = (e, n) => a.document.getElementById(e) ? n ? a.videojs(e, n) : a.videojs(e) : (console.error(`Error in finding player element with ID, ${e}`), null), mn = (e, n, o, t = !1, i = "https://api.sprig.com", s = document, l = null, v = null) => {
1026
1026
  a.document = s;
1027
- const i = e + Ie, p = _e(i);
1027
+ const r = e + Ie, c = _e(r);
1028
1028
  return a.document.addEventListener("securitypolicyviolation", (h) => {
1029
- $(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", r, {});
1029
+ N(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
1030
1030
  }), Te(ke, () => {
1031
- a.document.getElementById(ce(i)).remove(), ae(i, p);
1031
+ a.document.getElementById(ce(r)).remove(), ae(r, c);
1032
1032
  const h = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
1033
1033
  try {
1034
1034
  const I = e + be;
1035
- ae(I, p);
1036
- const g = oe(i, h), T = oe(I, { muted: !0, ...h });
1035
+ ae(I, c);
1036
+ const g = oe(r, h), T = oe(I, { muted: !0, ...h });
1037
1037
  if (!g || !T) return;
1038
1038
  ((d, w, j) => {
1039
1039
  d.addClass(`ul${be}`);
1040
1040
  const b = new (a.videojs.getComponent("Component"))(d);
1041
1041
  w && d.src(w), d.addChild(b), j && j(d);
1042
- })(T, l, c), l || T.addClass(D);
1042
+ })(T, l, v), l || T.addClass(D);
1043
1043
  const f = Le(g, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), L = f.children().find((d) => d.name_ === "FullscreenToggle");
1044
1044
  L.hasClass("vjs-disabled") && L.hide(), Re(g, f, n, o, t, T);
1045
1045
  } catch (I) {
1046
- return void $(new Error(`Error when creating video player object ${I}`), "playerDeviceError", r, {});
1046
+ return void N(new Error(`Error when creating video player object ${I}`), "playerDeviceError", i, {});
1047
1047
  }
1048
- }), p;
1049
- }, gn = (e, n = {}, o = "https://api.userleap.com", t, r, s, l = !1, c = document) => {
1050
- a.document = c;
1051
- const i = e + De, p = _e(i);
1048
+ }), c;
1049
+ }, gn = (e, n = {}, o = "https://api.userleap.com", t, i, s, l = !1, v = document) => {
1050
+ a.document = v;
1051
+ const r = e + De, c = _e(r);
1052
1052
  return a.document.addEventListener("securitypolicyviolation", (h) => {
1053
- $(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", o, s, n.visitorId, n.envId);
1054
- }), Te(ke.concat(Je), () => {
1055
- ae(i, p), a.document.getElementById(ce(i)).remove();
1053
+ N(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", o, s, n.visitorId, n.envId);
1054
+ }), Te(ke.concat(Ye), () => {
1055
+ ae(r, c), a.document.getElementById(ce(r)).remove();
1056
1056
  try {
1057
- Qe(p, i, n, o, t, r, s, l);
1057
+ Ke(c, r, n, o, t, i, s, l);
1058
1058
  } catch (h) {
1059
- return void $(new Error(`Error when creating video recorder player object ${h}`), "recorderDeviceError", o, s, n.visitorId, n.envId);
1059
+ return void N(new Error(`Error when creating video recorder player object ${h}`), "recorderDeviceError", o, s, n.visitorId, n.envId);
1060
1060
  }
1061
- }), p;
1061
+ }), c;
1062
1062
  }, bn = (e) => {
1063
1063
  const n = e + De;
1064
1064
  if (a.document.getElementById(n) && a.videojs) {
@@ -1072,7 +1072,7 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
1072
1072
  }, fn = (e) => {
1073
1073
  const n = oe(e + Ie);
1074
1074
  n == null || n.pause();
1075
- }, en = (e) => {
1075
+ }, Xe = (e) => {
1076
1076
  if (!e) return null;
1077
1077
  const n = e.match(/https:\/\/stream.mux.com\/(.*)/);
1078
1078
  let o = n ? n[1] : null;
@@ -1081,19 +1081,19 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
1081
1081
  export {
1082
1082
  Ne as B,
1083
1083
  $e as H,
1084
- ln as L,
1084
+ sn as L,
1085
1085
  dn as M,
1086
1086
  cn as O,
1087
1087
  un as Q,
1088
1088
  x as R,
1089
1089
  vn as S,
1090
1090
  pn as a,
1091
- sn as b,
1091
+ rn as b,
1092
1092
  gn as c,
1093
1093
  an as d,
1094
1094
  hn as g,
1095
1095
  fn as p,
1096
1096
  bn as s,
1097
- ze as u,
1097
+ ln as u,
1098
1098
  mn as v
1099
1099
  };