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