@vtex/country-forms 1.1.0 → 1.2.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/dist/{BRA-PMVV6KOM.js → BRA-CWGYPPBD.js} +43 -27
  3. package/dist/BRA-CWGYPPBD.js.map +1 -0
  4. package/dist/{BRA-ZBZXE5II.mjs → BRA-R2DBJTZ2.mjs} +43 -27
  5. package/dist/BRA-R2DBJTZ2.mjs.map +1 -0
  6. package/dist/CAN-RDQPFPZU.mjs +127 -0
  7. package/dist/CAN-RDQPFPZU.mjs.map +1 -0
  8. package/dist/CAN-ZJQJFUW4.js +129 -0
  9. package/dist/CAN-ZJQJFUW4.js.map +1 -0
  10. package/dist/MEX-6CJCALY3.js +125 -0
  11. package/dist/MEX-6CJCALY3.js.map +1 -0
  12. package/dist/MEX-ZQL7ZS3G.mjs +123 -0
  13. package/dist/MEX-ZQL7ZS3G.mjs.map +1 -0
  14. package/dist/USA-2QW25XAI.mjs +128 -0
  15. package/dist/USA-2QW25XAI.mjs.map +1 -0
  16. package/dist/USA-MWP4SDGW.js +130 -0
  17. package/dist/USA-MWP4SDGW.js.map +1 -0
  18. package/dist/{bra-MHTXSNLA.js → bra-DQO5W7HB.js} +7 -15
  19. package/dist/bra-DQO5W7HB.js.map +1 -0
  20. package/dist/{bra-ILOTR4AN.mjs → bra-MJUXI46I.mjs} +4 -15
  21. package/dist/bra-MJUXI46I.mjs.map +1 -0
  22. package/dist/can-3MOZIOGB.js +65 -0
  23. package/dist/can-3MOZIOGB.js.map +1 -0
  24. package/dist/can-DKTB2M6I.mjs +41 -0
  25. package/dist/can-DKTB2M6I.mjs.map +1 -0
  26. package/dist/can-LLWX4LC2.js +48 -0
  27. package/dist/can-LLWX4LC2.js.map +1 -0
  28. package/dist/can-OONXPDKH.mjs +59 -0
  29. package/dist/can-OONXPDKH.mjs.map +1 -0
  30. package/dist/chunk-B2XPLIJU.mjs +19 -0
  31. package/dist/chunk-B2XPLIJU.mjs.map +1 -0
  32. package/dist/chunk-ZQQPNXLP.js +21 -0
  33. package/dist/chunk-ZQQPNXLP.js.map +1 -0
  34. package/dist/common-E4IN3G46.mjs +4 -0
  35. package/dist/common-E4IN3G46.mjs.map +1 -0
  36. package/dist/common-LFDTUEMM.js +13 -0
  37. package/dist/common-LFDTUEMM.js.map +1 -0
  38. package/dist/{en-US-YW7UYXNB.mjs → en-US-KHII5INO.mjs} +22 -2
  39. package/dist/en-US-KHII5INO.mjs.map +1 -0
  40. package/dist/{en-US-RLEM27ZZ.js → en-US-RCNO3BZC.js} +22 -2
  41. package/dist/en-US-RCNO3BZC.js.map +1 -0
  42. package/dist/{es-MX-K5MWKMJW.js → es-MX-IGOEW2P4.js} +22 -2
  43. package/dist/es-MX-IGOEW2P4.js.map +1 -0
  44. package/dist/{es-MX-AGRGVXRK.mjs → es-MX-R24GRBU5.mjs} +22 -2
  45. package/dist/es-MX-R24GRBU5.mjs.map +1 -0
  46. package/dist/{fr-FR-KWQ3MPP5.mjs → fr-FR-N4WJAN23.mjs} +22 -2
  47. package/dist/fr-FR-N4WJAN23.mjs.map +1 -0
  48. package/dist/{fr-FR-LJIPE6BH.js → fr-FR-WZBI6O4O.js} +22 -2
  49. package/dist/fr-FR-WZBI6O4O.js.map +1 -0
  50. package/dist/index.d.mts +178 -7
  51. package/dist/index.d.ts +178 -7
  52. package/dist/index.js +109 -37
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +104 -38
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/mex-AMEX6IHY.mjs +108 -0
  57. package/dist/mex-AMEX6IHY.mjs.map +1 -0
  58. package/dist/mex-DYWVMWB6.js +38 -0
  59. package/dist/mex-DYWVMWB6.js.map +1 -0
  60. package/dist/mex-VX3Y5I6I.mjs +33 -0
  61. package/dist/mex-VX3Y5I6I.mjs.map +1 -0
  62. package/dist/mex-Y56WV2L7.js +114 -0
  63. package/dist/mex-Y56WV2L7.js.map +1 -0
  64. package/dist/{pt-BR-P2RZ3X3H.mjs → pt-BR-PIBP3JHL.mjs} +25 -2
  65. package/dist/pt-BR-PIBP3JHL.mjs.map +1 -0
  66. package/dist/{pt-BR-74IZNREP.js → pt-BR-ZDM55ITO.js} +25 -2
  67. package/dist/pt-BR-ZDM55ITO.js.map +1 -0
  68. package/dist/usa-AC7YPVS3.mjs +52 -0
  69. package/dist/usa-AC7YPVS3.mjs.map +1 -0
  70. package/dist/usa-B6NCCTF6.js +61 -0
  71. package/dist/usa-B6NCCTF6.js.map +1 -0
  72. package/dist/usa-LOOP7MRM.mjs +55 -0
  73. package/dist/usa-LOOP7MRM.mjs.map +1 -0
  74. package/dist/usa-OQ44AFEI.js +61 -0
  75. package/dist/usa-OQ44AFEI.js.map +1 -0
  76. package/package.json +1 -1
  77. package/dist/BRA-PMVV6KOM.js.map +0 -1
  78. package/dist/BRA-ZBZXE5II.mjs.map +0 -1
  79. package/dist/bra-ILOTR4AN.mjs.map +0 -1
  80. package/dist/bra-MHTXSNLA.js.map +0 -1
  81. package/dist/can-7TMYDEJF.mjs +0 -17
  82. package/dist/can-7TMYDEJF.mjs.map +0 -1
  83. package/dist/can-B5ME2ZFN.js +0 -20
  84. package/dist/can-B5ME2ZFN.js.map +0 -1
  85. package/dist/can-FGNN5MZS.mjs +0 -19
  86. package/dist/can-FGNN5MZS.mjs.map +0 -1
  87. package/dist/can-LLJ4A5Y5.js +0 -21
  88. package/dist/can-LLJ4A5Y5.js.map +0 -1
  89. package/dist/en-US-RLEM27ZZ.js.map +0 -1
  90. package/dist/en-US-YW7UYXNB.mjs.map +0 -1
  91. package/dist/es-MX-AGRGVXRK.mjs.map +0 -1
  92. package/dist/es-MX-K5MWKMJW.js.map +0 -1
  93. package/dist/fr-FR-KWQ3MPP5.mjs.map +0 -1
  94. package/dist/fr-FR-LJIPE6BH.js.map +0 -1
  95. package/dist/mex-5BKCF6LS.js +0 -21
  96. package/dist/mex-5BKCF6LS.js.map +0 -1
  97. package/dist/mex-G3HMNBBF.mjs +0 -19
  98. package/dist/mex-G3HMNBBF.mjs.map +0 -1
  99. package/dist/pt-BR-74IZNREP.js.map +0 -1
  100. package/dist/pt-BR-P2RZ3X3H.mjs.map +0 -1
  101. package/dist/usa-3AM7UFVG.js +0 -20
  102. package/dist/usa-3AM7UFVG.js.map +0 -1
  103. package/dist/usa-I7DK2CTL.mjs +0 -18
  104. package/dist/usa-I7DK2CTL.mjs.map +0 -1
  105. package/dist/usa-LXT6WW64.js +0 -21
  106. package/dist/usa-LXT6WW64.js.map +0 -1
  107. package/dist/usa-ZD5OWGAD.mjs +0 -18
  108. package/dist/usa-ZD5OWGAD.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.0] - 2026-06-22
