@incodetech/core 0.0.0-dev-20261201-e37652f8 → 0.0.0-dev-20261201-bcf41e7a
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/dist/{FaceDetectionProvider-DQYbHLxC.esm.js → FaceDetectionProvider-C5dOOMt6.esm.js} +4 -4
- package/dist/{addressSearch-gginelz3.esm.js → addressSearch-Bw456gzP.esm.js} +2 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-BRiJu_rv.esm.js → apiError-CJO7D9eZ.esm.js} +1 -1
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-CrBlRkAd.esm.js → authenticationManager-aN4L7zuz.esm.js} +3 -3
- package/dist/{authenticationStateMachine-DLwEyCeH.esm.js → authenticationStateMachine-CrqkFPRT.esm.js} +3 -3
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-Bow34QP_.d.ts → consentManager-9ThuTAcx.d.ts} +13 -13
- package/dist/{deepsightCaptureConfig-BVJANeRn.esm.js → deepsightCaptureConfig-C66ahpbd.esm.js} +2 -2
- package/dist/{deepsightLoader-C6nKqY9Q.esm.js → deepsightLoader-C79inICH.esm.js} +4 -4
- package/dist/{desktopCameraElection-BAq-Kaiq.esm.js → desktopCameraElection-U5cGf_FU.esm.js} +4 -4
- package/dist/document-capture.d.ts +1 -1
- package/dist/document-signature.esm.js +1 -1
- package/dist/{documentCaptureManager-DOgJTJ4F.d.ts → documentCaptureManager-sJWgqtUy.d.ts} +4 -4
- package/dist/{documentSignatureStateMachine-Btlg3q7j.esm.js → documentSignatureStateMachine-DqqwvvDm.esm.js} +1 -1
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-SbEUnFoF.esm.js → dynamicFormsManager-DK7vxpMH.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-Dxv36mAP.esm.js → dynamicFormsStateMachine-DLF8DYpl.esm.js} +1 -1
- package/dist/ekyb.esm.js +2 -2
- package/dist/{ekybManager-xhoOX9O9.esm.js → ekybManager-DP1MEUQ_.esm.js} +1 -1
- package/dist/{ekybStateMachine-CCjUH0j3.esm.js → ekybStateMachine-DYUl09cC.esm.js} +371 -1113
- package/dist/ekyc-prefill.esm.js +2 -2
- package/dist/ekyc.esm.js +2 -2
- package/dist/{ekycManager-DrGuK0kT.esm.js → ekycManager-Y9JjrHvd.esm.js} +1 -1
- package/dist/{ekycPrefillManager-C9kdwCC6.esm.js → ekycPrefillManager-CZldcVY5.esm.js} +2 -2
- package/dist/{ekycPrefillStateMachine-DiQifkkd.esm.js → ekycPrefillStateMachine-B8T-GZIi.esm.js} +122 -140
- package/dist/ekycStateMachine-3FCrYuNv.esm.js +5072 -0
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-C6liTNbu.esm.js → electronicSignatureManager-DnpxTBha.esm.js} +1 -1
- package/dist/extensibility.d.ts +5 -5
- package/dist/extensibility.esm.js +13 -13
- package/dist/{faceCaptureManagerFactory-OL8BWaIW.esm.js → faceCaptureManagerFactory-B15Ry9Bj.esm.js} +2 -2
- package/dist/{faceCaptureSetup-DQVtmb1q.esm.js → faceCaptureSetup-B944AKd-.esm.js} +7 -7
- package/dist/{feature-management-D_T-MG_i.esm.js → feature-management-BQSa2eVc.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-L0J63ui-.esm.js → flowCompletionService-D2aikrG9.esm.js} +1 -1
- package/dist/{flowServices-3OXrEqDE.esm.js → flowServices-E3lKW8An.esm.js} +4 -4
- package/dist/{formErrors-kpskZLNT.esm.js → formErrors-BVC6OSFV.esm.js} +1 -1
- package/dist/geolocation.d.ts +1 -1
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-CREfQNgO.esm.js → geolocationManager-AasT8XSO.esm.js} +1 -1
- package/dist/{geolocationManager-Del2ddmt.d.ts → geolocationManager-CENrvxpK.d.ts} +1 -1
- package/dist/{geolocationStateMachine-D9_bBr19.esm.js → geolocationStateMachine-BhtSd3lc.esm.js} +1 -1
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-selfie-flow.esm.js +6 -6
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureManager-B5ZN7scK.esm.js → idCaptureManager-DHmvbvgU.esm.js} +4 -4
- package/dist/{idCaptureServices-7zZ457LW.esm.js → idCaptureServices-DBtFQvpt.esm.js} +2 -2
- package/dist/{idCaptureStateMachine-FP4j-qeT.esm.js → idCaptureStateMachine-BoTNUq6T.esm.js} +11 -11
- package/dist/{idOcrManager-C0C7lFGd.d.ts → idOcrManager-DflRx-_u.d.ts} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/kyb-checks.esm.js +2 -2
- package/dist/{kybChecksManager-tUsFKBCN.esm.js → kybChecksManager-BN5CnCkm.esm.js} +1 -1
- package/dist/{kybChecksStateMachine-D1q4K7Xr.esm.js → kybChecksStateMachine-CMVaVAsg.esm.js} +3 -3
- package/dist/mandatory-consent.d.ts +1 -1
- package/dist/{mandatoryConsentManager-De9ZX6o4.d.ts → mandatoryConsentManager-C5o1gUTc.d.ts} +7 -7
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{recordingService-OcyZO_w6.esm.js → recordingService-Dy27FR2M.esm.js} +1 -1
- package/dist/{runChildModule-BuZFd3Df.esm.js → runChildModule-DSSE84df.esm.js} +1 -1
- package/dist/{sdkVersion-BY8g-EEL.esm.js → sdkVersion-BSGdHq76.esm.js} +1 -1
- package/dist/selfie.esm.js +7 -7
- package/dist/{selfieErrorUtils-DIVWh0ih.esm.js → selfieErrorUtils-Bh1ocgV4.esm.js} +1 -1
- package/dist/{selfieManager-DQ5xB8y6.esm.js → selfieManager-C9ZJq0Z3.esm.js} +3 -3
- package/dist/{selfieStateMachine-fyNh2r31.esm.js → selfieStateMachine-xLHsQPLy.esm.js} +3 -3
- package/dist/{session-DKnCv6zu.esm.js → session-Bty0Uulw.esm.js} +4 -4
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-q5b8Qwr3.esm.js → sessionInitializer-CvOQVUFs.esm.js} +4 -4
- package/dist/{setup-JGwc0kgu.esm.js → setup-BIu7oJOZ.esm.js} +5 -5
- package/dist/{trim-OmrUb6mG.esm.js → trim-JimszAvC.esm.js} +7 -1
- package/dist/trueSight-BOq-NOAC.esm.js +1 -0
- package/dist/{trueSightService-Dx8AqgKD.esm.js → trueSightService-B9lkK1VF.esm.js} +1 -1
- package/dist/{uppercase-CwlIuiwR.esm.js → uppercase-BShuo-xK.esm.js} +24 -2
- package/dist/video-selfie.esm.js +3 -3
- package/dist/{videoSelfieCameraWarmer-AoMytGBD.esm.js → videoSelfieCameraWarmer-Dg-NDqO8.esm.js} +23 -8
- package/dist/wasm.esm.js +1 -1
- package/dist/workflow.d.ts +4 -4
- package/dist/workflow.esm.js +18 -18
- package/package.json +2 -2
- package/dist/ekycStateMachine-BmMdLe2G.esm.js +0 -9328
- package/dist/trueSight-9VsfHXFt.esm.js +0 -1
|
@@ -0,0 +1,5072 @@
|
|
|
1
|
+
import { t as getLocalIsoDate } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
|
|
2
|
+
import { t as api, u as endpoints } from "./api-CsXnB7m6.esm.js";
|
|
3
|
+
import { n as loadPhoneValidation, t as getPhoneValidation } from "./phoneValidation-OggtfjRt.esm.js";
|
|
4
|
+
import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
5
|
+
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
6
|
+
import { t as isValidCurp } from "./curp-DZGvefg3.esm.js";
|
|
7
|
+
import { a as hasNameCharacters, c as isEmailFormat, d as resolvePrefill, f as isValidRut, h as isValidEsDni, i as isNotFuture, l as digitCountError, m as isValidFiPersonalIdentityCode, n as hasScriptCharacters, o as isWithinMaxAge, p as isValidInDrivingLicenseNumber, r as isInNumericRange, s as isPoBox, u as hasDigitCount } from "./scriptCharacters-D7swUycV.esm.js";
|
|
8
|
+
import { n as calendarDateError } from "./calendarDate-D2zWfUlA.esm.js";
|
|
9
|
+
import { c as expandDefinitions, o as createBundledDefinitionSource, s as matchesCharTemplate } from "./uppercase-BShuo-xK.esm.js";
|
|
10
|
+
import { n as usStates, t as usStateOptions } from "./usStates-CwOQ2kAx.esm.js";
|
|
11
|
+
import { a as formatPostalCode, c as getPostalCodeMaxLength, d as fillFromSuggestion, f as getStreetLevelErrorForSuggestion, i as PAYLOAD_TRANSFORMS, l as validatePostalCode, n as searchAddress, o as getPostalCodeErrorKey, p as keepSuggestionInOptions, r as standardDeps, s as getPostalCodeErrorParams, t as debounceSearchActor, u as STREET_LEVEL_REQUIRED_ERROR } from "./addressSearch-Bw456gzP.esm.js";
|
|
12
|
+
import { a as buildPayload, i as checkSupport, l as DYNAMIC_REQUIRED_KEY, r as resolveForm } from "./trim-JimszAvC.esm.js";
|
|
13
|
+
import { t as isFormDefinitionsEnabled } from "./formDefinitionsRollout-B-c4yO2z.esm.js";
|
|
14
|
+
import { C as ONE_OF_REQUIRED_GROUPS, D as TAX_ID_SOURCES, E as STREET_SOURCES, O as VOCABULARY, S as NAME_SOURCES, T as STATE_CODE_HINTS, _ as COUNTRY_CODE_OMITTED_SOURCES, a as getEKYCFields, b as HOUSE_NO_SOURCES, c as isFieldOptional, f as toEkycConfigFor, g as CITY_SOURCES, h as APARTMENT_SOURCES, i as getEKYCDisplayModes, k as EKYC_INDEX, l as mapToEKYCvalue, m as ADDRESS_STATE_SOURCES, o as getEkycRiskAddons, p as withRiskAddonFields, r as getEKYCCountry, s as getRiskAddonFields, t as EKYC_GROUP_KEYS, u as resolveEkycSource, v as COUNTRY_SELECTOR_DISABLED_SOURCES, w as POSTAL_CODE_SOURCES, x as MIDDLE_NAME_SOURCES, y as EMAIL_SOURCES } from "./ekycUtils-DfBNTcvX.esm.js";
|
|
15
|
+
import { t as DateFormattingProvider } from "./DateFormattingProvider-DPq9zco-.esm.js";
|
|
16
|
+
import { t as validateCPF } from "./cpf-DDXMTLYr.esm.js";
|
|
17
|
+
import { n as hasAllowedCharacters } from "./allowedCharacters-Bnir--CN.esm.js";
|
|
18
|
+
const brStateOptions = Object.values({
|
|
19
|
+
AC: {
|
|
20
|
+
code: "AC",
|
|
21
|
+
name: "Acre"
|
|
22
|
+
},
|
|
23
|
+
AL: {
|
|
24
|
+
code: "AL",
|
|
25
|
+
name: "Alagoas"
|
|
26
|
+
},
|
|
27
|
+
AP: {
|
|
28
|
+
code: "AP",
|
|
29
|
+
name: "Amapá"
|
|
30
|
+
},
|
|
31
|
+
AM: {
|
|
32
|
+
code: "AM",
|
|
33
|
+
name: "Amazonas"
|
|
34
|
+
},
|
|
35
|
+
BA: {
|
|
36
|
+
code: "BA",
|
|
37
|
+
name: "Bahia"
|
|
38
|
+
},
|
|
39
|
+
CE: {
|
|
40
|
+
code: "CE",
|
|
41
|
+
name: "Ceará"
|
|
42
|
+
},
|
|
43
|
+
DF: {
|
|
44
|
+
code: "DF",
|
|
45
|
+
name: "Distrito Federal"
|
|
46
|
+
},
|
|
47
|
+
ES: {
|
|
48
|
+
code: "ES",
|
|
49
|
+
name: "Espírito Santo"
|
|
50
|
+
},
|
|
51
|
+
GO: {
|
|
52
|
+
code: "GO",
|
|
53
|
+
name: "Goiás"
|
|
54
|
+
},
|
|
55
|
+
MA: {
|
|
56
|
+
code: "MA",
|
|
57
|
+
name: "Maranhão"
|
|
58
|
+
},
|
|
59
|
+
MT: {
|
|
60
|
+
code: "MT",
|
|
61
|
+
name: "Mato Grosso"
|
|
62
|
+
},
|
|
63
|
+
MS: {
|
|
64
|
+
code: "MS",
|
|
65
|
+
name: "Mato Grosso do Sul"
|
|
66
|
+
},
|
|
67
|
+
MG: {
|
|
68
|
+
code: "MG",
|
|
69
|
+
name: "Minas Gerais"
|
|
70
|
+
},
|
|
71
|
+
PA: {
|
|
72
|
+
code: "PA",
|
|
73
|
+
name: "Pará"
|
|
74
|
+
},
|
|
75
|
+
PB: {
|
|
76
|
+
code: "PB",
|
|
77
|
+
name: "Paraíba"
|
|
78
|
+
},
|
|
79
|
+
PR: {
|
|
80
|
+
code: "PR",
|
|
81
|
+
name: "Paraná"
|
|
82
|
+
},
|
|
83
|
+
PE: {
|
|
84
|
+
code: "PE",
|
|
85
|
+
name: "Pernambuco"
|
|
86
|
+
},
|
|
87
|
+
PI: {
|
|
88
|
+
code: "PI",
|
|
89
|
+
name: "Piauí"
|
|
90
|
+
},
|
|
91
|
+
RJ: {
|
|
92
|
+
code: "RJ",
|
|
93
|
+
name: "Rio de Janeiro"
|
|
94
|
+
},
|
|
95
|
+
RN: {
|
|
96
|
+
code: "RN",
|
|
97
|
+
name: "Rio Grande do Norte"
|
|
98
|
+
},
|
|
99
|
+
RS: {
|
|
100
|
+
code: "RS",
|
|
101
|
+
name: "Rio Grande do Sul"
|
|
102
|
+
},
|
|
103
|
+
RO: {
|
|
104
|
+
code: "RO",
|
|
105
|
+
name: "Rondônia"
|
|
106
|
+
},
|
|
107
|
+
RR: {
|
|
108
|
+
code: "RR",
|
|
109
|
+
name: "Roraima"
|
|
110
|
+
},
|
|
111
|
+
SC: {
|
|
112
|
+
code: "SC",
|
|
113
|
+
name: "Santa Catarina"
|
|
114
|
+
},
|
|
115
|
+
SP: {
|
|
116
|
+
code: "SP",
|
|
117
|
+
name: "São Paulo"
|
|
118
|
+
},
|
|
119
|
+
SE: {
|
|
120
|
+
code: "SE",
|
|
121
|
+
name: "Sergipe"
|
|
122
|
+
},
|
|
123
|
+
TO: {
|
|
124
|
+
code: "TO",
|
|
125
|
+
name: "Tocantins"
|
|
126
|
+
}
|
|
127
|
+
}).map((state) => ({
|
|
128
|
+
value: state.code,
|
|
129
|
+
label: state.name
|
|
130
|
+
}));
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/shared/validators/textRules.ts
|
|
133
|
+
const CHARACTER_CLASSES = [
|
|
134
|
+
"letter",
|
|
135
|
+
"digit",
|
|
136
|
+
"space"
|
|
137
|
+
];
|
|
138
|
+
const UNICODE_SCRIPTS = ["Han"];
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/shared/phoneFormat.ts
|
|
141
|
+
/**
|
|
142
|
+
* The phone in E.164, or the value as typed when the rules are not loaded
|
|
143
|
+
* (`loadPhoneValidation()`) or the number is not valid.
|
|
144
|
+
*/
|
|
145
|
+
function formatPhoneE164(phone, country) {
|
|
146
|
+
return getPhoneValidation()?.formatE164(phone, country) ?? phone;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/modules/ekyc/ekycValidators.ts
|
|
150
|
+
async function loadPhoneValidator() {
|
|
151
|
+
if (!await loadPhoneValidation()) throw new Error("Failed to load the phone validation rules");
|
|
152
|
+
}
|
|
153
|
+
/** Progressively formats an SSN as XXX-XX-XXXX */
|
|
154
|
+
function formatSSN(value) {
|
|
155
|
+
const ssn = value?.replace(/\D/g, "") ?? "";
|
|
156
|
+
if (ssn.length < 4) return ssn;
|
|
157
|
+
if (ssn.length < 6) return `${ssn.slice(0, 3)}-${ssn.slice(3)}`;
|
|
158
|
+
return `${ssn.slice(0, 3)}-${ssn.slice(3, 5)}-${ssn.slice(5, 9)}`;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Strips characters a name can't contain, as the user types. Keeps everything
|
|
162
|
+
* `nameCharacters` allows (letters from any script with their combining marks,
|
|
163
|
+
* spaces, hyphens, and straight or typographic apostrophes), plus the commas
|
|
164
|
+
* and acute accents (´) SDKv1 kept, so it never strips a valid name.
|
|
165
|
+
*/
|
|
166
|
+
function cleanName(name) {
|
|
167
|
+
return (name ?? "").replace(/[^\p{L}\p{M}\s,'’´-]/gu, "").slice(0, 100);
|
|
168
|
+
}
|
|
169
|
+
function validatePhone(phone, country) {
|
|
170
|
+
return getPhoneValidation()?.isValid(phone, country) ?? false;
|
|
171
|
+
}
|
|
172
|
+
/** The phone's national significant number, or the value as typed. */
|
|
173
|
+
function formatPhoneNational(phone, country) {
|
|
174
|
+
return getPhoneValidation()?.nationalNumber(phone, country) ?? phone;
|
|
175
|
+
}
|
|
176
|
+
/** The error key a `oneOfRequired` group shows: its own message, or DOB-or-SSN. */
|
|
177
|
+
const oneOfRequiredErrorKey = (rule) => rule.message ?? "verification.errors.dobOrSsnRequired";
|
|
178
|
+
const PHONE_INVALID_KEY = "verification.errors.phoneInvalid";
|
|
179
|
+
const INVALID_ID_NUMBER_KEY = "verification.errors.invalidIdNumber";
|
|
180
|
+
/**
|
|
181
|
+
* A national ID check: blank passes, anything else must satisfy `isValid`.
|
|
182
|
+
* The error is the vocabulary's message for these rules; a definition names
|
|
183
|
+
* its own with the rule's `message`.
|
|
184
|
+
*/
|
|
185
|
+
const idNumberValidator = (isValid) => (value) => {
|
|
186
|
+
if (value.trim().length === 0) return void 0;
|
|
187
|
+
if (isValid(value)) return void 0;
|
|
188
|
+
return { key: INVALID_ID_NUMBER_KEY };
|
|
189
|
+
};
|
|
190
|
+
const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
|
|
191
|
+
const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
|
|
192
|
+
const requiredError = (field) => {
|
|
193
|
+
const fieldName = field.displayLabel ?? field.label;
|
|
194
|
+
return fieldName ? {
|
|
195
|
+
key: DYNAMIC_REQUIRED_KEY,
|
|
196
|
+
params: { fieldName }
|
|
197
|
+
} : { key: DYNAMIC_REQUIRED_KEY };
|
|
198
|
+
};
|
|
199
|
+
const isFilled = (values, name) => normalizeFieldValue(values[name]).trim().length > 0;
|
|
200
|
+
const createValidators = () => {
|
|
201
|
+
const validators = {
|
|
202
|
+
required: (value, _rule, field) => {
|
|
203
|
+
if (value.trim().length > 0) return void 0;
|
|
204
|
+
return requiredError(field);
|
|
205
|
+
},
|
|
206
|
+
requiredIfFilled: (value, rule, field, values) => {
|
|
207
|
+
if (rule.type !== "requiredIfFilled") return void 0;
|
|
208
|
+
if (value.trim().length > 0) return void 0;
|
|
209
|
+
return rule.fields.some((name) => isFilled(values, name)) ? requiredError(field) : void 0;
|
|
210
|
+
},
|
|
211
|
+
rulesByOption: (value, rule, field, values) => {
|
|
212
|
+
if (rule.type !== "rulesByOption") return void 0;
|
|
213
|
+
if (value.trim().length === 0) return void 0;
|
|
214
|
+
const option = normalizeFieldValue(values[rule.selector]).trim();
|
|
215
|
+
const rules = Object.prototype.hasOwnProperty.call(rule.cases, option) ? rule.cases[option] : void 0;
|
|
216
|
+
return evaluateRules(value, rules, field, values, validators);
|
|
217
|
+
},
|
|
218
|
+
streetLevelRequired: (value) => {
|
|
219
|
+
if (value.trim().length > 0) return void 0;
|
|
220
|
+
return STREET_LEVEL_REQUIRED_ERROR;
|
|
221
|
+
},
|
|
222
|
+
cpf: (value) => {
|
|
223
|
+
if (value.trim().length === 0) return void 0;
|
|
224
|
+
return validateCPF(value) ? void 0 : { key: "verification.errors.invalidTaxId" };
|
|
225
|
+
},
|
|
226
|
+
ssnFormat: (value) => {
|
|
227
|
+
if (value.trim().length === 0) return void 0;
|
|
228
|
+
return SSN_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.ssnFormat" };
|
|
229
|
+
},
|
|
230
|
+
noPoBox: (value) => {
|
|
231
|
+
if (value.trim().length === 0) return void 0;
|
|
232
|
+
return isPoBox(value) ? { key: "verification.errors.poBox" } : void 0;
|
|
233
|
+
},
|
|
234
|
+
postalCodeFormat: (value, rule) => {
|
|
235
|
+
if (rule.type !== "postalCodeFormat") return void 0;
|
|
236
|
+
if (value.trim().length === 0) return void 0;
|
|
237
|
+
if (validatePostalCode(value, rule.country)) return void 0;
|
|
238
|
+
return {
|
|
239
|
+
key: getPostalCodeErrorKey(rule.country),
|
|
240
|
+
params: getPostalCodeErrorParams(rule.country)
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
phoneFormat: (value, rule) => {
|
|
244
|
+
if (rule.type !== "phoneFormat") return void 0;
|
|
245
|
+
const trimmed = value.trim();
|
|
246
|
+
if (rule.optional && trimmed.length === 0) return void 0;
|
|
247
|
+
return validatePhone(trimmed, rule.country) ? void 0 : { key: "verification.errors.phoneInvalid" };
|
|
248
|
+
},
|
|
249
|
+
emailFormat: (value) => {
|
|
250
|
+
if (value.trim().length === 0) return void 0;
|
|
251
|
+
return isEmailFormat(value) ? void 0 : { key: "verification.errors.emailInvalid" };
|
|
252
|
+
},
|
|
253
|
+
exactLength: (value, rule) => {
|
|
254
|
+
if (rule.type !== "exactLength") return void 0;
|
|
255
|
+
if (value.trim().length === 0) return void 0;
|
|
256
|
+
return value.length === rule.length ? void 0 : { key: "verification.errors.exactly10Characters" };
|
|
257
|
+
},
|
|
258
|
+
nameCharacters: (value) => {
|
|
259
|
+
if (value.trim().length === 0) return void 0;
|
|
260
|
+
return hasNameCharacters(value.trim()) ? void 0 : { key: "verification.errors.nameCharacters" };
|
|
261
|
+
},
|
|
262
|
+
notFuture: (value) => {
|
|
263
|
+
if (value.trim().length === 0) return void 0;
|
|
264
|
+
return isNotFuture(value.trim(), getLocalIsoDate()) ? void 0 : { key: "verification.errors.futureDate" };
|
|
265
|
+
},
|
|
266
|
+
maxAge: (value, rule) => {
|
|
267
|
+
if (rule.type !== "maxAge") return void 0;
|
|
268
|
+
if (value.trim().length === 0) return void 0;
|
|
269
|
+
return isWithinMaxAge(value.trim(), getLocalIsoDate(), rule.years) ? void 0 : { key: "verification.errors.dateOfBirthMaxAge" };
|
|
270
|
+
},
|
|
271
|
+
phoneDigits: (value, rule) => {
|
|
272
|
+
if (rule.type !== "phoneDigits") return void 0;
|
|
273
|
+
const trimmed = value.trim();
|
|
274
|
+
if (trimmed.length === 0) return void 0;
|
|
275
|
+
const national = getPhoneValidation()?.nationalNumber(trimmed, rule.country);
|
|
276
|
+
if (!national) return { key: PHONE_INVALID_KEY };
|
|
277
|
+
return national.length >= rule.min && national.length <= rule.max ? void 0 : { key: PHONE_INVALID_KEY };
|
|
278
|
+
},
|
|
279
|
+
digitCount: (value, rule) => {
|
|
280
|
+
if (rule.type !== "digitCount") return void 0;
|
|
281
|
+
if (value.trim().length === 0) return void 0;
|
|
282
|
+
return hasDigitCount(value.trim(), rule) ? void 0 : digitCountError(rule);
|
|
283
|
+
},
|
|
284
|
+
allowedCharacters: (value, rule) => {
|
|
285
|
+
if (rule.type !== "allowedCharacters") return void 0;
|
|
286
|
+
if (value.trim().length === 0) return void 0;
|
|
287
|
+
return hasAllowedCharacters(value.trim(), rule.classes, rule.extra) ? void 0 : { key: "verification.errors.invalidCharacters" };
|
|
288
|
+
},
|
|
289
|
+
charTemplate: (value, rule) => {
|
|
290
|
+
if (rule.type !== "charTemplate") return void 0;
|
|
291
|
+
if (value.trim().length === 0) return void 0;
|
|
292
|
+
return matchesCharTemplate(value.trim(), rule.templates, rule.ignoreCase) ? void 0 : { key: "verification.errors.invalidFormat" };
|
|
293
|
+
},
|
|
294
|
+
numericRange: (value, rule) => {
|
|
295
|
+
if (rule.type !== "numericRange") return void 0;
|
|
296
|
+
if (value.trim().length === 0) return void 0;
|
|
297
|
+
return isInNumericRange(value.trim(), rule.min, rule.max) ? void 0 : {
|
|
298
|
+
key: "verification.errors.numberBetween",
|
|
299
|
+
params: {
|
|
300
|
+
min: rule.min,
|
|
301
|
+
max: rule.max
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
scriptCharacters: (value, rule) => {
|
|
306
|
+
if (rule.type !== "scriptCharacters") return void 0;
|
|
307
|
+
if (value.trim().length === 0) return void 0;
|
|
308
|
+
return hasScriptCharacters(value.trim(), rule.scripts) ? void 0 : { key: "verification.errors.invalidCharacters" };
|
|
309
|
+
},
|
|
310
|
+
rut: idNumberValidator(isValidRut),
|
|
311
|
+
esDni: idNumberValidator(isValidEsDni),
|
|
312
|
+
fiPersonalIdentityCode: idNumberValidator(isValidFiPersonalIdentityCode),
|
|
313
|
+
inDrivingLicenseNumber: idNumberValidator(isValidInDrivingLicenseNumber),
|
|
314
|
+
curp: idNumberValidator((value) => isValidCurp(value.trim())),
|
|
315
|
+
oneOfRequired: (_value, rule, _field, values) => {
|
|
316
|
+
if (rule.type !== "oneOfRequired") return void 0;
|
|
317
|
+
return rule.fields.some((name) => isFilled(values, name)) ? void 0 : { key: oneOfRequiredErrorKey(rule) };
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
return validators;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* A rule's own message key shows instead of the validator's, keeping its
|
|
324
|
+
* params. `oneOfRequired` already shows its message.
|
|
325
|
+
*/
|
|
326
|
+
const withRuleMessage = (error, rule) => !rule.message || error.key === rule.message ? error : {
|
|
327
|
+
...error,
|
|
328
|
+
key: rule.message
|
|
329
|
+
};
|
|
330
|
+
const evaluateRules = (value, rules, field, values, validators) => {
|
|
331
|
+
const dateError = field.type === "date" ? calendarDateError(value.trim()) : void 0;
|
|
332
|
+
if (dateError) return { key: dateError };
|
|
333
|
+
if (!rules) return void 0;
|
|
334
|
+
for (const rule of rules) {
|
|
335
|
+
const error = validators[rule.type](value, rule, field, values);
|
|
336
|
+
if (error) return withRuleMessage(error, rule);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
function validateEkycForm(values, fields) {
|
|
340
|
+
const validators = createValidators();
|
|
341
|
+
return fields.reduce((errors, field) => {
|
|
342
|
+
const value = normalizeFieldValue(values[field.name]);
|
|
343
|
+
const error = evaluateRules(value, field.validation, field, values, validators);
|
|
344
|
+
if (error) errors[field.name] = error;
|
|
345
|
+
return errors;
|
|
346
|
+
}, {});
|
|
347
|
+
}
|
|
348
|
+
function validateEkycField(values, fieldName, fields) {
|
|
349
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
350
|
+
if (!field) return void 0;
|
|
351
|
+
const validators = createValidators();
|
|
352
|
+
const value = normalizeFieldValue(values[field.name]);
|
|
353
|
+
return evaluateRules(value, field.validation, field, values, validators);
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/modules/ekyc/ekycPrefill.ts
|
|
357
|
+
/**
|
|
358
|
+
* eKYC prefill data for form definitions: turns the `ocr-data` and
|
|
359
|
+
* `otp-status` responses into values keyed by the vocabulary's prefill source
|
|
360
|
+
* ids (`document.firstName`, `phoneModule.phone`, …). The forms kernel then
|
|
361
|
+
* decides which of them a field uses and how it shows (`resolvePrefill`).
|
|
362
|
+
*/
|
|
363
|
+
const dateFormatting = new DateFormattingProvider();
|
|
364
|
+
const fromSuggestion = (suggestion) => ({
|
|
365
|
+
street: suggestion.street,
|
|
366
|
+
houseNumber: suggestion.houseNumber,
|
|
367
|
+
city: suggestion.city,
|
|
368
|
+
state: suggestion.stateCode,
|
|
369
|
+
postalCode: suggestion.postalCode
|
|
370
|
+
});
|
|
371
|
+
const DRIVERS_LICENSE = "DriversLicense";
|
|
372
|
+
/** OCR sends some dates as epoch milliseconds in a string, such as `issuedAt`. */
|
|
373
|
+
const epochMs = (value) => typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
374
|
+
const US_STATE_CODES = Object.fromEntries(Object.values(usStates).flatMap(({ code, name }) => [[code, code], [name.toUpperCase(), code]]));
|
|
375
|
+
/** A US state code or name as its code, such as `California` → `CA`. */
|
|
376
|
+
function usStateCode(value) {
|
|
377
|
+
return value ? US_STATE_CODES[value.trim().toUpperCase()] : void 0;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* The first name and surname of a scanned document. Uses the OCR's
|
|
381
|
+
* `firstName` / `paternalLastName`. Only when OCR sent no name part at all does
|
|
382
|
+
* it split `fullName`, which is all some documents send (the Indian PAN card):
|
|
383
|
+
* the last word is the surname and the words before it the first name, so a
|
|
384
|
+
* middle name is kept. Any name part blocks the split, because the other
|
|
385
|
+
* sources still fill `middleName` / `maternalLastName` from those parts and a
|
|
386
|
+
* split would repeat them or replace a part OCR did send. A one-word
|
|
387
|
+
* `fullName` gives no surname.
|
|
388
|
+
*/
|
|
389
|
+
function resolveOcrName(name) {
|
|
390
|
+
const firstName = name?.firstName?.trim() ?? "";
|
|
391
|
+
const surName = name?.paternalLastName?.trim() ?? "";
|
|
392
|
+
const hasNameParts = Boolean(firstName || surName || name?.middleName?.trim() || name?.maternalLastName?.trim());
|
|
393
|
+
const words = name?.fullName?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
394
|
+
if (hasNameParts || words.length < 2) return {
|
|
395
|
+
firstName,
|
|
396
|
+
surName
|
|
397
|
+
};
|
|
398
|
+
return {
|
|
399
|
+
firstName: words.slice(0, -1).join(" "),
|
|
400
|
+
surName: words[words.length - 1]
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
/** The proof-of-address statement address, whichever shape it came in. */
|
|
404
|
+
function statementAddress(ocr) {
|
|
405
|
+
const fromStatement = ocr.addressFromStatement;
|
|
406
|
+
const parsed = typeof fromStatement === "object" ? fromStatement : void 0;
|
|
407
|
+
const fields = ocr.addressFieldsFromStatement;
|
|
408
|
+
return {
|
|
409
|
+
label: parsed?.address ?? (typeof fromStatement === "string" ? fromStatement : void 0) ?? fields?.label,
|
|
410
|
+
street: parsed?.street ?? fields?.street,
|
|
411
|
+
houseNumber: parsed?.houseNumber ?? fields?.houseNumber,
|
|
412
|
+
city: parsed?.city ?? fields?.city,
|
|
413
|
+
state: parsed?.state ?? fields?.state,
|
|
414
|
+
postalCode: parsed?.postalCode ?? fields?.postalCode
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
/** The address search queries to try for each origin, in order. */
|
|
418
|
+
function prefillAddressQueries(ocr) {
|
|
419
|
+
if (!ocr) return {
|
|
420
|
+
document: [],
|
|
421
|
+
poa: []
|
|
422
|
+
};
|
|
423
|
+
const documentQueries = ocr.addressFields || ocr.checkedAddressBean ? [ocr.address, ocr.checkedAddress] : [];
|
|
424
|
+
return {
|
|
425
|
+
document: [...new Set(documentQueries.filter((q) => Boolean(q)))],
|
|
426
|
+
poa: [statementAddress(ocr).label].filter((q) => Boolean(q))
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function addressEntries(origin, parts) {
|
|
430
|
+
return [
|
|
431
|
+
[`${origin}.street`, parts.street],
|
|
432
|
+
[`${origin}.houseNumber`, parts.houseNumber],
|
|
433
|
+
[`${origin}.city`, parts.city],
|
|
434
|
+
[`${origin}.state`, parts.state],
|
|
435
|
+
[`${origin}.postalCode`, parts.postalCode]
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
/** Each prefill source id this module can fill, and how. */
|
|
439
|
+
const SOURCES = {
|
|
440
|
+
"document.firstName": (ocr) => resolveOcrName(ocr.name).firstName,
|
|
441
|
+
"document.middleName": (ocr) => ocr.name?.middleName,
|
|
442
|
+
"document.paternalLastName": (ocr) => resolveOcrName(ocr.name).surName,
|
|
443
|
+
"document.maternalLastName": (ocr) => ocr.name?.maternalLastName,
|
|
444
|
+
"document.birthDate": (ocr) => dateFormatting.utcToIsoDateString(ocr.birthDate),
|
|
445
|
+
"document.issueDate": (ocr) => dateFormatting.utcToIsoDateString(epochMs(ocr.issuedAt)),
|
|
446
|
+
"document.documentNumber": (ocr) => ocr.documentNumber,
|
|
447
|
+
"document.personalNumber": (ocr) => ocr.personalNumber,
|
|
448
|
+
"document.driversLicenseNumber": (ocr) => ocr.typeOfId === DRIVERS_LICENSE ? ocr.documentNumber : void 0,
|
|
449
|
+
"document.driversLicenseState": (ocr) => ocr.typeOfId === DRIVERS_LICENSE ? usStateCode(ocr.issuingState) : void 0,
|
|
450
|
+
"poa.firstName": (ocr) => ocr.poaName?.trim().split(/\s+/)[0],
|
|
451
|
+
"poa.lastName": (ocr) => ocr.poaName?.trim().split(/\s+/).slice(1).join(" ") || void 0,
|
|
452
|
+
"phoneModule.phone": (_ocr, otp) => otp.phone,
|
|
453
|
+
"emailModule.email": (_ocr, otp) => otp.email
|
|
454
|
+
};
|
|
455
|
+
const ADDRESS_SOURCES = [...addressEntries("document", {}), ...addressEntries("poa", {})].map(([id]) => id);
|
|
456
|
+
/** Every prefill source id eKYC can fill, for `EKYC_SUPPORTED_IDS`. */
|
|
457
|
+
const EKYC_PREFILL_SOURCES = [...Object.keys(SOURCES), ...ADDRESS_SOURCES];
|
|
458
|
+
/**
|
|
459
|
+
* The session's prefill values by source id. An address comes from its
|
|
460
|
+
* suggestion when one was found, otherwise from the OCR address fields.
|
|
461
|
+
*/
|
|
462
|
+
function buildPrefillData(ocr, otp, matches = {}) {
|
|
463
|
+
const ocrData = ocr ?? {};
|
|
464
|
+
const otpData = otp ?? {};
|
|
465
|
+
const documentAddress = matches.document ? fromSuggestion(matches.document) : ocrData.addressFields ?? ocrData.checkedAddressBean ?? {};
|
|
466
|
+
const poaAddress = matches.poa ? fromSuggestion(matches.poa) : statementAddress(ocrData);
|
|
467
|
+
const entries = [
|
|
468
|
+
...Object.entries(SOURCES).map(([id, read]) => [id, read(ocrData, otpData, matches)]),
|
|
469
|
+
...addressEntries("document", documentAddress),
|
|
470
|
+
...addressEntries("poa", poaAddress)
|
|
471
|
+
];
|
|
472
|
+
return Object.fromEntries(entries.filter(([, value]) => Boolean(value)));
|
|
473
|
+
}
|
|
474
|
+
const EKYC_DEFINITIONS = /* @__PURE__ */ expandDefinitions([
|
|
475
|
+
{
|
|
476
|
+
name: "firstName",
|
|
477
|
+
kind: "text",
|
|
478
|
+
group: "name",
|
|
479
|
+
required: true,
|
|
480
|
+
label: { key: "verification.labels.firstName" },
|
|
481
|
+
placeholder: { key: "verification.placeholder.firstName" },
|
|
482
|
+
input: {
|
|
483
|
+
maxLength: 100,
|
|
484
|
+
autofill: "givenName"
|
|
485
|
+
},
|
|
486
|
+
rules: [{ id: "nameCharacters" }],
|
|
487
|
+
prefill: ["document.firstName", "poa.firstName"]
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
name: "middleName",
|
|
491
|
+
kind: "text",
|
|
492
|
+
group: "name",
|
|
493
|
+
label: { key: "verification.labels.middleName" },
|
|
494
|
+
placeholder: { key: "verification.placeholder.middleName" },
|
|
495
|
+
input: {
|
|
496
|
+
maxLength: 100,
|
|
497
|
+
autofill: "middleName"
|
|
498
|
+
},
|
|
499
|
+
rules: [{ id: "nameCharacters" }],
|
|
500
|
+
prefill: ["document.middleName"]
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: "surName",
|
|
504
|
+
kind: "text",
|
|
505
|
+
group: "name",
|
|
506
|
+
required: true,
|
|
507
|
+
label: { key: "verification.labels.surName" },
|
|
508
|
+
placeholder: { key: "verification.placeholder.surname" },
|
|
509
|
+
input: {
|
|
510
|
+
maxLength: 100,
|
|
511
|
+
autofill: "familyName"
|
|
512
|
+
},
|
|
513
|
+
rules: [{ id: "nameCharacters" }],
|
|
514
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: "dateOfBirth",
|
|
518
|
+
kind: "date",
|
|
519
|
+
group: "dateOfBirth",
|
|
520
|
+
required: true,
|
|
521
|
+
label: { key: "verification.labels.dateOfBirth" },
|
|
522
|
+
input: { autofill: "birthday" },
|
|
523
|
+
rules: [{
|
|
524
|
+
id: "maxAge",
|
|
525
|
+
params: { years: 120 }
|
|
526
|
+
}, { id: "notFuture" }],
|
|
527
|
+
prefill: ["document.birthDate"]
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: "email",
|
|
531
|
+
kind: "text",
|
|
532
|
+
group: "email",
|
|
533
|
+
required: true,
|
|
534
|
+
requiredWhen: [{ riskAddon: "emailCheck" }],
|
|
535
|
+
label: { key: "verification.labels.email" },
|
|
536
|
+
placeholder: { key: "verification.placeholder.email" },
|
|
537
|
+
input: {
|
|
538
|
+
keyboard: "email",
|
|
539
|
+
autofill: "email"
|
|
540
|
+
},
|
|
541
|
+
rules: [{ id: "emailFormat" }],
|
|
542
|
+
prefill: ["emailModule.email"]
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: "phone",
|
|
546
|
+
kind: "phone",
|
|
547
|
+
group: "phone",
|
|
548
|
+
requiredWhen: [
|
|
549
|
+
{ riskAddon: "phoneCheck" },
|
|
550
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
551
|
+
{ riskAddon: "phoneProfile" }
|
|
552
|
+
],
|
|
553
|
+
label: { key: "verification.labels.phone" },
|
|
554
|
+
input: { autofill: "phone" },
|
|
555
|
+
phone: { lockCountry: true },
|
|
556
|
+
rules: [{ id: "phoneFormat" }, {
|
|
557
|
+
id: "phoneDigits",
|
|
558
|
+
params: {
|
|
559
|
+
min: 10,
|
|
560
|
+
max: 10
|
|
561
|
+
}
|
|
562
|
+
}],
|
|
563
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
564
|
+
prefill: ["phoneModule.phone"]
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: "idNum",
|
|
568
|
+
kind: "text",
|
|
569
|
+
group: "idNumber",
|
|
570
|
+
label: { key: "verification.labels.idNum" },
|
|
571
|
+
input: {
|
|
572
|
+
maxLength: 8,
|
|
573
|
+
keyboard: "numeric"
|
|
574
|
+
},
|
|
575
|
+
rules: [{
|
|
576
|
+
id: "digitCount",
|
|
577
|
+
params: { lengths: [8] }
|
|
578
|
+
}],
|
|
579
|
+
payload: { key: "idNumber" },
|
|
580
|
+
prefill: ["document.documentNumber"]
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
name: "idNum1",
|
|
584
|
+
kind: "text",
|
|
585
|
+
group: "idNumber1",
|
|
586
|
+
label: { key: "verification.labels.idNum1" },
|
|
587
|
+
input: {
|
|
588
|
+
maxLength: 11,
|
|
589
|
+
keyboard: "numeric"
|
|
590
|
+
},
|
|
591
|
+
rules: [{
|
|
592
|
+
id: "digitCount",
|
|
593
|
+
params: { lengths: [11] }
|
|
594
|
+
}],
|
|
595
|
+
payload: { key: "idNumber1" },
|
|
596
|
+
prefill: ["document.personalNumber"]
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "gender",
|
|
600
|
+
kind: "choice",
|
|
601
|
+
group: "gender",
|
|
602
|
+
widget: "radio",
|
|
603
|
+
label: { key: "verification.labels.gender" },
|
|
604
|
+
options: [{
|
|
605
|
+
value: "F",
|
|
606
|
+
label: { key: "common.female" }
|
|
607
|
+
}, {
|
|
608
|
+
value: "M",
|
|
609
|
+
label: { key: "common.male" }
|
|
610
|
+
}]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: "street",
|
|
614
|
+
kind: "text",
|
|
615
|
+
group: "address",
|
|
616
|
+
section: "address",
|
|
617
|
+
widget: "addressSearch",
|
|
618
|
+
label: { key: "verification.labels.street" },
|
|
619
|
+
input: { autofill: "addressLine1" },
|
|
620
|
+
rules: [{ id: "noPoBox" }],
|
|
621
|
+
prefill: ["document.street", "poa.street"]
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "houseNo",
|
|
625
|
+
kind: "text",
|
|
626
|
+
group: "address",
|
|
627
|
+
section: "address",
|
|
628
|
+
label: { key: "verification.labels.houseNo" },
|
|
629
|
+
prefill: ["document.houseNumber", "poa.houseNumber"]
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "city",
|
|
633
|
+
kind: "text",
|
|
634
|
+
group: "address",
|
|
635
|
+
section: "address",
|
|
636
|
+
label: { key: "verification.labels.city" },
|
|
637
|
+
input: { autofill: "addressLevel2" },
|
|
638
|
+
prefill: ["document.city", "poa.city"]
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: "state",
|
|
642
|
+
kind: "text",
|
|
643
|
+
group: "address",
|
|
644
|
+
section: "address",
|
|
645
|
+
label: { key: "verification.labels.state" },
|
|
646
|
+
placeholder: {
|
|
647
|
+
key: "verification.placeholder.stateCode",
|
|
648
|
+
params: { states: "" }
|
|
649
|
+
},
|
|
650
|
+
input: { autofill: "addressLevel1" },
|
|
651
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
652
|
+
prefill: ["document.state", "poa.state"]
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "postalCode",
|
|
656
|
+
kind: "text",
|
|
657
|
+
group: "address",
|
|
658
|
+
section: "address",
|
|
659
|
+
label: { key: "verification.labels.postalCode" },
|
|
660
|
+
input: {
|
|
661
|
+
maxLength: 8,
|
|
662
|
+
autofill: "postalCode"
|
|
663
|
+
},
|
|
664
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
665
|
+
payload: { transforms: [{
|
|
666
|
+
id: "stripSeparators",
|
|
667
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
668
|
+
}] },
|
|
669
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: "dateOfBirth",
|
|
673
|
+
kind: "date",
|
|
674
|
+
group: "dateOfBirth",
|
|
675
|
+
label: { key: "verification.labels.dateOfBirth" },
|
|
676
|
+
input: { autofill: "birthday" },
|
|
677
|
+
rules: [{
|
|
678
|
+
id: "maxAge",
|
|
679
|
+
params: { years: 120 }
|
|
680
|
+
}, { id: "notFuture" }],
|
|
681
|
+
prefill: ["document.birthDate"]
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: "phone",
|
|
685
|
+
kind: "phone",
|
|
686
|
+
group: "phone",
|
|
687
|
+
required: true,
|
|
688
|
+
requiredWhen: [
|
|
689
|
+
{ riskAddon: "phoneCheck" },
|
|
690
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
691
|
+
{ riskAddon: "phoneProfile" }
|
|
692
|
+
],
|
|
693
|
+
label: { key: "verification.labels.phone" },
|
|
694
|
+
input: { autofill: "phone" },
|
|
695
|
+
phone: { lockCountry: "whenPhoneRisk" },
|
|
696
|
+
rules: [{ id: "phoneFormat" }],
|
|
697
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
698
|
+
prefill: ["phoneModule.phone"]
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "houseNo",
|
|
702
|
+
kind: "text",
|
|
703
|
+
group: "address",
|
|
704
|
+
section: "address",
|
|
705
|
+
label: { key: "verification.labels.houseNo" },
|
|
706
|
+
payload: { key: "streetNo" },
|
|
707
|
+
prefill: ["document.houseNumber", "poa.houseNumber"]
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "state",
|
|
711
|
+
kind: "text",
|
|
712
|
+
group: "address",
|
|
713
|
+
section: "address",
|
|
714
|
+
required: true,
|
|
715
|
+
label: { key: "verification.labels.state" },
|
|
716
|
+
placeholder: {
|
|
717
|
+
key: "verification.placeholder.stateCode",
|
|
718
|
+
params: { states: "" }
|
|
719
|
+
},
|
|
720
|
+
input: { autofill: "addressLevel1" },
|
|
721
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
722
|
+
prefill: ["document.state", "poa.state"]
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
name: "phone",
|
|
726
|
+
kind: "phone",
|
|
727
|
+
group: "phone",
|
|
728
|
+
required: true,
|
|
729
|
+
requiredWhen: [
|
|
730
|
+
{ riskAddon: "phoneCheck" },
|
|
731
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
732
|
+
{ riskAddon: "phoneProfile" }
|
|
733
|
+
],
|
|
734
|
+
label: { key: "verification.labels.phone" },
|
|
735
|
+
input: { autofill: "phone" },
|
|
736
|
+
phone: { lockCountry: true },
|
|
737
|
+
rules: [{ id: "phoneFormat" }, {
|
|
738
|
+
id: "phoneDigits",
|
|
739
|
+
params: {
|
|
740
|
+
min: 9,
|
|
741
|
+
max: 9
|
|
742
|
+
}
|
|
743
|
+
}],
|
|
744
|
+
payload: { transforms: [{ id: "nationalNumber" }] },
|
|
745
|
+
prefill: ["phoneModule.phone"]
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: "postalCode",
|
|
749
|
+
kind: "text",
|
|
750
|
+
group: "address",
|
|
751
|
+
section: "address",
|
|
752
|
+
label: { key: "verification.labels.postalCode" },
|
|
753
|
+
input: {
|
|
754
|
+
maxLength: 4,
|
|
755
|
+
autofill: "postalCode",
|
|
756
|
+
keyboard: "numeric"
|
|
757
|
+
},
|
|
758
|
+
rules: [
|
|
759
|
+
{ id: "postalCodeFormat" },
|
|
760
|
+
{
|
|
761
|
+
id: "digitCount",
|
|
762
|
+
params: { lengths: [4] }
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
id: "numericRange",
|
|
766
|
+
params: {
|
|
767
|
+
min: 1e3,
|
|
768
|
+
max: 9992
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
],
|
|
772
|
+
payload: { transforms: [{
|
|
773
|
+
id: "stripSeparators",
|
|
774
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
775
|
+
}] },
|
|
776
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "taxId",
|
|
780
|
+
kind: "text",
|
|
781
|
+
group: "ssn",
|
|
782
|
+
required: true,
|
|
783
|
+
label: { key: "verification.labels.taxId" },
|
|
784
|
+
displayLabel: {
|
|
785
|
+
key: "verification.labels.cpf",
|
|
786
|
+
text: "CPF"
|
|
787
|
+
},
|
|
788
|
+
rules: [{ id: "cpf" }]
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: "nationality",
|
|
792
|
+
kind: "choice",
|
|
793
|
+
group: "nationality",
|
|
794
|
+
widget: "select",
|
|
795
|
+
label: { key: "verification.labels.nationality" },
|
|
796
|
+
options: [
|
|
797
|
+
{
|
|
798
|
+
value: "brazilian",
|
|
799
|
+
label: { key: "verification.labels.brazilian" }
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
value: "naturalized_brazilian",
|
|
803
|
+
label: { key: "verification.labels.naturalizedBrazilian" }
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
value: "foreigner",
|
|
807
|
+
label: { key: "verification.labels.foreigner" }
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
value: "brazilian_born_abroad",
|
|
811
|
+
label: { key: "verification.labels.brazilianBornAbroad" }
|
|
812
|
+
}
|
|
813
|
+
],
|
|
814
|
+
payload: { transforms: [{ id: "uppercase" }] }
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
name: "state",
|
|
818
|
+
kind: "choice",
|
|
819
|
+
group: "address",
|
|
820
|
+
section: "address",
|
|
821
|
+
widget: "select",
|
|
822
|
+
label: { key: "verification.labels.chooseState" },
|
|
823
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
824
|
+
input: { autofill: "addressLevel1" },
|
|
825
|
+
optionsRef: "BR_STATES",
|
|
826
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
827
|
+
prefill: ["document.state", "poa.state"]
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
name: "postalCode",
|
|
831
|
+
kind: "text",
|
|
832
|
+
group: "address",
|
|
833
|
+
section: "address",
|
|
834
|
+
label: { key: "verification.labels.postalCode" },
|
|
835
|
+
input: {
|
|
836
|
+
maxLength: 9,
|
|
837
|
+
autofill: "postalCode"
|
|
838
|
+
},
|
|
839
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
840
|
+
payload: { transforms: [{
|
|
841
|
+
id: "stripSeparators",
|
|
842
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
843
|
+
}] },
|
|
844
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
name: "email",
|
|
848
|
+
kind: "text",
|
|
849
|
+
group: "email",
|
|
850
|
+
requiredWhen: [{ riskAddon: "emailCheck" }],
|
|
851
|
+
label: { key: "verification.labels.email" },
|
|
852
|
+
placeholder: { key: "verification.placeholder.email" },
|
|
853
|
+
input: {
|
|
854
|
+
keyboard: "email",
|
|
855
|
+
autofill: "email"
|
|
856
|
+
},
|
|
857
|
+
rules: [{ id: "emailFormat" }],
|
|
858
|
+
prefill: ["emailModule.email"]
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
name: "phone",
|
|
862
|
+
kind: "phone",
|
|
863
|
+
group: "phone",
|
|
864
|
+
requiredWhen: [
|
|
865
|
+
{ riskAddon: "phoneCheck" },
|
|
866
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
867
|
+
{ riskAddon: "phoneProfile" }
|
|
868
|
+
],
|
|
869
|
+
label: { key: "verification.labels.phone" },
|
|
870
|
+
input: { autofill: "phone" },
|
|
871
|
+
phone: { lockCountry: true },
|
|
872
|
+
rules: [{ id: "phoneFormat" }, {
|
|
873
|
+
id: "phoneDigits",
|
|
874
|
+
params: {
|
|
875
|
+
min: 10,
|
|
876
|
+
max: 11
|
|
877
|
+
}
|
|
878
|
+
}],
|
|
879
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
880
|
+
prefill: ["phoneModule.phone"]
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: "taxId",
|
|
884
|
+
kind: "text",
|
|
885
|
+
group: "ssn",
|
|
886
|
+
label: { key: "verification.labels.taxId" },
|
|
887
|
+
displayLabel: {
|
|
888
|
+
key: "verification.labels.cpf",
|
|
889
|
+
text: "CPF"
|
|
890
|
+
},
|
|
891
|
+
rules: [{ id: "cpf" }],
|
|
892
|
+
payload: { key: "idNum" }
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
name: "city",
|
|
896
|
+
kind: "text",
|
|
897
|
+
group: "address",
|
|
898
|
+
section: "address",
|
|
899
|
+
required: true,
|
|
900
|
+
label: { key: "verification.labels.city" },
|
|
901
|
+
input: { autofill: "addressLevel2" },
|
|
902
|
+
prefill: ["document.city", "poa.city"]
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
name: "street",
|
|
906
|
+
kind: "text",
|
|
907
|
+
group: "address",
|
|
908
|
+
section: "address",
|
|
909
|
+
required: true,
|
|
910
|
+
widget: "addressSearch",
|
|
911
|
+
label: { key: "verification.labels.street" },
|
|
912
|
+
input: { autofill: "addressLine1" },
|
|
913
|
+
rules: [{ id: "noPoBox" }],
|
|
914
|
+
prefill: ["document.street", "poa.street"]
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: "houseNo",
|
|
918
|
+
kind: "text",
|
|
919
|
+
group: "address",
|
|
920
|
+
section: "address",
|
|
921
|
+
required: true,
|
|
922
|
+
label: { key: "verification.labels.houseNo" },
|
|
923
|
+
prefill: ["document.houseNumber", "poa.houseNumber"]
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
name: "postalCode",
|
|
927
|
+
kind: "text",
|
|
928
|
+
group: "address",
|
|
929
|
+
section: "address",
|
|
930
|
+
required: true,
|
|
931
|
+
label: { key: "verification.labels.postalCode" },
|
|
932
|
+
input: {
|
|
933
|
+
maxLength: 8,
|
|
934
|
+
autofill: "postalCode"
|
|
935
|
+
},
|
|
936
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
937
|
+
payload: { transforms: [{
|
|
938
|
+
id: "stripSeparators",
|
|
939
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
940
|
+
}] },
|
|
941
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
name: "city",
|
|
945
|
+
kind: "text",
|
|
946
|
+
group: "address",
|
|
947
|
+
section: "address",
|
|
948
|
+
required: true,
|
|
949
|
+
label: { key: "verification.labels.city" },
|
|
950
|
+
input: { autofill: "addressLevel2" },
|
|
951
|
+
rules: [{
|
|
952
|
+
id: "allowedCharacters",
|
|
953
|
+
params: { classes: [
|
|
954
|
+
"letter",
|
|
955
|
+
"digit",
|
|
956
|
+
"space"
|
|
957
|
+
] }
|
|
958
|
+
}],
|
|
959
|
+
prefill: ["document.city", "poa.city"]
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
name: "state",
|
|
963
|
+
kind: "choice",
|
|
964
|
+
group: "address",
|
|
965
|
+
section: "address",
|
|
966
|
+
required: true,
|
|
967
|
+
widget: "select",
|
|
968
|
+
label: { key: "verification.labels.chooseState" },
|
|
969
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
970
|
+
input: { autofill: "addressLevel1" },
|
|
971
|
+
optionsRef: "CA_PROVINCES",
|
|
972
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
973
|
+
prefill: ["document.state", "poa.state"]
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
name: "postalCode",
|
|
977
|
+
kind: "text",
|
|
978
|
+
group: "address",
|
|
979
|
+
section: "address",
|
|
980
|
+
required: true,
|
|
981
|
+
label: { key: "verification.labels.postalCode" },
|
|
982
|
+
input: {
|
|
983
|
+
maxLength: 8,
|
|
984
|
+
autofill: "postalCode"
|
|
985
|
+
},
|
|
986
|
+
rules: [{ id: "postalCodeFormat" }, {
|
|
987
|
+
id: "allowedCharacters",
|
|
988
|
+
params: { classes: [
|
|
989
|
+
"letter",
|
|
990
|
+
"digit",
|
|
991
|
+
"space"
|
|
992
|
+
] }
|
|
993
|
+
}],
|
|
994
|
+
payload: { transforms: [{
|
|
995
|
+
id: "stripSeparators",
|
|
996
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
997
|
+
}] },
|
|
998
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: "phone",
|
|
1002
|
+
kind: "phone",
|
|
1003
|
+
group: "phone",
|
|
1004
|
+
required: true,
|
|
1005
|
+
requiredWhen: [
|
|
1006
|
+
{ riskAddon: "phoneCheck" },
|
|
1007
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1008
|
+
{ riskAddon: "phoneProfile" }
|
|
1009
|
+
],
|
|
1010
|
+
label: { key: "verification.labels.phone" },
|
|
1011
|
+
input: { autofill: "phone" },
|
|
1012
|
+
phone: { lockCountry: true },
|
|
1013
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1014
|
+
id: "phoneDigits",
|
|
1015
|
+
params: {
|
|
1016
|
+
min: 10,
|
|
1017
|
+
max: 10
|
|
1018
|
+
}
|
|
1019
|
+
}],
|
|
1020
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1021
|
+
prefill: ["phoneModule.phone"]
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
name: "state",
|
|
1025
|
+
kind: "choice",
|
|
1026
|
+
group: "address",
|
|
1027
|
+
section: "address",
|
|
1028
|
+
widget: "select",
|
|
1029
|
+
label: { key: "verification.labels.chooseState" },
|
|
1030
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
1031
|
+
input: { autofill: "addressLevel1" },
|
|
1032
|
+
optionsRef: "CA_PROVINCES",
|
|
1033
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
1034
|
+
prefill: ["document.state", "poa.state"]
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: "idNum",
|
|
1038
|
+
kind: "text",
|
|
1039
|
+
group: "idNumber",
|
|
1040
|
+
required: true,
|
|
1041
|
+
label: { key: "verification.labels.idNum" },
|
|
1042
|
+
input: {
|
|
1043
|
+
maxLength: 12,
|
|
1044
|
+
format: [{ id: "stripSeparators" }, { id: "uppercase" }]
|
|
1045
|
+
},
|
|
1046
|
+
rules: [{ id: "rut" }],
|
|
1047
|
+
payload: { key: "idNumber" },
|
|
1048
|
+
prefill: ["document.documentNumber"]
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: "firstName",
|
|
1052
|
+
kind: "text",
|
|
1053
|
+
group: "name",
|
|
1054
|
+
required: true,
|
|
1055
|
+
label: { key: "verification.labels.firstName" },
|
|
1056
|
+
placeholder: { key: "verification.placeholder.firstName" },
|
|
1057
|
+
input: {
|
|
1058
|
+
maxLength: 100,
|
|
1059
|
+
autofill: "givenName"
|
|
1060
|
+
},
|
|
1061
|
+
rules: [{
|
|
1062
|
+
id: "scriptCharacters",
|
|
1063
|
+
params: { scripts: ["Han"] },
|
|
1064
|
+
message: { key: "verification.errors.firstNameChineseCharacters" }
|
|
1065
|
+
}],
|
|
1066
|
+
prefill: ["document.firstName", "poa.firstName"]
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
name: "surName",
|
|
1070
|
+
kind: "text",
|
|
1071
|
+
group: "name",
|
|
1072
|
+
required: true,
|
|
1073
|
+
label: { key: "verification.labels.surName" },
|
|
1074
|
+
placeholder: { key: "verification.placeholder.surname" },
|
|
1075
|
+
input: {
|
|
1076
|
+
maxLength: 100,
|
|
1077
|
+
autofill: "familyName"
|
|
1078
|
+
},
|
|
1079
|
+
rules: [{
|
|
1080
|
+
id: "scriptCharacters",
|
|
1081
|
+
params: { scripts: ["Han"] },
|
|
1082
|
+
message: { key: "verification.errors.lastNameChineseCharacters" }
|
|
1083
|
+
}],
|
|
1084
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
name: "idNum",
|
|
1088
|
+
kind: "text",
|
|
1089
|
+
group: "idNumber",
|
|
1090
|
+
required: true,
|
|
1091
|
+
label: { key: "verification.labels.idNum" },
|
|
1092
|
+
input: {
|
|
1093
|
+
maxLength: 18,
|
|
1094
|
+
format: [{ id: "uppercase" }]
|
|
1095
|
+
},
|
|
1096
|
+
rules: [{
|
|
1097
|
+
id: "charTemplate",
|
|
1098
|
+
params: {
|
|
1099
|
+
templates: ["999999999999999999", "99999999999999999X"],
|
|
1100
|
+
ignoreCase: true
|
|
1101
|
+
},
|
|
1102
|
+
message: { key: "verification.errors.invalidIdNumber" }
|
|
1103
|
+
}],
|
|
1104
|
+
payload: { key: "idNumber" },
|
|
1105
|
+
prefill: ["document.documentNumber"]
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
name: "idNum",
|
|
1109
|
+
kind: "text",
|
|
1110
|
+
group: "idNumber",
|
|
1111
|
+
required: true,
|
|
1112
|
+
label: { key: "verification.labels.idNum" },
|
|
1113
|
+
input: {
|
|
1114
|
+
maxLength: 10,
|
|
1115
|
+
keyboard: "numeric"
|
|
1116
|
+
},
|
|
1117
|
+
rules: [{
|
|
1118
|
+
id: "digitCount",
|
|
1119
|
+
params: { lengths: [8, 10] }
|
|
1120
|
+
}],
|
|
1121
|
+
payload: { key: "idNumber" },
|
|
1122
|
+
prefill: ["document.documentNumber"]
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
name: "issueDate",
|
|
1126
|
+
kind: "date",
|
|
1127
|
+
group: "issueDate",
|
|
1128
|
+
required: true,
|
|
1129
|
+
label: { key: "verification.labels.issueDate" },
|
|
1130
|
+
rules: [{ id: "notFuture" }],
|
|
1131
|
+
prefill: ["document.issueDate"]
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: "phone",
|
|
1135
|
+
kind: "phone",
|
|
1136
|
+
group: "phone",
|
|
1137
|
+
requiredWhen: [
|
|
1138
|
+
{ riskAddon: "phoneCheck" },
|
|
1139
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1140
|
+
{ riskAddon: "phoneProfile" }
|
|
1141
|
+
],
|
|
1142
|
+
label: { key: "verification.labels.phone" },
|
|
1143
|
+
input: { autofill: "phone" },
|
|
1144
|
+
phone: { lockCountry: true },
|
|
1145
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1146
|
+
id: "phoneDigits",
|
|
1147
|
+
params: {
|
|
1148
|
+
min: 8,
|
|
1149
|
+
max: 11
|
|
1150
|
+
}
|
|
1151
|
+
}],
|
|
1152
|
+
payload: { transforms: [{ id: "e164NoPlus" }] },
|
|
1153
|
+
prefill: ["phoneModule.phone"]
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
name: "phone",
|
|
1157
|
+
kind: "phone",
|
|
1158
|
+
group: "phone",
|
|
1159
|
+
required: true,
|
|
1160
|
+
requiredWhen: [
|
|
1161
|
+
{ riskAddon: "phoneCheck" },
|
|
1162
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1163
|
+
{ riskAddon: "phoneProfile" }
|
|
1164
|
+
],
|
|
1165
|
+
label: { key: "verification.labels.phone" },
|
|
1166
|
+
input: { autofill: "phone" },
|
|
1167
|
+
phone: { lockCountry: true },
|
|
1168
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1169
|
+
id: "phoneDigits",
|
|
1170
|
+
params: {
|
|
1171
|
+
min: 8,
|
|
1172
|
+
max: 8
|
|
1173
|
+
}
|
|
1174
|
+
}],
|
|
1175
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1176
|
+
prefill: ["phoneModule.phone"]
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
name: "street",
|
|
1180
|
+
kind: "text",
|
|
1181
|
+
group: "address",
|
|
1182
|
+
section: "address",
|
|
1183
|
+
widget: "addressSearch",
|
|
1184
|
+
label: { key: "verification.labels.streetAndHouseNumber" },
|
|
1185
|
+
input: { autofill: "addressLine1" },
|
|
1186
|
+
rules: [{ id: "noPoBox" }],
|
|
1187
|
+
prefill: ["document.street", "poa.street"]
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
name: "phone",
|
|
1191
|
+
kind: "phone",
|
|
1192
|
+
group: "phone",
|
|
1193
|
+
requiredWhen: [
|
|
1194
|
+
{ riskAddon: "phoneCheck" },
|
|
1195
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1196
|
+
{ riskAddon: "phoneProfile" }
|
|
1197
|
+
],
|
|
1198
|
+
label: { key: "verification.labels.phone" },
|
|
1199
|
+
input: { autofill: "phone" },
|
|
1200
|
+
phone: { lockCountry: true },
|
|
1201
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1202
|
+
id: "phoneDigits",
|
|
1203
|
+
params: {
|
|
1204
|
+
min: 9,
|
|
1205
|
+
max: 9
|
|
1206
|
+
}
|
|
1207
|
+
}],
|
|
1208
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1209
|
+
prefill: ["phoneModule.phone"]
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
name: "idNum",
|
|
1213
|
+
kind: "text",
|
|
1214
|
+
group: "idNumber",
|
|
1215
|
+
required: true,
|
|
1216
|
+
label: { key: "verification.labels.idNum" },
|
|
1217
|
+
input: {
|
|
1218
|
+
maxLength: 12,
|
|
1219
|
+
format: [{ id: "stripSeparators" }, { id: "uppercase" }]
|
|
1220
|
+
},
|
|
1221
|
+
rules: [{ id: "esDni" }],
|
|
1222
|
+
payload: { key: "idNumber" },
|
|
1223
|
+
prefill: ["document.documentNumber"]
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: "postalCode",
|
|
1227
|
+
kind: "text",
|
|
1228
|
+
group: "address",
|
|
1229
|
+
section: "address",
|
|
1230
|
+
label: { key: "verification.labels.postalCode" },
|
|
1231
|
+
input: {
|
|
1232
|
+
maxLength: 5,
|
|
1233
|
+
autofill: "postalCode",
|
|
1234
|
+
keyboard: "numeric"
|
|
1235
|
+
},
|
|
1236
|
+
rules: [{ id: "postalCodeFormat" }, {
|
|
1237
|
+
id: "digitCount",
|
|
1238
|
+
params: { lengths: [5] }
|
|
1239
|
+
}],
|
|
1240
|
+
payload: { transforms: [{
|
|
1241
|
+
id: "stripSeparators",
|
|
1242
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
1243
|
+
}] },
|
|
1244
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
name: "phone",
|
|
1248
|
+
kind: "phone",
|
|
1249
|
+
group: "phone",
|
|
1250
|
+
required: true,
|
|
1251
|
+
requiredWhen: [
|
|
1252
|
+
{ riskAddon: "phoneCheck" },
|
|
1253
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1254
|
+
{ riskAddon: "phoneProfile" }
|
|
1255
|
+
],
|
|
1256
|
+
label: { key: "verification.labels.phone" },
|
|
1257
|
+
input: { autofill: "phone" },
|
|
1258
|
+
phone: { lockCountry: true },
|
|
1259
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1260
|
+
id: "phoneDigits",
|
|
1261
|
+
params: {
|
|
1262
|
+
min: 9,
|
|
1263
|
+
max: 9
|
|
1264
|
+
}
|
|
1265
|
+
}],
|
|
1266
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1267
|
+
prefill: ["phoneModule.phone"]
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
name: "idNum",
|
|
1271
|
+
kind: "text",
|
|
1272
|
+
group: "idNumber",
|
|
1273
|
+
required: true,
|
|
1274
|
+
label: { key: "verification.labels.idNum" },
|
|
1275
|
+
input: { maxLength: 11 },
|
|
1276
|
+
rules: [{ id: "fiPersonalIdentityCode" }],
|
|
1277
|
+
payload: { key: "idNumber" },
|
|
1278
|
+
prefill: ["document.documentNumber"]
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
name: "street",
|
|
1282
|
+
kind: "text",
|
|
1283
|
+
group: "address",
|
|
1284
|
+
section: "address",
|
|
1285
|
+
required: true,
|
|
1286
|
+
widget: "addressSearch",
|
|
1287
|
+
label: { key: "verification.labels.streetAndHouseNumber" },
|
|
1288
|
+
input: { autofill: "addressLine1" },
|
|
1289
|
+
rules: [{ id: "noPoBox" }],
|
|
1290
|
+
prefill: ["document.street", "poa.street"]
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
name: "city",
|
|
1294
|
+
kind: "text",
|
|
1295
|
+
group: "address",
|
|
1296
|
+
section: "address",
|
|
1297
|
+
required: true,
|
|
1298
|
+
label: { key: "verification.labels.city" },
|
|
1299
|
+
input: { autofill: "addressLevel2" },
|
|
1300
|
+
rules: [{
|
|
1301
|
+
id: "allowedCharacters",
|
|
1302
|
+
params: { classes: ["letter", "space"] }
|
|
1303
|
+
}],
|
|
1304
|
+
prefill: ["document.city", "poa.city"]
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
name: "state",
|
|
1308
|
+
kind: "text",
|
|
1309
|
+
group: "address",
|
|
1310
|
+
section: "address",
|
|
1311
|
+
required: true,
|
|
1312
|
+
label: { key: "verification.labels.state" },
|
|
1313
|
+
placeholder: {
|
|
1314
|
+
key: "verification.placeholder.stateCode",
|
|
1315
|
+
params: { states: "" }
|
|
1316
|
+
},
|
|
1317
|
+
input: { autofill: "addressLevel1" },
|
|
1318
|
+
rules: [{
|
|
1319
|
+
id: "allowedCharacters",
|
|
1320
|
+
params: { classes: ["letter", "space"] }
|
|
1321
|
+
}],
|
|
1322
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
1323
|
+
prefill: ["document.state", "poa.state"]
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
name: "idNum",
|
|
1327
|
+
kind: "text",
|
|
1328
|
+
group: "idNumber",
|
|
1329
|
+
required: true,
|
|
1330
|
+
label: { key: "verification.labels.idNum" },
|
|
1331
|
+
input: {
|
|
1332
|
+
maxLength: 9,
|
|
1333
|
+
keyboard: "numeric"
|
|
1334
|
+
},
|
|
1335
|
+
rules: [{
|
|
1336
|
+
id: "digitCount",
|
|
1337
|
+
params: { lengths: [9] }
|
|
1338
|
+
}],
|
|
1339
|
+
payload: { key: "idNumber" },
|
|
1340
|
+
prefill: ["document.documentNumber"]
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
name: "firstName",
|
|
1344
|
+
kind: "text",
|
|
1345
|
+
group: "name",
|
|
1346
|
+
label: { key: "verification.labels.firstName" },
|
|
1347
|
+
placeholder: { key: "verification.placeholder.firstName" },
|
|
1348
|
+
input: {
|
|
1349
|
+
maxLength: 100,
|
|
1350
|
+
autofill: "givenName"
|
|
1351
|
+
},
|
|
1352
|
+
rules: [{ id: "nameCharacters" }],
|
|
1353
|
+
prefill: ["document.firstName", "poa.firstName"]
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
name: "surName",
|
|
1357
|
+
kind: "text",
|
|
1358
|
+
group: "name",
|
|
1359
|
+
label: { key: "verification.labels.surName" },
|
|
1360
|
+
placeholder: { key: "verification.placeholder.surname" },
|
|
1361
|
+
input: {
|
|
1362
|
+
maxLength: 100,
|
|
1363
|
+
autofill: "familyName"
|
|
1364
|
+
},
|
|
1365
|
+
rules: [{ id: "nameCharacters" }],
|
|
1366
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
name: "idNum",
|
|
1370
|
+
kind: "text",
|
|
1371
|
+
group: "idNumber",
|
|
1372
|
+
required: true,
|
|
1373
|
+
label: { key: "verification.labels.idNum" },
|
|
1374
|
+
input: {
|
|
1375
|
+
maxLength: 13,
|
|
1376
|
+
keyboard: "numeric"
|
|
1377
|
+
},
|
|
1378
|
+
rules: [{
|
|
1379
|
+
id: "digitCount",
|
|
1380
|
+
params: { lengths: [13] }
|
|
1381
|
+
}],
|
|
1382
|
+
payload: { key: "idNumber" },
|
|
1383
|
+
prefill: ["document.documentNumber"]
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
name: "apartment",
|
|
1387
|
+
kind: "text",
|
|
1388
|
+
group: "address",
|
|
1389
|
+
section: "address",
|
|
1390
|
+
label: { key: "verification.labels.apartment" },
|
|
1391
|
+
placeholder: { key: "verification.placeholder.apartment" },
|
|
1392
|
+
input: { autofill: "addressLine2" }
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
name: "buildingName",
|
|
1396
|
+
kind: "text",
|
|
1397
|
+
group: "address",
|
|
1398
|
+
section: "address",
|
|
1399
|
+
label: { key: "verification.labels.buildingName" }
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
name: "city",
|
|
1403
|
+
kind: "text",
|
|
1404
|
+
group: "address",
|
|
1405
|
+
section: "address",
|
|
1406
|
+
label: { key: "verification.labels.area" },
|
|
1407
|
+
input: { autofill: "addressLevel2" },
|
|
1408
|
+
prefill: ["document.city", "poa.city"]
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
name: "state",
|
|
1412
|
+
kind: "choice",
|
|
1413
|
+
group: "address",
|
|
1414
|
+
section: "address",
|
|
1415
|
+
required: true,
|
|
1416
|
+
widget: "select",
|
|
1417
|
+
label: { key: "verification.labels.chooseState" },
|
|
1418
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
1419
|
+
input: { autofill: "addressLevel1" },
|
|
1420
|
+
options: [
|
|
1421
|
+
{
|
|
1422
|
+
value: "Hong Kong",
|
|
1423
|
+
label: { key: "Hong Kong" }
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
value: "Kowloon",
|
|
1427
|
+
label: { key: "Kowloon" }
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
value: "New Territories",
|
|
1431
|
+
label: { key: "New Territories" }
|
|
1432
|
+
}
|
|
1433
|
+
],
|
|
1434
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
1435
|
+
prefill: ["document.state", "poa.state"]
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
name: "idNum",
|
|
1439
|
+
kind: "text",
|
|
1440
|
+
group: "idNumber",
|
|
1441
|
+
required: true,
|
|
1442
|
+
label: { key: "verification.labels.idNum" },
|
|
1443
|
+
input: { maxLength: 20 },
|
|
1444
|
+
rules: [{ id: "inDrivingLicenseNumber" }],
|
|
1445
|
+
payload: { key: "idNumber" },
|
|
1446
|
+
prefill: ["document.documentNumber"]
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
name: "houseNo",
|
|
1450
|
+
kind: "text",
|
|
1451
|
+
group: "address",
|
|
1452
|
+
section: "address",
|
|
1453
|
+
label: { key: "verification.labels.houseNo" },
|
|
1454
|
+
rules: [{
|
|
1455
|
+
id: "allowedCharacters",
|
|
1456
|
+
params: {
|
|
1457
|
+
classes: [
|
|
1458
|
+
"letter",
|
|
1459
|
+
"digit",
|
|
1460
|
+
"space"
|
|
1461
|
+
],
|
|
1462
|
+
extra: "/-"
|
|
1463
|
+
}
|
|
1464
|
+
}],
|
|
1465
|
+
prefill: ["document.houseNumber", "poa.houseNumber"]
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
name: "state",
|
|
1469
|
+
kind: "choice",
|
|
1470
|
+
group: "address",
|
|
1471
|
+
section: "address",
|
|
1472
|
+
widget: "select",
|
|
1473
|
+
label: { key: "verification.labels.chooseState" },
|
|
1474
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
1475
|
+
input: { autofill: "addressLevel1" },
|
|
1476
|
+
optionsRef: "IN_STATES",
|
|
1477
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
1478
|
+
prefill: ["document.state", "poa.state"]
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
name: "postalCode",
|
|
1482
|
+
kind: "text",
|
|
1483
|
+
group: "address",
|
|
1484
|
+
section: "address",
|
|
1485
|
+
label: { key: "verification.labels.postalCode" },
|
|
1486
|
+
input: {
|
|
1487
|
+
maxLength: 6,
|
|
1488
|
+
autofill: "postalCode",
|
|
1489
|
+
keyboard: "numeric"
|
|
1490
|
+
},
|
|
1491
|
+
rules: [{ id: "postalCodeFormat" }, {
|
|
1492
|
+
id: "digitCount",
|
|
1493
|
+
params: { lengths: [6] }
|
|
1494
|
+
}],
|
|
1495
|
+
payload: { transforms: [{
|
|
1496
|
+
id: "stripSeparators",
|
|
1497
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
1498
|
+
}] },
|
|
1499
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
name: "panNumber",
|
|
1503
|
+
kind: "text",
|
|
1504
|
+
group: "panNumber",
|
|
1505
|
+
required: true,
|
|
1506
|
+
label: { key: "verification.labels.panNumber" },
|
|
1507
|
+
input: { maxLength: 10 },
|
|
1508
|
+
rules: [{
|
|
1509
|
+
id: "exactLength",
|
|
1510
|
+
params: { length: 10 }
|
|
1511
|
+
}, {
|
|
1512
|
+
id: "charTemplate",
|
|
1513
|
+
params: { templates: ["AAAAA9999A"] },
|
|
1514
|
+
message: { key: "verification.errors.panNumberFormat" }
|
|
1515
|
+
}],
|
|
1516
|
+
payload: { key: "idNumber" },
|
|
1517
|
+
prefill: ["document.documentNumber"]
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
name: "surName",
|
|
1521
|
+
kind: "text",
|
|
1522
|
+
group: "name",
|
|
1523
|
+
required: true,
|
|
1524
|
+
label: { key: "verification.labels.lastName" },
|
|
1525
|
+
placeholder: { key: "verification.placeholder.surname" },
|
|
1526
|
+
input: {
|
|
1527
|
+
maxLength: 100,
|
|
1528
|
+
autofill: "familyName"
|
|
1529
|
+
},
|
|
1530
|
+
rules: [{ id: "nameCharacters" }],
|
|
1531
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
name: "idNum",
|
|
1535
|
+
kind: "text",
|
|
1536
|
+
group: "idNumber",
|
|
1537
|
+
required: true,
|
|
1538
|
+
label: { key: "verification.labels.passportNumber" },
|
|
1539
|
+
input: {
|
|
1540
|
+
maxLength: 8,
|
|
1541
|
+
format: [{ id: "uppercase" }]
|
|
1542
|
+
},
|
|
1543
|
+
rules: [{
|
|
1544
|
+
id: "charTemplate",
|
|
1545
|
+
params: {
|
|
1546
|
+
templates: ["A9999999"],
|
|
1547
|
+
ignoreCase: true
|
|
1548
|
+
},
|
|
1549
|
+
message: { key: "verification.errors.passportNumberFormat" }
|
|
1550
|
+
}],
|
|
1551
|
+
payload: { key: "idNumber" },
|
|
1552
|
+
prefill: ["document.documentNumber"]
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
name: "issueDate",
|
|
1556
|
+
kind: "date",
|
|
1557
|
+
group: "issueDate",
|
|
1558
|
+
label: { key: "verification.labels.issueDate" },
|
|
1559
|
+
rules: [{ id: "notFuture" }],
|
|
1560
|
+
payload: { key: "dateOfIssue" },
|
|
1561
|
+
prefill: ["document.issueDate"]
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
name: "fileNumber",
|
|
1565
|
+
kind: "text",
|
|
1566
|
+
group: "fileNumber",
|
|
1567
|
+
required: true,
|
|
1568
|
+
label: { key: "verification.labels.fileNumber" },
|
|
1569
|
+
input: {
|
|
1570
|
+
maxLength: 15,
|
|
1571
|
+
format: [{ id: "uppercase" }]
|
|
1572
|
+
},
|
|
1573
|
+
rules: [{
|
|
1574
|
+
id: "charTemplate",
|
|
1575
|
+
params: {
|
|
1576
|
+
templates: ["AA9999999999999"],
|
|
1577
|
+
ignoreCase: true
|
|
1578
|
+
},
|
|
1579
|
+
message: { key: "verification.errors.fileNumberFormat" }
|
|
1580
|
+
}]
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
name: "phone",
|
|
1584
|
+
kind: "phone",
|
|
1585
|
+
group: "phone",
|
|
1586
|
+
required: true,
|
|
1587
|
+
requiredWhen: [
|
|
1588
|
+
{ riskAddon: "phoneCheck" },
|
|
1589
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1590
|
+
{ riskAddon: "phoneProfile" }
|
|
1591
|
+
],
|
|
1592
|
+
label: { key: "verification.labels.phone" },
|
|
1593
|
+
input: { autofill: "phone" },
|
|
1594
|
+
phone: { lockCountry: true },
|
|
1595
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1596
|
+
id: "phoneDigits",
|
|
1597
|
+
params: {
|
|
1598
|
+
min: 9,
|
|
1599
|
+
max: 10
|
|
1600
|
+
}
|
|
1601
|
+
}],
|
|
1602
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1603
|
+
prefill: ["phoneModule.phone"]
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
name: "idNum",
|
|
1607
|
+
kind: "text",
|
|
1608
|
+
group: "idNumber",
|
|
1609
|
+
label: { key: "verification.labels.idNum" },
|
|
1610
|
+
input: {
|
|
1611
|
+
maxLength: 14,
|
|
1612
|
+
keyboard: "numeric"
|
|
1613
|
+
},
|
|
1614
|
+
rules: [{
|
|
1615
|
+
id: "digitCount",
|
|
1616
|
+
params: { lengths: [14] }
|
|
1617
|
+
}],
|
|
1618
|
+
payload: { key: "idNum" },
|
|
1619
|
+
prefill: ["document.documentNumber"]
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
name: "idNum",
|
|
1623
|
+
kind: "text",
|
|
1624
|
+
group: "idNumber",
|
|
1625
|
+
required: true,
|
|
1626
|
+
label: { key: "verification.labels.idNum" },
|
|
1627
|
+
displayLabel: {
|
|
1628
|
+
key: "verification.labels.curp",
|
|
1629
|
+
text: "CURP"
|
|
1630
|
+
},
|
|
1631
|
+
input: {
|
|
1632
|
+
maxLength: 18,
|
|
1633
|
+
format: [{ id: "uppercase" }]
|
|
1634
|
+
},
|
|
1635
|
+
rules: [{
|
|
1636
|
+
id: "curp",
|
|
1637
|
+
message: { key: "verification.errors.curp" }
|
|
1638
|
+
}],
|
|
1639
|
+
payload: { key: "idNumber" },
|
|
1640
|
+
prefill: ["document.documentNumber"]
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
name: "phone",
|
|
1644
|
+
kind: "phone",
|
|
1645
|
+
group: "phone",
|
|
1646
|
+
requiredWhen: [
|
|
1647
|
+
{ riskAddon: "phoneCheck" },
|
|
1648
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1649
|
+
{ riskAddon: "phoneProfile" }
|
|
1650
|
+
],
|
|
1651
|
+
label: { key: "verification.labels.phone" },
|
|
1652
|
+
input: { autofill: "phone" },
|
|
1653
|
+
phone: { lockCountry: true },
|
|
1654
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1655
|
+
id: "phoneDigits",
|
|
1656
|
+
params: {
|
|
1657
|
+
min: 8,
|
|
1658
|
+
max: 8
|
|
1659
|
+
}
|
|
1660
|
+
}],
|
|
1661
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1662
|
+
prefill: ["phoneModule.phone"]
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: "idNum",
|
|
1666
|
+
kind: "text",
|
|
1667
|
+
group: "idNumber",
|
|
1668
|
+
required: true,
|
|
1669
|
+
label: { key: "verification.labels.idNum" },
|
|
1670
|
+
input: {
|
|
1671
|
+
maxLength: 8,
|
|
1672
|
+
keyboard: "numeric"
|
|
1673
|
+
},
|
|
1674
|
+
rules: [{
|
|
1675
|
+
id: "digitCount",
|
|
1676
|
+
params: { lengths: [8] }
|
|
1677
|
+
}],
|
|
1678
|
+
payload: { key: "idNumber" },
|
|
1679
|
+
prefill: ["document.documentNumber"]
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
name: "idType",
|
|
1683
|
+
kind: "choice",
|
|
1684
|
+
group: "idType",
|
|
1685
|
+
requiredWhen: [{ fieldFilled: "idNum" }],
|
|
1686
|
+
widget: "select",
|
|
1687
|
+
label: { key: "verification.labels.idType" },
|
|
1688
|
+
placeholder: { key: "verification.placeholder.idType" },
|
|
1689
|
+
optionsRef: "PH_ID_TYPES"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
name: "idNum",
|
|
1693
|
+
kind: "text",
|
|
1694
|
+
group: "idNumber",
|
|
1695
|
+
label: { key: "verification.labels.idNum" },
|
|
1696
|
+
input: { maxLength: 15 },
|
|
1697
|
+
rules: [{
|
|
1698
|
+
id: "allowedCharacters",
|
|
1699
|
+
params: {
|
|
1700
|
+
classes: ["digit"],
|
|
1701
|
+
extra: "-"
|
|
1702
|
+
}
|
|
1703
|
+
}],
|
|
1704
|
+
payload: { key: "idNumber" },
|
|
1705
|
+
prefill: ["document.documentNumber"]
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
name: "district",
|
|
1709
|
+
kind: "text",
|
|
1710
|
+
group: "address",
|
|
1711
|
+
section: "address",
|
|
1712
|
+
label: { key: "verification.labels.district" }
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
name: "postalCode",
|
|
1716
|
+
kind: "text",
|
|
1717
|
+
group: "address",
|
|
1718
|
+
section: "address",
|
|
1719
|
+
label: { key: "verification.labels.postalCode" },
|
|
1720
|
+
input: {
|
|
1721
|
+
maxLength: 4,
|
|
1722
|
+
autofill: "postalCode",
|
|
1723
|
+
keyboard: "numeric"
|
|
1724
|
+
},
|
|
1725
|
+
rules: [{ id: "postalCodeFormat" }, {
|
|
1726
|
+
id: "digitCount",
|
|
1727
|
+
params: { lengths: [4] }
|
|
1728
|
+
}],
|
|
1729
|
+
payload: { transforms: [{
|
|
1730
|
+
id: "stripSeparators",
|
|
1731
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
1732
|
+
}] },
|
|
1733
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
name: "postalCode",
|
|
1737
|
+
kind: "text",
|
|
1738
|
+
group: "address",
|
|
1739
|
+
section: "address",
|
|
1740
|
+
label: { key: "verification.labels.postalCode" },
|
|
1741
|
+
input: {
|
|
1742
|
+
maxLength: 8,
|
|
1743
|
+
autofill: "postalCode",
|
|
1744
|
+
keyboard: "numeric"
|
|
1745
|
+
},
|
|
1746
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
1747
|
+
payload: { transforms: [{
|
|
1748
|
+
id: "stripSeparators",
|
|
1749
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
1750
|
+
}] },
|
|
1751
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
name: "phone",
|
|
1755
|
+
kind: "phone",
|
|
1756
|
+
group: "phone",
|
|
1757
|
+
requiredWhen: [
|
|
1758
|
+
{ riskAddon: "phoneCheck" },
|
|
1759
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1760
|
+
{ riskAddon: "phoneProfile" }
|
|
1761
|
+
],
|
|
1762
|
+
label: { key: "verification.labels.phone" },
|
|
1763
|
+
input: { autofill: "phone" },
|
|
1764
|
+
phone: { lockCountry: "whenPhoneRisk" },
|
|
1765
|
+
rules: [{ id: "phoneFormat" }],
|
|
1766
|
+
payload: { transforms: [{ id: "e164" }] },
|
|
1767
|
+
prefill: ["phoneModule.phone"]
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
name: "phone",
|
|
1771
|
+
kind: "phone",
|
|
1772
|
+
group: "phone",
|
|
1773
|
+
required: true,
|
|
1774
|
+
requiredWhen: [
|
|
1775
|
+
{ riskAddon: "phoneCheck" },
|
|
1776
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
1777
|
+
{ riskAddon: "phoneProfile" }
|
|
1778
|
+
],
|
|
1779
|
+
label: { key: "verification.labels.phone" },
|
|
1780
|
+
input: { autofill: "phone" },
|
|
1781
|
+
phone: { lockCountry: true },
|
|
1782
|
+
rules: [{ id: "phoneFormat" }, {
|
|
1783
|
+
id: "phoneDigits",
|
|
1784
|
+
params: {
|
|
1785
|
+
min: 8,
|
|
1786
|
+
max: 8
|
|
1787
|
+
}
|
|
1788
|
+
}],
|
|
1789
|
+
payload: { transforms: [{ id: "e164NoPlus" }] },
|
|
1790
|
+
prefill: ["phoneModule.phone"]
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
name: "idNum",
|
|
1794
|
+
kind: "text",
|
|
1795
|
+
group: "idNumber",
|
|
1796
|
+
label: { key: "verification.labels.idNum" },
|
|
1797
|
+
input: {
|
|
1798
|
+
maxLength: 11,
|
|
1799
|
+
keyboard: "numeric"
|
|
1800
|
+
},
|
|
1801
|
+
rules: [{
|
|
1802
|
+
id: "digitCount",
|
|
1803
|
+
params: { lengths: [11] }
|
|
1804
|
+
}, {
|
|
1805
|
+
id: "numericRange",
|
|
1806
|
+
params: {
|
|
1807
|
+
min: 1e10,
|
|
1808
|
+
max: 99999999999
|
|
1809
|
+
}
|
|
1810
|
+
}],
|
|
1811
|
+
payload: { key: "idNum" },
|
|
1812
|
+
prefill: ["document.documentNumber"]
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
name: "city",
|
|
1816
|
+
kind: "choice",
|
|
1817
|
+
group: "address",
|
|
1818
|
+
section: "address",
|
|
1819
|
+
widget: "select",
|
|
1820
|
+
label: { key: "verification.labels.province" },
|
|
1821
|
+
placeholder: { key: "verification.placeholder.province" },
|
|
1822
|
+
input: { autofill: "addressLevel2" },
|
|
1823
|
+
options: [
|
|
1824
|
+
{
|
|
1825
|
+
value: "Adana",
|
|
1826
|
+
label: { key: "Adana" }
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
value: "Adıyaman",
|
|
1830
|
+
label: { key: "Adıyaman" }
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
value: "Afyonkarahisar",
|
|
1834
|
+
label: { key: "Afyonkarahisar" }
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
value: "Ağrı",
|
|
1838
|
+
label: { key: "Ağrı" }
|
|
1839
|
+
},
|
|
1840
|
+
{
|
|
1841
|
+
value: "Amasya",
|
|
1842
|
+
label: { key: "Amasya" }
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
value: "Ankara",
|
|
1846
|
+
label: { key: "Ankara" }
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
value: "Antalya",
|
|
1850
|
+
label: { key: "Antalya" }
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
value: "Artvin",
|
|
1854
|
+
label: { key: "Artvin" }
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
value: "Aydın",
|
|
1858
|
+
label: { key: "Aydın" }
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
value: "Balıkesir",
|
|
1862
|
+
label: { key: "Balıkesir" }
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
value: "Bilecik",
|
|
1866
|
+
label: { key: "Bilecik" }
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
value: "Bingöl",
|
|
1870
|
+
label: { key: "Bingöl" }
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
value: "Bitlis",
|
|
1874
|
+
label: { key: "Bitlis" }
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
value: "Bolu",
|
|
1878
|
+
label: { key: "Bolu" }
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
value: "Burdur",
|
|
1882
|
+
label: { key: "Burdur" }
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
value: "Bursa",
|
|
1886
|
+
label: { key: "Bursa" }
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
value: "Çanakkale",
|
|
1890
|
+
label: { key: "Çanakkale" }
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
value: "Çankırı",
|
|
1894
|
+
label: { key: "Çankırı" }
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
value: "Çorum",
|
|
1898
|
+
label: { key: "Çorum" }
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
value: "Denizli",
|
|
1902
|
+
label: { key: "Denizli" }
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
value: "Diyarbakır",
|
|
1906
|
+
label: { key: "Diyarbakır" }
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
value: "Edirne",
|
|
1910
|
+
label: { key: "Edirne" }
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
value: "Elazığ",
|
|
1914
|
+
label: { key: "Elazığ" }
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
value: "Erzincan",
|
|
1918
|
+
label: { key: "Erzincan" }
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
value: "Erzurum",
|
|
1922
|
+
label: { key: "Erzurum" }
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
value: "Eskişehir",
|
|
1926
|
+
label: { key: "Eskişehir" }
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
value: "Gaziantep",
|
|
1930
|
+
label: { key: "Gaziantep" }
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
value: "Giresun",
|
|
1934
|
+
label: { key: "Giresun" }
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
value: "Gümüşhane",
|
|
1938
|
+
label: { key: "Gümüşhane" }
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
value: "Hakkari",
|
|
1942
|
+
label: { key: "Hakkari" }
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
value: "Hatay",
|
|
1946
|
+
label: { key: "Hatay" }
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
value: "Isparta",
|
|
1950
|
+
label: { key: "Isparta" }
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
value: "Mersin",
|
|
1954
|
+
label: { key: "Mersin" }
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
value: "İstanbul",
|
|
1958
|
+
label: { key: "İstanbul" }
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
value: "İzmir",
|
|
1962
|
+
label: { key: "İzmir" }
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
value: "Kars",
|
|
1966
|
+
label: { key: "Kars" }
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
value: "Kastamonu",
|
|
1970
|
+
label: { key: "Kastamonu" }
|
|
1971
|
+
},
|
|
1972
|
+
{
|
|
1973
|
+
value: "Kayseri",
|
|
1974
|
+
label: { key: "Kayseri" }
|
|
1975
|
+
},
|
|
1976
|
+
{
|
|
1977
|
+
value: "Kırklareli",
|
|
1978
|
+
label: { key: "Kırklareli" }
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
value: "Kırşehir",
|
|
1982
|
+
label: { key: "Kırşehir" }
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
value: "Kocaeli",
|
|
1986
|
+
label: { key: "Kocaeli" }
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
value: "Konya",
|
|
1990
|
+
label: { key: "Konya" }
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
value: "Kütahya",
|
|
1994
|
+
label: { key: "Kütahya" }
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
value: "Malatya",
|
|
1998
|
+
label: { key: "Malatya" }
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
value: "Manisa",
|
|
2002
|
+
label: { key: "Manisa" }
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
value: "Kahramanmaraş",
|
|
2006
|
+
label: { key: "Kahramanmaraş" }
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
value: "Mardin",
|
|
2010
|
+
label: { key: "Mardin" }
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
value: "Muğla",
|
|
2014
|
+
label: { key: "Muğla" }
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
value: "Muş",
|
|
2018
|
+
label: { key: "Muş" }
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
value: "Nevşehir",
|
|
2022
|
+
label: { key: "Nevşehir" }
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
value: "Niğde",
|
|
2026
|
+
label: { key: "Niğde" }
|
|
2027
|
+
},
|
|
2028
|
+
{
|
|
2029
|
+
value: "Ordu",
|
|
2030
|
+
label: { key: "Ordu" }
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
value: "Rize",
|
|
2034
|
+
label: { key: "Rize" }
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
value: "Sakarya",
|
|
2038
|
+
label: { key: "Sakarya" }
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
value: "Samsun",
|
|
2042
|
+
label: { key: "Samsun" }
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
value: "Siirt",
|
|
2046
|
+
label: { key: "Siirt" }
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
value: "Sinop",
|
|
2050
|
+
label: { key: "Sinop" }
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
value: "Sivas",
|
|
2054
|
+
label: { key: "Sivas" }
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
value: "Tekirdağ",
|
|
2058
|
+
label: { key: "Tekirdağ" }
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
value: "Tokat",
|
|
2062
|
+
label: { key: "Tokat" }
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
value: "Trabzon",
|
|
2066
|
+
label: { key: "Trabzon" }
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
value: "Tunceli",
|
|
2070
|
+
label: { key: "Tunceli" }
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
value: "Şanlıurfa",
|
|
2074
|
+
label: { key: "Şanlıurfa" }
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
value: "Uşak",
|
|
2078
|
+
label: { key: "Uşak" }
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
value: "Van",
|
|
2082
|
+
label: { key: "Van" }
|
|
2083
|
+
},
|
|
2084
|
+
{
|
|
2085
|
+
value: "Yozgat",
|
|
2086
|
+
label: { key: "Yozgat" }
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
value: "Zonguldak",
|
|
2090
|
+
label: { key: "Zonguldak" }
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
value: "Aksaray",
|
|
2094
|
+
label: { key: "Aksaray" }
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
value: "Bayburt",
|
|
2098
|
+
label: { key: "Bayburt" }
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
value: "Karaman",
|
|
2102
|
+
label: { key: "Karaman" }
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
value: "Kırıkkale",
|
|
2106
|
+
label: { key: "Kırıkkale" }
|
|
2107
|
+
},
|
|
2108
|
+
{
|
|
2109
|
+
value: "Batman",
|
|
2110
|
+
label: { key: "Batman" }
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
value: "Şırnak",
|
|
2114
|
+
label: { key: "Şırnak" }
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
value: "Bartın",
|
|
2118
|
+
label: { key: "Bartın" }
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
value: "Ardahan",
|
|
2122
|
+
label: { key: "Ardahan" }
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
value: "Iğdır",
|
|
2126
|
+
label: { key: "Iğdır" }
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
value: "Yalova",
|
|
2130
|
+
label: { key: "Yalova" }
|
|
2131
|
+
},
|
|
2132
|
+
{
|
|
2133
|
+
value: "Karabük",
|
|
2134
|
+
label: { key: "Karabük" }
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
value: "Kilis",
|
|
2138
|
+
label: { key: "Kilis" }
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
value: "Osmaniye",
|
|
2142
|
+
label: { key: "Osmaniye" }
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
value: "Düzce",
|
|
2146
|
+
label: { key: "Düzce" }
|
|
2147
|
+
}
|
|
2148
|
+
],
|
|
2149
|
+
prefill: ["document.city", "poa.city"]
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
name: "surName",
|
|
2153
|
+
kind: "text",
|
|
2154
|
+
group: "name",
|
|
2155
|
+
required: true,
|
|
2156
|
+
label: { key: "verification.labels.lastName" },
|
|
2157
|
+
placeholder: { key: "verification.placeholder.lastName" },
|
|
2158
|
+
input: {
|
|
2159
|
+
maxLength: 100,
|
|
2160
|
+
autofill: "familyName"
|
|
2161
|
+
},
|
|
2162
|
+
rules: [{ id: "nameCharacters" }],
|
|
2163
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
name: "ssn",
|
|
2167
|
+
kind: "text",
|
|
2168
|
+
group: "ssn",
|
|
2169
|
+
required: true,
|
|
2170
|
+
widget: "masked",
|
|
2171
|
+
label: { key: "verification.labels.ssn" },
|
|
2172
|
+
input: {
|
|
2173
|
+
maxLength: 11,
|
|
2174
|
+
keyboard: "numeric"
|
|
2175
|
+
},
|
|
2176
|
+
rules: [{ id: "ssnFormat" }],
|
|
2177
|
+
payload: { transforms: [{
|
|
2178
|
+
id: "stripSeparators",
|
|
2179
|
+
params: { chars: "-" }
|
|
2180
|
+
}] }
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
name: "state",
|
|
2184
|
+
kind: "choice",
|
|
2185
|
+
group: "address",
|
|
2186
|
+
section: "address",
|
|
2187
|
+
required: true,
|
|
2188
|
+
widget: "select",
|
|
2189
|
+
label: { key: "verification.labels.chooseState" },
|
|
2190
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
2191
|
+
input: { autofill: "addressLevel1" },
|
|
2192
|
+
optionsRef: "US_STATES",
|
|
2193
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
2194
|
+
prefill: ["document.state", "poa.state"]
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
name: "postalCode",
|
|
2198
|
+
kind: "text",
|
|
2199
|
+
group: "address",
|
|
2200
|
+
section: "address",
|
|
2201
|
+
required: true,
|
|
2202
|
+
label: { key: "verification.labels.zipCode" },
|
|
2203
|
+
input: {
|
|
2204
|
+
maxLength: 10,
|
|
2205
|
+
autofill: "postalCode"
|
|
2206
|
+
},
|
|
2207
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
2208
|
+
payload: { transforms: [{
|
|
2209
|
+
id: "stripSeparators",
|
|
2210
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
2211
|
+
}] },
|
|
2212
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
name: "phone",
|
|
2216
|
+
kind: "phone",
|
|
2217
|
+
group: "phone",
|
|
2218
|
+
requiredWhen: [
|
|
2219
|
+
{ riskAddon: "phoneCheck" },
|
|
2220
|
+
{ riskAddon: "advancedPhoneCheck" },
|
|
2221
|
+
{ riskAddon: "phoneProfile" }
|
|
2222
|
+
],
|
|
2223
|
+
label: { key: "verification.labels.phone" },
|
|
2224
|
+
input: { autofill: "phone" },
|
|
2225
|
+
phone: { lockCountry: true },
|
|
2226
|
+
rules: [{ id: "phoneFormat" }, {
|
|
2227
|
+
id: "phoneDigits",
|
|
2228
|
+
params: {
|
|
2229
|
+
min: 10,
|
|
2230
|
+
max: 10
|
|
2231
|
+
}
|
|
2232
|
+
}],
|
|
2233
|
+
payload: { transforms: [{ id: "nationalNumber" }] },
|
|
2234
|
+
prefill: ["phoneModule.phone"]
|
|
2235
|
+
},
|
|
2236
|
+
{
|
|
2237
|
+
name: "ssn",
|
|
2238
|
+
kind: "text",
|
|
2239
|
+
group: "ssn",
|
|
2240
|
+
widget: "masked",
|
|
2241
|
+
label: { key: "verification.labels.ssn" },
|
|
2242
|
+
input: {
|
|
2243
|
+
maxLength: 11,
|
|
2244
|
+
keyboard: "numeric"
|
|
2245
|
+
},
|
|
2246
|
+
rules: [{ id: "ssnFormat" }],
|
|
2247
|
+
payload: {
|
|
2248
|
+
transforms: [{
|
|
2249
|
+
id: "stripSeparators",
|
|
2250
|
+
params: { chars: "-" }
|
|
2251
|
+
}],
|
|
2252
|
+
key: "idNumber"
|
|
2253
|
+
}
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
name: "state",
|
|
2257
|
+
kind: "choice",
|
|
2258
|
+
group: "address",
|
|
2259
|
+
section: "address",
|
|
2260
|
+
widget: "select",
|
|
2261
|
+
label: { key: "verification.labels.chooseState" },
|
|
2262
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
2263
|
+
input: { autofill: "addressLevel1" },
|
|
2264
|
+
optionsRef: "US_STATES",
|
|
2265
|
+
payload: { transforms: [{ id: "uppercase" }] },
|
|
2266
|
+
prefill: ["document.state", "poa.state"]
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
name: "postalCode",
|
|
2270
|
+
kind: "text",
|
|
2271
|
+
group: "address",
|
|
2272
|
+
section: "address",
|
|
2273
|
+
label: { key: "verification.labels.zipCode" },
|
|
2274
|
+
input: {
|
|
2275
|
+
maxLength: 10,
|
|
2276
|
+
autofill: "postalCode"
|
|
2277
|
+
},
|
|
2278
|
+
rules: [{ id: "postalCodeFormat" }],
|
|
2279
|
+
payload: { transforms: [{
|
|
2280
|
+
id: "stripSeparators",
|
|
2281
|
+
params: { chars: "- \n\v\f\r\xA0" }
|
|
2282
|
+
}] },
|
|
2283
|
+
prefill: ["document.postalCode", "poa.postalCode"]
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
name: "ssn",
|
|
2287
|
+
kind: "text",
|
|
2288
|
+
group: "ssn",
|
|
2289
|
+
widget: "masked",
|
|
2290
|
+
label: { key: "verification.labels.ssn" },
|
|
2291
|
+
input: {
|
|
2292
|
+
maxLength: 11,
|
|
2293
|
+
keyboard: "numeric"
|
|
2294
|
+
},
|
|
2295
|
+
rules: [{ id: "ssnFormat" }],
|
|
2296
|
+
payload: { transforms: [{
|
|
2297
|
+
id: "stripSeparators",
|
|
2298
|
+
params: { chars: "-" }
|
|
2299
|
+
}] }
|
|
2300
|
+
},
|
|
2301
|
+
{
|
|
2302
|
+
name: "apartment",
|
|
2303
|
+
kind: "text",
|
|
2304
|
+
group: "address",
|
|
2305
|
+
section: "address",
|
|
2306
|
+
label: { key: "verification.labels.apartment" },
|
|
2307
|
+
placeholder: { key: "verification.placeholder.apartment" },
|
|
2308
|
+
input: {
|
|
2309
|
+
autofill: "addressLine2",
|
|
2310
|
+
maxLength: 20
|
|
2311
|
+
}
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
name: "last4SSN",
|
|
2315
|
+
kind: "text",
|
|
2316
|
+
group: "last4SSN",
|
|
2317
|
+
label: { key: "verification.labels.last4SSN" },
|
|
2318
|
+
input: {
|
|
2319
|
+
maxLength: 4,
|
|
2320
|
+
keyboard: "numeric"
|
|
2321
|
+
},
|
|
2322
|
+
rules: [{
|
|
2323
|
+
id: "digitCount",
|
|
2324
|
+
params: { lengths: [4] }
|
|
2325
|
+
}]
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
name: "dlNumber",
|
|
2329
|
+
kind: "text",
|
|
2330
|
+
group: "dlNumber",
|
|
2331
|
+
section: "driverLicense",
|
|
2332
|
+
label: { key: "verification.labels.dlNumber" },
|
|
2333
|
+
prefill: ["document.driversLicenseNumber"]
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
name: "dlState",
|
|
2337
|
+
kind: "choice",
|
|
2338
|
+
group: "dlState",
|
|
2339
|
+
section: "driverLicense",
|
|
2340
|
+
widget: "select",
|
|
2341
|
+
label: { key: "verification.labels.dlState" },
|
|
2342
|
+
placeholder: { key: "verification.placeholder.state" },
|
|
2343
|
+
optionsRef: "US_STATES",
|
|
2344
|
+
prefill: ["document.driversLicenseState"]
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
name: "surName",
|
|
2348
|
+
kind: "text",
|
|
2349
|
+
group: "name",
|
|
2350
|
+
label: { key: "verification.labels.lastName" },
|
|
2351
|
+
placeholder: { key: "verification.placeholder.lastName" },
|
|
2352
|
+
input: {
|
|
2353
|
+
maxLength: 100,
|
|
2354
|
+
autofill: "familyName"
|
|
2355
|
+
},
|
|
2356
|
+
rules: [{ id: "nameCharacters" }],
|
|
2357
|
+
prefill: ["document.paternalLastName", "poa.lastName"]
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
name: "idNum",
|
|
2361
|
+
kind: "text",
|
|
2362
|
+
group: "idNumber",
|
|
2363
|
+
required: true,
|
|
2364
|
+
label: { key: "verification.labels.idNum" },
|
|
2365
|
+
input: {
|
|
2366
|
+
maxLength: 9,
|
|
2367
|
+
keyboard: "numeric"
|
|
2368
|
+
},
|
|
2369
|
+
rules: [{
|
|
2370
|
+
id: "digitCount",
|
|
2371
|
+
params: {
|
|
2372
|
+
min: 7,
|
|
2373
|
+
max: 9
|
|
2374
|
+
}
|
|
2375
|
+
}],
|
|
2376
|
+
payload: { key: "idNumber" },
|
|
2377
|
+
prefill: ["document.documentNumber"]
|
|
2378
|
+
}
|
|
2379
|
+
], [{
|
|
2380
|
+
static: { plugins: ["kyc"] },
|
|
2381
|
+
context: {
|
|
2382
|
+
source: "source",
|
|
2383
|
+
countryCode: "country"
|
|
2384
|
+
}
|
|
2385
|
+
}, { static: {
|
|
2386
|
+
plugins: ["kyc"],
|
|
2387
|
+
source: "PHONE_PROFILE"
|
|
2388
|
+
} }], {
|
|
2389
|
+
"ekyc/AR/AR_CREDIT_BUR_1": {
|
|
2390
|
+
schemaVersion: 1,
|
|
2391
|
+
vocabulary: "1.3",
|
|
2392
|
+
id: "ekyc/AR/AR_CREDIT_BUR_1",
|
|
2393
|
+
module: "ekyc",
|
|
2394
|
+
country: "AR",
|
|
2395
|
+
source: "AR_CREDIT_BUR_1",
|
|
2396
|
+
sections: [{ id: "address" }],
|
|
2397
|
+
fields: [
|
|
2398
|
+
0,
|
|
2399
|
+
1,
|
|
2400
|
+
2,
|
|
2401
|
+
3,
|
|
2402
|
+
4,
|
|
2403
|
+
5,
|
|
2404
|
+
6,
|
|
2405
|
+
7,
|
|
2406
|
+
8,
|
|
2407
|
+
9,
|
|
2408
|
+
10,
|
|
2409
|
+
11,
|
|
2410
|
+
12,
|
|
2411
|
+
13
|
|
2412
|
+
],
|
|
2413
|
+
submit: 0
|
|
2414
|
+
},
|
|
2415
|
+
"ekyc/AR/AR_RES_REGISTER": {
|
|
2416
|
+
schemaVersion: 1,
|
|
2417
|
+
vocabulary: "1.3",
|
|
2418
|
+
id: "ekyc/AR/AR_RES_REGISTER",
|
|
2419
|
+
module: "ekyc",
|
|
2420
|
+
country: "AR",
|
|
2421
|
+
source: "AR_RES_REGISTER",
|
|
2422
|
+
sections: [{ id: "address" }],
|
|
2423
|
+
fields: [
|
|
2424
|
+
0,
|
|
2425
|
+
1,
|
|
2426
|
+
2,
|
|
2427
|
+
14,
|
|
2428
|
+
4,
|
|
2429
|
+
15,
|
|
2430
|
+
8,
|
|
2431
|
+
9,
|
|
2432
|
+
16,
|
|
2433
|
+
11,
|
|
2434
|
+
17,
|
|
2435
|
+
13
|
|
2436
|
+
],
|
|
2437
|
+
submit: 0
|
|
2438
|
+
},
|
|
2439
|
+
"ekyc/BE/BE_CREDIT_TELCO": {
|
|
2440
|
+
schemaVersion: 1,
|
|
2441
|
+
vocabulary: "1.3",
|
|
2442
|
+
id: "ekyc/BE/BE_CREDIT_TELCO",
|
|
2443
|
+
module: "ekyc",
|
|
2444
|
+
country: "BE",
|
|
2445
|
+
source: "BE_CREDIT_TELCO",
|
|
2446
|
+
sections: [{ id: "address" }],
|
|
2447
|
+
fields: [
|
|
2448
|
+
0,
|
|
2449
|
+
2,
|
|
2450
|
+
14,
|
|
2451
|
+
4,
|
|
2452
|
+
18,
|
|
2453
|
+
9,
|
|
2454
|
+
10,
|
|
2455
|
+
11,
|
|
2456
|
+
12,
|
|
2457
|
+
19
|
|
2458
|
+
],
|
|
2459
|
+
submit: 0
|
|
2460
|
+
},
|
|
2461
|
+
"ekyc/BR/BR_GOVT_1": {
|
|
2462
|
+
schemaVersion: 1,
|
|
2463
|
+
vocabulary: "1.3",
|
|
2464
|
+
id: "ekyc/BR/BR_GOVT_1",
|
|
2465
|
+
module: "ekyc",
|
|
2466
|
+
country: "BR",
|
|
2467
|
+
source: "BR_GOVT_1",
|
|
2468
|
+
sections: [{ id: "address" }],
|
|
2469
|
+
fields: [
|
|
2470
|
+
0,
|
|
2471
|
+
2,
|
|
2472
|
+
3,
|
|
2473
|
+
4,
|
|
2474
|
+
15,
|
|
2475
|
+
20,
|
|
2476
|
+
21,
|
|
2477
|
+
9,
|
|
2478
|
+
10,
|
|
2479
|
+
11,
|
|
2480
|
+
22,
|
|
2481
|
+
23
|
|
2482
|
+
],
|
|
2483
|
+
submit: 0
|
|
2484
|
+
},
|
|
2485
|
+
"ekyc/BR/BR_TAX_PHONE_REGISTER": {
|
|
2486
|
+
schemaVersion: 1,
|
|
2487
|
+
vocabulary: "1.3",
|
|
2488
|
+
id: "ekyc/BR/BR_TAX_PHONE_REGISTER",
|
|
2489
|
+
module: "ekyc",
|
|
2490
|
+
country: "BR",
|
|
2491
|
+
source: "BR_TAX_PHONE_REGISTER",
|
|
2492
|
+
sections: [{ id: "address" }],
|
|
2493
|
+
fields: [
|
|
2494
|
+
0,
|
|
2495
|
+
1,
|
|
2496
|
+
2,
|
|
2497
|
+
14,
|
|
2498
|
+
24,
|
|
2499
|
+
25,
|
|
2500
|
+
26,
|
|
2501
|
+
8,
|
|
2502
|
+
9,
|
|
2503
|
+
10,
|
|
2504
|
+
27,
|
|
2505
|
+
22,
|
|
2506
|
+
23
|
|
2507
|
+
],
|
|
2508
|
+
submit: 0
|
|
2509
|
+
},
|
|
2510
|
+
"ekyc/CA/CA_CREDIT_FINTRAC": {
|
|
2511
|
+
schemaVersion: 1,
|
|
2512
|
+
vocabulary: "1.3",
|
|
2513
|
+
id: "ekyc/CA/CA_CREDIT_FINTRAC",
|
|
2514
|
+
module: "ekyc",
|
|
2515
|
+
country: "CA",
|
|
2516
|
+
source: "CA_CREDIT_FINTRAC",
|
|
2517
|
+
sections: [{ id: "address" }],
|
|
2518
|
+
fields: [
|
|
2519
|
+
0,
|
|
2520
|
+
1,
|
|
2521
|
+
2,
|
|
2522
|
+
3,
|
|
2523
|
+
4,
|
|
2524
|
+
15,
|
|
2525
|
+
28,
|
|
2526
|
+
29,
|
|
2527
|
+
27,
|
|
2528
|
+
17,
|
|
2529
|
+
30
|
|
2530
|
+
],
|
|
2531
|
+
submit: 0
|
|
2532
|
+
},
|
|
2533
|
+
"ekyc/CA/CA_RES_CREDIT": {
|
|
2534
|
+
schemaVersion: 1,
|
|
2535
|
+
vocabulary: "1.3",
|
|
2536
|
+
id: "ekyc/CA/CA_RES_CREDIT",
|
|
2537
|
+
module: "ekyc",
|
|
2538
|
+
country: "CA",
|
|
2539
|
+
source: "CA_RES_CREDIT",
|
|
2540
|
+
sections: [{ id: "address" }],
|
|
2541
|
+
fields: [
|
|
2542
|
+
0,
|
|
2543
|
+
1,
|
|
2544
|
+
2,
|
|
2545
|
+
3,
|
|
2546
|
+
4,
|
|
2547
|
+
5,
|
|
2548
|
+
28,
|
|
2549
|
+
29,
|
|
2550
|
+
31,
|
|
2551
|
+
32,
|
|
2552
|
+
33
|
|
2553
|
+
],
|
|
2554
|
+
submit: 0
|
|
2555
|
+
},
|
|
2556
|
+
"ekyc/CA/CA_TELCO": {
|
|
2557
|
+
schemaVersion: 1,
|
|
2558
|
+
vocabulary: "1.3",
|
|
2559
|
+
id: "ekyc/CA/CA_TELCO",
|
|
2560
|
+
module: "ekyc",
|
|
2561
|
+
country: "CA",
|
|
2562
|
+
source: "CA_TELCO",
|
|
2563
|
+
sections: [{ id: "address" }],
|
|
2564
|
+
fields: [
|
|
2565
|
+
0,
|
|
2566
|
+
2,
|
|
2567
|
+
3,
|
|
2568
|
+
4,
|
|
2569
|
+
34,
|
|
2570
|
+
9,
|
|
2571
|
+
11,
|
|
2572
|
+
35,
|
|
2573
|
+
13
|
|
2574
|
+
],
|
|
2575
|
+
submit: 0
|
|
2576
|
+
},
|
|
2577
|
+
"ekyc/CL/CL_CIVIL_REGISTER_2": {
|
|
2578
|
+
schemaVersion: 1,
|
|
2579
|
+
vocabulary: "1.2",
|
|
2580
|
+
id: "ekyc/CL/CL_CIVIL_REGISTER_2",
|
|
2581
|
+
module: "ekyc",
|
|
2582
|
+
country: "CL",
|
|
2583
|
+
source: "CL_CIVIL_REGISTER_2",
|
|
2584
|
+
fields: [
|
|
2585
|
+
0,
|
|
2586
|
+
2,
|
|
2587
|
+
4,
|
|
2588
|
+
15,
|
|
2589
|
+
36
|
|
2590
|
+
],
|
|
2591
|
+
submit: 0
|
|
2592
|
+
},
|
|
2593
|
+
"ekyc/CN/CN_NATIONAL_ID": {
|
|
2594
|
+
schemaVersion: 1,
|
|
2595
|
+
vocabulary: "1.4",
|
|
2596
|
+
id: "ekyc/CN/CN_NATIONAL_ID",
|
|
2597
|
+
module: "ekyc",
|
|
2598
|
+
country: "CN",
|
|
2599
|
+
source: "CN_NATIONAL_ID",
|
|
2600
|
+
fields: [
|
|
2601
|
+
37,
|
|
2602
|
+
38,
|
|
2603
|
+
3,
|
|
2604
|
+
4,
|
|
2605
|
+
15,
|
|
2606
|
+
39
|
|
2607
|
+
],
|
|
2608
|
+
submit: 0
|
|
2609
|
+
},
|
|
2610
|
+
"ekyc/CO/CO_CIVIL_REGISTER_1": {
|
|
2611
|
+
schemaVersion: 1,
|
|
2612
|
+
vocabulary: "1.3",
|
|
2613
|
+
id: "ekyc/CO/CO_CIVIL_REGISTER_1",
|
|
2614
|
+
module: "ekyc",
|
|
2615
|
+
country: "CO",
|
|
2616
|
+
source: "CO_CIVIL_REGISTER_1",
|
|
2617
|
+
groups: [{
|
|
2618
|
+
group: "issueDate",
|
|
2619
|
+
whenDisabled: "forceShow"
|
|
2620
|
+
}],
|
|
2621
|
+
fields: [
|
|
2622
|
+
0,
|
|
2623
|
+
1,
|
|
2624
|
+
2,
|
|
2625
|
+
14,
|
|
2626
|
+
4,
|
|
2627
|
+
15,
|
|
2628
|
+
40,
|
|
2629
|
+
41,
|
|
2630
|
+
8
|
|
2631
|
+
],
|
|
2632
|
+
submit: 0
|
|
2633
|
+
},
|
|
2634
|
+
"ekyc/DE/DE_PHONE_MOBILE_REGISTER": {
|
|
2635
|
+
schemaVersion: 1,
|
|
2636
|
+
vocabulary: "1.3",
|
|
2637
|
+
id: "ekyc/DE/DE_PHONE_MOBILE_REGISTER",
|
|
2638
|
+
module: "ekyc",
|
|
2639
|
+
country: "DE",
|
|
2640
|
+
source: "DE_PHONE_MOBILE_REGISTER",
|
|
2641
|
+
sections: [{ id: "address" }],
|
|
2642
|
+
fields: [
|
|
2643
|
+
0,
|
|
2644
|
+
1,
|
|
2645
|
+
2,
|
|
2646
|
+
14,
|
|
2647
|
+
4,
|
|
2648
|
+
42,
|
|
2649
|
+
9,
|
|
2650
|
+
10,
|
|
2651
|
+
11,
|
|
2652
|
+
13
|
|
2653
|
+
],
|
|
2654
|
+
submit: 0
|
|
2655
|
+
},
|
|
2656
|
+
"ekyc/DK/DK_CIVIL_REG_CREDIT_TELCO": {
|
|
2657
|
+
schemaVersion: 1,
|
|
2658
|
+
vocabulary: "1.3",
|
|
2659
|
+
id: "ekyc/DK/DK_CIVIL_REG_CREDIT_TELCO",
|
|
2660
|
+
module: "ekyc",
|
|
2661
|
+
country: "DK",
|
|
2662
|
+
source: "DK_CIVIL_REG_CREDIT_TELCO",
|
|
2663
|
+
sections: [{ id: "address" }],
|
|
2664
|
+
fields: [
|
|
2665
|
+
0,
|
|
2666
|
+
2,
|
|
2667
|
+
14,
|
|
2668
|
+
4,
|
|
2669
|
+
43,
|
|
2670
|
+
44,
|
|
2671
|
+
11,
|
|
2672
|
+
13
|
|
2673
|
+
],
|
|
2674
|
+
submit: 0
|
|
2675
|
+
},
|
|
2676
|
+
"ekyc/ES/ES_PHONE_REGISTER_2": {
|
|
2677
|
+
schemaVersion: 1,
|
|
2678
|
+
vocabulary: "1.3",
|
|
2679
|
+
id: "ekyc/ES/ES_PHONE_REGISTER_2",
|
|
2680
|
+
module: "ekyc",
|
|
2681
|
+
country: "ES",
|
|
2682
|
+
source: "ES_PHONE_REGISTER_2",
|
|
2683
|
+
sections: [{ id: "address" }],
|
|
2684
|
+
fields: [
|
|
2685
|
+
0,
|
|
2686
|
+
1,
|
|
2687
|
+
2,
|
|
2688
|
+
14,
|
|
2689
|
+
4,
|
|
2690
|
+
45,
|
|
2691
|
+
46,
|
|
2692
|
+
9,
|
|
2693
|
+
10,
|
|
2694
|
+
11,
|
|
2695
|
+
12,
|
|
2696
|
+
47
|
|
2697
|
+
],
|
|
2698
|
+
submit: 0
|
|
2699
|
+
},
|
|
2700
|
+
"ekyc/FI/FI_CONSUMER_POP_REG_TELCO": {
|
|
2701
|
+
schemaVersion: 1,
|
|
2702
|
+
vocabulary: "1.3",
|
|
2703
|
+
id: "ekyc/FI/FI_CONSUMER_POP_REG_TELCO",
|
|
2704
|
+
module: "ekyc",
|
|
2705
|
+
country: "FI",
|
|
2706
|
+
source: "FI_CONSUMER_POP_REG_TELCO",
|
|
2707
|
+
sections: [{ id: "address" }],
|
|
2708
|
+
fields: [
|
|
2709
|
+
0,
|
|
2710
|
+
2,
|
|
2711
|
+
14,
|
|
2712
|
+
24,
|
|
2713
|
+
48,
|
|
2714
|
+
8,
|
|
2715
|
+
9,
|
|
2716
|
+
10,
|
|
2717
|
+
11,
|
|
2718
|
+
47
|
|
2719
|
+
],
|
|
2720
|
+
submit: 0
|
|
2721
|
+
},
|
|
2722
|
+
"ekyc/FI/FI_NATIONAL_ID": {
|
|
2723
|
+
schemaVersion: 1,
|
|
2724
|
+
vocabulary: "1.3",
|
|
2725
|
+
id: "ekyc/FI/FI_NATIONAL_ID",
|
|
2726
|
+
module: "ekyc",
|
|
2727
|
+
country: "FI",
|
|
2728
|
+
source: "FI_NATIONAL_ID",
|
|
2729
|
+
sections: [{ id: "address" }],
|
|
2730
|
+
fields: [
|
|
2731
|
+
0,
|
|
2732
|
+
2,
|
|
2733
|
+
3,
|
|
2734
|
+
4,
|
|
2735
|
+
15,
|
|
2736
|
+
49,
|
|
2737
|
+
44,
|
|
2738
|
+
11,
|
|
2739
|
+
12,
|
|
2740
|
+
47
|
|
2741
|
+
],
|
|
2742
|
+
submit: 0
|
|
2743
|
+
},
|
|
2744
|
+
"ekyc/GB/GB_2X2": {
|
|
2745
|
+
schemaVersion: 1,
|
|
2746
|
+
vocabulary: "1.3",
|
|
2747
|
+
id: "ekyc/GB/GB_2X2",
|
|
2748
|
+
module: "ekyc",
|
|
2749
|
+
country: "GB",
|
|
2750
|
+
source: "GB_2X2",
|
|
2751
|
+
sections: [{ id: "address" }],
|
|
2752
|
+
fields: [
|
|
2753
|
+
0,
|
|
2754
|
+
2,
|
|
2755
|
+
3,
|
|
2756
|
+
4,
|
|
2757
|
+
15,
|
|
2758
|
+
50,
|
|
2759
|
+
51,
|
|
2760
|
+
52,
|
|
2761
|
+
33
|
|
2762
|
+
],
|
|
2763
|
+
submit: 0
|
|
2764
|
+
},
|
|
2765
|
+
"ekyc/GB/UK_VOTER_REGISTER": {
|
|
2766
|
+
schemaVersion: 1,
|
|
2767
|
+
vocabulary: "1.3",
|
|
2768
|
+
id: "ekyc/GB/UK_VOTER_REGISTER",
|
|
2769
|
+
module: "ekyc",
|
|
2770
|
+
country: "GB",
|
|
2771
|
+
source: "UK_VOTER_REGISTER",
|
|
2772
|
+
sections: [{ id: "address" }],
|
|
2773
|
+
fields: [
|
|
2774
|
+
0,
|
|
2775
|
+
1,
|
|
2776
|
+
2,
|
|
2777
|
+
14,
|
|
2778
|
+
4,
|
|
2779
|
+
5,
|
|
2780
|
+
8,
|
|
2781
|
+
9,
|
|
2782
|
+
16,
|
|
2783
|
+
11,
|
|
2784
|
+
13
|
|
2785
|
+
],
|
|
2786
|
+
submit: 0
|
|
2787
|
+
},
|
|
2788
|
+
"ekyc/GR/GR_1": {
|
|
2789
|
+
schemaVersion: 1,
|
|
2790
|
+
vocabulary: "1.3",
|
|
2791
|
+
id: "ekyc/GR/GR_1",
|
|
2792
|
+
module: "ekyc",
|
|
2793
|
+
country: "GR",
|
|
2794
|
+
source: "GR_1",
|
|
2795
|
+
sections: [{ id: "address" }],
|
|
2796
|
+
fields: [
|
|
2797
|
+
0,
|
|
2798
|
+
1,
|
|
2799
|
+
2,
|
|
2800
|
+
14,
|
|
2801
|
+
4,
|
|
2802
|
+
5,
|
|
2803
|
+
53,
|
|
2804
|
+
8,
|
|
2805
|
+
9,
|
|
2806
|
+
10,
|
|
2807
|
+
27,
|
|
2808
|
+
12,
|
|
2809
|
+
47
|
|
2810
|
+
],
|
|
2811
|
+
submit: 0
|
|
2812
|
+
},
|
|
2813
|
+
"ekyc/GT/GT_1": {
|
|
2814
|
+
schemaVersion: 1,
|
|
2815
|
+
vocabulary: "1.3",
|
|
2816
|
+
id: "ekyc/GT/GT_1",
|
|
2817
|
+
module: "ekyc",
|
|
2818
|
+
country: "GT",
|
|
2819
|
+
source: "GT_1",
|
|
2820
|
+
fields: [
|
|
2821
|
+
54,
|
|
2822
|
+
55,
|
|
2823
|
+
3,
|
|
2824
|
+
4,
|
|
2825
|
+
15,
|
|
2826
|
+
56
|
|
2827
|
+
],
|
|
2828
|
+
submit: 0
|
|
2829
|
+
},
|
|
2830
|
+
"ekyc/HK/HK_RESIDENT_REGISTER": {
|
|
2831
|
+
schemaVersion: 1,
|
|
2832
|
+
vocabulary: "1.3",
|
|
2833
|
+
id: "ekyc/HK/HK_RESIDENT_REGISTER",
|
|
2834
|
+
module: "ekyc",
|
|
2835
|
+
country: "HK",
|
|
2836
|
+
source: "HK_RESIDENT_REGISTER",
|
|
2837
|
+
sections: [{ id: "address" }],
|
|
2838
|
+
fields: [
|
|
2839
|
+
0,
|
|
2840
|
+
2,
|
|
2841
|
+
14,
|
|
2842
|
+
8,
|
|
2843
|
+
4,
|
|
2844
|
+
15,
|
|
2845
|
+
57,
|
|
2846
|
+
58,
|
|
2847
|
+
10,
|
|
2848
|
+
9,
|
|
2849
|
+
59,
|
|
2850
|
+
60
|
|
2851
|
+
],
|
|
2852
|
+
submit: 0
|
|
2853
|
+
},
|
|
2854
|
+
"ekyc/IN/IN_DMV": {
|
|
2855
|
+
schemaVersion: 1,
|
|
2856
|
+
vocabulary: "1.3",
|
|
2857
|
+
id: "ekyc/IN/IN_DMV",
|
|
2858
|
+
module: "ekyc",
|
|
2859
|
+
country: "IN",
|
|
2860
|
+
source: "IN_DMV",
|
|
2861
|
+
sections: [{ id: "address" }],
|
|
2862
|
+
fields: [
|
|
2863
|
+
0,
|
|
2864
|
+
1,
|
|
2865
|
+
2,
|
|
2866
|
+
3,
|
|
2867
|
+
4,
|
|
2868
|
+
15,
|
|
2869
|
+
61,
|
|
2870
|
+
9,
|
|
2871
|
+
62,
|
|
2872
|
+
11,
|
|
2873
|
+
63,
|
|
2874
|
+
64
|
|
2875
|
+
],
|
|
2876
|
+
submit: 0
|
|
2877
|
+
},
|
|
2878
|
+
"ekyc/IN/INDIA_PAN_1": {
|
|
2879
|
+
schemaVersion: 1,
|
|
2880
|
+
vocabulary: "1.3",
|
|
2881
|
+
id: "ekyc/IN/INDIA_PAN_1",
|
|
2882
|
+
module: "ekyc",
|
|
2883
|
+
country: "IN",
|
|
2884
|
+
source: "INDIA_PAN_1",
|
|
2885
|
+
fields: [
|
|
2886
|
+
0,
|
|
2887
|
+
2,
|
|
2888
|
+
3,
|
|
2889
|
+
65
|
|
2890
|
+
],
|
|
2891
|
+
submit: 0
|
|
2892
|
+
},
|
|
2893
|
+
"ekyc/IN/INDIA_PASSPORT_1": {
|
|
2894
|
+
schemaVersion: 1,
|
|
2895
|
+
vocabulary: "1.3",
|
|
2896
|
+
id: "ekyc/IN/INDIA_PASSPORT_1",
|
|
2897
|
+
module: "ekyc",
|
|
2898
|
+
country: "IN",
|
|
2899
|
+
source: "INDIA_PASSPORT_1",
|
|
2900
|
+
groups: [{
|
|
2901
|
+
group: "fileNumber",
|
|
2902
|
+
whenDisabled: "forceShow"
|
|
2903
|
+
}, {
|
|
2904
|
+
group: "issueDate",
|
|
2905
|
+
whenDisabled: "forceShow"
|
|
2906
|
+
}],
|
|
2907
|
+
fields: [
|
|
2908
|
+
0,
|
|
2909
|
+
66,
|
|
2910
|
+
3,
|
|
2911
|
+
67,
|
|
2912
|
+
68,
|
|
2913
|
+
69
|
|
2914
|
+
],
|
|
2915
|
+
submit: 0
|
|
2916
|
+
},
|
|
2917
|
+
"ekyc/IT/IT_CIVIL_REG_CREDIT_TELCO": {
|
|
2918
|
+
schemaVersion: 1,
|
|
2919
|
+
vocabulary: "1.3",
|
|
2920
|
+
id: "ekyc/IT/IT_CIVIL_REG_CREDIT_TELCO",
|
|
2921
|
+
module: "ekyc",
|
|
2922
|
+
country: "IT",
|
|
2923
|
+
source: "IT_CIVIL_REG_CREDIT_TELCO",
|
|
2924
|
+
sections: [{ id: "address" }],
|
|
2925
|
+
fields: [
|
|
2926
|
+
0,
|
|
2927
|
+
2,
|
|
2928
|
+
14,
|
|
2929
|
+
4,
|
|
2930
|
+
70,
|
|
2931
|
+
44,
|
|
2932
|
+
11,
|
|
2933
|
+
47
|
|
2934
|
+
],
|
|
2935
|
+
submit: 0
|
|
2936
|
+
},
|
|
2937
|
+
"ekyc/KG/KG_VOTER_REGISTER": {
|
|
2938
|
+
schemaVersion: 1,
|
|
2939
|
+
vocabulary: "1.2",
|
|
2940
|
+
id: "ekyc/KG/KG_VOTER_REGISTER",
|
|
2941
|
+
module: "ekyc",
|
|
2942
|
+
country: "KG",
|
|
2943
|
+
source: "KG_VOTER_REGISTER",
|
|
2944
|
+
sections: [{ id: "address" }],
|
|
2945
|
+
fields: [
|
|
2946
|
+
0,
|
|
2947
|
+
1,
|
|
2948
|
+
2,
|
|
2949
|
+
4,
|
|
2950
|
+
15,
|
|
2951
|
+
71,
|
|
2952
|
+
8,
|
|
2953
|
+
9,
|
|
2954
|
+
27
|
|
2955
|
+
],
|
|
2956
|
+
submit: 0
|
|
2957
|
+
},
|
|
2958
|
+
"ekyc/MX/MX_CIVIL_REGISTER_2": {
|
|
2959
|
+
schemaVersion: 1,
|
|
2960
|
+
vocabulary: "1.3",
|
|
2961
|
+
id: "ekyc/MX/MX_CIVIL_REGISTER_2",
|
|
2962
|
+
module: "ekyc",
|
|
2963
|
+
country: "MX",
|
|
2964
|
+
source: "MX_CIVIL_REGISTER_2",
|
|
2965
|
+
fields: [
|
|
2966
|
+
0,
|
|
2967
|
+
1,
|
|
2968
|
+
2,
|
|
2969
|
+
14,
|
|
2970
|
+
4,
|
|
2971
|
+
15,
|
|
2972
|
+
72,
|
|
2973
|
+
8
|
|
2974
|
+
],
|
|
2975
|
+
submit: 0
|
|
2976
|
+
},
|
|
2977
|
+
"ekyc/NL/NL_CIVIL_REG_CREDIT_TELCO": {
|
|
2978
|
+
schemaVersion: 1,
|
|
2979
|
+
vocabulary: "1.3",
|
|
2980
|
+
id: "ekyc/NL/NL_CIVIL_REG_CREDIT_TELCO",
|
|
2981
|
+
module: "ekyc",
|
|
2982
|
+
country: "NL",
|
|
2983
|
+
source: "NL_CIVIL_REG_CREDIT_TELCO",
|
|
2984
|
+
sections: [{ id: "address" }],
|
|
2985
|
+
fields: [
|
|
2986
|
+
0,
|
|
2987
|
+
2,
|
|
2988
|
+
14,
|
|
2989
|
+
4,
|
|
2990
|
+
48,
|
|
2991
|
+
44,
|
|
2992
|
+
11,
|
|
2993
|
+
13
|
|
2994
|
+
],
|
|
2995
|
+
submit: 0
|
|
2996
|
+
},
|
|
2997
|
+
"ekyc/NL/NL_CONSUMER_POP_REG_TELCO": {
|
|
2998
|
+
schemaVersion: 1,
|
|
2999
|
+
vocabulary: "1.3",
|
|
3000
|
+
id: "ekyc/NL/NL_CONSUMER_POP_REG_TELCO",
|
|
3001
|
+
module: "ekyc",
|
|
3002
|
+
country: "NL",
|
|
3003
|
+
source: "NL_CONSUMER_POP_REG_TELCO",
|
|
3004
|
+
sections: [{ id: "address" }],
|
|
3005
|
+
fields: [
|
|
3006
|
+
0,
|
|
3007
|
+
2,
|
|
3008
|
+
14,
|
|
3009
|
+
24,
|
|
3010
|
+
48,
|
|
3011
|
+
8,
|
|
3012
|
+
9,
|
|
3013
|
+
10,
|
|
3014
|
+
11,
|
|
3015
|
+
13
|
|
3016
|
+
],
|
|
3017
|
+
submit: 0
|
|
3018
|
+
},
|
|
3019
|
+
"ekyc/NO/NO_CONS_POP_REG": {
|
|
3020
|
+
schemaVersion: 1,
|
|
3021
|
+
vocabulary: "1.3",
|
|
3022
|
+
id: "ekyc/NO/NO_CONS_POP_REG",
|
|
3023
|
+
module: "ekyc",
|
|
3024
|
+
country: "NO",
|
|
3025
|
+
source: "NO_CONS_POP_REG",
|
|
3026
|
+
sections: [{ id: "address" }],
|
|
3027
|
+
fields: [
|
|
3028
|
+
0,
|
|
3029
|
+
2,
|
|
3030
|
+
3,
|
|
3031
|
+
24,
|
|
3032
|
+
73,
|
|
3033
|
+
8,
|
|
3034
|
+
9,
|
|
3035
|
+
10,
|
|
3036
|
+
11,
|
|
3037
|
+
13
|
|
3038
|
+
],
|
|
3039
|
+
submit: 0
|
|
3040
|
+
},
|
|
3041
|
+
"ekyc/PE/PE_CIVIL_REGISTER_2": {
|
|
3042
|
+
schemaVersion: 1,
|
|
3043
|
+
vocabulary: "1.3",
|
|
3044
|
+
id: "ekyc/PE/PE_CIVIL_REGISTER_2",
|
|
3045
|
+
module: "ekyc",
|
|
3046
|
+
country: "PE",
|
|
3047
|
+
source: "PE_CIVIL_REGISTER_2",
|
|
3048
|
+
sections: [{ id: "address" }],
|
|
3049
|
+
fields: [
|
|
3050
|
+
0,
|
|
3051
|
+
1,
|
|
3052
|
+
2,
|
|
3053
|
+
14,
|
|
3054
|
+
4,
|
|
3055
|
+
15,
|
|
3056
|
+
74,
|
|
3057
|
+
8,
|
|
3058
|
+
44
|
|
3059
|
+
],
|
|
3060
|
+
submit: 0
|
|
3061
|
+
},
|
|
3062
|
+
"ekyc/PH/PH_RES_CREDIT": {
|
|
3063
|
+
schemaVersion: 1,
|
|
3064
|
+
vocabulary: "1.3",
|
|
3065
|
+
id: "ekyc/PH/PH_RES_CREDIT",
|
|
3066
|
+
module: "ekyc",
|
|
3067
|
+
country: "PH",
|
|
3068
|
+
source: "PH_RES_CREDIT",
|
|
3069
|
+
sections: [{ id: "address" }],
|
|
3070
|
+
groups: [{
|
|
3071
|
+
group: "idType",
|
|
3072
|
+
whenDisabled: "forceShow"
|
|
3073
|
+
}],
|
|
3074
|
+
fields: [
|
|
3075
|
+
0,
|
|
3076
|
+
1,
|
|
3077
|
+
2,
|
|
3078
|
+
3,
|
|
3079
|
+
4,
|
|
3080
|
+
15,
|
|
3081
|
+
75,
|
|
3082
|
+
76,
|
|
3083
|
+
44,
|
|
3084
|
+
77,
|
|
3085
|
+
11,
|
|
3086
|
+
12,
|
|
3087
|
+
78
|
|
3088
|
+
],
|
|
3089
|
+
groupRules: [{
|
|
3090
|
+
id: "rulesByOption",
|
|
3091
|
+
fields: ["idType", "idNum"],
|
|
3092
|
+
params: {
|
|
3093
|
+
selector: "idType",
|
|
3094
|
+
target: "idNum",
|
|
3095
|
+
cases: {
|
|
3096
|
+
TIN: [{
|
|
3097
|
+
id: "charTemplate",
|
|
3098
|
+
params: { templates: [
|
|
3099
|
+
"999999999",
|
|
3100
|
+
"999-999-999",
|
|
3101
|
+
"999999999999",
|
|
3102
|
+
"999-999-999-999"
|
|
3103
|
+
] }
|
|
3104
|
+
}],
|
|
3105
|
+
SSS: [{
|
|
3106
|
+
id: "charTemplate",
|
|
3107
|
+
params: { templates: ["99-9999999-9"] }
|
|
3108
|
+
}],
|
|
3109
|
+
GSIS: [{
|
|
3110
|
+
id: "digitCount",
|
|
3111
|
+
params: { lengths: [12] }
|
|
3112
|
+
}]
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
}],
|
|
3116
|
+
submit: 0
|
|
3117
|
+
},
|
|
3118
|
+
"ekyc/PT/PT_CIVIL_REG_CREDIT_TELCO": {
|
|
3119
|
+
schemaVersion: 1,
|
|
3120
|
+
vocabulary: "1.3",
|
|
3121
|
+
id: "ekyc/PT/PT_CIVIL_REG_CREDIT_TELCO",
|
|
3122
|
+
module: "ekyc",
|
|
3123
|
+
country: "PT",
|
|
3124
|
+
source: "PT_CIVIL_REG_CREDIT_TELCO",
|
|
3125
|
+
sections: [{ id: "address" }],
|
|
3126
|
+
fields: [
|
|
3127
|
+
0,
|
|
3128
|
+
2,
|
|
3129
|
+
14,
|
|
3130
|
+
4,
|
|
3131
|
+
48,
|
|
3132
|
+
44,
|
|
3133
|
+
11,
|
|
3134
|
+
79
|
|
3135
|
+
],
|
|
3136
|
+
submit: 0
|
|
3137
|
+
},
|
|
3138
|
+
"ekyc/PT/PT_PHONE_REGISTER": {
|
|
3139
|
+
schemaVersion: 1,
|
|
3140
|
+
vocabulary: "1.2",
|
|
3141
|
+
id: "ekyc/PT/PT_PHONE_REGISTER",
|
|
3142
|
+
module: "ekyc",
|
|
3143
|
+
country: "PT",
|
|
3144
|
+
source: "PT_PHONE_REGISTER",
|
|
3145
|
+
sections: [{ id: "address" }],
|
|
3146
|
+
fields: [
|
|
3147
|
+
0,
|
|
3148
|
+
1,
|
|
3149
|
+
2,
|
|
3150
|
+
4,
|
|
3151
|
+
45,
|
|
3152
|
+
8,
|
|
3153
|
+
44,
|
|
3154
|
+
11,
|
|
3155
|
+
79
|
|
3156
|
+
],
|
|
3157
|
+
submit: 0
|
|
3158
|
+
},
|
|
3159
|
+
"ekyc/RISK_ADDONS_ONLY": {
|
|
3160
|
+
schemaVersion: 1,
|
|
3161
|
+
vocabulary: "1.2",
|
|
3162
|
+
id: "ekyc/RISK_ADDONS_ONLY",
|
|
3163
|
+
module: "ekyc",
|
|
3164
|
+
source: "RISK_ADDONS_ONLY",
|
|
3165
|
+
fields: [24, 80],
|
|
3166
|
+
submit: 0
|
|
3167
|
+
},
|
|
3168
|
+
"ekyc/RISK_ADDONS_ONLY/phoneProfile": {
|
|
3169
|
+
schemaVersion: 1,
|
|
3170
|
+
vocabulary: "1.2",
|
|
3171
|
+
id: "ekyc/RISK_ADDONS_ONLY/phoneProfile",
|
|
3172
|
+
module: "ekyc",
|
|
3173
|
+
source: "RISK_ADDONS_ONLY",
|
|
3174
|
+
riskAddon: "phoneProfile",
|
|
3175
|
+
fields: [24, 15],
|
|
3176
|
+
submit: 1
|
|
3177
|
+
},
|
|
3178
|
+
"ekyc/RO/RO_VOTER_REGISTER": {
|
|
3179
|
+
schemaVersion: 1,
|
|
3180
|
+
vocabulary: "1.3",
|
|
3181
|
+
id: "ekyc/RO/RO_VOTER_REGISTER",
|
|
3182
|
+
module: "ekyc",
|
|
3183
|
+
country: "RO",
|
|
3184
|
+
source: "RO_VOTER_REGISTER",
|
|
3185
|
+
sections: [{ id: "address" }],
|
|
3186
|
+
fields: [
|
|
3187
|
+
0,
|
|
3188
|
+
1,
|
|
3189
|
+
2,
|
|
3190
|
+
14,
|
|
3191
|
+
4,
|
|
3192
|
+
15,
|
|
3193
|
+
8,
|
|
3194
|
+
44,
|
|
3195
|
+
11,
|
|
3196
|
+
64
|
|
3197
|
+
],
|
|
3198
|
+
submit: 0
|
|
3199
|
+
},
|
|
3200
|
+
"ekyc/SG/SG_PHONE_REGISTER": {
|
|
3201
|
+
schemaVersion: 1,
|
|
3202
|
+
vocabulary: "1.3",
|
|
3203
|
+
id: "ekyc/SG/SG_PHONE_REGISTER",
|
|
3204
|
+
module: "ekyc",
|
|
3205
|
+
country: "SG",
|
|
3206
|
+
source: "SG_PHONE_REGISTER",
|
|
3207
|
+
sections: [{ id: "address" }],
|
|
3208
|
+
fields: [
|
|
3209
|
+
0,
|
|
3210
|
+
1,
|
|
3211
|
+
2,
|
|
3212
|
+
14,
|
|
3213
|
+
24,
|
|
3214
|
+
81,
|
|
3215
|
+
8,
|
|
3216
|
+
9,
|
|
3217
|
+
10,
|
|
3218
|
+
11,
|
|
3219
|
+
13
|
|
3220
|
+
],
|
|
3221
|
+
submit: 0
|
|
3222
|
+
},
|
|
3223
|
+
"ekyc/TR/TR_VOTER_REGISTER": {
|
|
3224
|
+
schemaVersion: 1,
|
|
3225
|
+
vocabulary: "1.3",
|
|
3226
|
+
id: "ekyc/TR/TR_VOTER_REGISTER",
|
|
3227
|
+
module: "ekyc",
|
|
3228
|
+
country: "TR",
|
|
3229
|
+
source: "TR_VOTER_REGISTER",
|
|
3230
|
+
sections: [{ id: "address" }],
|
|
3231
|
+
fields: [
|
|
3232
|
+
0,
|
|
3233
|
+
1,
|
|
3234
|
+
2,
|
|
3235
|
+
14,
|
|
3236
|
+
4,
|
|
3237
|
+
15,
|
|
3238
|
+
82,
|
|
3239
|
+
8,
|
|
3240
|
+
44,
|
|
3241
|
+
83
|
|
3242
|
+
],
|
|
3243
|
+
submit: 0
|
|
3244
|
+
},
|
|
3245
|
+
"ekyc/US/US_CREDIT_BUREAU_1": {
|
|
3246
|
+
schemaVersion: 1,
|
|
3247
|
+
vocabulary: "1.3",
|
|
3248
|
+
id: "ekyc/US/US_CREDIT_BUREAU_1",
|
|
3249
|
+
module: "ekyc",
|
|
3250
|
+
country: "US",
|
|
3251
|
+
source: "US_CREDIT_BUREAU_1",
|
|
3252
|
+
sections: [{ id: "address" }],
|
|
3253
|
+
fields: [
|
|
3254
|
+
0,
|
|
3255
|
+
1,
|
|
3256
|
+
84,
|
|
3257
|
+
14,
|
|
3258
|
+
24,
|
|
3259
|
+
5,
|
|
3260
|
+
85,
|
|
3261
|
+
28,
|
|
3262
|
+
27,
|
|
3263
|
+
86,
|
|
3264
|
+
87
|
|
3265
|
+
],
|
|
3266
|
+
submit: 0
|
|
3267
|
+
},
|
|
3268
|
+
"ekyc/US/US_CREDIT_BUREAU_3": {
|
|
3269
|
+
schemaVersion: 1,
|
|
3270
|
+
vocabulary: "1.3",
|
|
3271
|
+
id: "ekyc/US/US_CREDIT_BUREAU_3",
|
|
3272
|
+
module: "ekyc",
|
|
3273
|
+
country: "US",
|
|
3274
|
+
source: "US_CREDIT_BUREAU_3",
|
|
3275
|
+
sections: [{ id: "address" }],
|
|
3276
|
+
fields: [
|
|
3277
|
+
0,
|
|
3278
|
+
1,
|
|
3279
|
+
84,
|
|
3280
|
+
14,
|
|
3281
|
+
24,
|
|
3282
|
+
88,
|
|
3283
|
+
89,
|
|
3284
|
+
9,
|
|
3285
|
+
10,
|
|
3286
|
+
11,
|
|
3287
|
+
90,
|
|
3288
|
+
91
|
|
3289
|
+
],
|
|
3290
|
+
groupRules: [{
|
|
3291
|
+
id: "oneOfRequired",
|
|
3292
|
+
fields: ["dateOfBirth", "phone"],
|
|
3293
|
+
message: {
|
|
3294
|
+
key: "verification.errors.dobOrPhoneRequired",
|
|
3295
|
+
text: "Enter your date of birth or phone number"
|
|
3296
|
+
}
|
|
3297
|
+
}],
|
|
3298
|
+
submit: 0
|
|
3299
|
+
},
|
|
3300
|
+
"ekyc/US/US_CREDIT_TELCO": {
|
|
3301
|
+
schemaVersion: 1,
|
|
3302
|
+
vocabulary: "1.3",
|
|
3303
|
+
id: "ekyc/US/US_CREDIT_TELCO",
|
|
3304
|
+
module: "ekyc",
|
|
3305
|
+
country: "US",
|
|
3306
|
+
source: "US_CREDIT_TELCO",
|
|
3307
|
+
sections: [{ id: "address" }],
|
|
3308
|
+
groups: [{
|
|
3309
|
+
group: "name",
|
|
3310
|
+
whenDisabled: "forceShow"
|
|
3311
|
+
}],
|
|
3312
|
+
fields: [
|
|
3313
|
+
0,
|
|
3314
|
+
84,
|
|
3315
|
+
14,
|
|
3316
|
+
4,
|
|
3317
|
+
5,
|
|
3318
|
+
92,
|
|
3319
|
+
9,
|
|
3320
|
+
93,
|
|
3321
|
+
11,
|
|
3322
|
+
90,
|
|
3323
|
+
91
|
|
3324
|
+
],
|
|
3325
|
+
groupRules: [{
|
|
3326
|
+
id: "oneOfRequired",
|
|
3327
|
+
fields: ["dateOfBirth", "ssn"],
|
|
3328
|
+
message: { key: "verification.errors.dobOrSsnRequired" }
|
|
3329
|
+
}],
|
|
3330
|
+
submit: 0
|
|
3331
|
+
},
|
|
3332
|
+
"ekyc/US/US_TELCO_1": {
|
|
3333
|
+
schemaVersion: 1,
|
|
3334
|
+
vocabulary: "1.3",
|
|
3335
|
+
id: "ekyc/US/US_TELCO_1",
|
|
3336
|
+
module: "ekyc",
|
|
3337
|
+
country: "US",
|
|
3338
|
+
source: "US_TELCO_1",
|
|
3339
|
+
sections: [{ id: "driverLicense" }, { id: "address" }],
|
|
3340
|
+
fields: [
|
|
3341
|
+
0,
|
|
3342
|
+
84,
|
|
3343
|
+
14,
|
|
3344
|
+
24,
|
|
3345
|
+
34,
|
|
3346
|
+
94,
|
|
3347
|
+
95,
|
|
3348
|
+
96,
|
|
3349
|
+
9,
|
|
3350
|
+
11,
|
|
3351
|
+
90,
|
|
3352
|
+
91
|
|
3353
|
+
],
|
|
3354
|
+
submit: 0
|
|
3355
|
+
},
|
|
3356
|
+
"ekyc/US/US_TELCO_2": {
|
|
3357
|
+
schemaVersion: 1,
|
|
3358
|
+
vocabulary: "1.3",
|
|
3359
|
+
id: "ekyc/US/US_TELCO_2",
|
|
3360
|
+
module: "ekyc",
|
|
3361
|
+
country: "US",
|
|
3362
|
+
source: "US_TELCO_2",
|
|
3363
|
+
sections: [{ id: "address" }],
|
|
3364
|
+
fields: [
|
|
3365
|
+
54,
|
|
3366
|
+
97,
|
|
3367
|
+
14,
|
|
3368
|
+
4,
|
|
3369
|
+
34,
|
|
3370
|
+
9,
|
|
3371
|
+
11,
|
|
3372
|
+
90,
|
|
3373
|
+
91
|
|
3374
|
+
],
|
|
3375
|
+
submit: 0
|
|
3376
|
+
},
|
|
3377
|
+
"ekyc/VE/VE_CIVIL_REGISTER": {
|
|
3378
|
+
schemaVersion: 1,
|
|
3379
|
+
vocabulary: "1.3",
|
|
3380
|
+
id: "ekyc/VE/VE_CIVIL_REGISTER",
|
|
3381
|
+
module: "ekyc",
|
|
3382
|
+
country: "VE",
|
|
3383
|
+
source: "VE_CIVIL_REGISTER",
|
|
3384
|
+
fields: [
|
|
3385
|
+
0,
|
|
3386
|
+
1,
|
|
3387
|
+
2,
|
|
3388
|
+
14,
|
|
3389
|
+
4,
|
|
3390
|
+
15,
|
|
3391
|
+
98
|
|
3392
|
+
],
|
|
3393
|
+
submit: 0
|
|
3394
|
+
}
|
|
3395
|
+
});
|
|
3396
|
+
const caProvinceOptions = Object.values({
|
|
3397
|
+
AB: {
|
|
3398
|
+
code: "AB",
|
|
3399
|
+
name: "Alberta"
|
|
3400
|
+
},
|
|
3401
|
+
BC: {
|
|
3402
|
+
code: "BC",
|
|
3403
|
+
name: "British Columbia"
|
|
3404
|
+
},
|
|
3405
|
+
MB: {
|
|
3406
|
+
code: "MB",
|
|
3407
|
+
name: "Manitoba"
|
|
3408
|
+
},
|
|
3409
|
+
NB: {
|
|
3410
|
+
code: "NB",
|
|
3411
|
+
name: "New Brunswick"
|
|
3412
|
+
},
|
|
3413
|
+
NL: {
|
|
3414
|
+
code: "NL",
|
|
3415
|
+
name: "Newfoundland and Labrador"
|
|
3416
|
+
},
|
|
3417
|
+
NS: {
|
|
3418
|
+
code: "NS",
|
|
3419
|
+
name: "Nova Scotia"
|
|
3420
|
+
},
|
|
3421
|
+
ON: {
|
|
3422
|
+
code: "ON",
|
|
3423
|
+
name: "Ontario"
|
|
3424
|
+
},
|
|
3425
|
+
PE: {
|
|
3426
|
+
code: "PE",
|
|
3427
|
+
name: "Prince Edward Island"
|
|
3428
|
+
},
|
|
3429
|
+
QC: {
|
|
3430
|
+
code: "QC",
|
|
3431
|
+
name: "Quebec"
|
|
3432
|
+
},
|
|
3433
|
+
SK: {
|
|
3434
|
+
code: "SK",
|
|
3435
|
+
name: "Saskatchewan"
|
|
3436
|
+
},
|
|
3437
|
+
NT: {
|
|
3438
|
+
code: "NT",
|
|
3439
|
+
name: "Northwest Territories"
|
|
3440
|
+
},
|
|
3441
|
+
NU: {
|
|
3442
|
+
code: "NU",
|
|
3443
|
+
name: "Nunavut"
|
|
3444
|
+
},
|
|
3445
|
+
YT: {
|
|
3446
|
+
code: "YT",
|
|
3447
|
+
name: "Yukon"
|
|
3448
|
+
}
|
|
3449
|
+
}).map((province) => ({
|
|
3450
|
+
value: province.code,
|
|
3451
|
+
label: province.name
|
|
3452
|
+
}));
|
|
3453
|
+
const inStateOptions = Object.values({
|
|
3454
|
+
AN: {
|
|
3455
|
+
code: "AN",
|
|
3456
|
+
name: "Andaman and Nicobar Islands"
|
|
3457
|
+
},
|
|
3458
|
+
AP: {
|
|
3459
|
+
code: "AP",
|
|
3460
|
+
name: "Andhra Pradesh"
|
|
3461
|
+
},
|
|
3462
|
+
AR: {
|
|
3463
|
+
code: "AR",
|
|
3464
|
+
name: "Arunachal Pradesh"
|
|
3465
|
+
},
|
|
3466
|
+
AS: {
|
|
3467
|
+
code: "AS",
|
|
3468
|
+
name: "Assam"
|
|
3469
|
+
},
|
|
3470
|
+
BR: {
|
|
3471
|
+
code: "BR",
|
|
3472
|
+
name: "Bihar"
|
|
3473
|
+
},
|
|
3474
|
+
CH: {
|
|
3475
|
+
code: "CH",
|
|
3476
|
+
name: "Chandigarh"
|
|
3477
|
+
},
|
|
3478
|
+
CT: {
|
|
3479
|
+
code: "CT",
|
|
3480
|
+
name: "Chhattisgarh"
|
|
3481
|
+
},
|
|
3482
|
+
DH: {
|
|
3483
|
+
code: "DH",
|
|
3484
|
+
name: "Dadra and Nagar Haveli and Daman and Diu"
|
|
3485
|
+
},
|
|
3486
|
+
DL: {
|
|
3487
|
+
code: "DL",
|
|
3488
|
+
name: "Delhi"
|
|
3489
|
+
},
|
|
3490
|
+
GA: {
|
|
3491
|
+
code: "GA",
|
|
3492
|
+
name: "Goa"
|
|
3493
|
+
},
|
|
3494
|
+
GJ: {
|
|
3495
|
+
code: "GJ",
|
|
3496
|
+
name: "Gujarat"
|
|
3497
|
+
},
|
|
3498
|
+
HR: {
|
|
3499
|
+
code: "HR",
|
|
3500
|
+
name: "Haryana"
|
|
3501
|
+
},
|
|
3502
|
+
HP: {
|
|
3503
|
+
code: "HP",
|
|
3504
|
+
name: "Himachal Pradesh"
|
|
3505
|
+
},
|
|
3506
|
+
JK: {
|
|
3507
|
+
code: "JK",
|
|
3508
|
+
name: "Jammu and Kashmir"
|
|
3509
|
+
},
|
|
3510
|
+
JH: {
|
|
3511
|
+
code: "JH",
|
|
3512
|
+
name: "Jharkhand"
|
|
3513
|
+
},
|
|
3514
|
+
KA: {
|
|
3515
|
+
code: "KA",
|
|
3516
|
+
name: "Karnataka"
|
|
3517
|
+
},
|
|
3518
|
+
KL: {
|
|
3519
|
+
code: "KL",
|
|
3520
|
+
name: "Kerala"
|
|
3521
|
+
},
|
|
3522
|
+
LA: {
|
|
3523
|
+
code: "LA",
|
|
3524
|
+
name: "Ladakh"
|
|
3525
|
+
},
|
|
3526
|
+
LD: {
|
|
3527
|
+
code: "LD",
|
|
3528
|
+
name: "Lakshadweep"
|
|
3529
|
+
},
|
|
3530
|
+
MP: {
|
|
3531
|
+
code: "MP",
|
|
3532
|
+
name: "Madhya Pradesh"
|
|
3533
|
+
},
|
|
3534
|
+
MH: {
|
|
3535
|
+
code: "MH",
|
|
3536
|
+
name: "Maharashtra"
|
|
3537
|
+
},
|
|
3538
|
+
MN: {
|
|
3539
|
+
code: "MN",
|
|
3540
|
+
name: "Manipur"
|
|
3541
|
+
},
|
|
3542
|
+
ML: {
|
|
3543
|
+
code: "ML",
|
|
3544
|
+
name: "Meghalaya"
|
|
3545
|
+
},
|
|
3546
|
+
MZ: {
|
|
3547
|
+
code: "MZ",
|
|
3548
|
+
name: "Mizoram"
|
|
3549
|
+
},
|
|
3550
|
+
NL: {
|
|
3551
|
+
code: "NL",
|
|
3552
|
+
name: "Nagaland"
|
|
3553
|
+
},
|
|
3554
|
+
OR: {
|
|
3555
|
+
code: "OR",
|
|
3556
|
+
name: "Odisha"
|
|
3557
|
+
},
|
|
3558
|
+
PY: {
|
|
3559
|
+
code: "PY",
|
|
3560
|
+
name: "Puducherry"
|
|
3561
|
+
},
|
|
3562
|
+
PB: {
|
|
3563
|
+
code: "PB",
|
|
3564
|
+
name: "Punjab"
|
|
3565
|
+
},
|
|
3566
|
+
RJ: {
|
|
3567
|
+
code: "RJ",
|
|
3568
|
+
name: "Rajasthan"
|
|
3569
|
+
},
|
|
3570
|
+
SK: {
|
|
3571
|
+
code: "SK",
|
|
3572
|
+
name: "Sikkim"
|
|
3573
|
+
},
|
|
3574
|
+
TN: {
|
|
3575
|
+
code: "TN",
|
|
3576
|
+
name: "Tamil Nadu"
|
|
3577
|
+
},
|
|
3578
|
+
TG: {
|
|
3579
|
+
code: "TG",
|
|
3580
|
+
name: "Telangana"
|
|
3581
|
+
},
|
|
3582
|
+
TR: {
|
|
3583
|
+
code: "TR",
|
|
3584
|
+
name: "Tripura"
|
|
3585
|
+
},
|
|
3586
|
+
UP: {
|
|
3587
|
+
code: "UP",
|
|
3588
|
+
name: "Uttar Pradesh"
|
|
3589
|
+
},
|
|
3590
|
+
UK: {
|
|
3591
|
+
code: "UK",
|
|
3592
|
+
name: "Uttarakhand"
|
|
3593
|
+
},
|
|
3594
|
+
WB: {
|
|
3595
|
+
code: "WB",
|
|
3596
|
+
name: "West Bengal"
|
|
3597
|
+
}
|
|
3598
|
+
}).map((state) => ({
|
|
3599
|
+
value: state.code,
|
|
3600
|
+
label: state.name
|
|
3601
|
+
}));
|
|
3602
|
+
//#endregion
|
|
3603
|
+
//#region src/modules/ekyc/ekycRules.ts
|
|
3604
|
+
/** Vocabulary rules expressed as today's `EkycValidationRule` objects. */
|
|
3605
|
+
const RULES = {
|
|
3606
|
+
cpf: () => ({ type: "cpf" }),
|
|
3607
|
+
ssnFormat: () => ({ type: "ssnFormat" }),
|
|
3608
|
+
noPoBox: () => ({ type: "noPoBox" }),
|
|
3609
|
+
emailFormat: () => ({ type: "emailFormat" }),
|
|
3610
|
+
postalCodeFormat: ({ country }) => ({
|
|
3611
|
+
type: "postalCodeFormat",
|
|
3612
|
+
country
|
|
3613
|
+
}),
|
|
3614
|
+
phoneFormat: ({ country, required }) => ({
|
|
3615
|
+
type: "phoneFormat",
|
|
3616
|
+
country,
|
|
3617
|
+
optional: !required
|
|
3618
|
+
}),
|
|
3619
|
+
exactLength: ({ params }) => ({
|
|
3620
|
+
type: "exactLength",
|
|
3621
|
+
length: params.length
|
|
3622
|
+
}),
|
|
3623
|
+
nameCharacters: () => ({ type: "nameCharacters" }),
|
|
3624
|
+
notFuture: () => ({ type: "notFuture" }),
|
|
3625
|
+
maxAge: ({ params }) => ({
|
|
3626
|
+
type: "maxAge",
|
|
3627
|
+
years: params.years
|
|
3628
|
+
}),
|
|
3629
|
+
phoneDigits: ({ country, params }) => ({
|
|
3630
|
+
type: "phoneDigits",
|
|
3631
|
+
country,
|
|
3632
|
+
min: params.min,
|
|
3633
|
+
max: params.max
|
|
3634
|
+
}),
|
|
3635
|
+
digitCount: ({ params }) => ({
|
|
3636
|
+
type: "digitCount",
|
|
3637
|
+
...params.lengths !== void 0 && { lengths: [...params.lengths] },
|
|
3638
|
+
...params.min !== void 0 && { min: params.min },
|
|
3639
|
+
...params.max !== void 0 && { max: params.max }
|
|
3640
|
+
}),
|
|
3641
|
+
allowedCharacters: ({ params }) => ({
|
|
3642
|
+
type: "allowedCharacters",
|
|
3643
|
+
classes: [...params.classes],
|
|
3644
|
+
...params.extra !== void 0 && { extra: params.extra }
|
|
3645
|
+
}),
|
|
3646
|
+
charTemplate: ({ params }) => ({
|
|
3647
|
+
type: "charTemplate",
|
|
3648
|
+
templates: [...params.templates],
|
|
3649
|
+
...params.ignoreCase !== void 0 && { ignoreCase: params.ignoreCase }
|
|
3650
|
+
}),
|
|
3651
|
+
numericRange: ({ params }) => ({
|
|
3652
|
+
type: "numericRange",
|
|
3653
|
+
min: params.min,
|
|
3654
|
+
max: params.max
|
|
3655
|
+
}),
|
|
3656
|
+
scriptCharacters: ({ params }) => ({
|
|
3657
|
+
type: "scriptCharacters",
|
|
3658
|
+
scripts: [...params.scripts]
|
|
3659
|
+
}),
|
|
3660
|
+
rut: () => ({ type: "rut" }),
|
|
3661
|
+
esDni: () => ({ type: "esDni" }),
|
|
3662
|
+
fiPersonalIdentityCode: () => ({ type: "fiPersonalIdentityCode" }),
|
|
3663
|
+
inDrivingLicenseNumber: () => ({ type: "inDrivingLicenseNumber" }),
|
|
3664
|
+
curp: () => ({ type: "curp" })
|
|
3665
|
+
};
|
|
3666
|
+
const isCount = (value) => typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
3667
|
+
const isInteger = (value) => typeof value === "number" && Number.isInteger(value);
|
|
3668
|
+
const isNonEmptyArrayOf = (value, item) => Array.isArray(value) && value.length > 0 && value.every(item);
|
|
3669
|
+
const isString = (value) => typeof value === "string";
|
|
3670
|
+
const isCharacterClass = (value) => CHARACTER_CLASSES.includes(value);
|
|
3671
|
+
const isUnicodeScript = (value) => UNICODE_SCRIPTS.includes(value);
|
|
3672
|
+
/**
|
|
3673
|
+
* Params a projected rule reads. The compiler checks params against the
|
|
3674
|
+
* vocabulary too; this keeps a definition that skipped it, such as a served
|
|
3675
|
+
* one later, from projecting a broken rule.
|
|
3676
|
+
*/
|
|
3677
|
+
const RULE_PARAMS = {
|
|
3678
|
+
exactLength: ({ length }) => isCount(length),
|
|
3679
|
+
phoneDigits: ({ min, max }) => isCount(min) && isCount(max) && min <= max,
|
|
3680
|
+
digitCount: ({ lengths, min, max }) => lengths !== void 0 ? isNonEmptyArrayOf(lengths, isCount) && min === void 0 && max === void 0 : isCount(min) && isCount(max) && min <= max,
|
|
3681
|
+
allowedCharacters: ({ classes, extra }) => isNonEmptyArrayOf(classes, isCharacterClass) && (extra === void 0 || isString(extra)),
|
|
3682
|
+
charTemplate: ({ templates, ignoreCase }) => isNonEmptyArrayOf(templates, (t) => isString(t) && t !== "") && (ignoreCase === void 0 || typeof ignoreCase === "boolean"),
|
|
3683
|
+
numericRange: ({ min, max }) => isInteger(min) && isInteger(max) && min <= max,
|
|
3684
|
+
scriptCharacters: ({ scripts }) => isNonEmptyArrayOf(scripts, isUnicodeScript),
|
|
3685
|
+
maxAge: ({ years }) => isCount(years)
|
|
3686
|
+
};
|
|
3687
|
+
/**
|
|
3688
|
+
* Whether a field rule maps onto a validator: a known id, valid params, and
|
|
3689
|
+
* a message without params. eKYC's adapter checks its definitions with it.
|
|
3690
|
+
*/
|
|
3691
|
+
function isProjectableRule(rule) {
|
|
3692
|
+
return Object.prototype.hasOwnProperty.call(RULES, rule.id) && !rule.message?.params && (RULE_PARAMS[rule.id]?.(rule.params ?? {}) ?? true);
|
|
3693
|
+
}
|
|
3694
|
+
/**
|
|
3695
|
+
* A field's vocabulary rules as today's `EkycValidationRule`s, which
|
|
3696
|
+
* `validateEkycField` runs.
|
|
3697
|
+
*/
|
|
3698
|
+
function projectRules(rules, country, required) {
|
|
3699
|
+
return rules.flatMap((rule) => {
|
|
3700
|
+
const project = RULES[rule.id];
|
|
3701
|
+
if (!project) return [];
|
|
3702
|
+
const projected = project({
|
|
3703
|
+
country,
|
|
3704
|
+
required,
|
|
3705
|
+
params: rule.params ?? {}
|
|
3706
|
+
});
|
|
3707
|
+
return [rule.message ? {
|
|
3708
|
+
...projected,
|
|
3709
|
+
message: rule.message.key
|
|
3710
|
+
} : projected];
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
//#endregion
|
|
3714
|
+
//#region src/modules/ekyc/ekycForm.ts
|
|
3715
|
+
/**
|
|
3716
|
+
* eKYC adapter for form definitions.
|
|
3717
|
+
*
|
|
3718
|
+
* Selects the bundled definition for a source and country, resolves it against
|
|
3719
|
+
* the verification fields from module configuration, and projects the result
|
|
3720
|
+
* to today's public `EkycFieldDef[]` shape, including the `validation` arrays
|
|
3721
|
+
* today's validators run. The request body comes from the definition itself
|
|
3722
|
+
* (`buildEkycSubmitBody`), so any kernel request transform, `payload.omit`,
|
|
3723
|
+
* key renames and `submit.copies` are fine. A pair without a definition this
|
|
3724
|
+
* projection can express keeps the current builder, and so does a source
|
|
3725
|
+
* today's builder knows while the form definitions rollout is off.
|
|
3726
|
+
*/
|
|
3727
|
+
/**
|
|
3728
|
+
* The option lists definitions reference by `optionsRef`. Their values must
|
|
3729
|
+
* match the `values` vocabulary.json declares, which the compiler checks
|
|
3730
|
+
* `rulesByOption` cases against.
|
|
3731
|
+
*/
|
|
3732
|
+
const OPTION_LISTS = {
|
|
3733
|
+
US_STATES: usStateOptions,
|
|
3734
|
+
BR_STATES: brStateOptions,
|
|
3735
|
+
IN_STATES: inStateOptions,
|
|
3736
|
+
CA_PROVINCES: caProvinceOptions,
|
|
3737
|
+
PH_ID_TYPES: [
|
|
3738
|
+
{
|
|
3739
|
+
value: "TIN",
|
|
3740
|
+
label: "verification.labels.phIdTypeTin"
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
value: "SSS",
|
|
3744
|
+
label: "verification.labels.phIdTypeSss"
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
value: "GSIS",
|
|
3748
|
+
label: "verification.labels.phIdTypeGsis"
|
|
3749
|
+
}
|
|
3750
|
+
]
|
|
3751
|
+
};
|
|
3752
|
+
/**
|
|
3753
|
+
* What eKYC can use today. The request body is the kernel's, so every
|
|
3754
|
+
* request transform it implements is listed, and `payload.omitWhenEmpty`
|
|
3755
|
+
* (the kernel leaves every empty value out).
|
|
3756
|
+
*/
|
|
3757
|
+
const EKYC_SUPPORTED_IDS = {
|
|
3758
|
+
schemaVersions: [1],
|
|
3759
|
+
vocabulary: "1.4",
|
|
3760
|
+
kinds: /* @__PURE__ */ new Set([
|
|
3761
|
+
"text",
|
|
3762
|
+
"date",
|
|
3763
|
+
"choice",
|
|
3764
|
+
"phone"
|
|
3765
|
+
]),
|
|
3766
|
+
groups: new Set(Object.keys(EKYC_GROUP_KEYS)),
|
|
3767
|
+
rules: new Set(Object.keys(RULES)),
|
|
3768
|
+
transforms: new Set(PAYLOAD_TRANSFORMS.transforms.keys()),
|
|
3769
|
+
groupRules: /* @__PURE__ */ new Set(["oneOfRequired", "rulesByOption"]),
|
|
3770
|
+
optionLists: new Set(Object.keys(OPTION_LISTS)),
|
|
3771
|
+
conditions: /* @__PURE__ */ new Set(["fieldFilled", "riskAddon"]),
|
|
3772
|
+
prefillSources: new Set(EKYC_PREFILL_SOURCES),
|
|
3773
|
+
flags: /* @__PURE__ */ new Set(["payload.omitWhenEmpty"])
|
|
3774
|
+
};
|
|
3775
|
+
/** Today's field shape only flags `middleName` as optional. */
|
|
3776
|
+
const LEGACY_OPTIONAL_FLAG = /* @__PURE__ */ new Set(["middleName"]);
|
|
3777
|
+
/** The sections the eKYC UI has headers for. */
|
|
3778
|
+
const UI_SECTIONS = /* @__PURE__ */ new Set(["address", "driverLicense"]);
|
|
3779
|
+
/** The fields today's DOB-or-SSN group rule and its message are for. */
|
|
3780
|
+
const ONE_OF_REQUIRED_FIELDS = ["dateOfBirth", "ssn"];
|
|
3781
|
+
/** A Text today's field shape can carry: a key only, or `text` where shown. */
|
|
3782
|
+
const plainKey = (text) => !text?.params;
|
|
3783
|
+
function sameTransforms(declared, expected) {
|
|
3784
|
+
return declared.length === expected.length && declared.every((transform, i) => {
|
|
3785
|
+
const params = transform.params ?? {};
|
|
3786
|
+
const want = expected[i].params ?? {};
|
|
3787
|
+
return transform.id === expected[i].id && Object.keys(params).length === Object.keys(want).length && Object.entries(want).every(([key, value]) => params[key] === value);
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
/**
|
|
3791
|
+
* Whether today's field shape and UI can show a field the way its definition
|
|
3792
|
+
* says. A rule can name its own message key, without params. The field shape
|
|
3793
|
+
* has no hint or suggestions, and only placeholders take params. Input
|
|
3794
|
+
* formatting (`processFieldValue`) stays keyed by field name until P2; a
|
|
3795
|
+
* field can add the `INPUT_FORMATTERS` formats. Its request key, transforms
|
|
3796
|
+
* and `omit` are the kernel's to apply, so any are fine.
|
|
3797
|
+
*/
|
|
3798
|
+
function isProjectableField(field) {
|
|
3799
|
+
return !field.hint && !field.suggestionsRef && plainKey(field.label) && plainKey(field.displayLabel) && (field.options ?? []).every((option) => plainKey(option.label)) && (!field.section || UI_SECTIONS.has(field.section)) && (field.rules ?? []).every(isProjectableRule) && (field.input?.format ?? []).every(isInputFormat);
|
|
3800
|
+
}
|
|
3801
|
+
/** Input formats `processFieldValue` applies as the user types. */
|
|
3802
|
+
const INPUT_FORMATTERS = {
|
|
3803
|
+
uppercase: (value) => value.toUpperCase(),
|
|
3804
|
+
stripSeparators: (value) => value.replace(/[\s./-]/g, "")
|
|
3805
|
+
};
|
|
3806
|
+
function isInputFormat(format) {
|
|
3807
|
+
return Object.prototype.hasOwnProperty.call(INPUT_FORMATTERS, format.id) && !format.params;
|
|
3808
|
+
}
|
|
3809
|
+
/** Applies a field's input formats to a typed value. */
|
|
3810
|
+
function applyInputFormat(value, formats) {
|
|
3811
|
+
return (formats ?? []).reduce((formatted, format) => INPUT_FORMATTERS[format](formatted), value);
|
|
3812
|
+
}
|
|
3813
|
+
/**
|
|
3814
|
+
* Phone transforms other than E.164. A phone that declares one of them alone
|
|
3815
|
+
* gets it as its `phoneFormat`, part of today's field shape (the legacy body
|
|
3816
|
+
* reads it; a catalog form's body applies the transforms themselves).
|
|
3817
|
+
*/
|
|
3818
|
+
const PHONE_FORMATS = ["nationalNumber", "e164NoPlus"];
|
|
3819
|
+
function phoneFormatOf(field) {
|
|
3820
|
+
if (field.name !== "phone") return void 0;
|
|
3821
|
+
const transforms = field.payload?.transforms ?? [];
|
|
3822
|
+
return PHONE_FORMATS.find((id) => sameTransforms(transforms, [{ id }]));
|
|
3823
|
+
}
|
|
3824
|
+
/**
|
|
3825
|
+
* Caches the check per definition object. Bundled definitions are singletons
|
|
3826
|
+
* created once at module load, so each is checked once. A served source (P4)
|
|
3827
|
+
* that builds new objects per call would still be correct, but would miss
|
|
3828
|
+
* this cache; key it by definition id and version then.
|
|
3829
|
+
*/
|
|
3830
|
+
const projectable = /* @__PURE__ */ new WeakMap();
|
|
3831
|
+
/**
|
|
3832
|
+
* `oneOfRequired` shows its own message key, or today's DOB-or-SSN message
|
|
3833
|
+
* when it has none, which only fits date of birth and SSN.
|
|
3834
|
+
* `rulesByOption` needs a selector and a target among its fields, and a list
|
|
3835
|
+
* of projectable rules per option value; its errors are the rules' own.
|
|
3836
|
+
*/
|
|
3837
|
+
function isProjectableGroupRule(rule) {
|
|
3838
|
+
if (rule.id === "oneOfRequired") {
|
|
3839
|
+
if (rule.message) return !rule.message.params;
|
|
3840
|
+
return rule.fields.length === ONE_OF_REQUIRED_FIELDS.length && ONE_OF_REQUIRED_FIELDS.every((name) => rule.fields.includes(name));
|
|
3841
|
+
}
|
|
3842
|
+
if (rule.id === "rulesByOption") {
|
|
3843
|
+
if (!isRulesByOptionParams(rule.params)) return false;
|
|
3844
|
+
const { selector, target, cases } = rule.params;
|
|
3845
|
+
return !rule.message && selector !== target && rule.fields.includes(selector) && rule.fields.includes(target) && Object.values(cases).every((rules) => rules.every(isProjectableRule));
|
|
3846
|
+
}
|
|
3847
|
+
return false;
|
|
3848
|
+
}
|
|
3849
|
+
const isRuleRef = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && "id" in value && typeof value.id === "string";
|
|
3850
|
+
/** Whether a `rulesByOption` rule's params have the shape it needs. */
|
|
3851
|
+
function isRulesByOptionParams(params) {
|
|
3852
|
+
if (!params) return false;
|
|
3853
|
+
const { selector, target, cases } = params;
|
|
3854
|
+
return typeof selector === "string" && typeof target === "string" && typeof cases === "object" && cases !== null && !Array.isArray(cases) && Object.values(cases).every((rules) => Array.isArray(rules) && rules.every(isRuleRef));
|
|
3855
|
+
}
|
|
3856
|
+
/** Whether every part of a definition maps onto today's `EkycFieldDef`. */
|
|
3857
|
+
function isProjectableEkycDefinition(definition) {
|
|
3858
|
+
let result = projectable.get(definition);
|
|
3859
|
+
if (result === void 0) {
|
|
3860
|
+
result = definition.module === "ekyc" && checkSupport(definition, EKYC_SUPPORTED_IDS).supported && definition.fields.every(isProjectableField) && (definition.sections ?? []).every((section) => !section.title && UI_SECTIONS.has(section.id)) && (definition.groupRules ?? []).every(isProjectableGroupRule);
|
|
3861
|
+
projectable.set(definition, result);
|
|
3862
|
+
}
|
|
3863
|
+
return result;
|
|
3864
|
+
}
|
|
3865
|
+
const bundled = createBundledDefinitionSource(EKYC_DEFINITIONS, EKYC_INDEX);
|
|
3866
|
+
/**
|
|
3867
|
+
* Sources today's builder knows that also have a definition. The form
|
|
3868
|
+
* definitions rollout picks between the two for these, including a risk
|
|
3869
|
+
* add-on's own form (RISK_ADDONS_ONLY's phoneProfile form); any other source
|
|
3870
|
+
* with a definition is catalog-only and always uses it. `ekycForm.test.ts`
|
|
3871
|
+
* keeps this list equal to the defined sources with a parity fixture.
|
|
3872
|
+
*/
|
|
3873
|
+
const MIGRATED_EKYC_SOURCES = /* @__PURE__ */ new Set([
|
|
3874
|
+
"BR_GOVT_1",
|
|
3875
|
+
"CA_RES_CREDIT",
|
|
3876
|
+
"GR_1",
|
|
3877
|
+
"GT_1",
|
|
3878
|
+
"RISK_ADDONS_ONLY",
|
|
3879
|
+
"UK_VOTER_REGISTER",
|
|
3880
|
+
"US_CREDIT_BUREAU_1",
|
|
3881
|
+
"US_CREDIT_TELCO",
|
|
3882
|
+
"US_TELCO_1",
|
|
3883
|
+
"US_TELCO_2"
|
|
3884
|
+
]);
|
|
3885
|
+
/**
|
|
3886
|
+
* Where eKYC looks for a configuration's form, in order:
|
|
3887
|
+
*
|
|
3888
|
+
* 1. each configured risk add-on, in configuration order: its form for the
|
|
3889
|
+
* source and country, then its form for the source with no country;
|
|
3890
|
+
* 2. the source's form for the country;
|
|
3891
|
+
* 3. the source's form with no country.
|
|
3892
|
+
*/
|
|
3893
|
+
function ekycDefinitionQueries(source, country, riskAddons) {
|
|
3894
|
+
return [
|
|
3895
|
+
...riskAddons.flatMap((riskAddon) => [{
|
|
3896
|
+
source,
|
|
3897
|
+
country,
|
|
3898
|
+
riskAddon
|
|
3899
|
+
}, {
|
|
3900
|
+
source,
|
|
3901
|
+
riskAddon
|
|
3902
|
+
}]),
|
|
3903
|
+
{
|
|
3904
|
+
source,
|
|
3905
|
+
country
|
|
3906
|
+
},
|
|
3907
|
+
{ source }
|
|
3908
|
+
];
|
|
3909
|
+
}
|
|
3910
|
+
/**
|
|
3911
|
+
* The bundled definition for this configuration, if it is projectable and
|
|
3912
|
+
* the rollout lets this source use it. `useDefinitions` is the rollout answer
|
|
3913
|
+
* the machine read once, when it was created. An alias is resolved to its
|
|
3914
|
+
* source first, so it reaches that source's risk add-on forms too, and an
|
|
3915
|
+
* alias of a migrated source follows the rollout as its source does; the body
|
|
3916
|
+
* still names the configured id. Then the first form found in
|
|
3917
|
+
* `ekycDefinitionQueries` order wins. Prefill and submit pass the same risk
|
|
3918
|
+
* add-ons, and prefill rebuilds a catalog form's fields with them, so fields,
|
|
3919
|
+
* prefill and submit use one form.
|
|
3920
|
+
*/
|
|
3921
|
+
function selectEkycDefinition(source, country, useDefinitions, riskAddons = []) {
|
|
3922
|
+
const own = bundled.sourceOf("ekyc", source, country);
|
|
3923
|
+
if (!useDefinitions && (MIGRATED_EKYC_SOURCES.has(source) || MIGRATED_EKYC_SOURCES.has(own))) return;
|
|
3924
|
+
for (const query of ekycDefinitionQueries(own, country, riskAddons)) {
|
|
3925
|
+
const definition = bundled.select({
|
|
3926
|
+
module: "ekyc",
|
|
3927
|
+
...query
|
|
3928
|
+
});
|
|
3929
|
+
if (definition) return isProjectableEkycDefinition(definition) ? definition : void 0;
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
const PREFILL_ORIGIN_ENTRIES = VOCABULARY.entries.filter((entry) => entry.type === "prefillOrigin");
|
|
3933
|
+
/**
|
|
3934
|
+
* A verification field's source → the vocabulary's prefill origin, through
|
|
3935
|
+
* the module configuration values each origin lists (`configValues`).
|
|
3936
|
+
*/
|
|
3937
|
+
const PREFILL_ORIGINS = new Map(PREFILL_ORIGIN_ENTRIES.flatMap((origin) => (origin.configValues ?? []).map((value) => [mapToEKYCvalue(value), origin.id])));
|
|
3938
|
+
/**
|
|
3939
|
+
* Risk add-ons whose earlier module already captured a group's value, so the
|
|
3940
|
+
* group fills from that module whatever its source says (as in Web SDK 1):
|
|
3941
|
+
* each origin's `riskAddons` and `groups`.
|
|
3942
|
+
*/
|
|
3943
|
+
const RISK_ADDON_ORIGINS = new Map(PREFILL_ORIGIN_ENTRIES.flatMap((origin) => (origin.riskAddons ?? []).map((addon) => [addon, {
|
|
3944
|
+
groups: origin.groups ?? [],
|
|
3945
|
+
origin: origin.id
|
|
3946
|
+
}])));
|
|
3947
|
+
/** Origins whose values another module verified (`locks`). */
|
|
3948
|
+
const LOCKING_ORIGINS = PREFILL_ORIGIN_ENTRIES.filter((origin) => origin.locks).map((origin) => origin.id);
|
|
3949
|
+
function toEkycResolveContext(verificationFields, enablePhoneRisk, displayModes = {}, riskAddons = []) {
|
|
3950
|
+
const groups = Object.entries(EKYC_GROUP_KEYS);
|
|
3951
|
+
const origins = {};
|
|
3952
|
+
const modes = {};
|
|
3953
|
+
for (const [group, key] of groups) {
|
|
3954
|
+
const source = verificationFields[key];
|
|
3955
|
+
const origin = source ? PREFILL_ORIGINS.get(source) : void 0;
|
|
3956
|
+
if (origin) origins[group] = origin;
|
|
3957
|
+
const mode = displayModes[key];
|
|
3958
|
+
if (mode) modes[group] = mode;
|
|
3959
|
+
}
|
|
3960
|
+
const addons = enablePhoneRisk ? [...riskAddons, "phoneCheck"] : riskAddons;
|
|
3961
|
+
for (const addon of addons) {
|
|
3962
|
+
const entry = RISK_ADDON_ORIGINS.get(addon);
|
|
3963
|
+
if (!entry) continue;
|
|
3964
|
+
for (const group of entry.groups) origins[group] = entry.origin;
|
|
3965
|
+
}
|
|
3966
|
+
return {
|
|
3967
|
+
groups: Object.fromEntries(groups.map(([group, key]) => [group, Boolean(verificationFields[key])])),
|
|
3968
|
+
phoneRisk: enablePhoneRisk,
|
|
3969
|
+
riskAddons: [...riskAddons],
|
|
3970
|
+
origins,
|
|
3971
|
+
displayModes: modes,
|
|
3972
|
+
lockingOrigins: LOCKING_ORIGINS
|
|
3973
|
+
};
|
|
3974
|
+
}
|
|
3975
|
+
function fieldType(field) {
|
|
3976
|
+
if (field.kind === "choice") return field.widget === "radio" ? "radio" : "dropdown";
|
|
3977
|
+
return field.kind === "date" || field.kind === "phone" ? field.kind : "text";
|
|
3978
|
+
}
|
|
3979
|
+
function fieldOptions(field) {
|
|
3980
|
+
if (field.optionsRef) return OPTION_LISTS[field.optionsRef];
|
|
3981
|
+
return field.options?.map((option) => ({
|
|
3982
|
+
value: option.value,
|
|
3983
|
+
label: option.label.key
|
|
3984
|
+
}));
|
|
3985
|
+
}
|
|
3986
|
+
function projectField(resolved, verificationFields, country) {
|
|
3987
|
+
const { field, required } = resolved;
|
|
3988
|
+
const groupKey = EKYC_GROUP_KEYS[field.group];
|
|
3989
|
+
const source = groupKey && verificationFields[groupKey] || "user_input";
|
|
3990
|
+
const def = {
|
|
3991
|
+
name: field.name,
|
|
3992
|
+
type: fieldType(field),
|
|
3993
|
+
label: field.label.key,
|
|
3994
|
+
source,
|
|
3995
|
+
required
|
|
3996
|
+
};
|
|
3997
|
+
if (field.placeholder) {
|
|
3998
|
+
def.placeholder = field.placeholder.key;
|
|
3999
|
+
if (field.placeholder.params) def.placeholderParams = { ...field.placeholder.params };
|
|
4000
|
+
}
|
|
4001
|
+
if (field.displayLabel) def.displayLabel = field.displayLabel.text ?? field.displayLabel.key;
|
|
4002
|
+
if (field.input?.format?.length) def.inputFormat = field.input.format.map((format) => format.id);
|
|
4003
|
+
if (field.input?.maxLength !== void 0) def.maxLength = field.input.maxLength;
|
|
4004
|
+
const options = fieldOptions(field);
|
|
4005
|
+
if (options) def.options = options;
|
|
4006
|
+
if (field.section) def.section = field.section;
|
|
4007
|
+
if (field.kind === "phone") {
|
|
4008
|
+
def.disableCountrySelector = resolved.phoneLocked;
|
|
4009
|
+
const digits = field.rules?.find((rule) => rule.id === "phoneDigits");
|
|
4010
|
+
if (digits && isCount(digits.params?.max)) def.maxLength = digits.params.max;
|
|
4011
|
+
}
|
|
4012
|
+
const phoneFormat = phoneFormatOf(field);
|
|
4013
|
+
if (phoneFormat) def.phoneFormat = phoneFormat;
|
|
4014
|
+
if (field.payload?.key && field.payload.key !== field.name) def.payloadKey = field.payload.key;
|
|
4015
|
+
if (LEGACY_OPTIONAL_FLAG.has(field.name)) def.optional = true;
|
|
4016
|
+
const validation = [];
|
|
4017
|
+
if (required) validation.push({ type: "required" });
|
|
4018
|
+
else if (resolved.requiredIfFilled.length > 0) validation.push({
|
|
4019
|
+
type: "requiredIfFilled",
|
|
4020
|
+
fields: [...resolved.requiredIfFilled]
|
|
4021
|
+
});
|
|
4022
|
+
validation.push(...projectRules(field.rules ?? [], country, required));
|
|
4023
|
+
if (validation.length > 0) def.validation = validation;
|
|
4024
|
+
return def;
|
|
4025
|
+
}
|
|
4026
|
+
/**
|
|
4027
|
+
* Adds a "one of" group rule to a member, first so it answers for a blank
|
|
4028
|
+
* field before any format rule. A member required on its own (a risk add-on's,
|
|
4029
|
+
* B20) answers with its own required error, so the group rule goes last
|
|
4030
|
+
* there. It stays so that filling that member clears its siblings' group error.
|
|
4031
|
+
*/
|
|
4032
|
+
function withOneOfRequired(def, oneOf) {
|
|
4033
|
+
const rules = def.validation ?? [];
|
|
4034
|
+
return def.required ? [...rules, oneOf] : [oneOf, ...rules];
|
|
4035
|
+
}
|
|
4036
|
+
/**
|
|
4037
|
+
* Projects a resolved definition to today's `EkycFieldDef[]`, identical to
|
|
4038
|
+
* what `legacyBuildFieldDefs` returns for the same source and country.
|
|
4039
|
+
*/
|
|
4040
|
+
function projectEkycFields(form, verificationFields, country) {
|
|
4041
|
+
const defs = form.fields.map((resolved) => projectField(resolved, verificationFields, country));
|
|
4042
|
+
for (const { rule, fields } of form.groupRules) {
|
|
4043
|
+
if (rule.id === "rulesByOption") {
|
|
4044
|
+
if (!isRulesByOptionParams(rule.params)) continue;
|
|
4045
|
+
const { selector, target, cases } = rule.params;
|
|
4046
|
+
const def = defs.find((d) => d.name === target);
|
|
4047
|
+
if (!def || !fields.includes(selector)) continue;
|
|
4048
|
+
def.validation = [...def.validation ?? [], {
|
|
4049
|
+
type: "rulesByOption",
|
|
4050
|
+
selector,
|
|
4051
|
+
cases: Object.fromEntries(Object.entries(cases).map(([value, rules]) => [value, projectRules(rules, country, def.required)]))
|
|
4052
|
+
}];
|
|
4053
|
+
continue;
|
|
4054
|
+
}
|
|
4055
|
+
const message = rule.message?.key;
|
|
4056
|
+
const oneOf = {
|
|
4057
|
+
type: "oneOfRequired",
|
|
4058
|
+
fields: [...fields],
|
|
4059
|
+
...message && message !== "verification.errors.dobOrSsnRequired" && { message }
|
|
4060
|
+
};
|
|
4061
|
+
for (const def of defs) if (fields.includes(def.name)) def.validation = withOneOfRequired(def, oneOf);
|
|
4062
|
+
}
|
|
4063
|
+
return defs;
|
|
4064
|
+
}
|
|
4065
|
+
//#endregion
|
|
4066
|
+
//#region src/modules/ekyc/ekycActions.ts
|
|
4067
|
+
const dateFormattingInstance = new DateFormattingProvider();
|
|
4068
|
+
/** Countries whose state is picked from a list, sent as the two-letter code. */
|
|
4069
|
+
const STATE_OPTIONS_BY_COUNTRY = {
|
|
4070
|
+
US: usStateOptions,
|
|
4071
|
+
BR: brStateOptions
|
|
4072
|
+
};
|
|
4073
|
+
function buildValidationRules(field, country) {
|
|
4074
|
+
const rules = [];
|
|
4075
|
+
if (field.required) rules.push({ type: "required" });
|
|
4076
|
+
if (field.name === "taxId" && country === "BR") rules.push({ type: "cpf" });
|
|
4077
|
+
if (field.name === "ssn" && (country === "US" || country === "CA")) rules.push({ type: "ssnFormat" });
|
|
4078
|
+
if (field.name === "street") rules.push({ type: "noPoBox" });
|
|
4079
|
+
if (field.name === "postalCode") rules.push({
|
|
4080
|
+
type: "postalCodeFormat",
|
|
4081
|
+
country
|
|
4082
|
+
});
|
|
4083
|
+
if (field.name === "phone") rules.push({
|
|
4084
|
+
type: "phoneFormat",
|
|
4085
|
+
country,
|
|
4086
|
+
optional: !field.required
|
|
4087
|
+
});
|
|
4088
|
+
if (field.name === "email") rules.push({ type: "emailFormat" });
|
|
4089
|
+
if (field.name === "panNumber") rules.push({
|
|
4090
|
+
type: "exactLength",
|
|
4091
|
+
length: 10
|
|
4092
|
+
});
|
|
4093
|
+
if (field.name === "dateOfBirth") rules.push({
|
|
4094
|
+
type: "maxAge",
|
|
4095
|
+
years: 120
|
|
4096
|
+
});
|
|
4097
|
+
return rules;
|
|
4098
|
+
}
|
|
4099
|
+
function applyOneOfRequiredGroups(defs, configSource) {
|
|
4100
|
+
for (const group of ONE_OF_REQUIRED_GROUPS[configSource] ?? []) {
|
|
4101
|
+
const members = defs.filter((def) => group.includes(def.name));
|
|
4102
|
+
const fields = members.map((def) => def.name);
|
|
4103
|
+
for (const def of members) def.validation = withOneOfRequired(def, {
|
|
4104
|
+
type: "oneOfRequired",
|
|
4105
|
+
fields
|
|
4106
|
+
});
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
/**
|
|
4110
|
+
* Builds the form's field defs. A source with a form definition for exactly
|
|
4111
|
+
* this country reads it (`packages/form-definitions/catalog/ekyc`) when the
|
|
4112
|
+
* rollout allows (`selectEkycDefinition`); any other pair keeps the current
|
|
4113
|
+
* builder. `useDefinitions` is the rollout answer the machine read once, when
|
|
4114
|
+
* it was created, so it can't change mid-session. The options are named so a
|
|
4115
|
+
* caller can't swap the two booleans.
|
|
4116
|
+
*/
|
|
4117
|
+
function buildFieldDefs(fields, configSource, country, { useDefinitions, enablePhoneRisk = false, riskAddons = [] }) {
|
|
4118
|
+
const definition = selectEkycDefinition(configSource, country, useDefinitions, riskAddons);
|
|
4119
|
+
if (definition) return projectEkycFields(resolveForm(definition, toEkycResolveContext(fields, enablePhoneRisk, {}, riskAddons)), fields, country);
|
|
4120
|
+
return legacyBuildFieldDefs(fields, configSource, country, enablePhoneRisk, riskAddons);
|
|
4121
|
+
}
|
|
4122
|
+
/** The per-source builder for sources without a form definition yet. */
|
|
4123
|
+
function legacyBuildFieldDefs(fields, configSource, country, enablePhoneRisk = false, riskAddons = []) {
|
|
4124
|
+
const defs = [];
|
|
4125
|
+
const addonFields = getRiskAddonFields(riskAddons);
|
|
4126
|
+
const add = (name, type, label, source, opts) => {
|
|
4127
|
+
if (source === false) return;
|
|
4128
|
+
const def = {
|
|
4129
|
+
name,
|
|
4130
|
+
type,
|
|
4131
|
+
label,
|
|
4132
|
+
source,
|
|
4133
|
+
required: addonFields.has(name) || !isFieldOptional(name, configSource),
|
|
4134
|
+
...opts
|
|
4135
|
+
};
|
|
4136
|
+
const validation = buildValidationRules(def, country);
|
|
4137
|
+
if (validation.length > 0) def.validation = validation;
|
|
4138
|
+
defs.push(def);
|
|
4139
|
+
};
|
|
4140
|
+
const nameSource = fields.name || (NAME_SOURCES.includes(configSource) ? "user_input" : false);
|
|
4141
|
+
if (nameSource) {
|
|
4142
|
+
add("firstName", "text", "verification.labels.firstName", nameSource, {
|
|
4143
|
+
maxLength: 100,
|
|
4144
|
+
placeholder: "verification.placeholder.firstName"
|
|
4145
|
+
});
|
|
4146
|
+
if (MIDDLE_NAME_SOURCES.includes(configSource)) add("middleName", "text", "verification.labels.middleName", nameSource, {
|
|
4147
|
+
maxLength: 100,
|
|
4148
|
+
placeholder: "verification.placeholder.middleName",
|
|
4149
|
+
optional: true
|
|
4150
|
+
});
|
|
4151
|
+
add("surName", "text", country === "US" ? "verification.labels.lastName" : "verification.labels.surName", nameSource, {
|
|
4152
|
+
maxLength: 100,
|
|
4153
|
+
placeholder: country === "US" ? "verification.placeholder.lastName" : "verification.placeholder.surname"
|
|
4154
|
+
});
|
|
4155
|
+
if (country === "MX") add("maternalSurname", "text", "verification.labels.maternalSurname", nameSource, {
|
|
4156
|
+
maxLength: 100,
|
|
4157
|
+
placeholder: "verification.placeholder.maternalSurname"
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
if (fields["date of birth"]) add("dateOfBirth", "date", "verification.labels.dateOfBirth", fields["date of birth"]);
|
|
4161
|
+
const emailSource = fields.email || (EMAIL_SOURCES.includes(configSource) ? "user_input" : false);
|
|
4162
|
+
if (emailSource) add("email", "text", "verification.labels.email", emailSource, { placeholder: "verification.placeholder.email" });
|
|
4163
|
+
if (fields.phone) {
|
|
4164
|
+
const phoneCountrySelectorDisabled = enablePhoneRisk && configSource !== "PHONE_RISK_1" || COUNTRY_SELECTOR_DISABLED_SOURCES.includes(configSource);
|
|
4165
|
+
add("phone", "phone", "verification.labels.phone", fields.phone, { disableCountrySelector: phoneCountrySelectorDisabled });
|
|
4166
|
+
}
|
|
4167
|
+
if (fields.SSN) if (country === "BR" || TAX_ID_SOURCES.includes(configSource)) add("taxId", "text", "verification.labels.taxId", fields.SSN, { ...country === "BR" && { displayLabel: "CPF" } });
|
|
4168
|
+
else if (country === "CN") add("ssn", "text", "verification.labels.prcId", fields.SSN);
|
|
4169
|
+
else add("ssn", "text", "verification.labels.ssn", fields.SSN, { maxLength: 11 });
|
|
4170
|
+
if (fields.nationality) if (country === "BR") add("nationality", "dropdown", "verification.labels.nationality", fields.nationality, { options: [
|
|
4171
|
+
{
|
|
4172
|
+
value: "brazilian",
|
|
4173
|
+
label: "verification.labels.brazilian"
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
value: "naturalized_brazilian",
|
|
4177
|
+
label: "verification.labels.naturalizedBrazilian"
|
|
4178
|
+
},
|
|
4179
|
+
{
|
|
4180
|
+
value: "foreigner",
|
|
4181
|
+
label: "verification.labels.foreigner"
|
|
4182
|
+
},
|
|
4183
|
+
{
|
|
4184
|
+
value: "brazilian_born_abroad",
|
|
4185
|
+
label: "verification.labels.brazilianBornAbroad"
|
|
4186
|
+
}
|
|
4187
|
+
] });
|
|
4188
|
+
else add("nationality", "text", "verification.labels.nationality", fields.nationality);
|
|
4189
|
+
if (fields.last4SSN) add("last4SSN", "text", "verification.labels.last4SSN", fields.last4SSN, { maxLength: 4 });
|
|
4190
|
+
if (fields.idNum) add("idNum", "text", "verification.labels.idNum", fields.idNum, {
|
|
4191
|
+
maxLength: 13,
|
|
4192
|
+
payloadKey: "idNumber"
|
|
4193
|
+
});
|
|
4194
|
+
if (fields.idNum1) add("idNum1", "text", "verification.labels.idNum1", fields.idNum1, { payloadKey: "idNumber1" });
|
|
4195
|
+
if (fields.gender) add("gender", "radio", "verification.labels.gender", fields.gender, { options: [{
|
|
4196
|
+
value: "F",
|
|
4197
|
+
label: "common.female"
|
|
4198
|
+
}, {
|
|
4199
|
+
value: "M",
|
|
4200
|
+
label: "common.male"
|
|
4201
|
+
}] });
|
|
4202
|
+
if (fields.panNumber) add("panNumber", "text", "verification.labels.panNumber", fields.panNumber, { maxLength: 10 });
|
|
4203
|
+
const addAddressFields = () => {
|
|
4204
|
+
const addrSource = fields.address;
|
|
4205
|
+
if (!addrSource) return;
|
|
4206
|
+
if (STREET_SOURCES.includes(configSource)) add("street", "text", "verification.labels.street", addrSource, { section: "address" });
|
|
4207
|
+
if (HOUSE_NO_SOURCES.includes(configSource)) add("houseNo", "text", "verification.labels.houseNo", addrSource, { section: "address" });
|
|
4208
|
+
if (APARTMENT_SOURCES.includes(configSource)) add("apartment", "text", "verification.labels.apartment", addrSource, {
|
|
4209
|
+
section: "address",
|
|
4210
|
+
placeholder: "verification.placeholder.apartment"
|
|
4211
|
+
});
|
|
4212
|
+
if (CITY_SOURCES.includes(configSource)) add("city", "text", "verification.labels.city", addrSource, { section: "address" });
|
|
4213
|
+
if (ADDRESS_STATE_SOURCES.includes(configSource)) {
|
|
4214
|
+
const stateOptions = STATE_OPTIONS_BY_COUNTRY[country];
|
|
4215
|
+
add("state", stateOptions ? "dropdown" : "text", stateOptions ? "verification.labels.chooseState" : "verification.labels.state", addrSource, {
|
|
4216
|
+
section: "address",
|
|
4217
|
+
...stateOptions ? {
|
|
4218
|
+
options: stateOptions,
|
|
4219
|
+
placeholder: "verification.placeholder.state"
|
|
4220
|
+
} : {
|
|
4221
|
+
placeholder: "verification.placeholder.stateCode",
|
|
4222
|
+
placeholderParams: { states: STATE_CODE_HINTS[country] ?? "" }
|
|
4223
|
+
}
|
|
4224
|
+
});
|
|
4225
|
+
}
|
|
4226
|
+
if (POSTAL_CODE_SOURCES.includes(configSource)) add("postalCode", "text", country === "US" ? "verification.labels.zipCode" : "verification.labels.postalCode", addrSource, {
|
|
4227
|
+
section: "address",
|
|
4228
|
+
maxLength: getPostalCodeMaxLength(country)
|
|
4229
|
+
});
|
|
4230
|
+
};
|
|
4231
|
+
const addDriversLicenseFields = () => {
|
|
4232
|
+
if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
|
|
4233
|
+
if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
|
|
4234
|
+
section: "driverLicense",
|
|
4235
|
+
options: usStateOptions,
|
|
4236
|
+
placeholder: "verification.placeholder.state"
|
|
4237
|
+
});
|
|
4238
|
+
if (fields.dlExpireAt) add("dlExpireAt", "date", "verification.labels.dlExpireAt", fields.dlExpireAt, { section: "driverLicense" });
|
|
4239
|
+
};
|
|
4240
|
+
if (configSource === "US_TELCO_1") {
|
|
4241
|
+
addDriversLicenseFields();
|
|
4242
|
+
addAddressFields();
|
|
4243
|
+
} else {
|
|
4244
|
+
addAddressFields();
|
|
4245
|
+
addDriversLicenseFields();
|
|
4246
|
+
}
|
|
4247
|
+
applyOneOfRequiredGroups(defs, configSource);
|
|
4248
|
+
return defs;
|
|
4249
|
+
}
|
|
4250
|
+
function applyPrefill(fields, ocrData, otpStatus, _country) {
|
|
4251
|
+
const values = {};
|
|
4252
|
+
const prefilled = {};
|
|
4253
|
+
const readonlyFields = [];
|
|
4254
|
+
let hideEmail = false;
|
|
4255
|
+
if (fields.name === "document_scan" && ocrData?.name) {
|
|
4256
|
+
const { firstName, surName } = resolveOcrName(ocrData.name);
|
|
4257
|
+
if (firstName) {
|
|
4258
|
+
values.firstName = firstName;
|
|
4259
|
+
prefilled.firstName = true;
|
|
4260
|
+
}
|
|
4261
|
+
if (surName) {
|
|
4262
|
+
values.surName = surName;
|
|
4263
|
+
prefilled.surName = true;
|
|
4264
|
+
}
|
|
4265
|
+
if (ocrData.name.middleName) {
|
|
4266
|
+
values.middleName = ocrData.name.middleName;
|
|
4267
|
+
prefilled.middleName = true;
|
|
4268
|
+
}
|
|
4269
|
+
if (ocrData.name.maternalLastName) {
|
|
4270
|
+
values.maternalSurname = ocrData.name.maternalLastName;
|
|
4271
|
+
prefilled.maternalSurname = true;
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
const ocrBirthDate = dateFormattingInstance.utcToIsoDateString(ocrData?.birthDate);
|
|
4275
|
+
if (fields["date of birth"] === "document_scan" && ocrBirthDate) {
|
|
4276
|
+
values.dateOfBirth = ocrBirthDate;
|
|
4277
|
+
prefilled.dateOfBirth = true;
|
|
4278
|
+
}
|
|
4279
|
+
const addressSource = fields.address;
|
|
4280
|
+
if (addressSource === "document_scan" || addressSource === "poa_document") {
|
|
4281
|
+
const addrData = addressSource === "poa_document" ? ocrData?.addressFieldsFromStatement ?? void 0 : ocrData?.addressFields ?? ocrData?.checkedAddressBean ?? void 0;
|
|
4282
|
+
if (addrData) {
|
|
4283
|
+
if (addrData.street) {
|
|
4284
|
+
values.street = addrData.street;
|
|
4285
|
+
prefilled.street = true;
|
|
4286
|
+
}
|
|
4287
|
+
if (addrData.city) {
|
|
4288
|
+
values.city = addrData.city;
|
|
4289
|
+
prefilled.city = true;
|
|
4290
|
+
}
|
|
4291
|
+
if (addrData.state) {
|
|
4292
|
+
values.state = addrData.state;
|
|
4293
|
+
prefilled.state = true;
|
|
4294
|
+
}
|
|
4295
|
+
if (addrData.postalCode) {
|
|
4296
|
+
values.postalCode = addrData.postalCode;
|
|
4297
|
+
prefilled.postalCode = true;
|
|
4298
|
+
}
|
|
4299
|
+
if (addrData.houseNumber) {
|
|
4300
|
+
values.houseNo = addrData.houseNumber;
|
|
4301
|
+
prefilled.houseNo = true;
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
if (fields.phone === "phone_module_input" && otpStatus?.phone) {
|
|
4306
|
+
values.phone = otpStatus.phone;
|
|
4307
|
+
prefilled.phone = true;
|
|
4308
|
+
readonlyFields.push("phone");
|
|
4309
|
+
}
|
|
4310
|
+
if (fields.email === "email_module_input" && otpStatus?.email) {
|
|
4311
|
+
values.email = otpStatus.email;
|
|
4312
|
+
prefilled.email = true;
|
|
4313
|
+
hideEmail = true;
|
|
4314
|
+
}
|
|
4315
|
+
return {
|
|
4316
|
+
values,
|
|
4317
|
+
prefilled,
|
|
4318
|
+
hideEmail,
|
|
4319
|
+
readonlyFields
|
|
4320
|
+
};
|
|
4321
|
+
}
|
|
4322
|
+
/**
|
|
4323
|
+
* The address origin to look up an address suggestion for, when the source
|
|
4324
|
+
* has a form definition and its address comes from a document. Sources on
|
|
4325
|
+
* the current builder never look one up.
|
|
4326
|
+
*/
|
|
4327
|
+
function prefillAddressOrigin(config) {
|
|
4328
|
+
if (!selectEkycDefinition(config.configSource, config.country, config.useDefinitions, config.riskAddons)) return;
|
|
4329
|
+
const source = config.verificationFields.address;
|
|
4330
|
+
if (source === "document_scan") return "document";
|
|
4331
|
+
if (source === "poa_document") return "poa";
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* Checks a prefilled value the way eKYC checks a typed one: the same input
|
|
4335
|
+
* formatting, then the projected field's validation.
|
|
4336
|
+
*/
|
|
4337
|
+
function ekycPrefillChecks(defs, country) {
|
|
4338
|
+
const list = [...defs];
|
|
4339
|
+
const byName = new Map(list.map((def) => [def.name, def]));
|
|
4340
|
+
return {
|
|
4341
|
+
format: (field, value) => processFieldValue(field.name, value, country, byName.get(field.name)?.inputFormat),
|
|
4342
|
+
isValid: (field, value, values) => validateEkycField({
|
|
4343
|
+
...values,
|
|
4344
|
+
[field.name]: value
|
|
4345
|
+
}, field.name, list) === void 0
|
|
4346
|
+
};
|
|
4347
|
+
}
|
|
4348
|
+
/**
|
|
4349
|
+
* Prefills a source that has a form definition: the forms kernel picks each
|
|
4350
|
+
* field's value and display mode, checking each value with the same input
|
|
4351
|
+
* formatting and validation as typed input. Undefined for a source on the
|
|
4352
|
+
* current builder, which keeps `applyPrefill`.
|
|
4353
|
+
*/
|
|
4354
|
+
function prefillFromDefinition(config, data) {
|
|
4355
|
+
const { verificationFields, configSource, country } = config;
|
|
4356
|
+
const definition = selectEkycDefinition(configSource, country, config.useDefinitions, config.riskAddons);
|
|
4357
|
+
if (!definition) return void 0;
|
|
4358
|
+
const context = toEkycResolveContext(verificationFields, config.enablePhoneRisk ?? false, config.displayModes, config.riskAddons);
|
|
4359
|
+
const form = resolveForm(definition, context);
|
|
4360
|
+
const defs = projectEkycFields(form, verificationFields, country);
|
|
4361
|
+
const result = resolvePrefill(form, context, data, ekycPrefillChecks(defs, country));
|
|
4362
|
+
const modes = new Map(result.fields.map((prefilled) => [prefilled.field.name, prefilled.displayMode]));
|
|
4363
|
+
return {
|
|
4364
|
+
fields: defs.map((def) => {
|
|
4365
|
+
const displayMode = modes.get(def.name) ?? "editable";
|
|
4366
|
+
return displayMode === "readOnly" ? {
|
|
4367
|
+
...def,
|
|
4368
|
+
displayMode,
|
|
4369
|
+
readonly: true
|
|
4370
|
+
} : {
|
|
4371
|
+
...def,
|
|
4372
|
+
displayMode
|
|
4373
|
+
};
|
|
4374
|
+
}),
|
|
4375
|
+
values: { ...result.values },
|
|
4376
|
+
prefilled: Object.fromEntries(Object.keys(result.values).map((name) => [name, true]))
|
|
4377
|
+
};
|
|
4378
|
+
}
|
|
4379
|
+
/** How a phone with a `phoneFormat` is sent. Phones without one go as E.164. */
|
|
4380
|
+
const PHONE_FORMATTERS = {
|
|
4381
|
+
nationalNumber: formatPhoneNational,
|
|
4382
|
+
e164NoPlus: (phone, country) => formatPhoneE164(phone, country).replace(/^\+/, "")
|
|
4383
|
+
};
|
|
4384
|
+
/**
|
|
4385
|
+
* Whether a field's value is left out of the request body: absent, `null`, or
|
|
4386
|
+
* text that is blank once trimmed (CK1 decision K1, as the kernel's
|
|
4387
|
+
* `buildPayload` does). A host can pass anything to `setField`, so any other
|
|
4388
|
+
* value is sent as it is.
|
|
4389
|
+
*/
|
|
4390
|
+
const isLeftOut = (value) => value === void 0 || value === null || typeof value === "string" && value.trim() === "";
|
|
4391
|
+
/**
|
|
4392
|
+
* The request body for a source with no form definition (the retired ids,
|
|
4393
|
+
* until ENG-63328 deletes them), and the body the side-by-side runner checks
|
|
4394
|
+
* the kernel against. A catalog form's body comes from the kernel
|
|
4395
|
+
* (`buildEkycSubmitBody` in `ekycSubmit.ts`). Keep the per-field transforms
|
|
4396
|
+
* below in sync with `legacyTransforms` in `ekycKernelConformance.test.ts`.
|
|
4397
|
+
*/
|
|
4398
|
+
function legacyBuildSubmitPayload(ctx) {
|
|
4399
|
+
const payload = {};
|
|
4400
|
+
for (const field of ctx.fields) {
|
|
4401
|
+
const val = ctx.values[field.name];
|
|
4402
|
+
if (!isLeftOut(val)) payload[field.name] = val;
|
|
4403
|
+
}
|
|
4404
|
+
if (payload.nationality) payload.nationality = payload.nationality.toUpperCase();
|
|
4405
|
+
if (ctx.fieldsCountry && !COUNTRY_CODE_OMITTED_SOURCES.includes(ctx.configSource)) payload.countryCode = ctx.fieldsCountry;
|
|
4406
|
+
if (ctx.hideEmail && ctx.values.email) payload.email = ctx.values.email;
|
|
4407
|
+
if (payload.ssn && (ctx.fieldsCountry === "US" || ctx.fieldsCountry === "CA")) payload.ssn = payload.ssn.replace(/-/g, "");
|
|
4408
|
+
if (payload.postalCode) payload.postalCode = payload.postalCode.replace(/[-\s]/g, "");
|
|
4409
|
+
if (payload.phone) {
|
|
4410
|
+
const phoneField = ctx.fields.find((field) => field.name === "phone");
|
|
4411
|
+
payload.phone = (phoneField?.phoneFormat ? PHONE_FORMATTERS[phoneField.phoneFormat] : formatPhoneE164)(payload.phone, ctx.fieldsCountry);
|
|
4412
|
+
}
|
|
4413
|
+
if (payload.state) payload.state = payload.state.toUpperCase();
|
|
4414
|
+
if (ctx.configSource === "UK_CREDIT_BUREAU_1" && payload.countryCode) payload.country = payload.countryCode;
|
|
4415
|
+
if (ctx.configSource === "US_DRIVERS_LICENSE_1" && payload.dlState) payload.state = payload.dlState;
|
|
4416
|
+
const body = payload;
|
|
4417
|
+
for (const field of ctx.fields) {
|
|
4418
|
+
if (!field.payloadKey || body[field.name] === void 0) continue;
|
|
4419
|
+
body[field.payloadKey] = body[field.name];
|
|
4420
|
+
delete body[field.name];
|
|
4421
|
+
}
|
|
4422
|
+
return {
|
|
4423
|
+
...payload,
|
|
4424
|
+
plugins: ["kyc"],
|
|
4425
|
+
source: ctx.configSource
|
|
4426
|
+
};
|
|
4427
|
+
}
|
|
4428
|
+
function processFieldValue(name, value, fieldsCountry, inputFormat) {
|
|
4429
|
+
return applyInputFormat(processFieldValueByName(name, value, fieldsCountry), inputFormat);
|
|
4430
|
+
}
|
|
4431
|
+
function processFieldValueByName(name, value, fieldsCountry) {
|
|
4432
|
+
if ((name === "firstName" || name === "surName" || name === "middleName" || name === "maternalSurname") && value) return cleanName(value);
|
|
4433
|
+
if (name === "ssn" && (fieldsCountry === "US" || fieldsCountry === "CA")) return formatSSN(value);
|
|
4434
|
+
if (name === "postalCode") return formatPostalCode(value, fieldsCountry);
|
|
4435
|
+
if (name === "panNumber") return value.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
|
|
4436
|
+
return value;
|
|
4437
|
+
}
|
|
4438
|
+
//#endregion
|
|
4439
|
+
//#region src/modules/ekyc/ekycSubmit.ts
|
|
4440
|
+
/**
|
|
4441
|
+
* eKYC's submit step, shaped like KYB Checks' and Pre-fill's: the
|
|
4442
|
+
* `submitting` state invokes the `submitEkyc` actor with the form and its
|
|
4443
|
+
* values (`toEkycSubmitInput`), and the actor builds the request body
|
|
4444
|
+
* (`buildEkycSubmitBody`) and sends it. Another destination later is another
|
|
4445
|
+
* actor through `ekycMachine.provide()`, with no machine change.
|
|
4446
|
+
*
|
|
4447
|
+
* Nothing new is kept in machine context: the form is selected and resolved
|
|
4448
|
+
* again at submit, from the same context inputs that built `context.fields`.
|
|
4449
|
+
* Internal: not exported from `ekyc/index.ts`.
|
|
4450
|
+
*/
|
|
4451
|
+
/**
|
|
4452
|
+
* The inputs eKYC selects and resolves its form from, for prefill and for
|
|
4453
|
+
* submit, so both see the form the fields were built from.
|
|
4454
|
+
*/
|
|
4455
|
+
const ekycFormConfig = (context) => ({
|
|
4456
|
+
verificationFields: context.verificationFields,
|
|
4457
|
+
displayModes: context.displayModes,
|
|
4458
|
+
configSource: context.configSource,
|
|
4459
|
+
country: context.fieldsCountry,
|
|
4460
|
+
enablePhoneRisk: context.moduleConfig?.enablePhoneRisk ?? context.config.enablePhoneRisk,
|
|
4461
|
+
riskAddons: getEkycRiskAddons(context),
|
|
4462
|
+
useDefinitions: context._formDefinitions
|
|
4463
|
+
});
|
|
4464
|
+
/**
|
|
4465
|
+
* The form `context.fields` was built from, selected and resolved again as
|
|
4466
|
+
* `buildFieldDefs` and `prefillFromDefinition` do. `undefined` for a source
|
|
4467
|
+
* with no form, which keeps the legacy body.
|
|
4468
|
+
*/
|
|
4469
|
+
function resolveEkycSubmitForm(context) {
|
|
4470
|
+
const config = ekycFormConfig(context);
|
|
4471
|
+
const definition = selectEkycDefinition(config.configSource, config.country, config.useDefinitions, config.riskAddons);
|
|
4472
|
+
if (!definition) return void 0;
|
|
4473
|
+
return resolveForm(definition, toEkycResolveContext(config.verificationFields, config.enablePhoneRisk ?? false, config.displayModes, config.riskAddons));
|
|
4474
|
+
}
|
|
4475
|
+
/** The `submitEkyc` actor's input, from the machine context at submit. */
|
|
4476
|
+
function toEkycSubmitInput(context) {
|
|
4477
|
+
const form = resolveEkycSubmitForm(context);
|
|
4478
|
+
const riskAddons = getEkycRiskAddons(context);
|
|
4479
|
+
return {
|
|
4480
|
+
form,
|
|
4481
|
+
values: context.values,
|
|
4482
|
+
env: {
|
|
4483
|
+
source: context.configSource,
|
|
4484
|
+
country: form?.definition.country ?? context.fieldsCountry,
|
|
4485
|
+
...riskAddons && { riskAddons }
|
|
4486
|
+
},
|
|
4487
|
+
legacy: {
|
|
4488
|
+
configSource: context.configSource,
|
|
4489
|
+
fieldsCountry: context.fieldsCountry,
|
|
4490
|
+
fields: context.fields,
|
|
4491
|
+
values: context.values,
|
|
4492
|
+
hideEmail: context.hideEmail
|
|
4493
|
+
}
|
|
4494
|
+
};
|
|
4495
|
+
}
|
|
4496
|
+
/**
|
|
4497
|
+
* The `POST /omni/externalVerification/ekyc` body. A catalog form's is the kernel's
|
|
4498
|
+
* `buildPayload`: every shown field with a value, after its request
|
|
4499
|
+
* transforms, then the definition's `submit` keys. A source with no form
|
|
4500
|
+
* keeps the legacy body. A served form the compiler never saw can still
|
|
4501
|
+
* repeat a request key; the first writer wins, with a warning.
|
|
4502
|
+
*/
|
|
4503
|
+
function buildEkycSubmitBody(input) {
|
|
4504
|
+
if (!input.form) return legacyBuildSubmitPayload(input.legacy);
|
|
4505
|
+
const { body, problems } = buildPayload(input.form, input.values, PAYLOAD_TRANSFORMS, {
|
|
4506
|
+
...input.env,
|
|
4507
|
+
today: getLocalIsoDate(),
|
|
4508
|
+
deps: standardDeps()
|
|
4509
|
+
});
|
|
4510
|
+
if (problems.length > 0) console.warn("[ekyc] Request body problems", problems);
|
|
4511
|
+
return { ...body };
|
|
4512
|
+
}
|
|
4513
|
+
/** Whether the form shows a field: not hidden, and not an email shown elsewhere. */
|
|
4514
|
+
const isVisibleEkycField = (field, hideEmail) => field.displayMode !== "hidden" && !(hideEmail && field.name === "email");
|
|
4515
|
+
/**
|
|
4516
|
+
* Splits the form into steps, one per run of visible fields with the same
|
|
4517
|
+
* section, in field order. A section with no visible field has no step.
|
|
4518
|
+
*/
|
|
4519
|
+
function buildEkycSteps(fields, hideEmail) {
|
|
4520
|
+
const steps = [];
|
|
4521
|
+
for (const field of fields) {
|
|
4522
|
+
if (!isVisibleEkycField(field, hideEmail)) continue;
|
|
4523
|
+
const id = field.section ?? "personal";
|
|
4524
|
+
const last = steps[steps.length - 1];
|
|
4525
|
+
if (last?.id === id) last.fieldNames.push(field.name);
|
|
4526
|
+
else steps.push({
|
|
4527
|
+
id,
|
|
4528
|
+
fieldNames: [field.name]
|
|
4529
|
+
});
|
|
4530
|
+
}
|
|
4531
|
+
return steps;
|
|
4532
|
+
}
|
|
4533
|
+
/**
|
|
4534
|
+
* The step index kept within the steps the form has now. A missing index, as
|
|
4535
|
+
* in a snapshot taken before steps existed, is the first step.
|
|
4536
|
+
*/
|
|
4537
|
+
const clampStepIndex = (index, steps) => Number.isFinite(index) ? Math.max(0, Math.min(index, steps.length - 1)) : 0;
|
|
4538
|
+
/** Whether a step's fields have no validation errors. */
|
|
4539
|
+
const isStepValid = (step, errors) => !step || step.fieldNames.every((name) => !errors?.[name]);
|
|
4540
|
+
/** The first step with a validation error, or `undefined` when none has one. */
|
|
4541
|
+
function firstStepWithError(steps, errors) {
|
|
4542
|
+
const index = steps.findIndex((step) => !isStepValid(step, errors));
|
|
4543
|
+
return index === -1 ? void 0 : index;
|
|
4544
|
+
}
|
|
4545
|
+
//#endregion
|
|
4546
|
+
//#region src/modules/ekyc/ekycServices.ts
|
|
4547
|
+
/** Fetches module configuration for EXTERNAL_VERIFICATION */
|
|
4548
|
+
async function fetchModuleConfig(flowId, signal) {
|
|
4549
|
+
const url = `${endpoints.moduleConfig}?id=${encodeURIComponent(flowId)}&moduleKey=EXTERNAL_VERIFICATION`;
|
|
4550
|
+
return (await api.get(url, { signal })).data;
|
|
4551
|
+
}
|
|
4552
|
+
/** Fetches OCR data for pre-fill */
|
|
4553
|
+
async function fetchOcrData(signal) {
|
|
4554
|
+
return (await api.get(endpoints.ocrData, { signal })).data;
|
|
4555
|
+
}
|
|
4556
|
+
/** Fetches phone/email from prior OTP modules */
|
|
4557
|
+
async function fetchOtpStatus(signal) {
|
|
4558
|
+
return (await api.get(endpoints.otpStatus, { signal })).data;
|
|
4559
|
+
}
|
|
4560
|
+
var EkycSubmitError = class extends Error {
|
|
4561
|
+
constructor(status, apiError) {
|
|
4562
|
+
super(`POST ${endpoints.ekycSubmit} failed: ${status} – ${apiError}`);
|
|
4563
|
+
this.name = "EkycSubmitError";
|
|
4564
|
+
this.status = status;
|
|
4565
|
+
this.apiError = apiError;
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
/** Submits eKYC verification */
|
|
4569
|
+
async function submitEkyc(data, signal) {
|
|
4570
|
+
try {
|
|
4571
|
+
return (await api.post(endpoints.ekycSubmit, data, { signal })).data;
|
|
4572
|
+
} catch (err) {
|
|
4573
|
+
const httpErr = err;
|
|
4574
|
+
if (typeof httpErr.status === "number") {
|
|
4575
|
+
const body = httpErr.data;
|
|
4576
|
+
const apiError = body?.error ?? body?.message ?? String(err);
|
|
4577
|
+
throw new EkycSubmitError(httpErr.status, apiError);
|
|
4578
|
+
}
|
|
4579
|
+
throw err;
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
//#endregion
|
|
4583
|
+
//#region src/modules/ekyc/ekycGuards.ts
|
|
4584
|
+
const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
|
|
4585
|
+
const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
|
|
4586
|
+
/** The backend runs the checks itself, so the step finishes without a form. */
|
|
4587
|
+
const isAutoExecutionGuard = ({ context }) => context.config.autoExecution === true;
|
|
4588
|
+
/** The fetched module config turns on auto execution. */
|
|
4589
|
+
const isModuleConfigAutoExecutionGuard = ({ event }) => event.output?.autoExecution === true;
|
|
4590
|
+
/** A `flowId` config whose module config never arrived (its load failed). */
|
|
4591
|
+
const needsModuleConfigGuard = ({ context }) => !!context.config.flowId && context.moduleConfig === void 0;
|
|
4592
|
+
/** A form with a phone field whose phone rules haven't loaded. */
|
|
4593
|
+
const needsPhoneRulesGuard = ({ context }) => context.fields.some((field) => field.type === "phone") && getPhoneValidation() === void 0;
|
|
4594
|
+
const hasVerificationFieldsGuard = ({ context }) => !!context.config.verificationFields;
|
|
4595
|
+
const COUNTRY_NOT_SUPPORTED_MSG = "Request unsuccessful. Country not supported for EKYC.";
|
|
4596
|
+
const isCountryNotSupportedGuard = ({ event }) => {
|
|
4597
|
+
const err = event.error;
|
|
4598
|
+
return err instanceof EkycSubmitError && err.status === 400 && err.apiError === COUNTRY_NOT_SUPPORTED_MSG;
|
|
4599
|
+
};
|
|
4600
|
+
//#endregion
|
|
4601
|
+
//#region src/modules/ekyc/ekycActors.ts
|
|
4602
|
+
const fetchModuleConfigActor = fromPromise(async ({ input, signal }) => {
|
|
4603
|
+
const phoneRules = loadPhoneValidator();
|
|
4604
|
+
phoneRules.catch(() => void 0);
|
|
4605
|
+
const config = await fetchModuleConfig(input.flowId, signal);
|
|
4606
|
+
if (config.autoExecution !== true && getEKYCFields(config).phone !== false) await phoneRules;
|
|
4607
|
+
return config;
|
|
4608
|
+
});
|
|
4609
|
+
/**
|
|
4610
|
+
* Loads the phone validation rules for a config that arrived already resolved
|
|
4611
|
+
* (a workflow node, or `verificationFields`), which skips
|
|
4612
|
+
* `fetchModuleConfigActor`. Only a form with a phone field waits for them.
|
|
4613
|
+
*/
|
|
4614
|
+
const loadPhoneRulesActor = fromPromise(async ({ input }) => {
|
|
4615
|
+
if (input.hasPhone) await loadPhoneValidator();
|
|
4616
|
+
});
|
|
4617
|
+
/** The first address suggestion for the first query that has one. */
|
|
4618
|
+
async function firstSuggestion(queries, signal) {
|
|
4619
|
+
for (const query of queries) try {
|
|
4620
|
+
const suggestion = (await searchAddress(query, signal))?.apiResponse?.items[0];
|
|
4621
|
+
if (suggestion) return suggestion;
|
|
4622
|
+
} catch {}
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4625
|
+
* Fetches OCR and OTP data. With `addressOrigin`, it also looks up an address
|
|
4626
|
+
* suggestion for that address, which prefills it in a normalized form.
|
|
4627
|
+
*/
|
|
4628
|
+
const fetchPrefillDataActor = fromPromise(async ({ input, signal }) => {
|
|
4629
|
+
const [ocrData, otpStatus] = await Promise.all([fetchOcrData(signal).catch(() => void 0), fetchOtpStatus(signal).catch(() => void 0)]);
|
|
4630
|
+
const origin = input?.addressOrigin;
|
|
4631
|
+
if (!origin) return {
|
|
4632
|
+
ocrData,
|
|
4633
|
+
otpStatus
|
|
4634
|
+
};
|
|
4635
|
+
const suggestion = await firstSuggestion(prefillAddressQueries(ocrData)[origin], signal);
|
|
4636
|
+
return {
|
|
4637
|
+
ocrData,
|
|
4638
|
+
otpStatus,
|
|
4639
|
+
addressMatches: suggestion ? { [origin]: suggestion } : {}
|
|
4640
|
+
};
|
|
4641
|
+
});
|
|
4642
|
+
/**
|
|
4643
|
+
* Builds the request body from the form and its values, then sends it. It
|
|
4644
|
+
* doesn't load the phone rules: the fields that need them already waited for
|
|
4645
|
+
* them on load.
|
|
4646
|
+
*/
|
|
4647
|
+
const submitEkycActor = fromPromise(async ({ input, signal }) => submitEkyc(buildEkycSubmitBody(input), signal));
|
|
4648
|
+
//#endregion
|
|
4649
|
+
//#region src/modules/ekyc/ekycStateMachine.ts
|
|
4650
|
+
const ADDRESS_AUTOCOMPLETE_KEYS = [
|
|
4651
|
+
"street",
|
|
4652
|
+
"city",
|
|
4653
|
+
"state",
|
|
4654
|
+
"postalCode",
|
|
4655
|
+
"houseNo"
|
|
4656
|
+
];
|
|
4657
|
+
/** A field the user can't change: read-only, or hidden from the form. */
|
|
4658
|
+
const isLocked = (field) => field?.readonly === true || field?.displayMode === "hidden";
|
|
4659
|
+
/** Every field is hidden, so the form has nothing to show. */
|
|
4660
|
+
const showsNoFields = (context) => context.fields.length > 0 && context.fields.every((field) => field.displayMode === "hidden");
|
|
4661
|
+
const stepsOf = (context) => buildEkycSteps(context.fields, context.hideEmail);
|
|
4662
|
+
/** The step the user is on, kept within the steps the form has now. */
|
|
4663
|
+
const currentStep = (context) => {
|
|
4664
|
+
const steps = stepsOf(context);
|
|
4665
|
+
return steps[clampStepIndex(context.currentStepIndex, steps)];
|
|
4666
|
+
};
|
|
4667
|
+
const omitKeys = (errors, keys) => {
|
|
4668
|
+
if (!errors) return void 0;
|
|
4669
|
+
const next = { ...errors };
|
|
4670
|
+
for (const key of keys) delete next[key];
|
|
4671
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
4672
|
+
};
|
|
4673
|
+
const ekycMachine = setup({
|
|
4674
|
+
types: {
|
|
4675
|
+
context: {},
|
|
4676
|
+
events: {},
|
|
4677
|
+
input: {}
|
|
4678
|
+
},
|
|
4679
|
+
actors: {
|
|
4680
|
+
fetchModuleConfig: fetchModuleConfigActor,
|
|
4681
|
+
loadPhoneRules: loadPhoneRulesActor,
|
|
4682
|
+
fetchPrefillData: fetchPrefillDataActor,
|
|
4683
|
+
submitEkyc: submitEkycActor,
|
|
4684
|
+
debounceSearch: debounceSearchActor
|
|
4685
|
+
},
|
|
4686
|
+
actions: {
|
|
4687
|
+
setModuleConfig: assign(({ context, event }) => {
|
|
4688
|
+
const config = event.output;
|
|
4689
|
+
const useDefinitions = context._formDefinitions;
|
|
4690
|
+
const configured = config.source ?? context.config.source ?? "";
|
|
4691
|
+
const source = useDefinitions ? configured : resolveEkycSource(configured, config.riskAddons);
|
|
4692
|
+
const country = context.config.fieldsCountry ?? getEKYCCountry(source);
|
|
4693
|
+
const vFields = getEKYCFields(config);
|
|
4694
|
+
const riskAddons = useDefinitions ? getEkycRiskAddons({
|
|
4695
|
+
config: context.config,
|
|
4696
|
+
moduleConfig: config
|
|
4697
|
+
}) : config.riskAddons;
|
|
4698
|
+
return {
|
|
4699
|
+
moduleConfig: config,
|
|
4700
|
+
verificationFields: vFields,
|
|
4701
|
+
configSource: source,
|
|
4702
|
+
fieldsCountry: country,
|
|
4703
|
+
fields: buildFieldDefs(vFields, source, country, {
|
|
4704
|
+
useDefinitions,
|
|
4705
|
+
enablePhoneRisk: config.enablePhoneRisk,
|
|
4706
|
+
riskAddons
|
|
4707
|
+
}),
|
|
4708
|
+
displayModes: getEKYCDisplayModes(config)
|
|
4709
|
+
};
|
|
4710
|
+
}),
|
|
4711
|
+
applyPrefillData: assign(({ context, event }) => {
|
|
4712
|
+
const { ocrData, otpStatus, addressMatches } = event.output;
|
|
4713
|
+
const fromDefinition = prefillFromDefinition(ekycFormConfig(context), buildPrefillData(ocrData, otpStatus, addressMatches));
|
|
4714
|
+
if (fromDefinition) return {
|
|
4715
|
+
values: fromDefinition.values,
|
|
4716
|
+
prefilled: fromDefinition.prefilled,
|
|
4717
|
+
hideEmail: false,
|
|
4718
|
+
fields: fromDefinition.fields
|
|
4719
|
+
};
|
|
4720
|
+
const { values, prefilled, hideEmail, readonlyFields } = applyPrefill(context.verificationFields, ocrData, otpStatus, context.fieldsCountry);
|
|
4721
|
+
return {
|
|
4722
|
+
values,
|
|
4723
|
+
prefilled,
|
|
4724
|
+
hideEmail,
|
|
4725
|
+
fields: context.fields.map((f) => ({
|
|
4726
|
+
...f,
|
|
4727
|
+
readonly: readonlyFields.includes(f.name) ? true : f.readonly
|
|
4728
|
+
}))
|
|
4729
|
+
};
|
|
4730
|
+
}),
|
|
4731
|
+
applyEmptyPrefill: assign(({ context }) => {
|
|
4732
|
+
const fromDefinition = prefillFromDefinition(ekycFormConfig(context), buildPrefillData(void 0, void 0));
|
|
4733
|
+
if (!fromDefinition) return {};
|
|
4734
|
+
return {
|
|
4735
|
+
values: fromDefinition.values,
|
|
4736
|
+
prefilled: fromDefinition.prefilled,
|
|
4737
|
+
fields: fromDefinition.fields
|
|
4738
|
+
};
|
|
4739
|
+
}),
|
|
4740
|
+
updateField: assign(({ context, event }) => {
|
|
4741
|
+
if (event.type !== "DATA_CHANGED") return {};
|
|
4742
|
+
const field = context.fields.find((f) => f.name === event.name);
|
|
4743
|
+
if (isLocked(field)) return {};
|
|
4744
|
+
const processedValue = processFieldValue(event.name, event.value, context.fieldsCountry, context.fields.find((field) => field.name === event.name)?.inputFormat);
|
|
4745
|
+
return {
|
|
4746
|
+
values: {
|
|
4747
|
+
...context.values,
|
|
4748
|
+
[event.name]: processedValue
|
|
4749
|
+
},
|
|
4750
|
+
submitError: ""
|
|
4751
|
+
};
|
|
4752
|
+
}),
|
|
4753
|
+
clearFieldValidationError: assign(({ context, event }) => {
|
|
4754
|
+
if (event.type !== "DATA_CHANGED") return {};
|
|
4755
|
+
const errs = context.validationErrors;
|
|
4756
|
+
if (!errs) return {};
|
|
4757
|
+
const next = { ...errs };
|
|
4758
|
+
delete next[event.name];
|
|
4759
|
+
const oneOfRule = context.fields.find((f) => f.name === event.name)?.validation?.find((rule) => rule.type === "oneOfRequired");
|
|
4760
|
+
if (oneOfRule?.type === "oneOfRequired") {
|
|
4761
|
+
const groupKey = oneOfRequiredErrorKey(oneOfRule);
|
|
4762
|
+
for (const sibling of oneOfRule.fields) if (next[sibling]?.key === groupKey) delete next[sibling];
|
|
4763
|
+
}
|
|
4764
|
+
if (Object.keys(next).length === Object.keys(errs).length) return {};
|
|
4765
|
+
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
4766
|
+
}),
|
|
4767
|
+
validateFormField: assign(({ context, event }) => {
|
|
4768
|
+
if (event.type !== "VALIDATE_FIELD") return {};
|
|
4769
|
+
const message = validateEkycField(context.values, event.name, context.fields);
|
|
4770
|
+
const next = { ...context.validationErrors ?? {} };
|
|
4771
|
+
if (message) next[event.name] = message;
|
|
4772
|
+
else delete next[event.name];
|
|
4773
|
+
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
4774
|
+
}),
|
|
4775
|
+
computeValidationResult: assign(({ context }) => {
|
|
4776
|
+
const errors = validateEkycForm(context.values, context.fields);
|
|
4777
|
+
return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
|
|
4778
|
+
}),
|
|
4779
|
+
validateCurrentStep: assign(({ context }) => {
|
|
4780
|
+
const step = currentStep(context);
|
|
4781
|
+
if (!step) return {};
|
|
4782
|
+
const next = { ...context.validationErrors ?? {} };
|
|
4783
|
+
for (const name of step.fieldNames) {
|
|
4784
|
+
const message = validateEkycField(context.values, name, context.fields);
|
|
4785
|
+
if (message) next[name] = message;
|
|
4786
|
+
else delete next[name];
|
|
4787
|
+
}
|
|
4788
|
+
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
4789
|
+
}),
|
|
4790
|
+
advanceStep: assign(({ context }) => {
|
|
4791
|
+
const steps = stepsOf(context);
|
|
4792
|
+
return { currentStepIndex: clampStepIndex(clampStepIndex(context.currentStepIndex, steps) + 1, steps) };
|
|
4793
|
+
}),
|
|
4794
|
+
previousStep: assign(({ context }) => {
|
|
4795
|
+
const steps = stepsOf(context);
|
|
4796
|
+
return { currentStepIndex: clampStepIndex(clampStepIndex(context.currentStepIndex, steps) - 1, steps) };
|
|
4797
|
+
}),
|
|
4798
|
+
goToFirstStepWithError: assign(({ context }) => {
|
|
4799
|
+
const index = firstStepWithError(stepsOf(context), context.validationErrors);
|
|
4800
|
+
return index === void 0 ? {} : { currentStepIndex: index };
|
|
4801
|
+
}),
|
|
4802
|
+
resetStep: assign({ currentStepIndex: () => 0 }),
|
|
4803
|
+
fillAddressFields: assign(({ context, event }) => {
|
|
4804
|
+
const { suggestion } = event;
|
|
4805
|
+
const activeFields = new Set(context.fields.filter((f) => !isLocked(f)).map((f) => f.name));
|
|
4806
|
+
const { values: filled } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
|
|
4807
|
+
const newValues = keepSuggestionInOptions(context.fields, context.values, filled);
|
|
4808
|
+
const clearedErrors = omitKeys(context.validationErrors, ADDRESS_AUTOCOMPLETE_KEYS);
|
|
4809
|
+
const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
|
|
4810
|
+
const validationErrors = {
|
|
4811
|
+
...clearedErrors ?? {},
|
|
4812
|
+
...streetError !== void 0 ? { street: streetError } : {}
|
|
4813
|
+
};
|
|
4814
|
+
return {
|
|
4815
|
+
values: newValues,
|
|
4816
|
+
addressSuggestions: [],
|
|
4817
|
+
_searchQuery: "",
|
|
4818
|
+
validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0,
|
|
4819
|
+
submitError: ""
|
|
4820
|
+
};
|
|
4821
|
+
}),
|
|
4822
|
+
setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions })),
|
|
4823
|
+
setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
|
|
4824
|
+
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
4825
|
+
setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
|
|
4826
|
+
clearSubmitError: assign({ submitError: () => "" })
|
|
4827
|
+
},
|
|
4828
|
+
guards: {
|
|
4829
|
+
hasNoValidationErrors: hasNoValidationErrorsGuard,
|
|
4830
|
+
hasFlowId: hasFlowIdGuard,
|
|
4831
|
+
isAutoExecution: isAutoExecutionGuard,
|
|
4832
|
+
isModuleConfigAutoExecution: isModuleConfigAutoExecutionGuard,
|
|
4833
|
+
hasVerificationFields: hasVerificationFieldsGuard,
|
|
4834
|
+
needsModuleConfig: needsModuleConfigGuard,
|
|
4835
|
+
needsPhoneRules: needsPhoneRulesGuard,
|
|
4836
|
+
isCountryNotSupported: isCountryNotSupportedGuard,
|
|
4837
|
+
shouldAutoSubmit: ({ context }) => !context.autoSubmitted && showsNoFields(context),
|
|
4838
|
+
showsNoFields: ({ context }) => showsNoFields(context),
|
|
4839
|
+
isLastStep: ({ context }) => {
|
|
4840
|
+
const steps = stepsOf(context);
|
|
4841
|
+
return clampStepIndex(context.currentStepIndex, steps) >= steps.length - 1;
|
|
4842
|
+
},
|
|
4843
|
+
currentStepHasNoErrors: ({ context }) => isStepValid(currentStep(context), context.validationErrors)
|
|
4844
|
+
}
|
|
4845
|
+
}).createMachine({
|
|
4846
|
+
id: "ekyc",
|
|
4847
|
+
initial: "idle",
|
|
4848
|
+
context: ({ input }) => {
|
|
4849
|
+
const formDefinitions = isFormDefinitionsEnabled();
|
|
4850
|
+
const config = toEkycConfigFor(input.config, formDefinitions);
|
|
4851
|
+
return {
|
|
4852
|
+
config,
|
|
4853
|
+
moduleConfig: void 0,
|
|
4854
|
+
verificationFields: {},
|
|
4855
|
+
configSource: config.source ?? "",
|
|
4856
|
+
fieldsCountry: config.fieldsCountry ?? "",
|
|
4857
|
+
fields: [],
|
|
4858
|
+
values: {},
|
|
4859
|
+
addressSuggestions: [],
|
|
4860
|
+
prefilled: {},
|
|
4861
|
+
hideEmail: false,
|
|
4862
|
+
displayModes: config.displayModes ?? {},
|
|
4863
|
+
autoSubmitted: false,
|
|
4864
|
+
errorMessage: "",
|
|
4865
|
+
submitError: "",
|
|
4866
|
+
currentStepIndex: 0,
|
|
4867
|
+
_formDefinitions: formDefinitions,
|
|
4868
|
+
_searchQuery: ""
|
|
4869
|
+
};
|
|
4870
|
+
},
|
|
4871
|
+
states: {
|
|
4872
|
+
idle: { on: { LOAD: [
|
|
4873
|
+
{
|
|
4874
|
+
target: "finished",
|
|
4875
|
+
guard: "isAutoExecution"
|
|
4876
|
+
},
|
|
4877
|
+
{
|
|
4878
|
+
target: "loading.moduleConfig",
|
|
4879
|
+
guard: "hasFlowId"
|
|
4880
|
+
},
|
|
4881
|
+
{
|
|
4882
|
+
target: "loading.phoneRules",
|
|
4883
|
+
guard: "hasVerificationFields",
|
|
4884
|
+
actions: assign(({ context }) => {
|
|
4885
|
+
const vFields = withRiskAddonFields(context.config.verificationFields, context.config.riskAddons);
|
|
4886
|
+
const source = context.config.source ?? "";
|
|
4887
|
+
const country = context.config.fieldsCountry ?? getEKYCCountry(source);
|
|
4888
|
+
return {
|
|
4889
|
+
verificationFields: vFields,
|
|
4890
|
+
configSource: source,
|
|
4891
|
+
fieldsCountry: country,
|
|
4892
|
+
fields: buildFieldDefs(vFields, source, country, {
|
|
4893
|
+
useDefinitions: context._formDefinitions,
|
|
4894
|
+
enablePhoneRisk: context.config.enablePhoneRisk,
|
|
4895
|
+
riskAddons: context.config.riskAddons
|
|
4896
|
+
})
|
|
4897
|
+
};
|
|
4898
|
+
})
|
|
4899
|
+
},
|
|
4900
|
+
{ target: "misconfigured" }
|
|
4901
|
+
] } },
|
|
4902
|
+
loading: {
|
|
4903
|
+
initial: "moduleConfig",
|
|
4904
|
+
states: {
|
|
4905
|
+
moduleConfig: { invoke: {
|
|
4906
|
+
id: "fetchModuleConfig",
|
|
4907
|
+
src: "fetchModuleConfig",
|
|
4908
|
+
input: ({ context }) => ({ flowId: context.config.flowId }),
|
|
4909
|
+
onDone: [{
|
|
4910
|
+
target: "#ekyc.finished",
|
|
4911
|
+
guard: "isModuleConfigAutoExecution"
|
|
4912
|
+
}, {
|
|
4913
|
+
target: "#ekyc.prefilling",
|
|
4914
|
+
actions: "setModuleConfig"
|
|
4915
|
+
}],
|
|
4916
|
+
onError: {
|
|
4917
|
+
target: "#ekyc.error",
|
|
4918
|
+
actions: "setErrorMessage"
|
|
4919
|
+
}
|
|
4920
|
+
} },
|
|
4921
|
+
phoneRules: { invoke: {
|
|
4922
|
+
id: "loadPhoneRules",
|
|
4923
|
+
src: "loadPhoneRules",
|
|
4924
|
+
input: ({ context }) => ({ hasPhone: context.fields.some((field) => field.type === "phone") }),
|
|
4925
|
+
onDone: { target: "#ekyc.prefilling" },
|
|
4926
|
+
onError: {
|
|
4927
|
+
target: "#ekyc.error",
|
|
4928
|
+
actions: "setErrorMessage"
|
|
4929
|
+
}
|
|
4930
|
+
} }
|
|
4931
|
+
}
|
|
4932
|
+
},
|
|
4933
|
+
prefilling: {
|
|
4934
|
+
entry: "resetStep",
|
|
4935
|
+
invoke: {
|
|
4936
|
+
id: "fetchPrefillData",
|
|
4937
|
+
src: "fetchPrefillData",
|
|
4938
|
+
input: ({ context }) => ({ addressOrigin: prefillAddressOrigin(ekycFormConfig(context)) }),
|
|
4939
|
+
onDone: {
|
|
4940
|
+
target: "form",
|
|
4941
|
+
actions: "applyPrefillData"
|
|
4942
|
+
},
|
|
4943
|
+
onError: {
|
|
4944
|
+
target: "form",
|
|
4945
|
+
actions: "applyEmptyPrefill"
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
},
|
|
4949
|
+
form: {
|
|
4950
|
+
initial: "inputting",
|
|
4951
|
+
states: {
|
|
4952
|
+
inputting: {
|
|
4953
|
+
always: {
|
|
4954
|
+
guard: "shouldAutoSubmit",
|
|
4955
|
+
target: "validatingSubmit",
|
|
4956
|
+
actions: assign({ autoSubmitted: () => true })
|
|
4957
|
+
},
|
|
4958
|
+
on: {
|
|
4959
|
+
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
4960
|
+
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
4961
|
+
SUBMIT: { target: "validatingSubmit" }
|
|
4962
|
+
}
|
|
4963
|
+
},
|
|
4964
|
+
searching: {
|
|
4965
|
+
invoke: {
|
|
4966
|
+
id: "debounceSearch",
|
|
4967
|
+
src: "debounceSearch",
|
|
4968
|
+
input: ({ context }) => ({ query: context._searchQuery })
|
|
4969
|
+
},
|
|
4970
|
+
on: {
|
|
4971
|
+
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
4972
|
+
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
4973
|
+
RESULTS: {
|
|
4974
|
+
target: "inputting",
|
|
4975
|
+
actions: "setAddressSuggestions"
|
|
4976
|
+
},
|
|
4977
|
+
SUBMIT: { target: "validatingSubmit" }
|
|
4978
|
+
}
|
|
4979
|
+
},
|
|
4980
|
+
validatingSubmit: {
|
|
4981
|
+
entry: "computeValidationResult",
|
|
4982
|
+
always: [{
|
|
4983
|
+
guard: "hasNoValidationErrors",
|
|
4984
|
+
target: "#ekyc.submitting"
|
|
4985
|
+
}, {
|
|
4986
|
+
target: "inputting",
|
|
4987
|
+
actions: "goToFirstStepWithError"
|
|
4988
|
+
}]
|
|
4989
|
+
},
|
|
4990
|
+
validatingStep: {
|
|
4991
|
+
entry: "validateCurrentStep",
|
|
4992
|
+
always: [{
|
|
4993
|
+
guard: "currentStepHasNoErrors",
|
|
4994
|
+
target: "inputting",
|
|
4995
|
+
actions: "advanceStep"
|
|
4996
|
+
}, { target: "inputting" }]
|
|
4997
|
+
}
|
|
4998
|
+
},
|
|
4999
|
+
on: {
|
|
5000
|
+
NEXT_STEP: [{
|
|
5001
|
+
guard: "isLastStep",
|
|
5002
|
+
target: ".validatingSubmit"
|
|
5003
|
+
}, { target: ".validatingStep" }],
|
|
5004
|
+
PREVIOUS_STEP: {
|
|
5005
|
+
target: ".inputting",
|
|
5006
|
+
actions: "previousStep"
|
|
5007
|
+
},
|
|
5008
|
+
SEARCH_ADDRESS: {
|
|
5009
|
+
target: ".searching",
|
|
5010
|
+
actions: assign(({ event }) => ({
|
|
5011
|
+
_searchQuery: event.query,
|
|
5012
|
+
addressSuggestions: []
|
|
5013
|
+
}))
|
|
5014
|
+
},
|
|
5015
|
+
SELECT_ADDRESS: {
|
|
5016
|
+
target: ".inputting",
|
|
5017
|
+
actions: "fillAddressFields"
|
|
5018
|
+
},
|
|
5019
|
+
SKIP: { target: "#ekyc.finished" },
|
|
5020
|
+
CLOSE: { target: "#ekyc.closed" }
|
|
5021
|
+
}
|
|
5022
|
+
},
|
|
5023
|
+
submitting: { invoke: {
|
|
5024
|
+
id: "submitEkyc",
|
|
5025
|
+
src: "submitEkyc",
|
|
5026
|
+
input: ({ context }) => toEkycSubmitInput(context),
|
|
5027
|
+
onDone: { target: "success" },
|
|
5028
|
+
onError: [
|
|
5029
|
+
{
|
|
5030
|
+
target: "error",
|
|
5031
|
+
guard: "showsNoFields",
|
|
5032
|
+
actions: "setErrorMessage"
|
|
5033
|
+
},
|
|
5034
|
+
{
|
|
5035
|
+
target: "form",
|
|
5036
|
+
guard: "isCountryNotSupported",
|
|
5037
|
+
actions: "setSubmitError"
|
|
5038
|
+
},
|
|
5039
|
+
{
|
|
5040
|
+
target: "error",
|
|
5041
|
+
actions: "setErrorMessage"
|
|
5042
|
+
}
|
|
5043
|
+
]
|
|
5044
|
+
} },
|
|
5045
|
+
success: { after: { 3e3: "finished" } },
|
|
5046
|
+
error: { on: {
|
|
5047
|
+
RETRY: [
|
|
5048
|
+
{
|
|
5049
|
+
target: "loading.moduleConfig",
|
|
5050
|
+
guard: "needsModuleConfig",
|
|
5051
|
+
actions: "clearErrorMessage"
|
|
5052
|
+
},
|
|
5053
|
+
{
|
|
5054
|
+
target: "loading.phoneRules",
|
|
5055
|
+
guard: "needsPhoneRules",
|
|
5056
|
+
actions: "clearErrorMessage"
|
|
5057
|
+
},
|
|
5058
|
+
{
|
|
5059
|
+
target: "form",
|
|
5060
|
+
actions: ["clearErrorMessage", assign({ autoSubmitted: () => false })]
|
|
5061
|
+
}
|
|
5062
|
+
],
|
|
5063
|
+
SKIP: { target: "finished" },
|
|
5064
|
+
CLOSE: { target: "closed" }
|
|
5065
|
+
} },
|
|
5066
|
+
misconfigured: { on: { CLOSE: { target: "closed" } } },
|
|
5067
|
+
finished: { type: "final" },
|
|
5068
|
+
closed: { type: "final" }
|
|
5069
|
+
}
|
|
5070
|
+
});
|
|
5071
|
+
//#endregion
|
|
5072
|
+
export { isStepValid as i, buildEkycSteps as n, clampStepIndex as r, ekycMachine as t };
|