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