@vtex/country-forms 1.0.1 → 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 (117) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/README.md +2 -1
  3. package/dist/{BRA-PMVV6KOM.js → BRA-CWGYPPBD.js} +43 -27
  4. package/dist/BRA-CWGYPPBD.js.map +1 -0
  5. package/dist/{BRA-PCJDRSEF.mjs → BRA-JUHEOV7J.mjs} +3 -3
  6. package/dist/{BRA-PCJDRSEF.mjs.map → BRA-JUHEOV7J.mjs.map} +1 -1
  7. package/dist/{BRA-ZBZXE5II.mjs → BRA-R2DBJTZ2.mjs} +43 -27
  8. package/dist/BRA-R2DBJTZ2.mjs.map +1 -0
  9. package/dist/{BRA-WGCSNRCO.js → BRA-VIVRV7X7.js} +3 -3
  10. package/dist/{BRA-WGCSNRCO.js.map → BRA-VIVRV7X7.js.map} +1 -1
  11. package/dist/CAN-RDQPFPZU.mjs +127 -0
  12. package/dist/CAN-RDQPFPZU.mjs.map +1 -0
  13. package/dist/CAN-ZJQJFUW4.js +129 -0
  14. package/dist/CAN-ZJQJFUW4.js.map +1 -0
  15. package/dist/MEX-6CJCALY3.js +125 -0
  16. package/dist/MEX-6CJCALY3.js.map +1 -0
  17. package/dist/MEX-ZQL7ZS3G.mjs +123 -0
  18. package/dist/MEX-ZQL7ZS3G.mjs.map +1 -0
  19. package/dist/USA-2QW25XAI.mjs +128 -0
  20. package/dist/USA-2QW25XAI.mjs.map +1 -0
  21. package/dist/USA-MWP4SDGW.js +130 -0
  22. package/dist/USA-MWP4SDGW.js.map +1 -0
  23. package/dist/{bra-PZBWBUGB.js → bra-DQO5W7HB.js} +23 -31
  24. package/dist/bra-DQO5W7HB.js.map +1 -0
  25. package/dist/{bra-ZDFUVAXT.mjs → bra-MJUXI46I.mjs} +16 -27
  26. package/dist/bra-MJUXI46I.mjs.map +1 -0
  27. package/dist/can-3MOZIOGB.js +65 -0
  28. package/dist/can-3MOZIOGB.js.map +1 -0
  29. package/dist/can-DKTB2M6I.mjs +41 -0
  30. package/dist/can-DKTB2M6I.mjs.map +1 -0
  31. package/dist/can-LLWX4LC2.js +48 -0
  32. package/dist/can-LLWX4LC2.js.map +1 -0
  33. package/dist/can-OONXPDKH.mjs +59 -0
  34. package/dist/can-OONXPDKH.mjs.map +1 -0
  35. package/dist/chunk-B2XPLIJU.mjs +19 -0
  36. package/dist/chunk-B2XPLIJU.mjs.map +1 -0
  37. package/dist/{chunk-HKDTDE53.js → chunk-CFX5EF4R.js} +2 -2
  38. package/dist/{chunk-HKDTDE53.js.map → chunk-CFX5EF4R.js.map} +1 -1
  39. package/dist/{chunk-IVJED4TG.mjs → chunk-KWESVZKV.mjs} +2 -2
  40. package/dist/{chunk-IVJED4TG.mjs.map → chunk-KWESVZKV.mjs.map} +1 -1
  41. package/dist/chunk-ZQQPNXLP.js +21 -0
  42. package/dist/chunk-ZQQPNXLP.js.map +1 -0
  43. package/dist/common-E4IN3G46.mjs +4 -0
  44. package/dist/common-E4IN3G46.mjs.map +1 -0
  45. package/dist/common-LFDTUEMM.js +13 -0
  46. package/dist/common-LFDTUEMM.js.map +1 -0
  47. package/dist/{en-US-67K5REMQ.mjs → en-US-KHII5INO.mjs} +29 -14
  48. package/dist/en-US-KHII5INO.mjs.map +1 -0
  49. package/dist/{en-US-DXYSM6Q2.js → en-US-RCNO3BZC.js} +29 -14
  50. package/dist/en-US-RCNO3BZC.js.map +1 -0
  51. package/dist/{es-MX-UL5OL7HT.js → es-MX-IGOEW2P4.js} +28 -13
  52. package/dist/es-MX-IGOEW2P4.js.map +1 -0
  53. package/dist/{es-MX-2R6G2ZLS.mjs → es-MX-R24GRBU5.mjs} +28 -13
  54. package/dist/es-MX-R24GRBU5.mjs.map +1 -0
  55. package/dist/{fr-FR-GGR2M6TJ.mjs → fr-FR-N4WJAN23.mjs} +29 -14
  56. package/dist/fr-FR-N4WJAN23.mjs.map +1 -0
  57. package/dist/{fr-FR-LWA6B3MW.js → fr-FR-WZBI6O4O.js} +29 -14
  58. package/dist/fr-FR-WZBI6O4O.js.map +1 -0
  59. package/dist/index.d.mts +227 -11
  60. package/dist/index.d.ts +227 -11
  61. package/dist/index.js +127 -43
  62. package/dist/index.js.map +1 -1
  63. package/dist/index.mjs +122 -44
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/mex-AMEX6IHY.mjs +108 -0
  66. package/dist/mex-AMEX6IHY.mjs.map +1 -0
  67. package/dist/mex-DYWVMWB6.js +38 -0
  68. package/dist/mex-DYWVMWB6.js.map +1 -0
  69. package/dist/mex-VX3Y5I6I.mjs +33 -0
  70. package/dist/mex-VX3Y5I6I.mjs.map +1 -0
  71. package/dist/mex-Y56WV2L7.js +114 -0
  72. package/dist/mex-Y56WV2L7.js.map +1 -0
  73. package/dist/{pt-BR-KH6RW3HM.mjs → pt-BR-PIBP3JHL.mjs} +31 -13
  74. package/dist/pt-BR-PIBP3JHL.mjs.map +1 -0
  75. package/dist/{pt-BR-WVTTIEAH.js → pt-BR-ZDM55ITO.js} +31 -13
  76. package/dist/pt-BR-ZDM55ITO.js.map +1 -0
  77. package/dist/usa-AC7YPVS3.mjs +52 -0
  78. package/dist/usa-AC7YPVS3.mjs.map +1 -0
  79. package/dist/usa-B6NCCTF6.js +61 -0
  80. package/dist/usa-B6NCCTF6.js.map +1 -0
  81. package/dist/usa-LOOP7MRM.mjs +55 -0
  82. package/dist/usa-LOOP7MRM.mjs.map +1 -0
  83. package/dist/usa-OQ44AFEI.js +61 -0
  84. package/dist/usa-OQ44AFEI.js.map +1 -0
  85. package/package.json +1 -1
  86. package/dist/BRA-PMVV6KOM.js.map +0 -1
  87. package/dist/BRA-ZBZXE5II.mjs.map +0 -1
  88. package/dist/bra-PZBWBUGB.js.map +0 -1
  89. package/dist/bra-ZDFUVAXT.mjs.map +0 -1
  90. package/dist/can-7TMYDEJF.mjs +0 -17
  91. package/dist/can-7TMYDEJF.mjs.map +0 -1
  92. package/dist/can-B5ME2ZFN.js +0 -20
  93. package/dist/can-B5ME2ZFN.js.map +0 -1
  94. package/dist/can-BUKTOPLB.js +0 -21
  95. package/dist/can-BUKTOPLB.js.map +0 -1
  96. package/dist/can-SHRLPUU5.mjs +0 -19
  97. package/dist/can-SHRLPUU5.mjs.map +0 -1
  98. package/dist/en-US-67K5REMQ.mjs.map +0 -1
  99. package/dist/en-US-DXYSM6Q2.js.map +0 -1
  100. package/dist/es-MX-2R6G2ZLS.mjs.map +0 -1
  101. package/dist/es-MX-UL5OL7HT.js.map +0 -1
  102. package/dist/fr-FR-GGR2M6TJ.mjs.map +0 -1
  103. package/dist/fr-FR-LWA6B3MW.js.map +0 -1
  104. package/dist/mex-I3LUVYVC.mjs +0 -19
  105. package/dist/mex-I3LUVYVC.mjs.map +0 -1
  106. package/dist/mex-QT4CJZDD.js +0 -21
  107. package/dist/mex-QT4CJZDD.js.map +0 -1
  108. package/dist/pt-BR-KH6RW3HM.mjs.map +0 -1
  109. package/dist/pt-BR-WVTTIEAH.js.map +0 -1
  110. package/dist/usa-6PGU5UHS.mjs +0 -18
  111. package/dist/usa-6PGU5UHS.mjs.map +0 -1
  112. package/dist/usa-I7DK2CTL.mjs +0 -18
  113. package/dist/usa-I7DK2CTL.mjs.map +0 -1
  114. package/dist/usa-LFLDXKPA.js +0 -20
  115. package/dist/usa-LFLDXKPA.js.map +0 -1
  116. package/dist/usa-LXT6WW64.js +0 -21
  117. package/dist/usa-LXT6WW64.js.map +0 -1
