@sprig-technologies/sprig-browser 2.40.3 → 2.41.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-BhbQgh6X.cjs +1 -0
- package/dist/conversational-ui-DlnwFL72.js +593 -0
- package/dist/{core-Bu7SvToK.js → core-CRJIQvxS.js} +3 -3
- package/dist/{core-C6T-kQJo.cjs → core-DY4ohxcP.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +64 -5
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-Czw_vkQN.js → getAttributedUrl-CVKJ3sRY.js} +14 -7
- package/dist/{getAttributedUrl-HU3np_BZ.cjs → getAttributedUrl-DxxH9aNE.cjs} +2 -2
- package/dist/index-CA0jioLg.cjs +1 -0
- package/dist/index-Dj3ZmhVC.js +749 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +64 -5
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-0SKeVvnG.cjs → metricsReporter-Dq2lxT-9.cjs} +1 -1
- package/dist/{metricsReporter-MLC5Ejl7.js → metricsReporter-uLWRAnwI.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-Bt__MdRk.js +1722 -0
- package/dist/view-KypSYKm-.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-ui-Cm0ADZ91.js +0 -579
- package/dist/conversational-ui-DWIDxaCY.cjs +0 -1
- package/dist/index-DKYCbzko.cjs +0 -1
- package/dist/index-H_s2z0Uz.js +0 -695
- package/dist/view-BkptC8BC.js +0 -1503
- package/dist/view-DSm0GsZ1.cjs +0 -1
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
import { a as $, u as e, h as O, c as P, b as F, e as K, f as fe, p as re, F as le, _ as J, T as oe, A as Fe, g as ke, i as Ze, j as Ye, k as we, l as ze, m as Ke, n as Xe, w as Re, o as We } from "./view-Bt__MdRk.js";
|
|
2
|
+
import { v as Je, R as Z, B as X, M as W, Q as ee, O as xe, a as te, b as ue, S as et, L as tt, u as rt, H as ce, c as Ce, g as nt, P as at, p as st, d as it, s as ot } from "./getAttributedUrl-CVKJ3sRY.js";
|
|
3
|
+
import { a as ge, D as Se, A as Te, g as lt } from "./core-CRJIQvxS.js";
|
|
4
|
+
import { t as Me } from "./metricsReporter-uLWRAnwI.js";
|
|
5
|
+
const ct = ({ properties: t, surveyVideoUrl: a, questionId: r }) => {
|
|
6
|
+
const n = `ul-card-video__question_player-q${r}`, { apiURL: s, viewDocument: i } = $((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
|
|
7
|
+
return e("div", { id: n, ref: (l) => {
|
|
8
|
+
if (l && l.children.length === 0 && !t.properties.hideRecordedPrompt) {
|
|
9
|
+
const d = Je(n, { src: a, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === Z.MEDIA_TYPE_AUDIO, s, i);
|
|
10
|
+
l.appendChild(d);
|
|
11
|
+
}
|
|
12
|
+
} });
|
|
13
|
+
}, ae = ({ isDisabled: t, onClick: a, children: r }) => e(X, { className: "ul-card__button-checkmark", disabled: t, onClick: a, type: "button", children: [e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#ffffff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), r || "Ok"] }), dt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
|
|
14
|
+
const { useMobileStyling: i, border: l } = $((_) => ({ useMobileStyling: _.useMobileStyling, border: _.border })), [d, c] = O(!1), [v, y] = O(""), [o, p] = O(!1), k = r == null ? void 0 : r.collectName, f = (r == null ? void 0 : r.nameLabelText) || "Full Name", m = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", S = (r == null ? void 0 : r.submitButtonText) || "Submit", N = !!v.trim(), q = d && (!k || N), E = (_, Q = !1) => {
|
|
15
|
+
_.preventDefault(), _.stopPropagation();
|
|
16
|
+
let A = null;
|
|
17
|
+
if (!Q) {
|
|
18
|
+
if (!q) return void p(!0);
|
|
19
|
+
A = { submitted: !0 }, k && (A.name = v);
|
|
20
|
+
}
|
|
21
|
+
a({ value: A, questionId: n, type: s }, !!Q || q);
|
|
22
|
+
};
|
|
23
|
+
return e("div", { className: P(t, "ul-card__consent-legal", "fade-in-transition"), children: e(W, { embeddedType: "pdf", properties: r, children: e(ee, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: l, error: o && !d, id: "consent", isRadio: !1, isSelected: d, label: m, onUserInputChanged: ({ selected: _ }) => {
|
|
24
|
+
_ !== d && c(!d);
|
|
25
|
+
}, useMobileStyling: i }), k && e("input", { "aria-label": f, "aria-placeholder": f, className: P(F("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (_) => {
|
|
26
|
+
_.currentTarget.style.borderColor = o && !N ? ge : Se;
|
|
27
|
+
}, onFocus: (_) => {
|
|
28
|
+
_.currentTarget.style.borderColor = o && !N ? ge : l;
|
|
29
|
+
}, onInput: (_) => {
|
|
30
|
+
_.preventDefault(), _.stopPropagation(), y(_.currentTarget.value);
|
|
31
|
+
}, placeholder: f, style: o && !N ? { borderColor: ge } : {}, tabIndex: 0, value: v })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ae, { isDisabled: !q, onClick: (_) => E(new SubmitEvent(_.type)), children: K({ buttonText: S }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (_) => E(new SubmitEvent(_.type), !0), children: fe(r) })] })] }) }) }, n);
|
|
32
|
+
}, ut = () => {
|
|
33
|
+
const { destroy: t, forceBrandedLogo: a } = $((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
|
|
34
|
+
return re(() => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
t(Te);
|
|
37
|
+
}, a ? 4e3 : 2e3);
|
|
38
|
+
}, [t, a]), e("div", { className: "end-of-survey-text", children: "End of survey" });
|
|
39
|
+
}, pt = ({ activeValue: t, border: a, icon: r, enableCspTrustedTypes: n, isPressed: s, range: i, scaleLabelType: l, selectedValue: d, setSelectedValue: c, setActiveValue: v, setIsPressed: y, useMobileStyling: o, value: p, viewDocument: k }) => {
|
|
40
|
+
const f = `option-${p}`, m = l === "number", S = l === "star", N = l === "smiley", q = m && p === t || p === d, [E, _] = (() => {
|
|
41
|
+
const u = S && d !== null && p <= d;
|
|
42
|
+
return S && p <= t || N && p === t || u || p === t || p === d ? [a, s || u || p === d ? 1 : 0.3] : ["", 1];
|
|
43
|
+
})(), Q = le(() => {
|
|
44
|
+
const u = { borderColor: q ? E : "", fillOpacity: q ? "" : _, zIndex: q ? 3 : "auto", color: d === p ? "#fff" : "" };
|
|
45
|
+
return m ? { ...u, backgroundColor: d === p ? E : "" } : { ...u, color: S || N || d === p ? E : "" };
|
|
46
|
+
}, [q, E, _, d, p, m, S, N]), A = le(() => lt((({ icon: u, scaleLabelType: h, value: x, selectedValue: g }) => {
|
|
47
|
+
if (h === "smiley" && x === g) {
|
|
48
|
+
let b = 0;
|
|
49
|
+
return u.replace(/black/g, () => ++b == 1 ? "black" : "white");
|
|
50
|
+
}
|
|
51
|
+
return u;
|
|
52
|
+
})({ icon: r, scaleLabelType: l, value: p, selectedValue: d }), n), [n, r, l, d, p]);
|
|
53
|
+
return e("button", { "aria-label": m ? void 0 : String(p), className: (() => {
|
|
54
|
+
switch (l) {
|
|
55
|
+
case "star":
|
|
56
|
+
return P(F("likert-star", o), F(`likert-star-${p}`, o));
|
|
57
|
+
case "smiley":
|
|
58
|
+
return P(F("likert-smiley", o), F(`likert-smiley-${p}`, o));
|
|
59
|
+
default:
|
|
60
|
+
return p === i ? P(F("likert-number", o), F(`likert-number-${p}`, o), F("likert-last-option", o)) : P(F("likert-number", o), F(`likert-number-${p}`, o));
|
|
61
|
+
}
|
|
62
|
+
})(), dangerouslySetInnerHTML: { __html: A }, id: f, onClick: (u) => {
|
|
63
|
+
u.preventDefault(), u.stopPropagation(), c(p);
|
|
64
|
+
}, onKeyDown: (u) => {
|
|
65
|
+
var g, b;
|
|
66
|
+
const h = k.querySelectorAll(`.likert-${l ?? "number"}`), x = p - 1;
|
|
67
|
+
u.key === "ArrowRight" ? (g = h[x + 1]) == null || g.focus() : u.key === "ArrowLeft" ? (b = h[x - 1]) == null || b.focus() : u.key !== "Enter" && u.key !== " " || (u.preventDefault(), u.stopPropagation(), c(p));
|
|
68
|
+
}, onPointerDown: () => y(!0), onPointerEnter: () => v(p), onPointerLeave: () => {
|
|
69
|
+
v(-1), y(!1);
|
|
70
|
+
}, style: Q, tabIndex: 0 });
|
|
71
|
+
}, mt = ({ className: t, labels: a, next: r, properties: n, questionId: s, type: i }) => {
|
|
72
|
+
const { border: l, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: v } = $((h) => ({ border: h.border, useMobileStyling: h.useMobileStyling, viewDocument: h.viewDocument, enableCspTrustedTypes: h.enableCspTrustedTypes })), [y, o] = O(-1), [p, k] = O(!1), [f, m] = O(null), S = a && a.left, N = a && a.right;
|
|
73
|
+
let q;
|
|
74
|
+
const { range: E, scaleLabelType: _, ratingIcons: Q } = n;
|
|
75
|
+
E && (q = Number(E));
|
|
76
|
+
const A = q || 5, u = (h) => {
|
|
77
|
+
var x, g;
|
|
78
|
+
switch (_) {
|
|
79
|
+
case "star":
|
|
80
|
+
return (x = Q[0]) == null ? void 0 : x.svg;
|
|
81
|
+
case "smiley":
|
|
82
|
+
return (g = Q[h]) == null ? void 0 : g.svg;
|
|
83
|
+
default:
|
|
84
|
+
return String(h + 1);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return e("form", { className: P(t, "ul-card--likert", "fade-in-transition"), children: e(W, { properties: n, children: [e(te, { children: [e("div", { "aria-label": `Rating (1 - ${A})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(A)].map((h, x) => {
|
|
88
|
+
const g = x + 1;
|
|
89
|
+
return e(pt, { activeValue: y, border: l, enableCspTrustedTypes: v, icon: u(x), isPressed: p, range: A, scaleLabelType: _, selectedValue: f, setActiveValue: o, setIsPressed: k, setSelectedValue: m, useMobileStyling: d, value: g, viewDocument: c }, x);
|
|
90
|
+
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: S }), e("span", { children: N })] })] }), e(ee, { children: e(ae, { isDisabled: f === null && n.required, onClick: () => r({ value: f, questionId: s, type: i }, !0), children: K(n) }) })] }) }, s);
|
|
91
|
+
}, ht = ({ columns: t, onSelect: a, options: r, selectedOptions: n }) => {
|
|
92
|
+
const s = J([]), { border: i, useMobileStyling: l } = $((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling })), d = r.findIndex((p) => n[p.id] === null), [c, v] = O(d), y = oe((p, k) => {
|
|
93
|
+
a(p, k);
|
|
94
|
+
const f = c + 1, m = r[f];
|
|
95
|
+
m && n[m.id] === null && v(f);
|
|
96
|
+
}, [a, r, n, c]), o = oe((p, k) => {
|
|
97
|
+
const f = c === p;
|
|
98
|
+
return e(Fe, { animate: !0, header: k.label, isOpen: f, onClick: () => {
|
|
99
|
+
var m;
|
|
100
|
+
return v(f && !((m = window.UserLeap) != null && m.isMobileSDK) ? -1 : p);
|
|
101
|
+
}, ref: (m) => {
|
|
102
|
+
m && (s.current[p] = m);
|
|
103
|
+
}, showHeaderCheck: n[k.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((m) => e(xe, { allowTextEntry: !1, ariaLabel: `${k.label}-${m.label}`, border: i, error: !1, id: `${k.id}-${m.value}`, isRadio: !0, isSelected: n[k.id] === m.value, label: m.label, onUserInputChanged: () => y(k.id, m.value), useMobileStyling: l }, m.label)) }) }, k.id);
|
|
104
|
+
}, [i, t, c, y, n, l]);
|
|
105
|
+
return e("div", { children: r.map((p, k) => o(k, p)) });
|
|
106
|
+
}, gt = ({ className: t, next: a, options: r, properties: n, questionId: s, type: i, onSubmitButtonClick: l }) => {
|
|
107
|
+
const d = n.matrixColumn, c = n.required, v = (f) => {
|
|
108
|
+
f.preventDefault(), f.stopPropagation(), a({ value: o, questionId: s, type: i }, !0), l && l();
|
|
109
|
+
}, y = r.reduce((f, m) => (f[m.id] = null, f), {}), [o, p] = O(y);
|
|
110
|
+
return e("form", { className: P(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: v, children: e(W, { properties: n, children: [e(te, { children: e(ht, { columns: d, onSelect: (f, m) => {
|
|
111
|
+
p((S) => ({ ...S, [f]: m }));
|
|
112
|
+
}, options: r, selectedOptions: o }) }), e(ee, { children: e(ae, { isDisabled: (k = o, c && Object.values(k).every((f) => f == null)), onClick: () => v(new SubmitEvent("submit")), children: K(n) }) })] }) }, s);
|
|
113
|
+
var k;
|
|
114
|
+
}, Ue = ({ className: t, onSubmit: a, options: r = [], properties: n, questionId: s, type: i, showIndividualSubmit: l = !1, onSubmitButtonClick: d }) => {
|
|
115
|
+
const { border: c, useMobileStyling: v } = $((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), y = r.reduce((g, b) => (g[b.id] = { isSelected: !1 }, g), {}), [o, p] = O(y), k = i === "multiplechoice", f = n.required, m = r.find((g) => {
|
|
116
|
+
var b;
|
|
117
|
+
return (b = g.optionProperties) == null ? void 0 : b.noneOfTheAbove;
|
|
118
|
+
}), S = (g) => Object.entries(g).some(([b, I]) => {
|
|
119
|
+
var H;
|
|
120
|
+
const L = r.find((V) => `${V.id}` === b), R = I.userText === void 0 || I.userText.trim() === "";
|
|
121
|
+
return ((H = L == null ? void 0 : L.optionProperties) == null ? void 0 : H.allowsTextEntry) && R && I.isSelected;
|
|
122
|
+
}), N = (g) => Object.values(g).filter((b) => b.isSelected).length, q = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && N(o) < n.minSelect && (f || N(o) > 0), E = (g) => S(g) || f && !N(g) || !((b) => {
|
|
123
|
+
const { minSelect: I = 0, maxSelect: L = 1 / 0, maxSelectMode: R } = n, H = N(b);
|
|
124
|
+
switch (R) {
|
|
125
|
+
case ue.Maximum:
|
|
126
|
+
return H <= L;
|
|
127
|
+
case ue.Range:
|
|
128
|
+
return H === 0 || H >= I;
|
|
129
|
+
default:
|
|
130
|
+
return !0;
|
|
131
|
+
}
|
|
132
|
+
})(g), _ = Object.entries(o).some(([g, b]) => {
|
|
133
|
+
var I, L;
|
|
134
|
+
return b.isSelected && ((L = (I = r.find((R) => `${R.id}` === g)) == null ? void 0 : I.optionProperties) == null ? void 0 : L.allowsTextEntry);
|
|
135
|
+
}), Q = l && (!k || _), A = (g) => {
|
|
136
|
+
x(g.id, g.selected, g.userText, g.noneOfTheAbove);
|
|
137
|
+
}, u = (g) => {
|
|
138
|
+
var b;
|
|
139
|
+
return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && N(o) === (n == null ? void 0 : n.maxSelect) && !((b = o[g]) != null && b.isSelected);
|
|
140
|
+
}, h = () => {
|
|
141
|
+
a(o, !0), d && d();
|
|
142
|
+
}, x = (g, b, I, L) => {
|
|
143
|
+
const R = Object.assign({}, o);
|
|
144
|
+
if ((k || L) && b) for (const H of Object.values(R)) H.isSelected = !1, delete H.userText;
|
|
145
|
+
else m && !L && o[m.id].isSelected && (R[m.id].isSelected = !1);
|
|
146
|
+
R[g] = { isSelected: b, userText: I }, p(R);
|
|
147
|
+
};
|
|
148
|
+
return e("form", { className: P(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: h, children: e(W, { properties: n, children: [e(te, { children: [n.isDropdown ? e(et, { disabledOptions: r.filter((g) => u(g.id)), dropdownFooter: q ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [N(o), "/", n.minSelect] }) : void 0, isMultiSelect: !k, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
|
|
149
|
+
const b = { ...o };
|
|
150
|
+
for (const I of r) g.includes(I) ? b[I.id].isSelected = !0 : b[I.id].isSelected = !1;
|
|
151
|
+
p(b);
|
|
152
|
+
}, options: r, placeholderText: n.dropdownPlaceholderText ?? (k ? "Select choice" : "Select choice(s)"), value: r.filter((g) => o[g.id].isSelected) }) : e("div", { className: P(F("ul-card__choices", v)), role: k ? "radiogroup" : "group", children: [r.map(({ id: g, label: b, value: I, optionProperties: L }) => {
|
|
153
|
+
var j, ne;
|
|
154
|
+
const R = `${g}`, { allowsTextEntry: H, noneOfTheAbove: V } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...L };
|
|
155
|
+
return e(xe, { allowTextEntry: H, border: c, disabled: u(R), error: (G = o, S(G)), id: R, isRadio: k, isSelected: !!((j = o[R]) != null && j.isSelected), label: b, noneOfTheAbove: V, onUserInputChanged: A, promptText: "Please specify", text: (ne = o[g]) == null ? void 0 : ne.userText, useMobileStyling: v, value: I }, R);
|
|
156
|
+
var G;
|
|
157
|
+
}), !!q && e("div", { className: "ul-card__min-select-counter", children: [N(o), "/", n.minSelect] })] }), Q && e(tt, { handleSubmit: h, isSubmitDisabled: E(o) })] }), e(ee, { children: e(ae, { isDisabled: E(o), onClick: h, children: K(n) }) })] }) }, s);
|
|
158
|
+
}, vt = (t) => {
|
|
159
|
+
const { questionId: a, type: r, next: n, options: s } = t;
|
|
160
|
+
return e(Ue, { ...t, onSubmit: (i, l) => {
|
|
161
|
+
const d = Object.entries(i).find(([, p]) => p.isSelected) || [void 0, void 0], [c, v] = d, y = s.find((p) => `${p.id}` === c), o = v != null && v.userText ? { [c]: { userText: v.userText } } : null;
|
|
162
|
+
n({ value: y && c ? { [c]: y.value } : {}, secondaryValue: o, questionId: a, type: r }, l);
|
|
163
|
+
} });
|
|
164
|
+
}, bt = (t) => {
|
|
165
|
+
const { questionId: a, type: r, next: n } = t;
|
|
166
|
+
return e(Ue, { ...t, onSubmit: (s, i) => {
|
|
167
|
+
const l = Object.entries(s).reduce((c, [v, y]) => (c[v] = y.isSelected, c), {}), d = Object.entries(s).reduce((c, [v, y]) => {
|
|
168
|
+
if (!y.userText) return c;
|
|
169
|
+
const o = c || {};
|
|
170
|
+
return o[v] = { userText: y.userText }, o;
|
|
171
|
+
}, null);
|
|
172
|
+
n({ value: l, secondaryValue: d, questionId: a, type: r }, i);
|
|
173
|
+
} });
|
|
174
|
+
}, yt = ({ className: t, labels: a, properties: r, next: n, questionId: s, type: i }) => {
|
|
175
|
+
const [l, d] = O(null), { border: c, useMobileStyling: v, viewDocument: y } = $((k) => ({ border: k.border, useMobileStyling: k.useMobileStyling, viewDocument: k.viewDocument })), o = a && a.left, p = a && a.right;
|
|
176
|
+
return e("form", { className: P(t, "ul-card--nps", "fade-in-transition"), children: e(W, { properties: r, children: [e(te, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((k, f) => e("button", { className: P(F("nps-number", v), F(`nps-number-${f}`, v)), id: `option-${f}`, onClick: (m) => {
|
|
177
|
+
m.preventDefault(), m.stopPropagation(), d(f);
|
|
178
|
+
}, onKeyDown: (m) => {
|
|
179
|
+
var N, q;
|
|
180
|
+
const S = y.querySelectorAll("button.nps-number");
|
|
181
|
+
m.key === "ArrowRight" ? (N = S[f + 1]) == null || N.focus() : m.key === "ArrowLeft" ? (q = S[f - 1]) == null || q.focus() : m.key !== "Enter" && m.key !== " " || (m.preventDefault(), m.stopPropagation(), d(f));
|
|
182
|
+
}, onPointerDown: (m) => {
|
|
183
|
+
m.currentTarget.style.zIndex = "2", m.currentTarget.style.borderColor = c;
|
|
184
|
+
}, onPointerLeave: (m) => {
|
|
185
|
+
m.currentTarget.style.zIndex = "auto", m.currentTarget.style.borderColor = Se;
|
|
186
|
+
}, style: l === f ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: f }, f)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: o }), e("span", { children: p })] })] }), e(ee, { children: e(ae, { isDisabled: l === null && r.required, onClick: () => n({ value: l, questionId: s, type: i }, !0), children: K(r) }) })] }) }, s);
|
|
187
|
+
}, ft = ({ className: t, next: a, properties: r, questionId: n, type: s, onSubmitButtonClick: i }) => {
|
|
188
|
+
const { border: l, useMobileStyling: d, update: c } = $((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, update: S.update })), [v, y] = O(""), o = J(null), p = v.trim(), k = r.required === !0 && !p, f = rt(o, () => c()), m = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
|
|
189
|
+
return e("form", { className: P(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(W, { properties: r, children: e("div", { className: "ul-card-text", children: [e(te, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": m, className: P(F("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (S) => {
|
|
190
|
+
S.currentTarget.style.borderColor = Se;
|
|
191
|
+
}, onChange: (S) => {
|
|
192
|
+
const { value: N } = S.currentTarget;
|
|
193
|
+
f(), S.preventDefault(), S.stopPropagation(), y(N);
|
|
194
|
+
}, onFocus: (S) => {
|
|
195
|
+
S.currentTarget.style.borderColor = l;
|
|
196
|
+
}, placeholder: m, ref: o, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(ee, { children: e(ae, { isDisabled: k, onClick: (S) => {
|
|
197
|
+
S.preventDefault(), S.stopPropagation();
|
|
198
|
+
const N = r.required !== !0 || p.length > 0;
|
|
199
|
+
a({ value: v, questionId: n, type: s }, N), i && i();
|
|
200
|
+
}, children: K(r) }) })] }) }) }, n);
|
|
201
|
+
}, kt = ({ className: t, labels: a, next: r, properties: n, questionId: s, type: i, onSubmitButtonClick: l, options: d }) => {
|
|
202
|
+
const c = J(null), v = J(0), y = J(0), o = J(null), p = J(!1), k = J([]), [f, m] = O(() => (n == null ? void 0 : n.required) === !0), [S, N] = O(() => d.map((C) => ({ ...C, rank: null }))), q = le(() => Array.from({ length: d.length }, (C, w) => w + 1), [d.length]), { useMobileStyling: E, isPreview: _, headers: Q } = $((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), A = (Q == null ? void 0 : Q["userleap-platform"]) === "android", u = E && !_ && !A, h = !u && !A, x = (C, w) => {
|
|
203
|
+
N((D) => {
|
|
204
|
+
const T = parseInt(w), U = D.map((M) => ({ ...M }));
|
|
205
|
+
U.some((M) => M.rank == null) && U.forEach((M, se) => M.rank = se + 1);
|
|
206
|
+
const Y = U.findIndex((M) => M.id === C);
|
|
207
|
+
if (Y === -1) return D;
|
|
208
|
+
const B = U[Y].rank;
|
|
209
|
+
return T < B ? U.forEach((M) => {
|
|
210
|
+
M.id !== C && M.rank >= T && M.rank < B && (M.rank = M.rank + 1);
|
|
211
|
+
}) : T > B && U.forEach((M) => {
|
|
212
|
+
M.id !== C && M.rank > B && M.rank <= T && (M.rank = M.rank - 1);
|
|
213
|
+
}), U[Y].rank = T, U.sort((M, se) => M.rank - se.rank), V(), U;
|
|
214
|
+
});
|
|
215
|
+
}, g = (C, w) => {
|
|
216
|
+
for (let D = 0; D < k.current.length; D++) {
|
|
217
|
+
const T = k.current[D];
|
|
218
|
+
if (!T || T === o.current) continue;
|
|
219
|
+
const U = T.getBoundingClientRect();
|
|
220
|
+
if (C >= U.left && C <= U.right && w >= U.top && w <= U.bottom) return { element: T, index: D };
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}, b = (C) => (w) => {
|
|
224
|
+
if (!u) return;
|
|
225
|
+
w.preventDefault(), w.stopPropagation(), p.current = !0, c.current = C;
|
|
226
|
+
const D = w.touches[0];
|
|
227
|
+
v.current = D.clientY, y.current = D.clientY;
|
|
228
|
+
const T = w.currentTarget.closest(".ul-card-rank__option");
|
|
229
|
+
T && (o.current = T, T.classList.add("is-dragging"));
|
|
230
|
+
}, I = (C) => {
|
|
231
|
+
if (!u || !p.current || c.current === null) return;
|
|
232
|
+
C.preventDefault(), C.stopPropagation();
|
|
233
|
+
const w = C.touches[0];
|
|
234
|
+
y.current = w.clientY;
|
|
235
|
+
const D = y.current - v.current;
|
|
236
|
+
o.current && (o.current.style.transform = `translateY(${D}px)`, o.current.style.zIndex = "1000"), k.current.forEach((U) => {
|
|
237
|
+
U && U !== o.current && U.classList.remove("is-drop-target");
|
|
238
|
+
});
|
|
239
|
+
const T = g(w.clientX, w.clientY);
|
|
240
|
+
T && T.element.classList.add("is-drop-target");
|
|
241
|
+
}, L = (C) => {
|
|
242
|
+
if (!u || !p.current || c.current === null) return;
|
|
243
|
+
C.preventDefault(), C.stopPropagation();
|
|
244
|
+
const w = C.changedTouches[0], D = g(w.clientX, w.clientY);
|
|
245
|
+
o.current && (o.current.style.transform = "", o.current.style.zIndex = "", o.current.classList.remove("is-dragging")), k.current.forEach((T) => {
|
|
246
|
+
T && T.classList.remove("is-drop-target");
|
|
247
|
+
}), D && D.index !== c.current && R(c.current, D.index), c.current = null, o.current = null, p.current = !1;
|
|
248
|
+
}, R = (C, w) => {
|
|
249
|
+
N((D) => {
|
|
250
|
+
const T = D.map((Y) => ({ ...Y })), [U] = T.splice(C, 1);
|
|
251
|
+
return T.splice(w, 0, U), T.forEach((Y, B) => {
|
|
252
|
+
Y.rank = B + 1;
|
|
253
|
+
}), V(), T;
|
|
254
|
+
});
|
|
255
|
+
}, H = (C) => {
|
|
256
|
+
const w = {};
|
|
257
|
+
C.reduce((D, T) => (D[T.id] = T.rank, D), w), r({ value: w, questionId: s, type: i }, !0);
|
|
258
|
+
}, V = () => {
|
|
259
|
+
m(!1);
|
|
260
|
+
}, { left: G, right: j } = a, ne = d.length, de = (C) => {
|
|
261
|
+
C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
|
|
262
|
+
}, Ge = (C) => {
|
|
263
|
+
C.currentTarget.classList.remove("is-drop-target");
|
|
264
|
+
}, je = (C) => {
|
|
265
|
+
c.current = null, C.currentTarget.classList.remove("is-dragging");
|
|
266
|
+
};
|
|
267
|
+
return e("form", { className: P(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
|
|
268
|
+
C.preventDefault(), H(S), l && l();
|
|
269
|
+
}, children: e(W, { properties: n, children: e(ke, A ? { children: [e(te, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", G] }) }), e("ol", { className: "ul-card-rank__list", children: S.map(({ id: C, label: w, rank: D }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${w}`, className: P("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (T) => x(C, T.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((T) => e("option", { className: "ul-card-rank__select-option", value: T, children: T }, `${T}-${s}`))] }), e("span", { children: w })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", j] }) })] }) }), e(ee, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: f, children: K(n) }) }) })] } : { children: [e(te, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", G] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: A ? void 0 : (C) => {
|
|
270
|
+
C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
|
|
271
|
+
}, children: S.map(({ id: C, label: w, rank: D }, T) => {
|
|
272
|
+
return e("li", { className: "ul-card-rank__option", draggable: !!h || void 0, onDragEnd: h ? je : void 0, onDragEnter: h ? de : void 0, onDragLeave: h ? Ge : void 0, onDragStart: h ? (Y = T, (B) => {
|
|
273
|
+
c.current = Y, B.dataTransfer && (B.dataTransfer.effectAllowed = "move", B.dataTransfer.setData("text/plain", String(Y)), B.currentTarget.classList.add("is-dragging"));
|
|
274
|
+
}) : void 0, onDrop: h ? (U = T, (B) => {
|
|
275
|
+
var se, Ie;
|
|
276
|
+
B.preventDefault(), B.currentTarget.classList.remove("is-drop-target");
|
|
277
|
+
const M = c.current;
|
|
278
|
+
c.current = null, (Ie = (se = B.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : se.querySelector(".is-dragging")) == null || Ie.classList.remove("is-dragging"), M != null && M !== U && R(M, U);
|
|
279
|
+
}) : void 0, ref: (B) => k.current[T] = B, children: [e("select", { "aria-label": `Rank for ${w}`, className: P("ul-card-rank__select", D == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (B) => x(C, B.currentTarget.value), value: D ?? "", children: [D == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((B) => e("option", { className: "ul-card-rank__select-option", value: B, children: B }, B))] }), e("span", { children: w }), !A && e("button", { "aria-label": `Drag ${w} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: u ? L : void 0, onTouchMove: u ? I : void 0, onTouchStart: u ? b(T) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, C);
|
|
280
|
+
var U, Y;
|
|
281
|
+
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", j] }) })] }) }), e(ee, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: f, children: K(n) }) }) })] }) }) }, s);
|
|
282
|
+
}, ve = 1, Ee = 2, Ae = 3, pe = (t) => t.type === "av_permission", De = (t) => t.type === "screen_permission", Be = (t, a) => t === void 0 ? ve : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, a) ? Ae : ve : Ee, qe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
283
|
+
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, z = Ze((t) => ({ ...qe, reset: () => {
|
|
284
|
+
t(qe);
|
|
285
|
+
}, updatePage: (a) => {
|
|
286
|
+
t(a);
|
|
287
|
+
} }));
|
|
288
|
+
function be({ currentPage: t, pages: a }) {
|
|
289
|
+
const { avStream: r, recordingMediaTypes: n, updatePage: s } = z.getState(), { recorderEventEmitter: i } = $.getState();
|
|
290
|
+
i.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (l, d) => {
|
|
291
|
+
if (r === l) return;
|
|
292
|
+
let c = t;
|
|
293
|
+
if (l && !t.permissionDescriptors.includes("camera")) {
|
|
294
|
+
const v = a.indexOf(t), y = d != null && d.active ? v + 2 : v + 1;
|
|
295
|
+
d != null && d.active && n && i.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (o) => s({ mediaRecordingUids: o }) }), c = a[y];
|
|
296
|
+
}
|
|
297
|
+
s({ currentPage: c, avStream: l });
|
|
298
|
+
} });
|
|
299
|
+
}
|
|
300
|
+
function ye({ status: t }) {
|
|
301
|
+
const { nextQuestion: a, passthroughData: r, mediaRecordingUids: n, reset: s } = z.getState(), { recorderEventEmitter: i, handleUploadUpdate: l, index: d } = $.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
|
|
302
|
+
r && i.emit("finish.task", { "begin.callback": (v) => {
|
|
303
|
+
l({ mediaRecordingUid: v, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
304
|
+
}, "progress.callback": (v, y) => {
|
|
305
|
+
l({ mediaRecordingUid: v, progressPct: y.detail, isSubmitted: !1, isComplete: !1 });
|
|
306
|
+
}, "upload.callback": (v) => {
|
|
307
|
+
v && l({ mediaRecordingUid: v, isComplete: !0, isSubmitted: !0, progressPct: 100 });
|
|
308
|
+
}, "passthrough.data": r, "current.index": d, "task.response": c, "task.complete.callback": (v) => {
|
|
309
|
+
c.value.taskDurationMillisecond = v, n && (c.value.mediaRecordingUids = n), s(), a(c);
|
|
310
|
+
} });
|
|
311
|
+
}
|
|
312
|
+
function _e({ pages: t, setIsRequestingPermission: a }) {
|
|
313
|
+
const { recorderEventEmitter: r, eventEmitFn: n } = $.getState(), { updatePage: s, currentPage: i, recordingMediaTypes: l, screenPermissionRequested: d } = z.getState();
|
|
314
|
+
if (!i) return;
|
|
315
|
+
const c = t.indexOf(i);
|
|
316
|
+
switch (i.type) {
|
|
317
|
+
case "av_permission": {
|
|
318
|
+
const v = d ? c + 2 : c + 1;
|
|
319
|
+
return d && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (y) => {
|
|
320
|
+
s({ mediaRecordingUids: y });
|
|
321
|
+
} }), void s({ currentPage: t[v] });
|
|
322
|
+
}
|
|
323
|
+
case "screen_permission":
|
|
324
|
+
return void r.emit("screen.permission", { "screen.permission.requested": a, "stream.ready.callback": (v, y) => {
|
|
325
|
+
const o = y ? t[c + 1] : i;
|
|
326
|
+
y && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (p) => {
|
|
327
|
+
s({ captureStream: y, mediaRecordingUids: p });
|
|
328
|
+
} }), s({ currentPage: o, screenPermissionRequested: !0, captureStream: y });
|
|
329
|
+
} });
|
|
330
|
+
case "start_task":
|
|
331
|
+
return n("recorded.task.start"), r.emit("recorded.task.start"), r.emit("start.task"), void s({ currentPage: t[c + 1], screenPermissionRequested: !0 });
|
|
332
|
+
case "complete_task":
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const $e = "ul-permission-graphics-container", Oe = "ul-permission-body", Qe = P($e, "ul_recorded-task-inset-spacing"), me = P("ul-horizontal-button-container", "ul-horizontal-button-container-left"), He = ({ richTextBody: t }) => e(ce, { className: "ul-rich-text-body", html: t, id: "ul-task-detail-container" }), he = ({ required: t, skipButtonText: a, bottom: r = !1 }) => t ? null : e(X, { className: P(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ye.bind(null, { status: "abandoned" }), children: a || "Skip" }), Ne = (t) => {
|
|
337
|
+
const { avStream: a, captureStream: r, recordingMediaTypes: n, updatePage: s } = z.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
|
|
338
|
+
re(() => {
|
|
339
|
+
const l = setInterval(() => {
|
|
340
|
+
i && a && !a.active ? s({ avStream: null, currentPage: t[0] }) : r && r.active || s({ captureStream: void 0, currentPage: t[i ? 1 : 0] });
|
|
341
|
+
}, 1e3);
|
|
342
|
+
return () => clearInterval(l);
|
|
343
|
+
}, [a, r, i, t, n, s]);
|
|
344
|
+
}, xt = ({ content: t, pages: a, required: r }) => {
|
|
345
|
+
const { buttonText: n, skipButtonText: s, taskDetail: i } = t;
|
|
346
|
+
return Ne(a), e("div", { className: "ul-task-page", children: [i && e(He, { richTextBody: i }), e("div", { className: me, children: [e(X, { onClick: _e.bind(null, { pages: a }), children: n }), e(he, { required: r, skipButtonText: s })] })] }, "start-task");
|
|
347
|
+
}, Ct = ({ content: t, pages: a, properties: r }) => {
|
|
348
|
+
const { buttonText: n, skipButtonText: s } = t;
|
|
349
|
+
return Ne(a), e("div", { className: "ul-task-page", children: [t.taskDetail && e(He, { richTextBody: t.taskDetail }), e(W, { properties: r, children: e("div", { className: me, children: [e(X, { className: "ul-complete-task-button", onClick: ye.bind(null, { status: "completed" }), children: n }), e(X, { className: P("ul-button-inactive"), onClick: ye.bind(null, { status: "given.up" }), children: s })] }) })] }, "complete-task");
|
|
350
|
+
}, St = ({ content: t, pages: a, required: r }) => {
|
|
351
|
+
const { buttonText: n, skipButtonText: s } = t, [i] = $((c) => [c.tabTitle]), [l, d] = O(!1);
|
|
352
|
+
return e("div", { children: [e("div", { className: Qe, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Oe, children: i }) })] }), e("div", { className: r ? "" : me, children: [e(X, { disabled: l, onClick: _e.bind(null, { pages: a, setIsRequestingPermission: d }), children: n }), e(he, { required: r, skipButtonText: s })] })] });
|
|
353
|
+
}, Tt = ({ content: t }) => e(ce, { className: P($e, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), _t = ({ content: t, pages: a, required: r }) => {
|
|
354
|
+
const { permissionDeniedHeadline: n, permissionDeniedBody: s, skipButtonText: i, tryAgainButtonText: l } = t, d = pe(a[0]) ? a[0] : null;
|
|
355
|
+
return re(() => {
|
|
356
|
+
const c = setInterval(() => {
|
|
357
|
+
d !== null && be({ currentPage: d, pages: a });
|
|
358
|
+
}, 1e3);
|
|
359
|
+
return () => clearInterval(c);
|
|
360
|
+
}, [d, a]), d ? e("div", { children: [e("div", { className: Qe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Oe, children: s })] }) }), e("div", { className: me, children: [e(X, { onClick: be.bind(null, { currentPage: d, pages: a }), children: l }), e(he, { required: r, skipButtonText: i })] })] }) : null;
|
|
361
|
+
}, Nt = ({ stream: t }) => e("video", { autoPlay: !0, className: P("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (a) => {
|
|
362
|
+
a && (a.srcObject = t || null);
|
|
363
|
+
} }), It = ({ content: t, pages: a, required: r }) => {
|
|
364
|
+
const { skipButtonText: n } = t, { avStream: s } = z.getState();
|
|
365
|
+
return Ne(a), e("div", { children: [e(Nt, { stream: s }), e("div", { className: "ul-vertical-button-container-center", children: [e(X, { onClick: _e.bind(null, { pages: a }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
|
|
366
|
+
}, wt = ({ properties: t }) => {
|
|
367
|
+
const { pages: a, required: r } = t, { avStream: n, currentPage: s } = z.getState();
|
|
368
|
+
if (s === void 0) return null;
|
|
369
|
+
switch (s == null ? void 0 : s.type) {
|
|
370
|
+
case "av_permission": {
|
|
371
|
+
const i = Be(n, s);
|
|
372
|
+
return i === ve ? e(Tt, { content: s }) : e(i === Ee ? _t : It, { content: s, pages: a, required: r });
|
|
373
|
+
}
|
|
374
|
+
case "screen_permission":
|
|
375
|
+
return e(St, { content: s, pages: a, required: r });
|
|
376
|
+
case "start_task":
|
|
377
|
+
return e(xt, { content: s, pages: a, required: r });
|
|
378
|
+
case "complete_task":
|
|
379
|
+
return e(Ct, { content: s, pages: a, properties: t });
|
|
380
|
+
default:
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
}, Dt = ({ className: t, properties: a, next: r, questionId: n }) => {
|
|
384
|
+
const s = $(), { surveyId: i, responseGroupUid: l, userId: d } = s, c = z(), { screenPermissionRequested: v } = c, y = z((m) => m.avStream);
|
|
385
|
+
let o = z((m) => m.currentPage);
|
|
386
|
+
o || (o = function({ pages: m, userId: S, responseGroupUid: N, surveyId: q, questionId: E, next: _ }) {
|
|
387
|
+
const { updatePage: Q } = z.getState(), { eventEmitFn: A, recorderEventEmitter: u } = $.getState(), h = { questionId: E, surveyId: q, visitorId: S, responseGroupUid: N };
|
|
388
|
+
let x = 0;
|
|
389
|
+
u.emit("recorded.task.permission.screen"), A("recorded.task.permission.screen"), u.emit("permission.status", { "permission.status.callback": (b, I, L, R) => {
|
|
390
|
+
const H = m[x], { type: V } = H, G = ["screen"];
|
|
391
|
+
if (pe(H)) {
|
|
392
|
+
const { permissionDescriptors: j } = H, ne = j == null ? void 0 : j.includes("microphone"), de = j == null ? void 0 : j.includes("camera");
|
|
393
|
+
ne && G.push("audio"), de && G.push("video"), (b != null && b.active && !de || b != null && b.active && I) && x++;
|
|
394
|
+
}
|
|
395
|
+
De(m[x]) && L && (x++, u.emit("begin.recording", { "recording.media.types": G, "start.recording.callback": (j) => Q({ mediaRecordingUids: j }) })), Q({ currentPage: m[x], avStream: b, screenPermissionRequested: L, nextQuestion: _, type: V, passthroughData: h, recordingMediaTypes: G, captureStream: R });
|
|
396
|
+
} });
|
|
397
|
+
const g = m[x];
|
|
398
|
+
return g.type === "av_permission" && be({ currentPage: g, pages: m }), g;
|
|
399
|
+
}({ questionId: n, surveyId: i, next: (m) => {
|
|
400
|
+
r(m, !0);
|
|
401
|
+
}, pages: a.pages, responseGroupUid: l, userId: d }));
|
|
402
|
+
let p = o.headline, k = o.captionText;
|
|
403
|
+
const f = Be(y, o);
|
|
404
|
+
return De(o) && v && (p = o.permissionDeniedHeadline, k = o.permissionDeniedCaptionText), pe(o) && f === Ae && (p = o.permissionGrantedHeadline, k = o.permissionGrantedCaptionText), e("div", { className: P(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: a == null ? void 0 : a.required, message: p, properties: { captionText: k } }), e(te, { children: e(wt, { properties: a }) })] });
|
|
405
|
+
}, qt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
|
|
406
|
+
const { visitorAttributes: i, isLongFormSurvey: l } = $((y) => ({ visitorAttributes: y.visitorAttributes, isLongFormSurvey: Me(y.studyType) })), d = (y, o = !1) => {
|
|
407
|
+
a({ value: o ? { skipped: !0 } : void 0, questionId: n, type: s }, !0);
|
|
408
|
+
}, c = nt(r && r.buttonUrl, i), v = l && r.promptActionType === at.NO_BUTTON;
|
|
409
|
+
return e("div", { className: P(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(W, { properties: r, children: !v && e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: c, id: "ul-card-text__button", onClick: d, onKeyPress: (y) => {
|
|
410
|
+
y.key !== "Enter" && y.key !== " " || a({ value: void 0, questionId: n, type: s }, !0);
|
|
411
|
+
}, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: K(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => d(0, !0), children: fe(r) })] }) }) }) }, n);
|
|
412
|
+
}, Pt = ({ className: t, questionId: a }) => {
|
|
413
|
+
const { border: r, destroy: n, endCard: s, forceBrandedLogo: i } = $((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
|
|
414
|
+
re(() => {
|
|
415
|
+
setTimeout(() => {
|
|
416
|
+
n(Te);
|
|
417
|
+
}, i ? 4e3 : 2e3);
|
|
418
|
+
}, [n, i]);
|
|
419
|
+
const l = s && s.subheader ? e("p", { className: "ul-caption", children: s.subheader }) : null, d = s && s.headline ? s.headline : "";
|
|
420
|
+
return e("div", { className: P(t, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: r, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: r, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(Ce, { message: d }), l] }) }) }, a);
|
|
421
|
+
}, Lt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), Rt = ({ className: t }) => {
|
|
422
|
+
const { uploadProgress: a } = $((i) => ({ uploadProgress: i.uploadProgress }));
|
|
423
|
+
let r, n;
|
|
424
|
+
Object.values(a).filter((i) => i.isSubmitted).length > 1 ? (r = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (r = "Your response is processing", n = "Please keep this tab open until your response is fully processed.");
|
|
425
|
+
const s = Math.round(Math.min(99, ...Object.values(a).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0)));
|
|
426
|
+
return e("div", { className: P(t, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(Ce, { message: `${r} (${s}% complete)` }), e("p", { className: "ul-caption", children: n })] });
|
|
427
|
+
}, Pe = 0, Le = 1, Mt = ({ className: t, next: a, properties: r, questionId: n, type: s }) => {
|
|
428
|
+
const i = `ul-card-video__player_recorder-q${n}`, { apiURL: l, envId: d, handleUploadUpdate: c, headers: v, responseGroupUid: y, surveyId: o, viewDocument: p, visitorId: k } = $((h) => ({ apiURL: h.apiURL, envId: h.envId, handleUploadUpdate: h.handleUploadUpdate, headers: h.headers, responseGroupUid: h.responseGroupUid, surveyId: h.surveyId, viewDocument: h.viewDocument, visitorId: h.userId })), [f, m] = O(!1), [S, N] = O(null), [q, E] = O(null), [_, Q] = O(Pe), A = (h, x) => {
|
|
429
|
+
h === Z.UPLOAD_STARTED ? (N(x[Z.UPLOAD_ID]), E(x[Z.MEDIA_RECORDING_UID]), m(!0)) : h === Z.DELETE ? (N(null), E(null), m(!1)) : h === Z.UPLOAD_PROGRESS ? isNaN(x[Z.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], progressPct: x[Z.UPLOAD_PROGRESS_PCT] }) : h === Z.UPLOAD_FINISHED && c({ mediaRecordingUid: x[Z.MEDIA_RECORDING_UID], isComplete: !0 });
|
|
430
|
+
}, u = (h) => {
|
|
431
|
+
h.preventDefault(), h.stopPropagation(), document.getElementById(i) && ot(i), S && q ? (c({ mediaRecordingUid: q, isSubmitted: !0 }), a({ value: { mediaRecordingUid: q }, questionId: n, type: s }, !0)) : a({ value: null, questionId: n, type: s }, !0);
|
|
432
|
+
};
|
|
433
|
+
return e("form", { className: P(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(te, { children: [e("div", { id: "ul-question-player-container", style: { display: _ === Pe ? "" : "none" }, children: e(W, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (h) => {
|
|
434
|
+
h.preventDefault(), h.stopPropagation(), document.getElementById(i) && st(i), Q(Le);
|
|
435
|
+
} }) }) }), e("div", { style: { display: _ === Le ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (h) => {
|
|
436
|
+
if (h && h.children.length === 0) {
|
|
437
|
+
const x = it(i, { surveyId: o, responseGroupUid: y, questionId: n, visitorId: k, envId: d }, l, A, void 0, { ...v, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === Z.MEDIA_TYPE_AUDIO, p);
|
|
438
|
+
h.appendChild(x);
|
|
439
|
+
}
|
|
440
|
+
} }) })] }), e(ee, { children: [e(ae, { isDisabled: !!r.required && !f, onClick: u, children: K(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: u, style: { ...r.required ? { display: "none" } : {}, ...f ? { display: "none" } : {} }, children: fe(r) })] })] });
|
|
441
|
+
}, Ve = (t) => t.type === "thanks" || t.type === "uploading", Ut = ({ card: t, avatars: a, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: s }) => {
|
|
442
|
+
const i = ((l) => "properties" in l.props && l.props.properties && "questionHtml" in l.props.properties && l.props.properties.questionHtml ? { content: l.props.properties.questionHtml, isHtml: !0 } : "message" in l.props ? { content: l.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
|
|
443
|
+
return e(ie, { avatars: a, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? s : null, children: r ? e(Lt, {}) : e(ke, { children: [i.isHtml ? e(ce, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(ct, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
|
|
444
|
+
}, Et = ({ card: t, avatars: a }) => {
|
|
445
|
+
const r = ((n) => {
|
|
446
|
+
if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
|
|
447
|
+
const s = n.props.properties, i = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
|
|
448
|
+
for (const { key: l, isHtml: d } of i) {
|
|
449
|
+
const c = s[l];
|
|
450
|
+
if (typeof c != "string") continue;
|
|
451
|
+
const v = c.trim();
|
|
452
|
+
if (v) {
|
|
453
|
+
if (d && !v.replaceAll(/<[^>]*>/g, "").trim()) continue;
|
|
454
|
+
return { content: v, isHtml: d };
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
})(t);
|
|
459
|
+
return r ? e(ie, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e(ce, { className: "chat-message-text", html: r.content }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
|
|
460
|
+
}, At = ({ card: t, userResponse: a, avatars: r }) => {
|
|
461
|
+
const n = ((s, i) => {
|
|
462
|
+
if (s.type === "open" && i && typeof i == "object" && "value" in i) return i.value;
|
|
463
|
+
})(t, a);
|
|
464
|
+
return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: n || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
|
|
465
|
+
}, Bt = ({ card: t, avatars: a, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => {
|
|
466
|
+
const { endCard: s } = $((i) => ({ endCard: i.endCard }));
|
|
467
|
+
return e(ke, { children: [e(ie, { avatars: a, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (s == null ? void 0 : s.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (s == null ? void 0 : s.subheader) && e(ie, { avatars: a, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: s.subheader } }), e(ut, {})] });
|
|
468
|
+
}, $t = ({ card: t, cardIndex: a, index: r, avatars: n, cardResponses: s, questionThinkingStates: i, startingQuestionIdx: l, currentQuestionBubbleRef: d, handleCardResponse: c }) => {
|
|
469
|
+
const v = a === r, y = a < r, o = Ve(t);
|
|
470
|
+
if (o) return e(Bt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: v });
|
|
471
|
+
const p = `${t.name}`, k = s.get(p), f = t.type === "open", m = i.get(p), S = a > (l ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (m === !0 || m === void 0);
|
|
472
|
+
return e(Re.Fragment, { children: [e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: v, isThinking: S }), !S && e(Et, { avatars: n, card: t }), y && f ? e(At, { avatars: n, card: t, userResponse: k }) : (!y || !f) && !S && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(Qt, { card: t, className: o ? "chat-thanks-card" : "chat-card", isAnswered: y, next: v ? c : () => {
|
|
473
|
+
} }) }) })] }, `question-card-${t.name}`);
|
|
474
|
+
}, ie = Re.forwardRef(({ message: t, isLeft: a = !1, children: r, avatars: n, hideAvatar: s = !1 }, i) => {
|
|
475
|
+
const l = a ? "chat-bubble-left" : "chat-bubble-right";
|
|
476
|
+
return e("div", { className: `chat-bubble-container ${a ? "chat-left" : "chat-right"}${a && s ? " chat-no-avatar" : ""}`, ref: i, children: [a && !s && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${l}`, children: r || e("div", { className: "chat-message-text", children: t.content }) }), !a && !s && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x` })] });
|
|
477
|
+
});
|
|
478
|
+
ie.displayName = "ChatBubble";
|
|
479
|
+
const Ot = () => {
|
|
480
|
+
const t = $((r) => r.close), a = le(() => () => t(Te), [t]);
|
|
481
|
+
return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: a, onKeyPress: (r) => {
|
|
482
|
+
r.key === "Enter" && a();
|
|
483
|
+
}, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
|
|
484
|
+
}, Qt = ({ card: t, next: a, className: r = "", isAnswered: n = !1 }) => {
|
|
485
|
+
const s = { className: n ? `${r} answered-card` : r, next: n ? () => {
|
|
486
|
+
} : a, questionId: t.name, type: t.type, isAnswered: n };
|
|
487
|
+
switch (t.type) {
|
|
488
|
+
case "consentlegal":
|
|
489
|
+
return e(dt, { ...s, ...t.props });
|
|
490
|
+
case "likert":
|
|
491
|
+
return e(mt, { ...s, ...t.props });
|
|
492
|
+
case "matrix":
|
|
493
|
+
return e(gt, { ...s, ...t.props });
|
|
494
|
+
case "multiplechoice":
|
|
495
|
+
return e(vt, { ...s, ...t.props });
|
|
496
|
+
case "multipleselect":
|
|
497
|
+
return e(bt, { ...s, ...t.props });
|
|
498
|
+
case "nps":
|
|
499
|
+
return e(yt, { ...s, ...t.props });
|
|
500
|
+
case "aidynamicfollowup":
|
|
501
|
+
case "open":
|
|
502
|
+
return e(ft, { ...s, type: t.type, ...t.props });
|
|
503
|
+
case "rankorder":
|
|
504
|
+
return e(kt, { ...s, ...t.props });
|
|
505
|
+
case "recordedtask":
|
|
506
|
+
return e(Dt, { ...s, ...t.props });
|
|
507
|
+
case "texturlprompt":
|
|
508
|
+
return e(qt, { ...s, ...t.props });
|
|
509
|
+
case "thanks":
|
|
510
|
+
return e(Pt, { ...s, ...t.props });
|
|
511
|
+
case "uploading":
|
|
512
|
+
return e(Rt, { ...s, ...t.props });
|
|
513
|
+
case "videovoice":
|
|
514
|
+
return e(Mt, { ...s, ...t.props });
|
|
515
|
+
default:
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
}, Ft = ({ cards: t, next: a, previousResponses: r }) => {
|
|
519
|
+
const { cardResponses: n, setCardResponse: s } = (() => {
|
|
520
|
+
const [u, h] = O(/* @__PURE__ */ new Map());
|
|
521
|
+
return { cardResponses: u, setCardResponse: oe((x, g) => {
|
|
522
|
+
h((b) => new Map(b).set(x, g));
|
|
523
|
+
}, []) };
|
|
524
|
+
})(), { index: i, isLongFormSurvey: l, avatars: d, showSurveyBrand: c, forceBrandedLogo: v, marketingUrlLink: y, startingQuestionIdx: o, viewDocument: p, createDynamicQuestion: k, update: f } = $((u) => ({ index: u.index, isLongFormSurvey: Me(u.studyType), avatars: u.avatars, forceBrandedLogo: u.forceBrandedLogo, startingQuestionIdx: u.startingQuestionIdx, showSurveyBrand: u.showSurveyBrand, marketingUrlLink: Ye({ marketingUrl: u.marketingUrl, slugName: u.slugName, surveyId: u.surveyId, forceBrandedLogo: u.forceBrandedLogo }), viewDocument: u.viewDocument, createDynamicQuestion: u.createDynamicQuestion, update: u.update })), { currentQuestionBubbleRef: m, scrollToCurrentQuestion: S } = (({ viewDocument: u }) => {
|
|
525
|
+
const h = J(null), x = oe(() => {
|
|
526
|
+
const g = u.querySelector(".ul-card-main-content");
|
|
527
|
+
if (h.current && g && g instanceof HTMLElement) {
|
|
528
|
+
const b = h.current.offsetTop - g.offsetTop - 16;
|
|
529
|
+
g.scrollTo({ top: Math.max(0, b), behavior: "smooth" });
|
|
530
|
+
}
|
|
531
|
+
}, []);
|
|
532
|
+
return { currentQuestionBubbleRef: h, scrollToCurrentQuestion: x };
|
|
533
|
+
})({ viewDocument: p }), N = ((u, h, x) => {
|
|
534
|
+
const [g, b] = O(/* @__PURE__ */ new Map());
|
|
535
|
+
return re(() => {
|
|
536
|
+
if (u.length > 0 && h < u.length) {
|
|
537
|
+
const I = u[h], L = `${I.name}`;
|
|
538
|
+
if (h <= (x ?? 0) || Ve(I)) return void b((V) => new Map(V).set(L, !1));
|
|
539
|
+
const R = (V) => V.type === "aidynamicfollowup";
|
|
540
|
+
b((V) => {
|
|
541
|
+
const G = !R(I) || !!I.props.loading;
|
|
542
|
+
return new Map(V).set(L, G);
|
|
543
|
+
});
|
|
544
|
+
const H = setTimeout(() => {
|
|
545
|
+
b((V) => {
|
|
546
|
+
const G = !!R(I) && !!I.props.loading;
|
|
547
|
+
return new Map(V).set(L, G);
|
|
548
|
+
});
|
|
549
|
+
}, 1e3);
|
|
550
|
+
return () => clearTimeout(H);
|
|
551
|
+
}
|
|
552
|
+
}, [h, u, x]), g;
|
|
553
|
+
})(t, i, o), q = ((u, h) => {
|
|
554
|
+
const [x, g] = O(() => /* @__PURE__ */ new Set([u]));
|
|
555
|
+
return re(() => {
|
|
556
|
+
g((b) => new Set(b).add(u));
|
|
557
|
+
}, [u]), re(() => {
|
|
558
|
+
const b = h ?? 0;
|
|
559
|
+
b > 0 && g((I) => {
|
|
560
|
+
const L = new Set(I);
|
|
561
|
+
for (let R = 0; R <= b; R++) L.add(R);
|
|
562
|
+
return L;
|
|
563
|
+
});
|
|
564
|
+
}, [h]), x;
|
|
565
|
+
})(i, o), E = le(() => ({ ...r, ...we(t.map((u, h) => {
|
|
566
|
+
var x, g;
|
|
567
|
+
return { ...u, value: h < i ? ((x = n.get(`${u.name}`)) == null ? void 0 : x.value) ?? null : null, secondaryValue: h < i ? ((g = n.get(`${u.name}`)) == null ? void 0 : g.secondaryValue) ?? null : null };
|
|
568
|
+
})) }), [r, n, t, i]);
|
|
569
|
+
ze(E);
|
|
570
|
+
const _ = Ke(t, E);
|
|
571
|
+
re(() => {
|
|
572
|
+
requestAnimationFrame(() => {
|
|
573
|
+
S();
|
|
574
|
+
}), f();
|
|
575
|
+
}, [i, S, N, f]);
|
|
576
|
+
const Q = oe((u, h) => {
|
|
577
|
+
if (!h) return;
|
|
578
|
+
const x = _[i];
|
|
579
|
+
if (!x) return;
|
|
580
|
+
const g = `${x.name}`;
|
|
581
|
+
s(g, u);
|
|
582
|
+
const b = { ...u, questionText: We(x) };
|
|
583
|
+
if (x.childId && (b == null ? void 0 : b.value) != null) {
|
|
584
|
+
const I = we([x].map((L) => ({ ...L, value: (b == null ? void 0 : b.value) ?? null, secondaryValue: (b == null ? void 0 : b.secondaryValue) ?? null })));
|
|
585
|
+
k({ parentQuestionId: x.name, parentResponseConfig: I });
|
|
586
|
+
}
|
|
587
|
+
a([b]);
|
|
588
|
+
}, [_, i, a, s]), A = _.map((u, h) => ({ card: u, cardIndex: h })).filter(({ cardIndex: u }) => q.has(u));
|
|
589
|
+
return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!l && e(Ot, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: A.map(({ card: u, cardIndex: h }) => e($t, { avatars: d, card: u, cardIndex: h, cardResponses: n, currentQuestionBubbleRef: m, handleCardResponse: Q, index: i, questionThinkingStates: N, startingQuestionIdx: o }, `question-card-${u.name}`)) }) }), l && e("div", { className: "long-form-question-footer-container-logo", children: c && e(Xe, { forceBrandedLogo: v, marketingUrlLink: y }) })] });
|
|
590
|
+
};
|
|
591
|
+
export {
|
|
592
|
+
Ft as default
|
|
593
|
+
};
|