@sprig-technologies/sprig-browser 2.43.0 → 2.44.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.
- package/dist/conversational-ui-Cai2CXxq.js +614 -0
- package/dist/conversational-ui-uecC--rF.cjs +1 -0
- package/dist/{conversational-v2-styles-D3WQxdro.cjs → conversational-v2-styles-BTm-8rVB.cjs} +1 -1
- package/dist/{conversational-v2-styles-XFcJt3-u.js → conversational-v2-styles-Bj3dBWvf.js} +1 -1
- package/dist/{core-DJ3Dpomz.js → core-CWHAsU-S.js} +22 -22
- package/dist/{core-wqg-G3hc.cjs → core-CgFFOhiH.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +15 -7
- package/dist/core.js +2 -2
- package/dist/index-CbagEkvN.js +754 -0
- package/dist/index-D2nvY-Yh.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-BAjv1fmT.cjs → metricsReporter-BGIzo9eh.cjs} +1 -1
- package/dist/{metricsReporter-DDWVWGid.js → metricsReporter-Bg5aC8mO.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +116 -111
- package/dist/{videoPlayer-DD0Jmq0y.cjs → videoPlayer-B4YqaVpY.cjs} +3 -3
- package/dist/{videoPlayer-Cj-utOH3.js → videoPlayer-ChSRlzGk.js} +246 -250
- package/dist/view-5xam8eBF.cjs +1 -0
- package/dist/view-MpYHLeMt.js +1789 -0
- package/package.json +1 -1
- package/dist/conversational-ui-BnadcoG2.cjs +0 -1
- package/dist/conversational-ui-CtA-YS3e.js +0 -604
- package/dist/index-BEn8X37H.js +0 -743
- package/dist/index-C0oA6Zlm.cjs +0 -1
- package/dist/view-Ctyh240J.js +0 -1737
- package/dist/view-DlMlH6Lu.cjs +0 -1
|
@@ -1,80 +1,86 @@
|
|
|
1
|
-
import { u as v, c as _, a as
|
|
2
|
-
import { g as He, i as Se, E as
|
|
3
|
-
import { d as
|
|
4
|
-
import { v as
|
|
5
|
-
const
|
|
6
|
-
const { enableCspTrustedTypes: o } =
|
|
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";
|
|
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
7
|
return v("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
8
8
|
}, xe = () => {
|
|
9
|
-
const { viewDocument: e } =
|
|
10
|
-
return
|
|
11
|
-
const t = e.querySelector(".sprig-question-body"),
|
|
9
|
+
const { viewDocument: e } = U((t) => ({ viewDocument: t.viewDocument })), [n, o] = de(!1);
|
|
10
|
+
return J(() => {
|
|
11
|
+
const t = e.querySelector(".sprig-question-body"), r = new ResizeObserver(() => {
|
|
12
12
|
window.requestAnimationFrame(() => {
|
|
13
13
|
o(!!(t && Se(t) && t.scrollHeight > t.offsetHeight));
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
|
-
return t &&
|
|
17
|
-
t &&
|
|
16
|
+
return t && r.observe(t), () => {
|
|
17
|
+
t && r.disconnect();
|
|
18
18
|
};
|
|
19
19
|
}, [e]), n;
|
|
20
|
-
}, ve = ({ plainText: e, richText: n, id: o, className: t, isHeader:
|
|
21
|
-
const t =
|
|
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:
|
|
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" }) }),
|
|
24
|
-
const o =
|
|
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) => {
|
|
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
|
|
29
|
+
const r = t.scrollHeight + (t.offsetHeight - t.clientHeight), s = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), l = r <= s ? r : 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 }));
|
|
37
|
+
J(() => {
|
|
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);
|
|
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 }) => {
|
|
36
42
|
var I;
|
|
37
|
-
const { handleClickEmbedButton: t, hasViewedEmbed:
|
|
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) => {
|
|
38
44
|
g.preventDefault(), t(T);
|
|
39
45
|
};
|
|
40
46
|
if ((() => {
|
|
41
|
-
const { update: g, index: T, isConversationalUI: f, viewDocument: L } =
|
|
42
|
-
|
|
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);
|
|
48
|
+
J(() => {
|
|
43
49
|
if (f) return;
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
|
|
50
|
+
const w = new ResizeObserver(d), j = L.querySelector(".ul-card__container");
|
|
51
|
+
return j && w.observe(j, { box: "border-box" }), () => {
|
|
52
|
+
w.disconnect();
|
|
47
53
|
};
|
|
48
54
|
}, [d, g, T, f, L]);
|
|
49
|
-
})(), !l &&
|
|
50
|
-
if (e === "prototype") return v(
|
|
51
|
-
|
|
55
|
+
})(), !l && i && !r && c && ["email", "link"].includes(p)) {
|
|
56
|
+
if (e === "prototype") return v(he, { handleClick: (g) => {
|
|
57
|
+
h(g, "question.prototype.click");
|
|
52
58
|
} });
|
|
53
|
-
if (e === "pdf") return v(
|
|
54
|
-
|
|
59
|
+
if (e === "pdf") return v(he, { buttonText: (n == null ? void 0 : n.viewDocumentText) || "View Document", handleClick: (g) => {
|
|
60
|
+
h(g, "question.agreement.click");
|
|
55
61
|
} });
|
|
56
62
|
}
|
|
57
|
-
return v(
|
|
58
|
-
},
|
|
59
|
-
const { styleNonce: d, viewDocument:
|
|
60
|
-
Ze(
|
|
61
|
-
const k = ({ isSelected:
|
|
62
|
-
L && L({ id: c, selected:
|
|
63
|
-
}, M = (
|
|
64
|
-
f || (
|
|
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);
|
|
67
|
+
const k = ({ isSelected: E, userText: y }) => {
|
|
68
|
+
L && L({ id: c, selected: E, value: s, userText: y, noneOfTheAbove: g });
|
|
69
|
+
}, M = (E) => {
|
|
70
|
+
f || (E.stopPropagation(), k({ isSelected: i || !r, userText: l }), b(!1));
|
|
65
71
|
}, Y = () => {
|
|
66
|
-
|
|
72
|
+
j || b(!0);
|
|
67
73
|
}, O = () => {
|
|
68
|
-
|
|
69
|
-
}, B = { onClick: (
|
|
74
|
+
j && b(!1);
|
|
75
|
+
}, B = { onClick: (E) => M(E), onKeyPress: (E) => ((y) => {
|
|
70
76
|
f || y.key !== "Enter" && y.key !== " " || M(y);
|
|
71
|
-
})(
|
|
72
|
-
"ontouchstart" in
|
|
73
|
-
const W =
|
|
74
|
-
return v("div", { className: _(le("choice",
|
|
77
|
+
})(E) };
|
|
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 }) })] });
|
|
75
81
|
}, qe = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
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(), () => {
|
|
78
84
|
s();
|
|
79
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) => {
|
|
80
86
|
l(), c.stopPropagation(), o(c.currentTarget.value);
|
|
@@ -82,82 +88,74 @@ const Fe = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
|
|
|
82
88
|
c.stopPropagation();
|
|
83
89
|
}, onKeyPress: (c) => {
|
|
84
90
|
c.stopPropagation();
|
|
85
|
-
}, placeholder: e, ref:
|
|
86
|
-
},
|
|
87
|
-
let t = e.getElementById(
|
|
88
|
-
t || (t = e.createElement("style"),
|
|
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));
|
|
89
95
|
}, Ge = (e) => `
|
|
90
|
-
.${
|
|
96
|
+
.${ee} {
|
|
91
97
|
border-color: ${e};
|
|
92
98
|
}
|
|
93
|
-
.${
|
|
99
|
+
.${ee} .select-radio, .${ee}.select-radio {
|
|
94
100
|
border: 6px solid ${e};
|
|
95
101
|
box-shadow: none;
|
|
96
102
|
}
|
|
97
|
-
.${
|
|
103
|
+
.${Ee} {
|
|
98
104
|
border-color: ${ye};
|
|
99
105
|
}
|
|
100
|
-
`, pn = ({ children: e }) => v("div", { className: "sprig-question-body", children: e }),
|
|
101
|
-
const n = xe(), { isConversationalUI: o } =
|
|
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 }));
|
|
102
108
|
return v("div", { className: _("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
const Je = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: i, dropdownFooter: s, panelRef: l }) => {
|
|
112
|
-
const { themeColor: c } = $((r) => ({ doc: r.viewDocument, themeColor: r.border }));
|
|
113
|
-
return v("div", { className: "select-list", ref: l, children: [e.map((r) => {
|
|
114
|
-
return v("div", { "aria-disabled": i == null ? void 0 : i.includes(r), className: _("select-option", i != null && i.includes(r) ? "ul-choice-disabled" : ""), onClick: (m) => {
|
|
115
|
-
i != null && i.includes(r) || (n(r), m.stopPropagation());
|
|
116
|
-
}, role: "option", style: { ...i != null && i.includes(r) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && v(Ee, { divId: (u = r.id, `checkbox-div-${u}`), id: r.id, isSelected: o.includes(r), themeColor: c }), r.label] }, r.id);
|
|
117
|
-
var u;
|
|
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;
|
|
118
116
|
}), s] });
|
|
119
|
-
},
|
|
120
|
-
const [
|
|
121
|
-
|
|
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);
|
|
122
120
|
};
|
|
123
|
-
|
|
121
|
+
ue(() => {
|
|
124
122
|
T || g();
|
|
125
|
-
}, [
|
|
126
|
-
|
|
127
|
-
}, [
|
|
128
|
-
var
|
|
129
|
-
const d = (
|
|
130
|
-
const b =
|
|
131
|
-
(b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) ||
|
|
123
|
+
}, [i, T, g]), ue(() => {
|
|
124
|
+
i && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
125
|
+
}, [i]), J(() => {
|
|
126
|
+
var w;
|
|
127
|
+
const d = (j) => {
|
|
128
|
+
const b = j.target;
|
|
129
|
+
(b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) || p(!1);
|
|
132
130
|
};
|
|
133
131
|
I.addEventListener("click", d);
|
|
134
132
|
try {
|
|
135
|
-
(
|
|
133
|
+
(w = window.parent) == null || w.addEventListener("click", d);
|
|
136
134
|
} catch {
|
|
137
135
|
window.addEventListener("click", d);
|
|
138
136
|
}
|
|
139
137
|
return () => {
|
|
140
|
-
var
|
|
138
|
+
var j;
|
|
141
139
|
I.removeEventListener("click", d);
|
|
142
140
|
try {
|
|
143
|
-
(
|
|
141
|
+
(j = window.parent) == null || j.removeEventListener("click", d);
|
|
144
142
|
} catch {
|
|
145
143
|
window.removeEventListener("click", d);
|
|
146
144
|
}
|
|
147
145
|
};
|
|
148
146
|
}, [I]);
|
|
149
147
|
const L = s.length === 0 ? ["select-button-placeholder"] : [];
|
|
150
|
-
return v(
|
|
148
|
+
return v(Ce, { children: [v("button", { "aria-label": "choice dropdown button", className: _("select-button", ...L), onClick: (d) => {
|
|
151
149
|
d.stopPropagation(), f();
|
|
152
|
-
}, type: "button", children: [v("span", { children: s.length === 0 ?
|
|
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) => {
|
|
153
151
|
var b;
|
|
154
|
-
const
|
|
152
|
+
const w = s.some((k) => k.id === d.id), j = s.some((k) => {
|
|
155
153
|
var M;
|
|
156
154
|
return (M = k.optionProperties) == null ? void 0 : M.noneOfTheAbove;
|
|
157
155
|
});
|
|
158
|
-
(b = d.optionProperties) != null && b.noneOfTheAbove && !
|
|
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();
|
|
159
157
|
}, showCheckbox: e })] });
|
|
160
|
-
},
|
|
158
|
+
}, Ye = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, hn = (e = void 0, n = {}) => {
|
|
161
159
|
if (!e) return e;
|
|
162
160
|
const o = ["http:", "https:", "itms-apps:", "market:"], t = ((l) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(l) ? l : `http://${l}`)(e);
|
|
163
161
|
if (!t) return;
|
|
@@ -167,20 +165,20 @@ const Je = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, di
|
|
|
167
165
|
} catch {
|
|
168
166
|
return;
|
|
169
167
|
}
|
|
170
|
-
const
|
|
171
|
-
let
|
|
172
|
-
for (const [
|
|
173
|
-
const g = new RegExp(
|
|
174
|
-
|
|
175
|
-
} else
|
|
176
|
-
return
|
|
177
|
-
})(t, n,
|
|
178
|
-
return
|
|
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]) {
|
|
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) => {
|
|
179
177
|
if (!l.includes("?")) return l;
|
|
180
|
-
const
|
|
181
|
-
return
|
|
182
|
-
})(s,
|
|
183
|
-
}, 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",
|
|
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 */
|
|
184
182
|
.video-js .vjs-control {
|
|
185
183
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
186
184
|
}
|
|
@@ -838,31 +836,31 @@ span.ul-button-text {
|
|
|
838
836
|
background-size: cover;
|
|
839
837
|
}
|
|
840
838
|
` }], Ie = "-video-player", be = "-secondary-video-player", De = "-video-recorder";
|
|
841
|
-
let
|
|
842
|
-
const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId:
|
|
839
|
+
let V, fe;
|
|
840
|
+
const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, metadata: s }) => {
|
|
843
841
|
const l = a.document.documentElement;
|
|
844
|
-
if (!t || !
|
|
845
|
-
const c = { event: `SDK - ${e}`, visitorId: t, environmentId:
|
|
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 } };
|
|
846
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);
|
|
847
|
-
},
|
|
848
|
-
z({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId:
|
|
849
|
-
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 },
|
|
850
|
-
(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(
|
|
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);
|
|
851
849
|
}, Te = (e, n) => {
|
|
852
850
|
if (e.length === 0) return n && n();
|
|
853
|
-
Promise.all(e.reduce((o, t) => (o.push(((
|
|
854
|
-
let
|
|
855
|
-
s === "script" ? (
|
|
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() {
|
|
856
854
|
c(l);
|
|
857
|
-
},
|
|
858
|
-
|
|
859
|
-
},
|
|
855
|
+
}, p.onerror = function() {
|
|
856
|
+
i(l);
|
|
857
|
+
}, p.async = !1, p.id = btoa(l), r.appendChild(p);
|
|
860
858
|
}))(a.document.head, t)), o), [])).then(() => {
|
|
861
859
|
a.videojs = a.document.defaultView.videojs, n && n();
|
|
862
860
|
}).catch(function(o) {
|
|
863
861
|
console.log(o + " failed to load");
|
|
864
862
|
});
|
|
865
|
-
},
|
|
863
|
+
}, we = (e, n, o) => {
|
|
866
864
|
if (n === "start" && (e.style.visibility = "visible"), n === "none") e.style.visibility = D;
|
|
867
865
|
else if (n === "success") e.style.visibility = D, e.innerHTML = "Upload succeeded!";
|
|
868
866
|
else {
|
|
@@ -876,24 +874,24 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, met
|
|
|
876
874
|
const o = new (a.videojs.getComponent("Component"))(e);
|
|
877
875
|
return o.addClass("ul-buttons-panel"), n.map((t) => {
|
|
878
876
|
o.addChild(t);
|
|
879
|
-
}),
|
|
880
|
-
},
|
|
877
|
+
}), Ke(o), o;
|
|
878
|
+
}, Ke = (e) => {
|
|
881
879
|
e.children().forEach((n) => {
|
|
882
|
-
if (
|
|
883
|
-
const o =
|
|
880
|
+
if (P[n.name_]) {
|
|
881
|
+
const o = ne(P[n.name_], `ul-${P[n.name_]}`);
|
|
884
882
|
n.el_.appendChild(o);
|
|
885
883
|
}
|
|
886
884
|
});
|
|
887
|
-
},
|
|
885
|
+
}, ne = (e, n = "") => {
|
|
888
886
|
const o = a.document.createElement("span");
|
|
889
887
|
return o.className = "ul-button-text", o.innerHTML = e, o.id = n, o;
|
|
890
|
-
},
|
|
888
|
+
}, Re = (e, n, o, t, r = !1, s) => {
|
|
891
889
|
e.addClass("ul-video-player");
|
|
892
890
|
const l = new (a.videojs.getComponent("Component"))(e);
|
|
893
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");
|
|
894
|
-
const c = o && o.src ?
|
|
895
|
-
!o || !
|
|
896
|
-
|
|
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();
|
|
897
895
|
}), e.on("pause", () => {
|
|
898
896
|
s == null || s.pause();
|
|
899
897
|
}), e.on("seeked", () => {
|
|
@@ -901,118 +899,118 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, met
|
|
|
901
899
|
}), e.on("ratechange", () => {
|
|
902
900
|
s == null || s.playbackRate(e.playbackRate());
|
|
903
901
|
}), e.addChild(e.audioPlayerPlaceholder, {}, 1), l.addChild(n), e.addChild(l), t && t(e);
|
|
904
|
-
},
|
|
902
|
+
}, Qe = (e, n, o, t, r, s, l, c = !1) => {
|
|
905
903
|
fe = Date.now();
|
|
906
|
-
const
|
|
907
|
-
if (!
|
|
908
|
-
|
|
909
|
-
const { surveyId:
|
|
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;
|
|
910
908
|
let f;
|
|
911
|
-
const L = (
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
909
|
+
const L = (u) => {
|
|
910
|
+
const C = re, m = re + "-audio-only";
|
|
911
|
+
we(i.uploadProgressLabel, "none"), V && V.startTime >= fe && V.abort();
|
|
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) => {
|
|
916
914
|
y.stop();
|
|
917
915
|
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((y) => {
|
|
918
|
-
f = y, y.getVideoTracks().forEach((
|
|
919
|
-
|
|
920
|
-
}),
|
|
921
|
-
}).catch(
|
|
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) => {
|
|
922
920
|
y.enabled = !0;
|
|
923
|
-
}),
|
|
924
|
-
}, d = new (a.videojs.getComponent("Button"))(
|
|
925
|
-
d.hasClass(D) || (z({ event: "Video Delete Button Clicked", apiBase: t, headers: l, visitorId: g, envId: T, metadata: { questionId:
|
|
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));
|
|
926
924
|
} });
|
|
927
|
-
d.addClass("ul-video-recorder-delete-button"), d.el_.appendChild(
|
|
928
|
-
const
|
|
929
|
-
|
|
925
|
+
d.addClass("ul-video-recorder-delete-button"), d.el_.appendChild(ne(P.DeleteButton, "ul-delete-button"));
|
|
926
|
+
const w = a.document.getElementById(n), j = () => {
|
|
927
|
+
w.classList.contains("vjs-fullscreen") && i.cameraOff ? w.style.display = "table" : w.style.display = "flex";
|
|
930
928
|
};
|
|
931
|
-
|
|
932
|
-
const b = new (a.videojs.getComponent("Button"))(
|
|
933
|
-
|
|
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());
|
|
934
932
|
} });
|
|
935
|
-
b.addClass(re), b.el_.appendChild(
|
|
936
|
-
const k = new (a.videojs.getComponent("Button"))(
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
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);
|
|
939
937
|
else {
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
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();
|
|
942
940
|
else {
|
|
943
|
-
k.addClass(ie), O.hide(), b.addClass(D), d.addClass(D),
|
|
944
|
-
const
|
|
945
|
-
|
|
941
|
+
k.addClass(ie), O.hide(), b.addClass(D), d.addClass(D), u && (u.innerHTML = P.StopButton);
|
|
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);
|
|
946
944
|
}
|
|
947
945
|
}
|
|
948
946
|
} });
|
|
949
|
-
k.addClass("ul-video-recorder-toggle-button"), k.el_.appendChild(
|
|
947
|
+
k.addClass("ul-video-recorder-toggle-button"), k.el_.appendChild(ne(P.RecordButton, "ul-recorder-toggle"));
|
|
950
948
|
const M = a.document.createElement("p");
|
|
951
|
-
M.style.visibility = "hidden", M.className = "ul-upload-progress-label", e.appendChild(M),
|
|
952
|
-
const Y = Le(
|
|
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");
|
|
953
951
|
O.hasClass("vjs-disabled") && O.hide();
|
|
954
|
-
const B = Y.children().find((
|
|
955
|
-
B.hide(), d.addClass(D),
|
|
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", () => {
|
|
956
954
|
k.hide(), B.show(), O.show(), d.removeClass(D);
|
|
957
|
-
}),
|
|
955
|
+
}), i.on("deviceReady", () => {
|
|
958
956
|
k.show(), B.hide(), d.addClass(D);
|
|
959
|
-
}), ((
|
|
960
|
-
const { surveyId:
|
|
961
|
-
|
|
962
|
-
console.warn("device error: ",
|
|
963
|
-
}),
|
|
964
|
-
|
|
965
|
-
}),
|
|
966
|
-
|
|
967
|
-
}),
|
|
968
|
-
|
|
969
|
-
const Z = se(
|
|
970
|
-
if (!
|
|
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) {
|
|
971
969
|
const S = "internal error: missing fields in payload";
|
|
972
|
-
return
|
|
970
|
+
return m && m(x.ERROR, { type: x.OTHER }), $(new Error(S), "finishRecord", C, y, R, H), null;
|
|
973
971
|
}
|
|
974
|
-
|
|
975
|
-
const
|
|
976
|
-
z({ event: "Video Record Finish", apiBase:
|
|
977
|
-
const
|
|
978
|
-
Z && (
|
|
979
|
-
const
|
|
980
|
-
const S = await fetch(`${
|
|
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 };
|
|
976
|
+
Z && (Q.questionId = Z), q && (Q.responseGroupUid = q), R && (Q.visitorId = R);
|
|
977
|
+
const X = await (async () => {
|
|
978
|
+
const S = await fetch(`${C}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(Q) });
|
|
981
979
|
if (S.ok) {
|
|
982
|
-
const
|
|
983
|
-
return
|
|
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;
|
|
984
982
|
}
|
|
985
|
-
return
|
|
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;
|
|
986
984
|
})();
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}),
|
|
990
|
-
|
|
991
|
-
}),
|
|
992
|
-
|
|
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);
|
|
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);
|
|
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 } });
|
|
993
991
|
}));
|
|
994
992
|
});
|
|
995
|
-
})(
|
|
993
|
+
})(i, t, r, we, l);
|
|
996
994
|
const W = [{ name: "microphone" }];
|
|
997
|
-
!
|
|
998
|
-
var
|
|
999
|
-
return (
|
|
1000
|
-
})).then((
|
|
1001
|
-
|
|
1002
|
-
}).catch((
|
|
995
|
+
!i.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((u) => {
|
|
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) => {
|
|
1003
1001
|
});
|
|
1004
|
-
},
|
|
1002
|
+
}, Pe = (e, n = 3) => {
|
|
1005
1003
|
const o = a.document.getElementById("ul-recording-countdown-screen");
|
|
1006
1004
|
o && n === 0 ? (o.remove(), e.record().start()) : o && (o.innerHTML = `<span class='ul-countdown-text'>Recording in... ${n}</span>`, setTimeout(() => {
|
|
1007
|
-
|
|
1005
|
+
Pe(e, n - 1);
|
|
1008
1006
|
}, 1e3));
|
|
1009
1007
|
}, _e = (e) => {
|
|
1010
1008
|
const n = a.document.createElement("div");
|
|
1011
1009
|
return n.className = "ul-video-container", n.appendChild(((o) => {
|
|
1012
1010
|
const t = a.document.createElement("div");
|
|
1013
|
-
return t.className = "ul-video-player-loading", t.id = ce(o), ["first", "second", "third", "fourth"].map((
|
|
1011
|
+
return t.className = "ul-video-player-loading", t.id = ce(o), ["first", "second", "third", "fourth"].map((r) => {
|
|
1014
1012
|
const s = a.document.createElement("div");
|
|
1015
|
-
s.className =
|
|
1013
|
+
s.className = r, t.appendChild(s);
|
|
1016
1014
|
}), t;
|
|
1017
1015
|
})(e)), n;
|
|
1018
1016
|
}, ae = (e, n) => {
|
|
@@ -1020,48 +1018,48 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, met
|
|
|
1020
1018
|
o.id = e, o.className = "video-js vjs-default-skin ul-video-player-video";
|
|
1021
1019
|
const t = a.document.createElement("p");
|
|
1022
1020
|
t.className = "vjs-no-js", t.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1025
|
-
},
|
|
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) => {
|
|
1026
1024
|
e.children()[0].classList.remove("vjs-hidden"), e.audioPlayerPlaceholder.hide(), a.document.getElementById(`${e.id()}_html5_api`).style.height = "100%";
|
|
1027
|
-
},
|
|
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) => {
|
|
1028
1026
|
a.document = s;
|
|
1029
|
-
const
|
|
1030
|
-
return a.document.addEventListener("securitypolicyviolation", (
|
|
1031
|
-
|
|
1027
|
+
const i = e + Ie, p = _e(i);
|
|
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, {});
|
|
1032
1030
|
}), Te(ke, () => {
|
|
1033
|
-
a.document.getElementById(ce(
|
|
1034
|
-
const
|
|
1031
|
+
a.document.getElementById(ce(i)).remove(), ae(i, p);
|
|
1032
|
+
const h = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
|
|
1035
1033
|
try {
|
|
1036
1034
|
const I = e + be;
|
|
1037
|
-
ae(I,
|
|
1038
|
-
const g =
|
|
1035
|
+
ae(I, p);
|
|
1036
|
+
const g = oe(i, h), T = oe(I, { muted: !0, ...h });
|
|
1039
1037
|
if (!g || !T) return;
|
|
1040
|
-
((d,
|
|
1038
|
+
((d, w, j) => {
|
|
1041
1039
|
d.addClass(`ul${be}`);
|
|
1042
1040
|
const b = new (a.videojs.getComponent("Component"))(d);
|
|
1043
|
-
|
|
1041
|
+
w && d.src(w), d.addChild(b), j && j(d);
|
|
1044
1042
|
})(T, l, c), l || T.addClass(D);
|
|
1045
1043
|
const f = Le(g, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), L = f.children().find((d) => d.name_ === "FullscreenToggle");
|
|
1046
|
-
L.hasClass("vjs-disabled") && L.hide(),
|
|
1044
|
+
L.hasClass("vjs-disabled") && L.hide(), Re(g, f, n, o, t, T);
|
|
1047
1045
|
} catch (I) {
|
|
1048
|
-
return void
|
|
1046
|
+
return void $(new Error(`Error when creating video player object ${I}`), "playerDeviceError", r, {});
|
|
1049
1047
|
}
|
|
1050
|
-
}),
|
|
1051
|
-
},
|
|
1048
|
+
}), p;
|
|
1049
|
+
}, gn = (e, n = {}, o = "https://api.userleap.com", t, r, s, l = !1, c = document) => {
|
|
1052
1050
|
a.document = c;
|
|
1053
|
-
const
|
|
1054
|
-
return a.document.addEventListener("securitypolicyviolation", (
|
|
1055
|
-
|
|
1056
|
-
}), Te(ke.concat(
|
|
1057
|
-
ae(
|
|
1051
|
+
const i = e + De, p = _e(i);
|
|
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();
|
|
1058
1056
|
try {
|
|
1059
|
-
|
|
1060
|
-
} catch (
|
|
1061
|
-
return void
|
|
1057
|
+
Qe(p, i, n, o, t, r, s, l);
|
|
1058
|
+
} catch (h) {
|
|
1059
|
+
return void $(new Error(`Error when creating video recorder player object ${h}`), "recorderDeviceError", o, s, n.visitorId, n.envId);
|
|
1062
1060
|
}
|
|
1063
|
-
}),
|
|
1064
|
-
},
|
|
1061
|
+
}), p;
|
|
1062
|
+
}, bn = (e) => {
|
|
1065
1063
|
const n = e + De;
|
|
1066
1064
|
if (a.document.getElementById(n) && a.videojs) {
|
|
1067
1065
|
try {
|
|
@@ -1071,33 +1069,31 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, met
|
|
|
1071
1069
|
}
|
|
1072
1070
|
a.videojs(n).record().stop(), a.videojs(n).record().stopDevice();
|
|
1073
1071
|
}
|
|
1074
|
-
},
|
|
1075
|
-
const n =
|
|
1072
|
+
}, fn = (e) => {
|
|
1073
|
+
const n = oe(e + Ie);
|
|
1076
1074
|
n == null || n.pause();
|
|
1077
|
-
},
|
|
1075
|
+
}, en = (e) => {
|
|
1078
1076
|
if (!e) return null;
|
|
1079
1077
|
const n = e.match(/https:\/\/stream.mux.com\/(.*)/);
|
|
1080
1078
|
let o = n ? n[1] : null;
|
|
1081
1079
|
return o.includes(ge) && (o = o.replace(ge, "")), o ? `https://image.mux.com/${o}/thumbnail.jpg?time=0` : null;
|
|
1082
|
-
}, 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" },
|
|
1080
|
+
}, 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" }, P = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" };
|
|
1083
1081
|
export {
|
|
1084
|
-
|
|
1082
|
+
Ne as B,
|
|
1085
1083
|
$e as H,
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
vn as Q,
|
|
1084
|
+
ln as L,
|
|
1085
|
+
dn as M,
|
|
1086
|
+
cn as O,
|
|
1087
|
+
un as Q,
|
|
1091
1088
|
x as R,
|
|
1092
|
-
|
|
1089
|
+
vn as S,
|
|
1093
1090
|
pn as a,
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
Cn as s,
|
|
1091
|
+
sn as b,
|
|
1092
|
+
gn as c,
|
|
1093
|
+
an as d,
|
|
1094
|
+
hn as g,
|
|
1095
|
+
fn as p,
|
|
1096
|
+
bn as s,
|
|
1101
1097
|
ze as u,
|
|
1102
|
-
|
|
1098
|
+
mn as v
|
|
1103
1099
|
};
|