@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
@@ -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,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;AAAA,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tB,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-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;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AAAA,MACN,KAAA,EAAO,4CAAA;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,SAAA,EAAW,MAAA;AAAA;AAAA,MAEX,SAAA,EAAW,EAAA;AAAA,MACX,SAAA,EAAW,WAAA;AAAA,MACX,WAAA,EAAa,aAAA;AAAA,MACb,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,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,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A,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"]}
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ // src/schemas/personal-data/USA.ts
4
+ var schema = {
5
+ id: "personal-data-USA",
6
+ country: "USA",
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
+ // 17 chars accommodates the longest accepted raw input, "+1 (201) 555-0123",
65
+ // so pasted country-code forms are not truncated before the mask normalizes
66
+ // them to the 14-char display "(201) 555-0123".
67
+ maxLength: 17,
68
+ label: "country-forms.personal-data.phone.label",
69
+ placeholder: "country-forms.personal-data.phone.placeholder.USA",
70
+ required: true,
71
+ inputMode: "tel",
72
+ formatRef: "formatPhoneUSA",
73
+ unformatRef: "unformatPhoneUSA",
74
+ validation: {
75
+ customValidator: "validatePhoneUSA"
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 SSN length ("123-45-6789"); EIN (10) fits within it.
85
+ maxLength: 11,
86
+ dependsOn: "personType",
87
+ conditionalLabel: {
88
+ individual: "country-forms.personal-data.ssn.label",
89
+ business: "country-forms.personal-data.ein.label"
90
+ },
91
+ conditionalPlaceholder: {
92
+ individual: "country-forms.personal-data.ssn.placeholder",
93
+ business: "country-forms.personal-data.ein.placeholder"
94
+ },
95
+ conditionalValidator: {
96
+ individual: "validateSSN",
97
+ business: "validateEIN"
98
+ },
99
+ conditionalFormatRef: {
100
+ individual: "formatSSN",
101
+ business: "formatEIN"
102
+ },
103
+ conditionalUnformatRef: {
104
+ individual: "unformatSSN",
105
+ business: "unformatEIN"
106
+ },
107
+ conditionalVisibility: {
108
+ field: "personType",
109
+ operator: "includes",
110
+ value: ["individual", "business"]
111
+ }
112
+ },
113
+ {
114
+ name: "documentType",
115
+ type: "text",
116
+ label: "country-forms.personal-data.documentType.label",
117
+ required: false,
118
+ derivedFrom: "personType",
119
+ derivedValue: {
120
+ individual: "ssn",
121
+ business: "ein"
122
+ }
123
+ }
124
+ ]
125
+ };
126
+ var USA_default = schema;
127
+
128
+ module.exports = USA_default;
129
+ //# sourceMappingURL=USA-MWP4SDGW.js.map
130
+ //# sourceMappingURL=USA-MWP4SDGW.js.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,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;AAAA,MACX,SAAA,EAAW,GAAA;AAAA,MACX,qBAAA,EAAuB;AAA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AAA;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-MWP4SDGW.js","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"]}
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var chunkZQQPNXLP_js = require('./chunk-ZQQPNXLP.js');
3
4
  var chunkCFX5EF4R_js = require('./chunk-CFX5EF4R.js');
4
5
 
5
6
  // src/rules/validators/bra.ts
@@ -9,17 +10,6 @@ function validateCEP(value) {
9
10
  if (new Set(digits).size === 1) return "country-forms.validation.postalCode.BRA";
10
11
  return true;
11
12
  }
12
- function validateEmail(value) {
13
- const email = value.trim();
14
- if (!email) {
15
- return "country-forms.validation.invalid";
16
- }
17
- const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/;
18
- if (!emailRegex.test(email)) {
19
- return "country-forms.validation.invalid";
20
- }
21
- return true;
22
- }
23
13
  function validatePhoneBRA(value) {
24
14
  const phoneRegex = /^(?:(?:(?:\+|)55)|)(?:0|)(?:11|12|13|14|15|16|17|18|19|21|22|24|27|28|31|32|33|34|35|36|37|38|41|42|43|44|45|46|47|48|49|51|52|53|54|55|61|62|63|64|65|66|67|68|69|71|72|73|74|75|77|78|79|81|82|83|84|85|86|87|88|89|91|92|93|94|95|96|97|98|99)(?:9\d{8}|[1-8]\d{7})$/;
25
15
  const phone = value.replace(/\D/g, "");
@@ -82,15 +72,17 @@ function validateCNPJ(value) {
82
72
  return true;
83
73
  }
84
74
  chunkCFX5EF4R_js.registerValidator("validateCEP", validateCEP);
85
- chunkCFX5EF4R_js.registerValidator("validateEmail", validateEmail);
86
75
  chunkCFX5EF4R_js.registerValidator("validatePhoneBRA", validatePhoneBRA);
87
76
  chunkCFX5EF4R_js.registerValidator("validateCPF", validateCPF);
88
77
  chunkCFX5EF4R_js.registerValidator("validateCNPJ", validateCNPJ);
89
78
 
79
+ Object.defineProperty(exports, "validateEmail", {
80
+ enumerable: true,
81
+ get: function () { return chunkZQQPNXLP_js.validateEmail; }
82
+ });
90
83
  exports.validateCEP = validateCEP;
91
84
  exports.validateCNPJ = validateCNPJ;
92
85
  exports.validateCPF = validateCPF;
93
- exports.validateEmail = validateEmail;
94
86
  exports.validatePhoneBRA = validatePhoneBRA;
95
- //# sourceMappingURL=bra-MHTXSNLA.js.map
96
- //# sourceMappingURL=bra-MHTXSNLA.js.map
87
+ //# sourceMappingURL=bra-DQO5W7HB.js.map
88
+ //# sourceMappingURL=bra-DQO5W7HB.js.map