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