@jmeirinkmarimed/form-popup 1.0.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/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/FormPopup/FormPopup.d.ts +5 -0
- package/dist/FormPopup/FormPopup.injected.css.d.ts +5 -0
- package/dist/FormPopup/FormPopup.styles.d.ts +13 -0
- package/dist/FormPopup/api/submitHubSpotForm.d.ts +20 -0
- package/dist/FormPopup/getWebComponentHost.d.ts +3 -0
- package/dist/FormPopup/hooks/useDeferredReady.d.ts +8 -0
- package/dist/FormPopup/hooks/useFormPopupVisibility.d.ts +5 -0
- package/dist/FormPopup/parseCommunicationConsents.d.ts +3 -0
- package/dist/FormPopup/parseStates.d.ts +1 -0
- package/dist/FormPopup/resolveRecaptchaText.d.ts +6 -0
- package/dist/FormPopup/screens/ConfirmationScreen.d.ts +10 -0
- package/dist/FormPopup/screens/FormScreen.d.ts +27 -0
- package/dist/FormPopup/types.d.ts +82 -0
- package/dist/form-popup.cjs.js +45 -0
- package/dist/form-popup.cjs.js.map +1 -0
- package/dist/form-popup.es.js +1052 -0
- package/dist/form-popup.es.js.map +1 -0
- package/dist/form-popup.min.js +84 -0
- package/dist/form-popup.min.js.map +1 -0
- package/dist/form-popup.umd.js +45 -0
- package/dist/form-popup.umd.js.map +1 -0
- package/dist/iife.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/utils/cloudinaryPlaceholder.d.ts +5 -0
- package/dist/web-component/registerFormPopupElement.d.ts +4 -0
- package/package.json +78 -0
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
import Tt, { useState as E, useEffect as V, useCallback as wt } from "react";
|
|
2
|
+
import ot from "react-dom";
|
|
3
|
+
import { jsxs as S, Fragment as kt, jsx as c } from "react/jsx-runtime";
|
|
4
|
+
var Zt = Object.defineProperty, Qt = (t, e, o) => e in t ? Zt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, U = (t, e, o) => Qt(t, typeof e != "symbol" ? e + "" : e, o);
|
|
5
|
+
const te = {
|
|
6
|
+
stringify: (t) => t ? "true" : "false",
|
|
7
|
+
parse: (t) => /^[ty1-9]/i.test(t)
|
|
8
|
+
}, ee = {
|
|
9
|
+
stringify: (t) => t.name,
|
|
10
|
+
parse: (t, e, o) => {
|
|
11
|
+
const r = (() => {
|
|
12
|
+
if (typeof window < "u" && t in window)
|
|
13
|
+
return window[t];
|
|
14
|
+
if (typeof global < "u" && t in global)
|
|
15
|
+
return global[t];
|
|
16
|
+
})();
|
|
17
|
+
return typeof r == "function" ? r.bind(o) : void 0;
|
|
18
|
+
}
|
|
19
|
+
}, oe = {
|
|
20
|
+
stringify: (t) => JSON.stringify(t),
|
|
21
|
+
parse: (t) => JSON.parse(t)
|
|
22
|
+
}, re = {
|
|
23
|
+
stringify: (t) => `${t}`,
|
|
24
|
+
parse: (t) => parseFloat(t)
|
|
25
|
+
}, ne = {
|
|
26
|
+
stringify: (t) => t,
|
|
27
|
+
parse: (t) => t
|
|
28
|
+
}, tt = {
|
|
29
|
+
string: ne,
|
|
30
|
+
number: re,
|
|
31
|
+
boolean: te,
|
|
32
|
+
function: ee,
|
|
33
|
+
json: oe
|
|
34
|
+
};
|
|
35
|
+
function ie(t) {
|
|
36
|
+
return t.replace(
|
|
37
|
+
/([a-z0-9])([A-Z])/g,
|
|
38
|
+
(e, o, r) => `${o}-${r.toLowerCase()}`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const P = Symbol.for("r2wc.render"), $ = Symbol.for("r2wc.connected"), H = Symbol.for("r2wc.context"), k = Symbol.for("r2wc.props");
|
|
42
|
+
function se(t, e, o) {
|
|
43
|
+
var r, n, u;
|
|
44
|
+
e.props || (e.props = t.propTypes ? Object.keys(t.propTypes) : []), e.events || (e.events = []);
|
|
45
|
+
const s = Array.isArray(e.props) ? e.props.slice() : Object.keys(e.props), y = Array.isArray(e.events) ? e.events.slice() : Object.keys(e.events), p = {}, w = {}, v = {}, A = {};
|
|
46
|
+
for (const i of s) {
|
|
47
|
+
p[i] = Array.isArray(e.props) ? "string" : e.props[i];
|
|
48
|
+
const a = ie(i);
|
|
49
|
+
v[i] = a, A[a] = i;
|
|
50
|
+
}
|
|
51
|
+
for (const i of y)
|
|
52
|
+
w[i] = Array.isArray(e.events) ? {} : e.events[i];
|
|
53
|
+
class F extends HTMLElement {
|
|
54
|
+
constructor() {
|
|
55
|
+
super(), U(this, u, !0), U(this, n), U(this, r, {}), U(this, "container"), e.shadow ? this.container = this.attachShadow({
|
|
56
|
+
mode: e.shadow
|
|
57
|
+
}) : this.container = this, this[k].container = this.container;
|
|
58
|
+
for (const a of s) {
|
|
59
|
+
const h = v[a], f = this.getAttribute(h), d = p[a], g = d ? tt[d] : null;
|
|
60
|
+
g != null && g.parse && f && (this[k][a] = g.parse(f, h, this));
|
|
61
|
+
}
|
|
62
|
+
for (const a of y)
|
|
63
|
+
this[k][a] = (h) => {
|
|
64
|
+
const f = a.replace(/^on/, "").toLowerCase();
|
|
65
|
+
this.dispatchEvent(
|
|
66
|
+
new CustomEvent(f, { detail: h, ...w[a] })
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static get observedAttributes() {
|
|
71
|
+
return Object.keys(A);
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
this[$] = !0, this[P]();
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
this[$] = !1, this[H] && o.unmount(this[H]), delete this[H];
|
|
78
|
+
}
|
|
79
|
+
attributeChangedCallback(a, h, f) {
|
|
80
|
+
const d = A[a], g = p[d], C = g ? tt[g] : null;
|
|
81
|
+
d in p && C != null && C.parse && f && (this[k][d] = C.parse(f, a, this), this[P]());
|
|
82
|
+
}
|
|
83
|
+
[(u = $, n = H, r = k, P)]() {
|
|
84
|
+
this[$] && (this[H] ? o.update(this[H], this[k]) : this[H] = o.mount(
|
|
85
|
+
this.container,
|
|
86
|
+
t,
|
|
87
|
+
this[k]
|
|
88
|
+
));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const i of s) {
|
|
92
|
+
const a = v[i], h = p[i];
|
|
93
|
+
Object.defineProperty(F.prototype, i, {
|
|
94
|
+
enumerable: !0,
|
|
95
|
+
configurable: !0,
|
|
96
|
+
get() {
|
|
97
|
+
return this[k][i];
|
|
98
|
+
},
|
|
99
|
+
set(f) {
|
|
100
|
+
this[k][i] = f;
|
|
101
|
+
const d = h ? tt[h] : null;
|
|
102
|
+
if (d != null && d.stringify) {
|
|
103
|
+
const g = d.stringify(f, a, this);
|
|
104
|
+
this.getAttribute(a) !== g && this.setAttribute(a, g);
|
|
105
|
+
} else
|
|
106
|
+
this[P]();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return F;
|
|
111
|
+
}
|
|
112
|
+
function ae(t, e, o) {
|
|
113
|
+
const r = Tt.createElement(e, o);
|
|
114
|
+
return ot.render(r, t), {
|
|
115
|
+
container: t,
|
|
116
|
+
ReactComponent: e
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function le({ container: t, ReactComponent: e }, o) {
|
|
120
|
+
const r = Tt.createElement(e, o);
|
|
121
|
+
ot.render(r, t);
|
|
122
|
+
}
|
|
123
|
+
function ce({ container: t }) {
|
|
124
|
+
ot.unmountComponentAtNode(t);
|
|
125
|
+
}
|
|
126
|
+
function ue(t, e = {}) {
|
|
127
|
+
return se(t, e, { mount: ae, update: le, unmount: ce });
|
|
128
|
+
}
|
|
129
|
+
const m = {
|
|
130
|
+
boxSizing: "border-box",
|
|
131
|
+
margin: "0",
|
|
132
|
+
padding: "0",
|
|
133
|
+
letterSpacing: "normal"
|
|
134
|
+
}, me = "#d4ecec", de = "#111111", xt = "#000000", vt = "#ffffff", pe = 'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif', fe = 'Georgia, "Times New Roman", Times, serif', he = (t) => {
|
|
135
|
+
const e = t.fontFamily || pe, o = t.headingFontFamily || fe, r = t.textColor || de;
|
|
136
|
+
return {
|
|
137
|
+
overlay: {
|
|
138
|
+
...m,
|
|
139
|
+
fontFamily: e,
|
|
140
|
+
position: "fixed",
|
|
141
|
+
top: 0,
|
|
142
|
+
left: 0,
|
|
143
|
+
width: "100%",
|
|
144
|
+
height: "100%",
|
|
145
|
+
minHeight: "100vh",
|
|
146
|
+
maxWidth: "100vw",
|
|
147
|
+
zIndex: 2147483647,
|
|
148
|
+
display: "flex",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
justifyContent: "center",
|
|
151
|
+
backgroundColor: t.overlayColor || "rgba(0, 0, 0, 0.55)",
|
|
152
|
+
overflow: "auto",
|
|
153
|
+
WebkitTextSizeAdjust: "100%",
|
|
154
|
+
WebkitFontSmoothing: "antialiased",
|
|
155
|
+
MozOsxFontSmoothing: "grayscale",
|
|
156
|
+
padding: "1.5rem"
|
|
157
|
+
},
|
|
158
|
+
card: {
|
|
159
|
+
...m,
|
|
160
|
+
fontFamily: e,
|
|
161
|
+
position: "relative",
|
|
162
|
+
width: "100%",
|
|
163
|
+
maxWidth: "440px",
|
|
164
|
+
minHeight: "480px",
|
|
165
|
+
justifyContent: "center",
|
|
166
|
+
backgroundColor: t.backgroundColor || me,
|
|
167
|
+
color: r,
|
|
168
|
+
padding: "3rem 2.25rem 1.5rem",
|
|
169
|
+
display: "flex",
|
|
170
|
+
flexDirection: "column",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
textAlign: "center",
|
|
173
|
+
boxShadow: "0 12px 40px rgba(0, 0, 0, 0.18)"
|
|
174
|
+
},
|
|
175
|
+
closeButton: {
|
|
176
|
+
...m,
|
|
177
|
+
position: "absolute",
|
|
178
|
+
top: "14px",
|
|
179
|
+
right: "14px",
|
|
180
|
+
width: "28px",
|
|
181
|
+
height: "28px",
|
|
182
|
+
borderRadius: "50%",
|
|
183
|
+
border: "none",
|
|
184
|
+
backgroundColor: "#cfcfcf",
|
|
185
|
+
color: "#4a4a4a",
|
|
186
|
+
cursor: "pointer",
|
|
187
|
+
display: "flex",
|
|
188
|
+
alignItems: "center",
|
|
189
|
+
justifyContent: "center",
|
|
190
|
+
padding: "0",
|
|
191
|
+
lineHeight: 1
|
|
192
|
+
},
|
|
193
|
+
formTitle: {
|
|
194
|
+
...m,
|
|
195
|
+
fontFamily: o,
|
|
196
|
+
fontSize: "30px",
|
|
197
|
+
fontWeight: 700,
|
|
198
|
+
lineHeight: 1.25,
|
|
199
|
+
color: r,
|
|
200
|
+
maxWidth: "22ch"
|
|
201
|
+
},
|
|
202
|
+
formSubtitle: {
|
|
203
|
+
...m,
|
|
204
|
+
fontFamily: e,
|
|
205
|
+
fontSize: "15px",
|
|
206
|
+
fontWeight: 400,
|
|
207
|
+
lineHeight: 1.4,
|
|
208
|
+
color: r,
|
|
209
|
+
marginTop: "0.85rem",
|
|
210
|
+
marginBottom: "1.35rem"
|
|
211
|
+
},
|
|
212
|
+
form: {
|
|
213
|
+
...m,
|
|
214
|
+
width: "100%",
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "column",
|
|
217
|
+
alignItems: "stretch",
|
|
218
|
+
textAlign: "left"
|
|
219
|
+
},
|
|
220
|
+
emailInput: {
|
|
221
|
+
...m,
|
|
222
|
+
fontFamily: o,
|
|
223
|
+
width: "100%",
|
|
224
|
+
height: "48px",
|
|
225
|
+
padding: "0 14px",
|
|
226
|
+
fontSize: "16px",
|
|
227
|
+
backgroundColor: "#ffffff",
|
|
228
|
+
color: "#111111",
|
|
229
|
+
border: "1px solid #e6e6e6",
|
|
230
|
+
borderRadius: "0",
|
|
231
|
+
outline: "none",
|
|
232
|
+
appearance: "none",
|
|
233
|
+
WebkitAppearance: "none"
|
|
234
|
+
},
|
|
235
|
+
stateLabel: {
|
|
236
|
+
...m,
|
|
237
|
+
fontFamily: e,
|
|
238
|
+
fontSize: "15px",
|
|
239
|
+
fontWeight: 700,
|
|
240
|
+
color: r,
|
|
241
|
+
marginTop: "1.15rem",
|
|
242
|
+
marginBottom: "0.75rem"
|
|
243
|
+
},
|
|
244
|
+
stateGrid: {
|
|
245
|
+
...m,
|
|
246
|
+
display: "grid",
|
|
247
|
+
gridTemplateColumns: "1fr 1fr",
|
|
248
|
+
columnGap: "1.25rem",
|
|
249
|
+
rowGap: "0.7rem",
|
|
250
|
+
width: "100%"
|
|
251
|
+
},
|
|
252
|
+
radioRow: {
|
|
253
|
+
...m,
|
|
254
|
+
display: "flex",
|
|
255
|
+
alignItems: "center",
|
|
256
|
+
gap: "0.5rem",
|
|
257
|
+
cursor: "pointer",
|
|
258
|
+
fontFamily: o,
|
|
259
|
+
fontSize: "16px",
|
|
260
|
+
color: r,
|
|
261
|
+
userSelect: "none"
|
|
262
|
+
},
|
|
263
|
+
radio: {
|
|
264
|
+
...m,
|
|
265
|
+
width: "16px",
|
|
266
|
+
height: "16px",
|
|
267
|
+
flexShrink: 0,
|
|
268
|
+
accentColor: r,
|
|
269
|
+
cursor: "pointer"
|
|
270
|
+
},
|
|
271
|
+
consentList: {
|
|
272
|
+
...m,
|
|
273
|
+
display: "flex",
|
|
274
|
+
flexDirection: "column",
|
|
275
|
+
gap: "0.65rem",
|
|
276
|
+
width: "100%",
|
|
277
|
+
marginTop: "1.15rem"
|
|
278
|
+
},
|
|
279
|
+
consentRow: {
|
|
280
|
+
...m,
|
|
281
|
+
display: "flex",
|
|
282
|
+
alignItems: "flex-start",
|
|
283
|
+
gap: "0.5rem",
|
|
284
|
+
cursor: "pointer",
|
|
285
|
+
fontFamily: e,
|
|
286
|
+
fontSize: "12px",
|
|
287
|
+
lineHeight: 1.4,
|
|
288
|
+
color: r,
|
|
289
|
+
userSelect: "none"
|
|
290
|
+
},
|
|
291
|
+
consentCheckbox: {
|
|
292
|
+
...m,
|
|
293
|
+
width: "16px",
|
|
294
|
+
height: "16px",
|
|
295
|
+
marginTop: "1px",
|
|
296
|
+
flexShrink: 0,
|
|
297
|
+
accentColor: r,
|
|
298
|
+
cursor: "pointer"
|
|
299
|
+
},
|
|
300
|
+
consentRequired: {
|
|
301
|
+
...m,
|
|
302
|
+
color: "#9b1c1c",
|
|
303
|
+
fontSize: "16px",
|
|
304
|
+
fontWeight: 700,
|
|
305
|
+
lineHeight: 1,
|
|
306
|
+
marginLeft: "0.15em"
|
|
307
|
+
},
|
|
308
|
+
submitButton: {
|
|
309
|
+
...m,
|
|
310
|
+
fontFamily: o,
|
|
311
|
+
alignSelf: "center",
|
|
312
|
+
marginTop: "1.75rem",
|
|
313
|
+
minWidth: "168px",
|
|
314
|
+
height: "46px",
|
|
315
|
+
padding: "0 2rem",
|
|
316
|
+
border: "none",
|
|
317
|
+
borderRadius: "0",
|
|
318
|
+
backgroundColor: t.buttonColor || xt,
|
|
319
|
+
color: t.buttonTextColor || vt,
|
|
320
|
+
fontSize: "20px",
|
|
321
|
+
fontWeight: 700,
|
|
322
|
+
cursor: "pointer",
|
|
323
|
+
lineHeight: 1
|
|
324
|
+
},
|
|
325
|
+
error: {
|
|
326
|
+
...m,
|
|
327
|
+
fontFamily: e,
|
|
328
|
+
fontSize: "13px",
|
|
329
|
+
color: "#9b1c1c",
|
|
330
|
+
textAlign: "center",
|
|
331
|
+
marginTop: "0.75rem"
|
|
332
|
+
},
|
|
333
|
+
recaptcha: {
|
|
334
|
+
...m,
|
|
335
|
+
fontFamily: e,
|
|
336
|
+
fontSize: "11px",
|
|
337
|
+
color: r,
|
|
338
|
+
textAlign: "center",
|
|
339
|
+
marginTop: "1.75rem"
|
|
340
|
+
},
|
|
341
|
+
confirmationTitle: {
|
|
342
|
+
...m,
|
|
343
|
+
fontFamily: o,
|
|
344
|
+
fontSize: "26px",
|
|
345
|
+
fontWeight: 700,
|
|
346
|
+
lineHeight: 1.3,
|
|
347
|
+
color: r,
|
|
348
|
+
maxWidth: "20ch"
|
|
349
|
+
},
|
|
350
|
+
confirmationMessage: {
|
|
351
|
+
...m,
|
|
352
|
+
fontFamily: e,
|
|
353
|
+
fontSize: "15px",
|
|
354
|
+
fontWeight: 400,
|
|
355
|
+
lineHeight: 1.45,
|
|
356
|
+
color: r,
|
|
357
|
+
marginTop: "1rem",
|
|
358
|
+
maxWidth: "34ch"
|
|
359
|
+
},
|
|
360
|
+
confirmationButton: {
|
|
361
|
+
...m,
|
|
362
|
+
fontFamily: o,
|
|
363
|
+
marginTop: "1.75rem",
|
|
364
|
+
minWidth: "168px",
|
|
365
|
+
height: "46px",
|
|
366
|
+
padding: "0 1.5rem",
|
|
367
|
+
border: "none",
|
|
368
|
+
borderRadius: "0",
|
|
369
|
+
backgroundColor: t.buttonColor || xt,
|
|
370
|
+
color: t.buttonTextColor || vt,
|
|
371
|
+
fontSize: "18px",
|
|
372
|
+
fontWeight: 700,
|
|
373
|
+
cursor: "pointer",
|
|
374
|
+
lineHeight: 1
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
function ge(t) {
|
|
379
|
+
const { buttonHoverColor: e, buttonHoverTextColor: o } = t;
|
|
380
|
+
return `
|
|
381
|
+
.sr-only {
|
|
382
|
+
position: absolute !important;
|
|
383
|
+
width: 1px !important;
|
|
384
|
+
height: 1px !important;
|
|
385
|
+
padding: 0 !important;
|
|
386
|
+
margin: -1px !important;
|
|
387
|
+
overflow: hidden !important;
|
|
388
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
389
|
+
white-space: nowrap !important;
|
|
390
|
+
border: 0 !important;
|
|
391
|
+
}
|
|
392
|
+
#form-popup-email:focus {
|
|
393
|
+
border-color: #111111 !important;
|
|
394
|
+
box-shadow: 0 0 0 1px #111111 !important;
|
|
395
|
+
}
|
|
396
|
+
#form-popup-email::placeholder {
|
|
397
|
+
color: #9a9a9a !important;
|
|
398
|
+
font-family: inherit !important;
|
|
399
|
+
}
|
|
400
|
+
#form-popup-close:hover {
|
|
401
|
+
background-color: #bdbdbd !important;
|
|
402
|
+
}
|
|
403
|
+
#form-popup-submit:hover:not(:disabled),
|
|
404
|
+
#form-popup-confirmation-button:hover {
|
|
405
|
+
background-color: ${e} !important;
|
|
406
|
+
color: ${o} !important;
|
|
407
|
+
}
|
|
408
|
+
#form-popup-submit:disabled {
|
|
409
|
+
opacity: 0.65 !important;
|
|
410
|
+
cursor: wait !important;
|
|
411
|
+
}
|
|
412
|
+
@media screen and (max-width: 480px) {
|
|
413
|
+
#form-popup-card {
|
|
414
|
+
padding: 2.5rem 1.25rem 1.25rem !important;
|
|
415
|
+
}
|
|
416
|
+
#form-popup-form-title {
|
|
417
|
+
font-size: 24px !important;
|
|
418
|
+
}
|
|
419
|
+
#form-popup-confirmation-title {
|
|
420
|
+
font-size: 22px !important;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
`;
|
|
424
|
+
}
|
|
425
|
+
function Et(t) {
|
|
426
|
+
return `formPopupSubmitted:${t || "default"}`;
|
|
427
|
+
}
|
|
428
|
+
function Ct(t) {
|
|
429
|
+
return typeof window > "u" || !t ? !1 : localStorage.getItem(Et(t)) === "true";
|
|
430
|
+
}
|
|
431
|
+
function be(t) {
|
|
432
|
+
const [e, o] = E(
|
|
433
|
+
() => t ? !Ct(t) : !1
|
|
434
|
+
);
|
|
435
|
+
V(() => {
|
|
436
|
+
t && o(!Ct(t));
|
|
437
|
+
}, [t]);
|
|
438
|
+
const r = wt(() => {
|
|
439
|
+
t && localStorage.setItem(Et(t), "true");
|
|
440
|
+
}, [t]), n = wt(() => {
|
|
441
|
+
o(!1);
|
|
442
|
+
}, []);
|
|
443
|
+
return { showModal: e, markSubmitted: r, dismiss: n };
|
|
444
|
+
}
|
|
445
|
+
const ye = "ageVerified", we = "true", rt = "age-gate", xe = "#age-gate-modal";
|
|
446
|
+
function ve(t, e) {
|
|
447
|
+
return typeof window > "u" ? !1 : localStorage.getItem(t) === e;
|
|
448
|
+
}
|
|
449
|
+
function St(t, e) {
|
|
450
|
+
var o;
|
|
451
|
+
try {
|
|
452
|
+
const r = document.querySelectorAll(t);
|
|
453
|
+
for (const n of r) {
|
|
454
|
+
const u = (o = n.shadowRoot) == null ? void 0 : o.querySelector(e);
|
|
455
|
+
if (u) return u;
|
|
456
|
+
}
|
|
457
|
+
} catch {
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
function Ce(t, e) {
|
|
463
|
+
if (typeof document > "u" || !t) return null;
|
|
464
|
+
try {
|
|
465
|
+
const o = document.querySelector(t);
|
|
466
|
+
if (o) return o;
|
|
467
|
+
} catch {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
{
|
|
471
|
+
const o = St(e, t);
|
|
472
|
+
if (o) return o;
|
|
473
|
+
}
|
|
474
|
+
return St(rt, t);
|
|
475
|
+
}
|
|
476
|
+
function At(t) {
|
|
477
|
+
var s, y, p, w;
|
|
478
|
+
const e = !!t.waitForAgeGate, o = ((s = t.waitForStorageKey) == null ? void 0 : s.trim()) || (e ? ye : ""), r = ((y = t.waitForStorageValue) == null ? void 0 : y.trim()) || we, n = ((p = t.waitUntilHidden) == null ? void 0 : p.trim()) || (e ? xe : ""), u = ((w = t.waitUntilHiddenHost) == null ? void 0 : w.trim()) || rt;
|
|
479
|
+
return !o && !n ? !0 : !(o && !ve(o, r) || n && Ce(n, u));
|
|
480
|
+
}
|
|
481
|
+
function Se(t) {
|
|
482
|
+
var p, w, v, A;
|
|
483
|
+
const e = !!t.waitForAgeGate, o = ((p = t.waitForStorageKey) == null ? void 0 : p.trim()) || "", r = ((w = t.waitForStorageValue) == null ? void 0 : w.trim()) || "", n = ((v = t.waitUntilHidden) == null ? void 0 : v.trim()) || "", u = ((A = t.waitUntilHiddenHost) == null ? void 0 : A.trim()) || "", [s, y] = E(() => At(t));
|
|
484
|
+
return V(() => {
|
|
485
|
+
const F = {
|
|
486
|
+
waitForAgeGate: e,
|
|
487
|
+
waitForStorageKey: o,
|
|
488
|
+
waitForStorageValue: r,
|
|
489
|
+
waitUntilHidden: n,
|
|
490
|
+
waitUntilHiddenHost: u
|
|
491
|
+
};
|
|
492
|
+
if (!e && !o && !n) {
|
|
493
|
+
y(!0);
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const i = () => y(At(F));
|
|
497
|
+
i();
|
|
498
|
+
const a = [], h = /* @__PURE__ */ new WeakSet(), f = () => {
|
|
499
|
+
const C = u || rt;
|
|
500
|
+
try {
|
|
501
|
+
document.querySelectorAll(C).forEach((_) => {
|
|
502
|
+
const l = _.shadowRoot;
|
|
503
|
+
if (!l || h.has(l)) return;
|
|
504
|
+
h.add(l);
|
|
505
|
+
const x = new MutationObserver(i);
|
|
506
|
+
x.observe(l, {
|
|
507
|
+
childList: !0,
|
|
508
|
+
subtree: !0
|
|
509
|
+
}), a.push(x);
|
|
510
|
+
});
|
|
511
|
+
} catch {
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
f();
|
|
515
|
+
const d = new MutationObserver(() => {
|
|
516
|
+
f(), i();
|
|
517
|
+
});
|
|
518
|
+
d.observe(document.documentElement, {
|
|
519
|
+
childList: !0,
|
|
520
|
+
subtree: !0
|
|
521
|
+
});
|
|
522
|
+
const g = window.setInterval(i, 250);
|
|
523
|
+
return () => {
|
|
524
|
+
d.disconnect(), a.forEach((C) => C.disconnect()), window.clearInterval(g);
|
|
525
|
+
};
|
|
526
|
+
}, [e, o, r, n, u]), s;
|
|
527
|
+
}
|
|
528
|
+
function Ae(t) {
|
|
529
|
+
return t ? Array.isArray(t) ? t.map((e) => e.trim()).filter(Boolean) : String(t).split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
530
|
+
}
|
|
531
|
+
function nt(t) {
|
|
532
|
+
if (!t) return;
|
|
533
|
+
if (t instanceof ShadowRoot) return t.host;
|
|
534
|
+
const e = t.getRootNode();
|
|
535
|
+
if (e instanceof ShadowRoot) return e.host;
|
|
536
|
+
}
|
|
537
|
+
function G(t, e) {
|
|
538
|
+
const o = nt(t);
|
|
539
|
+
if (!(o != null && o.hasAttribute(e))) return;
|
|
540
|
+
const r = o.getAttribute(e);
|
|
541
|
+
return r ?? void 0;
|
|
542
|
+
}
|
|
543
|
+
function Te(t, e, o) {
|
|
544
|
+
const r = nt(e);
|
|
545
|
+
if (r != null && r.hasAttribute(o)) {
|
|
546
|
+
const n = (r.getAttribute(o) ?? "").trim().toLowerCase();
|
|
547
|
+
return !(n === "false" || n === "0" || n === "no" || n === "off");
|
|
548
|
+
}
|
|
549
|
+
return t === !0 || t === "true";
|
|
550
|
+
}
|
|
551
|
+
const ke = "This site is protected by reCAPTCHA.", Ee = /* @__PURE__ */ new Set(["", "false", "none", "off", "hidden"]);
|
|
552
|
+
function Fe(t, e) {
|
|
553
|
+
const o = nt(e), r = (o == null ? void 0 : o.hasAttribute("recaptcha-text")) === !0 ? o.getAttribute("recaptcha-text") ?? "" : t;
|
|
554
|
+
return r === void 0 ? ke : Ee.has(String(r).trim().toLowerCase()) ? "" : String(r);
|
|
555
|
+
}
|
|
556
|
+
function Re(t) {
|
|
557
|
+
if (!t || typeof t != "object") return null;
|
|
558
|
+
const e = t, o = String(e.text ?? "").trim(), r = e.subscriptionTypeId;
|
|
559
|
+
return !o || typeof r != "string" && typeof r != "number" || String(r).trim() === "" ? null : {
|
|
560
|
+
subscriptionTypeId: r,
|
|
561
|
+
text: o,
|
|
562
|
+
required: !!e.required
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function He(t) {
|
|
566
|
+
if (!t) return [];
|
|
567
|
+
let e = [];
|
|
568
|
+
if (Array.isArray(t))
|
|
569
|
+
e = t;
|
|
570
|
+
else {
|
|
571
|
+
const o = t.trim();
|
|
572
|
+
if (!o) return [];
|
|
573
|
+
try {
|
|
574
|
+
const r = JSON.parse(o);
|
|
575
|
+
if (!Array.isArray(r)) return [];
|
|
576
|
+
e = r;
|
|
577
|
+
} catch {
|
|
578
|
+
return [];
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return e.flatMap((o) => {
|
|
582
|
+
const r = Re(o);
|
|
583
|
+
return r ? [r] : [];
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function et(t) {
|
|
587
|
+
return String(t.subscriptionTypeId);
|
|
588
|
+
}
|
|
589
|
+
function Le(t) {
|
|
590
|
+
if (typeof document > "u") return;
|
|
591
|
+
const e = document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));
|
|
592
|
+
return e ? decodeURIComponent(e[1]) : void 0;
|
|
593
|
+
}
|
|
594
|
+
async function Oe(t) {
|
|
595
|
+
var u;
|
|
596
|
+
const e = Le("hubspotutk"), o = t.legalConsent, r = (u = o == null ? void 0 : o.communications) == null ? void 0 : u.map((s) => ({
|
|
597
|
+
subscriptionTypeId: s.subscriptionTypeId,
|
|
598
|
+
text: s.text,
|
|
599
|
+
value: s.value
|
|
600
|
+
})), n = await fetch(
|
|
601
|
+
`https://api.hsforms.com/submissions/v3/integration/submit/${t.portalId}/${t.formId}`,
|
|
602
|
+
{
|
|
603
|
+
method: "POST",
|
|
604
|
+
headers: { "Content-Type": "application/json" },
|
|
605
|
+
body: JSON.stringify({
|
|
606
|
+
fields: t.fields.map((s) => ({
|
|
607
|
+
objectTypeId: "0-1",
|
|
608
|
+
name: s.name,
|
|
609
|
+
value: s.value
|
|
610
|
+
})),
|
|
611
|
+
context: {
|
|
612
|
+
pageUri: window.location.href,
|
|
613
|
+
pageName: document.title,
|
|
614
|
+
...e ? { hutk: e } : {}
|
|
615
|
+
},
|
|
616
|
+
...o ? {
|
|
617
|
+
legalConsentOptions: {
|
|
618
|
+
consent: {
|
|
619
|
+
consentToProcess: o.consentToProcess,
|
|
620
|
+
...o.text ? { text: o.text } : {},
|
|
621
|
+
...r != null && r.length ? { communications: r } : {}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
} : {}
|
|
625
|
+
})
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
if (!n.ok) {
|
|
629
|
+
let s = "";
|
|
630
|
+
try {
|
|
631
|
+
s = await n.text();
|
|
632
|
+
} catch {
|
|
633
|
+
s = "";
|
|
634
|
+
}
|
|
635
|
+
throw new Error(s || `HubSpot submission failed (${n.status})`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function We({
|
|
639
|
+
styles: t,
|
|
640
|
+
formTitle: e,
|
|
641
|
+
formSubtitle: o,
|
|
642
|
+
email: r,
|
|
643
|
+
emailPlaceholder: n,
|
|
644
|
+
state: u,
|
|
645
|
+
stateLabel: s,
|
|
646
|
+
states: y,
|
|
647
|
+
consentToProcessText: p,
|
|
648
|
+
consentToProcess: w,
|
|
649
|
+
communicationConsents: v,
|
|
650
|
+
communicationValues: A,
|
|
651
|
+
submitButtonText: F,
|
|
652
|
+
recaptchaText: i,
|
|
653
|
+
error: a,
|
|
654
|
+
submitting: h,
|
|
655
|
+
onEmailChange: f,
|
|
656
|
+
onStateChange: d,
|
|
657
|
+
onConsentToProcessChange: g,
|
|
658
|
+
onCommunicationChange: C,
|
|
659
|
+
onSubmit: _
|
|
660
|
+
}) {
|
|
661
|
+
return /* @__PURE__ */ S(kt, { children: [
|
|
662
|
+
/* @__PURE__ */ c("h1", { id: "form-popup-form-title", style: t.formTitle, children: e }),
|
|
663
|
+
o != null && o.trim() ? /* @__PURE__ */ c("p", { id: "form-popup-form-subtitle", style: t.formSubtitle, children: o }) : null,
|
|
664
|
+
/* @__PURE__ */ S("form", { id: "form-popup-form", style: t.form, onSubmit: _, noValidate: !0, children: [
|
|
665
|
+
/* @__PURE__ */ c("label", { htmlFor: "form-popup-email", className: "sr-only", children: "Email" }),
|
|
666
|
+
/* @__PURE__ */ c(
|
|
667
|
+
"input",
|
|
668
|
+
{
|
|
669
|
+
id: "form-popup-email",
|
|
670
|
+
name: "email",
|
|
671
|
+
type: "email",
|
|
672
|
+
autoComplete: "email",
|
|
673
|
+
required: !0,
|
|
674
|
+
value: r,
|
|
675
|
+
placeholder: n,
|
|
676
|
+
onChange: (l) => f(l.target.value),
|
|
677
|
+
style: t.emailInput,
|
|
678
|
+
"aria-required": "true"
|
|
679
|
+
}
|
|
680
|
+
),
|
|
681
|
+
/* @__PURE__ */ c("p", { id: "form-popup-state-label", style: t.stateLabel, children: s }),
|
|
682
|
+
/* @__PURE__ */ c(
|
|
683
|
+
"div",
|
|
684
|
+
{
|
|
685
|
+
role: "radiogroup",
|
|
686
|
+
"aria-labelledby": "form-popup-state-label",
|
|
687
|
+
"aria-required": "true",
|
|
688
|
+
style: t.stateGrid,
|
|
689
|
+
children: y.map((l) => {
|
|
690
|
+
const x = `form-popup-state-${l.replace(/\s+/g, "-").toLowerCase()}`;
|
|
691
|
+
return /* @__PURE__ */ S("label", { htmlFor: x, style: t.radioRow, children: [
|
|
692
|
+
/* @__PURE__ */ c(
|
|
693
|
+
"input",
|
|
694
|
+
{
|
|
695
|
+
id: x,
|
|
696
|
+
type: "radio",
|
|
697
|
+
name: "form-popup-state",
|
|
698
|
+
value: l,
|
|
699
|
+
checked: u === l,
|
|
700
|
+
onChange: () => d(l),
|
|
701
|
+
style: t.radio
|
|
702
|
+
}
|
|
703
|
+
),
|
|
704
|
+
l
|
|
705
|
+
] }, l);
|
|
706
|
+
})
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
p || v.length > 0 ? /* @__PURE__ */ S("div", { style: t.consentList, children: [
|
|
710
|
+
p ? /* @__PURE__ */ S("label", { htmlFor: "form-popup-consent-process", style: t.consentRow, children: [
|
|
711
|
+
/* @__PURE__ */ c(
|
|
712
|
+
"input",
|
|
713
|
+
{
|
|
714
|
+
id: "form-popup-consent-process",
|
|
715
|
+
type: "checkbox",
|
|
716
|
+
checked: w,
|
|
717
|
+
required: !0,
|
|
718
|
+
"aria-required": "true",
|
|
719
|
+
onChange: (l) => g(l.target.checked),
|
|
720
|
+
style: t.consentCheckbox
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
/* @__PURE__ */ S("span", { children: [
|
|
724
|
+
p,
|
|
725
|
+
/* @__PURE__ */ c("span", { style: t.consentRequired, "aria-hidden": "true", children: "*" })
|
|
726
|
+
] })
|
|
727
|
+
] }) : null,
|
|
728
|
+
v.map((l) => {
|
|
729
|
+
const x = et(l), D = `form-popup-consent-comm-${x}`;
|
|
730
|
+
return /* @__PURE__ */ S("label", { htmlFor: D, style: t.consentRow, children: [
|
|
731
|
+
/* @__PURE__ */ c(
|
|
732
|
+
"input",
|
|
733
|
+
{
|
|
734
|
+
id: D,
|
|
735
|
+
type: "checkbox",
|
|
736
|
+
checked: !!A[x],
|
|
737
|
+
required: l.required,
|
|
738
|
+
"aria-required": l.required ? !0 : void 0,
|
|
739
|
+
onChange: (N) => C(x, N.target.checked),
|
|
740
|
+
style: t.consentCheckbox
|
|
741
|
+
}
|
|
742
|
+
),
|
|
743
|
+
/* @__PURE__ */ S("span", { children: [
|
|
744
|
+
l.text,
|
|
745
|
+
l.required ? /* @__PURE__ */ c("span", { style: t.consentRequired, "aria-hidden": "true", children: "*" }) : null
|
|
746
|
+
] })
|
|
747
|
+
] }, x);
|
|
748
|
+
})
|
|
749
|
+
] }) : null,
|
|
750
|
+
/* @__PURE__ */ c(
|
|
751
|
+
"button",
|
|
752
|
+
{
|
|
753
|
+
id: "form-popup-submit",
|
|
754
|
+
type: "submit",
|
|
755
|
+
style: t.submitButton,
|
|
756
|
+
disabled: h,
|
|
757
|
+
children: h ? "Submitting…" : F
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
a ? /* @__PURE__ */ c("p", { id: "form-popup-error", role: "alert", style: t.error, children: a }) : null
|
|
761
|
+
] }),
|
|
762
|
+
i != null && i.trim() ? /* @__PURE__ */ c("p", { id: "form-popup-recaptcha", style: t.recaptcha, children: i }) : null
|
|
763
|
+
] });
|
|
764
|
+
}
|
|
765
|
+
function Ge({
|
|
766
|
+
styles: t,
|
|
767
|
+
confirmationTitle: e,
|
|
768
|
+
confirmationMessage: o,
|
|
769
|
+
confirmationButtonText: r,
|
|
770
|
+
onButtonClick: n
|
|
771
|
+
}) {
|
|
772
|
+
const u = !!(r != null && r.trim());
|
|
773
|
+
return /* @__PURE__ */ S(kt, { children: [
|
|
774
|
+
/* @__PURE__ */ c("h1", { id: "form-popup-confirmation-title", style: t.confirmationTitle, children: e }),
|
|
775
|
+
o != null && o.trim() ? /* @__PURE__ */ c("p", { id: "form-popup-confirmation-message", style: t.confirmationMessage, children: o }) : null,
|
|
776
|
+
u ? /* @__PURE__ */ c(
|
|
777
|
+
"button",
|
|
778
|
+
{
|
|
779
|
+
id: "form-popup-confirmation-button",
|
|
780
|
+
type: "button",
|
|
781
|
+
style: t.confirmationButton,
|
|
782
|
+
onClick: n,
|
|
783
|
+
children: r
|
|
784
|
+
}
|
|
785
|
+
) : null
|
|
786
|
+
] });
|
|
787
|
+
}
|
|
788
|
+
const _e = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
789
|
+
function qe(t) {
|
|
790
|
+
return !t || t === "demo";
|
|
791
|
+
}
|
|
792
|
+
const Be = ({
|
|
793
|
+
hubspotPortalId: t,
|
|
794
|
+
hubspotFormId: e,
|
|
795
|
+
emailProperty: o = "email",
|
|
796
|
+
stateProperty: r = "state",
|
|
797
|
+
additionalPropertyName: n,
|
|
798
|
+
additionalPropertyValue: u,
|
|
799
|
+
consentToProcessText: s,
|
|
800
|
+
communicationConsents: y,
|
|
801
|
+
formTitle: p,
|
|
802
|
+
formSubtitle: w,
|
|
803
|
+
states: v,
|
|
804
|
+
submitButtonText: A = "Submit",
|
|
805
|
+
emailPlaceholder: F = "Email *",
|
|
806
|
+
stateLabel: i = "Select A State *",
|
|
807
|
+
confirmationTitle: a,
|
|
808
|
+
confirmationMessage: h,
|
|
809
|
+
confirmationButtonText: f,
|
|
810
|
+
confirmationButtonUrl: d,
|
|
811
|
+
recaptchaText: g,
|
|
812
|
+
backgroundColor: C,
|
|
813
|
+
overlayColor: _,
|
|
814
|
+
textColor: l = "#111111",
|
|
815
|
+
buttonColor: x = "#000000",
|
|
816
|
+
buttonTextColor: D = "#ffffff",
|
|
817
|
+
buttonHoverColor: N = "#333333",
|
|
818
|
+
buttonHoverTextColor: Rt = "#ffffff",
|
|
819
|
+
fontFamily: Ht,
|
|
820
|
+
headingFontFamily: Lt,
|
|
821
|
+
waitForAgeGate: Ot,
|
|
822
|
+
waitForStorageKey: M,
|
|
823
|
+
waitForStorageValue: K,
|
|
824
|
+
waitUntilHidden: J,
|
|
825
|
+
waitUntilHiddenHost: X,
|
|
826
|
+
container: R
|
|
827
|
+
}) => {
|
|
828
|
+
var mt, dt, pt, ft, ht, gt;
|
|
829
|
+
const q = he({
|
|
830
|
+
backgroundColor: C,
|
|
831
|
+
overlayColor: _,
|
|
832
|
+
textColor: l,
|
|
833
|
+
buttonColor: x,
|
|
834
|
+
buttonTextColor: D,
|
|
835
|
+
fontFamily: Ht,
|
|
836
|
+
headingFontFamily: Lt
|
|
837
|
+
}), it = (e == null ? void 0 : e.trim()) || ((mt = G(R, "hubspot-form-id")) == null ? void 0 : mt.trim()) || "", st = (t == null ? void 0 : t.trim()) || ((dt = G(R, "hubspot-portal-id")) == null ? void 0 : dt.trim()) || "", Wt = Te(
|
|
838
|
+
Ot,
|
|
839
|
+
R,
|
|
840
|
+
"wait-for-age-gate"
|
|
841
|
+
), Gt = (M == null ? void 0 : M.trim()) || ((pt = G(R, "wait-for-storage-key")) == null ? void 0 : pt.trim()) || "", _t = (K == null ? void 0 : K.trim()) || ((ft = G(R, "wait-for-storage-value")) == null ? void 0 : ft.trim()) || "", qt = (J == null ? void 0 : J.trim()) || ((ht = G(R, "wait-until-hidden")) == null ? void 0 : ht.trim()) || "", Bt = (X == null ? void 0 : X.trim()) || ((gt = G(R, "wait-until-hidden-host")) == null ? void 0 : gt.trim()) || "", { showModal: It, markSubmitted: zt, dismiss: B } = be(it), Dt = Se({
|
|
842
|
+
waitForAgeGate: Wt,
|
|
843
|
+
waitForStorageKey: Gt,
|
|
844
|
+
waitForStorageValue: _t,
|
|
845
|
+
waitUntilHidden: qt,
|
|
846
|
+
waitUntilHiddenHost: Bt
|
|
847
|
+
}), I = It && Dt, [at, jt] = E("form"), [lt, Ut] = E(""), [Y, Pt] = E(""), [Z, $t] = E(!1), [Q, Vt] = E({}), [ct, ut] = E(!1), [j, T] = E(""), Nt = Ae(v), Mt = Fe(g, R), L = (s == null ? void 0 : s.trim()) || "", z = He(y), Kt = !!L || z.length > 0;
|
|
848
|
+
V(() => {
|
|
849
|
+
if (!I) return;
|
|
850
|
+
const b = document.body.style.overflow;
|
|
851
|
+
return document.body.style.overflow = "hidden", () => {
|
|
852
|
+
document.body.style.overflow = b;
|
|
853
|
+
};
|
|
854
|
+
}, [I]), V(() => {
|
|
855
|
+
if (!I) return;
|
|
856
|
+
const b = (O) => {
|
|
857
|
+
O.key === "Escape" && B();
|
|
858
|
+
};
|
|
859
|
+
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
860
|
+
}, [I, B]);
|
|
861
|
+
const Jt = async (b) => {
|
|
862
|
+
b.preventDefault();
|
|
863
|
+
const O = lt.trim();
|
|
864
|
+
if (!_e.test(O)) {
|
|
865
|
+
T("Please enter a valid email address.");
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
if (!Y) {
|
|
869
|
+
T("Please select a state.");
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
if (L && !Z) {
|
|
873
|
+
T("Please agree to the privacy terms.");
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (z.find(
|
|
877
|
+
(W) => W.required && !Q[et(W)]
|
|
878
|
+
)) {
|
|
879
|
+
T("Please agree to the required communications terms.");
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
T(""), ut(!0);
|
|
883
|
+
const yt = [
|
|
884
|
+
{ name: o, value: O },
|
|
885
|
+
{ name: r, value: Y }
|
|
886
|
+
];
|
|
887
|
+
n != null && n.trim() && u != null && yt.push({
|
|
888
|
+
name: n.trim(),
|
|
889
|
+
value: u
|
|
890
|
+
});
|
|
891
|
+
try {
|
|
892
|
+
qe(st) || await Oe({
|
|
893
|
+
portalId: st,
|
|
894
|
+
formId: it,
|
|
895
|
+
fields: yt,
|
|
896
|
+
legalConsent: Kt ? {
|
|
897
|
+
consentToProcess: !!(L && Z),
|
|
898
|
+
...L ? { text: L } : {},
|
|
899
|
+
...z.length ? {
|
|
900
|
+
communications: z.map((W) => ({
|
|
901
|
+
subscriptionTypeId: Number(W.subscriptionTypeId),
|
|
902
|
+
text: W.text,
|
|
903
|
+
value: !!Q[et(W)]
|
|
904
|
+
}))
|
|
905
|
+
} : {}
|
|
906
|
+
} : void 0
|
|
907
|
+
}), zt(), jt("confirmation");
|
|
908
|
+
} catch {
|
|
909
|
+
T("Something went wrong. Please try again.");
|
|
910
|
+
} finally {
|
|
911
|
+
ut(!1);
|
|
912
|
+
}
|
|
913
|
+
}, Xt = () => {
|
|
914
|
+
if (d) {
|
|
915
|
+
window.location.href = d;
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
B();
|
|
919
|
+
};
|
|
920
|
+
if (!I) return null;
|
|
921
|
+
const Yt = at === "form" ? "form-popup-form-title" : "form-popup-confirmation-title";
|
|
922
|
+
return /* @__PURE__ */ S(
|
|
923
|
+
"div",
|
|
924
|
+
{
|
|
925
|
+
id: "form-popup-overlay",
|
|
926
|
+
style: q.overlay,
|
|
927
|
+
role: "dialog",
|
|
928
|
+
"aria-modal": "true",
|
|
929
|
+
"aria-labelledby": Yt,
|
|
930
|
+
onClick: (b) => {
|
|
931
|
+
b.target === b.currentTarget && !ct && B();
|
|
932
|
+
},
|
|
933
|
+
children: [
|
|
934
|
+
/* @__PURE__ */ c("style", { children: ge({
|
|
935
|
+
buttonHoverColor: N,
|
|
936
|
+
buttonHoverTextColor: Rt
|
|
937
|
+
}) }),
|
|
938
|
+
/* @__PURE__ */ S("div", { id: "form-popup-card", style: q.card, role: "document", children: [
|
|
939
|
+
/* @__PURE__ */ c(
|
|
940
|
+
"button",
|
|
941
|
+
{
|
|
942
|
+
id: "form-popup-close",
|
|
943
|
+
type: "button",
|
|
944
|
+
style: q.closeButton,
|
|
945
|
+
"aria-label": "Close",
|
|
946
|
+
onClick: B,
|
|
947
|
+
children: /* @__PURE__ */ c("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ c(
|
|
948
|
+
"path",
|
|
949
|
+
{
|
|
950
|
+
d: "M1 1l8 8M9 1L1 9",
|
|
951
|
+
stroke: "currentColor",
|
|
952
|
+
strokeWidth: "1.5",
|
|
953
|
+
strokeLinecap: "round"
|
|
954
|
+
}
|
|
955
|
+
) })
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
at === "form" ? /* @__PURE__ */ c(
|
|
959
|
+
We,
|
|
960
|
+
{
|
|
961
|
+
styles: q,
|
|
962
|
+
formTitle: p,
|
|
963
|
+
formSubtitle: w,
|
|
964
|
+
email: lt,
|
|
965
|
+
emailPlaceholder: F,
|
|
966
|
+
state: Y,
|
|
967
|
+
stateLabel: i,
|
|
968
|
+
states: Nt,
|
|
969
|
+
consentToProcessText: L || void 0,
|
|
970
|
+
consentToProcess: Z,
|
|
971
|
+
communicationConsents: z,
|
|
972
|
+
communicationValues: Q,
|
|
973
|
+
submitButtonText: A,
|
|
974
|
+
recaptchaText: Mt,
|
|
975
|
+
error: j,
|
|
976
|
+
submitting: ct,
|
|
977
|
+
onEmailChange: Ut,
|
|
978
|
+
onStateChange: (b) => {
|
|
979
|
+
Pt(b), j && T("");
|
|
980
|
+
},
|
|
981
|
+
onConsentToProcessChange: (b) => {
|
|
982
|
+
$t(b), j && T("");
|
|
983
|
+
},
|
|
984
|
+
onCommunicationChange: (b, O) => {
|
|
985
|
+
Vt((bt) => ({
|
|
986
|
+
...bt,
|
|
987
|
+
[b]: O
|
|
988
|
+
})), j && T("");
|
|
989
|
+
},
|
|
990
|
+
onSubmit: Jt
|
|
991
|
+
}
|
|
992
|
+
) : /* @__PURE__ */ c(
|
|
993
|
+
Ge,
|
|
994
|
+
{
|
|
995
|
+
styles: q,
|
|
996
|
+
confirmationTitle: a,
|
|
997
|
+
confirmationMessage: h,
|
|
998
|
+
confirmationButtonText: f,
|
|
999
|
+
onButtonClick: Xt
|
|
1000
|
+
}
|
|
1001
|
+
)
|
|
1002
|
+
] })
|
|
1003
|
+
]
|
|
1004
|
+
}
|
|
1005
|
+
);
|
|
1006
|
+
}, Ie = ue(Be, {
|
|
1007
|
+
props: {
|
|
1008
|
+
hubspotPortalId: "string",
|
|
1009
|
+
hubspotFormId: "string",
|
|
1010
|
+
emailProperty: "string",
|
|
1011
|
+
stateProperty: "string",
|
|
1012
|
+
additionalPropertyName: "string",
|
|
1013
|
+
additionalPropertyValue: "string",
|
|
1014
|
+
consentToProcessText: "string",
|
|
1015
|
+
communicationConsents: "string",
|
|
1016
|
+
formTitle: "string",
|
|
1017
|
+
formSubtitle: "string",
|
|
1018
|
+
states: "string",
|
|
1019
|
+
submitButtonText: "string",
|
|
1020
|
+
emailPlaceholder: "string",
|
|
1021
|
+
stateLabel: "string",
|
|
1022
|
+
confirmationTitle: "string",
|
|
1023
|
+
confirmationMessage: "string",
|
|
1024
|
+
confirmationButtonText: "string",
|
|
1025
|
+
confirmationButtonUrl: "string",
|
|
1026
|
+
recaptchaText: "string",
|
|
1027
|
+
backgroundColor: "string",
|
|
1028
|
+
overlayColor: "string",
|
|
1029
|
+
textColor: "string",
|
|
1030
|
+
buttonColor: "string",
|
|
1031
|
+
buttonTextColor: "string",
|
|
1032
|
+
buttonHoverColor: "string",
|
|
1033
|
+
buttonHoverTextColor: "string",
|
|
1034
|
+
fontFamily: "string",
|
|
1035
|
+
headingFontFamily: "string",
|
|
1036
|
+
waitForAgeGate: "string",
|
|
1037
|
+
waitForStorageKey: "string",
|
|
1038
|
+
waitForStorageValue: "string",
|
|
1039
|
+
waitUntilHidden: "string",
|
|
1040
|
+
waitUntilHiddenHost: "string"
|
|
1041
|
+
},
|
|
1042
|
+
shadow: "open"
|
|
1043
|
+
});
|
|
1044
|
+
function Ft() {
|
|
1045
|
+
typeof customElements > "u" || customElements.get("form-popup") || customElements.define("form-popup", Ie);
|
|
1046
|
+
}
|
|
1047
|
+
Ft();
|
|
1048
|
+
Ft();
|
|
1049
|
+
export {
|
|
1050
|
+
Be as FormPopup
|
|
1051
|
+
};
|
|
1052
|
+
//# sourceMappingURL=form-popup.es.js.map
|