@sprig-technologies/sprig-browser 2.43.0 → 2.44.1
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-9DbZAKes.cjs +1 -0
- package/dist/conversational-ui-DATX1Rzh.js +614 -0
- package/dist/conversational-v2-styles-BuQiqTAN.js +4 -0
- package/dist/conversational-v2-styles-C-AtgFtc.cjs +1 -0
- package/dist/{core-DJ3Dpomz.js → core-C0ciuTvK.js} +22 -22
- package/dist/{core-wqg-G3hc.cjs → core-Vobbc_vZ.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-BiflywHi.js +756 -0
- package/dist/index-CkWsBT9s.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-DDWVWGid.js → metricsReporter-Cnou16yM.js} +1 -1
- package/dist/{metricsReporter-BAjv1fmT.cjs → metricsReporter-DvTMi1WJ.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +116 -111
- package/dist/{videoPlayer-Cj-utOH3.js → videoPlayer-CmLaWmsH.js} +223 -227
- package/dist/{videoPlayer-DD0Jmq0y.cjs → videoPlayer-ukQj6AnT.cjs} +4 -4
- package/dist/view-B4JucFRs.js +1789 -0
- package/dist/view-Cn-0mZ7q.cjs +1 -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/conversational-v2-styles-D3WQxdro.cjs +0 -1
- package/dist/conversational-v2-styles-XFcJt3-u.js +0 -4
- 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,13 +1,13 @@
|
|
|
1
|
-
import { u
|
|
2
|
-
import { g as He, i as Se, E as
|
|
3
|
-
import { d as
|
|
4
|
-
import { v as
|
|
5
|
-
const
|
|
1
|
+
import { u, c as _, a as $, F as Me, h as de, p as J, _ as K, g as Ce, S as Oe, b as le, y as ue, d as Be } from "./view-B4JucFRs.js";
|
|
2
|
+
import { g as He, i as Se, E as Ve, b as ye } from "./core-C0ciuTvK.js";
|
|
3
|
+
import { d as Ue } from "./debounce-CMb8f7wh.js";
|
|
4
|
+
import { v as Fe } from "./metricsReporter-Cnou16yM.js";
|
|
5
|
+
const Ne = (e) => u("button", { ...e, className: _("ul-card-text__button", e.className), id: "ul-card-text__button" }), $e = ({ html: e, ...n }) => {
|
|
6
6
|
const { enableCspTrustedTypes: o } = $((i) => ({ enableCspTrustedTypes: i.enableCspTrustedTypes })), t = Me(() => He(e, o), [o, e]);
|
|
7
|
-
return
|
|
7
|
+
return u("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
8
8
|
}, xe = () => {
|
|
9
9
|
const { viewDocument: e } = $((t) => ({ viewDocument: t.viewDocument })), [n, o] = de(!1);
|
|
10
|
-
return
|
|
10
|
+
return J(() => {
|
|
11
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));
|
|
@@ -17,11 +17,11 @@ const Fe = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
|
|
|
17
17
|
t && i.disconnect();
|
|
18
18
|
};
|
|
19
19
|
}, [e]), n;
|
|
20
|
-
}, ve = ({ plainText: e, richText: n, id: o, className: t, isHeader: i, showAsterisk: s }) => n ?
|
|
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 ? u($e, { className: t, html: n, id: o }) : e ? i ? u("h1", { className: t, id: o, children: [e, s && "*"] }) : u("p", { className: t, id: o, children: e }) : null, rn = ({ message: e, properties: n, isRequired: o }) => {
|
|
21
|
+
const t = K(null), i = n == null ? void 0 : n.captionText, s = xe();
|
|
22
|
+
return u("div", { className: _("question-header-container", "sprig-header-container", s ? "sprig-border-bottom" : null), ref: t, children: [u("div", { className: "question-header-button-container", children: u(ve, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: n == null ? void 0 : n.questionHtml, showAsterisk: o }) }), u(ve, { className: "ul-caption", id: "ul-caption", plainText: i, richText: n == null ? void 0 : n.captionHtml })] });
|
|
23
|
+
}, Ae = () => u("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: u("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), sn = ({ isSubmitDisabled: e, handleSubmit: n }) => u("div", { className: "ul-card-longform__submit-button-container", children: u(Ne, { className: "ul-card-longform__submit-button", disabled: e, onClick: n, children: ["OK ", u(Ae, {})] }) }), ln = (e, n) => {
|
|
24
|
+
const o = K(0);
|
|
25
25
|
return () => {
|
|
26
26
|
if (e.current) {
|
|
27
27
|
const t = e.current;
|
|
@@ -32,132 +32,130 @@ const Fe = (e) => v("button", { ...e, className: _("ul-card-text__button", e.cla
|
|
|
32
32
|
}), o.current = l, t.style.height = `${l}px`;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
},
|
|
35
|
+
}, an = (e) => {
|
|
36
|
+
const n = K(), { setAllResponsesRaw: o } = $((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((i) => e[i] !== t[i])) && (o(e), n.current = e);
|
|
40
|
+
}, [e, o]);
|
|
41
|
+
}, he = ({ buttonText: e = "View Prototype", handleClick: n }) => u("button", { className: "prototype-button", onClick: n, children: e }, "prototype-btn"), dn = ({ embeddedType: e = "prototype", properties: n, children: o }) => {
|
|
36
42
|
var I;
|
|
37
|
-
const { handleClickEmbedButton: t, hasViewedEmbed: i, headers: s, useDesktopPrototype: l } = $((g) => ({ handleClickEmbedButton: g.handleClickEmbedButton, hasViewedEmbed: g.hasViewedEmbed, headers: g.headers, useDesktopPrototype: g.useDesktopPrototype })),
|
|
43
|
+
const { handleClickEmbedButton: t, hasViewedEmbed: i, headers: s, useDesktopPrototype: l } = $((g) => ({ handleClickEmbedButton: g.handleClickEmbedButton, hasViewedEmbed: g.hasViewedEmbed, headers: g.headers, useDesktopPrototype: g.useDesktopPrototype })), v = (n == null ? void 0 : n.conceptUrl) || ((I = n == null ? void 0 : n.consentDocument) == null ? void 0 : I.url), r = window.innerWidth < Ve, c = s["userleap-platform"], h = (g, T) => {
|
|
38
44
|
g.preventDefault(), t(T);
|
|
39
45
|
};
|
|
40
46
|
if ((() => {
|
|
41
|
-
const { update: g, index: T, isConversationalUI: f, viewDocument: L } = $(({ update:
|
|
42
|
-
|
|
47
|
+
const { update: g, index: T, isConversationalUI: f, viewDocument: L } = $(({ update: w, index: j, isConversationalUI: b, viewDocument: k }) => ({ update: w, index: j, isConversationalUI: b, viewDocument: k })), d = Ue(g, 100);
|
|
48
|
+
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 && r && !i &&
|
|
50
|
-
if (e === "prototype") return
|
|
51
|
-
|
|
55
|
+
})(), !l && r && !i && v && ["email", "link"].includes(c)) {
|
|
56
|
+
if (e === "prototype") return u(he, { handleClick: (g) => {
|
|
57
|
+
h(g, "question.prototype.click");
|
|
52
58
|
} });
|
|
53
|
-
if (e === "pdf") return
|
|
54
|
-
|
|
59
|
+
if (e === "pdf") return u(he, { buttonText: (n == null ? void 0 : n.viewDocumentText) || "View Document", handleClick: (g) => {
|
|
60
|
+
h(g, "question.agreement.click");
|
|
55
61
|
} });
|
|
56
62
|
}
|
|
57
|
-
return
|
|
58
|
-
},
|
|
59
|
-
const { styleNonce: d, viewDocument:
|
|
60
|
-
|
|
61
|
-
const k = ({ isSelected:
|
|
62
|
-
L && L({ id:
|
|
63
|
-
}, M = (
|
|
64
|
-
f || (
|
|
63
|
+
return u(Ce, { children: o });
|
|
64
|
+
}, je = ({ isSelected: e, id: n, divId: o, themeColor: t, disabled: i = !1 }) => u("div", { "aria-checked": e, "aria-disabled": i, "aria-labelledby": `label-${n}`, className: "select-checkbox", id: o, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...i ? { opacity: 0.5 } : {} }, tabIndex: i ? -1 : 0, children: e && u(Oe, {}) }), cn = ({ ariaLabel: e, border: n, choiceStyle: o = {}, label: t, isSelected: i, value: s, text: l, id: v, isRadio: r, useMobileStyling: c, error: h, allowTextEntry: I, noneOfTheAbove: g, promptText: T, disabled: f = !1, onUserInputChanged: L }) => {
|
|
65
|
+
const { styleNonce: d, viewDocument: w } = $((E) => ({ styleNonce: E.styleNonce, viewDocument: E.viewDocument })), [j, b] = de(!1);
|
|
66
|
+
qe(w, n, d);
|
|
67
|
+
const k = ({ isSelected: E, userText: y }) => {
|
|
68
|
+
L && L({ id: v, selected: E, value: s, userText: y, noneOfTheAbove: g });
|
|
69
|
+
}, M = (E) => {
|
|
70
|
+
f || (E.stopPropagation(), k({ isSelected: r || !i, 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 = r ? `radio-${
|
|
74
|
-
return
|
|
75
|
-
},
|
|
76
|
-
const i =
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}, onClick: (
|
|
82
|
-
|
|
83
|
-
}, onKeyPress: (
|
|
84
|
-
|
|
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 = r ? `radio-${v}` : `checkbox-${v}`, p = i || j ? [ee] : [], C = [...h ? [Ee] : [], ...p, ...f ? ["ul-choice-disabled"] : []], m = t ? { "aria-labelledby": `label-${v}` } : { "aria-label": e };
|
|
80
|
+
return u("div", { className: _(le("choice", c), ...C), id: `choice-div-${v}`, style: { ...o, ...h ? { borderColor: ye } : {}, ...f ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...f ? {} : B, "aria-disabled": f, children: [u("div", { className: _("choice-label-container"), children: [r ? u("div", { ...m, className: _("select-radio", ...p), id: W, role: "radio", tabIndex: 0 }) : u(je, { disabled: f, divId: W, id: v, isSelected: i, themeColor: n }), t && u("label", { className: _(le("select-label", c)), htmlFor: W, id: `label-${v}`, children: t })] }), I && i && u("div", { className: _("choice-text-entry-container", ...p), children: u(ze, { onTextChange: (E) => k({ isSelected: i, userText: E }), promptText: T || "Please specify", textValue: l, useMobileStyling: c }) })] });
|
|
81
|
+
}, ze = ({ promptText: e, textValue: n, onTextChange: o, useMobileStyling: t }) => {
|
|
82
|
+
const i = K(null);
|
|
83
|
+
return J(() => {
|
|
84
|
+
i.current && i.current.focus();
|
|
85
|
+
}, []), u("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: _(le("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (s) => {
|
|
86
|
+
s.stopPropagation(), o(s.currentTarget.value);
|
|
87
|
+
}, onClick: (s) => {
|
|
88
|
+
s.stopPropagation();
|
|
89
|
+
}, onKeyPress: (s) => {
|
|
90
|
+
s.stopPropagation();
|
|
85
91
|
}, placeholder: e, ref: i, role: "textbox", rows: 1, value: n });
|
|
86
|
-
},
|
|
87
|
-
let t = e.getElementById(
|
|
88
|
-
t || (t = e.createElement("style"), i = !0), t.tagName.toLowerCase() === "style" && (t.id =
|
|
89
|
-
},
|
|
90
|
-
.${
|
|
92
|
+
}, me = "ul-select-style-element", ee = "ul-select-active-dynamic-style", Ee = "ul-select-error-dynamic-style", qe = (e, n, o) => {
|
|
93
|
+
let t = e.getElementById(me), i = !1;
|
|
94
|
+
t || (t = e.createElement("style"), i = !0), t.tagName.toLowerCase() === "style" && (t.id = me, o && (t.nonce = o), t.textContent = Ze(n), i && e.head.appendChild(t));
|
|
95
|
+
}, Ze = (e) => `
|
|
96
|
+
.${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 }) =>
|
|
106
|
+
`, pn = ({ children: e }) => u("div", { className: "sprig-question-body", children: e }), un = ({ children: e }) => {
|
|
101
107
|
const n = xe(), { isConversationalUI: o } = $((t) => ({ isConversationalUI: t.isConversationalUI }));
|
|
102
|
-
return
|
|
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;
|
|
108
|
+
return u("div", { className: _("sprig-question-footer-container", n && !o ? "sprig-border-top" : null), children: e });
|
|
109
|
+
}, Ge = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: i, dropdownFooter: s, panelRef: l }) => {
|
|
110
|
+
const { themeColor: v } = $((r) => ({ doc: r.viewDocument, themeColor: r.border }));
|
|
111
|
+
return u("div", { className: "select-list", ref: l, children: [e.map((r) => {
|
|
112
|
+
return u("div", { "aria-disabled": i == null ? void 0 : i.includes(r), className: _("select-option", i != null && i.includes(r) ? "ul-choice-disabled" : ""), onClick: (h) => {
|
|
113
|
+
i != null && i.includes(r) || (n(r), h.stopPropagation());
|
|
114
|
+
}, role: "option", style: { ...i != null && i.includes(r) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && u(je, { divId: (c = r.id, `checkbox-div-${c}`), id: r.id, isSelected: o.includes(r), themeColor: v }), r.label] }, r.id);
|
|
115
|
+
var c;
|
|
118
116
|
}), s] });
|
|
119
|
-
},
|
|
120
|
-
const [r,
|
|
121
|
-
|
|
117
|
+
}, vn = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: o, options: t, placeholderText: i, value: s, disabledOptions: l = [], dropdownFooter: v }) => {
|
|
118
|
+
const [r, c] = de(!1), h = K(null), { viewDocument: I, update: g, isConversationalUI: T } = $((d) => ({ viewDocument: d.viewDocument, update: d.update, isConversationalUI: d.isConversationalUI })), f = () => {
|
|
119
|
+
c(!r);
|
|
122
120
|
};
|
|
123
|
-
|
|
121
|
+
ue(() => {
|
|
124
122
|
T || g();
|
|
125
|
-
}, [r, T, g]),
|
|
126
|
-
r &&
|
|
127
|
-
}, [r]),
|
|
128
|
-
var
|
|
129
|
-
const d = (
|
|
130
|
-
const b =
|
|
131
|
-
(b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) ||
|
|
123
|
+
}, [r, T, g]), ue(() => {
|
|
124
|
+
r && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
125
|
+
}, [r]), 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")) || c(!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
|
|
148
|
+
return u(Ce, { children: [u("button", { "aria-label": "choice dropdown button", className: _("select-button", ...L), onClick: (d) => {
|
|
151
149
|
d.stopPropagation(), f();
|
|
152
|
-
}, type: "button", children: [
|
|
150
|
+
}, type: "button", children: [u("span", { children: s.length === 0 ? i : s.length === 1 ? s[0].label : `${s.length} ${n}` }), u(Be, {})] }), r && u(Ge, { disabledOptions: l, dropdownFooter: v, options: t, panelRef: h, selectedOptions: s, selectItem: (d) => {
|
|
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
|
+
}, We = { "{{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 i = [], s = ((l,
|
|
171
|
-
let
|
|
172
|
-
for (const [
|
|
173
|
-
const g = new RegExp(
|
|
174
|
-
|
|
175
|
-
} else r.push(
|
|
176
|
-
return
|
|
168
|
+
const i = [], s = ((l, v, r) => {
|
|
169
|
+
let c = l;
|
|
170
|
+
for (const [h, I] of Object.entries(We)) if (c.toLowerCase().includes(h)) if (v[I]) {
|
|
171
|
+
const g = new RegExp(h, "gi");
|
|
172
|
+
c = c.replace(g, v[I]);
|
|
173
|
+
} else r.push(h);
|
|
174
|
+
return c;
|
|
177
175
|
})(t, n, i);
|
|
178
|
-
return i.length === 0 ? s : ((l,
|
|
176
|
+
return i.length === 0 ? s : ((l, v) => {
|
|
179
177
|
if (!l.includes("?")) return l;
|
|
180
|
-
const r = l.slice(0, l.indexOf("?")),
|
|
181
|
-
return
|
|
178
|
+
const r = l.slice(0, l.indexOf("?")), c = l.slice(l.indexOf("?") + 1).split("&").map((h) => h.split("=")).filter((h) => !v.includes(h[1]));
|
|
179
|
+
return c.length === 0 ? r : `${r}?${c.map((h) => h.join("=")).join("&")}`;
|
|
182
180
|
})(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",
|
|
181
|
+
}, G = "https://cdn.sprig.com", a = { document: void 0, videojs: void 0 }, ce = (e) => e + "-loading-spiner", D = "hidden", ge = ".m3u8", te = "questionId", re = "ul-video-recorder-camera-off-button", ie = "ul-recording-in-session", Ye = [{ type: "link", content: `${G}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${G}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${G}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${G}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${G}/userleap-web-upchunk-v2.2.2.js` }], ke = [{ type: "link", content: `${G}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${G}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
|
|
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
|
|
839
|
+
let V, fe;
|
|
842
840
|
const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, metadata: s }) => {
|
|
843
841
|
const l = a.document.documentElement;
|
|
844
842
|
if (!t || !i) return;
|
|
845
|
-
const
|
|
846
|
-
(await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(
|
|
847
|
-
},
|
|
843
|
+
const v = { event: `SDK - ${e}`, visitorId: t, environmentId: i, metadata: { ...s || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language } };
|
|
844
|
+
(await fetch(`${n}/sdk/1/visitors/${t}/analytics`, { method: "POST", cache: "no-cache", headers: o, body: JSON.stringify(v) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
|
|
845
|
+
}, N = async (e, n, o, t, i, s) => {
|
|
848
846
|
z({ event: `Video Error ${n}`, apiBase: o, headers: t, visitorId: i, envId: s, metadata: { errorMessage: e.message } });
|
|
849
|
-
const l = a.document.documentElement,
|
|
847
|
+
const l = a.document.documentElement, v = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language }, r = { action: n, err: { message: e.message, stack: e.stack }, meta: v, vid: i, envId: s };
|
|
850
848
|
(await fetch(`${o}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...t, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(r) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
|
|
851
849
|
}, Te = (e, n) => {
|
|
852
850
|
if (e.length === 0) return n && n();
|
|
853
|
-
Promise.all(e.reduce((o, t) => (o.push(((i, { type: s, content: l }) => new Promise(function(
|
|
854
|
-
let
|
|
855
|
-
s === "script" ? (
|
|
856
|
-
|
|
857
|
-
},
|
|
851
|
+
Promise.all(e.reduce((o, t) => (o.push(((i, { type: s, content: l }) => new Promise(function(v, r) {
|
|
852
|
+
let c;
|
|
853
|
+
s === "script" ? (c = a.document.createElement("script"), c.src = l) : s === "link" ? (c = a.document.createElement("link"), c.rel = "stylesheet", c.href = l, c.type = "text/css") : (c = a.document.createElement("style"), c.innerHTML = l), c.onload = function() {
|
|
854
|
+
v(l);
|
|
855
|
+
}, c.onerror = function() {
|
|
858
856
|
r(l);
|
|
859
|
-
},
|
|
857
|
+
}, c.async = !1, c.id = btoa(l), i.appendChild(c);
|
|
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
|
+
}), Je(o), o;
|
|
878
|
+
}, Je = (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, i = !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
|
|
895
|
-
!o || !i &&
|
|
896
|
-
i || !o ||
|
|
892
|
+
const v = o && o.src ? Xe(o.src) : null;
|
|
893
|
+
!o || !i && v ? (e.audioPlayerPlaceholder.hide(), a.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", v && e.poster(v)) : (e.children()[0].classList.add("vjs-hidden"), a.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
|
|
894
|
+
i || !o || v || Qe(e), s == null || s.play();
|
|
897
895
|
}), e.on("pause", () => {
|
|
898
896
|
s == null || s.pause();
|
|
899
897
|
}), e.on("seeked", () => {
|
|
@@ -901,110 +899,110 @@ 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
|
+
}, Ke = (e, n, o, t, i, s, l, v = !1) => {
|
|
905
903
|
fe = Date.now();
|
|
906
|
-
const r =
|
|
904
|
+
const r = oe(n, { controls: !1, bigPlayButton: !1, fluid: !1, width: 1280, height: 720, playsinline: !0, plugins: { record: { audio: !0, video: { mandatory: { minWidth: 1280, minHeight: 720 } }, frameWidth: 1280, frameHeight: 720, maxLength: 600, autoMuteDevice: !0 } } });
|
|
907
905
|
if (!r) return;
|
|
908
906
|
r.payload = o;
|
|
909
|
-
const { surveyId:
|
|
907
|
+
const { surveyId: c, questionId: h, responseGroupUid: I, visitorId: g, envId: T } = o;
|
|
910
908
|
let f;
|
|
911
909
|
const L = (p) => {
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
p ? (r.children()[0].classList.add("vjs-hidden"), b.removeClass(
|
|
910
|
+
const C = re, m = re + "-audio-only";
|
|
911
|
+
we(r.uploadProgressLabel, "none"), V && V.startTime >= fe && V.abort();
|
|
912
|
+
const E = a.document.getElementById("ul-camera-button");
|
|
913
|
+
p ? (r.children()[0].classList.add("vjs-hidden"), b.removeClass(C), b.addClass(m), E.innerHTML = P.TurnOnCamera, r.audioPlayerPlaceholder.removeClass("vjs-hidden"), f == null || f.getTracks().forEach((y) => {
|
|
916
914
|
y.stop();
|
|
917
915
|
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((y) => {
|
|
918
|
-
f = y, y.getVideoTracks().forEach((
|
|
919
|
-
|
|
916
|
+
f = y, y.getVideoTracks().forEach((U) => {
|
|
917
|
+
U.enabled = !1;
|
|
920
918
|
}), r.record().onDeviceReady(y);
|
|
921
919
|
}).catch(r.record().onDeviceError.bind(r.record()))) : (f == null || f.getVideoTracks().forEach((y) => {
|
|
922
920
|
y.enabled = !0;
|
|
923
|
-
}), r.children()[0].classList.remove("vjs-hidden"), r.record().getDevice(), b.removeClass(
|
|
921
|
+
}), r.children()[0].classList.remove("vjs-hidden"), r.record().getDevice(), b.removeClass(m), b.addClass(C), E.innerHTML = P.TurnOffCamera, r.audioPlayerPlaceholder.addClass("vjs-hidden"));
|
|
924
922
|
}, 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:
|
|
923
|
+
d.hasClass(D) || (z({ event: "Video Delete Button Clicked", apiBase: t, headers: l, visitorId: g, envId: T, metadata: { questionId: h, responseGroupUid: I, surveyId: c } }), L(r.cameraOff), i(x.DELETE, {}), b.removeClass(D), d.addClass(D));
|
|
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") && r.cameraOff ? w.style.display = "table" : w.style.display = "flex";
|
|
930
928
|
};
|
|
931
|
-
|
|
929
|
+
j();
|
|
932
930
|
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:
|
|
931
|
+
r.record().isRecording() || (r.cameraOff = !r.cameraOff, z({ event: "Video Camera Button Clicked", apiBase: t, headers: l, visitorId: o.visitorId, envId: o.envId, metadata: { questionId: h, responseGroupUid: I, surveyId: c, cameraOff: r.cameraOff } }), L(r.cameraOff), !d.hasClass(D) && d.addClass(D), i(x.DELETE, {}), j());
|
|
934
932
|
} });
|
|
935
|
-
b.addClass(re), b.el_.appendChild(
|
|
933
|
+
b.addClass(re), b.el_.appendChild(ne(P.TurnOffCamera, "ul-camera-button"));
|
|
936
934
|
const k = new (a.videojs.getComponent("Button"))(r, { clickHandler: () => {
|
|
937
935
|
const p = a.document.getElementById("ul-recorder-toggle");
|
|
938
|
-
if (r.record().isRecording()) r.record().stop(), p && (p.innerHTML =
|
|
936
|
+
if (r.record().isRecording()) r.record().stop(), p && (p.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(), p && (p.innerHTML = P.RecordButton), L(r.cameraOff), i(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), p && (p.innerHTML =
|
|
944
|
-
const
|
|
945
|
-
|
|
941
|
+
k.addClass(ie), O.hide(), b.addClass(D), d.addClass(D), p && (p.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(r, 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
949
|
M.style.visibility = "hidden", M.className = "ul-upload-progress-label", e.appendChild(M), r.uploadProgressLabel = M;
|
|
952
950
|
const Y = Le(r, [d, b, "PlayToggle", k, "FullscreenToggle"]), O = Y.children().find((p) => p.name_ === "FullscreenToggle");
|
|
953
951
|
O.hasClass("vjs-disabled") && O.hide();
|
|
954
952
|
const B = Y.children().find((p) => p.name_ === "PlayToggle");
|
|
955
|
-
B.hide(), d.addClass(D),
|
|
953
|
+
B.hide(), d.addClass(D), Re(r, Y, s, !1, v), r.on("stopRecord", () => {
|
|
956
954
|
k.hide(), B.show(), O.show(), d.removeClass(D);
|
|
957
955
|
}), r.on("deviceReady", () => {
|
|
958
956
|
k.show(), B.hide(), d.addClass(D);
|
|
959
|
-
}), ((p,
|
|
960
|
-
const { surveyId:
|
|
957
|
+
}), ((p, C, m, E, y) => {
|
|
958
|
+
const { surveyId: U, responseGroupUid: q, visitorId: R, envId: H } = p.payload;
|
|
961
959
|
p.on("deviceError", function() {
|
|
962
|
-
console.warn("device error: ", p.deviceErrorCode), p.deviceErrorCode.message === "Permission denied" ? (p.deviceButton.addClass("permission-denied"),
|
|
963
|
-
}), p.on("error", function(Z,
|
|
964
|
-
F
|
|
965
|
-
}), p.on("startRecord", function(Z,
|
|
966
|
-
|
|
960
|
+
console.warn("device error: ", p.deviceErrorCode), p.deviceErrorCode.message === "Permission denied" ? (p.deviceButton.addClass("permission-denied"), m && m(x.ERROR, { type: x.PERMISSION_DENIED }), z({ event: "Video Permission Denied", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(p, te), responseGroupUid: q, surveyId: U } })) : (m && m(x.ERROR, { type: x.OTHER }), N(new Error(p.deviceErrorCode.message), "recorderDeviceError", C, y, R, H));
|
|
961
|
+
}), p.on("error", function(Z, F) {
|
|
962
|
+
N(F || p.error(), "recorderError", C, y, R, H);
|
|
963
|
+
}), p.on("startRecord", function(Z, F) {
|
|
964
|
+
E(p.uploadProgressLabel, "none"), z({ event: "Video Record Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { questionId: se(p, te), responseGroupUid: q, surveyId: U } });
|
|
967
965
|
}), p.on("finishRecord", async function() {
|
|
968
|
-
|
|
966
|
+
E(p.uploadProgressLabel, "start", 0);
|
|
969
967
|
const Z = se(p, te);
|
|
970
|
-
if (!
|
|
968
|
+
if (!U) {
|
|
971
969
|
const S = "internal error: missing fields in payload";
|
|
972
|
-
return
|
|
970
|
+
return m && m(x.ERROR, { type: x.OTHER }), N(new Error(S), "finishRecord", C, y, R, H), null;
|
|
973
971
|
}
|
|
974
972
|
p.record().stopDevice();
|
|
975
|
-
const
|
|
976
|
-
z({ event: "Video Record Finish", apiBase:
|
|
977
|
-
const
|
|
978
|
-
Z && (
|
|
979
|
-
const
|
|
980
|
-
const S = await fetch(`${
|
|
973
|
+
const F = p.cameraOff ? x.MEDIA_TYPE_AUDIO : x.MEDIA_TYPE_VIDEO, A = Fe();
|
|
974
|
+
z({ event: "Video Record Finish", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F } });
|
|
975
|
+
const Q = { surveyId: U, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: F, mediaRecordingUid: A };
|
|
976
|
+
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]: F, [x.MEDIA_RECORDING_UID]: A }), pe.upload.url;
|
|
984
982
|
}
|
|
985
|
-
return
|
|
983
|
+
return m && m(x.ERROR, { type: x.OTHER, response: S }), N(new Error("failed to get upload response with url"), "finishRecord", C, y, R, H), null;
|
|
986
984
|
})();
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}),
|
|
990
|
-
|
|
991
|
-
}),
|
|
992
|
-
|
|
985
|
+
X && (V = a.document.defaultView.UpChunk.createUpload({ endpoint: X, file: new a.document.defaultView.File([p.recordedData], `recording ${F} ${Date.now()}`), chunkSize: 5120 }), V.startTime = Date.now(), z({ event: "Video Upload Start", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F, url: X } }), V.on("error", (S) => {
|
|
986
|
+
E(p.uploadProgressLabel, "none"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), N(S, "finishRecord", C, y, R, H);
|
|
987
|
+
}), V.on("progress", (S) => {
|
|
988
|
+
m && m(x.UPLOAD_PROGRESS, { [x.MEDIA_RECORDING_UID]: A, [x.UPLOAD_PROGRESS_PCT]: S.detail }), E(p.uploadProgressLabel, "progress", S.detail);
|
|
989
|
+
}), V.on("success", () => {
|
|
990
|
+
E(p.uploadProgressLabel, "success"), m && m(x.UPLOAD_FINISHED, { [x.MEDIA_RECORDING_UID]: A }), z({ event: "Video Upload Success", apiBase: C, headers: y, visitorId: R, envId: H, metadata: { mediaRecordingUid: A, questionId: Z, responseGroupUid: q, surveyId: U, mediaType: F, url: X, elapsedMs: V.startTime && Date.now() - V.startTime } });
|
|
993
991
|
}));
|
|
994
992
|
});
|
|
995
|
-
})(r, t, i,
|
|
993
|
+
})(r, t, i, we, l);
|
|
996
994
|
const W = [{ name: "microphone" }];
|
|
997
995
|
!r.cameraOff && W.push({ name: "camera" }), Promise.all(W.map((p) => {
|
|
998
|
-
var
|
|
999
|
-
return (
|
|
996
|
+
var C;
|
|
997
|
+
return (C = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : C.query(p);
|
|
1000
998
|
})).then((p) => {
|
|
1001
|
-
p.reduce((
|
|
999
|
+
p.reduce((C, m) => C & m.state === "granted", !0) && r && (r.deviceButton && r.deviceButton.hide(), r.record().getDevice());
|
|
1002
1000
|
}).catch((p) => {
|
|
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");
|
|
@@ -1022,46 +1020,46 @@ const z = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: i, met
|
|
|
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
1021
|
const i = a.document.createElement("a");
|
|
1024
1022
|
return i.href = "https://videojs.com/html5-video-support/", i.target = "_blank", i.innerHTML = "supports HTML5 video", t.appendChild(i), o.appendChild(t), n.appendChild(o), n;
|
|
1025
|
-
},
|
|
1023
|
+
}, Qe = (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, i = "https://api.sprig.com", s = document, l = null, v = null) => {
|
|
1028
1026
|
a.document = s;
|
|
1029
|
-
const r = e + Ie,
|
|
1030
|
-
return a.document.addEventListener("securitypolicyviolation", (
|
|
1031
|
-
|
|
1027
|
+
const r = e + Ie, c = _e(r);
|
|
1028
|
+
return a.document.addEventListener("securitypolicyviolation", (h) => {
|
|
1029
|
+
N(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
|
|
1032
1030
|
}), Te(ke, () => {
|
|
1033
|
-
a.document.getElementById(ce(r)).remove(), ae(r,
|
|
1034
|
-
const
|
|
1031
|
+
a.document.getElementById(ce(r)).remove(), ae(r, c);
|
|
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, c);
|
|
1036
|
+
const g = oe(r, 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
|
-
|
|
1044
|
-
})(T, l,
|
|
1041
|
+
w && d.src(w), d.addChild(b), j && j(d);
|
|
1042
|
+
})(T, l, v), 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 N(new Error(`Error when creating video player object ${I}`), "playerDeviceError", i, {});
|
|
1049
1047
|
}
|
|
1050
|
-
}),
|
|
1051
|
-
},
|
|
1052
|
-
a.document =
|
|
1053
|
-
const r = e + De,
|
|
1054
|
-
return a.document.addEventListener("securitypolicyviolation", (
|
|
1055
|
-
|
|
1056
|
-
}), Te(ke.concat(
|
|
1057
|
-
ae(r,
|
|
1048
|
+
}), c;
|
|
1049
|
+
}, gn = (e, n = {}, o = "https://api.userleap.com", t, i, s, l = !1, v = document) => {
|
|
1050
|
+
a.document = v;
|
|
1051
|
+
const r = e + De, c = _e(r);
|
|
1052
|
+
return a.document.addEventListener("securitypolicyviolation", (h) => {
|
|
1053
|
+
N(new Error(`Voice & Video feature violates ${h.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", o, s, n.visitorId, n.envId);
|
|
1054
|
+
}), Te(ke.concat(Ye), () => {
|
|
1055
|
+
ae(r, c), a.document.getElementById(ce(r)).remove();
|
|
1058
1056
|
try {
|
|
1059
|
-
|
|
1060
|
-
} catch (
|
|
1061
|
-
return void
|
|
1057
|
+
Ke(c, r, n, o, t, i, s, l);
|
|
1058
|
+
} catch (h) {
|
|
1059
|
+
return void N(new Error(`Error when creating video recorder player object ${h}`), "recorderDeviceError", o, s, n.visitorId, n.envId);
|
|
1062
1060
|
}
|
|
1063
|
-
}),
|
|
1064
|
-
},
|
|
1061
|
+
}), c;
|
|
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
|
+
}, Xe = (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
|
+
sn 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
|
-
|
|
1101
|
-
|
|
1102
|
-
bn as v
|
|
1091
|
+
rn as b,
|
|
1092
|
+
gn as c,
|
|
1093
|
+
an as d,
|
|
1094
|
+
hn as g,
|
|
1095
|
+
fn as p,
|
|
1096
|
+
bn as s,
|
|
1097
|
+
ln as u,
|
|
1098
|
+
mn as v
|
|
1103
1099
|
};
|