@usgb/forms 1.0.5 → 1.0.6

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/README.md CHANGED
@@ -35,7 +35,7 @@ Use `listFormDefinitions()` (or the manifest) when a CMS needs a picker of avail
35
35
  | -------------------------------- | ------------ | --------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------ |
36
36
  | `magento-fik-10dlc` | `lead` | First name, last name, email (required); phone (optional) | Optional TCPA (v1), marketing SMS, and terms/privacy checkboxes | `dense`, `large`, or `sidebar`; optional two-column name row |
37
37
  | `magento-ira-401k` | `lead` | First name, last name, email, phone (all required) | Optional TCPA checkbox (v2, links terms and privacy) | `dense`, `large`, or `sidebar`; optional two-column name row |
38
- | `magento-fik` | `lead` | First name, last name, email, phone (all required) | Required TCPA checkbox (v3, links terms and privacy) | `dense`, `large`, or `sidebar`; optional two-column name row |
38
+ | `magento-fik` | `lead` | First name, last name, email, phone (all required) | Required TCPA checkbox (v2, links terms and privacy) | `dense`, `large`, or `sidebar`; optional two-column name row |
39
39
  | `magento-footer` | `newsletter` | Email only | None | None — omit `variant` and `twoColumn` / `two-column` |
40
40
  | `wp-full-lead` | `lead` | First name, last name, email, phone (all required) | Clickwrap notice only (`lead-clickwrap` v2) | `dense`, `large`, or `sidebar`; optional two-column name row |
41
41
  | `wp-request-call-back` | `lead` | Same as `wp-full-lead` | Same as `wp-full-lead` | Same as `wp-full-lead` |
@@ -258,7 +258,7 @@ interface HostAdapter {
258
258
 
259
259
  ### Payload shape (summary)
260
260
 
261
- Successful submits send `formId`, `definitionVersion`, `submissionContractVersion`, `idempotencyKey`, `data`, and optional `consents` (grant booleans, opt-in dates, and `*_consent_language` strings). `data` is an array of `{ name, value }` entries in catalog field order:
261
+ Successful submits send `formId`, `definitionVersion`, `submissionContractVersion`, `idempotencyKey`, `data`, and optional `consents`. `data` and `consents` are both arrays of `{ name, value }` entries. `data` follows catalog field order:
262
262
 
263
263
  ```json
264
264
  "data": [
@@ -269,7 +269,22 @@ Successful submits send `formId`, `definitionVersion`, `submissionContractVersio
269
269
  ]
