@sprig-technologies/sprig-bundled 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-ui-BDY1U1pN.js +1512 -0
- package/dist/{conversational-ui-B9SOjjQE.cjs → conversational-ui-EBO_5YT4.cjs} +2 -2
- package/dist/{conversational-v2-styles-D3WQxdro.cjs → conversational-v2-styles-BTm-8rVB.cjs} +1 -1
- package/dist/{conversational-v2-styles-XFcJt3-u.js → conversational-v2-styles-Bj3dBWvf.js} +1 -1
- package/dist/getAttributedUrl-8t2IIhOk.js +193 -0
- package/dist/getAttributedUrl-M03Qw_Lk.cjs +12 -0
- package/dist/{index-B2lKZafM.cjs → index-B0e_zgRQ.cjs} +4 -4
- package/dist/index-BLbkNfGp.cjs +1 -0
- package/dist/{index-Bbp8h_Ls.js → index-BUTuSSuP.js} +229 -224
- package/dist/index-D2wwf1iZ.js +717 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +1 -1
- package/dist/view-0ocXtsSZ.cjs +1 -0
- package/dist/view-DcerBHpf.js +1780 -0
- package/package.json +1 -1
- package/dist/conversational-ui-WaAjNR3Q.js +0 -1502
- package/dist/getAttributedUrl-CMu77L08.js +0 -197
- package/dist/getAttributedUrl-CkFVhnm0.cjs +0 -12
- package/dist/index-BnE-K_Xo.cjs +0 -1
- package/dist/index-CY9QSu7D.js +0 -706
- package/dist/view-CHBo6RQ4.js +0 -1728
- package/dist/view-s39eJCD9.cjs +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { a as s, c as C, u as k, F as Z, h as R, p as E, _ as S, d as H, x as Q, b as q, y as _, z as G } from "./view-DcerBHpf.js";
|
|
2
|
+
import { j as J, k as X, l as Y, m as ee, E as j } from "./index-BUTuSSuP.js";
|
|
3
|
+
const te = (e) => s("button", { ...e, className: C("ul-card-text__button", e.className), id: "ul-card-text__button" }), oe = ({ html: e, ...n }) => {
|
|
4
|
+
const { enableCspTrustedTypes: i } = k((o) => ({ enableCspTrustedTypes: o.enableCspTrustedTypes })), t = Z(() => J(e, i), [i, e]);
|
|
5
|
+
return s("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
6
|
+
}, M = () => {
|
|
7
|
+
const { viewDocument: e } = k((t) => ({ viewDocument: t.viewDocument })), [n, i] = R(!1);
|
|
8
|
+
return E(() => {
|
|
9
|
+
const t = e.querySelector(".sprig-question-body"), o = new ResizeObserver(() => {
|
|
10
|
+
window.requestAnimationFrame(() => {
|
|
11
|
+
i(!!(t && X(t) && t.scrollHeight > t.offsetHeight));
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return t && o.observe(t), () => {
|
|
15
|
+
t && o.disconnect();
|
|
16
|
+
};
|
|
17
|
+
}, [e]), n;
|
|
18
|
+
}, A = ({ plainText: e, richText: n, id: i, className: t, isHeader: o, showAsterisk: l }) => n ? s(oe, { className: t, html: n, id: i }) : e ? o ? s("h1", { className: t, id: i, children: [e, l && "*"] }) : s("p", { className: t, id: i, children: e }) : null, pe = ({ message: e, properties: n, isRequired: i }) => {
|
|
19
|
+
const t = S(null), o = n == null ? void 0 : n.captionText, l = M();
|
|
20
|
+
return s("div", { className: C("question-header-container", "sprig-header-container", l ? "sprig-border-bottom" : null), ref: t, children: [s("div", { className: "question-header-button-container", children: s(A, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: n == null ? void 0 : n.questionHtml, showAsterisk: i }) }), s(A, { className: "ul-caption", id: "ul-caption", plainText: o, richText: n == null ? void 0 : n.captionHtml })] });
|
|
21
|
+
}, ne = () => s("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: s("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), he = ({ isSubmitDisabled: e, handleSubmit: n }) => s("div", { className: "ul-card-longform__submit-button-container", children: s(te, { className: "ul-card-longform__submit-button", disabled: e, onClick: n, children: ["OK ", s(ne, {})] }) }), se = (e, n) => {
|
|
22
|
+
const i = S(0);
|
|
23
|
+
return () => {
|
|
24
|
+
if (e.current) {
|
|
25
|
+
const t = e.current;
|
|
26
|
+
t.style.height = "1px";
|
|
27
|
+
const o = t.scrollHeight + (t.offsetHeight - t.clientHeight), l = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), r = o <= l ? o : l;
|
|
28
|
+
i.current !== r && requestAnimationFrame(() => {
|
|
29
|
+
n();
|
|
30
|
+
}), i.current = r, t.style.height = `${r}px`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, be = (e) => {
|
|
34
|
+
const n = S(), { setAllResponsesRaw: i } = k((t) => ({ setAllResponsesRaw: t.setAllResponsesRaw }));
|
|
35
|
+
E(() => {
|
|
36
|
+
const t = n.current;
|
|
37
|
+
(!t || Object.keys(e).length !== Object.keys(t).length || Object.keys(e).some((o) => e[o] !== t[o])) && (i(e), n.current = e);
|
|
38
|
+
}, [e, i]);
|
|
39
|
+
}, F = ({ buttonText: e = "View Prototype", handleClick: n }) => s("button", { className: "prototype-button", onClick: n, children: e }, "prototype-btn"), me = ({ embeddedType: e = "prototype", properties: n, children: i }) => {
|
|
40
|
+
var y;
|
|
41
|
+
const { handleClickEmbedButton: t, hasViewedEmbed: o, headers: l, useDesktopPrototype: r } = k((p) => ({ handleClickEmbedButton: p.handleClickEmbedButton, hasViewedEmbed: p.hasViewedEmbed, headers: p.headers, useDesktopPrototype: p.useDesktopPrototype })), c = (n == null ? void 0 : n.conceptUrl) || ((y = n == null ? void 0 : n.consentDocument) == null ? void 0 : y.url), a = window.innerWidth < ee, h = l["userleap-platform"], u = (p, f) => {
|
|
42
|
+
p.preventDefault(), t(f);
|
|
43
|
+
};
|
|
44
|
+
if ((() => {
|
|
45
|
+
const { update: p, index: f, isConversationalUI: v, viewDocument: T } = k(({ update: m, index: b, isConversationalUI: w, viewDocument: g }) => ({ update: m, index: b, isConversationalUI: w, viewDocument: g })), d = Y(p, 100);
|
|
46
|
+
E(() => {
|
|
47
|
+
if (v) return;
|
|
48
|
+
const m = new ResizeObserver(d), b = T.querySelector(".ul-card__container");
|
|
49
|
+
return b && m.observe(b, { box: "border-box" }), () => {
|
|
50
|
+
m.disconnect();
|
|
51
|
+
};
|
|
52
|
+
}, [d, p, f, v, T]);
|
|
53
|
+
})(), !r && a && !o && c && ["email", "link"].includes(h)) {
|
|
54
|
+
if (e === "prototype") return s(F, { handleClick: (p) => {
|
|
55
|
+
u(p, "question.prototype.click");
|
|
56
|
+
} });
|
|
57
|
+
if (e === "pdf") return s(F, { buttonText: (n == null ? void 0 : n.viewDocumentText) || "View Document", handleClick: (p) => {
|
|
58
|
+
u(p, "question.agreement.click");
|
|
59
|
+
} });
|
|
60
|
+
}
|
|
61
|
+
return s(H, { children: i });
|
|
62
|
+
}, V = ({ isSelected: e, id: n, divId: i, themeColor: t, disabled: o = !1 }) => s("div", { "aria-checked": e, "aria-disabled": o, "aria-labelledby": `label-${n}`, className: "select-checkbox", id: i, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...o ? { opacity: 0.5 } : {} }, tabIndex: o ? -1 : 0, children: e && s(Q, {}) }), ve = ({ ariaLabel: e, border: n, choiceStyle: i = {}, label: t, isSelected: o, value: l, text: r, id: c, isRadio: a, useMobileStyling: h, error: u, allowTextEntry: y, noneOfTheAbove: p, promptText: f, disabled: v = !1, onUserInputChanged: T }) => {
|
|
63
|
+
const { styleNonce: d, viewDocument: m } = k((x) => ({ styleNonce: x.styleNonce, viewDocument: x.viewDocument })), [b, w] = R(!1);
|
|
64
|
+
re(m, n, d);
|
|
65
|
+
const g = ({ isSelected: x, userText: I }) => {
|
|
66
|
+
T && T({ id: c, selected: x, value: l, userText: I, noneOfTheAbove: p });
|
|
67
|
+
}, D = (x) => {
|
|
68
|
+
v || (x.stopPropagation(), g({ isSelected: a || !o, userText: r }), w(!1));
|
|
69
|
+
}, z = () => {
|
|
70
|
+
b || w(!0);
|
|
71
|
+
}, O = () => {
|
|
72
|
+
b && w(!1);
|
|
73
|
+
}, N = { onClick: (x) => D(x), onKeyPress: (x) => ((I) => {
|
|
74
|
+
v || I.key !== "Enter" && I.key !== " " || D(I);
|
|
75
|
+
})(x) };
|
|
76
|
+
"ontouchstart" in m.documentElement ? (N.onTouchStart = O, N.onTouchCancel = O, N.onTouchEnd = O) : (N.onMouseDown = z, N.onMouseLeave = O);
|
|
77
|
+
const L = a ? `radio-${c}` : `checkbox-${c}`, P = o || b ? [$] : [], K = [...u ? [B] : [], ...P, ...v ? ["ul-choice-disabled"] : []], W = t ? { "aria-labelledby": `label-${c}` } : { "aria-label": e };
|
|
78
|
+
return s("div", { className: C(q("choice", h), ...K), id: `choice-div-${c}`, style: { ...i, ...u ? { borderColor: j } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : N, "aria-disabled": v, children: [s("div", { className: C("choice-label-container"), children: [a ? s("div", { ...W, className: C("select-radio", ...P), id: L, role: "radio", tabIndex: 0 }) : s(V, { disabled: v, divId: L, id: c, isSelected: o, themeColor: n }), t && s("label", { className: C(q("select-label", h)), htmlFor: L, id: `label-${c}`, children: t })] }), y && o && s("div", { className: C("choice-text-entry-container", ...P), children: s(ie, { onTextChange: (x) => g({ isSelected: o, userText: x }), promptText: f || "Please specify", textValue: r, useMobileStyling: h }) })] });
|
|
79
|
+
}, ie = ({ promptText: e, textValue: n, onTextChange: i, useMobileStyling: t }) => {
|
|
80
|
+
const o = S(null), { update: l } = k((c) => ({ update: c.update })), r = se(o, () => l());
|
|
81
|
+
return E(() => (r(), o.current && o.current.focus(), () => {
|
|
82
|
+
l();
|
|
83
|
+
}), []), s("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: C(q("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (c) => {
|
|
84
|
+
r(), c.stopPropagation(), i(c.currentTarget.value);
|
|
85
|
+
}, onClick: (c) => {
|
|
86
|
+
c.stopPropagation();
|
|
87
|
+
}, onKeyPress: (c) => {
|
|
88
|
+
c.stopPropagation();
|
|
89
|
+
}, placeholder: e, ref: o, role: "textbox", rows: 1, value: n });
|
|
90
|
+
}, U = "ul-select-style-element", $ = "ul-select-active-dynamic-style", B = "ul-select-error-dynamic-style", re = (e, n, i) => {
|
|
91
|
+
let t = e.getElementById(U), o = !1;
|
|
92
|
+
t || (t = e.createElement("style"), o = !0), t.tagName.toLowerCase() === "style" && (t.id = U, i && (t.nonce = i), t.textContent = ae(n), o && e.head.appendChild(t));
|
|
93
|
+
}, ae = (e) => `
|
|
94
|
+
.${$} {
|
|
95
|
+
border-color: ${e};
|
|
96
|
+
}
|
|
97
|
+
.${$} .select-radio, .${$}.select-radio {
|
|
98
|
+
border: 6px solid ${e};
|
|
99
|
+
box-shadow: none;
|
|
100
|
+
}
|
|
101
|
+
.${B} {
|
|
102
|
+
border-color: ${j};
|
|
103
|
+
}
|
|
104
|
+
`, we = ({ children: e }) => s("div", { className: "sprig-question-body", children: e }), xe = ({ children: e }) => {
|
|
105
|
+
const n = M(), { isConversationalUI: i } = k((t) => ({ isConversationalUI: t.isConversationalUI }));
|
|
106
|
+
return s("div", { className: C("sprig-question-footer-container", n && !i ? "sprig-border-top" : null), children: e });
|
|
107
|
+
}, le = ({ options: e, selectItem: n, selectedOptions: i, showCheckbox: t, disabledOptions: o, dropdownFooter: l, panelRef: r }) => {
|
|
108
|
+
const { themeColor: c } = k((a) => ({ doc: a.viewDocument, themeColor: a.border }));
|
|
109
|
+
return s("div", { className: "select-list", ref: r, children: [e.map((a) => {
|
|
110
|
+
return s("div", { "aria-disabled": o == null ? void 0 : o.includes(a), className: C("select-option", o != null && o.includes(a) ? "ul-choice-disabled" : ""), onClick: (u) => {
|
|
111
|
+
o != null && o.includes(a) || (n(a), u.stopPropagation());
|
|
112
|
+
}, role: "option", style: { ...o != null && o.includes(a) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && s(V, { divId: (h = a.id, `checkbox-div-${h}`), id: a.id, isSelected: i.includes(a), themeColor: c }), a.label] }, a.id);
|
|
113
|
+
var h;
|
|
114
|
+
}), l] });
|
|
115
|
+
}, ye = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: i, options: t, placeholderText: o, value: l, disabledOptions: r = [], dropdownFooter: c }) => {
|
|
116
|
+
const [a, h] = R(!1), u = S(null), { viewDocument: y, update: p, isConversationalUI: f } = k((d) => ({ viewDocument: d.viewDocument, update: d.update, isConversationalUI: d.isConversationalUI })), v = () => {
|
|
117
|
+
h(!a);
|
|
118
|
+
};
|
|
119
|
+
_(() => {
|
|
120
|
+
f || p();
|
|
121
|
+
}, [a, f, p]), _(() => {
|
|
122
|
+
a && u.current && u.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
123
|
+
}, [a]), E(() => {
|
|
124
|
+
var m;
|
|
125
|
+
const d = (b) => {
|
|
126
|
+
const w = b.target;
|
|
127
|
+
(w == null ? void 0 : w.closest(".select-option.ul-choice-disabled")) || h(!1);
|
|
128
|
+
};
|
|
129
|
+
y.addEventListener("click", d);
|
|
130
|
+
try {
|
|
131
|
+
(m = window.parent) == null || m.addEventListener("click", d);
|
|
132
|
+
} catch {
|
|
133
|
+
window.addEventListener("click", d);
|
|
134
|
+
}
|
|
135
|
+
return () => {
|
|
136
|
+
var b;
|
|
137
|
+
y.removeEventListener("click", d);
|
|
138
|
+
try {
|
|
139
|
+
(b = window.parent) == null || b.removeEventListener("click", d);
|
|
140
|
+
} catch {
|
|
141
|
+
window.removeEventListener("click", d);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}, [y]);
|
|
145
|
+
const T = l.length === 0 ? ["select-button-placeholder"] : [];
|
|
146
|
+
return s(H, { children: [s("button", { "aria-label": "choice dropdown button", className: C("select-button", ...T), onClick: (d) => {
|
|
147
|
+
d.stopPropagation(), v();
|
|
148
|
+
}, type: "button", children: [s("span", { children: l.length === 0 ? o : l.length === 1 ? l[0].label : `${l.length} ${n}` }), s(G, {})] }), a && s(le, { disabledOptions: r, dropdownFooter: c, options: t, panelRef: u, selectedOptions: l, selectItem: (d) => {
|
|
149
|
+
var w;
|
|
150
|
+
const m = l.some((g) => g.id === d.id), b = l.some((g) => {
|
|
151
|
+
var D;
|
|
152
|
+
return (D = g.optionProperties) == null ? void 0 : D.noneOfTheAbove;
|
|
153
|
+
});
|
|
154
|
+
(w = d.optionProperties) != null && w.noneOfTheAbove && !m ? i([d]) : e ? i(m ? l.filter((g) => g.id !== d.id) : b ? [d] : [...l, d]) : m || i([d]), e || v();
|
|
155
|
+
}, showCheckbox: e })] });
|
|
156
|
+
}, ce = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, ge = (e = void 0, n = {}) => {
|
|
157
|
+
if (!e) return e;
|
|
158
|
+
const i = ["http:", "https:", "itms-apps:", "market:"], t = ((r) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(r) ? r : `http://${r}`)(e);
|
|
159
|
+
if (!t) return;
|
|
160
|
+
try {
|
|
161
|
+
const r = new URL(t);
|
|
162
|
+
if (!r.protocol || !i.includes(r.protocol)) return;
|
|
163
|
+
} catch {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const o = [], l = ((r, c, a) => {
|
|
167
|
+
let h = r;
|
|
168
|
+
for (const [u, y] of Object.entries(ce)) if (h.toLowerCase().includes(u)) if (c[y]) {
|
|
169
|
+
const p = new RegExp(u, "gi");
|
|
170
|
+
h = h.replace(p, c[y]);
|
|
171
|
+
} else a.push(u);
|
|
172
|
+
return h;
|
|
173
|
+
})(t, n, o);
|
|
174
|
+
return o.length === 0 ? l : ((r, c) => {
|
|
175
|
+
if (!r.includes("?")) return r;
|
|
176
|
+
const a = r.slice(0, r.indexOf("?")), h = r.slice(r.indexOf("?") + 1).split("&").map((u) => u.split("=")).filter((u) => !c.includes(u[1]));
|
|
177
|
+
return h.length === 0 ? a : `${a}?${h.map((u) => u.join("=")).join("&")}`;
|
|
178
|
+
})(l, o);
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
te as B,
|
|
182
|
+
pe as H,
|
|
183
|
+
he as L,
|
|
184
|
+
me as M,
|
|
185
|
+
ve as O,
|
|
186
|
+
we as Q,
|
|
187
|
+
ye as S,
|
|
188
|
+
oe as a,
|
|
189
|
+
xe as b,
|
|
190
|
+
be as c,
|
|
191
|
+
ge as g,
|
|
192
|
+
se as u
|
|
193
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const e=require("./view-0ocXtsSZ.cjs"),T=require("./index-B0e_zgRQ.cjs"),_=t=>e.u("button",{...t,className:e.cc("ul-card-text__button",t.className),id:"ul-card-text__button"}),A=({html:t,...i})=>{const{enableCspTrustedTypes:l}=e.useConfig(n=>({enableCspTrustedTypes:n.enableCspTrustedTypes})),o=e.F(()=>T.getHtml(t,l),[l,t]);return e.u("div",{...i,dangerouslySetInnerHTML:{__html:o}})},I=()=>{const{viewDocument:t}=e.useConfig(o=>({viewDocument:o.viewDocument})),[i,l]=e.h(!1);return e.p(()=>{const o=t.querySelector(".sprig-question-body"),n=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{l(!!(o&&T.isHTMLElement(o)&&o.scrollHeight>o.offsetHeight))})});return o&&n.observe(o),()=>{o&&n.disconnect()}},[t]),i},L=({plainText:t,richText:i,id:l,className:o,isHeader:n,showAsterisk:c})=>i?e.u(A,{className:o,html:i,id:l}):t?n?e.u("h1",{className:o,id:l,children:[t,c&&"*"]}):e.u("p",{className:o,id:l,children:t}):null,V=()=>e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),P=(t,i)=>{const l=e._(0);return()=>{if(t.current){const o=t.current;o.style.height="1px";const n=o.scrollHeight+(o.offsetHeight-o.clientHeight),c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),s=n<=c?n:c;l.current!==s&&requestAnimationFrame(()=>{i()}),l.current=s,o.style.height=`${s}px`}}},$=({buttonText:t="View Prototype",handleClick:i})=>e.u("button",{className:"prototype-button",onClick:i,children:t},"prototype-btn"),H=({isSelected:t,id:i,divId:l,themeColor:o,disabled:n=!1})=>e.u("div",{"aria-checked":t,"aria-disabled":n,"aria-labelledby":`label-${i}`,className:"select-checkbox",id:l,role:"checkbox",style:{...t?{backgroundColor:o,borderColor:o,boxShadow:"none"}:{},...n?{opacity:.5}:{}},tabIndex:n?-1:0,children:t&&e.u(e.SvgCheckmark,{})}),j=({promptText:t,textValue:i,onTextChange:l,useMobileStyling:o})=>{const n=e._(null),{update:c}=e.useConfig(a=>({update:a.update})),s=P(n,()=>c());return e.p(()=>(s(),n.current&&n.current.focus(),()=>{c()}),[]),e.u("textarea",{"aria-label":t,"aria-multiline":"true","aria-placeholder":t,className:e.cc(e.getClasses("choice-text-input",o)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{s(),a.stopPropagation(),l(a.currentTarget.value)},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:t,ref:n,role:"textbox",rows:1,value:i})},q="ul-select-style-element",R="ul-select-active-dynamic-style",F="ul-select-error-dynamic-style",z=(t,i,l)=>{let o=t.getElementById(q),n=!1;o||(o=t.createElement("style"),n=!0),o.tagName.toLowerCase()==="style"&&(o.id=q,l&&(o.nonce=l),o.textContent=W(i),n&&t.head.appendChild(o))},W=t=>`
|
|
2
|
+
.${R} {
|
|
3
|
+
border-color: ${t};
|
|
4
|
+
}
|
|
5
|
+
.${R} .select-radio, .${R}.select-radio {
|
|
6
|
+
border: 6px solid ${t};
|
|
7
|
+
box-shadow: none;
|
|
8
|
+
}
|
|
9
|
+
.${F} {
|
|
10
|
+
border-color: ${T.ERROR_BORDER_COLOR};
|
|
11
|
+
}
|
|
12
|
+
`,K=({options:t,selectItem:i,selectedOptions:l,showCheckbox:o,disabledOptions:n,dropdownFooter:c,panelRef:s})=>{const{themeColor:a}=e.useConfig(r=>({doc:r.viewDocument,themeColor:r.border}));return e.u("div",{className:"select-list",ref:s,children:[t.map(r=>{return e.u("div",{"aria-disabled":n==null?void 0:n.includes(r),className:e.cc("select-option",n!=null&&n.includes(r)?"ul-choice-disabled":""),onClick:u=>{n!=null&&n.includes(r)||(i(r),u.stopPropagation())},role:"option",style:{...n!=null&&n.includes(r)?{opacity:.5,cursor:"not-allowed"}:{}},children:[o&&e.u(H,{divId:(h=r.id,`checkbox-div-${h}`),id:r.id,isSelected:l.includes(r),themeColor:a}),r.label]},r.id);var h}),c]})},Q={"{{user_id}}":"externalUserId","{{email}}":"email"};exports.Button=_,exports.Header=({message:t,properties:i,isRequired:l})=>{const o=e._(null),n=i==null?void 0:i.captionText,c=I();return e.u("div",{className:e.cc("question-header-container","sprig-header-container",c?"sprig-border-bottom":null),ref:o,children:[e.u("div",{className:"question-header-button-container",children:e.u(L,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:t,richText:i==null?void 0:i.questionHtml,showAsterisk:l})}),e.u(L,{className:"ul-caption",id:"ul-caption",plainText:n,richText:i==null?void 0:i.captionHtml})]})},exports.Html=A,exports.LongformSubmitButton=({isSubmitDisabled:t,handleSubmit:i})=>e.u("div",{className:"ul-card-longform__submit-button-container",children:e.u(_,{className:"ul-card-longform__submit-button",disabled:t,onClick:i,children:["OK ",e.u(V,{})]})}),exports.MobileEmbedView=({embeddedType:t="prototype",properties:i,children:l})=>{var y;const{handleClickEmbedButton:o,hasViewedEmbed:n,headers:c,useDesktopPrototype:s}=e.useConfig(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),a=(i==null?void 0:i.conceptUrl)||((y=i==null?void 0:i.consentDocument)==null?void 0:y.url),r=window.innerWidth<T.EMBED_MOBILE_MAX_WIDTH,h=c["userleap-platform"],u=(p,C)=>{p.preventDefault(),o(C)};if((()=>{const{update:p,index:C,isConversationalUI:g,viewDocument:f}=e.useConfig(({update:b,index:m,isConversationalUI:v,viewDocument:x})=>({update:b,index:m,isConversationalUI:v,viewDocument:x})),d=T.debounce(p,100);e.p(()=>{if(g)return;const b=new ResizeObserver(d),m=f.querySelector(".ul-card__container");return m&&b.observe(m,{box:"border-box"}),()=>{b.disconnect()}},[d,p,C,g,f])})(),!s&&r&&!n&&a&&["email","link"].includes(h)){if(t==="prototype")return e.u($,{handleClick:p=>{u(p,"question.prototype.click")}});if(t==="pdf")return e.u($,{buttonText:(i==null?void 0:i.viewDocumentText)||"View Document",handleClick:p=>{u(p,"question.agreement.click")}})}return e.u(e.g,{children:l})},exports.Option=({ariaLabel:t,border:i,choiceStyle:l={},label:o,isSelected:n,value:c,text:s,id:a,isRadio:r,useMobileStyling:h,error:u,allowTextEntry:y,noneOfTheAbove:p,promptText:C,disabled:g=!1,onUserInputChanged:f})=>{const{styleNonce:d,viewDocument:b}=e.useConfig(w=>({styleNonce:w.styleNonce,viewDocument:w.viewDocument})),[m,v]=e.h(!1);z(b,i,d);const x=({isSelected:w,userText:E})=>{f&&f({id:a,selected:w,value:c,userText:E,noneOfTheAbove:p})},N=w=>{g||(w.stopPropagation(),x({isSelected:r||!n,userText:s}),v(!1))},U=()=>{m||v(!0)},O=()=>{m&&v(!1)},k={onClick:w=>N(w),onKeyPress:w=>(E=>{g||E.key!=="Enter"&&E.key!==" "||N(E)})(w)};"ontouchstart"in b.documentElement?(k.onTouchStart=O,k.onTouchCancel=O,k.onTouchEnd=O):(k.onMouseDown=U,k.onMouseLeave=O);const D=r?`radio-${a}`:`checkbox-${a}`,S=n||m?[R]:[],B=[...u?[F]:[],...S,...g?["ul-choice-disabled"]:[]],M=o?{"aria-labelledby":`label-${a}`}:{"aria-label":t};return e.u("div",{className:e.cc(e.getClasses("choice",h),...B),id:`choice-div-${a}`,style:{...l,...u?{borderColor:T.ERROR_BORDER_COLOR}:{},...g?{opacity:.5,cursor:"not-allowed"}:{}},...g?{}:k,"aria-disabled":g,children:[e.u("div",{className:e.cc("choice-label-container"),children:[r?e.u("div",{...M,className:e.cc("select-radio",...S),id:D,role:"radio",tabIndex:0}):e.u(H,{disabled:g,divId:D,id:a,isSelected:n,themeColor:i}),o&&e.u("label",{className:e.cc(e.getClasses("select-label",h)),htmlFor:D,id:`label-${a}`,children:o})]}),y&&n&&e.u("div",{className:e.cc("choice-text-entry-container",...S),children:e.u(j,{onTextChange:w=>x({isSelected:n,userText:w}),promptText:C||"Please specify",textValue:s,useMobileStyling:h})})]})},exports.QuestionBodyFooterContainer=({children:t})=>{const i=I(),{isConversationalUI:l}=e.useConfig(o=>({isConversationalUI:o.isConversationalUI}));return e.u("div",{className:e.cc("sprig-question-footer-container",i&&!l?"sprig-border-top":null),children:t})},exports.QuestionBodyWrapper=({children:t})=>e.u("div",{className:"sprig-question-body",children:t}),exports.Select=({isMultiSelect:t=!1,multiselectText:i="choices selected",onChange:l,options:o,placeholderText:n,value:c,disabledOptions:s=[],dropdownFooter:a})=>{const[r,h]=e.h(!1),u=e._(null),{viewDocument:y,update:p,isConversationalUI:C}=e.useConfig(d=>({viewDocument:d.viewDocument,update:d.update,isConversationalUI:d.isConversationalUI})),g=()=>{h(!r)};e.y(()=>{C||p()},[r,C,p]),e.y(()=>{r&&u.current&&u.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[r]),e.p(()=>{var b;const d=m=>{const v=m.target;(v==null?void 0:v.closest(".select-option.ul-choice-disabled"))||h(!1)};y.addEventListener("click",d);try{(b=window.parent)==null||b.addEventListener("click",d)}catch{window.addEventListener("click",d)}return()=>{var m;y.removeEventListener("click",d);try{(m=window.parent)==null||m.removeEventListener("click",d)}catch{window.removeEventListener("click",d)}}},[y]);const f=c.length===0?["select-button-placeholder"]:[];return e.u(e.g,{children:[e.u("button",{"aria-label":"choice dropdown button",className:e.cc("select-button",...f),onClick:d=>{d.stopPropagation(),g()},type:"button",children:[e.u("span",{children:c.length===0?n:c.length===1?c[0].label:`${c.length} ${i}`}),e.u(e.SvgCaret,{})]}),r&&e.u(K,{disabledOptions:s,dropdownFooter:a,options:o,panelRef:u,selectedOptions:c,selectItem:d=>{var v;const b=c.some(x=>x.id===d.id),m=c.some(x=>{var N;return(N=x.optionProperties)==null?void 0:N.noneOfTheAbove});(v=d.optionProperties)!=null&&v.noneOfTheAbove&&!b?l([d]):t?l(b?c.filter(x=>x.id!==d.id):m?[d]:[...c,d]):b||l([d]),t||g()},showCheckbox:t})]})},exports.getAttributedUrl=(t=void 0,i={})=>{if(!t)return t;const l=["http:","https:","itms-apps:","market:"],o=(s=>/^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(s)?s:`http://${s}`)(t);if(!o)return;try{const s=new URL(o);if(!s.protocol||!l.includes(s.protocol))return}catch{return}const n=[],c=((s,a,r)=>{let h=s;for(const[u,y]of Object.entries(Q))if(h.toLowerCase().includes(u))if(a[y]){const p=new RegExp(u,"gi");h=h.replace(p,a[y])}else r.push(u);return h})(o,i,n);return n.length===0?c:((s,a)=>{if(!s.includes("?"))return s;const r=s.slice(0,s.indexOf("?")),h=s.slice(s.indexOf("?")+1).split("&").map(u=>u.split("=")).filter(u=>!a.includes(u[1]));return h.length===0?r:`${r}?${h.map(u=>u.join("=")).join("&")}`})(c,n)},exports.useAutoSize=P,exports.useSetAllResponsesRaw=t=>{const i=e._(),{setAllResponsesRaw:l}=e.useConfig(o=>({setAllResponsesRaw:o.setAllResponsesRaw}));e.p(()=>{const o=i.current;(!o||Object.keys(t).length!==Object.keys(o).length||Object.keys(t).some(n=>t[n]!==o[n]))&&(l(t),i.current=t)},[t,l])};
|