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