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