@usgb/forms 1.0.1 → 1.0.3

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.
Files changed (42) hide show
  1. package/README.md +139 -104
  2. package/dist/forms-manifest.1.0.3.json +439 -0
  3. package/dist/forms-manifest.json +252 -64
  4. package/dist/index.js +747 -670
  5. package/dist/src/contract/createIdempotencyKey.d.ts +2 -0
  6. package/dist/src/contract/createIdempotencyKey.d.ts.map +1 -0
  7. package/dist/src/contract/createStubAdapter.d.ts.map +1 -1
  8. package/dist/src/contract/types.d.ts +21 -25
  9. package/dist/src/contract/types.d.ts.map +1 -1
  10. package/dist/src/definitions/consents.d.ts +63 -20
  11. package/dist/src/definitions/consents.d.ts.map +1 -1
  12. package/dist/src/definitions/index.d.ts +5 -4
  13. package/dist/src/definitions/index.d.ts.map +1 -1
  14. package/dist/src/definitions/manifest.d.ts +14 -1
  15. package/dist/src/definitions/manifest.d.ts.map +1 -1
  16. package/dist/src/definitions/types.d.ts +44 -9
  17. package/dist/src/definitions/types.d.ts.map +1 -1
  18. package/dist/src/form/FormShell.d.ts +2 -1
  19. package/dist/src/form/FormShell.d.ts.map +1 -1
  20. package/dist/src/form/UsgbForm.d.ts +5 -4
  21. package/dist/src/form/UsgbForm.d.ts.map +1 -1
  22. package/dist/src/form/chunkFields.d.ts +1 -1
  23. package/dist/src/form/kinds/LeadKindForm.d.ts +1 -1
  24. package/dist/src/form/kinds/LeadKindForm.d.ts.map +1 -1
  25. package/dist/src/form/kinds/NewsletterKindForm.d.ts +1 -1
  26. package/dist/src/form/kinds/NewsletterKindForm.d.ts.map +1 -1
  27. package/dist/src/form/kinds/types.d.ts +3 -1
  28. package/dist/src/form/kinds/types.d.ts.map +1 -1
  29. package/dist/src/form/useUsgbFormSession.d.ts +7 -8
  30. package/dist/src/form/useUsgbFormSession.d.ts.map +1 -1
  31. package/dist/src/index.d.ts +5 -5
  32. package/dist/src/index.d.ts.map +1 -1
  33. package/dist/src/ui/Button.d.ts.map +1 -1
  34. package/dist/src/ui/ConsentField.d.ts.map +1 -1
  35. package/dist/usgb-forms.1.0.3.js +44 -0
  36. package/dist/usgb-forms.css +98 -15
  37. package/dist/usgb-forms.js +11 -11
  38. package/forms-manifest.json +252 -64
  39. package/package.json +2 -2
  40. package/dist/src/contract/collectContext.d.ts +0 -9
  41. package/dist/src/contract/collectContext.d.ts.map +0 -1
  42. package/dist/usgb-forms.1.0.1.js +0 -44