11
+
12
+ ### Added
13
+
14
+ - Conditional rule resolution for fields driven by a sibling controller (`dependsOn`): new `FieldDefinition` props `conditionalValidator`, `conditionalFormatRef`, `conditionalUnformatRef`, and the engine resolvers `resolveFieldValidator`, `resolveFieldFormatRef`, `resolveFieldUnformatRef`, `resolveFieldLabel`, `resolveFieldPlaceholder` (all exported). `validate` now resolves the effective `customValidator` per controller value.
15
+ - Conditional `inputMode` (mobile keyboard hint): new `FieldDefinition` prop `conditionalInputMode` and exported resolver `resolveFieldInputMode`. The BRA `document` field uses it to keep a `numeric` keyboard for the numeric CPF (individual) while switching to `text` for the alphanumeric CNPJ (business); USA/CAN keep a static `numeric` and MEX a static `text` (uniform per country).
16
+ - Derived, data-only fields: new `FieldDefinition` props `derivedFrom` + `derivedValue`. Such fields are seeded by `createFormState`, recomputed by `setValue`, excluded from `getVisibleFields`, and never validated — used to carry API-shape values like `documentType`.
17
+ - MEX personal-data schema (`personal-data-MEX`). `personType` toggles between `individual` (shows `lastName`, optional `rfc` — persona física, 13 chars) and `business` (shows optional `rfcCorporate` — persona moral, 12 chars). Adds `validatePhoneMEX`, `validateRFC` (13 chars + SAT inconvenient-word blacklist), `validateRFCCorporate` (12 chars, structural) in `rules/validators/mex`, plus a new `rules/masks/mex` module with `formatPhoneMEX`/`unformatPhoneMEX` and `formatRFC`/`unformatRFC`. New i18n keys `country-forms.personal-data.{rfc,rfcCorporate}.{label,placeholder}` and `country-forms.personal-data.phone.placeholder.MEX` in all four bundles. `rfc`/`rfcCorporate` are **optional** (`required: false`) but format-validated when filled. `MEX` is now part of `SUPPORTED_PERSONAL_DATA_COUNTRIES`.
18
+ - CAN personal-data schema (`personal-data-CAN`). `personType` toggles between `individual` (shows `lastName`, optional `sin`) and `business` (shows optional `bn`). Adds `validatePhoneCAN`, `validateSIN` (9 digits + Luhn checksum), `validateBN` (9 digits, structural) and masks `formatPhoneCAN`/`unformatPhoneCAN`, `formatSIN`/`unformatSIN`. New i18n keys `country-forms.personal-data.{sin,bn}.{label,placeholder}` and `country-forms.personal-data.phone.placeholder.CAN` in all four bundles. `CAN` is now part of `SUPPORTED_PERSONAL_DATA_COUNTRIES`.
19
+ - USA personal-data schema (`personal-data-USA`). `personType` toggles between `individual` (shows `lastName`, `ssn`) and `business` (shows `ein`), mirroring the BRA schema. `ssn` and `ein` are **optional** (`required: false`) but are still format-validated when filled. `USA` is now part of `SUPPORTED_PERSONAL_DATA_COUNTRIES`.
20
+ - New US validators `validatePhoneUSA`, `validateSSN`, `validateEIN` and masks `formatPhoneUSA`/`unformatPhoneUSA`, `formatSSN`/`unformatSSN`, `formatEIN`/`unformatEIN` (registered by `rules/validators/usa` and `rules/masks/usa`).
21
+ - New i18n keys in all four bundles: `country-forms.personal-data.ssn.label`, `country-forms.personal-data.ssn.placeholder`, `country-forms.personal-data.ein.label`, `country-forms.personal-data.ein.placeholder`, and `country-forms.personal-data.phone.placeholder.USA`.
22
+
23
+ ### Changed
24
+
25
+ - **All personal-data schemas now model the identity document as a single `document` field plus a derived `documentType` field**, matching the `{ document, documentType }` shape of VTEX profile APIs. The previous per-type fields are removed in favor of conditional resolution on `personType`:
26
+ - BRA: `cpf`/`cnpj` → `document` (`documentType` ∈ `{cpf, cnpj}`)
27
+ - USA: `ssn`/`ein` → `document` (`documentType` ∈ `{ssn, ein}`)
28
+ - CAN: `sin`/`bn` → `document` (`documentType` ∈ `{sin, bn}`)
29
+ - MEX: `rfc`/`rfcCorporate` → `document` (`documentType` always `rfc`)
30
+ The `document` field keeps each country's per-type label, placeholder, validator, and mask via the new conditional refs; `setValue` resets `document` when `personType` changes.
31
+ - The country-agnostic `validateEmail` validator moved to `rules/validators/common` (single source of truth, shared by BRA and USA schemas). It is still re-exported from `rules/validators/bra` for backward compatibility, so existing imports keep working.
32
+
33
+ ### Fixed
34
+
35
+ - Conditional field resolution now matches **own keys only**: it uses `Object.prototype.hasOwnProperty.call` instead of the `in` operator, so a controller value such as `constructor` or `toString` no longer accidentally matches an inherited `Object.prototype` member.
36
+
10
37
  ## [1.1.0] - 2026-05-21