270
270
  ```
271
271
 
272
- Exact field sets come from the form’s catalog entry.
272
+ `consents` uses the same shape. Each pinned policy sends the language shown, including when its checkbox is unchecked. A checkbox also sends its grant flag as `true` or `false`. Its opt-in date is included only when that checkbox is checked. A notice has no grant flag: submit is the acknowledgment, so the payload sends `tcpa_consent_language` and `tcpa_form_opt_in_date`. Opt-in dates are `YYYY-MM-DD` in UTC. The timezone is not confirmed. This package does not keep a previously stored consent date.
273
+
274
+ ```json
275
+ "consents": [
276
+ { "name": "tcpa_consent_language", "value": "…" },
277
+ { "name": "tcpa_form_consent_granted", "value": true },
278
+ { "name": "tcpa_form_opt_in_date", "value": "2026-10-06" },
279
+ { "name": "sms_consent_language", "value": "…" },
280
+ { "name": "sms_form_consent_granted", "value": false },
281
+ { "name": "tospp_consent_language", "value": "…" },
282
+ { "name": "tospp_form_consent_granted", "value": true },
283
+ { "name": "tospp_form_opt_in_date", "value": "2026-10-06" }
284
+ ]
285
+ ```
286
+
287
+ Exact field sets come from the form’s catalog entry. `sms_form_opt_in_date` and `tospp_form_opt_in_date` are sent by this package when those checkboxes are checked. Creating and mapping those fields in HubSpot and Workato is separate work.
273
288
 
274
289
  ## Consent and legal URLs
275
290
 
@@ -277,15 +292,15 @@ Consent policies are versioned and package-owned (checkboxes and/or clickwrap no
277
292
 
278
293
  - `magento-fik-10dlc` pins `lead-tcpa`, `lead-sms`, and `lead-tospp` (all v1, optional checkboxes). Required URLs: `userAgreement`, `privacyPolicy` (`user-agreement-url`, `privacy-policy-url`).
279
294
  - `magento-ira-401k` pins `lead-tcpa` v2 only (optional checkbox). Unlike v1, v2 links the terms and privacy policy, so required URLs: `userAgreement`, `privacyPolicy`.
280
- - `magento-fik` pins `lead-tcpa` v3 only (required checkbox: automated text-message consent; “Terms of Service” links `userAgreement`, “Privacy Policy” links `privacyPolicy`). It shares the v1 payload keys. Required URLs: `userAgreement`, `privacyPolicy`.
281
- - WordPress lead forms pin `lead-clickwrap` v2 (notice only: Privacy Policy, Terms & Conditions, and text/call consent). Required URLs: `privacyPolicy`, `userAgreement`. They share the v1 payload key `clickwrap_consent_language`. `lead-clickwrap` v1 (five document links) stays in the catalog and is not pinned.
295
+ - `magento-fik` pins `lead-tcpa` v2 only (required checkbox: telephone and SMS consent, including autodialer disclosure; “terms and conditions” links `userAgreement`, “privacy policy” links `privacyPolicy`). It shares the v1 payload keys. Required URLs: `userAgreement`, `privacyPolicy`.
296
+ - WordPress lead forms pin `lead-clickwrap` v2 (notice only: Privacy Policy, Terms & Conditions, and text/call consent). Required URLs: `privacyPolicy`, `userAgreement`. Both clickwrap versions record the shown copy as `tcpa_consent_language` and the submit date as `tcpa_form_opt_in_date` (the same keys as the TCPA checkboxes). They do not send a grant flag. `lead-clickwrap` v1 (five document links) stays in the catalog and is not pinned.
282
297
  - `magento-footer` has no consents and needs no legal URLs.
283
298
  - `LEGAL_URL_ATTRS` lists every host-owned slot, including `clientAgreement` / `client-agreement-url`. No current catalog consent requires `clientAgreement`; it is still valid on `legalUrls` / the attribute (PWA Magento ships it in `PWA_LEGAL_URLS`).
284
299
  - PWA Magento defaults (`PWA_LEGAL_URLS`): `/content/client-agreement`, `/content/privacy-policy`, `/content/user-agreement`, `/content/market-loss-policy`, `/content/electronic-disclaimer`, `/content/terms-of-sale`.
285
300
  - WordPress must pass every URL required by the selected consents. A form with a missing required URL **does not render**. CMS pickers can compute the list with `getFormDefinition`, `resolveFormConsents`, and `collectRequiredLegalUrls`, then map keys through `LEGAL_URL_ATTRS`.
286
301
  - `isCompleteLegalUrls(legalUrls, requiredKeys)` is the same check the renderer uses.
287
- - Checkbox grants land in `consents` only (`tcpa_form_consent_granted`, `sms_form_consent_granted`, `tospp_form_consent_granted`). The exact copy shown is `tcpa_consent_language` (and the matching keys for other policies), even when unchecked.
288
- - Checking the TCPA box also adds `tcpa_form_opt_in_date` (YYYY-MM-DD). Clickwrap forms only send `clickwrap_consent_language`.
302
+ - Checkbox grants land in `consents` only (`tcpa_form_consent_granted`, `sms_form_consent_granted`, `tospp_form_consent_granted`), each as `true` or `false`. The exact copy shown is `tcpa_consent_language`, `sms_consent_language`, or `tospp_consent_language`, even when that checkbox is unchecked.
303
+ - A checked TCPA, SMS, or terms/privacy box also adds `tcpa_form_opt_in_date`, `sms_form_opt_in_date`, or `tospp_form_opt_in_date` (`YYYY-MM-DD`, UTC). An unchecked box omits its date. Clickwrap notices send `tcpa_consent_language` and `tcpa_form_opt_in_date`, and no grant flag.
289
304
  - Hosts supply document hrefs only. Consent wording stays in this package.
290
305
 
291
306
  ## Success behavior
@@ -342,13 +342,13 @@
342
342
  "consents": [
343
343
  {
344
344
  "definitionId": "lead-tcpa",
345
- "definitionVersion": "3",
345
+ "definitionVersion": "2",
346
346
  "required": true
347
347
  }
348
348
  ],
349
349
  "editor": {
350
350
  "label": "Magento FIK",
351
- "description": "First name, last name, email, and phone required. Required automated text-message consent checkbox with linked terms of service and privacy policy (lead-tcpa v3).",
351
+ "description": "First name, last name, email, and phone required. Required telephone and SMS consent checkbox with linked terms and privacy (lead-tcpa v2).",
352
352
  "whenToUse": "TBD",
353
353
  "whenNotToUse": "TBD",
354
354
  "options": [
@@ -342,13 +342,13 @@
342
342
  "consents": [
343
343
  {
344
344
  "definitionId": "lead-tcpa",
345
- "definitionVersion": "3",
345
+ "definitionVersion": "2",
346
346
  "required": true
347
347
  }
348
348
  ],
349
349
  "editor": {
350
350
  "label": "Magento FIK",
351
- "description": "First name, last name, email, and phone required. Required automated text-message consent checkbox with linked terms of service and privacy policy (lead-tcpa v3).",
351
+ "description": "First name, last name, email, and phone required. Required telephone and SMS consent checkbox with linked terms and privacy (lead-tcpa v2).",
352
352
  "whenToUse": "TBD",
353
353
  "whenNotToUse": "TBD",
354
354
  "options": [