@@ -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,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N).\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,125 @@
1
+ 'use strict';
2
+
3
+ // src/schemas/personal-data/MEX.ts
4
+ var schema = {
5
+ id: "personal-data-MEX",
6
+ country: "MEX",
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
+ // 18 chars accommodates the longest accepted raw input, "+52 (33) 1234 5678",
65
+ // so pasted country-code forms are not truncated before the mask normalizes
66
+ // them to the 14-char display "(55) 1234 5678".
67
+ maxLength: 18,
68
+ label: "country-forms.personal-data.phone.label",
69
+ placeholder: "country-forms.personal-data.phone.placeholder.MEX",
70
+ required: true,
71
+ inputMode: "tel",
72
+ formatRef: "formatPhoneMEX",
73
+ unformatRef: "unformatPhoneMEX",
74
+ validation: {
75
+ customValidator: "validatePhoneMEX"
76
+ }
77
+ },
78
+ {
79
+ name: "document",
80
+ type: "text",
81
+ label: "country-forms.personal-data.document.label",
82
+ required: false,
83
+ inputMode: "text",
84
+ // 13 = RFC persona física length; persona moral (12) fits within it.
85
+ maxLength: 13,
86
+ formatRef: "formatRFC",
87
+ unformatRef: "unformatRFC",
88
+ dependsOn: "personType",
89
+ conditionalLabel: {
90
+ individual: "country-forms.personal-data.rfc.label",
91
+ business: "country-forms.personal-data.rfcCorporate.label"
92
+ },
93
+ conditionalPlaceholder: {
94
+ individual: "country-forms.personal-data.rfc.placeholder",
95
+ business: "country-forms.personal-data.rfcCorporate.placeholder"
96
+ },
97
+ conditionalValidator: {
98
+ individual: "validateRFC",
99
+ business: "validateRFCCorporate"
100
+ },
101
+ conditionalVisibility: {
102
+ field: "personType",
103
+ operator: "includes",
104
+ value: ["individual", "business"]
105
+ }
106
+ },
107
+ {
108
+ name: "documentType",
109
+ type: "text",
110
+ label: "country-forms.personal-data.documentType.label",
111
+ required: false,
112
+ derivedFrom: "personType",
113
+ // Both person types use the RFC; only the validation rule differs.
114
+ derivedValue: {
115
+ individual: "rfc",
116
+ business: "rfc"
117
+ }
118
+ }
119
+ ]
120
+ };
121
+ var MEX_default = schema;
122
+
123
+ module.exports = MEX_default;
124
+ //# sourceMappingURL=MEX-6CJCALY3.js.map
125
+ //# sourceMappingURL=MEX-6CJCALY3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/MEX.ts"],"names":[],"mappings":";;;AAsCA,IAAM,MAAA,GAAS;AAAA,EACb,EAAA,EAAI,mBAAA;AAAA,EACJ,OAAA,EAAS,KAAA;AAAA,EACT,QAAA,EAAU,eAA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cAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,gDAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,WAAA,EAAa,YAAA;AAAA;AAAA,MAEb,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,KAAA;AAAA,QACZ,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,WAAA,GAAQ","file":"MEX-6CJCALY3.js","sourcesContent":["/**\n * Personal-data schema for Mexico (MEX).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (RFC persona física) visible\n * - `\"business\"` → `document` (RFC persona moral) 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 Mexican tax ID is the RFC, collected through a single `document` field plus\n * a derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates conditionally on `personType`\n * (`validateRFC` for persona física / 13 chars, `validateRFCCorporate` for persona\n * moral / 12 chars) and shares the `formatRFC`/`unformatRFC` mask. Both person\n * types map to the same `documentType` value (`rfc`).\n *\n * `document` is **optional** (`required: false`): Mexican invoicing (factura/CFDI)\n * often requires the RFC, but many flows do not collect it. It is still\n * format-validated *when filled*. Consumers that need it mandatory can override\n * `required` in their own schema layer.\n *\n * Email: `juan.perez@example.com` — validated by `validateEmail` (shared).\n * Phone: `(55) 1234 5678` — validated by `validatePhoneMEX`, masked by `formatPhoneMEX`/`unformatPhoneMEX`.\n * Document (individual): `XAXX010101000` — `validateRFC`, masked by `formatRFC`/`unformatRFC`.\n * Document (business): `ABC010101AB1` — `validateRFCCorporate`, masked by `formatRFC`/`unformatRFC`.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/mex`, `rules/masks/mex`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-MEX',\n country: 'MEX',\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 // 18 chars accommodates the longest accepted raw input, \"+52 (33) 1234 5678\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 14-char display \"(55) 1234 5678\".\n maxLength: 18,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.MEX',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneMEX',\n unformatRef: 'unformatPhoneMEX',\n validation: {\n customValidator: 'validatePhoneMEX',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: false,\n inputMode: 'text',\n // 13 = RFC persona física length; persona moral (12) fits within it.\n maxLength: 13,\n formatRef: 'formatRFC',\n unformatRef: 'unformatRFC',\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.rfc.label',\n business: 'country-forms.personal-data.rfcCorporate.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.rfc.placeholder',\n business: 'country-forms.personal-data.rfcCorporate.placeholder',\n },\n conditionalValidator: {\n individual: 'validateRFC',\n business: 'validateRFCCorporate',\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 // Both person types use the RFC; only the validation rule differs.\n derivedValue: {\n individual: 'rfc',\n business: 'rfc',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
@@ -0,0 +1,123 @@
1
+ // src/schemas/personal-data/MEX.ts
2
+ var schema = {
3
+ id: "personal-data-MEX",
4
+ country: "MEX",
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
+ // 18 chars accommodates the longest accepted raw input, "+52 (33) 1234 5678",
63
+ // so pasted country-code forms are not truncated before the mask normalizes
64
+ // them to the 14-char display "(55) 1234 5678".
65
+ maxLength: 18,
66
+ label: "country-forms.personal-data.phone.label",
67
+ placeholder: "country-forms.personal-data.phone.placeholder.MEX",
68
+ required: true,
69
+ inputMode: "tel",
70
+ formatRef: "formatPhoneMEX",
71
+ unformatRef: "unformatPhoneMEX",
72
+ validation: {
73
+ customValidator: "validatePhoneMEX"
74
+ }
75
+ },
76
+ {
77
+ name: "document",
78
+ type: "text",
79
+ label: "country-forms.personal-data.document.label",
80
+ required: false,
81
+ inputMode: "text",
82
+ // 13 = RFC persona física length; persona moral (12) fits within it.
83
+ maxLength: 13,
84
+ formatRef: "formatRFC",
85
+ unformatRef: "unformatRFC",
86
+ dependsOn: "personType",
87
+ conditionalLabel: {
88
+ individual: "country-forms.personal-data.rfc.label",
89
+ business: "country-forms.personal-data.rfcCorporate.label"
90
+ },
91
+ conditionalPlaceholder: {
92
+ individual: "country-forms.personal-data.rfc.placeholder",
93
+ business: "country-forms.personal-data.rfcCorporate.placeholder"
94
+ },
95
+ conditionalValidator: {
96
+ individual: "validateRFC",
97
+ business: "validateRFCCorporate"
98
+ },
99
+ conditionalVisibility: {
100
+ field: "personType",
101
+ operator: "includes",
102
+ value: ["individual", "business"]
103
+ }
104
+ },
105
+ {
106
+ name: "documentType",
107
+ type: "text",
108
+ label: "country-forms.personal-data.documentType.label",
109
+ required: false,
110
+ derivedFrom: "personType",
111
+ // Both person types use the RFC; only the validation rule differs.
112
+ derivedValue: {
113
+ individual: "rfc",
114
+ business: "rfc"
115
+ }
116
+ }
117
+ ]
118
+ };
119
+ var MEX_default = schema;
120
+
121
+ export { MEX_default as default };
122
+ //# sourceMappingURL=MEX-ZQL7ZS3G.mjs.map
123
+ //# sourceMappingURL=MEX-ZQL7ZS3G.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/MEX.ts"],"names":[],"mappings":";AAsCA,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,oCAAA;AAAqC;AACzE,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,UAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,4CAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,SAAA,EAAW,MAAA;A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A,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,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;AAAA,MAEb,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,KAAA;AAAA,QACZ,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,WAAA,GAAQ","file":"MEX-ZQL7ZS3G.mjs","sourcesContent":["/**\n * Personal-data schema for Mexico (MEX).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (RFC persona física) visible\n * - `\"business\"` → `document` (RFC persona moral) 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 Mexican tax ID is the RFC, collected through a single `document` field plus\n * a derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates conditionally on `personType`\n * (`validateRFC` for persona física / 13 chars, `validateRFCCorporate` for persona\n * moral / 12 chars) and shares the `formatRFC`/`unformatRFC` mask. Both person\n * types map to the same `documentType` value (`rfc`).\n *\n * `document` is **optional** (`required: false`): Mexican invoicing (factura/CFDI)\n * often requires the RFC, but many flows do not collect it. It is still\n * format-validated *when filled*. Consumers that need it mandatory can override\n * `required` in their own schema layer.\n *\n * Email: `juan.perez@example.com` — validated by `validateEmail` (shared).\n * Phone: `(55) 1234 5678` — validated by `validatePhoneMEX`, masked by `formatPhoneMEX`/`unformatPhoneMEX`.\n * Document (individual): `XAXX010101000` — `validateRFC`, masked by `formatRFC`/`unformatRFC`.\n * Document (business): `ABC010101AB1` — `validateRFCCorporate`, masked by `formatRFC`/`unformatRFC`.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/mex`, `rules/masks/mex`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-MEX',\n country: 'MEX',\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 // 18 chars accommodates the longest accepted raw input, \"+52 (33) 1234 5678\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 14-char display \"(55) 1234 5678\".\n maxLength: 18,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.MEX',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneMEX',\n unformatRef: 'unformatPhoneMEX',\n validation: {\n customValidator: 'validatePhoneMEX',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: false,\n inputMode: 'text',\n // 13 = RFC persona física length; persona moral (12) fits within it.\n maxLength: 13,\n formatRef: 'formatRFC',\n unformatRef: 'unformatRFC',\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.rfc.label',\n business: 'country-forms.personal-data.rfcCorporate.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.rfc.placeholder',\n business: 'country-forms.personal-data.rfcCorporate.placeholder',\n },\n conditionalValidator: {\n individual: 'validateRFC',\n business: 'validateRFCCorporate',\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 // Both person types use the RFC; only the validation rule differs.\n derivedValue: {\n individual: 'rfc',\n business: 'rfc',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
@@ -0,0 +1,128 @@
1
+ // src/schemas/personal-data/USA.ts
2
+ var schema = {
3
+ id: "personal-data-USA",
4
+ country: "USA",
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
+ // 17 chars accommodates the longest accepted raw input, "+1 (201) 555-0123",
63
+ // so pasted country-code forms are not truncated before the mask normalizes
64
+ // them to the 14-char display "(201) 555-0123".
65
+ maxLength: 17,
66
+ label: "country-forms.personal-data.phone.label",
67
+ placeholder: "country-forms.personal-data.phone.placeholder.USA",
68
+ required: true,
69
+ inputMode: "tel",
70
+ formatRef: "formatPhoneUSA",
71
+ unformatRef: "unformatPhoneUSA",
72
+ validation: {
73
+ customValidator: "validatePhoneUSA"
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 SSN length ("123-45-6789"); EIN (10) fits within it.
83
+ maxLength: 11,
84
+ dependsOn: "personType",
85
+ conditionalLabel: {
86
+ individual: "country-forms.personal-data.ssn.label",
87
+ business: "country-forms.personal-data.ein.label"
88
+ },
89
+ conditionalPlaceholder: {
90
+ individual: "country-forms.personal-data.ssn.placeholder",
91
+ business: "country-forms.personal-data.ein.placeholder"
92
+ },
93
+ conditionalValidator: {
94
+ individual: "validateSSN",
95
+ business: "validateEIN"
96
+ },
97
+ conditionalFormatRef: {
98
+ individual: "formatSSN",
99
+ business: "formatEIN"
100
+ },
101
+ conditionalUnformatRef: {
102
+ individual: "unformatSSN",
103
+ business: "unformatEIN"
104
+ },
105
+ conditionalVisibility: {
106
+ field: "personType",
107
+ operator: "includes",
108
+ value: ["individual", "business"]
109
+ }
110
+ },
111
+ {
112
+ name: "documentType",
113
+ type: "text",
114
+ label: "country-forms.personal-data.documentType.label",
115
+ required: false,
116
+ derivedFrom: "personType",
117
+ derivedValue: {
118
+ individual: "ssn",
119
+ business: "ein"
120
+ }
121
+ }
122
+ ]
123
+ };
124
+ var USA_default = schema;
125
+
126
+ export { USA_default as default };
127
+ //# sourceMappingURL=USA-2QW25XAI.mjs.map
128
+ //# sourceMappingURL=USA-2QW25XAI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/personal-data/USA.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,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M,UAAA;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,4CAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,SAAA,EAAW,SAAA;AAAA;AAAA,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,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":"USA-2QW25XAI.mjs","sourcesContent":["/**\n * Personal-data schema for the United States (USA).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as SSN) visible\n * - `\"business\"` → `document` (as EIN) 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/masks conditionally on\n * `personType` (SSN for individuals, EIN for businesses); `documentType` is\n * data-only and follows `personType` automatically (`ssn` / `ein`).\n *\n * `document` is **optional** (`required: false`): many US flows (e.g. checkout)\n * do not collect a tax/identity document. It is still format-validated *when\n * filled* (an invalid SSN/EIN is rejected; an empty one is accepted). Consumers\n * 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: `(201) 555-0123` — validated by `validatePhoneUSA`, masked by `formatPhoneUSA`/`unformatPhoneUSA`.\n * Document (individual): `123-45-6789` — `validateSSN`, masked by `formatSSN`/`unformatSSN`.\n * Document (business): `12-3456789` — `validateEIN`, masked by `formatEIN`/`unformatEIN`.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/usa`, `rules/masks/usa`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-USA',\n country: 'USA',\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 // 17 chars accommodates the longest accepted raw input, \"+1 (201) 555-0123\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 14-char display \"(201) 555-0123\".\n maxLength: 17,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.USA',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneUSA',\n unformatRef: 'unformatPhoneUSA',\n validation: {\n customValidator: 'validatePhoneUSA',\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 SSN length (\"123-45-6789\"); EIN (10) fits within it.\n maxLength: 11,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.ssn.label',\n business: 'country-forms.personal-data.ein.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.ssn.placeholder',\n business: 'country-forms.personal-data.ein.placeholder',\n },\n conditionalValidator: {\n individual: 'validateSSN',\n business: 'validateEIN',\n },\n conditionalFormatRef: {\n individual: 'formatSSN',\n business: 'formatEIN',\n },\n conditionalUnformatRef: {\n individual: 'unformatSSN',\n business: 'unformatEIN',\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: 'ssn',\n business: 'ein',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}