@vtex/country-forms 1.1.0 → 1.3.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.
- package/CHANGELOG.md +46 -1
- package/README.md +52 -13
- package/dist/{BRA-PMVV6KOM.js → BRA-CWGYPPBD.js} +43 -27
- package/dist/BRA-CWGYPPBD.js.map +1 -0
- package/dist/{BRA-ZBZXE5II.mjs → BRA-R2DBJTZ2.mjs} +43 -27
- package/dist/BRA-R2DBJTZ2.mjs.map +1 -0
- package/dist/CAN-RDQPFPZU.mjs +127 -0
- package/dist/CAN-RDQPFPZU.mjs.map +1 -0
- package/dist/CAN-ZJQJFUW4.js +129 -0
- package/dist/CAN-ZJQJFUW4.js.map +1 -0
- package/dist/MEX-6CJCALY3.js +125 -0
- package/dist/MEX-6CJCALY3.js.map +1 -0
- package/dist/MEX-ZQL7ZS3G.mjs +123 -0
- package/dist/MEX-ZQL7ZS3G.mjs.map +1 -0
- package/dist/USA-2QW25XAI.mjs +128 -0
- package/dist/USA-2QW25XAI.mjs.map +1 -0
- package/dist/USA-MWP4SDGW.js +130 -0
- package/dist/USA-MWP4SDGW.js.map +1 -0
- package/dist/ar-SA-SIOKG54S.mjs +69 -0
- package/dist/ar-SA-SIOKG54S.mjs.map +1 -0
- package/dist/ar-SA-W6WD6U2J.js +71 -0
- package/dist/ar-SA-W6WD6U2J.js.map +1 -0
- package/dist/bg-BG-JZDO4V5H.mjs +69 -0
- package/dist/bg-BG-JZDO4V5H.mjs.map +1 -0
- package/dist/bg-BG-M7VXC7CN.js +71 -0
- package/dist/bg-BG-M7VXC7CN.js.map +1 -0
- package/dist/{bra-MHTXSNLA.js → bra-DQO5W7HB.js} +7 -15
- package/dist/bra-DQO5W7HB.js.map +1 -0
- package/dist/{bra-ILOTR4AN.mjs → bra-MJUXI46I.mjs} +4 -15
- package/dist/bra-MJUXI46I.mjs.map +1 -0
- package/dist/ca-ES-6EIAUGFL.mjs +69 -0
- package/dist/ca-ES-6EIAUGFL.mjs.map +1 -0
- package/dist/ca-ES-JIEE3YSB.js +71 -0
- package/dist/ca-ES-JIEE3YSB.js.map +1 -0
- package/dist/can-3MOZIOGB.js +65 -0
- package/dist/can-3MOZIOGB.js.map +1 -0
- package/dist/can-DKTB2M6I.mjs +41 -0
- package/dist/can-DKTB2M6I.mjs.map +1 -0
- package/dist/can-LLWX4LC2.js +48 -0
- package/dist/can-LLWX4LC2.js.map +1 -0
- package/dist/can-OONXPDKH.mjs +59 -0
- package/dist/can-OONXPDKH.mjs.map +1 -0
- package/dist/chunk-B2XPLIJU.mjs +19 -0
- package/dist/chunk-B2XPLIJU.mjs.map +1 -0
- package/dist/chunk-ZQQPNXLP.js +21 -0
- package/dist/chunk-ZQQPNXLP.js.map +1 -0
- package/dist/common-E4IN3G46.mjs +4 -0
- package/dist/common-E4IN3G46.mjs.map +1 -0
- package/dist/common-LFDTUEMM.js +13 -0
- package/dist/common-LFDTUEMM.js.map +1 -0
- package/dist/cs-CZ-KHYD2YJP.js +71 -0
- package/dist/cs-CZ-KHYD2YJP.js.map +1 -0
- package/dist/cs-CZ-ZRHS2Z7M.mjs +69 -0
- package/dist/cs-CZ-ZRHS2Z7M.mjs.map +1 -0
- package/dist/da-DK-6P3RNZ65.js +71 -0
- package/dist/da-DK-6P3RNZ65.js.map +1 -0
- package/dist/da-DK-FP3P352Z.mjs +69 -0
- package/dist/da-DK-FP3P352Z.mjs.map +1 -0
- package/dist/de-DE-IQHNQRXU.js +71 -0
- package/dist/de-DE-IQHNQRXU.js.map +1 -0
- package/dist/de-DE-NZJR3EPR.mjs +69 -0
- package/dist/de-DE-NZJR3EPR.mjs.map +1 -0
- package/dist/el-GR-3BSJEUT3.js +71 -0
- package/dist/el-GR-3BSJEUT3.js.map +1 -0
- package/dist/el-GR-SJU4XLTR.mjs +69 -0
- package/dist/el-GR-SJU4XLTR.mjs.map +1 -0
- package/dist/en-US-BMSEMR3V.mjs +69 -0
- package/dist/en-US-BMSEMR3V.mjs.map +1 -0
- package/dist/en-US-ECWNONM7.js +71 -0
- package/dist/en-US-ECWNONM7.js.map +1 -0
- package/dist/es-MX-OEVEGKIR.js +71 -0
- package/dist/es-MX-OEVEGKIR.js.map +1 -0
- package/dist/es-MX-YIDSNQFO.mjs +69 -0
- package/dist/es-MX-YIDSNQFO.mjs.map +1 -0
- package/dist/fi-FI-D7YYJLZX.mjs +69 -0
- package/dist/fi-FI-D7YYJLZX.mjs.map +1 -0
- package/dist/fi-FI-NBVEC6C7.js +71 -0
- package/dist/fi-FI-NBVEC6C7.js.map +1 -0
- package/dist/{fr-FR-LJIPE6BH.js → fr-FR-IU6UXAXT.js} +30 -10
- package/dist/fr-FR-IU6UXAXT.js.map +1 -0
- package/dist/{fr-FR-KWQ3MPP5.mjs → fr-FR-MPBKVFXY.mjs} +30 -10
- package/dist/fr-FR-MPBKVFXY.mjs.map +1 -0
- package/dist/hu-HU-5KQMYHTZ.mjs +69 -0
- package/dist/hu-HU-5KQMYHTZ.mjs.map +1 -0
- package/dist/hu-HU-IXMSWLNZ.js +71 -0
- package/dist/hu-HU-IXMSWLNZ.js.map +1 -0
- package/dist/id-ID-2ESPXRTF.js +71 -0
- package/dist/id-ID-2ESPXRTF.js.map +1 -0
- package/dist/id-ID-43IVZSYW.mjs +69 -0
- package/dist/id-ID-43IVZSYW.mjs.map +1 -0
- package/dist/index.d.mts +233 -20
- package/dist/index.d.ts +233 -20
- package/dist/index.js +266 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +259 -39
- package/dist/index.mjs.map +1 -1
- package/dist/it-IT-KCNTLXEI.js +71 -0
- package/dist/it-IT-KCNTLXEI.js.map +1 -0
- package/dist/it-IT-XYKU7OTJ.mjs +69 -0
- package/dist/it-IT-XYKU7OTJ.mjs.map +1 -0
- package/dist/ja-JP-63ZZJM4K.js +71 -0
- package/dist/ja-JP-63ZZJM4K.js.map +1 -0
- package/dist/ja-JP-PNND5YFG.mjs +69 -0
- package/dist/ja-JP-PNND5YFG.mjs.map +1 -0
- package/dist/ko-KR-FH2T2VEV.js +71 -0
- package/dist/ko-KR-FH2T2VEV.js.map +1 -0
- package/dist/ko-KR-LCD642SY.mjs +69 -0
- package/dist/ko-KR-LCD642SY.mjs.map +1 -0
- package/dist/mex-AMEX6IHY.mjs +108 -0
- package/dist/mex-AMEX6IHY.mjs.map +1 -0
- package/dist/mex-DYWVMWB6.js +38 -0
- package/dist/mex-DYWVMWB6.js.map +1 -0
- package/dist/mex-VX3Y5I6I.mjs +33 -0
- package/dist/mex-VX3Y5I6I.mjs.map +1 -0
- package/dist/mex-Y56WV2L7.js +114 -0
- package/dist/mex-Y56WV2L7.js.map +1 -0
- package/dist/nb-NO-NQITOZPA.js +71 -0
- package/dist/nb-NO-NQITOZPA.js.map +1 -0
- package/dist/nb-NO-Z5JX3HYO.mjs +69 -0
- package/dist/nb-NO-Z5JX3HYO.mjs.map +1 -0
- package/dist/nl-NL-HZODT2YX.mjs +69 -0
- package/dist/nl-NL-HZODT2YX.mjs.map +1 -0
- package/dist/nl-NL-OLAORJAP.js +71 -0
- package/dist/nl-NL-OLAORJAP.js.map +1 -0
- package/dist/pl-PL-UMJTTHWX.mjs +69 -0
- package/dist/pl-PL-UMJTTHWX.mjs.map +1 -0
- package/dist/pl-PL-UWOMEGDC.js +71 -0
- package/dist/pl-PL-UWOMEGDC.js.map +1 -0
- package/dist/pt-BR-BVRXRMDM.js +71 -0
- package/dist/pt-BR-BVRXRMDM.js.map +1 -0
- package/dist/pt-BR-KDFQZFNO.mjs +69 -0
- package/dist/pt-BR-KDFQZFNO.mjs.map +1 -0
- package/dist/pt-PT-BUEHVMWK.mjs +69 -0
- package/dist/pt-PT-BUEHVMWK.mjs.map +1 -0
- package/dist/pt-PT-I4ND64JI.js +71 -0
- package/dist/pt-PT-I4ND64JI.js.map +1 -0
- package/dist/ro-RO-JRYCW7PF.js +71 -0
- package/dist/ro-RO-JRYCW7PF.js.map +1 -0
- package/dist/ro-RO-MENVW6ZF.mjs +69 -0
- package/dist/ro-RO-MENVW6ZF.mjs.map +1 -0
- package/dist/ru-RU-FMI7PJAA.mjs +69 -0
- package/dist/ru-RU-FMI7PJAA.mjs.map +1 -0
- package/dist/ru-RU-NKOHON7P.js +71 -0
- package/dist/ru-RU-NKOHON7P.js.map +1 -0
- package/dist/sk-SK-G4Z4KYN2.mjs +69 -0
- package/dist/sk-SK-G4Z4KYN2.mjs.map +1 -0
- package/dist/sk-SK-HBZS6TYX.js +71 -0
- package/dist/sk-SK-HBZS6TYX.js.map +1 -0
- package/dist/sl-SI-JAXM5ZRI.mjs +69 -0
- package/dist/sl-SI-JAXM5ZRI.mjs.map +1 -0
- package/dist/sl-SI-QHJ656PZ.js +71 -0
- package/dist/sl-SI-QHJ656PZ.js.map +1 -0
- package/dist/sv-SE-CXGY47PC.mjs +69 -0
- package/dist/sv-SE-CXGY47PC.mjs.map +1 -0
- package/dist/sv-SE-OHZU6ZE3.js +71 -0
- package/dist/sv-SE-OHZU6ZE3.js.map +1 -0
- package/dist/th-TH-GZP27XYY.mjs +69 -0
- package/dist/th-TH-GZP27XYY.mjs.map +1 -0
- package/dist/th-TH-NHNIX64G.js +71 -0
- package/dist/th-TH-NHNIX64G.js.map +1 -0
- package/dist/uk-UA-MUTERDP2.mjs +69 -0
- package/dist/uk-UA-MUTERDP2.mjs.map +1 -0
- package/dist/uk-UA-VQC3SULE.js +71 -0
- package/dist/uk-UA-VQC3SULE.js.map +1 -0
- package/dist/usa-AC7YPVS3.mjs +52 -0
- package/dist/usa-AC7YPVS3.mjs.map +1 -0
- package/dist/usa-B6NCCTF6.js +61 -0
- package/dist/usa-B6NCCTF6.js.map +1 -0
- package/dist/usa-LOOP7MRM.mjs +55 -0
- package/dist/usa-LOOP7MRM.mjs.map +1 -0
- package/dist/usa-OQ44AFEI.js +61 -0
- package/dist/usa-OQ44AFEI.js.map +1 -0
- package/package.json +1 -1
- package/dist/BRA-PMVV6KOM.js.map +0 -1
- package/dist/BRA-ZBZXE5II.mjs.map +0 -1
- package/dist/bra-ILOTR4AN.mjs.map +0 -1
- package/dist/bra-MHTXSNLA.js.map +0 -1
- package/dist/can-7TMYDEJF.mjs +0 -17
- package/dist/can-7TMYDEJF.mjs.map +0 -1
- package/dist/can-B5ME2ZFN.js +0 -20
- package/dist/can-B5ME2ZFN.js.map +0 -1
- package/dist/can-FGNN5MZS.mjs +0 -19
- package/dist/can-FGNN5MZS.mjs.map +0 -1
- package/dist/can-LLJ4A5Y5.js +0 -21
- package/dist/can-LLJ4A5Y5.js.map +0 -1
- package/dist/en-US-RLEM27ZZ.js +0 -51
- package/dist/en-US-RLEM27ZZ.js.map +0 -1
- package/dist/en-US-YW7UYXNB.mjs +0 -49
- package/dist/en-US-YW7UYXNB.mjs.map +0 -1
- package/dist/es-MX-AGRGVXRK.mjs +0 -49
- package/dist/es-MX-AGRGVXRK.mjs.map +0 -1
- package/dist/es-MX-K5MWKMJW.js +0 -51
- package/dist/es-MX-K5MWKMJW.js.map +0 -1
- package/dist/fr-FR-KWQ3MPP5.mjs.map +0 -1
- package/dist/fr-FR-LJIPE6BH.js.map +0 -1
- package/dist/mex-5BKCF6LS.js +0 -21
- package/dist/mex-5BKCF6LS.js.map +0 -1
- package/dist/mex-G3HMNBBF.mjs +0 -19
- package/dist/mex-G3HMNBBF.mjs.map +0 -1
- package/dist/pt-BR-74IZNREP.js +0 -51
- package/dist/pt-BR-74IZNREP.js.map +0 -1
- package/dist/pt-BR-P2RZ3X3H.mjs +0 -49
- package/dist/pt-BR-P2RZ3X3H.mjs.map +0 -1
- package/dist/usa-3AM7UFVG.js +0 -20
- package/dist/usa-3AM7UFVG.js.map +0 -1
- package/dist/usa-I7DK2CTL.mjs +0 -18
- package/dist/usa-I7DK2CTL.mjs.map +0 -1
- package/dist/usa-LXT6WW64.js +0 -21
- package/dist/usa-LXT6WW64.js.map +0 -1
- package/dist/usa-ZD5OWGAD.mjs +0 -18
- package/dist/usa-ZD5OWGAD.mjs.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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data schema for Canada (CAN).\n *\n * Field order: personType → firstName → lastName → email → phone → document → documentType\n *\n * `personType` drives conditional visibility:\n * - `\"individual\"` → `lastName`, `document` (as SIN) visible\n * - `\"business\"` → `document` (as BN) visible; `lastName` hidden\n *\n * `firstName` uses `conditionalLabel` keyed by `personType`:\n * - `\"individual\"` → \"First name\"\n * - `\"business\"` → \"Company name\"\n *\n * `lastName` is only visible for individuals (hidden for businesses).\n *\n * ## Document model (API-aligned)\n *\n * The tax/identity document is collected through a single `document` field plus a\n * derived `documentType` field, mirroring the `{ document, documentType }` shape\n * used by VTEX profile APIs. `document` validates conditionally on `personType`\n * (SIN for individuals, BN for businesses) and masks only the SIN; `documentType`\n * is data-only and follows `personType` automatically (`sin` / `bn`).\n *\n * `document` is **optional** (`required: false`): many Canadian flows (e.g.\n * checkout) do not collect a tax/identity document. It is still format-validated\n * *when filled* (an invalid SIN/BN is rejected; an empty one is accepted).\n * Consumers that need it mandatory can override `required` in their own schema layer.\n *\n * Email: `jane.doe@example.com` — validated by `validateEmail` (shared).\n * Phone: `613-555-0123` — validated by `validatePhoneCAN`, masked by `formatPhoneCAN`/`unformatPhoneCAN`.\n * Document (individual): `046-454-286` — `validateSIN` (9 digits + Luhn), masked by `formatSIN`/`unformatSIN`.\n * Document (business): `123456789` — `validateBN` (9 digits, structural); no mask.\n *\n * Required rule modules: `rules/validators/common`, `rules/validators/can`, `rules/masks/can`\n */\nimport type { FormSchema } from '../../types'\n\nconst schema = {\n id: 'personal-data-CAN',\n country: 'CAN',\n formType: 'personal-data',\n fields: [\n {\n name: 'personType',\n type: 'radio-group',\n label: 'country-forms.personal-data.personType.label',\n required: true,\n options: [\n { value: 'individual', displayValue: 'country-forms.personal-data.personType.individual' },\n { value: 'business', displayValue: 'country-forms.personal-data.personType.business' },\n ],\n },\n {\n name: 'firstName',\n type: 'text',\n label: 'country-forms.personal-data.firstName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.firstName.label.individual',\n business: 'country-forms.personal-data.firstName.label.business',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'lastName',\n type: 'text',\n label: 'country-forms.personal-data.lastName.label',\n required: true,\n inputMode: 'text',\n maxLength: 200,\n conditionalVisibility: {\n field: 'personType',\n operator: 'equals',\n value: 'individual',\n },\n validation: {\n maxLength: { value: 200, message: 'country-forms.validation.maxLength' },\n },\n },\n {\n name: 'email',\n type: 'email',\n label: 'country-forms.personal-data.email.label',\n required: true,\n inputMode: 'email',\n validation: {\n customValidator: 'validateEmail',\n },\n },\n {\n name: 'phone',\n type: 'text',\n // 15 chars accommodates the longest accepted raw input, \"+1 613-555-0123\",\n // so pasted country-code forms are not truncated before the mask normalizes\n // them to the 12-char display \"613-555-0123\".\n maxLength: 15,\n label: 'country-forms.personal-data.phone.label',\n placeholder: 'country-forms.personal-data.phone.placeholder.CAN',\n required: true,\n inputMode: 'tel',\n formatRef: 'formatPhoneCAN',\n unformatRef: 'unformatPhoneCAN',\n validation: {\n customValidator: 'validatePhoneCAN',\n },\n },\n {\n name: 'document',\n type: 'text',\n label: 'country-forms.personal-data.document.label',\n required: false,\n inputMode: 'numeric',\n // 11 = formatted SIN length (\"046-454-286\"); BN (9) fits within it.\n maxLength: 11,\n dependsOn: 'personType',\n conditionalLabel: {\n individual: 'country-forms.personal-data.sin.label',\n business: 'country-forms.personal-data.bn.label',\n },\n conditionalPlaceholder: {\n individual: 'country-forms.personal-data.sin.placeholder',\n business: 'country-forms.personal-data.bn.placeholder',\n },\n conditionalValidator: {\n individual: 'validateSIN',\n business: 'validateBN',\n },\n // BN has no mask — only the SIN (individual) declares format/unformat refs.\n conditionalFormatRef: {\n individual: 'formatSIN',\n },\n conditionalUnformatRef: {\n individual: 'unformatSIN',\n },\n conditionalVisibility: {\n field: 'personType',\n operator: 'includes',\n value: ['individual', 'business'],\n },\n },\n {\n name: 'documentType',\n type: 'text',\n label: 'country-forms.personal-data.documentType.label',\n required: false,\n derivedFrom: 'personType',\n derivedValue: {\n individual: 'sin',\n business: 'bn',\n },\n },\n ],\n} satisfies FormSchema\n\nexport default schema\n"]}
|
|
@@ -0,0 +1,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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* 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,EA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.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,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,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"]}
|