@usgb/forms 1.0.0 → 1.0.2

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/index.js CHANGED
@@ -1,68 +1,85 @@
1
- import { jsxs as p, Fragment as Y, jsx as s } from "react/jsx-runtime";
2
- import { validate as te } from "email-validator";
3
- import { useId as ne, useMemo as P, useState as ie, useEffect as re, forwardRef as O } from "react";
4
- import { useForm as oe } from "react-hook-form";
5
- import x from "classnames";
6
- const se = "1.0.0", ae = { version: "1.0.0", transport: "server-proxy", payloadShape: "data-and-context" }, le = { page_url: { destination: "form_submission_url", category: "page", collection: "server", required: !0, states: ["collected", "unavailable"], description: "Canonical landing-page URL at submission time" }, page_title: { destination: "pageName", category: "page", collection: "server", required: !1, states: ["collected", "unavailable"] }, referrer: { destination: "referrer", category: "page", collection: "browser", required: !1, states: ["collected", "unavailable"] }, first_touch_url: { destination: "crossDomain_landing_url", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_source: { destination: "utm_source", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_medium: { destination: "utm_medium", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_campaign: { destination: "utm_campaign", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_term: { destination: "utm_term", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_content: { destination: "utm_content", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, gclid: { destination: "gclid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, msclkid: { destination: "msclkid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, gbraid: { destination: "gbraid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, wbraid: { destination: "wbraid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, hubspot_utk: { destination: "hubspot_utk", category: "identity", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, ga_client_id: { destination: "ga_client_id", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, ga_session_id: { destination: "session_id_start", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, snowplow_id: { destination: "snowplow_id", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, vwo_uuid: { destination: "vwo_uuid", category: "experiment", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, user_agent: { destination: "header_http_client_details", category: "technical", collection: "server", required: !1, states: ["collected", "unavailable"] }, ip_address: { destination: "ipAddress", category: "technical", collection: "server", required: !1, states: ["collected", "unavailable"] } }, ce = { "main-investors-kit": { definitionVersion: "1", kind: "lead", flow: { type: "single" }, supportedHosts: ["pwa", "wordpress"], fields: [{ name: "firstname", required: !0, group: "name" }, { name: "lastname", required: !0, group: "name" }, { name: "email", required: !0 }, { name: "phone", required: !1 }], trackingFields: ["page_url", "page_title", "referrer", "first_touch_url", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content", "gclid", "msclkid", "gbraid", "wbraid", "hubspot_utk", "ga_client_id", "ga_session_id", "snowplow_id", "vwo_uuid", "user_agent", "ip_address"], consent: { definitionId: "lead-tcpa", definitionVersion: "1", required: !0, submitFields: ["tcpa_form_consent_granted", "tcpa_form_opt_in_date"] }, editor: { label: "Main Investors Kit", description: "Standard lead form: name, email, phone, TCPA consent. Use on full-width landing pages and PWA kit/sidebar placements.", whenToUse: "Default kit request. Do not use for affiliate landers or IRA-specific leads.", whenNotToUse: "Affiliate pages (separate definition). IRA kit (separate definition when added).", supportedAppearances: ["light", "navy"], supportedVariants: ["dense", "large", "sidebar", "two-column"] } }, newsletter: { definitionVersion: "1", kind: "newsletter", flow: { type: "single" }, supportedHosts: ["pwa"], fields: [{ name: "email", required: !0 }], trackingFields: ["page_url", "page_title", "referrer", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], editor: { label: "Newsletter", description: "Email-only newsletter signup. No TCPA consent.", whenToUse: "Footer or landing newsletter capture where only an email is required.", whenNotToUse: "Lead kits that need name, phone, or TCPA consent.", supportedAppearances: ["light", "navy"], supportedVariants: [] } } }, de = { hosts: ["pwa", "wordpress"], mayProvide: ["browser cookies", "URL parameters", "page and placement context", "host/store identity"], mustNotDefine: ["new tracking keys", "destination property names", "consent definitions", "form fields", "submission endpoints"] }, ue = {
7
- schemaVersion: se,
8
- package: { name: "@usgb/forms", compatiblePackageVersions: "^1.0.0" },
9
- submissionContract: ae,
10
- trackingRegistry: le,
11
- forms: ce,
12
- hostAdapterContract: de
13
- }, D = ue;
14
- function me(t) {
15
- return D.forms[t];
1
+ import { jsx as l, Fragment as X, jsxs as g } from "react/jsx-runtime";
2
+ import { validate as ee } from "email-validator";
3
+ import { useId as te, useMemo as D, useState as ne, useEffect as ie, forwardRef as $ } from "react";
4
+ import { useForm as re } from "react-hook-form";
5
+ import P from "classnames";
6
+ const oe = "1.0.0", se = { version: "1.0.0", transport: "server-proxy", payloadShape: "data-and-context" }, ae = { page_url: { destination: "form_submission_url", category: "page", collection: "server", required: !0, states: ["collected", "unavailable"], description: "Canonical landing-page URL at submission time" }, page_title: { destination: "pageName", category: "page", collection: "server", required: !1, states: ["collected", "unavailable"] }, referrer: { destination: "referrer", category: "page", collection: "browser", required: !1, states: ["collected", "unavailable"] }, first_touch_url: { destination: "crossDomain_landing_url", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_source: { destination: "utm_source", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_medium: { destination: "utm_medium", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_campaign: { destination: "utm_campaign", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_term: { destination: "utm_term", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, utm_content: { destination: "utm_content", category: "attribution", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, gclid: { destination: "gclid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, msclkid: { destination: "msclkid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, gbraid: { destination: "gbraid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, wbraid: { destination: "wbraid", category: "click-id", collection: "host-adapter", required: !1, states: ["collected", "unavailable"] }, hubspot_utk: { destination: "hubspot_utk", category: "identity", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, ga_client_id: { destination: "ga_client_id", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, ga_session_id: { destination: "session_id_start", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, snowplow_id: { destination: "snowplow_id", category: "analytics", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, vwo_uuid: { destination: "vwo_uuid", category: "experiment", collection: "host-adapter", required: !1, states: ["collected", "unavailable", "consent-withheld"] }, user_agent: { destination: "header_http_client_details", category: "technical", collection: "server", required: !1, states: ["collected", "unavailable"] }, ip_address: { destination: "ipAddress", category: "technical", collection: "server", required: !1, states: ["collected", "unavailable"] } }, le = { "main-investors-kit": { definitionVersion: "1", kind: "lead", flow: { type: "single" }, supportedHosts: ["pwa", "wordpress"], fields: [{ name: "firstname", required: !0, group: "name" }, { name: "lastname", required: !0, group: "name" }, { name: "email", required: !0 }, { name: "phone", required: !1 }], trackingFields: ["page_url", "page_title", "referrer", "first_touch_url", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content", "gclid", "msclkid", "gbraid", "wbraid", "hubspot_utk", "ga_client_id", "ga_session_id", "snowplow_id", "vwo_uuid", "user_agent", "ip_address"], ctaLabel: "GET MY FREE GUIDE", consents: [{ definitionId: "lead-tcpa", definitionVersion: "1", required: !1 }, { definitionId: "lead-sms", definitionVersion: "1", required: !1 }, { definitionId: "lead-tospp", definitionVersion: "1", required: !1 }], editor: { label: "Main Investors Kit", description: "Standard lead form: name, email, phone, plus optional TCPA, marketing SMS, and terms/privacy checkboxes. Use on full-width landing pages and PWA kit/sidebar placements.", whenToUse: "Default kit request with optional consent checkboxes. Do not use for affiliate landers or IRA-specific leads.", whenNotToUse: "Affiliate pages (separate definition). IRA kit (separate definition when added). Clickwrap-only kit (`main-investors-kit-notice`).", supportedAppearances: ["on-light", "on-dark"], supportedVariants: ["dense", "large", "sidebar", "two-column"] } }, "main-investors-kit-notice": { definitionVersion: "1", kind: "lead", flow: { type: "single" }, supportedHosts: ["pwa", "wordpress"], fields: [{ name: "firstname", required: !0, group: "name" }, { name: "lastname", required: !0, group: "name" }, { name: "email", required: !0 }, { name: "phone", required: !1 }], trackingFields: ["page_url", "page_title", "referrer", "first_touch_url", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content", "gclid", "msclkid", "gbraid", "wbraid", "hubspot_utk", "ga_client_id", "ga_session_id", "snowplow_id", "vwo_uuid", "user_agent", "ip_address"], ctaLabel: "GET MY FREE GUIDE", consents: [{ definitionId: "lead-clickwrap", definitionVersion: "1" }], editor: { label: "Main Investors Kit (clickwrap)", description: "Same fields as Main Investors Kit with a clickwrap notice only — no consent checkboxes.", whenToUse: "Kit request where submit acknowledges legal docs via notice copy instead of checkboxes.", whenNotToUse: "Placements that need TCPA / marketing SMS / terms checkboxes (`main-investors-kit`).", supportedAppearances: ["on-light", "on-dark"], supportedVariants: ["dense", "large", "sidebar", "two-column"] } }, newsletter: { definitionVersion: "1", kind: "newsletter", flow: { type: "single" }, supportedHosts: ["pwa"], fields: [{ name: "email", required: !0 }], trackingFields: ["page_url", "page_title", "referrer", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], ctaLabel: "SUBSCRIBE", editor: { label: "Newsletter", description: "Email-only newsletter signup. No TCPA consent.", whenToUse: "Footer or landing newsletter capture where only an email is required.", whenNotToUse: "Lead kits that need name, phone, or TCPA consent.", supportedAppearances: ["on-light", "on-dark"], supportedVariants: [] } } }, ce = { hosts: ["pwa", "wordpress"], mayProvide: ["browser cookies", "URL parameters", "page and placement context", "host/store identity"], mustNotDefine: ["new tracking keys", "destination property names", "consent definitions", "form fields", "submission endpoints"] }, de = {
7
+ schemaVersion: oe,
8
+ package: { name: "@usgb/forms", compatiblePackageVersions: "^1.0.2" },
9
+ submissionContract: se,
10
+ trackingRegistry: ae,
11
+ forms: le,
12
+ hostAdapterContract: ce
13
+ }, I = de;
14
+ function ue(t) {
15
+ return I.forms[t];
16
16
  }
17
- function Me() {
18
- return Object.entries(D.forms).map(([t, e]) => ({
17
+ function He() {
18
+ return Object.entries(I.forms).map(([t, e]) => ({
19
19
  formId: t,
20
20
  definition: e
21
21
  }));
22
22
  }
23
- function fe(t, e) {
24
- return typeof t == "function" ? t(e) : t;
23
+ function j(t, e) {
24
+ return typeof t == "string" ? { content: t, language: t } : t(e);
25
25
  }
26
- const U = {
26
+ function G(t, e) {
27
+ return `${t}@${e}`;
28
+ }
29
+ function H(t) {
30
+ return (e) => ({
31
+ language: t.map(
32
+ (n) => typeof n == "string" ? n : `${n.label} (${e[n.href] ?? ""})`
33
+ ).join(""),
34
+ content: /* @__PURE__ */ l(X, { children: t.map(
35
+ (n, i) => typeof n == "string" ? n : /* @__PURE__ */ l(
36
+ "a",
37
+ {
38
+ href: e[n.href],
39
+ target: "_blank",
40
+ rel: "noreferrer",
41
+ children: n.label
42
+ },
43
+ `${n.href}-${i}`
44
+ )
45
+ ) })
46
+ });
47
+ }
48
+ const me = {
27
49
  definitionId: "lead-tcpa",
28
50
  definitionVersion: "1",
29
- requiredLegalUrls: ["clientAgreement", "privacyPolicy"],
30
- items: [
31
- {
32
- type: "checkbox",
33
- name: "tcpa_form_consent_granted",
34
- required: !0,
35
- content: (t) => /* @__PURE__ */ p(Y, { children: [
36
- "By checking this box, I agree to receive automated text messages from U.S. Gold Bureau. Message and data rates may apply. Consent is not a condition of purchase. View our",
37
- " ",
38
- /* @__PURE__ */ s(
39
- "a",
40
- {
41
- href: t.clientAgreement,
42
- target: "_blank",
43
- rel: "noreferrer",
44
- children: "Client Agreement"
45
- }
46
- ),
47
- " ",
48
- "and",
49
- " ",
50
- /* @__PURE__ */ s(
51
- "a",
52
- {
53
- href: t.privacyPolicy,
54
- target: "_blank",
55
- rel: "noreferrer",
56
- children: "Privacy Policy"
57
- }
58
- ),
59
- "."
60
- ] })
61
- }
62
- ]
63
- }, $ = {
51
+ type: "checkbox",
52
+ name: "tcpa_form_consent_granted",
53
+ grantDateField: "tcpa_form_opt_in_date",
54
+ requiredLegalUrls: [],
55
+ languageKey: "tcpa_consent_language",
56
+ copy: "By checking, you are allowing to receive transactional/informational SMS communications regarding account notifications, customer care, etc, from U.S. Gold Bureau. Messages frequency may vary. Data rates may apply, reply STOP to opt-out"
57
+ }, fe = {
58
+ definitionId: "lead-sms",
59
+ definitionVersion: "1",
60
+ type: "checkbox",
61
+ name: "sms_form_consent_granted",
62
+ requiredLegalUrls: [],
63
+ languageKey: "sms_consent_language",
64
+ copy: "By checking, you are allowing to receive promotional/marketing SMS communications from U.S. Gold Bureau. Frequency may vary. Data rates may apply. Reply HELP for help or STOP to opt-out."
65
+ }, ge = {
66
+ definitionId: "lead-tospp",
67
+ definitionVersion: "1",
68
+ type: "checkbox",
69
+ name: "tospp_form_consent_granted",
70
+ requiredLegalUrls: ["userAgreement", "privacyPolicy"],
71
+ languageKey: "tospp_consent_language",
72
+ copy: H([
73
+ "By checking, I accept ",
74
+ { href: "userAgreement", label: "Terms of Conditions" },
75
+ " & ",
76
+ { href: "privacyPolicy", label: "Privacy Policy" },
77
+ "."
78
+ ])
79
+ }, pe = {
64
80
  definitionId: "lead-clickwrap",
65
81
  definitionVersion: "1",
82
+ type: "notice",
66
83
  requiredLegalUrls: [
67
84
  "privacyPolicy",
68
85
  "userAgreement",
@@ -70,99 +87,108 @@ const U = {
70
87
  "electronicDisclaimer",
71
88
  "termsOfSale"
72
89
  ],
73
- items: [
74
- {
75
- type: "notice",
76
- content: (t) => /* @__PURE__ */ p(Y, { children: [
77
- "By clicking the button, I agree to be bound by your",
78
- " ",
79
- /* @__PURE__ */ s(
80
- "a",
81
- {
82
- href: t.privacyPolicy,
83
- target: "_blank",
84
- rel: "noreferrer",
85
- children: "Privacy Policy"
86
- }
87
- ),
88
- ",",
89
- " ",
90
- /* @__PURE__ */ s(
91
- "a",
92
- {
93
- href: t.userAgreement,
94
- target: "_blank",
95
- rel: "noreferrer",
96
- children: "User Agreement"
97
- }
98
- ),
99
- ",",
100
- " ",
101
- /* @__PURE__ */ s(
102
- "a",
103
- {
104
- href: t.marketLossPolicy,
105
- target: "_blank",
106
- rel: "noreferrer",
107
- children: "Market Loss Policy"
108
- }
109
- ),
110
- ",",
111
- " ",
112
- /* @__PURE__ */ s(
113
- "a",
114
- {
115
- href: t.electronicDisclaimer,
116
- target: "_blank",
117
- rel: "noreferrer",
118
- children: "Electronic Disclaimer"
119
- }
120
- ),
121
- " ",
122
- "and",
123
- " ",
124
- /* @__PURE__ */ s("a", { href: t.termsOfSale, target: "_blank", rel: "noreferrer", children: "Terms & Conditions of Sale" }),
125
- "."
126
- ] })
127
- }
128
- ]
129
- }, ge = {
130
- [`${U.definitionId}@${U.definitionVersion}`]: U,
131
- [`${$.definitionId}@${$.definitionVersion}`]: $
90
+ languageKey: "clickwrap_consent_language",
91
+ copy: H([
92
+ "By clicking the button, I agree to be bound by your ",
93
+ { href: "privacyPolicy", label: "Privacy Policy" },
94
+ ", ",
95
+ { href: "userAgreement", label: "User Agreement" },
96
+ ", ",
97
+ { href: "marketLossPolicy", label: "Market Loss Policy" },
98
+ ", ",
99
+ { href: "electronicDisclaimer", label: "Electronic Disclaimer" },
100
+ " and ",
101
+ { href: "termsOfSale", label: "Terms & Conditions of Sale" },
102
+ "."
103
+ ])
132
104
  };
133
- function Z(t, e) {
134
- return ge[`${t}@${e}`];
105
+ function he(...t) {
106
+ return Object.fromEntries(
107
+ t.map((e) => [
108
+ G(e.definitionId, e.definitionVersion),
109
+ e
110
+ ])
111
+ );
135
112
  }
136
- function z(t) {
113
+ const be = he(
114
+ me,
115
+ fe,
116
+ ge,
117
+ pe
118
+ );
119
+ function ye(t, e) {
120
+ return be[G(t, e)];
121
+ }
122
+ function W(t) {
123
+ if (!(t != null && t.length))
124
+ return [];
125
+ const e = [];
126
+ for (const n of t) {
127
+ const i = ye(
128
+ n.definitionId,
129
+ n.definitionVersion
130
+ );
131
+ if (!i)
132
+ return null;
133
+ e.push(
134
+ i.type === "checkbox" ? { ...i, required: !!n.required } : i
135
+ );
136
+ }
137
+ return e;
138
+ }
139
+ function _e(t, e, n, i) {
140
+ if (!t.length)
141
+ return;
142
+ const a = {};
143
+ for (const s of t) {
144
+ const { language: r } = j(s.copy, n);
145
+ if (a[s.languageKey] = r, s.type === "checkbox") {
146
+ const o = !!e[s.name];
147
+ a[s.name] = o, o && s.grantDateField && (a[s.grantDateField] = i);
148
+ }
149
+ }
150
+ return a;
151
+ }
152
+ function ke(t) {
153
+ const e = /* @__PURE__ */ new Set();
154
+ for (const n of t)
155
+ for (const i of n.requiredLegalUrls)
156
+ e.add(i);
157
+ return [...e];
158
+ }
159
+ function we(t) {
160
+ return t.type === "checkbox";
161
+ }
162
+ function O(t) {
137
163
  return (e, n) => n ? e.trim().length > 0 || `${t} is required` : !0;
138
164
  }
139
- const pe = /^[2-9]\d{2}[2-9]\d{6}$/;
140
- function J(t) {
165
+ const ve = /^[2-9]\d{2}[2-9]\d{6}$/;
166
+ function z(t) {
141
167
  let e = t.replace(/\D/g, "");
142
- return e.length === 11 && e.startsWith("1") && (e = e.slice(1)), e.length !== 10 || !pe.test(e) ? null : e;
168
+ return e.length === 11 && e.startsWith("1") && (e = e.slice(1)), e.length !== 10 || !ve.test(e) ? null : e;
143
169
  }
144
- function he(t) {
170
+ function Se(t) {
145
171
  const e = t.trim();
146
172
  if (!e) return "";
147
- const n = J(e);
173
+ const n = z(e);
148
174
  if (!n) return e;
149
- const o = e.replace(/\D/g, "");
150
- return o.length === 11 && o.startsWith("1") ? `1${n}` : n;
175
+ const i = e.replace(/\D/g, "");
176
+ return i.length === 11 && i.startsWith("1") ? `1${n}` : n;
151
177
  }
152
- const be = {
178
+ const qe = {
153
179
  firstname: {
154
180
  name: "firstname",
155
181
  control: "text",
156
182
  label: "First name",
157
183
  autoComplete: "given-name",
158
- validate: z("First name")
184
+ validate: O("First name")
159
185
  },
160
186
  lastname: {
161
187
  name: "lastname",
162
188
  control: "text",
163
189
  label: "Last name",
164
190
  autoComplete: "family-name",
165
- validate: z("Last name")
191
+ validate: O("Last name")
166
192
  },
167
193
  email: {
168
194
  name: "email",
@@ -171,7 +197,7 @@ const be = {
171
197
  autoComplete: "email",
172
198
  validate: (t, e) => {
173
199
  const n = t.trim();
174
- return n ? te(n) || "Enter a valid email" : e ? "Email is required" : !0;
200
+ return n ? ee(n) || "Enter a valid email" : e ? "Email is required" : !0;
175
201
  }
176
202
  },
177
203
  phone: {
@@ -181,217 +207,202 @@ const be = {
181
207
  autoComplete: "tel",
182
208
  validate: (t, e) => {
183
209
  const n = t.trim();
184
- return n ? J(n) ? !0 : "Enter a valid phone number" : e ? "Phone is required" : !0;
210
+ return n ? z(n) ? !0 : "Enter a valid phone number" : e ? "Phone is required" : !0;
185
211
  },
186
- serialize: he
212
+ serialize: Se
187
213
  }
188
214
  };
189
- function j(t) {
190
- return be[t];
215
+ function B(t) {
216
+ return qe[t];
191
217
  }
192
- function R({
218
+ function V({
193
219
  className: t,
194
220
  appearance: e,
195
221
  variantValue: n,
196
- kind: o,
197
- children: l
222
+ kind: i,
223
+ children: a
198
224
  }) {
199
- return /* @__PURE__ */ s(
225
+ return /* @__PURE__ */ l(
200
226
  "div",
201
227
  {
202
228
  className: `usgb-form ${t ?? ""}`,
203
229
  "data-appearance": e,
204
230
  ...n ? { "data-variant": n } : {},
205
- "data-kind": o,
206
- children: l
231
+ "data-kind": i,
232
+ children: a
207
233
  }
208
234
  );
209
235
  }
210
- const _e = [
236
+ const Ce = [
211
237
  "hubspot_utk",
212
238
  "ga_client_id",
213
239
  "ga_session_id",
214
240
  "snowplow_id",
215
241
  "vwo_uuid"
216
242
  ];
217
- function L(t, e) {
243
+ function C(t, e) {
218
244
  return t === "collected" && e != null && e !== "" ? { status: "collected", value: e } : { status: t };
219
245
  }
220
- function we(t) {
221
- const { trackingFields: e, trackingRegistry: n, adapter: o } = t, l = o.getTrackingHints(), a = {};
222
- for (const i of e) {
223
- const r = n[i];
224
- if (!r) continue;
225
- const c = new Set(r.states);
226
- if (r.collection === "server") {
227
- a[i] = L("unavailable");
246
+ function Le(t) {
247
+ const { trackingFields: e, trackingRegistry: n, adapter: i } = t, a = i.getTrackingHints(), s = {};
248
+ for (const r of e) {
249
+ const o = n[r];
250
+ if (!o) continue;
251
+ const c = new Set(o.states);
252
+ if (o.collection === "server") {
253
+ s[r] = C("unavailable");
228
254
  continue;
229
255
  }
230
- if (r.collection === "browser") {
231
- if (i === "referrer" && typeof document < "u") {
256
+ if (o.collection === "browser") {
257
+ if (r === "referrer" && typeof document < "u") {
232
258
  const f = document.referrer;
233
- a[i] = f ? L("collected", f) : L("unavailable");
259
+ s[r] = f ? C("collected", f) : C("unavailable");
234
260
  } else
235
- a[i] = L("unavailable");
261
+ s[r] = C("unavailable");
236
262
  continue;
237
263
  }
238
- const d = l[i];
239
- if (d != null && d !== "") {
240
- a[i] = L("collected", d);
264
+ const u = a[r];
265
+ if (u != null && u !== "") {
266
+ s[r] = C("collected", u);
241
267
  continue;
242
268
  }
243
- if (_e.includes(i) && c.has("consent-withheld")) {
244
- a[i] = L("unavailable");
269
+ if (Ce.includes(r) && c.has("consent-withheld")) {
270
+ s[r] = C("unavailable");
245
271
  continue;
246
272
  }
247
- a[i] = L("unavailable");
273
+ s[r] = C("unavailable");
248
274
  }
249
- return a;
275
+ return s;
250
276
  }
251
- function ke() {
277
+ function Ne() {
252
278
  return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `usgb-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
253
279
  }
254
- function ye(t, e) {
280
+ function Ee(t, e) {
255
281
  const n = {};
256
- for (const o of t)
257
- n[o.name] = "";
258
- for (const o of e)
259
- n[o] = !1;
282
+ for (const i of t)
283
+ n[i.name] = "";
284
+ for (const i of e)
285
+ n[i] = !1;
260
286
  return n;
261
287
  }
262
- function M(t) {
288
+ function R(t) {
263
289
  const e = t == null ? void 0 : t.trim();
264
290
  return e || void 0;
265
291
  }
266
- function ve({
292
+ function De({
267
293
  formId: t,
268
294
  definition: e,
269
- variantValue: n,
270
- source: o,
271
- campaign: l,
272
- successUrl: a,
273
- adapter: i,
274
- analytics: r,
295
+ source: n,
296
+ campaign: i,
297
+ legalUrls: a,
298
+ successUrl: s,
299
+ adapter: r,
300
+ analytics: o,
275
301
  onAccepted: c,
276
- onFailed: d
302
+ onFailed: u
277
303
  }) {
278
- const f = ne(), h = e.consent, w = h ? Z(
279
- h.definitionId,
280
- h.definitionVersion
281
- ) : void 0, g = P(
282
- () => (w == null ? void 0 : w.items.filter(
283
- (_) => _.type === "checkbox"
284
- )) ?? [],
285
- [w]
286
- ), k = P(
287
- () => g.map((_) => _.name),
288
- [g]
289
- ), u = P(
290
- () => ye(e.fields, k),
291
- [e.fields, k]
304
+ const f = te(), b = D(
305
+ () => W(e.consents) ?? [],
306
+ [e.consents]
307
+ ), y = D(
308
+ () => b.filter(we).map((w) => w.name),
309
+ [b]
310
+ ), p = D(
311
+ () => Ee(e.fields, y),
312
+ [e.fields, y]
292
313
  ), {
293
- register: m,
294
- handleSubmit: N,
295
- formState: { errors: b }
296
- } = oe({
297
- defaultValues: u
298
- }), [q, C] = ie({ kind: "idle" });
299
- re(() => {
300
- r == null || r({ type: "view", formId: t });
301
- }, [r, t]);
302
- const T = P(() => {
303
- const _ = {};
304
- for (const S of e.fields)
305
- _[S.name] = `${f}-${S.name}`;
306
- for (const S of k)
307
- _[S] = `${f}-${S}`;
308
- return _;
309
- }, [f, e.fields, k]), I = N(async (_) => {
310
- const S = Object.keys(b);
311
- if (S.length) {
312
- r == null || r({
314
+ register: _,
315
+ handleSubmit: m,
316
+ formState: { errors: d }
317
+ } = re({
318
+ defaultValues: p
319
+ }), [q, h] = ne({ kind: "idle" });
320
+ ie(() => {
321
+ o == null || o({ type: "view", formId: t });
322
+ }, [o, t]);
323
+ const L = D(() => {
324
+ const w = {};
325
+ for (const v of e.fields)
326
+ w[v.name] = `${f}-${v.name}`;
327
+ for (const v of y)
328
+ w[v] = `${f}-${v}`;
329
+ return w;
330
+ }, [f, e.fields, y]), x = m(async (w) => {
331
+ const v = Object.keys(d);
332
+ if (v.length) {
333
+ o == null || o({
313
334
  type: "validation_failure",
314
335
  formId: t,
315
- fields: S
336
+ fields: v
316
337
  });
317
338
  return;
318
339
  }
319
- r == null || r({ type: "submit_attempt", formId: t }), C({ kind: "submitting" });
320
- const W = /* @__PURE__ */ new Date(), G = W.toISOString().slice(0, 10), ee = we({
340
+ o == null || o({ type: "submit_attempt", formId: t }), h({ kind: "submitting" });
341
+ const F = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), J = Le({
321
342
  trackingFields: e.trackingFields,
322
- trackingRegistry: D.trackingRegistry,
323
- adapter: i
324
- }), E = {};
325
- for (const y of e.fields) {
326
- const v = _[y.name];
327
- if (typeof v != "string") {
328
- E[y.name] = !!v;
343
+ trackingRegistry: I.trackingRegistry,
344
+ adapter: r
345
+ }), A = {};
346
+ for (const k of e.fields) {
347
+ const S = w[k.name];
348
+ if (typeof S != "string") {
349
+ A[k.name] = !!S;
329
350
  continue;
330
351
  }
331
- const A = j(y.name);
332
- E[y.name] = A != null && A.serialize ? A.serialize(v) : v.trim();
352
+ const U = B(k.name);
353
+ A[k.name] = U != null && U.serialize ? U.serialize(S) : S.trim();
333
354
  }
334
- let H;
335
- if (h && w) {
336
- const y = {};
337
- for (const v of g)
338
- y[v.name] = !!_[v.name], E[v.name] = !!_[v.name];
339
- h.submitFields.includes("tcpa_form_opt_in_date") && (y.tcpa_form_opt_in_date = G, E.tcpa_form_opt_in_date = G), H = {
340
- definitionId: h.definitionId,
341
- definitionVersion: h.definitionVersion,
342
- values: y,
343
- timestamp: W.toISOString(),
344
- source: o,
345
- placement: n || e.kind
346
- };
347
- }
348
- const V = {
355
+ const Q = _e(
356
+ b,
357
+ w,
358
+ a ?? {},
359
+ F
360
+ ), T = {
349
361
  formId: t,
350
362
  definitionVersion: e.definitionVersion,
351
- submissionContractVersion: D.submissionContract.version,
352
- idempotencyKey: ke(),
353
- data: E,
354
- consent: H,
363
+ submissionContractVersion: I.submissionContract.version,
364
+ idempotencyKey: Ne(),
365
+ data: A,
366
+ consents: Q,
355
367
  context: {
356
- host: i.host,
357
- source: o,
358
- campaign: l,
368
+ host: r.host,
369
+ source: n,
370
+ campaign: i,
359
371
  page: typeof window < "u" ? window.location.href : void 0,
360
- tracking: ee
372
+ tracking: J
361
373
  }
362
374
  };
363
375
  try {
364
- const y = await i.submit(V);
365
- if (y.status === "accepted") {
366
- r == null || r({ type: "success", formId: t, status: "accepted" }), c == null || c(V), C({ kind: "accepted" });
367
- const v = M(a);
368
- v && typeof window < "u" && window.location.assign(v);
376
+ const k = await r.submit(T);
377
+ if (k.status === "accepted") {
378
+ o == null || o({ type: "success", formId: t, status: "accepted" }), c == null || c(T), h({ kind: "accepted" });
379
+ const S = R(s);
380
+ S && typeof window < "u" && window.location.assign(S);
369
381
  } else
370
- C({
382
+ h({
371
383
  kind: "failed",
372
- message: y.message ?? "Submission failed"
373
- }), r == null || r({
384
+ message: k.message ?? "Submission failed"
385
+ }), o == null || o({
374
386
  type: "failure",
375
387
  formId: t,
376
- message: y.message
377
- }), d == null || d(V, y.message);
378
- } catch (y) {
379
- const v = y instanceof Error ? y.message : "Submission failed";
380
- C({ kind: "failed", message: v }), r == null || r({ type: "failure", formId: t, message: v }), d == null || d(V, v);
388
+ message: k.message
389
+ }), u == null || u(T, k.message);
390
+ } catch (k) {
391
+ const S = k instanceof Error ? k.message : "Submission failed";
392
+ h({ kind: "failed", message: S }), o == null || o({ type: "failure", formId: t, message: S }), u == null || u(T, S);
381
393
  }
382
394
  });
383
395
  return {
384
- register: m,
385
- errors: b,
386
- fieldIds: T,
387
- consentDef: w,
388
- consentCheckboxes: g,
396
+ register: _,
397
+ errors: d,
398
+ fieldIds: L,
399
+ consentDefs: b,
389
400
  uiState: q,
390
- onSubmit: I
401
+ onSubmit: x
391
402
  };
392
403
  }
393
- function Ce() {
394
- return /* @__PURE__ */ p(
404
+ function Pe() {
405
+ return /* @__PURE__ */ g(
395
406
  "svg",
396
407
  {
397
408
  className: "usgb-field-error-icon",
@@ -403,7 +414,7 @@ function Ce() {
403
414
  "aria-hidden": "true",
404
415
  focusable: "false",
405
416
  children: [
406
- /* @__PURE__ */ s(
417
+ /* @__PURE__ */ l(
407
418
  "path",
408
419
  {
409
420
  d: "M7 13C10.3137 13 13 10.3137 13 7C13 3.68629 10.3137 1 7 1C3.68629 1 1 3.68629 1 7C1 10.3137 3.68629 13 7 13Z",
@@ -412,7 +423,7 @@ function Ce() {
412
423
  strokeWidth: "0.7"
413
424
  }
414
425
  ),
415
- /* @__PURE__ */ s(
426
+ /* @__PURE__ */ l(
416
427
  "path",
417
428
  {
418
429
  d: "M6.31724 3.75816L6.42662 8.16962H7.57506L7.68444 3.75816H6.31724ZM7.00084 10.4483C7.41555 10.4483 7.74367 10.1338 7.74367 9.73277C7.74367 9.33173 7.41555 9.01727 7.00084 9.01727C6.58613 9.01727 6.258 9.33173 6.258 9.73277C6.258 10.1338 6.58613 10.4483 7.00084 10.4483Z",
@@ -423,8 +434,8 @@ function Ce() {
423
434
  }
424
435
  );
425
436
  }
426
- function Se() {
427
- return /* @__PURE__ */ s(
437
+ function xe() {
438
+ return /* @__PURE__ */ l(
428
439
  "svg",
429
440
  {
430
441
  className: "usgb-form-checkbox-mark",
@@ -435,7 +446,7 @@ function Se() {
435
446
  xmlns: "http://www.w3.org/2000/svg",
436
447
  "aria-hidden": "true",
437
448
  focusable: "false",
438
- children: /* @__PURE__ */ s(
449
+ children: /* @__PURE__ */ l(
439
450
  "path",
440
451
  {
441
452
  d: "M1 3.5L2.33333 4.75L3.66667 6L9 1",
@@ -453,184 +464,175 @@ function K({
453
464
  message: e,
454
465
  className: n
455
466
  }) {
456
- return e ? /* @__PURE__ */ p(
467
+ return e ? /* @__PURE__ */ g(
457
468
  "span",
458
469
  {
459
470
  id: t,
460
471
  role: "alert",
461
- className: x("usgb-field-error", n),
472
+ className: P("usgb-field-error", n),
462
473
  children: [
463
- /* @__PURE__ */ s(Ce, {}),
474
+ /* @__PURE__ */ l(Pe, {}),
464
475
  e
465
476
  ]
466
477
  }
467
478
  ) : null;
468
479
  }
469
- const qe = O(
470
- function({ id: e, label: n, errorMessage: o, required: l, className: a, ...i }, r) {
471
- const c = o ? `${e}-error` : void 0;
472
- return /* @__PURE__ */ p("div", { className: "usgb-form-group", children: [
473
- /* @__PURE__ */ p("div", { className: "usgb-consent-row", children: [
474
- /* @__PURE__ */ p("span", { className: "usgb-form-checkbox-wrap", children: [
475
- /* @__PURE__ */ s(
480
+ const Fe = $(
481
+ function({ id: e, label: n, errorMessage: i, required: a, className: s, ...r }, o) {
482
+ const c = i ? `${e}-error` : void 0;
483
+ return /* @__PURE__ */ g("div", { className: "usgb-form-group", children: [
484
+ /* @__PURE__ */ g("div", { className: "usgb-consent-row", children: [
485
+ /* @__PURE__ */ g("span", { className: "usgb-form-checkbox-wrap", children: [
486
+ /* @__PURE__ */ l(
476
487
  "input",
477
488
  {
478
- ref: r,
489
+ ref: o,
479
490
  id: e,
480
491
  type: "checkbox",
481
- className: x("usgb-form-checkbox", a),
482
- "aria-invalid": o ? !0 : void 0,
492
+ className: P("usgb-form-checkbox", s),
493
+ "aria-invalid": i ? !0 : void 0,
483
494
  "aria-describedby": c,
484
- "aria-required": l || void 0,
485
- ...i
495
+ "aria-required": a || void 0,
496
+ ...r
486
497
  }
487
498
  ),
488
- /* @__PURE__ */ s(Se, {})
499
+ /* @__PURE__ */ l(xe, {})
489
500
  ] }),
490
- /* @__PURE__ */ s("label", { htmlFor: e, className: "usgb-consent-copy", children: n })
501
+ /* @__PURE__ */ l("label", { htmlFor: e, className: "usgb-consent-copy", children: n })
491
502
  ] }),
492
- /* @__PURE__ */ s(K, { id: c, message: o })
503
+ /* @__PURE__ */ l(K, { id: c, message: i })
493
504
  ] });
494
505
  }
495
- ), Q = O(
506
+ ), Y = $(
496
507
  function({
497
508
  className: e,
498
509
  variant: n = "primary",
499
- loading: o = !1,
500
- disabled: l = !1,
501
- children: a,
502
- ...i
503
- }, r) {
504
- return /* @__PURE__ */ s(
510
+ loading: i = !1,
511
+ disabled: a = !1,
512
+ children: s,
513
+ ...r
514
+ }, o) {
515
+ return /* @__PURE__ */ l(
505
516
  "button",
506
517
  {
507
- ref: r,
508
- type: i.type ?? "button",
509
- className: x(
518
+ ref: o,
519
+ type: r.type ?? "button",
520
+ className: P(
510
521
  "usgb-btn",
511
522
  n === "primary" && "usgb-btn-primary",
512
523
  e
513
524
  ),
514
- disabled: l || o,
515
- "aria-busy": o || void 0,
516
- ...i,
517
- children: o ? "Submitting…" : a
525
+ disabled: a || i,
526
+ "aria-busy": i || void 0,
527
+ ...r,
528
+ children: i ? "Submitting…" : s
518
529
  }
519
530
  );
520
531
  }
521
- ), Be = {
522
- clientAgreement: "/content/client-agreement",
523
- privacyPolicy: "/content/privacy-policy"
524
- };
525
- function Ne(t, e = ["clientAgreement", "privacyPolicy"]) {
526
- return e.every((n) => {
527
- var o;
528
- return !!((o = t == null ? void 0 : t[n]) != null && o.trim());
529
- });
530
- }
531
- function Le(t) {
532
+ );
533
+ function Te(t) {
532
534
  const e = [];
533
535
  let n = 0;
534
536
  for (; n < t.length; ) {
535
- const o = t[n];
536
- if (o.group) {
537
- const l = o.group, a = [];
538
- for (; n < t.length && t[n].group === l; )
539
- a.push(t[n]), n += 1;
540
- e.push({ type: "group", group: l, fields: a });
537
+ const i = t[n];
538
+ if (i.group) {
539
+ const a = i.group, s = [];
540
+ for (; n < t.length && t[n].group === a; )
541
+ s.push(t[n]), n += 1;
542
+ e.push({ type: "group", group: a, fields: s });
541
543
  continue;
542
544
  }
543
- e.push({ type: "field", field: o }), n += 1;
545
+ e.push({ type: "field", field: i }), n += 1;
544
546
  }
545
547
  return e;
546
548
  }
547
- function Ee({
549
+ function Ue({
548
550
  htmlFor: t,
549
551
  children: e,
550
552
  className: n,
551
- required: o
553
+ required: i
552
554
  }) {
553
- return /* @__PURE__ */ p("label", { htmlFor: t, className: x("usgb-field-label", n), children: [
555
+ return /* @__PURE__ */ g("label", { htmlFor: t, className: P("usgb-field-label", n), children: [
554
556
  e,
555
- o ? /* @__PURE__ */ s("span", { className: "usgb-field-label-asterisk", "aria-hidden": "true", children: "*" }) : null
557
+ i ? /* @__PURE__ */ l("span", { className: "usgb-field-label-asterisk", "aria-hidden": "true", children: "*" }) : null
556
558
  ] });
557
559
  }
558
- function Fe(t) {
560
+ function Ie(t) {
559
561
  return t.replace(/\b\w/g, (e) => e.toUpperCase());
560
562
  }
561
- const Pe = O(
563
+ const Ae = $(
562
564
  function({
563
565
  id: e,
564
566
  label: n,
565
- type: o = "text",
566
- errorMessage: l,
567
- required: a,
568
- hideLabel: i = !1,
569
- placeholderCase: r = "upper",
567
+ type: i = "text",
568
+ errorMessage: a,
569
+ required: s,
570
+ hideLabel: r = !1,
571
+ placeholderCase: o = "upper",
570
572
  showError: c = !0,
571
- className: d,
573
+ className: u,
572
574
  placeholder: f,
573
- ...h
574
- }, w) {
575
- const g = l ? `${e}-error` : void 0, k = i ? `${n}${a ? "*" : ""}` : f, u = i && k ? r === "title" ? Fe(k) : k.toUpperCase() : k;
576
- return /* @__PURE__ */ p("div", { className: "usgb-form-group", children: [
577
- /* @__PURE__ */ s(
578
- Ee,
575
+ ...b
576
+ }, y) {
577
+ const p = a ? `${e}-error` : void 0, _ = r ? `${n}${s ? "*" : ""}` : f, m = r && _ ? o === "title" ? Ie(_) : _.toUpperCase() : _;
578
+ return /* @__PURE__ */ g("div", { className: "usgb-form-group", children: [
579
+ /* @__PURE__ */ l(
580
+ Ue,
579
581
  {
580
582
  htmlFor: e,
581
- required: a,
582
- className: i ? "usgb-field-label--sr-only" : void 0,
583
+ required: s,
584
+ className: r ? "usgb-field-label--sr-only" : void 0,
583
585
  children: n
584
586
  }
585
587
  ),
586
- /* @__PURE__ */ s(
588
+ /* @__PURE__ */ l(
587
589
  "input",
588
590
  {
589
- ref: w,
591
+ ref: y,
590
592
  id: e,
591
- type: o,
592
- className: x(
593
+ type: i,
594
+ className: P(
593
595
  "usgb-field-control",
594
- l && "usgb-field-invalid",
595
- d
596
+ a && "usgb-field-invalid",
597
+ u
596
598
  ),
597
- placeholder: u,
598
- "aria-invalid": l ? !0 : void 0,
599
- "aria-describedby": g,
600
- "aria-required": a || void 0,
601
- ...h
599
+ placeholder: m,
600
+ "aria-invalid": a ? !0 : void 0,
601
+ "aria-describedby": p,
602
+ "aria-required": s || void 0,
603
+ ...b
602
604
  }
603
605
  ),
604
- c ? /* @__PURE__ */ s(K, { id: g, message: l }) : null
606
+ c ? /* @__PURE__ */ l(K, { id: p, message: a }) : null
605
607
  ] });
606
608
  }
607
609
  );
608
- function B({
610
+ function M({
609
611
  fieldRef: t,
610
612
  fieldIds: e,
611
613
  register: n,
612
- errors: o,
613
- hideLabel: l,
614
- placeholderCase: a,
615
- showError: i = !0
614
+ errors: i,
615
+ hideLabel: a,
616
+ placeholderCase: s,
617
+ showError: r = !0
616
618
  }) {
617
- const r = j(t.name);
618
- if (!r) return null;
619
- const c = o[t.name], d = typeof (c == null ? void 0 : c.message) == "string" ? c.message : void 0;
620
- return /* @__PURE__ */ s(
621
- Pe,
619
+ const o = B(t.name);
620
+ if (!o) return null;
621
+ const c = i[t.name], u = typeof (c == null ? void 0 : c.message) == "string" ? c.message : void 0;
622
+ return /* @__PURE__ */ l(
623
+ Ae,
622
624
  {
623
625
  id: e[t.name],
624
- label: r.label,
625
- type: r.control,
626
+ label: o.label,
627
+ type: o.control,
626
628
  required: t.required,
627
- hideLabel: l,
628
- placeholderCase: a,
629
- showError: i,
630
- autoComplete: r.autoComplete,
631
- errorMessage: d,
629
+ hideLabel: a,
630
+ placeholderCase: s,
631
+ showError: r,
632
+ autoComplete: o.autoComplete,
633
+ errorMessage: u,
632
634
  ...n(t.name, {
633
- validate: (f) => r.validate(
635
+ validate: (f) => o.validate(
634
636
  typeof f == "string" ? f : "",
635
637
  t.required
636
638
  )
@@ -638,400 +640,415 @@ function B({
638
640
  }
639
641
  );
640
642
  }
641
- function xe({
643
+ function Ve({
642
644
  definition: t,
643
645
  variants: e,
644
646
  ctaLabel: n,
645
- legalUrls: o,
646
- session: l
647
+ legalUrls: i,
648
+ session: a
647
649
  }) {
648
- const { register: a, errors: i, fieldIds: r, consentDef: c, uiState: d, onSubmit: f } = l, h = P(
649
- () => Le(t.fields),
650
+ const { register: s, errors: r, fieldIds: o, consentDefs: c, uiState: u, onSubmit: f } = a, b = D(
651
+ () => Te(t.fields),
650
652
  [t.fields]
651
- ), w = e.includes("sidebar"), g = e.includes("dense") || w, k = w ? "title" : "upper";
652
- return /* @__PURE__ */ p("form", { onSubmit: f, noValidate: !0, children: [
653
- h.map((u) => u.type === "group" ? /* @__PURE__ */ s(
653
+ ), y = e.includes("sidebar"), p = e.includes("dense") || y, _ = y ? "title" : "upper";
654
+ return /* @__PURE__ */ g("form", { onSubmit: f, noValidate: !0, children: [
655
+ b.map((m) => m.type === "group" ? /* @__PURE__ */ l(
654
656
  "div",
655
657
  {
656
658
  className: "usgb-form-grid",
657
- children: u.fields.map((m) => /* @__PURE__ */ s(
658
- B,
659
+ children: m.fields.map((d) => /* @__PURE__ */ l(
660
+ M,
659
661
  {
660
- fieldRef: m,
661
- fieldIds: r,
662
- register: a,
663
- errors: i,
664
- hideLabel: g,
665
- placeholderCase: k
662
+ fieldRef: d,
663
+ fieldIds: o,
664
+ register: s,
665
+ errors: r,
666
+ hideLabel: p,
667
+ placeholderCase: _
666
668
  },
667
- m.name
669
+ d.name
668
670
  ))
669
671
  },
670
- `group-${u.group}-${u.fields.map((m) => m.name).join("-")}`
671
- ) : /* @__PURE__ */ s(
672
- B,
672
+ `group-${m.group}-${m.fields.map((d) => d.name).join("-")}`
673
+ ) : /* @__PURE__ */ l(
674
+ M,
673
675
  {
674
- fieldRef: u.field,
675
- fieldIds: r,
676
- register: a,
677
- errors: i,
678
- hideLabel: g,
679
- placeholderCase: k
676
+ fieldRef: m.field,
677
+ fieldIds: o,
678
+ register: s,
679
+ errors: r,
680
+ hideLabel: p,
681
+ placeholderCase: _
680
682
  },
681
- u.field.name
683
+ m.field.name
682
684
  )),
683
- c && Ne(o, c.requiredLegalUrls) ? c.items.map((u, m) => {
684
- const N = fe(
685
- u.content,
686
- o
685
+ c.map((m) => {
686
+ const { content: d } = j(
687
+ m.copy,
688
+ i ?? {}
687
689
  );
688
- if (u.type === "notice")
689
- return /* @__PURE__ */ s(
690
+ if (m.type === "notice")
691
+ return /* @__PURE__ */ l(
690
692
  "p",
691
693
  {
692
694
  className: "usgb-consent-copy usgb-consent-notice",
693
- children: N
695
+ children: d
694
696
  },
695
- `notice-${m}`
697
+ m.definitionId
696
698
  );
697
- const b = i[u.name], q = typeof (b == null ? void 0 : b.message) == "string" ? b.message : void 0;
698
- return /* @__PURE__ */ s(
699
- qe,
699
+ const q = r[m.name], h = typeof (q == null ? void 0 : q.message) == "string" ? q.message : void 0;
700
+ return /* @__PURE__ */ l(
701
+ Fe,
700
702
  {
701
- id: r[u.name],
702
- label: N,
703
- required: u.required,
704
- errorMessage: q,
705
- ...a(u.name, {
706
- required: u.required ? "This field is required" : !1
703
+ id: o[m.name],
704
+ label: d,
705
+ required: m.required,
706
+ errorMessage: h,
707
+ ...s(m.name, {
708
+ required: m.required ? "This field is required" : !1
707
709
  })
708
710
  },
709
- u.name
711
+ m.name
710
712
  );
711
- }) : null,
712
- /* @__PURE__ */ s(Q, { type: "submit", loading: d.kind === "submitting", children: n }),
713
- d.kind === "failed" ? /* @__PURE__ */ s(
713
+ }),
714
+ /* @__PURE__ */ l(Y, { type: "submit", loading: u.kind === "submitting", children: n }),
715
+ u.kind === "failed" ? /* @__PURE__ */ l(
714
716
  "p",
715
717
  {
716
718
  className: "usgb-form-status usgb-form-status-error",
717
719
  role: "alert",
718
- children: d.message ?? "Something went wrong. Please try again."
720
+ children: u.message ?? "Something went wrong. Please try again."
719
721
  }
720
722
  ) : null
721
723
  ] });
722
724
  }
723
- function Te({
725
+ function Re({
724
726
  definition: t,
725
727
  ctaLabel: e,
726
728
  session: n
727
729
  }) {
728
730
  var f;
729
- const { register: o, errors: l, fieldIds: a, uiState: i, onSubmit: r } = n, c = t.fields.find((h) => h.name === "email"), d = typeof ((f = l.email) == null ? void 0 : f.message) == "string" ? l.email.message : void 0;
730
- return c ? /* @__PURE__ */ p("form", { onSubmit: r, noValidate: !0, children: [
731
- /* @__PURE__ */ p("div", { className: "usgb-form-inline", children: [
732
- /* @__PURE__ */ s(
733
- B,
731
+ const { register: i, errors: a, fieldIds: s, uiState: r, onSubmit: o } = n, c = t.fields.find((b) => b.name === "email"), u = typeof ((f = a.email) == null ? void 0 : f.message) == "string" ? a.email.message : void 0;
732
+ return c ? /* @__PURE__ */ g("form", { onSubmit: o, noValidate: !0, children: [
733
+ /* @__PURE__ */ g("div", { className: "usgb-form-inline", children: [
734
+ /* @__PURE__ */ l(
735
+ M,
734
736
  {
735
737
  fieldRef: c,
736
- fieldIds: a,
737
- register: o,
738
- errors: l,
738
+ fieldIds: s,
739
+ register: i,
740
+ errors: a,
739
741
  hideLabel: !0,
740
742
  placeholderCase: "upper",
741
743
  showError: !1
742
744
  }
743
745
  ),
744
- /* @__PURE__ */ s(Q, { type: "submit", loading: i.kind === "submitting", children: e })
746
+ /* @__PURE__ */ l(Y, { type: "submit", loading: r.kind === "submitting", children: e })
745
747
  ] }),
746
- /* @__PURE__ */ s(
748
+ /* @__PURE__ */ l(
747
749
  K,
748
750
  {
749
- id: d ? `${a.email}-error` : void 0,
750
- message: d
751
+ id: u ? `${s.email}-error` : void 0,
752
+ message: u
751
753
  }
752
754
  ),
753
- i.kind === "failed" ? /* @__PURE__ */ s(
755
+ r.kind === "failed" ? /* @__PURE__ */ l(
754
756
  "p",
755
757
  {
756
758
  className: "usgb-form-status usgb-form-status-error",
757
759
  role: "alert",
758
- children: i.message ?? "Something went wrong. Please try again."
760
+ children: r.message ?? "Something went wrong. Please try again."
759
761
  }
760
762
  ) : null
761
- ] }) : /* @__PURE__ */ s("p", { className: "usgb-form-status usgb-form-status-error", role: "alert", children: "Newsletter kind requires an email field" });
763
+ ] }) : /* @__PURE__ */ l("p", { className: "usgb-form-status usgb-form-status-error", role: "alert", children: "Newsletter kind requires an email field" });
762
764
  }
763
- const X = {
764
- lead: xe,
765
- newsletter: Te
766
- }, Ie = "Thank you. Your request has been accepted and is being processed.";
767
- function F({
765
+ const Z = {
766
+ lead: Ve,
767
+ newsletter: Re
768
+ }, Me = "Thank you. Your request has been accepted and is being processed.";
769
+ function E({
768
770
  className: t,
769
771
  appearance: e,
770
772
  variantValue: n,
771
- kind: o,
772
- children: l
773
+ kind: i,
774
+ children: a
773
775
  }) {
774
- return /* @__PURE__ */ s(
775
- R,
776
+ return /* @__PURE__ */ l(
777
+ V,
776
778
  {
777
779
  className: t,
778
780
  appearance: e,
779
781
  variantValue: n,
780
- kind: o,
781
- children: /* @__PURE__ */ s("p", { className: "usgb-form-status usgb-form-status-error", role: "alert", children: l })
782
+ kind: i,
783
+ children: /* @__PURE__ */ l("p", { className: "usgb-form-status usgb-form-status-error", role: "alert", children: a })
782
784
  }
783
785
  );
784
786
  }
785
- function Ve({
787
+ function $e({
786
788
  formId: t,
787
789
  definition: e,
788
790
  appearance: n,
789
- variants: o,
790
- variantValue: l,
791
- heading: a,
792
- body: i,
793
- ctaLabel: r,
791
+ variants: i,
792
+ variantValue: a,
793
+ heading: s,
794
+ subheading: r,
795
+ ctaLabel: o,
794
796
  source: c,
795
- campaign: d,
797
+ campaign: u,
796
798
  legalUrls: f,
797
- successMessage: h,
798
- successUrl: w,
799
- adapter: g,
800
- analytics: k,
801
- className: u,
802
- onAccepted: m,
803
- onFailed: N
799
+ successMessage: b,
800
+ successUrl: y,
801
+ adapter: p,
802
+ analytics: _,
803
+ className: m,
804
+ onAccepted: d,
805
+ onFailed: q
804
806
  }) {
805
- const b = ve({
807
+ const h = De({
806
808
  formId: t,
807
809
  definition: e,
808
- variantValue: l,
810
+ variantValue: a,
809
811
  source: c,
810
- campaign: d,
811
- successUrl: w,
812
- adapter: g,
813
- analytics: k,
814
- onAccepted: m,
815
- onFailed: N
812
+ campaign: u,
813
+ legalUrls: f,
814
+ successUrl: y,
815
+ adapter: p,
816
+ analytics: _,
817
+ onAccepted: d,
818
+ onFailed: q
816
819
  });
817
- if (b.uiState.kind === "accepted") {
818
- const C = !!M(w);
819
- return /* @__PURE__ */ p(
820
- R,
820
+ if (h.uiState.kind === "accepted") {
821
+ const x = !!R(y);
822
+ return /* @__PURE__ */ g(
823
+ V,
821
824
  {
822
- className: u,
825
+ className: m,
823
826
  appearance: n,
824
- variantValue: l,
827
+ variantValue: a,
825
828
  kind: e.kind,
826
829
  children: [
827
- a ? /* @__PURE__ */ s("h2", { className: "usgb-form-heading", children: a }) : null,
828
- C ? null : /* @__PURE__ */ s(
830
+ s ? /* @__PURE__ */ l("h2", { className: "usgb-form-heading", children: s }) : null,
831
+ x ? null : /* @__PURE__ */ l(
829
832
  "p",
830
833
  {
831
834
  className: "usgb-form-status usgb-form-status-success",
832
835
  role: "status",
833
- children: M(h) ?? Ie
836
+ children: R(b) ?? Me
834
837
  }
835
838
  )
836
839
  ]
837
840
  }
838
841
  );
839
842
  }
840
- const q = X[e.kind];
841
- return /* @__PURE__ */ p(
842
- R,
843
+ const L = Z[e.kind];
844
+ return /* @__PURE__ */ g(
845
+ V,
843
846
  {
844
- className: u,
847
+ className: m,
845
848
  appearance: n,
846
- variantValue: l,
849
+ variantValue: a,
847
850
  kind: e.kind,
848
851
  children: [
849
- a ? /* @__PURE__ */ s("h2", { className: "usgb-form-heading", children: a }) : null,
850
- i ? /* @__PURE__ */ s("p", { className: "usgb-form-body", children: i }) : null,
851
- /* @__PURE__ */ s(
852
- q,
852
+ s ? /* @__PURE__ */ l("h2", { className: "usgb-form-heading", children: s }) : null,
853
+ r ? /* @__PURE__ */ l("p", { className: "usgb-form-subheading", children: r }) : null,
854
+ /* @__PURE__ */ l(
855
+ L,
853
856
  {
854
857
  definition: e,
855
- variants: o,
856
- ctaLabel: r,
858
+ variants: i,
859
+ ctaLabel: o,
857
860
  legalUrls: f,
858
- session: b
861
+ session: h
859
862
  }
860
863
  )
861
864
  ]
862
865
  }
863
866
  );
864
867
  }
865
- function Oe({
868
+ function We({
866
869
  formId: t,
867
- appearance: e = "light",
870
+ appearance: e = "on-light",
868
871
  variants: n = ["dense"],
869
- heading: o,
870
- body: l,
871
- ctaLabel: a = "GET MY FREE GUIDE",
872
- source: i,
873
- campaign: r,
872
+ heading: i,
873
+ subheading: a,
874
+ ctaLabel: s,
875
+ source: r,
876
+ campaign: o,
874
877
  legalUrls: c,
875
- successMessage: d,
878
+ successMessage: u,
876
879
  successUrl: f,
877
- adapter: h,
878
- analytics: w,
879
- className: g,
880
- onAccepted: k,
881
- onFailed: u
880
+ adapter: b,
881
+ analytics: y,
882
+ className: p,
883
+ onAccepted: _,
884
+ onFailed: m
882
885
  }) {
883
- const m = me(t), b = (m == null ? void 0 : m.kind) === "newsletter" ? "" : n.join(" ");
884
- if (!m)
885
- return /* @__PURE__ */ p(
886
- F,
886
+ const d = ue(t), h = (d == null ? void 0 : d.kind) === "newsletter" ? "" : n.join(" ");
887
+ if (!d)
888
+ return /* @__PURE__ */ g(
889
+ E,
887
890
  {
888
- className: g,
891
+ className: p,
889
892
  appearance: e,
890
- variantValue: b,
893
+ variantValue: h,
891
894
  children: [
892
895
  "Unknown form definition: ",
893
896
  t
894
897
  ]
895
898
  }
896
899
  );
897
- const q = m.consent, C = q ? Z(
898
- q.definitionId,
899
- q.definitionVersion
900
- ) : void 0;
901
- if (q && !C)
902
- return /* @__PURE__ */ p(
903
- F,
900
+ const L = W(d.consents);
901
+ if (L === null)
902
+ return /* @__PURE__ */ g(
903
+ E,
904
904
  {
905
- className: g,
905
+ className: p,
906
906
  appearance: e,
907
- variantValue: b,
908
- kind: m.kind,
907
+ variantValue: h,
908
+ kind: d.kind,
909
909
  children: [
910
910
  "Missing consent definition for ",
911
911
  t
912
912
  ]
913
913
  }
914
914
  );
915
- const T = (C == null ? void 0 : C.requiredLegalUrls.filter(
916
- (_) => {
917
- var S;
918
- return !((S = c == null ? void 0 : c[_]) != null && S.trim());
915
+ const w = ke(L).filter(
916
+ (N) => {
917
+ var F;
918
+ return !((F = c == null ? void 0 : c[N]) != null && F.trim());
919
919
  }
920
- )) ?? [];
921
- if (C && T.length)
922
- return /* @__PURE__ */ p(
923
- F,
920
+ );
921
+ if (w.length)
922
+ return /* @__PURE__ */ g(
923
+ E,
924
924
  {
925
- className: g,
925
+ className: p,
926
926
  appearance: e,
927
- variantValue: b,
928
- kind: m.kind,
927
+ variantValue: h,
928
+ kind: d.kind,
929
929
  children: [
930
930
  "Missing legal URL(s) for ",
931
931
  t,
932
932
  ": ",
933
- T.join(", ")
933
+ w.join(", ")
934
934
  ]
935
935
  }
936
936
  );
937
- const I = m.fields.filter(
938
- (_) => !j(_.name)
937
+ const v = d.fields.filter(
938
+ (N) => !B(N.name)
939
939
  );
940
- return I.length ? /* @__PURE__ */ p(
941
- F,
940
+ return v.length ? /* @__PURE__ */ g(
941
+ E,
942
942
  {
943
- className: g,
943
+ className: p,
944
944
  appearance: e,
945
- variantValue: b,
946
- kind: m.kind,
945
+ variantValue: h,
946
+ kind: d.kind,
947
947
  children: [
948
948
  "Unknown field(s) in ",
949
949
  t,
950
950
  ":",
951
951
  " ",
952
- I.map((_) => _.name).join(", ")
952
+ v.map((N) => N.name).join(", ")
953
953
  ]
954
954
  }
955
- ) : m.kind in X ? /* @__PURE__ */ s(
956
- Ve,
955
+ ) : d.kind in Z ? /* @__PURE__ */ l(
956
+ $e,
957
957
  {
958
958
  formId: t,
959
- definition: m,
959
+ definition: d,
960
960
  appearance: e,
961
961
  variants: n,
962
- variantValue: b,
963
- heading: o,
964
- body: l,
965
- ctaLabel: a,
966
- source: i,
967
- campaign: r,
962
+ variantValue: h,
963
+ heading: i,
964
+ subheading: a,
965
+ ctaLabel: s ?? d.ctaLabel,
966
+ source: r,
967
+ campaign: o,
968
968
  legalUrls: c,
969
- successMessage: d,
969
+ successMessage: u,
970
970
  successUrl: f,
971
- adapter: h,
972
- analytics: w,
973
- className: g,
974
- onAccepted: k,
975
- onFailed: u
971
+ adapter: b,
972
+ analytics: y,
973
+ className: p,
974
+ onAccepted: _,
975
+ onFailed: m
976
976
  }
977
- ) : /* @__PURE__ */ p(
978
- F,
977
+ ) : /* @__PURE__ */ g(
978
+ E,
979
979
  {
980
- className: g,
980
+ className: p,
981
981
  appearance: e,
982
- variantValue: b,
983
- kind: m.kind,
982
+ variantValue: h,
983
+ kind: d.kind,
984
984
  children: [
985
985
  "Missing renderer for kind: ",
986
- m.kind
986
+ d.kind
987
987
  ]
988
988
  }
989
989
  );
990
990
  }
991
- function je(t = {}) {
992
- const e = typeof t == "string" ? { host: t } : t, n = e.host ?? "pwa", o = e.delayMs ?? 400, l = e.result ?? { status: "accepted" };
991
+ function ze(t = {}) {
992
+ const e = typeof t == "string" ? { host: t } : t, n = e.host ?? "pwa", i = e.delayMs ?? 400, a = e.result ?? { status: "accepted" };
993
993
  return {
994
994
  host: n,
995
995
  getTrackingHints() {
996
996
  if (typeof window > "u") return {};
997
- const a = new URLSearchParams(window.location.search), i = (r) => a.get(r) ?? void 0;
997
+ const s = new URLSearchParams(window.location.search), r = (o) => s.get(o) ?? void 0;
998
998
  return {
999
- utm_source: i("utm_source"),
1000
- utm_medium: i("utm_medium"),
1001
- utm_campaign: i("utm_campaign"),
1002
- utm_term: i("utm_term"),
1003
- utm_content: i("utm_content"),
1004
- gclid: i("gclid"),
1005
- msclkid: i("msclkid"),
1006
- gbraid: i("gbraid"),
1007
- wbraid: i("wbraid")
999
+ utm_source: r("utm_source"),
1000
+ utm_medium: r("utm_medium"),
1001
+ utm_campaign: r("utm_campaign"),
1002
+ utm_term: r("utm_term"),
1003
+ utm_content: r("utm_content"),
1004
+ gclid: r("gclid"),
1005
+ msclkid: r("msclkid"),
1006
+ gbraid: r("gbraid"),
1007
+ wbraid: r("wbraid")
1008
1008
  };
1009
1009
  },
1010
- async submit(a) {
1011
- var i;
1012
- return (i = e.onSubmit) == null || i.call(e, a), await new Promise((r) => setTimeout(r, o)), l;
1010
+ async submit(s) {
1011
+ var r;
1012
+ return (r = e.onSubmit) == null || r.call(e, s), await new Promise((o) => setTimeout(o, i)), a;
1013
1013
  }
1014
1014
  };
1015
1015
  }
1016
+ const Ye = {
1017
+ clientAgreement: "/content/client-agreement",
1018
+ privacyPolicy: "/content/privacy-policy",
1019
+ userAgreement: "/content/user-agreement",
1020
+ marketLossPolicy: "/content/market-loss-policy",
1021
+ electronicDisclaimer: "/content/electronic-disclaimer",
1022
+ termsOfSale: "/content/terms-of-sale"
1023
+ };
1024
+ function Ze(t, e) {
1025
+ return e.every((n) => {
1026
+ var i;
1027
+ return !!((i = t == null ? void 0 : t[n]) != null && i.trim());
1028
+ });
1029
+ }
1016
1030
  export {
1017
- Q as Button,
1018
- qe as ConsentField,
1019
- be as FIELD_REGISTRY,
1031
+ Y as Button,
1032
+ Fe as ConsentField,
1033
+ qe as FIELD_REGISTRY,
1020
1034
  K as FieldError,
1021
- Ee as FieldLabel,
1022
- $ as LEAD_CLICKWRAP_V1,
1023
- U as LEAD_TCPA_V1,
1024
- Be as PWA_LEGAL_URLS,
1025
- Pe as TextField,
1026
- Oe as UsgbForm,
1027
- we as collectTrackingContext,
1028
- ke as createIdempotencyKey,
1029
- je as createStubAdapter,
1030
- D as formsManifest,
1031
- Z as getConsentDefinition,
1032
- j as getFieldDefinition,
1033
- me as getFormDefinition,
1034
- Ne as isCompleteLegalUrls,
1035
- Me as listFormDefinitions,
1036
- fe as resolveConsentContent
1035
+ Ue as FieldLabel,
1036
+ pe as LEAD_CLICKWRAP,
1037
+ fe as LEAD_SMS,
1038
+ me as LEAD_TCPA,
1039
+ ge as LEAD_TOSPP,
1040
+ Ye as PWA_LEGAL_URLS,
1041
+ Ae as TextField,
1042
+ We as UsgbForm,
1043
+ Le as collectTrackingContext,
1044
+ Ne as createIdempotencyKey,
1045
+ ze as createStubAdapter,
1046
+ I as formsManifest,
1047
+ ye as getConsentDefinition,
1048
+ B as getFieldDefinition,
1049
+ ue as getFormDefinition,
1050
+ Ze as isCompleteLegalUrls,
1051
+ He as listFormDefinitions,
1052
+ j as resolveConsentCopy,
1053
+ W as resolveFormConsents
1037
1054
  };