11
38
 
12
39
  ### Added
@@ -114,7 +141,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
114
141
  - `examples/react-minimal/` — React example with country/locale selection, form rendering, validation, and i18n overrides
115
142
 
116
143
 
117
- [Unreleased]: https://github.com/vtex/country-forms/compare/v1.1.0...HEAD
144
+ [Unreleased]: https://github.com/vtex/country-forms/compare/v1.2.0...HEAD
145
+ [1.2.0]: https://github.com/vtex/country-forms/compare/v1.1.0...v1.2.0
118
146
  [1.1.0]: https://github.com/vtex/country-forms/compare/v1.0.1...v1.1.0
119
147
  [1.0.1]: https://github.com/vtex/country-forms/compare/v1.0.0...v1.0.1
120
148
  [1.0.0]: https://github.com/vtex/country-forms/compare/v0.0.1...v1.0.0
@@ -73,41 +73,57 @@ var schema = {
73
73
  }
74
74
  },
75
75
  {
76
- name: "cpf",
76
+ name: "document",
77
77
  type: "text",
78
- label: "country-forms.personal-data.cpf.label",
79
- placeholder: "country-forms.personal-data.cpf.placeholder",
78
+ label: "country-forms.personal-data.document.label",
80
79
  required: true,
80
+ // Fallback before personType is chosen; conditionalInputMode refines it per
81
+ // person type so individuals (numeric CPF) keep the mobile numeric keyboard.
81
82
  inputMode: "numeric",
82
- maxLength: 14,
83
- formatRef: "formatCPF",
84
- unformatRef: "unformatCPF",
85
- validation: {
86
- customValidator: "validateCPF"
83
+ // 18 = formatted CNPJ length ("99.999.999/9999-99"); CPF (14) fits within it.
84
+ maxLength: 18,
85
+ dependsOn: "personType",
86
+ // CPF (individual) is purely numeric; CNPJ (business) is alphanumeric
87
+ // (SERPRO 2024+), so businesses need a text keyboard.
88
+ conditionalInputMode: {
89
+ individual: "numeric",
90
+ business: "text"
91
+ },
92
+ conditionalLabel: {
93
+ individual: "country-forms.personal-data.cpf.label",
94
+ business: "country-forms.personal-data.cnpj.label"
95
+ },
96
+ conditionalPlaceholder: {
97
+ individual: "country-forms.personal-data.cpf.placeholder",
98
+ business: "country-forms.personal-data.cnpj.placeholder"
99
+ },
100
+ conditionalValidator: {
101
+ individual: "validateCPF",
102
+ business: "validateCNPJ"
103
+ },
104
+ conditionalFormatRef: {
105
+ individual: "formatCPF",
106
+ business: "formatCNPJ"
107
+ },
108
+ conditionalUnformatRef: {
109
+ individual: "unformatCPF",
110
+ business: "unformatCNPJ"
87
111
  },
88
112
  conditionalVisibility: {
89
113
  field: "personType",
90
- operator: "equals",
91
- value: "individual"
114
+ operator: "includes",
115
+ value: ["individual", "business"]
92
116
  }
93
117
  },
94
118
  {
95
- name: "cnpj",
119
+ name: "documentType",
96
120
  type: "text",
97
- label: "country-forms.personal-data.cnpj.label",
98
- placeholder: "country-forms.personal-data.cnpj.placeholder",
99
- required: true,
100
- inputMode: "text",
101
- maxLength: 18,
102
- formatRef: "formatCNPJ",
103
- unformatRef: "unformatCNPJ",
104
- validation: {
105
- customValidator: "validateCNPJ"
106
- },
107
- conditionalVisibility: {
108
- field: "personType",
109
- operator: "equals",
110
- value: "business"
121
+ label: "country-forms.personal-data.documentType.label",
122
+ required: false,
123
+ derivedFrom: "personType",
124
+ derivedValue: {
125
+ individual: "cpf",
126
+ business: "cnpj"
111
127
  }
112
128
  }
113
129
  ]
@@ -115,5 +131,5 @@ var schema = {
115
131
  var BRA_default = schema;
116
132
 
117
133
  module.exports = BRA_default;
118
- //# sourceMappingURL=BRA-PMVV6KOM.js.map
119
- //# sourceMappingURL=BRA-PMVV6KOM.js.map
134
+ //# sourceMappingURL=BRA-CWGYPPBD.js.map
135
+ //# sourceMappingURL=BRA-CWGYPPBD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/BRA.ts"],"names":[],"mappings":";;;AAkCA,IAAM,MAAA,GAAS;AAAA,EACb,EAAA,EAAI,mBAAA;AAAA,EACJ,OAAA,EAAS,KAAA;AAAA,EACT,QAAA,EAAU,eAAA;AAAA,EACV,MAAA,EAAQ;AAAA,IACN;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,IAAA,EAAM,aAAA;AAAA,MACN,KAAA,EAAO,8CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,OAAA,EAAS;AAAA,QACP,EAAE,KAAA,EAAO,YAAA,EAAc,YAAA,EAAc,mDAAA,EAAoD;AAAA,QACzF,EAAE,KAAA,EAAO,UAAA,EAAY,YAAA,EAAc,iDAAA;AAAkD;AACvF,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,WAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,6CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,SAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAW,GAAA;AAAA,MACX,SAAA,EAAW,YAAA;AAAA,MACX,gBAAA,EAAkB;AAAA,QAChB,UAAA,EAAY,wDAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,UAAA,EAAY;AAAA,QACV,SAAA,EAAW,EAAE,KAAA,EAAO,GAAA,EAAK,SAAS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AAA;AAAA;AAAA,MAGX,oBAAA,EAAsB;AAAA,QACpB,UAAA,EAAY,SAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,gBAAA,EAAkB;AAAA,QAChB,UAAA,EAAY,uCAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,sBAAA,EAAwB;AAAA,QACtB,UAAA,EAAY,6CAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,oBAAA,EAAsB;AAAA,QACpB,UAAA,EAAY,aAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,oBAAA,EAAsB;AAAA,QACpB,UAAA,EAAY,WAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,sBAAA,EAAwB;AAAA,QACtB,UAAA,EAAY,aAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,qBAAA,EAAuB;AAAA,QACrB,KAAA,EAAO,YAAA;AAAA,QACP,QAAA,EAAU,UAAA;AAAA,QACV,KAAA,EAAO,CAAC,YAAA,EAAc,UAAU;AAAA;AAClC,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,cAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,gDAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,WAAA,EAAa,YAAA;AAAA,MACb,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,KAAA;AAAA,QACZ,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,WAAA,GAAQ","file":"BRA-CWGYPPBD.js","sourcesContent":["/**\n * Personal-data schema for Brazil (BRA).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as CPF) visible\n * - `\"business\"` → `document` (as CNPJ) visible; `lastName` hidden\n *\n * `firstName` uses `conditionalLabel` keyed by `personType`:\n * - `\"individual\"` → \"First name\" / \"Nome\"\n * - `\"business\"` → \"Company name\" / \"Razão social\"\n *\n * `lastName` is only visible for individuals (hidden for businesses).\n *\n * ## Document model (API-aligned)\n *\n * The identity document is collected through a single `document` field plus a\n * derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates/masks conditionally on\n * `personType` (CPF for individuals, CNPJ for businesses); `documentType` is\n * data-only and follows `personType` automatically (`cpf` / `cnpj`).\n *\n * Email: `joao.silva@example.com` -> validated by `validateEmail`.\n * Phone: `(11) 98888-7777` -> validated by `validatePhoneBRA`, masked by `formatPhoneBRA`/`unformatPhoneBRA`.\n * Document (individual): `999.999.999-99` — `validateCPF`, masked by `formatCPF`/`unformatCPF`.\n * Document (business): `99.999.999/9999-99` (numeric, legacy) or `AA.AAA.AAA/AAAA-99`\n * (alphanumeric, SERPRO 2024+) — `validateCNPJ`, masked by `formatCNPJ`/`unformatCNPJ`.\n * The first 12 characters can be `[A-Z0-9]`; the last 2 (check digits) are always numeric.\n *\n * Required rule modules: `rules/validators/bra`, `rules/masks/bra`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-BRA',\n country: 'BRA',\n formType: 'personal-data',\n fields: [\n {\n name: 'personType',\n type: 'radio-group',\n label: 'country-forms.personal-data.personType.label',\n required: true,\n options: [\n { value: 'individual', displayValue: 'country-forms.personal-data.personType.individual' },\n { value: 'business', displayValue: 'country-forms.personal-data.personType.business' },\n ],\n },\n {\n name: 'firstName',\n type: 'text',\n label: 'country-forms.personal-data.firstName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.firstName.label.individual',\n business: 'country-forms.personal-data.firstName.label.business',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'lastName',\n type: 'text',\n label: 'country-forms.personal-data.lastName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n conditionalVisibility: {\n field: 'personType',\n operator: 'equals',\n value: 'individual',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'email',\n type: 'email',\n label: 'country-forms.personal-data.email.label',\n required: true,\n inputMode: 'email',\n validation: {\n customValidator: 'validateEmail',\n },\n },\n {\n name: 'phone',\n type: 'text',\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.BRA',\n required: true,\n maxLength: 20,\n inputMode: 'tel',\n formatRef: 'formatPhoneBRA',\n unformatRef: 'unformatPhoneBRA',\n validation: {\n customValidator: 'validatePhoneBRA',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: true,\n // Fallback before personType is chosen; conditionalInputMode refines it per\n // person type so individuals (numeric CPF) keep the mobile numeric keyboard.\n inputMode: 'numeric',\n // 18 = formatted CNPJ length (\"99.999.999/9999-99\"); CPF (14) fits within it.\n maxLength: 18,\n dependsOn: 'personType',\n // CPF (individual) is purely numeric; CNPJ (business) is alphanumeric\n // (SERPRO 2024+), so businesses need a text keyboard.\n conditionalInputMode: {\n individual: 'numeric',\n business: 'text',\n },\n conditionalLabel: {\n individual: 'country-forms.personal-data.cpf.label',\n business: 'country-forms.personal-data.cnpj.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.cpf.placeholder',\n business: 'country-forms.personal-data.cnpj.placeholder',\n },\n conditionalValidator: {\n individual: 'validateCPF',\n business: 'validateCNPJ',\n },\n conditionalFormatRef: {\n individual: 'formatCPF',\n business: 'formatCNPJ',\n },\n conditionalUnformatRef: {\n individual: 'unformatCPF',\n business: 'unformatCNPJ',\n },\n conditionalVisibility: {\n field: 'personType',\n operator: 'includes',\n value: ['individual', 'business'],\n },\n },\n {\n name: 'documentType',\n type: 'text',\n label: 'country-forms.personal-data.documentType.label',\n required: false,\n derivedFrom: 'personType',\n derivedValue: {\n individual: 'cpf',\n business: 'cnpj',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
@@ -71,41 +71,57 @@ var schema = {
71
71
  }
72
72
  },
73
73
  {
74
- name: "cpf",
74
+ name: "document",
75
75
  type: "text",
76
- label: "country-forms.personal-data.cpf.label",
77
- placeholder: "country-forms.personal-data.cpf.placeholder",
76
+ label: "country-forms.personal-data.document.label",
78
77
  required: true,
78
+ // Fallback before personType is chosen; conditionalInputMode refines it per
79
+ // person type so individuals (numeric CPF) keep the mobile numeric keyboard.
79
80
  inputMode: "numeric",
80
- maxLength: 14,
81
- formatRef: "formatCPF",
82
- unformatRef: "unformatCPF",
83
- validation: {
84
- customValidator: "validateCPF"
81
+ // 18 = formatted CNPJ length ("99.999.999/9999-99"); CPF (14) fits within it.
82
+ maxLength: 18,
83
+ dependsOn: "personType",
84
+ // CPF (individual) is purely numeric; CNPJ (business) is alphanumeric
85
+ // (SERPRO 2024+), so businesses need a text keyboard.
86
+ conditionalInputMode: {
87
+ individual: "numeric",
88
+ business: "text"
89
+ },
90
+ conditionalLabel: {
91
+ individual: "country-forms.personal-data.cpf.label",
92
+ business: "country-forms.personal-data.cnpj.label"
93
+ },
94
+ conditionalPlaceholder: {
95
+ individual: "country-forms.personal-data.cpf.placeholder",
96
+ business: "country-forms.personal-data.cnpj.placeholder"
97
+ },
98
+ conditionalValidator: {
99
+ individual: "validateCPF",
100
+ business: "validateCNPJ"
101
+ },
102
+ conditionalFormatRef: {
103
+ individual: "formatCPF",
104
+ business: "formatCNPJ"
105
+ },
106
+ conditionalUnformatRef: {
107
+ individual: "unformatCPF",
108
+ business: "unformatCNPJ"
85
109
  },
86
110
  conditionalVisibility: {
87
111
  field: "personType",
88
- operator: "equals",
89
- value: "individual"
112
+ operator: "includes",
113
+ value: ["individual", "business"]
90
114
  }
91
115
  },
92
116
  {
93
- name: "cnpj",
117
+ name: "documentType",
94
118
  type: "text",
95
- label: "country-forms.personal-data.cnpj.label",
96
- placeholder: "country-forms.personal-data.cnpj.placeholder",
97
- required: true,
98
- inputMode: "text",
99
- maxLength: 18,
100
- formatRef: "formatCNPJ",
101
- unformatRef: "unformatCNPJ",
102
- validation: {
103
- customValidator: "validateCNPJ"
104
- },
105
- conditionalVisibility: {
106
- field: "personType",
107
- operator: "equals",
108
- value: "business"
119
+ label: "country-forms.personal-data.documentType.label",
120
+ required: false,
121
+ derivedFrom: "personType",
122
+ derivedValue: {
123
+ individual: "cpf",
124
+ business: "cnpj"
109
125
  }
110
126
  }
111
127
  ]
@@ -113,5 +129,5 @@ var schema = {
113
129
  var BRA_default = schema;
114
130
 
115
131
  export { BRA_default as default };
116
- //# sourceMappingURL=BRA-ZBZXE5II.mjs.map
117
- //# sourceMappingURL=BRA-ZBZXE5II.mjs.map
132
+ //# sourceMappingURL=BRA-R2DBJTZ2.mjs.map
133
+ //# sourceMappingURL=BRA-R2DBJTZ2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/BRA.ts"],"names":[],"mappings":";AAkCA,IAAM,MAAA,GAAS;AAAA,EACb,EAAA,EAAI,mBAAA;AAAA,EACJ,OAAA,EAAS,KAAA;AAAA,EACT,QAAA,EAAU,eAAA;AAAA,EACV,MAAA,EAAQ;AAAA,IACN;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,IAAA,EAAM,aAAA;AAAA,MACN,KAAA,EAAO,8CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,OAAA,EAAS;AAAA,QACP,EAAE,KAAA,EAAO,YAAA,EAAc,YAAA,EAAc,mDAAA,EAAoD;AAAA,QACzF,EAAE,KAAA,EAAO,UAAA,EAAY,YAAA,EAAc,iDAAA;AAAkD;AACvF,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,WAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,6CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,SAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAW,GAAA;AA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":["/**\n * Personal-data schema for Brazil (BRA).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as CPF) visible\n * - `\"business\"` → `document` (as CNPJ) visible; `lastName` hidden\n *\n * `firstName` uses `conditionalLabel` keyed by `personType`:\n * - `\"individual\"` → \"First name\" / \"Nome\"\n * - `\"business\"` → \"Company name\" / \"Razão social\"\n *\n * `lastName` is only visible for individuals (hidden for businesses).\n *\n * ## Document model (API-aligned)\n *\n * The identity document is collected through a single `document` field plus a\n * derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates/masks conditionally on\n * `personType` (CPF for individuals, CNPJ for businesses); `documentType` is\n * data-only and follows `personType` automatically (`cpf` / `cnpj`).\n *\n * Email: `joao.silva@example.com` -> validated by `validateEmail`.\n * Phone: `(11) 98888-7777` -> validated by `validatePhoneBRA`, masked by `formatPhoneBRA`/`unformatPhoneBRA`.\n * Document (individual): `999.999.999-99` — `validateCPF`, masked by `formatCPF`/`unformatCPF`.\n * Document (business): `99.999.999/9999-99` (numeric, legacy) or `AA.AAA.AAA/AAAA-99`\n * (alphanumeric, SERPRO 2024+) — `validateCNPJ`, masked by `formatCNPJ`/`unformatCNPJ`.\n * The first 12 characters can be `[A-Z0-9]`; the last 2 (check digits) are always numeric.\n *\n * Required rule modules: `rules/validators/bra`, `rules/masks/bra`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-BRA',\n country: 'BRA',\n formType: 'personal-data',\n fields: [\n {\n name: 'personType',\n type: 'radio-group',\n label: 'country-forms.personal-data.personType.label',\n required: true,\n options: [\n { value: 'individual', displayValue: 'country-forms.personal-data.personType.individual' },\n { value: 'business', displayValue: 'country-forms.personal-data.personType.business' },\n ],\n },\n {\n name: 'firstName',\n type: 'text',\n label: 'country-forms.personal-data.firstName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.firstName.label.individual',\n business: 'country-forms.personal-data.firstName.label.business',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'lastName',\n type: 'text',\n label: 'country-forms.personal-data.lastName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n conditionalVisibility: {\n field: 'personType',\n operator: 'equals',\n value: 'individual',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'email',\n type: 'email',\n label: 'country-forms.personal-data.email.label',\n required: true,\n inputMode: 'email',\n validation: {\n customValidator: 'validateEmail',\n },\n },\n {\n name: 'phone',\n type: 'text',\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.BRA',\n required: true,\n maxLength: 20,\n inputMode: 'tel',\n formatRef: 'formatPhoneBRA',\n unformatRef: 'unformatPhoneBRA',\n validation: {\n customValidator: 'validatePhoneBRA',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: true,\n // Fallback before personType is chosen; conditionalInputMode refines it per\n // person type so individuals (numeric CPF) keep the mobile numeric keyboard.\n inputMode: 'numeric',\n // 18 = formatted CNPJ length (\"99.999.999/9999-99\"); CPF (14) fits within it.\n maxLength: 18,\n dependsOn: 'personType',\n // CPF (individual) is purely numeric; CNPJ (business) is alphanumeric\n // (SERPRO 2024+), so businesses need a text keyboard.\n conditionalInputMode: {\n individual: 'numeric',\n business: 'text',\n },\n conditionalLabel: {\n individual: 'country-forms.personal-data.cpf.label',\n business: 'country-forms.personal-data.cnpj.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.cpf.placeholder',\n business: 'country-forms.personal-data.cnpj.placeholder',\n },\n conditionalValidator: {\n individual: 'validateCPF',\n business: 'validateCNPJ',\n },\n conditionalFormatRef: {\n individual: 'formatCPF',\n business: 'formatCNPJ',\n },\n conditionalUnformatRef: {\n individual: 'unformatCPF',\n business: 'unformatCNPJ',\n },\n conditionalVisibility: {\n field: 'personType',\n operator: 'includes',\n value: ['individual', 'business'],\n },\n },\n {\n name: 'documentType',\n type: 'text',\n label: 'country-forms.personal-data.documentType.label',\n required: false,\n derivedFrom: 'personType',\n derivedValue: {\n individual: 'cpf',\n business: 'cnpj',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
@@ -0,0 +1,127 @@
1
+ // src/schemas/personal-data/CAN.ts
2
+ var schema = {
3
+ id: "personal-data-CAN",
4
+ country: "CAN",
5
+ formType: "personal-data",
6
+ fields: [
7
+ {
8
+ name: "personType",
9
+ type: "radio-group",
10
+ label: "country-forms.personal-data.personType.label",
11
+ required: true,
12
+ options: [
13
+ { value: "individual", displayValue: "country-forms.personal-data.personType.individual" },
14
+ { value: "business", displayValue: "country-forms.personal-data.personType.business" }
15
+ ]
16
+ },
17
+ {
18
+ name: "firstName",
19
+ type: "text",
20
+ label: "country-forms.personal-data.firstName.label",
21
+ required: true,
22
+ inputMode: "text",
23
+ maxLength: 200,
24
+ dependsOn: "personType",
25
+ conditionalLabel: {
26
+ individual: "country-forms.personal-data.firstName.label.individual",
27
+ business: "country-forms.personal-data.firstName.label.business"
28
+ },
29
+ validation: {
30
+ maxLength: { value: 200, message: "country-forms.validation.maxLength" }
31
+ }
32
+ },
33
+ {
34
+ name: "lastName",
35
+ type: "text",
36
+ label: "country-forms.personal-data.lastName.label",
37
+ required: true,
38
+ inputMode: "text",
39
+ maxLength: 200,
40
+ conditionalVisibility: {
41
+ field: "personType",
42
+ operator: "equals",
43
+ value: "individual"
44
+ },
45
+ validation: {
46
+ maxLength: { value: 200, message: "country-forms.validation.maxLength" }
47
+ }
48
+ },
49
+ {
50
+ name: "email",
51
+ type: "email",
52
+ label: "country-forms.personal-data.email.label",
53
+ required: true,
54
+ inputMode: "email",
55
+ validation: {
56
+ customValidator: "validateEmail"
57
+ }
58
+ },
59
+ {
60
+ name: "phone",
61
+ type: "text",
62
+ // 15 chars accommodates the longest accepted raw input, "+1 613-555-0123",
63
+ // so pasted country-code forms are not truncated before the mask normalizes
64
+ // them to the 12-char display "613-555-0123".
65
+ maxLength: 15,
66
+ label: "country-forms.personal-data.phone.label",
67
+ placeholder: "country-forms.personal-data.phone.placeholder.CAN",
68
+ required: true,
69
+ inputMode: "tel",
70
+ formatRef: "formatPhoneCAN",
71
+ unformatRef: "unformatPhoneCAN",
72
+ validation: {
73
+ customValidator: "validatePhoneCAN"
74
+ }
75
+ },
76
+ {
77
+ name: "document",
78
+ type: "text",
79
+ label: "country-forms.personal-data.document.label",
80
+ required: false,
81
+ inputMode: "numeric",
82
+ // 11 = formatted SIN length ("046-454-286"); BN (9) fits within it.
83
+ maxLength: 11,
84
+ dependsOn: "personType",
85
+ conditionalLabel: {
86
+ individual: "country-forms.personal-data.sin.label",
87
+ business: "country-forms.personal-data.bn.label"
88
+ },
89
+ conditionalPlaceholder: {
90
+ individual: "country-forms.personal-data.sin.placeholder",
91
+ business: "country-forms.personal-data.bn.placeholder"
92
+ },
93
+ conditionalValidator: {
94
+ individual: "validateSIN",
95
+ business: "validateBN"
96
+ },
97
+ // BN has no mask — only the SIN (individual) declares format/unformat refs.
98
+ conditionalFormatRef: {
99
+ individual: "formatSIN"
100
+ },
101
+ conditionalUnformatRef: {
102
+ individual: "unformatSIN"
103
+ },
104
+ conditionalVisibility: {
105
+ field: "personType",
106
+ operator: "includes",
107
+ value: ["individual", "business"]
108
+ }
109
+ },
110
+ {
111
+ name: "documentType",
112
+ type: "text",
113
+ label: "country-forms.personal-data.documentType.label",
114
+ required: false,
115
+ derivedFrom: "personType",
116
+ derivedValue: {
117
+ individual: "sin",
118
+ business: "bn"
119
+ }
120
+ }
121
+ ]
122
+ };
123
+ var CAN_default = schema;
124
+
125
+ export { CAN_default as default };
126
+ //# sourceMappingURL=CAN-RDQPFPZU.mjs.map
127
+ //# sourceMappingURL=CAN-RDQPFPZU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":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wB;AAAA,QACtB,UAAA,EAAY;AAAA,OACd;AAAA,MACA,qBAAA,EAAuB;AAAA,QACrB,KAAA,EAAO,YAAA;AAAA,QACP,QAAA,EAAU,UAAA;AAAA,QACV,KAAA,EAAO,CAAC,YAAA,EAAc,UAAU;AAAA;AAClC,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,cAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,gDAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,WAAA,EAAa,YAAA;AAAA,MACb,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,KAAA;AAAA,QACZ,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,WAAA,GAAQ","file":"CAN-RDQPFPZU.mjs","sourcesContent":["/**\n * Personal-data schema for Canada (CAN).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as SIN) visible\n * - `\"business\"` → `document` (as BN) visible; `lastName` hidden\n *\n * `firstName` uses `conditionalLabel` keyed by `personType`:\n * - `\"individual\"` → \"First name\"\n * - `\"business\"` → \"Company name\"\n *\n * `lastName` is only visible for individuals (hidden for businesses).\n *\n * ## Document model (API-aligned)\n *\n * The tax/identity document is collected through a single `document` field plus a\n * derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates conditionally on `personType`\n * (SIN for individuals, BN for businesses) and masks only the SIN; `documentType`\n * is data-only and follows `personType` automatically (`sin` / `bn`).\n *\n * `document` is **optional** (`required: false`): many Canadian flows (e.g.\n * checkout) do not collect a tax/identity document. It is still format-validated\n * *when filled* (an invalid SIN/BN is rejected; an empty one is accepted).\n * Consumers that need it mandatory can override `required` in their own schema layer.\n *\n * Email: `jane.doe@example.com` — validated by `validateEmail` (shared).\n * Phone: `613-555-0123` — validated by `validatePhoneCAN`, masked by `formatPhoneCAN`/`unformatPhoneCAN`.\n * Document (individual): `046-454-286` — `validateSIN` (9 digits + Luhn), masked by `formatSIN`/`unformatSIN`.\n * Document (business): `123456789` — `validateBN` (9 digits, structural); no mask.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/can`, `rules/masks/can`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-CAN',\n country: 'CAN',\n formType: 'personal-data',\n fields: [\n {\n name: 'personType',\n type: 'radio-group',\n label: 'country-forms.personal-data.personType.label',\n required: true,\n options: [\n { value: 'individual', displayValue: 'country-forms.personal-data.personType.individual' },\n { value: 'business', displayValue: 'country-forms.personal-data.personType.business' },\n ],\n },\n {\n name: 'firstName',\n type: 'text',\n label: 'country-forms.personal-data.firstName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.firstName.label.individual',\n business: 'country-forms.personal-data.firstName.label.business',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'lastName',\n type: 'text',\n label: 'country-forms.personal-data.lastName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n conditionalVisibility: {\n field: 'personType',\n operator: 'equals',\n value: 'individual',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'email',\n type: 'email',\n label: 'country-forms.personal-data.email.label',\n required: true,\n inputMode: 'email',\n validation: {\n customValidator: 'validateEmail',\n },\n },\n {\n name: 'phone',\n type: 'text',\n // 15 chars accommodates the longest accepted raw input, \"+1 613-555-0123\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 12-char display \"613-555-0123\".\n maxLength: 15,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.CAN',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneCAN',\n unformatRef: 'unformatPhoneCAN',\n validation: {\n customValidator: 'validatePhoneCAN',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: false,\n inputMode: 'numeric',\n // 11 = formatted SIN length (\"046-454-286\"); BN (9) fits within it.\n maxLength: 11,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.sin.label',\n business: 'country-forms.personal-data.bn.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.sin.placeholder',\n business: 'country-forms.personal-data.bn.placeholder',\n },\n conditionalValidator: {\n individual: 'validateSIN',\n business: 'validateBN',\n },\n // BN has no mask — only the SIN (individual) declares format/unformat refs.\n conditionalFormatRef: {\n individual: 'formatSIN',\n },\n conditionalUnformatRef: {\n individual: 'unformatSIN',\n },\n conditionalVisibility: {\n field: 'personType',\n operator: 'includes',\n value: ['individual', 'business'],\n },\n },\n {\n name: 'documentType',\n type: 'text',\n label: 'country-forms.personal-data.documentType.label',\n required: false,\n derivedFrom: 'personType',\n derivedValue: {\n individual: 'sin',\n business: 'bn',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ // src/schemas/personal-data/CAN.ts
4
+ var schema = {
5
+ id: "personal-data-CAN",
6
+ country: "CAN",
7
+ formType: "personal-data",
8
+ fields: [
9
+ {
10
+ name: "personType",
11
+ type: "radio-group",
12
+ label: "country-forms.personal-data.personType.label",
13
+ required: true,
14
+ options: [
15
+ { value: "individual", displayValue: "country-forms.personal-data.personType.individual" },
16
+ { value: "business", displayValue: "country-forms.personal-data.personType.business" }
17
+ ]
18
+ },
19
+ {
20
+ name: "firstName",
21
+ type: "text",
22
+ label: "country-forms.personal-data.firstName.label",
23
+ required: true,
24
+ inputMode: "text",
25
+ maxLength: 200,
26
+ dependsOn: "personType",
27
+ conditionalLabel: {
28
+ individual: "country-forms.personal-data.firstName.label.individual",
29
+ business: "country-forms.personal-data.firstName.label.business"
30
+ },
31
+ validation: {
32
+ maxLength: { value: 200, message: "country-forms.validation.maxLength" }
33
+ }
34
+ },
35
+ {
36
+ name: "lastName",
37
+ type: "text",
38
+ label: "country-forms.personal-data.lastName.label",
39
+ required: true,
40
+ inputMode: "text",
41
+ maxLength: 200,
42
+ conditionalVisibility: {
43
+ field: "personType",
44
+ operator: "equals",
45
+ value: "individual"
46
+ },
47
+ validation: {
48
+ maxLength: { value: 200, message: "country-forms.validation.maxLength" }
49
+ }
50
+ },
51
+ {
52
+ name: "email",
53
+ type: "email",
54
+ label: "country-forms.personal-data.email.label",
55
+ required: true,
56
+ inputMode: "email",
57
+ validation: {
58
+ customValidator: "validateEmail"
59
+ }
60
+ },
61
+ {
62
+ name: "phone",
63
+ type: "text",
64
+ // 15 chars accommodates the longest accepted raw input, "+1 613-555-0123",
65
+ // so pasted country-code forms are not truncated before the mask normalizes
66
+ // them to the 12-char display "613-555-0123".
67
+ maxLength: 15,
68
+ label: "country-forms.personal-data.phone.label",
69
+ placeholder: "country-forms.personal-data.phone.placeholder.CAN",
70
+ required: true,
71
+ inputMode: "tel",
72
+ formatRef: "formatPhoneCAN",
73
+ unformatRef: "unformatPhoneCAN",
74
+ validation: {
75
+ customValidator: "validatePhoneCAN"
76
+ }
77
+ },
78
+ {
79
+ name: "document",
80
+ type: "text",
81
+ label: "country-forms.personal-data.document.label",
82
+ required: false,
83
+ inputMode: "numeric",
84
+ // 11 = formatted SIN length ("046-454-286"); BN (9) fits within it.
85
+ maxLength: 11,
86
+ dependsOn: "personType",
87
+ conditionalLabel: {
88
+ individual: "country-forms.personal-data.sin.label",
89
+ business: "country-forms.personal-data.bn.label"
90
+ },
91
+ conditionalPlaceholder: {
92
+ individual: "country-forms.personal-data.sin.placeholder",
93
+ business: "country-forms.personal-data.bn.placeholder"
94
+ },
95
+ conditionalValidator: {
96
+ individual: "validateSIN",
97
+ business: "validateBN"
98
+ },
99
+ // BN has no mask — only the SIN (individual) declares format/unformat refs.
100
+ conditionalFormatRef: {
101
+ individual: "formatSIN"
102
+ },
103
+ conditionalUnformatRef: {
104
+ individual: "unformatSIN"
105
+ },
106
+ conditionalVisibility: {
107
+ field: "personType",
108
+ operator: "includes",
109
+ value: ["individual", "business"]
110
+ }
111
+ },
112
+ {
113
+ name: "documentType",
114
+ type: "text",
115
+ label: "country-forms.personal-data.documentType.label",
116
+ required: false,
117
+ derivedFrom: "personType",
118
+ derivedValue: {
119
+ individual: "sin",
120
+ business: "bn"
121
+ }
122
+ }
123
+ ]
124
+ };
125
+ var CAN_default = schema;
126
+
127
+ module.exports = CAN_default;
128
+ //# sourceMappingURL=CAN-ZJQJFUW4.js.map
129
+ //# sourceMappingURL=CAN-ZJQJFUW4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/CAN.ts"],"names":[],"mappings":";;;AAqCA,IAAM,MAAA,GAAS;AAAA,EACb,EAAA,EAAI,mBAAA;AAAA,EACJ,OAAA,EAAS,KAAA;AAAA,EACT,QAAA,EAAU,eAAA;AAAA,EACV,MAAA,EAAQ;AAAA,IACN;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,IAAA,EAAM,aAAA;AAAA,MACN,KAAA,EAAO,8CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,OAAA,EAAS;AAAA,QACP,EAAE,KAAA,EAAO,YAAA,EAAc,YAAA,EAAc,mDAAA,EAAoD;AAAA,QACzF,EAAE,KAAA,EAAO,UAAA,EAAY,YAAA,EAAc,iDAAA;AAAkD;AACvF,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,WAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,6CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,SAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAW,GAAA;AAAA,MACX,SAAA,EAAW,YAAA;AAAA,MACX,gBAAA,EAAkB;AAAA,QAChB,UAAA,EAAY,wDAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,UAAA,EAAY;AAAA,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AA,MAEX,SAAA,EAAW,EAAA;AAAA,MACX,SAAA,EAAW,YAAA;AAAA,MACX,gBAAA,EAAkB;AAAA,QAChB,UAAA,EAAY,uCAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,sBAAA,EAAwB;AAAA,QACtB,UAAA,EAAY,6CAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,oBAAA,EAAsB;AAAA,QACpB,UAAA,EAAY,aAAA;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA;AAAA,MAEA,oBAAA,EAAsB;AAAA,QACpB,UAAA,EAAY;AAAA,OACd;AAAA,MACA,sBAAA,EAAwB;AAAA,QACtB,UAAA,EAAY;AAAA,OACd;AAAA,MACA,qBAAA,EAAuB;AAAA,QACrB,KAAA,EAAO,YAAA;AAAA,QACP,QAAA,EAAU,UAAA;AAAA,QACV,KAAA,EAAO,CAAC,YAAA,EAAc,UAAU;AAAA;AAClC,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,cAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,gDAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,WAAA,EAAa,YAAA;AAAA,MACb,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,KAAA;AAAA,QACZ,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,WAAA,GAAQ","file":"CAN-ZJQJFUW4.js","sourcesContent":["/**\n * Personal-data schema for Canada (CAN).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as SIN) visible\n * - `\"business\"` → `document` (as BN) visible; `lastName` hidden\n *\n * `firstName` uses `conditionalLabel` keyed by `personType`:\n * - `\"individual\"` → \"First name\"\n * - `\"business\"` → \"Company name\"\n *\n * `lastName` is only visible for individuals (hidden for businesses).\n *\n * ## Document model (API-aligned)\n *\n * The tax/identity document is collected through a single `document` field plus a\n * derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates conditionally on `personType`\n * (SIN for individuals, BN for businesses) and masks only the SIN; `documentType`\n * is data-only and follows `personType` automatically (`sin` / `bn`).\n *\n * `document` is **optional** (`required: false`): many Canadian flows (e.g.\n * checkout) do not collect a tax/identity document. It is still format-validated\n * *when filled* (an invalid SIN/BN is rejected; an empty one is accepted).\n * Consumers that need it mandatory can override `required` in their own schema layer.\n *\n * Email: `jane.doe@example.com` — validated by `validateEmail` (shared).\n * Phone: `613-555-0123` — validated by `validatePhoneCAN`, masked by `formatPhoneCAN`/`unformatPhoneCAN`.\n * Document (individual): `046-454-286` — `validateSIN` (9 digits + Luhn), masked by `formatSIN`/`unformatSIN`.\n * Document (business): `123456789` — `validateBN` (9 digits, structural); no mask.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/can`, `rules/masks/can`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-CAN',\n country: 'CAN',\n formType: 'personal-data',\n fields: [\n {\n name: 'personType',\n type: 'radio-group',\n label: 'country-forms.personal-data.personType.label',\n required: true,\n options: [\n { value: 'individual', displayValue: 'country-forms.personal-data.personType.individual' },\n { value: 'business', displayValue: 'country-forms.personal-data.personType.business' },\n ],\n },\n {\n name: 'firstName',\n type: 'text',\n label: 'country-forms.personal-data.firstName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.firstName.label.individual',\n business: 'country-forms.personal-data.firstName.label.business',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'lastName',\n type: 'text',\n label: 'country-forms.personal-data.lastName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n conditionalVisibility: {\n field: 'personType',\n operator: 'equals',\n value: 'individual',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'email',\n type: 'email',\n label: 'country-forms.personal-data.email.label',\n required: true,\n inputMode: 'email',\n validation: {\n customValidator: 'validateEmail',\n },\n },\n {\n name: 'phone',\n type: 'text',\n // 15 chars accommodates the longest accepted raw input, \"+1 613-555-0123\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 12-char display \"613-555-0123\".\n maxLength: 15,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.CAN',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneCAN',\n unformatRef: 'unformatPhoneCAN',\n validation: {\n customValidator: 'validatePhoneCAN',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: false,\n inputMode: 'numeric',\n // 11 = formatted SIN length (\"046-454-286\"); BN (9) fits within it.\n maxLength: 11,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.sin.label',\n business: 'country-forms.personal-data.bn.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.sin.placeholder',\n business: 'country-forms.personal-data.bn.placeholder',\n },\n conditionalValidator: {\n individual: 'validateSIN',\n business: 'validateBN',\n },\n // BN has no mask — only the SIN (individual) declares format/unformat refs.\n conditionalFormatRef: {\n individual: 'formatSIN',\n },\n conditionalUnformatRef: {\n individual: 'unformatSIN',\n },\n conditionalVisibility: {\n field: 'personType',\n operator: 'includes',\n value: ['individual', 'business'],\n },\n },\n {\n name: 'documentType',\n type: 'text',\n label: 'country-forms.personal-data.documentType.label',\n required: false,\n derivedFrom: 'personType',\n derivedValue: {\n individual: 'sin',\n business: 'bn',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}