@@ -1,13 +1,12 @@
1
1
  {
2
- "schemaVersion": "1.0.0",
2
+ "schemaVersion": "1.1.0",
3
3
  "package": {
4
4
  "name": "@usgb/forms",
5
- "compatiblePackageVersions": "^1.0.0"
5
+ "compatiblePackageVersions": "^1.0.2"
6
6
  },
7
7
  "submissionContract": {
8
8
  "version": "1.0.0",
9
- "transport": "server-proxy",
10
- "payloadShape": "data-and-context"
9
+ "transport": "server-proxy"
11
10
  },
12
11
  "trackingRegistry": {
13
12
  "page_url": {
@@ -152,97 +151,286 @@
152
151
  "states": ["collected", "unavailable"]
153
152
  }
154
153
  },
154
+ "editorOptions": {
155
+ "appearance": {
156
+ "label": "Appearance",
157
+ "control": "select",
158
+ "reactProp": "appearance",
159
+ "attribute": "appearance",
160
+ "required": false,
161
+ "default": "on-light",
162
+ "valuesFrom": "supportedAppearances",
163
+ "description": "Recolors the form for a light or dark host surface. It never paints a background, padding, or radius — the host container owns those."
164
+ },
165
+ "variant": {
166
+ "label": "Size variant",
167
+ "control": "select",
168
+ "reactProp": "variant",
169
+ "attribute": "variant",
170
+ "required": false,
171
+ "default": "dense",
172
+ "valuesFrom": "supportedVariants",
173
+ "description": "Select exactly one size treatment: `dense`, `large`, or `sidebar`."
174
+ },
175
+ "twoColumn": {
176
+ "label": "Two-column name row",
177
+ "control": "checkbox",
178
+ "reactProp": "twoColumn",
179
+ "attribute": "two-column",
180
+ "required": false,
181
+ "default": false,
182
+ "description": "Places grouped name fields in two columns when the form container is wide enough."
183
+ },
184
+ "heading": {
185
+ "label": "Heading",
186
+ "control": "text",
187
+ "reactProp": "heading",
188
+ "attribute": "heading",
189
+ "required": false,
190
+ "description": "Placement copy above the fields. Omit to render no heading."
191
+ },
192
+ "subheading": {
193
+ "label": "Subheading",
194
+ "control": "text",
195
+ "reactProp": "subheading",
196
+ "attribute": "subheading",
197
+ "required": false,
198
+ "description": "Supporting copy under the heading. Omit to render none."
199
+ },
200
+ "ctaLabel": {
201
+ "label": "Button label",
202
+ "control": "text",
203
+ "reactProp": "ctaLabel",
204
+ "attribute": "cta",
205
+ "required": false,
206
+ "defaultFrom": "ctaLabel",
207
+ "description": "Overrides the catalog submit label for this placement."
208
+ },
209
+ "legalUrls": {
210
+ "label": "Legal document URLs",
211
+ "control": "url-group",
212
+ "reactProp": "legalUrls",
213
+ "attributes": {
214
+ "clientAgreement": "client-agreement-url",
215
+ "privacyPolicy": "privacy-policy-url",
216
+ "userAgreement": "user-agreement-url",
217
+ "marketLossPolicy": "market-loss-policy-url",
218
+ "electronicDisclaimer": "electronic-disclaimer-url",
219
+ "termsOfSale": "terms-of-sale-url"
220
+ },
221
+ "required": true,
222
+ "valuesFrom": "requiredLegalUrls",
223
+ "description": "Host CMS hrefs for the documents named in this form's consent copy. Every key in `requiredLegalUrls` must be a non-empty URL or the form does not render."
224
+ },
225
+ "successMessage": {
226
+ "label": "Thank-you message",
227
+ "control": "text",
228
+ "reactProp": "successMessage",
229
+ "attribute": "success-message",
230
+ "required": false,
231
+ "description": "Inline copy shown after accept. Ignored when a thank-you URL is set; omitted values fall back to a package default line."
232
+ },
233
+ "successUrl": {
234
+ "label": "Thank-you URL",
235
+ "control": "url",
236
+ "reactProp": "successUrl",
237
+ "attribute": "success-url",
238
+ "required": false,
239
+ "description": "Redirect after accept. A full navigation can cut off analytics beacons — prefer measuring the conversion on the thank-you page."
240
+ }
241
+ },
155
242
  "forms": {
156
- "main-investors-kit": {
243
+ "magento-fik": {
157
244
  "definitionVersion": "1",
158
245
  "kind": "lead",
159
246
  "flow": { "type": "single" },
160
- "supportedHosts": ["pwa", "wordpress"],
161
247
  "fields": [
162
248
  { "name": "firstname", "required": true, "group": "name" },
163
249
  { "name": "lastname", "required": true, "group": "name" },
164
250
  { "name": "email", "required": true },
165
251
  { "name": "phone", "required": false }
166
252
  ],
167
- "trackingFields": [
168
- "page_url",
169
- "page_title",
170
- "referrer",
171
- "first_touch_url",
172
- "utm_source",
173
- "utm_medium",
174
- "utm_campaign",
175
- "utm_term",
176
- "utm_content",
177
- "gclid",
178
- "msclkid",
179
- "gbraid",
180
- "wbraid",
181
- "hubspot_utk",
182
- "ga_client_id",
183
- "ga_session_id",
184
- "snowplow_id",
185
- "vwo_uuid",
186
- "user_agent",
187
- "ip_address"
253
+ "ctaLabel": "GET MY FREE GUIDE",
254
+ "consents": [
255
+ {
256
+ "definitionId": "lead-tcpa",
257
+ "definitionVersion": "1",
258
+ "required": false
259
+ },
260
+ {
261
+ "definitionId": "lead-sms",
262
+ "definitionVersion": "1",
263
+ "required": false
264
+ },
265
+ {
266
+ "definitionId": "lead-tospp",
267
+ "definitionVersion": "1",
268
+ "required": false
269
+ }
270
+ ],
271
+ "editor": {
272
+ "label": "Magento FIK",
273
+ "description": "First name, last name, and email required; phone optional. Optional checkboxes: transactional SMS (lead-tcpa v1), marketing SMS (lead-sms v1), and terms and privacy (lead-tospp v1).",
274
+ "whenToUse": "TBD",
275
+ "whenNotToUse": "TBD",
276
+ "options": [
277
+ "appearance",
278
+ "variant",
279
+ "twoColumn",
280
+ "heading",
281
+ "subheading",
282
+ "ctaLabel",
283
+ "legalUrls",
284
+ "successMessage",
285
+ "successUrl"
286
+ ],
287
+ "supportedAppearances": ["on-light", "on-dark"],
288
+ "supportedVariants": ["dense", "large", "sidebar"],
289
+ "requiredLegalUrls": ["userAgreement", "privacyPolicy"]
290
+ }
291
+ },
292
+ "magento-ira-kick-article": {
293
+ "definitionVersion": "1",
294
+ "kind": "lead",
295
+ "flow": { "type": "single" },
296
+ "fields": [
297
+ { "name": "firstname", "required": true, "group": "name" },
298
+ { "name": "lastname", "required": true, "group": "name" },
299
+ { "name": "email", "required": true },
300
+ { "name": "phone", "required": true }
301
+ ],
302
+ "ctaLabel": "GET MY FREE GUIDE",
303
+ "consents": [
304
+ {
305
+ "definitionId": "lead-tcpa",
306
+ "definitionVersion": "2",
307
+ "required": false
308
+ }
309
+ ],
310
+ "editor": {
311
+ "label": "Magento IRA Kick Article",
312
+ "description": "First name, last name, email, and phone required. Optional telephone and SMS consent checkbox with linked terms and privacy (lead-tcpa v2).",
313
+ "whenToUse": "TBD",
314
+ "whenNotToUse": "TBD",
315
+ "options": [
316
+ "appearance",
317
+ "variant",
318
+ "twoColumn",
319
+ "heading",
320
+ "subheading",
321
+ "ctaLabel",
322
+ "legalUrls",
323
+ "successMessage",
324
+ "successUrl"
325
+ ],
326
+ "supportedAppearances": ["on-light", "on-dark"],
327
+ "supportedVariants": ["dense", "large", "sidebar"],
328
+ "requiredLegalUrls": ["userAgreement", "privacyPolicy"]
329
+ }
330
+ },
331
+ "magento-fik-blog-rail": {
332
+ "definitionVersion": "1",
333
+ "kind": "lead",
334
+ "flow": { "type": "single" },
335
+ "fields": [
336
+ { "name": "firstname", "required": true, "group": "name" },
337
+ { "name": "lastname", "required": true, "group": "name" },
338
+ { "name": "email", "required": true },
339
+ { "name": "phone", "required": true }
188
340
  ],
189
341
  "ctaLabel": "GET MY FREE GUIDE",
190
- "consent": {
191
- "definitionId": "lead-tcpa",
192
- "definitionVersion": "1",
193
- "required": true,
194
- "submitFields": [
195
- "tcpa_form_consent_granted",
196
- "tcpa_form_opt_in_date"
197
- ]
198
- },
342
+ "consents": [
343
+ {
344
+ "definitionId": "lead-tcpa",
345
+ "definitionVersion": "2",
346
+ "required": false
347
+ }
348
+ ],
349
+ "editor": {
350
+ "label": "Magento FIK Blog Rail",
351
+ "description": "First name, last name, email, and phone required. Optional telephone and SMS consent checkbox with linked terms and privacy (lead-tcpa v2).",
352
+ "whenToUse": "TBD",
353
+ "whenNotToUse": "TBD",
354
+ "options": [
355
+ "appearance",
356
+ "variant",
357
+ "twoColumn",
358
+ "heading",
359
+ "subheading",
360
+ "ctaLabel",
361
+ "legalUrls",
362
+ "successMessage",
363
+ "successUrl"
364
+ ],
365
+ "supportedAppearances": ["on-light", "on-dark"],
366
+ "supportedVariants": ["dense", "large", "sidebar"],
367
+ "requiredLegalUrls": ["userAgreement", "privacyPolicy"]
368
+ }
369
+ },
370
+ "main-investors-kit-notice": {
371
+ "definitionVersion": "1",
372
+ "kind": "lead",
373
+ "flow": { "type": "single" },
374
+ "fields": [
375
+ { "name": "firstname", "required": true, "group": "name" },
376
+ { "name": "lastname", "required": true, "group": "name" },
377
+ { "name": "email", "required": true },
378
+ { "name": "phone", "required": false }
379
+ ],
380
+ "ctaLabel": "CLAIM YOUR OFFER",
381
+ "consents": [
382
+ { "definitionId": "lead-clickwrap", "definitionVersion": "2" }
383
+ ],
199
384
  "editor": {
200
- "label": "Main Investors Kit",
201
- "description": "Standard lead form: name, email, phone, TCPA consent. Use on full-width landing pages and PWA kit/sidebar placements.",
202
- "whenToUse": "Default kit request. Do not use for affiliate landers or IRA-specific leads.",
203
- "whenNotToUse": "Affiliate pages (separate definition). IRA kit (separate definition when added).",
385
+ "label": "Main Investors Kit (clickwrap)",
386
+ "description": "First name, last name, and email required; phone optional. Clickwrap notice only (lead-clickwrap v2); no consent checkboxes.",
387
+ "whenToUse": "TBD",
388
+ "whenNotToUse": "TBD",
389
+ "options": [
390
+ "appearance",
391
+ "variant",
392
+ "twoColumn",
393
+ "heading",
394
+ "subheading",
395
+ "ctaLabel",
396
+ "legalUrls",
397
+ "successMessage",
398
+ "successUrl"
399
+ ],
204
400
  "supportedAppearances": ["on-light", "on-dark"],
205
- "supportedVariants": ["dense", "large", "sidebar", "two-column"]
401
+ "supportedVariants": ["dense", "large", "sidebar"],
402
+ "requiredLegalUrls": ["privacyPolicy", "userAgreement"]
206
403
  }
207
404
  },
208
405
  "newsletter": {
209
406
  "definitionVersion": "1",
210
407
  "kind": "newsletter",
211
408
  "flow": { "type": "single" },
212
- "supportedHosts": ["pwa"],
213
409
  "fields": [{ "name": "email", "required": true }],
214
- "trackingFields": [
215
- "page_url",
216
- "page_title",
217
- "referrer",
218
- "utm_source",
219
- "utm_medium",
220
- "utm_campaign",
221
- "utm_term",
222
- "utm_content"
223
- ],
224
410
  "ctaLabel": "SUBSCRIBE",
225
411
  "editor": {
226
412
  "label": "Newsletter",
227
- "description": "Email-only newsletter signup. No TCPA consent.",
228
- "whenToUse": "Footer or landing newsletter capture where only an email is required.",
229
- "whenNotToUse": "Lead kits that need name, phone, or TCPA consent.",
413
+ "description": "Email only. No consent.",
414
+ "whenToUse": "TBD",
415
+ "whenNotToUse": "TBD",
416
+ "options": [
417
+ "appearance",
418
+ "heading",
419
+ "subheading",
420
+ "ctaLabel",
421
+ "successMessage",
422
+ "successUrl"
423
+ ],
230
424
  "supportedAppearances": ["on-light", "on-dark"],
231
- "supportedVariants": []
425
+ "supportedVariants": [],
426
+ "requiredLegalUrls": []
232
427
  }
233
428
  }
234
429
  },
235
430
  "hostAdapterContract": {
236
431
  "hosts": ["pwa", "wordpress"],
237
- "mayProvide": [
238
- "browser cookies",
239
- "URL parameters",
240
- "page and placement context",
241
- "host/store identity"
242
- ],
432
+ "mayProvide": ["legal document URLs", "host/store identity"],
243
433
  "mustNotDefine": [
244
- "new tracking keys",
245
- "destination property names",
246
434
  "consent definitions",
247
435
  "form fields",
248
436
  "submission endpoints"
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@usgb/forms",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared USGB lead-form package for PWA and WordPress",
5
5
  "type": "module",
6
- "license": "UNLICENSED",
6
+ "license": "MIT",
7
7
  "files": [
8
8
  "dist",
9
9
  "forms-manifest.json"
@@ -1,9 +0,0 @@
1
- import { TrackingKey, TrackingValue, HostAdapter } from './types';
2
- import { TrackingRegistryEntry } from '../definitions/types';
3
- export declare function collectTrackingContext(args: {
4
- trackingFields: TrackingKey[];
5
- trackingRegistry: Record<string, TrackingRegistryEntry>;
6
- adapter: HostAdapter;
7
- }): Partial<Record<TrackingKey, TrackingValue>>;
8
- export declare function createIdempotencyKey(): string;
9
- //# sourceMappingURL=collectContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collectContext.d.ts","sourceRoot":"","sources":["../../../src/contract/collectContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAkB,aAAa,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAiB1C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IACzC,cAAc,EAAE,WAAW,EAAE,CAAA;IAC7B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACvD,OAAO,EAAE,WAAW,CAAA;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAgD9C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAK7C"}