@sprig-technologies/sprig-bundled 2.41.1 → 2.41.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-ui-rjtdSFBb.js → conversational-ui-B9H7uNQs.js} +80 -80
- package/dist/{conversational-ui-CRdFUEdz.cjs → conversational-ui-IgSB2b9B.cjs} +2 -2
- package/dist/{getAttributedUrl-WX6TIqnY.cjs → getAttributedUrl-DPVLIzlh.cjs} +1 -1
- package/dist/{getAttributedUrl-BCuq8noY.js → getAttributedUrl-DxNZ8ZsR.js} +2 -2
- package/dist/{index-Dm5Q2JaO.js → index-BiIngDfi.js} +373 -373
- package/dist/{index-B4g9h0E3.js → index-CL3rX0v3.js} +78 -78
- package/dist/{index-D2QLhKHZ.cjs → index-DEIb7Tgo.cjs} +15 -15
- package/dist/index-QboanN7x.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/view-DunMtls8.cjs +1 -0
- package/dist/{view-CocVngjw.js → view-E1bmiI1s.js} +93 -92
- package/package.json +1 -1
- package/dist/index-Ci7K6Rbp.cjs +0 -1
- package/dist/view-rFRtvibL.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { i as se, E as Ne, h as Pe, j as Ve, A as ur } from "./index-
|
|
3
|
-
import { c as ie, a as le, H as Se, M as pe, Q as ue, O as ye, B as ee, L as xe, b as ke, S as pr, u as mr, g as gr, P as hr, d as br } from "./getAttributedUrl-
|
|
1
|
+
import { u as z, h as J, a as e, c as O, g as re, d as Oe, F as me, e as be, b as ge, _ as te, T as Te, A as er, p as ne, f as rr, n as tr, q as nr, M as oe, s as Ue, o as sr, i as ir, S as ar, r as lr, j as Fe, k as or, l as dr, t as cr, m as Be } from "./view-E1bmiI1s.js";
|
|
2
|
+
import { i as se, E as Ne, h as Pe, j as Ve, A as ur } from "./index-BiIngDfi.js";
|
|
3
|
+
import { c as ie, a as le, H as Se, M as pe, Q as ue, O as ye, B as ee, L as xe, b as ke, S as pr, u as mr, g as gr, P as hr, d as br } from "./getAttributedUrl-DxNZ8ZsR.js";
|
|
4
4
|
const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, type: a }) => {
|
|
5
|
-
const { useMobileStyling: m, border: g, isLongFormSurvey: c, focusedQuestionId: p } =
|
|
5
|
+
const { useMobileStyling: m, border: g, isLongFormSurvey: c, focusedQuestionId: p } = z((v) => ({ useMobileStyling: v.useMobileStyling, border: v.border, isLongFormSurvey: se(v.studyType), focusedQuestionId: v.focusedQuestionId })), [d, y] = J(!1), [i, f] = J(""), [u, h] = J(!1), b = c && p === r, S = n == null ? void 0 : n.collectName, C = (n == null ? void 0 : n.nameLabelText) || "Full Name", k = (n == null ? void 0 : n.consentText) || "I agree to the stated conditions", E = (n == null ? void 0 : n.submitButtonText) || "Submit", P = !!i.trim(), D = d && (!S || P), F = (v, N = !1) => {
|
|
6
6
|
v.preventDefault(), v.stopPropagation();
|
|
7
7
|
let B = null;
|
|
8
8
|
if (!N) {
|
|
@@ -21,7 +21,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
21
21
|
v.preventDefault(), v.stopPropagation(), f(v.currentTarget.value);
|
|
22
22
|
}, placeholder: C, style: u && !P ? { borderColor: Ne } : {}, tabIndex: 0, value: i })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ee, { className: D ? "" : "sprig-button-disabled", onClick: F, children: E }), n.required === !1 && !c && e("button", { className: "ul-card-skip__button", onClick: (v) => F(v, !0), children: Oe(n) })] })] }) })] }, r);
|
|
23
23
|
}, yr = ({ activeValue: t, border: s, icon: o, isPressed: n, onSubmit: r, range: a, scaleLabelType: m, selectedValue: g, setSelectedValue: c, setActiveValue: p, setIsPressed: d, useMobileStyling: y, value: i, viewDocument: f }) => {
|
|
24
|
-
const { isLongFormSurvey: u, enableCspTrustedTypes: h } =
|
|
24
|
+
const { isLongFormSurvey: u, enableCspTrustedTypes: h } = z((N) => ({ isLongFormSurvey: se(N.studyType), enableCspTrustedTypes: N.enableCspTrustedTypes })), b = `option-${i}`, S = m === "number", C = m === "star", k = m === "smiley", E = S && i === t || i === g, [P, D] = (() => {
|
|
25
25
|
const N = C && g !== null && i <= g;
|
|
26
26
|
return C && i <= t || k && i === t || N || i === t || i === g ? [s, n || N || i === g ? 1 : 0.3] : ["", 1];
|
|
27
27
|
})(), F = me(() => {
|
|
@@ -53,7 +53,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
53
53
|
p(-1), d(!1);
|
|
54
54
|
}, style: F, tabIndex: 0 });
|
|
55
55
|
}, fr = ({ className: t, labels: s, message: o, next: n, properties: r, questionId: a, type: m }) => {
|
|
56
|
-
const { border: g, useMobileStyling: c, viewDocument: p, isLongFormSurvey: d, focusedQuestionId: y } =
|
|
56
|
+
const { border: g, useMobileStyling: c, viewDocument: p, isLongFormSurvey: d, focusedQuestionId: y } = z((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, viewDocument: T.viewDocument, isLongFormSurvey: se(T.studyType), focusedQuestionId: T.focusedQuestionId })), [i, f] = J(-1), [u, h] = J(!1), [b, S] = J(null), C = d && y === a, k = s && s.left, E = s && s.right;
|
|
57
57
|
let P;
|
|
58
58
|
const { range: D, scaleLabelType: F, ratingIcons: v } = r;
|
|
59
59
|
D && (P = Number(D));
|
|
@@ -79,7 +79,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
79
79
|
const s = getComputedStyle(t);
|
|
80
80
|
return parseFloat(s.marginTop) + parseFloat(s.marginBottom) + (parseFloat(s.borderTopWidth) + parseFloat(s.borderBottomWidth));
|
|
81
81
|
}, Sr = ({ columns: t, onSelect: s, options: o, selectedOptions: n }) => {
|
|
82
|
-
const r = te([]), { border: a, useMobileStyling: m } =
|
|
82
|
+
const r = te([]), { border: a, useMobileStyling: m } = z((i) => ({ border: i.border, useMobileStyling: i.useMobileStyling })), g = o.findIndex((i) => n[i.id] === null), [c, p] = J(g), d = Te((i, f) => {
|
|
83
83
|
s(i, f);
|
|
84
84
|
const u = c + 1, h = o[u];
|
|
85
85
|
if (h && n[h.id] === null) {
|
|
@@ -101,7 +101,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
101
101
|
}, [a, t, c, d, n, m]);
|
|
102
102
|
return e("div", { children: o.map((i, f) => y(f, i)) });
|
|
103
103
|
}, kr = ({ columns: t, onSelect: s, options: o, selectedOptions: n }) => {
|
|
104
|
-
const { border: r, useMobileStyling: a, isLongFormSurvey: m } =
|
|
104
|
+
const { border: r, useMobileStyling: a, isLongFormSurvey: m } = z((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, isLongFormSurvey: se(u.studyType) })), g = o.length, c = t.length, p = te(null), [d, y] = J(!1), [i, f] = J(!1);
|
|
105
105
|
return ne(() => {
|
|
106
106
|
const u = p.current, h = new ResizeObserver((b) => {
|
|
107
107
|
window.requestAnimationFrame(() => {
|
|
@@ -132,7 +132,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
132
132
|
}
|
|
133
133
|
}, children: e(i && !d ? Tr : Cr, {}) })] });
|
|
134
134
|
}, Tr = () => e("svg", { fill: "currentColor", height: "32", transform: "matrix(-1,0,0,1,0,0)", version: "1.1", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Cr = () => e("svg", { fill: "currentColor", height: "32", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Ir = ({ className: t, message: s, next: o, options: n, properties: r, questionId: a, type: m, showIndividualSubmit: g = !1, onSubmitButtonClick: c }) => {
|
|
135
|
-
const { useMobileStyling: p, isLongFormSurvey: d, focusedQuestionId: y, setFocusedQuestionId: i } =
|
|
135
|
+
const { useMobileStyling: p, isLongFormSurvey: d, focusedQuestionId: y, setFocusedQuestionId: i } = z((F) => ({ useMobileStyling: F.useMobileStyling, isLongFormSurvey: se(F.studyType), focusedQuestionId: F.focusedQuestionId, setFocusedQuestionId: F.setFocusedQuestionId })), f = r.matrixColumn, u = r.required, h = d && y === a, b = (F) => {
|
|
136
136
|
F.preventDefault(), F.stopPropagation(), o({ value: C, questionId: a, type: m }, !0), c && c();
|
|
137
137
|
}, S = n.reduce((F, v) => (F[v.id] = null, F), {}), [C, k] = J(S), E = (F) => u && Object.values(F).every((v) => v == null), P = (F, v) => {
|
|
138
138
|
d && o({ value: { ...C, [F]: v }, questionId: a, type: m }, !E({ ...C, [F]: v })), k((N) => ({ ...N, [F]: v }));
|
|
@@ -141,26 +141,26 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
141
141
|
h && i(a);
|
|
142
142
|
}, onSubmit: b, children: [e(ie, { isRequired: d && (r == null ? void 0 : r.required), message: s, properties: r }), e(pe, { properties: r, children: [e(le, { children: [e(D ? Sr : kr, { columns: f, onSelect: P, options: n, selectedOptions: C }), g && e(xe, { handleSubmit: b, isSubmitDisabled: E(C) })] }), !d && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: E(C), children: ge(r) }) }) })] })] }, a);
|
|
143
143
|
}, je = ({ className: t, message: s, onSubmit: o, options: n = [], properties: r, questionId: a, type: m, showIndividualSubmit: g = !1, onSubmitButtonClick: c }) => {
|
|
144
|
-
const { border: p, useMobileStyling: d, isLongFormSurvey: y, focusedQuestionId: i, setFocusedQuestionId: f } =
|
|
144
|
+
const { border: p, useMobileStyling: d, isLongFormSurvey: y, focusedQuestionId: i, setFocusedQuestionId: f } = z((_) => ({ border: _.border, useMobileStyling: _.useMobileStyling, isLongFormSurvey: se(_.studyType), focusedQuestionId: _.focusedQuestionId, setFocusedQuestionId: _.setFocusedQuestionId })), u = y && i === a, h = n.reduce((_, q) => (_[q.id] = { isSelected: !1 }, _), {}), [b, S] = J(h), C = m === "multiplechoice", k = r.required, E = n.find((_) => {
|
|
145
145
|
var q;
|
|
146
146
|
return (q = _.optionProperties) == null ? void 0 : q.noneOfTheAbove;
|
|
147
147
|
}), P = (_) => Object.entries(_).some(([q, H]) => {
|
|
148
148
|
var l;
|
|
149
|
-
const
|
|
150
|
-
return ((l =
|
|
149
|
+
const W = n.find((x) => `${x.id}` === q), V = H.userText === void 0 || H.userText.trim() === "";
|
|
150
|
+
return ((l = W == null ? void 0 : W.optionProperties) == null ? void 0 : l.allowsTextEntry) && V && H.isSelected;
|
|
151
151
|
}), D = (_) => Object.values(_).filter((q) => q.isSelected).length, F = r.minSelect && r.minSelect > 0 && r.maxSelectMode === ke.Range && D(b) < r.minSelect && (k || D(b) > 0), v = (_) => P(_) || k && !D(_) || !((q) => {
|
|
152
|
-
const { minSelect: H = 0, maxSelect:
|
|
152
|
+
const { minSelect: H = 0, maxSelect: W = 1 / 0, maxSelectMode: V } = r, l = D(q);
|
|
153
153
|
switch (V) {
|
|
154
154
|
case ke.Maximum:
|
|
155
|
-
return l <=
|
|
155
|
+
return l <= W;
|
|
156
156
|
case ke.Range:
|
|
157
157
|
return l === 0 || l >= H;
|
|
158
158
|
default:
|
|
159
159
|
return !0;
|
|
160
160
|
}
|
|
161
161
|
})(_), N = Object.entries(b).some(([_, q]) => {
|
|
162
|
-
var H,
|
|
163
|
-
return q.isSelected && ((
|
|
162
|
+
var H, W;
|
|
163
|
+
return q.isSelected && ((W = (H = n.find((V) => `${V.id}` === _)) == null ? void 0 : H.optionProperties) == null ? void 0 : W.allowsTextEntry);
|
|
164
164
|
}), B = g && (!C || N), T = (_) => {
|
|
165
165
|
X(_.id, _.selected, _.userText, _.noneOfTheAbove), _.selected && y && !C && !u && f(a);
|
|
166
166
|
}, L = (_) => {
|
|
@@ -168,14 +168,14 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
168
168
|
return (r == null ? void 0 : r.maxSelectMode) !== ke.Unlimited && D(b) === (r == null ? void 0 : r.maxSelect) && !((q = b[_]) != null && q.isSelected);
|
|
169
169
|
}, A = (_) => {
|
|
170
170
|
_.preventDefault(), _.stopPropagation(), o(b, !0), c && c();
|
|
171
|
-
}, X = (_, q, H,
|
|
171
|
+
}, X = (_, q, H, W) => {
|
|
172
172
|
const V = Object.assign({}, b);
|
|
173
|
-
if ((C ||
|
|
174
|
-
else E && !
|
|
173
|
+
if ((C || W) && q) for (const w of Object.values(V)) w.isSelected = !1, delete w.userText;
|
|
174
|
+
else E && !W && b[E.id].isSelected && (V[E.id].isSelected = !1);
|
|
175
175
|
V[_] = { isSelected: q, userText: H };
|
|
176
176
|
const l = C && Object.entries(V).some(([w, Q]) => {
|
|
177
177
|
var R, j;
|
|
178
|
-
return Q.isSelected && ((j = (R = n.find((
|
|
178
|
+
return Q.isSelected && ((j = (R = n.find((Y) => `${Y.id}` === w)) == null ? void 0 : R.optionProperties) == null ? void 0 : j.allowsTextEntry);
|
|
179
179
|
}), x = !v(V);
|
|
180
180
|
y && (o(V, x), C && !l && x && c && c()), S(V);
|
|
181
181
|
};
|
|
@@ -185,14 +185,14 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
185
185
|
const q = { ...b };
|
|
186
186
|
for (const H of n) _.includes(H) ? q[H.id].isSelected = !0 : q[H.id].isSelected = !1;
|
|
187
187
|
y && o(q, !v(q)), S(q);
|
|
188
|
-
}, options: n, placeholderText: r.dropdownPlaceholderText ?? (C ? "Select choice" : "Select choice(s)"), value: n.filter((_) => b[_.id].isSelected) }) : e("div", { className: O(re("ul-card__choices", d)), role: C ? "radiogroup" : "group", children: [n.map(({ id: _, label: q, value: H, optionProperties:
|
|
188
|
+
}, options: n, placeholderText: r.dropdownPlaceholderText ?? (C ? "Select choice" : "Select choice(s)"), value: n.filter((_) => b[_.id].isSelected) }) : e("div", { className: O(re("ul-card__choices", d)), role: C ? "radiogroup" : "group", children: [n.map(({ id: _, label: q, value: H, optionProperties: W }) => {
|
|
189
189
|
var Q, R;
|
|
190
|
-
const V = `${_}`, { allowsTextEntry: l, noneOfTheAbove: x } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...
|
|
191
|
-
return e(ye, { allowTextEntry: l, border: p, disabled: L(V), error: (w = b, P(w)), id: V, isRadio: C, isSelected: !!((Q = b[V]) != null && Q.isSelected), label: q, noneOfTheAbove: x, onUserInputChanged: T, promptText: "Please specify", text: (R = b[_]) == null ? void 0 : R.userText, useMobileStyling: d, value: H }, V);
|
|
190
|
+
const V = `${_}`, { allowsTextEntry: l, noneOfTheAbove: x } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...W };
|
|
191
|
+
return e(ye, { allowTextEntry: l, border: p, disabled: L(V), error: (w = b, P(w)), id: V, isRadio: C, isSelected: !!((Q = b[V]) != null && Q.isSelected), label: q, noneOfTheAbove: x, onUserInputChanged: T, promptText: (W == null ? void 0 : W.otherOptionPlaceholder) || "Please specify", text: (R = b[_]) == null ? void 0 : R.userText, useMobileStyling: d, value: H }, V);
|
|
192
192
|
var w;
|
|
193
193
|
}), !!F && e("div", { className: "ul-card__min-select-counter", children: [D(b), "/", r.minSelect] })] }), B && e(xe, { handleSubmit: A, isSubmitDisabled: v(b) })] }), !y && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: v(b), onClick: A, children: ge(r) }) }) })] }) })] }, a);
|
|
194
194
|
}, _r = (t) => {
|
|
195
|
-
const { questionId: s, type: o, next: n, options: r } = t, { setFocusedQuestionId: a } =
|
|
195
|
+
const { questionId: s, type: o, next: n, options: r } = t, { setFocusedQuestionId: a } = z((m) => ({ setFocusedQuestionId: m.setFocusedQuestionId }));
|
|
196
196
|
return e(je, { ...t, onSubmit: (m, g) => {
|
|
197
197
|
var f;
|
|
198
198
|
const c = Object.entries(m).find(([, u]) => u.isSelected) || [void 0, void 0], [p, d] = c, y = r.find((u) => `${u.id}` === p);
|
|
@@ -211,7 +211,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
211
211
|
n({ value: m, secondaryValue: g, questionId: s, type: o }, a);
|
|
212
212
|
} });
|
|
213
213
|
}, wr = ({ className: t, labels: s, message: o, properties: n, next: r, questionId: a, type: m }) => {
|
|
214
|
-
const [g, c] = J(null), { border: p, useMobileStyling: d, viewDocument: y, isLongFormSurvey: i, focusedQuestionId: f } =
|
|
214
|
+
const [g, c] = J(null), { border: p, useMobileStyling: d, viewDocument: y, isLongFormSurvey: i, focusedQuestionId: f } = z((S) => ({ border: S.border, useMobileStyling: S.useMobileStyling, viewDocument: S.viewDocument, isLongFormSurvey: se(S.studyType), focusedQuestionId: S.focusedQuestionId })), u = i && f === a, h = s && s.left, b = s && s.right;
|
|
215
215
|
return e("form", { className: O(t, "ul-card--nps", "fade-in-transition", i && !u && "ul-card--unfocused"), children: [e(ie, { isRequired: i && (n == null ? void 0 : n.required), message: o, properties: n }), e(pe, { properties: n, children: [e(le, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((S, C) => e("button", { className: O(re("nps-number", d), re(`nps-number-${C}`, d)), id: `option-${C}`, onClick: (k) => {
|
|
216
216
|
i && (k.preventDefault(), k.stopPropagation(), c(C)), r({ value: C, questionId: a, type: m }, !0);
|
|
217
217
|
}, onKeyDown: (k) => {
|
|
@@ -226,7 +226,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
226
226
|
S.preventDefault(), S.stopPropagation(), r({ value: null, questionId: a, type: m }, !0);
|
|
227
227
|
}, children: ge(n) }) }) })] })] }, a);
|
|
228
228
|
}, qr = (t) => {
|
|
229
|
-
const { className: s, message: o, next: n, properties: r, questionId: a, type: m, showIndividualSubmit: g = !1, onSubmitButtonClick: c } = t, p = m === "aidynamicfollowup" ? t.loading : void 0, { border: d, useMobileStyling: y, update: i, isLongFormSurvey: f, focusedQuestionId: u, setFocusedQuestionId: h, isPreview: b } =
|
|
229
|
+
const { className: s, message: o, next: n, properties: r, questionId: a, type: m, showIndividualSubmit: g = !1, onSubmitButtonClick: c } = t, p = m === "aidynamicfollowup" ? t.loading : void 0, { border: d, useMobileStyling: y, update: i, isLongFormSurvey: f, focusedQuestionId: u, setFocusedQuestionId: h, isPreview: b } = z((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, update: T.update, isLongFormSurvey: se(T.studyType), focusedQuestionId: T.focusedQuestionId, setFocusedQuestionId: T.setFocusedQuestionId, isPreview: T.isPreview })), [S, C] = J(""), k = te(null), E = f && u === a;
|
|
230
230
|
ne(() => {
|
|
231
231
|
var T, L;
|
|
232
232
|
f && !b && (E ? (T = k.current) == null || T.focus() : (L = k.current) == null || L.blur());
|
|
@@ -258,7 +258,7 @@ const vr = ({ className: t, message: s, next: o, properties: n, questionId: r, t
|
|
|
258
258
|
t(s);
|
|
259
259
|
} }));
|
|
260
260
|
function qe({ currentPage: t, pages: s }) {
|
|
261
|
-
const { avStream: o, recordingMediaTypes: n, updatePage: r } = de.getState(), { recorderEventEmitter: a } =
|
|
261
|
+
const { avStream: o, recordingMediaTypes: n, updatePage: r } = de.getState(), { recorderEventEmitter: a } = z.getState();
|
|
262
262
|
a.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (m, g) => {
|
|
263
263
|
if (o === m) return;
|
|
264
264
|
let c = t;
|
|
@@ -270,7 +270,7 @@ function qe({ currentPage: t, pages: s }) {
|
|
|
270
270
|
} });
|
|
271
271
|
}
|
|
272
272
|
function Le({ status: t }) {
|
|
273
|
-
const { nextQuestion: s, passthroughData: o, mediaRecordingUids: n, reset: r } = de.getState(), { recorderEventEmitter: a, handleUploadUpdate: m, index: g } =
|
|
273
|
+
const { nextQuestion: s, passthroughData: o, mediaRecordingUids: n, reset: r } = de.getState(), { recorderEventEmitter: a, handleUploadUpdate: m, index: g } = z.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (o == null ? void 0 : o.questionId) || 1 };
|
|
274
274
|
o && a.emit("finish.task", { "begin.callback": (p) => {
|
|
275
275
|
m({ mediaRecordingUid: p, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
276
276
|
}, "progress.callback": (p, d) => {
|
|
@@ -282,7 +282,7 @@ function Le({ status: t }) {
|
|
|
282
282
|
} });
|
|
283
283
|
}
|
|
284
284
|
function Me({ pages: t, setIsRequestingPermission: s }) {
|
|
285
|
-
const { recorderEventEmitter: o, eventEmitFn: n } =
|
|
285
|
+
const { recorderEventEmitter: o, eventEmitFn: n } = z.getState(), { updatePage: r, currentPage: a, recordingMediaTypes: m, screenPermissionRequested: g } = de.getState();
|
|
286
286
|
if (!a) return;
|
|
287
287
|
const c = t.indexOf(a);
|
|
288
288
|
switch (a.type) {
|
|
@@ -320,7 +320,7 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
320
320
|
const { buttonText: n, skipButtonText: r } = t;
|
|
321
321
|
return Re(s), e("div", { className: "ul-task-page", children: [t.taskDetail && e(Xe, { richTextBody: t.taskDetail }), e(pe, { properties: o, children: e("div", { className: Ie, children: [e(ee, { className: "ul-complete-task-button", onClick: Le.bind(null, { status: "completed" }), children: n }), e(ee, { className: O("ul-button-inactive"), onClick: Le.bind(null, { status: "given.up" }), children: r })] }) })] }, "complete-task");
|
|
322
322
|
}, Mr = ({ content: t, pages: s, required: o }) => {
|
|
323
|
-
const { buttonText: n, skipButtonText: r } = t, [a] =
|
|
323
|
+
const { buttonText: n, skipButtonText: r } = t, [a] = z((c) => [c.tabTitle]), [m, g] = J(!1);
|
|
324
324
|
return e("div", { children: [e("div", { className: Ke, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Ye, children: a }) })] }), e("div", { className: o ? "" : Ie, children: [e(ee, { disabled: m, onClick: Me.bind(null, { pages: s, setIsRequestingPermission: g }), children: n }), e(_e, { required: o, skipButtonText: r })] })] });
|
|
325
325
|
}, Rr = ({ content: t }) => e(Se, { className: O(ze, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), Dr = ({ content: t, pages: s, required: o }) => {
|
|
326
326
|
const { permissionDeniedHeadline: n, permissionDeniedBody: r, skipButtonText: a, tryAgainButtonText: m } = t, g = Ce(s[0]) ? s[0] : null;
|
|
@@ -353,18 +353,18 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
353
353
|
return null;
|
|
354
354
|
}
|
|
355
355
|
}, Er = ({ className: t, properties: s, next: o, questionId: n }) => {
|
|
356
|
-
const r =
|
|
356
|
+
const r = z(), { surveyId: a, responseGroupUid: m, userId: g, update: c } = r, p = de(), { screenPermissionRequested: d } = p, y = de((b) => b.avStream);
|
|
357
357
|
let i = de((b) => b.currentPage);
|
|
358
358
|
i || (i = function({ pages: b, userId: S, responseGroupUid: C, surveyId: k, questionId: E, next: P }) {
|
|
359
|
-
const { updatePage: D } = de.getState(), { eventEmitFn: F, recorderEventEmitter: v } =
|
|
359
|
+
const { updatePage: D } = de.getState(), { eventEmitFn: F, recorderEventEmitter: v } = z.getState(), N = { questionId: E, surveyId: k, visitorId: S, responseGroupUid: C };
|
|
360
360
|
let B = 0;
|
|
361
361
|
v.emit("recorded.task.permission.screen"), F("recorded.task.permission.screen"), v.emit("permission.status", { "permission.status.callback": (L, A, X, _) => {
|
|
362
|
-
const q = b[B], { type: H } = q,
|
|
362
|
+
const q = b[B], { type: H } = q, W = ["screen"];
|
|
363
363
|
if (Ce(q)) {
|
|
364
364
|
const { permissionDescriptors: V } = q, l = V == null ? void 0 : V.includes("microphone"), x = V == null ? void 0 : V.includes("camera");
|
|
365
|
-
l &&
|
|
365
|
+
l && W.push("audio"), x && W.push("video"), (L != null && L.active && !x || L != null && L.active && A) && B++;
|
|
366
366
|
}
|
|
367
|
-
Qe(b[B]) && X && (B++, v.emit("begin.recording", { "recording.media.types":
|
|
367
|
+
Qe(b[B]) && X && (B++, v.emit("begin.recording", { "recording.media.types": W, "start.recording.callback": (V) => D({ mediaRecordingUids: V }) })), D({ currentPage: b[B], avStream: L, screenPermissionRequested: X, nextQuestion: P, type: H, passthroughData: N, recordingMediaTypes: W, captureStream: _ });
|
|
368
368
|
} });
|
|
369
369
|
const T = b[B];
|
|
370
370
|
return T.type === "av_permission" && qe({ currentPage: T, pages: b }), T;
|
|
@@ -377,14 +377,14 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
377
377
|
c();
|
|
378
378
|
}, [c]), e("div", { className: O(t, "ul-center-horizontally", "fade-in-transition"), children: [e(ie, { isRequired: s == null ? void 0 : s.required, message: f, properties: { captionText: u } }), e(le, { children: e(Qr, { properties: s }) })] });
|
|
379
379
|
}, $r = ({ richTextBody: t, plaintextBody: s }) => t ? e(Se, { className: "ul-rich-text-body", html: t, id: "ul-card__text-url-body-container" }) : s ? e("div", { className: "ul-rich-text-body", id: "ul-card__text-url-body-container", children: (s ? s.split(/\n\s*\n/g) : []).map((o, n) => e("p", { children: o }, n)) }) : null, Ar = ({ className: t, message: s, next: o, properties: n, questionId: r, type: a }) => {
|
|
380
|
-
const { visitorAttributes: m, isLongFormSurvey: g } =
|
|
380
|
+
const { visitorAttributes: m, isLongFormSurvey: g } = z((y) => ({ visitorAttributes: y.visitorAttributes, isLongFormSurvey: se(y.studyType) })), c = (y, i = !1) => {
|
|
381
381
|
o({ value: i ? { skipped: !0 } : void 0, questionId: r, type: a }, !0);
|
|
382
382
|
}, p = gr(n && n.buttonUrl, m), d = g && n.promptActionType === hr.NO_BUTTON;
|
|
383
383
|
return e("div", { className: O(t, "ul-card__text-url-prompt", "fade-in-transition"), children: [e(ie, { isRequired: g && (n == null ? void 0 : n.required), message: s, properties: { questionHtml: n.questionHtml } }), e(le, { children: e($r, { plaintextBody: n == null ? void 0 : n.body, richTextBody: n == null ? void 0 : n.richTextBody }) }), e(pe, { properties: n, children: !d && e(ue, { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: p, id: "ul-card-text__button", onClick: c, onKeyPress: (y) => {
|
|
384
384
|
y.key !== "Enter" && y.key !== " " || o({ value: void 0, questionId: r, type: a }, !0);
|
|
385
385
|
}, rel: "noreferrer", role: p ? "link" : "button", tabIndex: 0, target: "_blank", children: ge(n) }), n.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => c(0, !0), children: Oe(n) })] }) }) })] }, r);
|
|
386
386
|
}, Or = ({ className: t, questionId: s }) => {
|
|
387
|
-
const { border: o, destroy: n, endCard: r, forceBrandedLogo: a, update: m } =
|
|
387
|
+
const { border: o, destroy: n, endCard: r, forceBrandedLogo: a, update: m } = z((p) => ({ border: p.border, destroy: p.destroy, endCard: p.endCard, forceBrandedLogo: p.forceBrandedLogo, update: p.update }));
|
|
388
388
|
ne(() => {
|
|
389
389
|
setTimeout(() => {
|
|
390
390
|
n(ur);
|
|
@@ -395,7 +395,7 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
395
395
|
m();
|
|
396
396
|
}, [m]), e("div", { className: O(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: o, 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: o, 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(ie, { message: c }), g] }) }) }, s);
|
|
397
397
|
}, Ur = ({ className: t }) => {
|
|
398
|
-
const { uploadProgress: s } =
|
|
398
|
+
const { uploadProgress: s } = z((a) => ({ uploadProgress: a.uploadProgress }));
|
|
399
399
|
let o, n;
|
|
400
400
|
Object.values(s).filter((a) => a.isSubmitted).length > 1 ? (o = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (o = "Your response is processing", n = "Please keep this tab open until your response is fully processed.");
|
|
401
401
|
const r = Math.round(Math.min(99, ...Object.values(s).filter((a) => a.isSubmitted).map((a) => a.progressPct || 0)));
|
|
@@ -419,7 +419,7 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
419
419
|
g({ value: _, questionId: a, type: m }, T, B), f(!1);
|
|
420
420
|
}, B ? 500 : 0);
|
|
421
421
|
}, [c]);
|
|
422
|
-
const { border: u, useMobileStyling: h, enableCspTrustedTypes: b } =
|
|
422
|
+
const { border: u, useMobileStyling: h, enableCspTrustedTypes: b } = z((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling, enableCspTrustedTypes: v.enableCspTrustedTypes })), S = (v, N) => () => {
|
|
423
423
|
i || p((B) => ((T, L, A) => T.map((X) => X.id === L ? { ...X, isRightLabel: A === oe.RIGHT, isLeftLabel: A === oe.LEFT } : A === oe.RIGHT && X.isRightLabel || A === oe.LEFT && X.isLeftLabel ? { ...X, isRightLabel: !1, isLeftLabel: !1 } : X))(B, v, N));
|
|
424
424
|
}, C = (E = n.ratingIcons) == null ? void 0 : E[0].svg, k = (P = n.ratingIcons) == null ? void 0 : P[1].svg;
|
|
425
425
|
return e("form", { className: O(t, "ul-card-maxdiff", "fade-in-transition"), children: [e(ie, { isRequired: n == null ? void 0 : n.required, message: o, properties: n }), e(le, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.left) || ((D = n == null ? void 0 : n.labels) == null ? void 0 : D.left) || jr }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.right) || ((F = n == null ? void 0 : n.labels) == null ? void 0 : F.right) || Zr }), c.map(({ id: v, label: N, isLeftLabel: B, isRightLabel: T }) => e(be, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (k ? "smiley" : ""), children: k ? e($e, { ariaPressed: B, className: B ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: k, id: `smiley-good-${v}`, onClick: S(v, oe.LEFT) }) : e(ye, { allowTextEntry: !1, ariaLabel: `bestLabel-${N}`, border: u, choiceStyle: y, error: !1, id: `${v}`, isRadio: !0, isSelected: B, onUserInputChanged: S(v, oe.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: N }), e("div", { className: "ul-card-maxdiff__option-control " + (C ? "smiley" : ""), children: C ? e($e, { ariaPressed: T, className: T ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: C, id: `smiley-bad-${v}`, onClick: S(v, oe.RIGHT) }) : e(ye, { allowTextEntry: !1, ariaLabel: `worstLabel-${N}`, border: u, choiceStyle: y, error: !1, id: `${v}`, isRadio: !0, isSelected: T, onUserInputChanged: S(v, oe.RIGHT), useMobileStyling: h }) })] }))] }) })] }, a);
|
|
@@ -427,20 +427,20 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
427
427
|
const m = me(() => Ve(n, t), [t, n]);
|
|
428
428
|
return e("span", { "aria-pressed": s, className: o, dangerouslySetInnerHTML: { __html: m }, id: r, onClick: a, tabIndex: 0, type: "button" });
|
|
429
429
|
}, Gr = ({ className: t, labels: s, message: o, next: n, properties: r, questionId: a, type: m, onSubmitButtonClick: g, options: c, showIndividualSubmit: p = !1 }) => {
|
|
430
|
-
const d = te(null), y = te(0), i = te(0), f = te(null), u = te(!1), h = te([]), [b, S] = J(() => (r == null ? void 0 : r.required) === !0), [C, k] = J(() => c.map((I) => ({ ...I, rank: null }))), E = me(() => Array.from({ length: c.length }, (I, $) => $ + 1), [c.length]), { isLongFormSurvey: P, focusedQuestionId: D, setFocusedQuestionId: F, useMobileStyling: v, isPreview: N, headers: B } =
|
|
430
|
+
const d = te(null), y = te(0), i = te(0), f = te(null), u = te(!1), h = te([]), [b, S] = J(() => (r == null ? void 0 : r.required) === !0), [C, k] = J(() => c.map((I) => ({ ...I, rank: null }))), E = me(() => Array.from({ length: c.length }, (I, $) => $ + 1), [c.length]), { isLongFormSurvey: P, focusedQuestionId: D, setFocusedQuestionId: F, useMobileStyling: v, isPreview: N, headers: B } = z((I) => ({ useMobileStyling: I.useMobileStyling, isLongFormSurvey: se(I.studyType), focusedQuestionId: I.focusedQuestionId, setFocusedQuestionId: I.setFocusedQuestionId, isPreview: I.isPreview, headers: I.headers })), T = (B == null ? void 0 : B["userleap-platform"]) === "android", L = v && !N && !T, A = !L && !T, X = P && D === a, _ = (I) => {
|
|
431
431
|
I.preventDefault(), w(C), g && g();
|
|
432
432
|
}, q = (I, $) => {
|
|
433
433
|
k((U) => {
|
|
434
|
-
const M = parseInt($), Z = U.map((
|
|
435
|
-
Z.some((
|
|
436
|
-
const ae = Z.findIndex((
|
|
434
|
+
const M = parseInt($), Z = U.map((G) => ({ ...G }));
|
|
435
|
+
Z.some((G) => G.rank == null) && Z.forEach((G, ve) => G.rank = ve + 1);
|
|
436
|
+
const ae = Z.findIndex((G) => G.id === I);
|
|
437
437
|
if (ae === -1) return U;
|
|
438
|
-
const
|
|
439
|
-
return M <
|
|
440
|
-
|
|
441
|
-
}) : M >
|
|
442
|
-
|
|
443
|
-
}), Z[ae].rank = M, Z.sort((
|
|
438
|
+
const K = Z[ae].rank;
|
|
439
|
+
return M < K ? Z.forEach((G) => {
|
|
440
|
+
G.id !== I && G.rank >= M && G.rank < K && (G.rank = G.rank + 1);
|
|
441
|
+
}) : M > K && Z.forEach((G) => {
|
|
442
|
+
G.id !== I && G.rank > K && G.rank <= M && (G.rank = G.rank - 1);
|
|
443
|
+
}), Z[ae].rank = M, Z.sort((G, ve) => G.rank - ve.rank), Q(Z), Z;
|
|
444
444
|
});
|
|
445
445
|
}, H = (I, $) => {
|
|
446
446
|
for (let U = 0; U < h.current.length; U++) {
|
|
@@ -450,7 +450,7 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
450
450
|
if (I >= Z.left && I <= Z.right && $ >= Z.top && $ <= Z.bottom) return { element: M, index: U };
|
|
451
451
|
}
|
|
452
452
|
return null;
|
|
453
|
-
},
|
|
453
|
+
}, W = (I) => ($) => {
|
|
454
454
|
if (!L) return;
|
|
455
455
|
$.preventDefault(), $.stopPropagation(), u.current = !0, d.current = I;
|
|
456
456
|
const U = $.touches[0];
|
|
@@ -478,8 +478,8 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
478
478
|
}, x = (I, $) => {
|
|
479
479
|
k((U) => {
|
|
480
480
|
const M = U.map((ae) => ({ ...ae })), [Z] = M.splice(I, 1);
|
|
481
|
-
return M.splice($, 0, Z), M.forEach((ae,
|
|
482
|
-
ae.rank =
|
|
481
|
+
return M.splice($, 0, Z), M.forEach((ae, K) => {
|
|
482
|
+
ae.rank = K + 1;
|
|
483
483
|
}), Q(M), M;
|
|
484
484
|
});
|
|
485
485
|
}, w = (I) => {
|
|
@@ -487,7 +487,7 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
487
487
|
I.reduce((U, M) => (U[M.id] = M.rank, U), $), n({ value: $, questionId: a, type: m }, !0);
|
|
488
488
|
}, Q = (I) => {
|
|
489
489
|
S(!1), P && w(I);
|
|
490
|
-
}, { left: R, right: j } = s,
|
|
490
|
+
}, { left: R, right: j } = s, Y = c.length, ce = (I) => {
|
|
491
491
|
I.preventDefault(), I.currentTarget.classList.add("is-drop-target");
|
|
492
492
|
}, he = (I) => {
|
|
493
493
|
I.currentTarget.classList.remove("is-drop-target");
|
|
@@ -496,21 +496,21 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
496
496
|
};
|
|
497
497
|
return e("form", { className: O(t, "ul-card-rank", "fade-in-transition", P && !X && "ul-card--unfocused"), onClick: P ? () => {
|
|
498
498
|
P && D !== a && F(a);
|
|
499
|
-
} : void 0, onSubmit: _, children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(pe, { properties: r, children: e(be, T ? { children: [e(le, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", R] }) }), e("ol", { className: "ul-card-rank__list", children: C.map(({ id: I, label: $, rank: U }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${$}`, className: O("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (M) => q(I, M.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), E.map((M) => e("option", { className: "ul-card-rank__select-option", value: M, children: M }, `${M}-${a}`))] }), e("span", { children: $ })] }, I)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [
|
|
499
|
+
} : void 0, onSubmit: _, children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(pe, { properties: r, children: e(be, T ? { children: [e(le, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", R] }) }), e("ol", { className: "ul-card-rank__list", children: C.map(({ id: I, label: $, rank: U }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${$}`, className: O("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (M) => q(I, M.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), E.map((M) => e("option", { className: "ul-card-rank__select-option", value: M, children: M }, `${M}-${a}`))] }), e("span", { children: $ })] }, I)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Y, " - ", j] }) })] }), p && e(xe, { handleSubmit: _, isSubmitDisabled: b })] }), !P && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: b, children: ge(r) }) }) })] } : { children: [e(le, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", R] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: T ? void 0 : (I) => {
|
|
500
500
|
I.preventDefault(), I.dataTransfer && (I.dataTransfer.dropEffect = "move");
|
|
501
501
|
}, children: C.map(({ id: I, label: $, rank: U }, M) => {
|
|
502
|
-
return e("li", { className: "ul-card-rank__option", draggable: !!A || void 0, onDragEnd: A ? fe : void 0, onDragEnter: A ? ce : void 0, onDragLeave: A ? he : void 0, onDragStart: A ? (ae = M, (
|
|
503
|
-
d.current = ae,
|
|
504
|
-
}) : void 0, onDrop: A ? (Z = M, (
|
|
502
|
+
return e("li", { className: "ul-card-rank__option", draggable: !!A || void 0, onDragEnd: A ? fe : void 0, onDragEnter: A ? ce : void 0, onDragLeave: A ? he : void 0, onDragStart: A ? (ae = M, (K) => {
|
|
503
|
+
d.current = ae, K.dataTransfer && (K.dataTransfer.effectAllowed = "move", K.dataTransfer.setData("text/plain", String(ae)), K.currentTarget.classList.add("is-dragging"));
|
|
504
|
+
}) : void 0, onDrop: A ? (Z = M, (K) => {
|
|
505
505
|
var ve, De;
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
d.current = null, (De = (ve =
|
|
509
|
-
}) : void 0, ref: (
|
|
506
|
+
K.preventDefault(), K.currentTarget.classList.remove("is-drop-target");
|
|
507
|
+
const G = d.current;
|
|
508
|
+
d.current = null, (De = (ve = K.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ve.querySelector(".is-dragging")) == null || De.classList.remove("is-dragging"), G != null && G !== Z && x(G, Z);
|
|
509
|
+
}) : void 0, ref: (K) => h.current[M] = K, children: [e("select", { "aria-label": `Rank for ${$}`, className: O("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (K) => q(I, K.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), E.map((K) => e("option", { className: "ul-card-rank__select-option", value: K, children: K }, `${K}-${a}`))] }), e("span", { children: $ }), !T && e("button", { "aria-label": `Drag ${$} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: L ? l : void 0, onTouchMove: L ? V : void 0, onTouchStart: L ? W(M) : 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" }) }) })] }, I);
|
|
510
510
|
var Z, ae;
|
|
511
|
-
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [
|
|
511
|
+
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Y, " - ", j] }) })] }), p && e(xe, { handleSubmit: _, isSubmitDisabled: b })] }), !P && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: b, children: ge(r) }) }) })] }) })] }, a);
|
|
512
512
|
}, zr = /* @__PURE__ */ new Set(["aidynamicfollowup", "open", "matrix", "multipleselect", "multiplechoice", "rankorder"]), Ae = ({ cardInstance: t, moveToNextQuestion: s, showIndividualSubmit: o, submitQuestion: n, updateCardValues: r, allResponsesArray: a }) => {
|
|
513
|
-
const { isLongFormSurvey: m, createDynamicQuestion: g, cards: c, surveyVisitorAttributes: p } =
|
|
513
|
+
const { isLongFormSurvey: m, createDynamicQuestion: g, cards: c, surveyVisitorAttributes: p } = z((k) => ({ isLongFormSurvey: se(k.studyType), createDynamicQuestion: k.createDynamicQuestion, cards: k.cards, surveyVisitorAttributes: k.surveyVisitorAttributes }));
|
|
514
514
|
if (!t) return null;
|
|
515
515
|
const { name: d, type: y, props: i, childId: f } = t, u = o && zr.has(y), h = i == null ? void 0 : i.displayLogic, b = h == null ? void 0 : Ue({ displayLogic: h, allResponses: a, cards: c, surveyVisitorAttributes: p ?? {} });
|
|
516
516
|
if (h && h.length > 0 && !b) return null;
|
|
@@ -554,11 +554,11 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
554
554
|
return C ? m ? e("div", { className: "ul-card-scroll-wrapper", children: C }, d) : C : null;
|
|
555
555
|
}, Yr = ({ isSubmitDisabled: t = !1, onSubmit: s, buttonText: o }) => {
|
|
556
556
|
var f;
|
|
557
|
-
const { cards: n, forceBrandedLogo: r, index: a, marketingUrl: m, showSurveyBrand: g, slugName: c, surveyId: p, useMobileStyling: d } =
|
|
557
|
+
const { cards: n, forceBrandedLogo: r, index: a, marketingUrl: m, showSurveyBrand: g, slugName: c, surveyId: p, useMobileStyling: d } = z((u) => ({ cards: u.cards, forceBrandedLogo: u.forceBrandedLogo, index: u.index, marketingUrl: u.marketingUrl, showSurveyBrand: u.showSurveyBrand, slugName: u.slugName, surveyId: u.surveyId, useMobileStyling: u.useMobileStyling })), y = ((f = n[a]) == null ? void 0 : f.type) === "thanks", i = ir({ marketingUrl: m, slugName: c, surveyId: p, forceBrandedLogo: r });
|
|
558
558
|
return e("footer", { className: O("long-form-question-footer-container", d && "long-form-question-footer-container--mobile", y && "long-form-question-footer-container-center"), children: [y && r ? e(sr, { marketingUrlLink: i }) : e("div", { className: "long-form-question-footer-container-logo", children: g ? e(ar, { forceBrandedLogo: r, marketingUrlLink: i }) : null }), !y && e("div", { className: O("ul-card__button-wrapper", "ul-card-vertical__button-wrapper", "long-form-question-footer-container-actions"), children: e(ee, { className: O("long-form-button", t && "sprig-button-disabled"), disabled: t, onClick: s, children: e("span", { className: "long-form-button-text-container", children: o ?? e(lr, { stroke: "white" }) }) }) })] });
|
|
559
559
|
}, et = ({ cards: t, next: s, previousResponses: o }) => {
|
|
560
560
|
var V;
|
|
561
|
-
const n = te(null), [r, a] = J({}), [m, g] = J({}), { isLongFormSurvey: c, focusedQuestionId: p, setFocusedQuestionId: d, createDynamicQuestion: y, allResponses: i, cardIndexByName: f, surveyVisitorAttributes: u, cards: h } =
|
|
561
|
+
const n = te(null), [r, a] = J({}), [m, g] = J({}), { isLongFormSurvey: c, focusedQuestionId: p, setFocusedQuestionId: d, createDynamicQuestion: y, allResponses: i, cardIndexByName: f, surveyVisitorAttributes: u, cards: h } = z((l) => ({ isLongFormSurvey: se(l.studyType), focusedQuestionId: l.focusedQuestionId, setFocusedQuestionId: l.setFocusedQuestionId, createDynamicQuestion: l.createDynamicQuestion, allResponses: l.allResponses, cardIndexByName: l.cardIndexByName, surveyVisitorAttributes: l.surveyVisitorAttributes, cards: l.cards })), b = me(() => ({ ...o, ...Fe(t.map((l) => {
|
|
562
562
|
var x, w;
|
|
563
563
|
return { ...l, value: ((x = r[l.name]) == null ? void 0 : x.value) ?? null, secondaryValue: ((w = r[l.name]) == null ? void 0 : w.secondaryValue) ?? null };
|
|
564
564
|
})) }), [o, r, t]);
|
|
@@ -586,14 +586,14 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
586
586
|
const P = te(null), D = te(!1), F = te(null), v = Te((l) => {
|
|
587
587
|
var R, j;
|
|
588
588
|
D.current = !0;
|
|
589
|
-
const x = t.findIndex((
|
|
589
|
+
const x = t.findIndex((Y) => Y.name === l);
|
|
590
590
|
if (!c || l === null || x === -1) return void (D.current = !1);
|
|
591
591
|
const w = (R = P.current) == null ? void 0 : R.querySelectorAll(".ul-card-scroll-wrapper")[x], Q = (j = P.current) == null ? void 0 : j.closest(".ul-card-main-content");
|
|
592
592
|
if (w && Q) {
|
|
593
593
|
if (w && Q) {
|
|
594
|
-
const
|
|
594
|
+
const Y = w.getBoundingClientRect(), ce = Q.getBoundingClientRect(), he = Y.top - ce.top + Q.scrollTop, fe = he + Y.height / 2, I = window.innerHeight - 157;
|
|
595
595
|
let $;
|
|
596
|
-
|
|
596
|
+
Y.height >= I ? $ = he : $ = fe - Q.clientHeight / 2;
|
|
597
597
|
const U = Q.clientHeight, M = Q.scrollHeight - U, Z = Math.max(0, Math.min($, M));
|
|
598
598
|
Q.scrollTo({ top: Z, behavior: "smooth" }), setTimeout(() => {
|
|
599
599
|
D.current = !1;
|
|
@@ -638,8 +638,8 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
638
638
|
const $ = fe.getBoundingClientRect(), U = $.top + $.height / 2, M = Math.abs(Q - U);
|
|
639
639
|
M < j && (j = M, R = I);
|
|
640
640
|
});
|
|
641
|
-
const
|
|
642
|
-
F.current =
|
|
641
|
+
const Y = t[R];
|
|
642
|
+
F.current = Y.name, d(Y.name);
|
|
643
643
|
}, [t, d]);
|
|
644
644
|
ne(() => {
|
|
645
645
|
var x;
|
|
@@ -655,8 +655,8 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
655
655
|
}), [m, t, k]), X = async (l, x, w) => {
|
|
656
656
|
return g((R) => ({ ...R, [l]: w })), await (Q = (R) => ({ ...R, [l]: x }), new Promise((R) => {
|
|
657
657
|
a((j) => {
|
|
658
|
-
const
|
|
659
|
-
return R(
|
|
658
|
+
const Y = Q(j);
|
|
659
|
+
return R(Y), Y;
|
|
660
660
|
});
|
|
661
661
|
}));
|
|
662
662
|
var Q;
|
|
@@ -668,14 +668,14 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
668
668
|
n.current = x;
|
|
669
669
|
const w = {};
|
|
670
670
|
if (t.forEach((R) => {
|
|
671
|
-
var j,
|
|
672
|
-
br(R) && (R.props.properties.required || (w[R.name] = { value: ((j = r[R.name]) == null ? void 0 : j.value) ?? null, secondaryValue: ((
|
|
671
|
+
var j, Y;
|
|
672
|
+
br(R) && (R.props.properties.required || (w[R.name] = { value: ((j = r[R.name]) == null ? void 0 : j.value) ?? null, secondaryValue: ((Y = r[R.name]) == null ? void 0 : Y.secondaryValue) ?? null, questionId: R.name, type: R.type }));
|
|
673
673
|
}), l == null || l !== x) a(w), g({});
|
|
674
674
|
else {
|
|
675
675
|
a((j) => ({ ...j, ...w }));
|
|
676
|
-
const R = t.reduce((j,
|
|
676
|
+
const R = t.reduce((j, Y) => {
|
|
677
677
|
var ce;
|
|
678
|
-
return
|
|
678
|
+
return Y.type === "aidynamicfollowup" && ((ce = Y.props) == null ? void 0 : ce.loading) === null && (j[Y.name] = !0), j;
|
|
679
679
|
}, {});
|
|
680
680
|
g((j) => ({ ...j, ...R }));
|
|
681
681
|
}
|
|
@@ -691,8 +691,8 @@ const ze = "ul-permission-graphics-container", Ye = "ul-permission-body", Ke = O
|
|
|
691
691
|
const w = S.find((R) => R.name === l.questionId), Q = { ...l, questionText: w ? Be(w) : void 0 };
|
|
692
692
|
N({ displayCard: w, response: l }), s([Q]);
|
|
693
693
|
}
|
|
694
|
-
}, q = (l) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(l), H = (l) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(l),
|
|
695
|
-
return c ? e("div", { className: "ul-card-list-container--longform", "data-testid": "ui-container", ref: P, children: [e(Vr, { value: o, children: S.map((l, x) => e(Ae, { allResponsesArray: C, cardInstance: l, moveToNextQuestion: T, showIndividualSubmit: c && t.length > 1 && x < t.length - 1, submitQuestion: _, updateCardValues: X }, (l == null ? void 0 : l.name) || x)) }), !
|
|
694
|
+
}, q = (l) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(l), H = (l) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(l), W = ((V = t[0]) == null ? void 0 : V.type) === "thanks";
|
|
695
|
+
return c ? e("div", { className: "ul-card-list-container--longform", "data-testid": "ui-container", ref: P, children: [e(Vr, { value: o, children: S.map((l, x) => e(Ae, { allResponsesArray: C, cardInstance: l, moveToNextQuestion: T, showIndividualSubmit: c && t.length > 1 && x < t.length - 1, submitQuestion: _, updateCardValues: X }, (l == null ? void 0 : l.name) || x)) }), !W && e(Yr, { isSubmitDisabled: !A, onSubmit: function() {
|
|
696
696
|
const l = B(t, r);
|
|
697
697
|
if ((S == null ? void 0 : S.length) === 1 && (l == null ? void 0 : l.length) === 1) {
|
|
698
698
|
const x = S[0], w = l[0];
|