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