@sprig-technologies/sprig-browser 2.38.1 → 2.39.2
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-styles-DHBMIjKf.js +4 -0
- package/dist/conversational-styles-DLzzNPKy.cjs +1 -0
- package/dist/conversational-ui-B92nf8Bv.js +586 -0
- package/dist/conversational-ui-DPfuR1GR.cjs +1 -0
- package/dist/core-Cw9EUdoP.cjs +12 -0
- package/dist/core-DTg_4VGg.js +963 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +15 -0
- package/dist/core.js +2 -2
- package/dist/getAttributedUrl-5xIVbtXI.js +1076 -0
- package/dist/getAttributedUrl-CMvZtsWh.cjs +669 -0
- package/dist/index-1abRW3c7.cjs +1 -0
- package/dist/index-4yK4LlJp.js +678 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-dznO2Koo.cjs → metricsReporter-Bggbn2wu.cjs} +1 -1
- package/dist/{metricsReporter-Snw3vppt.js → metricsReporter-CuPFKFei.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-Bijnkt4E.cjs +1 -0
- package/dist/view-itsnrGSE.js +1480 -0
- package/package.json +1 -1
- package/dist/core-7IPgomh6.cjs +0 -12
- package/dist/core-CjelM0RR.js +0 -964
- package/dist/view-CYeA72IX.cjs +0 -669
- package/dist/view-MuJNBZMh.js +0 -3164
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { a as A, u as e, h as H, c as L, g as V, e as te, f as ke, p as W, F as pe, d as ne, _ as z, T as ce, A as ze, i as Ye, j as Ke, k as Xe, w as Me } from "./view-itsnrGSE.js";
|
|
2
|
+
import { v as We, R as F, B as J, M as X, O as xe, Q as ae, a as ee, b as de, S as Je, L as ve, u as et, H as _e, g as tt, P as rt, p as nt, c as at, s as st } from "./getAttributedUrl-5xIVbtXI.js";
|
|
3
|
+
import { a as ge, D as Ce, A as Se } from "./core-DTg_4VGg.js";
|
|
4
|
+
import { t as Ue } from "./metricsReporter-CuPFKFei.js";
|
|
5
|
+
const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
6
|
+
const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: l } = A((o) => ({ apiURL: o.apiURL, viewDocument: o.viewDocument }));
|
|
7
|
+
return e("div", { id: n, ref: (o) => {
|
|
8
|
+
if (o && o.children.length === 0 && !t.properties.hideRecordedPrompt) {
|
|
9
|
+
const u = We(n, { src: s, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === F.MEDIA_TYPE_AUDIO, a, l);
|
|
10
|
+
o.appendChild(u);
|
|
11
|
+
}
|
|
12
|
+
} });
|
|
13
|
+
}, ie = ({ isDisabled: t, onClick: s, children: r }) => e(J, { className: "ul-card__button-checkmark", disabled: t, onClick: s, 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"] }), lt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
14
|
+
const { useMobileStyling: l, border: o } = A((f) => ({ useMobileStyling: f.useMobileStyling, border: f.border })), [u, c] = H(!1), [d, v] = H(""), [i, m] = H(!1), x = r == null ? void 0 : r.collectName, y = (r == null ? void 0 : r.nameLabelText) || "Full Name", p = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", T = (r == null ? void 0 : r.submitButtonText) || "Submit", D = !!d.trim(), h = u && (!x || D), _ = (f, N = !1) => {
|
|
15
|
+
f.preventDefault(), f.stopPropagation();
|
|
16
|
+
let b = null;
|
|
17
|
+
if (!N) {
|
|
18
|
+
if (!h) return void m(!0);
|
|
19
|
+
b = { submitted: !0 }, x && (b.name = d);
|
|
20
|
+
}
|
|
21
|
+
s({ value: b, questionId: n, type: a }, !!N || h);
|
|
22
|
+
}, S = (f) => {
|
|
23
|
+
f.preventDefault(), f.stopPropagation(), v(f.currentTarget.value);
|
|
24
|
+
}, k = (f) => {
|
|
25
|
+
f.currentTarget.style.borderColor = i && !D ? ge : o;
|
|
26
|
+
}, q = (f) => {
|
|
27
|
+
f.currentTarget.style.borderColor = i && !D ? ge : Ce;
|
|
28
|
+
}, M = () => e(ae, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: i && !u, id: "consent", isRadio: !1, isSelected: u, label: p, onUserInputChanged: ({ selected: f }) => {
|
|
29
|
+
f !== u && c(!u);
|
|
30
|
+
}, useMobileStyling: l }), x && e("input", { "aria-label": y, "aria-placeholder": y, className: L(V("ul-consent-legal__name-input", l)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: q, onFocus: k, onInput: S, placeholder: y, style: i && !D ? { borderColor: ge } : {}, tabIndex: 0, value: d })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ie, { isDisabled: !h, onClick: (f) => _(new SubmitEvent(f.type)), children: te({ buttonText: T }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (f) => _(new SubmitEvent(f.type), !0), children: ke(r) })] })] });
|
|
31
|
+
return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(X, { properties: r, defaultBody: M, embeddedType: "pdf" }) }, n);
|
|
32
|
+
}, ot = () => {
|
|
33
|
+
const { destroy: t, forceBrandedLogo: s } = A((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
|
|
34
|
+
return W(() => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
t(Se);
|
|
37
|
+
}, s ? 4e3 : 2e3);
|
|
38
|
+
}, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" });
|
|
39
|
+
}, ct = ({ icon: t, scaleLabelType: s, value: r, selectedValue: n }) => {
|
|
40
|
+
if (s === "smiley" && r === n) {
|
|
41
|
+
let a = 0;
|
|
42
|
+
return t.replace(/black/g, () => ++a == 1 ? "black" : "white");
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}, dt = ({ activeValue: t, border: s, icon: r, isPressed: n, range: a, scaleLabelType: l, selectedValue: o, setSelectedValue: u, setActiveValue: c, setIsPressed: d, useMobileStyling: v, value: i, viewDocument: m }) => {
|
|
46
|
+
const x = `option-${i}`, y = l === "number", p = l === "star", T = l === "smiley", D = y && i === t || i === o, [h, _] = (() => {
|
|
47
|
+
const k = p && o !== null && i <= o;
|
|
48
|
+
return p && i <= t || T && i === t || k || i === t || i === o ? [s, n || k || i === o ? 1 : 0.3] : ["", 1];
|
|
49
|
+
})(), S = pe(() => {
|
|
50
|
+
const k = { borderColor: D ? h : "", fillOpacity: D ? "" : _, zIndex: D ? 3 : "auto", color: o === i ? "#fff" : "" };
|
|
51
|
+
return y ? { ...k, backgroundColor: o === i ? h : "" } : { ...k, color: p || T || o === i ? h : "" };
|
|
52
|
+
}, [D, h, _, o, i, y, p, T]);
|
|
53
|
+
return e("button", { "aria-label": y ? void 0 : String(i), className: (() => {
|
|
54
|
+
switch (l) {
|
|
55
|
+
case "star":
|
|
56
|
+
return L(V("likert-star", v), V(`likert-star-${i}`, v));
|
|
57
|
+
case "smiley":
|
|
58
|
+
return L(V("likert-smiley", v), V(`likert-smiley-${i}`, v));
|
|
59
|
+
default:
|
|
60
|
+
return i === a ? L(V("likert-number", v), V(`likert-number-${i}`, v), V("likert-last-option", v)) : L(V("likert-number", v), V(`likert-number-${i}`, v));
|
|
61
|
+
}
|
|
62
|
+
})(), dangerouslySetInnerHTML: { __html: ct({ icon: r, scaleLabelType: l, value: i, selectedValue: o }) }, id: x, onClick: (k) => {
|
|
63
|
+
k.preventDefault(), k.stopPropagation(), u(i);
|
|
64
|
+
}, onKeyDown: (k) => {
|
|
65
|
+
var f, N;
|
|
66
|
+
const q = m.querySelectorAll(`.likert-${l ?? "number"}`), M = i - 1;
|
|
67
|
+
k.key === "ArrowRight" ? (f = q[M + 1]) == null || f.focus() : k.key === "ArrowLeft" ? (N = q[M - 1]) == null || N.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), u(i));
|
|
68
|
+
}, onPointerDown: () => d(!0), onPointerEnter: () => c(i), onPointerLeave: () => {
|
|
69
|
+
c(-1), d(!1);
|
|
70
|
+
}, style: S, tabIndex: 0 });
|
|
71
|
+
}, ut = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: l }) => {
|
|
72
|
+
const { border: o, useMobileStyling: u, viewDocument: c } = A((f) => ({ border: f.border, useMobileStyling: f.useMobileStyling, viewDocument: f.viewDocument })), [d, v] = H(-1), [i, m] = H(!1), [x, y] = H(null), p = s && s.left, T = s && s.right;
|
|
73
|
+
let D;
|
|
74
|
+
const { range: h, scaleLabelType: _, ratingIcons: S } = n;
|
|
75
|
+
h && (D = Number(h));
|
|
76
|
+
const k = D || 5, q = (f) => {
|
|
77
|
+
var N, b;
|
|
78
|
+
switch (_) {
|
|
79
|
+
case "star":
|
|
80
|
+
return (N = S[0]) == null ? void 0 : N.svg;
|
|
81
|
+
case "smiley":
|
|
82
|
+
return (b = S[f]) == null ? void 0 : b.svg;
|
|
83
|
+
default:
|
|
84
|
+
return String(f + 1);
|
|
85
|
+
}
|
|
86
|
+
}, M = [...Array(k)].map((f, N) => {
|
|
87
|
+
const b = N + 1;
|
|
88
|
+
return e(dt, { activeValue: d, border: o, icon: q(N), isPressed: i, range: k, scaleLabelType: _, selectedValue: x, setActiveValue: v, setIsPressed: m, setSelectedValue: y, useMobileStyling: u, value: b, viewDocument: c }, N);
|
|
89
|
+
});
|
|
90
|
+
return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(X, { properties: n, defaultBody: () => e(ne, { children: [e(ee, { children: [e("div", { "aria-label": `Rating (1 - ${k})`, className: "ul-card--likert__numbers", role: "radiogroup", children: M }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: p }), e("span", { children: T })] })] }), e(ae, { children: e(ie, { isDisabled: x === null && n.required, onClick: () => r({ value: x, questionId: a, type: l }, !0), children: te(n) }) })] }) }) }, a);
|
|
91
|
+
}, pt = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
|
|
92
|
+
const a = z([]), { border: l, useMobileStyling: o } = A((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling })), u = r.findIndex((m) => n[m.id] === null), [c, d] = H(u), v = ce((m, x) => {
|
|
93
|
+
s(m, x);
|
|
94
|
+
const y = c + 1, p = r[y];
|
|
95
|
+
p && n[p.id] === null && d(y);
|
|
96
|
+
}, [s, r, n, c]), i = ce((m, x) => {
|
|
97
|
+
const y = c === m;
|
|
98
|
+
return e(ze, { animate: !0, header: x.label, isOpen: y, onClick: () => d(y && !window.UserLeap.isMobileSDK ? -1 : m), ref: (p) => {
|
|
99
|
+
p && (a.current[m] = p);
|
|
100
|
+
}, showHeaderCheck: n[x.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((p) => e(xe, { allowTextEntry: !1, ariaLabel: `${x.label}-${p.label}`, border: l, error: !1, id: `${x.id}-${p.value}`, isRadio: !0, isSelected: n[x.id] === p.value, label: p.label, onUserInputChanged: () => v(x.id, p.value), useMobileStyling: o }, p.label)) }) }, x.id);
|
|
101
|
+
}, [l, t, c, v, n, o]);
|
|
102
|
+
return e("div", { children: r.map((m, x) => i(x, m)) });
|
|
103
|
+
}, mt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: l, onSubmitButtonClick: o }) => {
|
|
104
|
+
const u = n.matrixColumn, c = n.required, d = (y) => {
|
|
105
|
+
y.preventDefault(), y.stopPropagation(), s({ value: i, questionId: a, type: l }, !0), o && o();
|
|
106
|
+
}, v = r.reduce((y, p) => (y[p.id] = null, y), {}), [i, m] = H(v), x = (y, p) => {
|
|
107
|
+
m((T) => ({ ...T, [y]: p }));
|
|
108
|
+
};
|
|
109
|
+
return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: d, children: e(X, { properties: n, defaultBody: () => {
|
|
110
|
+
return e(ne, { children: [e(ee, { children: e(pt, { columns: u, onSelect: x, options: r, selectedOptions: i }) }), e(ae, { children: e(ie, { isDisabled: (y = i, c && Object.values(y).every((p) => p == null)), onClick: () => d(new SubmitEvent("submit")), children: te(n) }) })] });
|
|
111
|
+
var y;
|
|
112
|
+
} }) }, a);
|
|
113
|
+
}, Ee = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: l, showIndividualSubmit: o = !1, onSubmitButtonClick: u }) => {
|
|
114
|
+
const { border: c, useMobileStyling: d } = A((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), v = r.reduce((g, P) => (g[P.id] = { isSelected: !1 }, g), {}), [i, m] = H(v), x = l === "multiplechoice", y = n.required, p = r.find((g) => {
|
|
115
|
+
var P;
|
|
116
|
+
return (P = g.optionProperties) == null ? void 0 : P.noneOfTheAbove;
|
|
117
|
+
}), T = (g) => Object.entries(g).some(([P, $]) => {
|
|
118
|
+
var G;
|
|
119
|
+
const Q = r.find((Y) => `${Y.id}` === P), O = $.userText === void 0 || $.userText.trim() === "";
|
|
120
|
+
return ((G = Q == null ? void 0 : Q.optionProperties) == null ? void 0 : G.allowsTextEntry) && O && $.isSelected;
|
|
121
|
+
}), D = (g) => Object.values(g).filter((P) => P.isSelected).length, h = n.minSelect && n.minSelect > 0 && n.maxSelectMode === de.Range && D(i) < n.minSelect && (y || D(i) > 0), _ = (g) => T(g) || y && !D(g) || !((P) => {
|
|
122
|
+
const { minSelect: $ = 0, maxSelect: Q = 1 / 0, maxSelectMode: O } = n, G = D(P);
|
|
123
|
+
switch (O) {
|
|
124
|
+
case de.Maximum:
|
|
125
|
+
return G <= Q;
|
|
126
|
+
case de.Range:
|
|
127
|
+
return G === 0 || G >= $;
|
|
128
|
+
default:
|
|
129
|
+
return !0;
|
|
130
|
+
}
|
|
131
|
+
})(g), S = Object.entries(i).some(([g, P]) => {
|
|
132
|
+
var $, Q;
|
|
133
|
+
return P.isSelected && ((Q = ($ = r.find((O) => `${O.id}` === g)) == null ? void 0 : $.optionProperties) == null ? void 0 : Q.allowsTextEntry);
|
|
134
|
+
}), k = o && (!x || S), q = (g) => {
|
|
135
|
+
b(g.id, g.selected, g.userText, g.noneOfTheAbove);
|
|
136
|
+
}, M = (g) => {
|
|
137
|
+
var P;
|
|
138
|
+
return (n == null ? void 0 : n.maxSelectMode) !== de.Unlimited && D(i) === (n == null ? void 0 : n.maxSelect) && !((P = i[g]) != null && P.isSelected);
|
|
139
|
+
}, f = r.map(({ id: g, label: P, value: $, optionProperties: Q }) => {
|
|
140
|
+
var se, re;
|
|
141
|
+
const O = `${g}`, { allowsTextEntry: G, noneOfTheAbove: Y } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...Q };
|
|
142
|
+
return e(xe, { allowTextEntry: G, border: c, disabled: M(O), error: (j = i, T(j)), id: O, isRadio: x, isSelected: !!((se = i[O]) != null && se.isSelected), label: P, noneOfTheAbove: Y, onUserInputChanged: q, promptText: "Please specify", text: (re = i[g]) == null ? void 0 : re.userText, useMobileStyling: d, value: $ }, O);
|
|
143
|
+
var j;
|
|
144
|
+
}), N = () => {
|
|
145
|
+
s(i, !0), u && u();
|
|
146
|
+
}, b = (g, P, $, Q) => {
|
|
147
|
+
const O = Object.assign({}, i);
|
|
148
|
+
if ((x || Q) && P) for (const G of Object.values(O)) G.isSelected = !1, delete G.userText;
|
|
149
|
+
else p && !Q && i[p.id].isSelected && (O[p.id].isSelected = !1);
|
|
150
|
+
O[g] = { isSelected: P, userText: $ }, m(O);
|
|
151
|
+
};
|
|
152
|
+
return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: N, children: e(X, { properties: n, defaultBody: () => e(ne, { children: [e(ee, { children: [n.isDropdown ? e(Je, { disabledOptions: r.filter((g) => M(g.id)), dropdownFooter: h ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [D(i), "/", n.minSelect] }) : void 0, isMultiSelect: !x, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
|
|
153
|
+
const P = { ...i };
|
|
154
|
+
for (const $ of r) g.includes($) ? P[$.id].isSelected = !0 : P[$.id].isSelected = !1;
|
|
155
|
+
m(P);
|
|
156
|
+
}, options: r, placeholderText: n.dropdownPlaceholderText ?? (x ? "Select choice" : "Select choice(s)"), value: r.filter((g) => i[g.id].isSelected) }) : e("div", { className: L(V("ul-card__choices", d)), role: x ? "radiogroup" : "group", children: [f, !!h && e("div", { className: "ul-card__min-select-counter", children: [D(i), "/", n.minSelect] })] }), k && e(ve, { handleSubmit: N, isSubmitDisabled: _(i) })] }), e(ae, { children: e(ie, { isDisabled: _(i), onClick: N, children: te(n) }) })] }) }) }, a);
|
|
157
|
+
}, ht = (t) => {
|
|
158
|
+
const { questionId: s, type: r, next: n, options: a } = t;
|
|
159
|
+
return e(Ee, { ...t, onSubmit: (l, o) => {
|
|
160
|
+
const u = Object.entries(l).find(([, m]) => m.isSelected) || [void 0, void 0], [c, d] = u, v = a.find((m) => `${m.id}` === c), i = d != null && d.userText ? { [c]: { userText: d.userText } } : null;
|
|
161
|
+
n({ value: v && c ? { [c]: v.value } : {}, secondaryValue: i, questionId: s, type: r }, o);
|
|
162
|
+
} });
|
|
163
|
+
}, gt = (t) => {
|
|
164
|
+
const { questionId: s, type: r, next: n } = t;
|
|
165
|
+
return e(Ee, { ...t, onSubmit: (a, l) => {
|
|
166
|
+
const o = Object.entries(a).reduce((c, [d, v]) => (c[d] = v.isSelected, c), {}), u = Object.entries(a).reduce((c, [d, v]) => {
|
|
167
|
+
if (!v.userText) return c;
|
|
168
|
+
const i = c || {};
|
|
169
|
+
return i[d] = { userText: v.userText }, i;
|
|
170
|
+
}, null);
|
|
171
|
+
n({ value: o, secondaryValue: u, questionId: s, type: r }, l);
|
|
172
|
+
} });
|
|
173
|
+
}, vt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: l }) => {
|
|
174
|
+
const [o, u] = H(null), { border: c, useMobileStyling: d, viewDocument: v } = A((y) => ({ border: y.border, useMobileStyling: y.useMobileStyling, viewDocument: y.viewDocument })), i = s && s.left, m = s && s.right, x = [...Array(11)].map((y, p) => e("button", { className: L(V("nps-number", d), V(`nps-number-${p}`, d)), id: `option-${p}`, onClick: (T) => {
|
|
175
|
+
T.preventDefault(), T.stopPropagation(), u(p);
|
|
176
|
+
}, onKeyDown: (T) => {
|
|
177
|
+
var h, _;
|
|
178
|
+
const D = v.querySelectorAll("button.nps-number");
|
|
179
|
+
T.key === "ArrowRight" ? (h = D[p + 1]) == null || h.focus() : T.key === "ArrowLeft" ? (_ = D[p - 1]) == null || _.focus() : T.key !== "Enter" && T.key !== " " || (T.preventDefault(), T.stopPropagation(), u(p));
|
|
180
|
+
}, onPointerDown: (T) => {
|
|
181
|
+
T.currentTarget.style.zIndex = "2", T.currentTarget.style.borderColor = c;
|
|
182
|
+
}, onPointerLeave: (T) => {
|
|
183
|
+
T.currentTarget.style.zIndex = "auto", T.currentTarget.style.borderColor = Ce;
|
|
184
|
+
}, style: o === p ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: p }, p));
|
|
185
|
+
return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(X, { properties: r, defaultBody: () => e(ne, { children: [e(ee, { children: [e("div", { className: "ul-card--nps__numbers", children: x }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: i }), e("span", { children: m })] })] }), e(ae, { children: e(ie, { isDisabled: o === null && r.required, onClick: () => n({ value: o, questionId: a, type: l }, !0), children: te(r) }) })] }) }) }, a);
|
|
186
|
+
}, bt = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: l }) => {
|
|
187
|
+
const { border: o, useMobileStyling: u, update: c } = A((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, update: S.update })), [d, v] = H(""), i = z(null), m = d.trim(), x = r.required === !0 && !m, y = et(i, () => c()), p = (S) => {
|
|
188
|
+
const { value: k } = S.currentTarget;
|
|
189
|
+
y(), S.preventDefault(), S.stopPropagation(), v(k);
|
|
190
|
+
}, T = (S) => {
|
|
191
|
+
S.preventDefault(), S.stopPropagation();
|
|
192
|
+
const k = r.required !== !0 || m.length > 0;
|
|
193
|
+
s({ value: d, questionId: n, type: a }, k), l && l();
|
|
194
|
+
}, D = r && r.openTextPlaceholder ? r.openTextPlaceholder : "", h = (S) => {
|
|
195
|
+
S.currentTarget.style.borderColor = o;
|
|
196
|
+
}, _ = (S) => {
|
|
197
|
+
S.currentTarget.style.borderColor = Ce;
|
|
198
|
+
};
|
|
199
|
+
return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(X, { defaultBody: () => e("div", { className: "ul-card-text", children: [e(ee, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": D, className: L(V("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: _, onChange: p, onFocus: h, placeholder: D, ref: i, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e("div", { className: "footer", dangerouslySetInnerHTML: { __html: r.footerHtml } })] }), e(ae, { children: e(ie, { isDisabled: x, onClick: T, children: te(r) }) })] }), properties: r }) }, n);
|
|
200
|
+
}, yt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: l, onSubmitButtonClick: o, options: u, showIndividualSubmit: c = !1 }) => {
|
|
201
|
+
const d = z(null), v = z(0), i = z(0), m = z(null), x = z(!1), y = z([]), [p, T] = H(() => (n == null ? void 0 : n.required) === !0), [D, h] = H(() => u.map((C) => ({ ...C, rank: null }))), _ = pe(() => Array.from({ length: u.length }, (C, w) => w + 1), [u.length]), { useMobileStyling: S, isPreview: k, headers: q } = A((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), M = (q == null ? void 0 : q["userleap-platform"]) === "android", f = S && !k && !M, N = !f && !M, b = (C) => {
|
|
202
|
+
C.preventDefault(), j(D), o && o();
|
|
203
|
+
}, g = (C, w) => {
|
|
204
|
+
h((R) => {
|
|
205
|
+
const I = parseInt(w), E = R.map((U) => ({ ...U }));
|
|
206
|
+
E.some((U) => U.rank == null) && E.forEach((U, le) => U.rank = le + 1);
|
|
207
|
+
const Z = E.findIndex((U) => U.id === C);
|
|
208
|
+
if (Z === -1) return R;
|
|
209
|
+
const B = E[Z].rank;
|
|
210
|
+
return I < B ? E.forEach((U) => {
|
|
211
|
+
U.id !== C && U.rank >= I && U.rank < B && (U.rank = U.rank + 1);
|
|
212
|
+
}) : I > B && E.forEach((U) => {
|
|
213
|
+
U.id !== C && U.rank > B && U.rank <= I && (U.rank = U.rank - 1);
|
|
214
|
+
}), E[Z].rank = I, E.sort((U, le) => U.rank - le.rank), se(), E;
|
|
215
|
+
});
|
|
216
|
+
}, P = (C, w) => {
|
|
217
|
+
for (let R = 0; R < y.current.length; R++) {
|
|
218
|
+
const I = y.current[R];
|
|
219
|
+
if (!I || I === m.current) continue;
|
|
220
|
+
const E = I.getBoundingClientRect();
|
|
221
|
+
if (C >= E.left && C <= E.right && w >= E.top && w <= E.bottom) return { element: I, index: R };
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}, $ = (C) => (w) => {
|
|
225
|
+
if (!f) return;
|
|
226
|
+
w.preventDefault(), w.stopPropagation(), x.current = !0, d.current = C;
|
|
227
|
+
const R = w.touches[0];
|
|
228
|
+
v.current = R.clientY, i.current = R.clientY;
|
|
229
|
+
const I = w.currentTarget.closest(".ul-card-rank__option");
|
|
230
|
+
I && (m.current = I, I.classList.add("is-dragging"));
|
|
231
|
+
}, Q = (C) => {
|
|
232
|
+
if (!f || !x.current || d.current === null) return;
|
|
233
|
+
C.preventDefault(), C.stopPropagation();
|
|
234
|
+
const w = C.touches[0];
|
|
235
|
+
i.current = w.clientY;
|
|
236
|
+
const R = i.current - v.current;
|
|
237
|
+
m.current && (m.current.style.transform = `translateY(${R}px)`, m.current.style.zIndex = "1000"), y.current.forEach((E) => {
|
|
238
|
+
E && E !== m.current && E.classList.remove("is-drop-target");
|
|
239
|
+
});
|
|
240
|
+
const I = P(w.clientX, w.clientY);
|
|
241
|
+
I && I.element.classList.add("is-drop-target");
|
|
242
|
+
}, O = (C) => {
|
|
243
|
+
if (!f || !x.current || d.current === null) return;
|
|
244
|
+
C.preventDefault(), C.stopPropagation();
|
|
245
|
+
const w = C.changedTouches[0], R = P(w.clientX, w.clientY);
|
|
246
|
+
m.current && (m.current.style.transform = "", m.current.style.zIndex = "", m.current.classList.remove("is-dragging")), y.current.forEach((I) => {
|
|
247
|
+
I && I.classList.remove("is-drop-target");
|
|
248
|
+
}), R && R.index !== d.current && G(d.current, R.index), d.current = null, m.current = null, x.current = !1;
|
|
249
|
+
}, G = (C, w) => {
|
|
250
|
+
h((R) => {
|
|
251
|
+
const I = R.map((Z) => ({ ...Z })), [E] = I.splice(C, 1);
|
|
252
|
+
return I.splice(w, 0, E), I.forEach((Z, B) => {
|
|
253
|
+
Z.rank = B + 1;
|
|
254
|
+
}), se(), I;
|
|
255
|
+
});
|
|
256
|
+
}, Y = (C) => {
|
|
257
|
+
C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
|
|
258
|
+
}, j = (C) => {
|
|
259
|
+
const w = {};
|
|
260
|
+
C.reduce((R, I) => (R[I.id] = I.rank, R), w), r({ value: w, questionId: a, type: l }, !0);
|
|
261
|
+
}, se = () => {
|
|
262
|
+
T(!1);
|
|
263
|
+
}, { left: re, right: Ie } = s, De = u.length, je = (C) => {
|
|
264
|
+
C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
|
|
265
|
+
}, Fe = (C) => {
|
|
266
|
+
C.currentTarget.classList.remove("is-drop-target");
|
|
267
|
+
}, Ze = (C) => {
|
|
268
|
+
d.current = null, C.currentTarget.classList.remove("is-dragging");
|
|
269
|
+
};
|
|
270
|
+
return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: b, children: e(X, { properties: n, defaultBody: () => e(ne, M ? { children: e(ee, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", re] }) }), e("ol", { className: "ul-card-rank__list", children: D.map(({ id: C, label: w, rank: R }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${w}`, className: L("ul-card-rank__select", R == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (I) => g(C, I.currentTarget.value), value: R ?? "", children: [R == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), _.map((I) => e("option", { className: "ul-card-rank__select-option", value: I, children: I }, `${I}-${a}`))] }), e("span", { children: w })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [De, " - ", Ie] }) })] }), c && e(ve, { handleSubmit: b, isSubmitDisabled: p })] }) } : { children: [e(ee, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", re] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: M ? void 0 : Y, children: D.map(({ id: C, label: w, rank: R }, I) => {
|
|
271
|
+
return e("li", { className: "ul-card-rank__option", draggable: !!N || void 0, onDragEnd: N ? Ze : void 0, onDragEnter: N ? je : void 0, onDragLeave: N ? Fe : void 0, onDragStart: N ? (Z = I, (B) => {
|
|
272
|
+
d.current = Z, B.dataTransfer && (B.dataTransfer.effectAllowed = "move", B.dataTransfer.setData("text/plain", String(Z)), B.currentTarget.classList.add("is-dragging"));
|
|
273
|
+
}) : void 0, onDrop: N ? (E = I, (B) => {
|
|
274
|
+
var le, we;
|
|
275
|
+
B.preventDefault(), B.currentTarget.classList.remove("is-drop-target");
|
|
276
|
+
const U = d.current;
|
|
277
|
+
d.current = null, (we = (le = B.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : le.querySelector(".is-dragging")) == null || we.classList.remove("is-dragging"), U != null && U !== E && G(U, E);
|
|
278
|
+
}) : void 0, ref: (B) => y.current[I] = B, children: [e("select", { "aria-label": `Rank for ${w}`, className: L("ul-card-rank__select", R == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (B) => g(C, B.currentTarget.value), value: R ?? "", children: [R == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), _.map((B) => e("option", { className: "ul-card-rank__select-option", value: B, children: B }, B))] }), e("span", { children: w }), !M && e("button", { "aria-label": `Drag ${w} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: f ? O : void 0, onTouchMove: f ? Q : void 0, onTouchStart: f ? $(I) : 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);
|
|
279
|
+
var E, Z;
|
|
280
|
+
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [De, " - ", Ie] }) })] }), c && e(ve, { handleSubmit: b, isSubmitDisabled: p })] }), e(ae, { children: e("div", { className: "ul-card__button-wrapper", children: e(J, { disabled: p, children: te(n) }) }) })] }) }) }, a);
|
|
281
|
+
}, be = 1, Be = 2, Ae = 3, ue = (t) => t.type === "av_permission", qe = (t) => t.type === "screen_permission", $e = (t, s) => t === void 0 ? be : t ? ((r, n) => !(ue(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Ae : be : Be, Pe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
282
|
+
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, K = Ye((t) => ({ ...Pe, reset: () => {
|
|
283
|
+
t(Pe);
|
|
284
|
+
}, updatePage: (s) => {
|
|
285
|
+
t(s);
|
|
286
|
+
} }));
|
|
287
|
+
function ye({ currentPage: t, pages: s }) {
|
|
288
|
+
const { avStream: r, recordingMediaTypes: n, updatePage: a } = K.getState(), { recorderEventEmitter: l } = A.getState();
|
|
289
|
+
l.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (o, u) => {
|
|
290
|
+
if (r === o) return;
|
|
291
|
+
let c = t;
|
|
292
|
+
if (o && !t.permissionDescriptors.includes("camera")) {
|
|
293
|
+
const d = s.indexOf(t), v = u != null && u.active ? d + 2 : d + 1;
|
|
294
|
+
u != null && u.active && n && l.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (i) => a({ mediaRecordingUids: i }) }), c = s[v];
|
|
295
|
+
}
|
|
296
|
+
a({ currentPage: c, avStream: o });
|
|
297
|
+
} });
|
|
298
|
+
}
|
|
299
|
+
function fe({ status: t }) {
|
|
300
|
+
const { nextQuestion: s, passthroughData: r, mediaRecordingUids: n, reset: a } = K.getState(), { recorderEventEmitter: l, handleUploadUpdate: o, index: u } = A.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
|
|
301
|
+
r && l.emit("finish.task", { "begin.callback": (d) => {
|
|
302
|
+
o({ mediaRecordingUid: d, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
303
|
+
}, "progress.callback": (d, v) => {
|
|
304
|
+
o({ mediaRecordingUid: d, progressPct: v.detail, isSubmitted: !1, isComplete: !1 });
|
|
305
|
+
}, "upload.callback": (d) => {
|
|
306
|
+
d && o({ mediaRecordingUid: d, isComplete: !0, isSubmitted: !0, progressPct: 100 });
|
|
307
|
+
}, "passthrough.data": r, "current.index": u, "task.response": c, "task.complete.callback": (d) => {
|
|
308
|
+
c.value.taskDurationMillisecond = d, n && (c.value.mediaRecordingUids = n), a(), s(c);
|
|
309
|
+
} });
|
|
310
|
+
}
|
|
311
|
+
function Te({ pages: t, setIsRequestingPermission: s }) {
|
|
312
|
+
const { recorderEventEmitter: r, eventEmitFn: n } = A.getState(), { updatePage: a, currentPage: l, recordingMediaTypes: o, screenPermissionRequested: u } = K.getState();
|
|
313
|
+
if (!l) return;
|
|
314
|
+
const c = t.indexOf(l);
|
|
315
|
+
switch (l.type) {
|
|
316
|
+
case "av_permission": {
|
|
317
|
+
const d = u ? c + 2 : c + 1;
|
|
318
|
+
return u && o && r.emit("begin.recording", { "recording.media.types": o, "start.recording.callback": (v) => {
|
|
319
|
+
a({ mediaRecordingUids: v });
|
|
320
|
+
} }), void a({ currentPage: t[d] });
|
|
321
|
+
}
|
|
322
|
+
case "screen_permission":
|
|
323
|
+
return void r.emit("screen.permission", { "screen.permission.requested": s, "stream.ready.callback": (d, v) => {
|
|
324
|
+
const i = v ? t[c + 1] : l;
|
|
325
|
+
v && o && r.emit("begin.recording", { "recording.media.types": o, "start.recording.callback": (m) => {
|
|
326
|
+
a({ captureStream: v, mediaRecordingUids: m });
|
|
327
|
+
} }), a({ currentPage: i, screenPermissionRequested: !0, captureStream: v });
|
|
328
|
+
} });
|
|
329
|
+
case "start_task":
|
|
330
|
+
return n("recorded.task.start"), r.emit("recorded.task.start"), r.emit("start.task"), void a({ currentPage: t[c + 1], screenPermissionRequested: !0 });
|
|
331
|
+
case "complete_task":
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const Oe = "ul-permission-graphics-container", He = "ul-permission-body", Qe = L(Oe, "ul_recorded-task-inset-spacing"), me = L("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Ge = ({ richTextBody: t }) => e("div", { className: "ul-rich-text-body", dangerouslySetInnerHTML: { __html: t }, id: "ul-task-detail-container" }), he = ({ required: t, skipButtonText: s, bottom: r = !1 }) => t ? null : e(J, { className: L(r && "ul-skip-button-below", "ul-button-inactive"), onClick: fe.bind(null, { status: "abandoned" }), children: s || "Skip" }), Ne = (t) => {
|
|
336
|
+
const { avStream: s, captureStream: r, recordingMediaTypes: n, updatePage: a } = K.getState(), l = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
|
|
337
|
+
W(() => {
|
|
338
|
+
const o = setInterval(() => {
|
|
339
|
+
l && s && !s.active ? a({ avStream: null, currentPage: t[0] }) : r && r.active || a({ captureStream: void 0, currentPage: t[l ? 1 : 0] });
|
|
340
|
+
}, 1e3);
|
|
341
|
+
return () => clearInterval(o);
|
|
342
|
+
}, [s, r, l, t, n, a]);
|
|
343
|
+
}, ft = ({ content: t, pages: s, required: r }) => {
|
|
344
|
+
const { buttonText: n, skipButtonText: a, taskDetail: l } = t;
|
|
345
|
+
return Ne(s), e("div", { className: "ul-task-page", children: [l && e(Ge, { richTextBody: l }), e("div", { className: me, children: [e(J, { onClick: Te.bind(null, { pages: s }), children: n }), e(he, { required: r, skipButtonText: a })] })] }, "start-task");
|
|
346
|
+
}, kt = ({ content: t, pages: s, properties: r }) => {
|
|
347
|
+
const { buttonText: n, skipButtonText: a } = t;
|
|
348
|
+
Ne(s);
|
|
349
|
+
const l = e(X, { properties: r, defaultBody: () => e("div", { className: me, children: [e(J, { className: "ul-complete-task-button", onClick: fe.bind(null, { status: "completed" }), children: n }), e(J, { className: L("ul-button-inactive"), onClick: fe.bind(null, { status: "given.up" }), children: a })] }) });
|
|
350
|
+
return e("div", { className: "ul-task-page", children: [t.taskDetail && e(Ge, { richTextBody: t.taskDetail }), l] }, "complete-task");
|
|
351
|
+
}, xt = ({ content: t, pages: s, required: r }) => {
|
|
352
|
+
const { buttonText: n, skipButtonText: a } = t, [l] = A((c) => [c.tabTitle]), [o, u] = H(!1);
|
|
353
|
+
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: He, children: l }) })] }), e("div", { className: r ? "" : me, children: [e(J, { disabled: o, onClick: Te.bind(null, { pages: s, setIsRequestingPermission: u }), children: n }), e(he, { required: r, skipButtonText: a })] })] });
|
|
354
|
+
}, _t = ({ content: t }) => e("div", { className: L(Oe, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), dangerouslySetInnerHTML: { __html: t.svg } }, "ul-permission-request-graphic"), Ct = ({ content: t, pages: s, required: r }) => {
|
|
355
|
+
const { permissionDeniedHeadline: n, permissionDeniedBody: a, skipButtonText: l, tryAgainButtonText: o } = t, u = ue(s[0]) ? s[0] : null;
|
|
356
|
+
return W(() => {
|
|
357
|
+
const c = setInterval(() => {
|
|
358
|
+
u !== null && ye({ currentPage: u, pages: s });
|
|
359
|
+
}, 1e3);
|
|
360
|
+
return () => clearInterval(c);
|
|
361
|
+
}, [u, s]), u ? 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: He, children: a })] }) }), e("div", { className: me, children: [e(J, { onClick: ye.bind(null, { currentPage: u, pages: s }), children: o }), e(he, { required: r, skipButtonText: l })] })] }) : null;
|
|
362
|
+
}, St = ({ stream: t }) => e("video", { autoPlay: !0, className: L("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (s) => {
|
|
363
|
+
s && (s.srcObject = t || null);
|
|
364
|
+
} }), Tt = ({ content: t, pages: s, required: r }) => {
|
|
365
|
+
const { skipButtonText: n } = t, { avStream: a } = K.getState();
|
|
366
|
+
return Ne(s), e("div", { children: [e(St, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(J, { onClick: Te.bind(null, { pages: s }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
|
|
367
|
+
}, Nt = ({ properties: t }) => {
|
|
368
|
+
const { pages: s, required: r } = t, { avStream: n, currentPage: a } = K.getState();
|
|
369
|
+
if (a === void 0) return null;
|
|
370
|
+
switch (a == null ? void 0 : a.type) {
|
|
371
|
+
case "av_permission": {
|
|
372
|
+
const l = $e(n, a);
|
|
373
|
+
return l === be ? e(_t, { content: a }) : e(l === Be ? Ct : Tt, { content: a, pages: s, required: r });
|
|
374
|
+
}
|
|
375
|
+
case "screen_permission":
|
|
376
|
+
return e(xt, { content: a, pages: s, required: r });
|
|
377
|
+
case "start_task":
|
|
378
|
+
return e(ft, { content: a, pages: s, required: r });
|
|
379
|
+
case "complete_task":
|
|
380
|
+
return e(kt, { content: a, pages: s, properties: t });
|
|
381
|
+
default:
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
}, It = ({ className: t, properties: s, next: r, questionId: n }) => {
|
|
385
|
+
const a = A(), { surveyId: l, responseGroupUid: o, userId: u } = a, c = K(), { screenPermissionRequested: d } = c, v = K((p) => p.avStream);
|
|
386
|
+
let i = K((p) => p.currentPage);
|
|
387
|
+
i || (i = function({ pages: p, userId: T, responseGroupUid: D, surveyId: h, questionId: _, next: S }) {
|
|
388
|
+
const { updatePage: k } = K.getState(), { eventEmitFn: q, recorderEventEmitter: M } = A.getState(), f = { questionId: _, surveyId: h, visitorId: T, responseGroupUid: D };
|
|
389
|
+
let N = 0;
|
|
390
|
+
M.emit("recorded.task.permission.screen"), q("recorded.task.permission.screen"), M.emit("permission.status", { "permission.status.callback": (g, P, $, Q) => {
|
|
391
|
+
const O = p[N], { type: G } = O, Y = ["screen"];
|
|
392
|
+
if (ue(O)) {
|
|
393
|
+
const { permissionDescriptors: j } = O, se = j == null ? void 0 : j.includes("microphone"), re = j == null ? void 0 : j.includes("camera");
|
|
394
|
+
se && Y.push("audio"), re && Y.push("video"), (g != null && g.active && !re || g != null && g.active && P) && N++;
|
|
395
|
+
}
|
|
396
|
+
qe(p[N]) && $ && (N++, M.emit("begin.recording", { "recording.media.types": Y, "start.recording.callback": (j) => k({ mediaRecordingUids: j }) })), k({ currentPage: p[N], avStream: g, screenPermissionRequested: $, nextQuestion: S, type: G, passthroughData: f, recordingMediaTypes: Y, captureStream: Q });
|
|
397
|
+
} });
|
|
398
|
+
const b = p[N];
|
|
399
|
+
return b.type === "av_permission" && ye({ currentPage: b, pages: p }), b;
|
|
400
|
+
}({ questionId: n, surveyId: l, next: (p) => {
|
|
401
|
+
r(p, !0);
|
|
402
|
+
}, pages: s.pages, responseGroupUid: o, userId: u }));
|
|
403
|
+
let m = i.headline, x = i.captionText;
|
|
404
|
+
const y = $e(v, i);
|
|
405
|
+
return qe(i) && d && (m = i.permissionDeniedHeadline, x = i.permissionDeniedCaptionText), ue(i) && y === Ae && (m = i.permissionGrantedHeadline, x = i.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(_e, { message: m, properties: { captionText: x } }), e(ee, { children: e(Nt, { properties: s }) })] });
|
|
406
|
+
}, Dt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
407
|
+
const { visitorAttributes: l, isLongFormSurvey: o } = A((i) => ({ visitorAttributes: i.visitorAttributes, isLongFormSurvey: Ue(i.studyType) })), u = (i, m = !1) => {
|
|
408
|
+
s({ value: m ? { skipped: !0 } : void 0, questionId: n, type: a }, !0);
|
|
409
|
+
}, c = (i) => {
|
|
410
|
+
i.key !== "Enter" && i.key !== " " || s({ value: void 0, questionId: n, type: a }, !0);
|
|
411
|
+
}, d = tt(r && r.buttonUrl, l), v = o && r.promptActionType === rt.NO_BUTTON ? () => e(ne, {}) : () => 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: d, id: "ul-card-text__button", onClick: u, onKeyPress: c, rel: "noreferrer", role: d ? "link" : "button", tabIndex: 0, target: "_blank", children: te(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (i) => u(0, !0), children: ke(r) })] }) });
|
|
412
|
+
return e("div", { className: L(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(X, { defaultBody: v, properties: r }) }, n);
|
|
413
|
+
}, wt = ({ className: t, questionId: s }) => {
|
|
414
|
+
const { border: r, destroy: n, endCard: a, forceBrandedLogo: l } = A((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
|
|
415
|
+
W(() => {
|
|
416
|
+
setTimeout(() => {
|
|
417
|
+
n(Se);
|
|
418
|
+
}, l ? 4e3 : 2e3);
|
|
419
|
+
}, [n, l]);
|
|
420
|
+
const o = a && a.subheader ? e("p", { className: "ul-caption", children: a.subheader }) : null, u = a && a.headline ? a.headline : "";
|
|
421
|
+
return e("div", { className: L(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(_e, { message: u }), o] }) }) }, s);
|
|
422
|
+
}, qt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), Pt = ({ className: t }) => {
|
|
423
|
+
const { uploadProgress: s } = A((l) => ({ uploadProgress: l.uploadProgress }));
|
|
424
|
+
let r, n;
|
|
425
|
+
Object.values(s).filter((l) => l.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.");
|
|
426
|
+
const a = Math.round(Math.min(99, ...Object.values(s).filter((l) => l.isSubmitted).map((l) => l.progressPct || 0)));
|
|
427
|
+
return e("div", { className: L(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(_e, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] });
|
|
428
|
+
}, Re = 0, Le = 1, Rt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
429
|
+
const l = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: u, handleUploadUpdate: c, headers: d, responseGroupUid: v, surveyId: i, update: m, viewDocument: x, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, update: b.update, viewDocument: b.viewDocument, visitorId: b.userId })), [p, T] = H(!1), [D, h] = H(null), [_, S] = H(null), [k, q] = H(Re), M = z(null);
|
|
430
|
+
W(() => {
|
|
431
|
+
const b = M.current, g = new ResizeObserver(() => {
|
|
432
|
+
m();
|
|
433
|
+
});
|
|
434
|
+
return b && g.observe(b), () => {
|
|
435
|
+
b && g.unobserve(b);
|
|
436
|
+
};
|
|
437
|
+
}, [m]);
|
|
438
|
+
const f = (b, g) => {
|
|
439
|
+
b === F.UPLOAD_STARTED ? (h(g[F.UPLOAD_ID]), S(g[F.MEDIA_RECORDING_UID]), T(!0)) : b === F.DELETE ? (h(null), S(null), T(!1)) : b === F.UPLOAD_PROGRESS ? isNaN(g[F.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: g[F.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: g[F.MEDIA_RECORDING_UID], progressPct: g[F.UPLOAD_PROGRESS_PCT] }) : b === F.UPLOAD_FINISHED && c({ mediaRecordingUid: g[F.MEDIA_RECORDING_UID], isComplete: !0 });
|
|
440
|
+
}, N = (b) => {
|
|
441
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(l) && st(l), D && _ ? (c({ mediaRecordingUid: _, isSubmitted: !0 }), s({ value: { mediaRecordingUid: _ }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0);
|
|
442
|
+
};
|
|
443
|
+
return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ee, { children: [e("div", { id: "ul-question-player-container", ref: M, style: { display: k === Re ? "" : "none" }, children: e(X, { defaultBody: () => e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
|
|
444
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(l) && nt(l), q(Le);
|
|
445
|
+
} }), properties: r }) }), e("div", { style: { display: k === Le ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (b) => {
|
|
446
|
+
if (b && b.children.length === 0) {
|
|
447
|
+
const g = at(l, { surveyId: i, responseGroupUid: v, questionId: n, visitorId: y, envId: u }, o, f, void 0, { ...d, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === F.MEDIA_TYPE_AUDIO, x);
|
|
448
|
+
b.appendChild(g);
|
|
449
|
+
}
|
|
450
|
+
} }) })] }), e(ae, { children: [e(ie, { isDisabled: !!r.required && !p, onClick: N, children: te(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: N, style: { ...r.required ? { display: "none" } : {}, ...p ? { display: "none" } : {} }, children: ke(r) })] })] });
|
|
451
|
+
}, Ve = (t) => t.type === "thanks" || t.type === "uploading", Lt = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => {
|
|
452
|
+
const l = ((o) => "properties" in o.props && o.props.properties && "questionHtml" in o.props.properties && o.props.properties.questionHtml ? { content: o.props.properties.questionHtml, isHtml: !0 } : "message" in o.props ? { content: o.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
|
|
453
|
+
return e(oe, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: l.content }, ref: n ? a : null, children: r ? e(qt, {}) : e(ne, { children: [l.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: l.content } }) : e("div", { className: "chat-message-text", children: l.content }), t.type === "videovoice" && e(it, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
|
|
454
|
+
}, Mt = ({ card: t, avatars: s }) => {
|
|
455
|
+
const r = ((n) => {
|
|
456
|
+
if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
|
|
457
|
+
const a = n.props.properties, l = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
|
|
458
|
+
for (const { key: o, isHtml: u } of l) {
|
|
459
|
+
const c = a[o];
|
|
460
|
+
if (typeof c != "string") continue;
|
|
461
|
+
const d = c.trim();
|
|
462
|
+
if (d) {
|
|
463
|
+
if (u && !d.replaceAll(/<[^>]*>/g, "").trim()) continue;
|
|
464
|
+
return { content: d, isHtml: u };
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
})(t);
|
|
469
|
+
return r ? e(oe, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: r.content } }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
|
|
470
|
+
}, Ut = ({ card: t, userResponse: s, avatars: r }) => {
|
|
471
|
+
const n = ((a, l) => {
|
|
472
|
+
if (a.type === "open" && l && typeof l == "object" && "value" in l) return l.value;
|
|
473
|
+
})(t, s);
|
|
474
|
+
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` })] });
|
|
475
|
+
}, Et = ({ card: t, avatars: s, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => {
|
|
476
|
+
const { endCard: a } = A((l) => ({ endCard: l.endCard }));
|
|
477
|
+
return e(ne, { children: [e(oe, { avatars: s, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (a == null ? void 0 : a.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (a == null ? void 0 : a.subheader) && e(oe, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: a.subheader } }), e(ot, {})] });
|
|
478
|
+
}, Bt = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: l, startingQuestionIdx: o, currentQuestionBubbleRef: u, handleCardResponse: c }) => {
|
|
479
|
+
const d = s === r, v = s < r, i = Ve(t);
|
|
480
|
+
if (i) return e(Et, { avatars: n, card: t, currentQuestionBubbleRef: u, isCurrentQuestion: d });
|
|
481
|
+
const m = `${t.name}`, x = a.get(m), y = t.type === "open", p = l.get(m), T = s > (o ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (p === !0 || p === void 0);
|
|
482
|
+
return e(Me.Fragment, { children: [e(Lt, { avatars: n, card: t, currentQuestionBubbleRef: u, isCurrentQuestion: d, isThinking: T }), !T && e(Mt, { avatars: n, card: t }), v && y ? e(Ut, { avatars: n, card: t, userResponse: x }) : (!v || !y) && !T && e(oe, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e($t, { card: t, className: i ? "chat-thanks-card" : "chat-card", isAnswered: v, next: d ? c : () => {
|
|
483
|
+
} }) }) })] }, `question-card-${t.name}`);
|
|
484
|
+
}, oe = Me.forwardRef(({ message: t, isLeft: s = !1, children: r, avatars: n, hideAvatar: a = !1 }, l) => {
|
|
485
|
+
const o = s ? "chat-bubble-left" : "chat-bubble-right";
|
|
486
|
+
return e("div", { className: `chat-bubble-container ${s ? "chat-left" : "chat-right"}${s && a ? " chat-no-avatar" : ""}`, ref: l, children: [s && !a && 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 ${o}`, children: r || e("div", { className: "chat-message-text", children: t.content }) }), !s && !a && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x` })] });
|
|
487
|
+
});
|
|
488
|
+
oe.displayName = "ChatBubble";
|
|
489
|
+
const At = () => {
|
|
490
|
+
const t = A((r) => r.close), s = pe(() => () => t(Se), [t]);
|
|
491
|
+
return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: s, onKeyPress: (r) => {
|
|
492
|
+
r.key === "Enter" && s();
|
|
493
|
+
}, 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" }) }) });
|
|
494
|
+
}, $t = ({ card: t, next: s, className: r = "", isAnswered: n = !1 }) => {
|
|
495
|
+
const a = { className: n ? `${r} answered-card` : r, next: n ? () => {
|
|
496
|
+
} : s, questionId: t.name, type: t.type, isAnswered: n };
|
|
497
|
+
switch (t.type) {
|
|
498
|
+
case "consentlegal":
|
|
499
|
+
return e(lt, { ...a, ...t.props });
|
|
500
|
+
case "likert":
|
|
501
|
+
return e(ut, { ...a, ...t.props });
|
|
502
|
+
case "matrix":
|
|
503
|
+
return e(mt, { ...a, ...t.props });
|
|
504
|
+
case "multiplechoice":
|
|
505
|
+
return e(ht, { ...a, ...t.props });
|
|
506
|
+
case "multipleselect":
|
|
507
|
+
return e(gt, { ...a, ...t.props });
|
|
508
|
+
case "nps":
|
|
509
|
+
return e(vt, { ...a, ...t.props });
|
|
510
|
+
case "open":
|
|
511
|
+
return e(bt, { ...a, ...t.props });
|
|
512
|
+
case "rankorder":
|
|
513
|
+
return e(yt, { ...a, ...t.props });
|
|
514
|
+
case "recordedtask":
|
|
515
|
+
return e(It, { ...a, ...t.props });
|
|
516
|
+
case "texturlprompt":
|
|
517
|
+
return e(Dt, { ...a, ...t.props });
|
|
518
|
+
case "thanks":
|
|
519
|
+
return e(wt, { ...a, ...t.props });
|
|
520
|
+
case "uploading":
|
|
521
|
+
return e(Pt, { ...a, ...t.props });
|
|
522
|
+
case "videovoice":
|
|
523
|
+
return e(Rt, { ...a, ...t.props });
|
|
524
|
+
default:
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
}, Vt = ({ cards: t, next: s, previousResponses: r }) => {
|
|
528
|
+
const { messagesContainerRef: n, currentQuestionBubbleRef: a, scrollToCurrentQuestion: l } = (() => {
|
|
529
|
+
const h = z(null), _ = z(null), S = ce(() => {
|
|
530
|
+
if (_.current && h.current) {
|
|
531
|
+
const k = h.current, q = _.current.offsetTop - k.offsetTop - 16;
|
|
532
|
+
k.scrollTo({ top: Math.max(0, q), behavior: "smooth" });
|
|
533
|
+
}
|
|
534
|
+
}, []);
|
|
535
|
+
return { messagesContainerRef: h, currentQuestionBubbleRef: _, scrollToCurrentQuestion: S };
|
|
536
|
+
})(), { cardResponses: o, setCardResponse: u } = (() => {
|
|
537
|
+
const [h, _] = H(/* @__PURE__ */ new Map());
|
|
538
|
+
return { cardResponses: h, setCardResponse: ce((S, k) => {
|
|
539
|
+
_((q) => new Map(q).set(S, k));
|
|
540
|
+
}, []) };
|
|
541
|
+
})(), { index: c, isLongFormSurvey: d, avatars: v, startingQuestionIdx: i } = A((h) => ({ index: h.index, isLongFormSurvey: Ue(h.studyType), avatars: h.avatars, startingQuestionIdx: h.startingQuestionIdx })), m = ((h, _, S) => {
|
|
542
|
+
const [k, q] = H(/* @__PURE__ */ new Map());
|
|
543
|
+
return W(() => {
|
|
544
|
+
if (h.length > 0 && _ < h.length) {
|
|
545
|
+
const M = h[_], f = `${M.name}`;
|
|
546
|
+
if (_ <= (S ?? 0) || Ve(M)) return void q((b) => new Map(b).set(f, !1));
|
|
547
|
+
q((b) => new Map(b).set(f, !0));
|
|
548
|
+
const N = setTimeout(() => {
|
|
549
|
+
q((b) => new Map(b).set(f, !1));
|
|
550
|
+
}, 1e3);
|
|
551
|
+
return () => clearTimeout(N);
|
|
552
|
+
}
|
|
553
|
+
}, [_, h, S]), k;
|
|
554
|
+
})(t, c, i), x = ((h, _) => {
|
|
555
|
+
const [S, k] = H(/* @__PURE__ */ new Set([0]));
|
|
556
|
+
return W(() => {
|
|
557
|
+
k((q) => new Set(q).add(h));
|
|
558
|
+
}, [h]), W(() => {
|
|
559
|
+
const q = _ ?? 0;
|
|
560
|
+
q > 0 && k((M) => {
|
|
561
|
+
const f = new Set(M);
|
|
562
|
+
for (let N = 0; N <= q; N++) f.add(N);
|
|
563
|
+
return f;
|
|
564
|
+
});
|
|
565
|
+
}, [_]), S;
|
|
566
|
+
})(c, i), y = pe(() => ({ ...r, ...Ke(t.map((h, _) => {
|
|
567
|
+
var S, k;
|
|
568
|
+
return { ...h, value: _ < c ? ((S = o.get(`${h.name}`)) == null ? void 0 : S.value) ?? null : null, secondaryValue: _ < c ? ((k = o.get(`${h.name}`)) == null ? void 0 : k.secondaryValue) ?? null : null };
|
|
569
|
+
})) }), [r, o, t, c]), p = Xe(t, y);
|
|
570
|
+
W(() => {
|
|
571
|
+
requestAnimationFrame(() => {
|
|
572
|
+
l();
|
|
573
|
+
});
|
|
574
|
+
}, [c, l, m]);
|
|
575
|
+
const T = ce((h, _) => {
|
|
576
|
+
if (!_) return;
|
|
577
|
+
const S = p[c];
|
|
578
|
+
if (!S) return;
|
|
579
|
+
const k = `${S.name}`;
|
|
580
|
+
u(k, h), s([h]);
|
|
581
|
+
}, [p, c, s, u]), D = p.map((h, _) => ({ card: h, cardIndex: _ })).filter(({ cardIndex: h }) => x.has(h));
|
|
582
|
+
return e("div", { className: "conversational-ui ul-conversational-ui", children: [!d && e(At, {}), e("div", { className: "chat-container", ref: n, children: e("div", { className: "chat-messages", children: D.map(({ card: h, cardIndex: _ }) => e(Bt, { avatars: v, card: h, cardIndex: _, cardResponses: o, currentQuestionBubbleRef: a, handleCardResponse: T, index: c, questionThinkingStates: m, startingQuestionIdx: i }, `question-card-${h.name}`)) }) })] });
|
|
583
|
+
};
|
|
584
|
+
export {
|
|
585
|
+
Vt as default
|
|
586
|
+
};
|