@incodetech/core 0.0.0-dev-20261113-97244130 → 0.0.0-dev-20261113-5d033785
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-D1wWMy_5.esm.js → FaceDetectionProvider-BEhXNMV5.esm.js} +4 -4
- package/dist/ae-signature.d.ts +1 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-BnhiR_AL.esm.js → apiError-BQTeQKk6.esm.js} +1 -1
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-C_77ISIf.esm.js → authenticationManager-Y4VUpaf0.esm.js} +3 -3
- package/dist/{authenticationStateMachine-DvAf-wLB.esm.js → authenticationStateMachine-De54VFic.esm.js} +2 -2
- package/dist/{cnpj-Co1ottYN.esm.js → cnpj-Bl_olpdX.esm.js} +5 -3
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-DlvhoJYc.d.ts → consentManager-B0YKqYtZ.d.ts} +1 -1
- package/dist/{cpf-BIADjddF.esm.js → cpf-DDXMTLYr.esm.js} +1 -1
- package/dist/curp-DZGvefg3.esm.js +14 -0
- package/dist/curp-validation.esm.js +2 -2
- package/dist/{curpValidationManager-BNO88CiC.esm.js → curpValidationManager-CbvBDoE1.esm.js} +2 -2
- package/dist/{curpValidationStateMachine-DBhkpzBq.esm.js → curpValidationStateMachine-BQ8XK2Y3.esm.js} +1 -1
- package/dist/{deepsightLoader-Ds-ua4us.esm.js → deepsightLoader-Da6Vjzrr.esm.js} +3 -3
- package/dist/{definitionSource-BHNxbuiv.esm.js → definitionSource-BbeyVsUt.esm.js} +13 -1
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-PX1WqH4L.esm.js → dynamicFormsManager-DxVrBA_h.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-CURK4WB-.esm.js → dynamicFormsStateMachine-D6ELHmv0.esm.js} +1 -1
- package/dist/ekyb.esm.js +2 -2
- package/dist/{ekybManager-DuqMCmYr.esm.js → ekybManager-EYgqBG9K.esm.js} +1 -1
- package/dist/{ekybStateMachine-CojY8NBX.esm.js → ekybStateMachine-B1MeLvKj.esm.js} +4 -11
- package/dist/ekyc-prefill.esm.js +2 -2
- package/dist/ekyc.esm.js +2 -2
- package/dist/{ekycManager-BEJkmpFx.esm.js → ekycManager-at38HLKS.esm.js} +1 -1
- package/dist/{ekycPrefillManager-CWKo8InV.esm.js → ekycPrefillManager-D7l75f64.esm.js} +1 -1
- package/dist/{ekycPrefillStateMachine-BnmT7sbA.esm.js → ekycPrefillStateMachine-Cyewb-5Y.esm.js} +5 -5
- package/dist/{ekycRules-B0OocyvM.esm.js → ekycRules-BtKqNbSh.esm.js} +197 -37
- package/dist/{ekycStateMachine-B3iW2E9S.esm.js → ekycStateMachine-CvJF9_XE.esm.js} +10 -3
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-BlzMfmlz.esm.js → electronicSignatureManager-D7GoRUoi.esm.js} +1 -1
- package/dist/{electronicSignatureManager-5tYz-a4o.d.ts → electronicSignatureManager-Dxg9hr1_.d.ts} +1 -1
- package/dist/extensibility.d.ts +5 -5
- package/dist/extensibility.esm.js +16 -16
- package/dist/{faceCaptureManagerFactory-B948_tWc.esm.js → faceCaptureManagerFactory-DadZb6Zk.esm.js} +1 -1
- package/dist/{faceCaptureSetup-DkmfDJgn.esm.js → faceCaptureSetup-DHqQiHOr.esm.js} +3 -3
- package/dist/{feature-management-BXk9AQMx.esm.js → feature-management-C9DYYVV6.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-AuhoefiQ.esm.js → flowCompletionService-BVcrviWT.esm.js} +1 -1
- package/dist/{flowServices-CFYZ7E0J.esm.js → flowServices-CYNX5JMX.esm.js} +4 -4
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-caojCChS.esm.js → geolocationManager-Dl2mkYpm.esm.js} +1 -1
- package/dist/{geolocationStateMachine-qncd8bPi.esm.js → geolocationStateMachine-C6uzKX-P.esm.js} +1 -1
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-ocr.esm.js +3 -3
- package/dist/id-selfie-flow.esm.js +6 -6
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureManager-Bfy8VCZc.esm.js → idCaptureManager-BH0iR3xj.esm.js} +3 -3
- package/dist/{idCaptureServices-Cq1nZyvM.esm.js → idCaptureServices-DSjWf0mZ.esm.js} +2 -2
- package/dist/{idCaptureStateMachine-By7Bpl4P.esm.js → idCaptureStateMachine-CQqvoRIj.esm.js} +8 -8
- package/dist/{idOcrCpfUtils-Nfln1Psb.esm.js → idOcrCpfUtils-D5Gwskxu.esm.js} +1 -1
- package/dist/{idOcrManager-C0C7lFGd.d.ts → idOcrManager-DflRx-_u.d.ts} +1 -1
- package/dist/{idOcrManager-BmH5urT2.esm.js → idOcrManager-im7VfJQi.esm.js} +1 -1
- package/dist/{idOcrStateMachine-DE7g_xnk.esm.js → idOcrStateMachine-B832arAl.esm.js} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/kyb-checks.esm.js +2 -2
- package/dist/{kybChecksManager-fjwPQ_o4.esm.js → kybChecksManager-DwyPLSak.esm.js} +1 -1
- package/dist/{kybChecksStateMachine-DjnDVMK0.esm.js → kybChecksStateMachine-DWEnfvqh.esm.js} +2 -2
- package/dist/mandatory-consent.d.ts +1 -1
- package/dist/{mandatoryConsentManager-BYKfAPVW.d.ts → mandatoryConsentManager-B8gtexL8.d.ts} +1 -1
- package/dist/phoneFormat-C3q0Ukh4.esm.js +27 -0
- package/dist/qe-signature.d.ts +1 -1
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{runChildModule-BmyR8IFO.esm.js → runChildModule-C1azRujl.esm.js} +1 -1
- package/dist/{sdkVersion-CMTr1DUm.esm.js → sdkVersion-YJRSqpIJ.esm.js} +1 -1
- package/dist/selfie.esm.js +6 -6
- package/dist/{selfieErrorUtils-B_fesooG.esm.js → selfieErrorUtils-N9Q-9jVC.esm.js} +1 -1
- package/dist/{selfieManager-DVBdeivh.esm.js → selfieManager-CxtIkkdX.esm.js} +3 -3
- package/dist/{selfieStateMachine-BUaNQwie.esm.js → selfieStateMachine-DwscPxjs.esm.js} +3 -3
- package/dist/{session-BYYjaWcT.esm.js → session-B3DvD5Xp.esm.js} +3 -3
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-CSY3MLg8.esm.js → sessionInitializer-BEXhc2Fe.esm.js} +3 -3
- package/dist/{setup-blNORxc2.esm.js → setup-cA5Qcnt4.esm.js} +4 -4
- package/dist/{trueSightService-5EfA-9Xa.esm.js → trueSightService-CiSMAASE.esm.js} +1 -1
- package/dist/video-selfie.esm.js +3 -3
- package/dist/{videoSelfieCameraWarmer-DmzxxVKD.esm.js → videoSelfieCameraWarmer-DmE1eCPw.esm.js} +3 -3
- package/dist/wasm.esm.js +1 -1
- package/dist/watchlist-for-business.esm.js +2 -2
- package/dist/{watchlistForBusinessManager-CEOMKI63.esm.js → watchlistForBusinessManager-BH6M4kqA.esm.js} +1 -1
- package/dist/{watchlistForBusinessStateMachine-CDb2mHbq.esm.js → watchlistForBusinessStateMachine-BMWm5mcP.esm.js} +1 -1
- package/dist/workflow.esm.js +19 -19
- package/package.json +1 -1
- package/dist/nationalIds-B91f_RuB.esm.js +0 -99
- package/dist/phoneFormat-DEpESpz2.esm.js +0 -87
package/dist/{FaceDetectionProvider-D1wWMy_5.esm.js → FaceDetectionProvider-BEhXNMV5.esm.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { l as wasmRuntime } from "./warmup-BZOMg303.esm.js";
|
|
2
|
-
import { t as ensureWasmPipelines } from "./setup-
|
|
2
|
+
import { t as ensureWasmPipelines } from "./setup-cA5Qcnt4.esm.js";
|
|
3
3
|
import { r as BaseWasmProvider } from "./WasmUtilProvider-0xTxgP0R.esm.js";
|
|
4
4
|
import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
|
|
5
|
-
import { l as trueSightHintTransition, r as noteTrueSightCaptureActivity } from "./trueSightService-
|
|
6
|
-
import "./sessionInitializer-
|
|
5
|
+
import { l as trueSightHintTransition, r as noteTrueSightCaptureActivity } from "./trueSightService-CiSMAASE.esm.js";
|
|
6
|
+
import "./sessionInitializer-BEXhc2Fe.esm.js";
|
|
7
7
|
import { t as addDeviceStats } from "./stats-DoByUnTa.esm.js";
|
|
8
8
|
import { t as IncodeCanvas } from "./canvas-BxFzWTt-.esm.js";
|
|
9
9
|
import { t as StreamCanvasProcessingSession } from "./StreamCanvasProcessingSession-CBnbTnOr.esm.js";
|
|
@@ -235,7 +235,7 @@ function startDetection(params) {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
async function initializeDeepsightSession(options) {
|
|
238
|
-
const { loadDeepsightSession } = await import("./deepsightLoader-
|
|
238
|
+
const { loadDeepsightSession } = await import("./deepsightLoader-Da6Vjzrr.esm.js");
|
|
239
239
|
return loadDeepsightSession({
|
|
240
240
|
ds: options.ds,
|
|
241
241
|
storage: options.storage
|
package/dist/ae-signature.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-DufwKlav.js";
|
|
2
2
|
import { S as getDefaultConsentChecks, a as ElectronicSignatureConfig, b as areAllConsented, i as ConsentKey, r as ConsentChecks, s as ElectronicSignatureDocument, t as AE_CONSENT_KEYS } from "./types-D0gekt4U.js";
|
|
3
|
-
import { n as ElectronicSignatureState, o as electronicSignatureMachine } from "./electronicSignatureManager-
|
|
4
|
-
import "./electronic-signature.js";
|
|
3
|
+
import { n as ElectronicSignatureState, o as electronicSignatureMachine } from "./electronicSignatureManager-Dxg9hr1_.js";
|
|
5
4
|
//#region src/modules/ae-signature/index.d.ts
|
|
6
5
|
type AeSignatureConfig = Omit<ElectronicSignatureConfig, 'variant'>;
|
|
7
6
|
declare function createAeSignatureManager(options: {
|
package/dist/ae-signature.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as areAllConsented, i as AE_CONSENT_KEYS, r as electronicSignatureMachine, t as createElectronicSignatureManager, u as getDefaultConsentChecks } from "./electronicSignatureManager-
|
|
1
|
+
import { c as areAllConsented, i as AE_CONSENT_KEYS, r as electronicSignatureMachine, t as createElectronicSignatureManager, u as getDefaultConsentChecks } from "./electronicSignatureManager-D7GoRUoi.esm.js";
|
|
2
2
|
//#region src/modules/ae-signature/index.ts
|
|
3
3
|
function createAeSignatureManager(options) {
|
|
4
4
|
return createElectronicSignatureManager({ config: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as authenticationMachine } from "./authenticationStateMachine-
|
|
2
|
-
import { r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-
|
|
1
|
+
import { t as authenticationMachine } from "./authenticationStateMachine-De54VFic.esm.js";
|
|
2
|
+
import { r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-Y4VUpaf0.esm.js";
|
|
3
3
|
export { authenticationMachine, createAuthenticationActor, createAuthenticationManager };
|
package/dist/{authenticationManager-C_77ISIf.esm.js → authenticationManager-Y4VUpaf0.esm.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { u as BrowserStorageProvider } from "./setup-
|
|
1
|
+
import { u as BrowserStorageProvider } from "./setup-cA5Qcnt4.esm.js";
|
|
2
2
|
import { t as WasmUtilProvider } from "./WasmUtilProvider-0xTxgP0R.esm.js";
|
|
3
3
|
import { n as eventModuleNames } from "./types-DYYMdAGv.esm.js";
|
|
4
4
|
import "./events-CP3yOzAl.esm.js";
|
|
5
5
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
6
|
-
import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-
|
|
7
|
-
import { t as authenticationMachine } from "./authenticationStateMachine-
|
|
6
|
+
import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-DadZb6Zk.esm.js";
|
|
7
|
+
import { t as authenticationMachine } from "./authenticationStateMachine-De54VFic.esm.js";
|
|
8
8
|
//#region src/modules/authentication/authenticationActor.ts
|
|
9
9
|
function createAuthenticationActor(options) {
|
|
10
10
|
const dependencies = options.dependencies ?? {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as assign } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
2
2
|
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
3
|
-
import { n as createDefaultProtectedFaceControllerActor, t as faceCaptureMachine } from "./faceCaptureSetup-
|
|
4
|
-
import { d as isOnDeviceMode, u as FACE_ERROR_CODES } from "./FaceDetectionProvider-
|
|
3
|
+
import { n as createDefaultProtectedFaceControllerActor, t as faceCaptureMachine } from "./faceCaptureSetup-DHqQiHOr.esm.js";
|
|
4
|
+
import { d as isOnDeviceMode, u as FACE_ERROR_CODES } from "./FaceDetectionProvider-BEhXNMV5.esm.js";
|
|
5
5
|
import { s as PROTECTED_CAPTURE_TARGET } from "./desktopCameraElection-BKFjsQpO.esm.js";
|
|
6
6
|
//#region src/modules/authentication/authenticationErrorUtils.ts
|
|
7
7
|
const AUTH_ERROR_MAP = {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
/** Countries whose tax ID is a CNPJ and must pass {@link validateCNPJ}. */
|
|
3
|
-
const COUNTRIES_WITH_CNPJ_VALIDATION = ["BR"];
|
|
1
|
+
//#region src/internal/forms/checks/cnpj.ts
|
|
4
2
|
const CNPJ_FORMATTED_LENGTH = 18;
|
|
5
3
|
const CNPJ_CLEAN_LENGTH = 14;
|
|
6
4
|
const INVALID_CNPJ_PATTERNS = [
|
|
@@ -69,6 +67,10 @@ function validateCNPJ(cnpjInput) {
|
|
|
69
67
|
if (cnpj.charAt(13) !== second) return false;
|
|
70
68
|
return true;
|
|
71
69
|
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/shared/validators/cnpj.ts
|
|
72
|
+
/** Countries whose tax ID is a CNPJ and must pass {@link validateCNPJ}. */
|
|
73
|
+
const COUNTRIES_WITH_CNPJ_VALIDATION = ["BR"];
|
|
72
74
|
/** Returns true when CNPJ validation applies for the given country. */
|
|
73
75
|
function requiresCnpjValidation(country) {
|
|
74
76
|
return COUNTRIES_WITH_CNPJ_VALIDATION.includes(country);
|
package/dist/consent.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ConsentActor, c as ConsentConfig, i as createConsentManagerFromActor, n as ConsentState, o as consentMachine, r as createConsentManager, s as ConsentCheckbox, t as ConsentManager } from "./consentManager-
|
|
1
|
+
import { a as ConsentActor, c as ConsentConfig, i as createConsentManagerFromActor, n as ConsentState, o as consentMachine, r as createConsentManager, s as ConsentCheckbox, t as ConsentManager } from "./consentManager-B0YKqYtZ.js";
|
|
2
2
|
export { type ConsentActor, type ConsentCheckbox, type ConsentConfig, type ConsentManager, type ConsentState, consentMachine, createConsentManager, createConsentManagerFromActor };
|
|
@@ -102,7 +102,7 @@ declare const consentMachine: StateMachine<ConsentContext, {
|
|
|
102
102
|
}>, {
|
|
103
103
|
type: "canSubmit";
|
|
104
104
|
params: unknown;
|
|
105
|
-
}, never, "error" | "idle" | "finished" | "
|
|
105
|
+
}, never, "error" | "idle" | "finished" | "submitting" | "loading" | "display", string, ConsentInput, NonReducibleUnknown, EventObject, MetaObject, {
|
|
106
106
|
readonly id: "consent";
|
|
107
107
|
readonly initial: "idle";
|
|
108
108
|
readonly context: ({ input }: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/internal/forms/checks/curp.ts
|
|
2
|
+
const CURP_PATTERN = /^([A-Z][AEIOUX][A-Z]{2}\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])[HMX](?:AS|B[CS]|C[CLMSH]|D[FG]|G[TR]|HG|JC|M[CNS]|N[ETL]|OC|PL|Q[TR]|S[PLR]|T[CSL]|VZ|YN|ZS)[B-DF-HJ-NP-TV-Z]{3}[A-Z\d])(\d)$/;
|
|
3
|
+
/**
|
|
4
|
+
* Mexican CURP layout: 4 letters (the second a vowel or X), a YYMMDD birth
|
|
5
|
+
* date, H, M or X for sex, a state code (NE for born abroad), 3 consonants, a
|
|
6
|
+
* letter or digit, and a final digit. Format only: the check digit isn't
|
|
7
|
+
* computed, as in SDK1 (see "Gaps" in the eKYC drafts README for how to add
|
|
8
|
+
* it). The CURP module checks the same layout.
|
|
9
|
+
*/
|
|
10
|
+
function isValidCurp(curp) {
|
|
11
|
+
return typeof curp === "string" && curp.length === 18 && CURP_PATTERN.test(curp.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isValidCurp as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as mexicanStates, n as ENTER_CURP_FIELD, r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-
|
|
2
|
-
import { n as createCurpValidationManagerFromActor, t as createCurpValidationManager } from "./curpValidationManager-
|
|
1
|
+
import { i as mexicanStates, n as ENTER_CURP_FIELD, r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-BQ8XK2Y3.esm.js";
|
|
2
|
+
import { n as createCurpValidationManagerFromActor, t as createCurpValidationManager } from "./curpValidationManager-CbvBDoE1.esm.js";
|
|
3
3
|
export { ENTER_CURP_FIELD, GENERATE_CURP_FIELDS, createCurpValidationManager, createCurpValidationManagerFromActor, curpValidationMachine, mexicanStates };
|
package/dist/{curpValidationManager-BNO88CiC.esm.js → curpValidationManager-CbvBDoE1.esm.js}
RENAMED
|
@@ -3,8 +3,8 @@ import { t as createManagerInstrumentation } from "./events-CP3yOzAl.esm.js";
|
|
|
3
3
|
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
4
|
import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
|
|
5
5
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
6
|
-
import { t as isValidCurp } from "./
|
|
7
|
-
import { r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-
|
|
6
|
+
import { t as isValidCurp } from "./curp-DZGvefg3.esm.js";
|
|
7
|
+
import { r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-BQ8XK2Y3.esm.js";
|
|
8
8
|
//#region src/modules/curp-validation/curpValidationActor.ts
|
|
9
9
|
function createCurpValidationActor(options) {
|
|
10
10
|
return createActor(curpValidationMachine, { input: { config: options.config } }).start();
|
|
@@ -2,7 +2,7 @@ import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
|
|
|
2
2
|
import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
3
3
|
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
4
4
|
import { t as carryAttempts } from "./attemptCarry-BecGGZK8.esm.js";
|
|
5
|
-
import { t as isValidCurp } from "./
|
|
5
|
+
import { t as isValidCurp } from "./curp-DZGvefg3.esm.js";
|
|
6
6
|
//#region src/modules/curp-validation/curpValidationUtils.ts
|
|
7
7
|
/** Convert YYYY-MM-DD to DD/MM/YYYY for the API */
|
|
8
8
|
function formatDateForApi(date) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as WasmUtilProvider } from "./WasmUtilProvider-0xTxgP0R.esm.js";
|
|
2
|
-
import { u as trueSightLog } from "./trueSightService-
|
|
3
|
-
import { t as SDK_VERSION } from "./sdkVersion-
|
|
4
|
-
import { C as BrowserEnvironmentProvider, S as IpifyProvider, T as SDK_PLATFORM, b as getThumbmarkId, n as getDisableIpify, r as getFingerprintEnabled, v as isBrowserSimulation, w as fingerprintSignalsReporter } from "./sessionInitializer-
|
|
2
|
+
import { u as trueSightLog } from "./trueSightService-CiSMAASE.esm.js";
|
|
3
|
+
import { t as SDK_VERSION } from "./sdkVersion-YJRSqpIJ.esm.js";
|
|
4
|
+
import { C as BrowserEnvironmentProvider, S as IpifyProvider, T as SDK_PLATFORM, b as getThumbmarkId, n as getDisableIpify, r as getFingerprintEnabled, v as isBrowserSimulation, w as fingerprintSignalsReporter } from "./sessionInitializer-BEXhc2Fe.esm.js";
|
|
5
5
|
import { t as getParsedUserAgent } from "./getParsedUserAgent-DhQPeKqw.esm.js";
|
|
6
6
|
import { t as getUserAgent } from "./getBrowser-CBiibsL-.esm.js";
|
|
7
7
|
import { t as setWasmDsFlagSync } from "./wasmDsFlagSync-DPK7qGgo.esm.js";
|
|
@@ -100,6 +100,18 @@ function getPostalCodeErrorKey(country) {
|
|
|
100
100
|
if (country === "US") return "verification.errors.zipCodeInvalidFormat";
|
|
101
101
|
return "verification.errors.postalCodeInvalidFormat";
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* The params of a postal code's error message: the digit count for a
|
|
105
|
+
* fixed-length format, otherwise the maximum length. US and BR don't count
|
|
106
|
+
* the dash.
|
|
107
|
+
*/
|
|
108
|
+
function getPostalCodeErrorParams(country) {
|
|
109
|
+
const fixedLength = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
110
|
+
if (fixedLength !== void 0) return { length: fixedLength };
|
|
111
|
+
let maxLength = getPostalCodeMaxLength(country);
|
|
112
|
+
if (country === "US" || country === "BR") maxLength = maxLength - 1;
|
|
113
|
+
return { maxLength };
|
|
114
|
+
}
|
|
103
115
|
const US_POSTAL_CODE_REGEX = /^(?:\d{5}|\d{9}|\d{5}-\d{4})$/;
|
|
104
116
|
const BR_POSTAL_CODE_REGEX = /^(?:\d{5}|\d{8}|\d{5}-\d{3})$/;
|
|
105
117
|
const CA_POSTAL_CODE_REGEX = /^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/;
|
|
@@ -181,4 +193,4 @@ function createBundledDefinitionSource(definitions) {
|
|
|
181
193
|
return { select: (query) => byQuery.get(queryKey(query)) };
|
|
182
194
|
}
|
|
183
195
|
//#endregion
|
|
184
|
-
export { getPostalCodeMaxLength as a, fillFromSuggestion as c,
|
|
196
|
+
export { getPostalCodeMaxLength as a, fillFromSuggestion as c, getPostalCodeErrorParams as i, getStreetLevelErrorForSuggestion as l, formatPostalCode as n, validatePostalCode as o, getPostalCodeErrorKey as r, STREET_LEVEL_REQUIRED_ERROR as s, createBundledDefinitionSource as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as dynamicFormsMachine } from "./dynamicFormsStateMachine-
|
|
2
|
-
import { t as createDynamicFormsManager } from "./dynamicFormsManager-
|
|
1
|
+
import { t as dynamicFormsMachine } from "./dynamicFormsStateMachine-D6ELHmv0.esm.js";
|
|
2
|
+
import { t as createDynamicFormsManager } from "./dynamicFormsManager-DxVrBA_h.esm.js";
|
|
3
3
|
export { createDynamicFormsManager, dynamicFormsMachine };
|
|
@@ -3,7 +3,7 @@ import { t as createManagerInstrumentation } from "./events-CP3yOzAl.esm.js";
|
|
|
3
3
|
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
4
|
import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
|
|
5
5
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
6
|
-
import { t as dynamicFormsMachine } from "./dynamicFormsStateMachine-
|
|
6
|
+
import { t as dynamicFormsMachine } from "./dynamicFormsStateMachine-D6ELHmv0.esm.js";
|
|
7
7
|
//#region src/modules/dynamic-forms/dynamicFormsActor.ts
|
|
8
8
|
function createDynamicFormsActor(options) {
|
|
9
9
|
return createActor(dynamicFormsMachine, { input: { config: options.config } }).start();
|
package/dist/{dynamicFormsStateMachine-CURK4WB-.esm.js → dynamicFormsStateMachine-D6ELHmv0.esm.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
|
|
2
|
-
import { i as toIncodeApiError, r as isServerError, t as IncodeApiError } from "./apiError-
|
|
2
|
+
import { i as toIncodeApiError, r as isServerError, t as IncodeApiError } from "./apiError-BQTeQKk6.esm.js";
|
|
3
3
|
import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
4
4
|
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
5
5
|
import { t as isoDateToMs } from "./dateUtils-CvG0FvK8.esm.js";
|
package/dist/ekyb.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as ALL_COUNTRIES, f as SUPPORTED_COUNTRIES, l as DEV_ONLY_COUNTRIES, m as isSupportedCountry, o as toEkybConfig } from "./ekybUtils-Cw8Ta9Qi.esm.js";
|
|
2
|
-
import { t as ekybMachine } from "./ekybStateMachine-
|
|
3
|
-
import { t as createEkybManager } from "./ekybManager-
|
|
2
|
+
import { t as ekybMachine } from "./ekybStateMachine-B1MeLvKj.esm.js";
|
|
3
|
+
import { t as createEkybManager } from "./ekybManager-EYgqBG9K.esm.js";
|
|
4
4
|
export { ALL_COUNTRIES, DEV_ONLY_COUNTRIES, SUPPORTED_COUNTRIES, createEkybManager, ekybMachine, isSupportedCountry, toEkybConfig };
|
|
@@ -3,7 +3,7 @@ import { t as createManagerInstrumentation } from "./events-CP3yOzAl.esm.js";
|
|
|
3
3
|
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
4
|
import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
|
|
5
5
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
6
|
-
import { t as ekybMachine } from "./ekybStateMachine-
|
|
6
|
+
import { t as ekybMachine } from "./ekybStateMachine-B1MeLvKj.esm.js";
|
|
7
7
|
//#region src/modules/ekyb/ekybActor.ts
|
|
8
8
|
/**
|
|
9
9
|
* Creates and starts an eKYB actor.
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
|
|
2
|
-
import { n as getFlow } from "./flowServices-
|
|
2
|
+
import { n as getFlow } from "./flowServices-CYNX5JMX.esm.js";
|
|
3
3
|
import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
4
4
|
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
5
5
|
import { a as sortModulesByOrder, c as ALL_COUNTRIES, d as FIELD_ORDER, i as requiresAddressValidation, m as isSupportedCountry, n as hasAtLeastOneAddressField, o as toEkybConfig, p as UBO_FIELD_LABELS, r as isFieldOptional, s as ADDRESS_FIELDS, u as FIELD_NAME_MAPPING } from "./ekybUtils-Cw8Ta9Qi.esm.js";
|
|
6
6
|
import { t as usStateOptions } from "./usStates-CwOQ2kAx.esm.js";
|
|
7
|
-
import { n as requiresCnpjValidation, r as validateCNPJ } from "./cnpj-
|
|
8
|
-
import { a as getPostalCodeMaxLength, c as fillFromSuggestion, i as
|
|
7
|
+
import { n as requiresCnpjValidation, r as validateCNPJ } from "./cnpj-Bl_olpdX.esm.js";
|
|
8
|
+
import { a as getPostalCodeMaxLength, c as fillFromSuggestion, i as getPostalCodeErrorParams, l as getStreetLevelErrorForSuggestion, n as formatPostalCode, o as validatePostalCode, r as getPostalCodeErrorKey, s as STREET_LEVEL_REQUIRED_ERROR, t as createBundledDefinitionSource } from "./definitionSource-BbeyVsUt.esm.js";
|
|
9
9
|
import { n as checkSupport, r as DYNAMIC_REQUIRED_KEY, t as resolveForm } from "./resolveForm-DaaQSVWp.esm.js";
|
|
10
10
|
import { r as isFormDefinitionsEnabled, t as debounceSearchActor } from "./addressSearch-Rxm1K67A.esm.js";
|
|
11
11
|
//#region src/modules/ekyb/ekybValidators.ts
|
|
12
|
-
const buildPostalCodeParams = (country) => {
|
|
13
|
-
const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
14
|
-
if (fixedLen !== void 0) return { length: fixedLen };
|
|
15
|
-
let maxLen = getPostalCodeMaxLength(country);
|
|
16
|
-
if (country === "US" || country === "BR") maxLen = maxLen - 1;
|
|
17
|
-
return { maxLength: maxLen };
|
|
18
|
-
};
|
|
19
12
|
const createValidators = () => ({
|
|
20
13
|
required: (value, _rule, field) => {
|
|
21
14
|
if (value.trim().length > 0) return void 0;
|
|
@@ -39,7 +32,7 @@ const createValidators = () => ({
|
|
|
39
32
|
if (validatePostalCode(value, rule.country)) return void 0;
|
|
40
33
|
return {
|
|
41
34
|
key: getPostalCodeErrorKey(rule.country),
|
|
42
|
-
params:
|
|
35
|
+
params: getPostalCodeErrorParams(rule.country)
|
|
43
36
|
};
|
|
44
37
|
}
|
|
45
38
|
});
|
package/dist/ekyc-prefill.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as toEkycPrefillConfig, t as ekycPrefillMachine } from "./ekycPrefillStateMachine-
|
|
2
|
-
import { t as createEkycPrefillManager } from "./ekycPrefillManager-
|
|
1
|
+
import { i as toEkycPrefillConfig, t as ekycPrefillMachine } from "./ekycPrefillStateMachine-Cyewb-5Y.esm.js";
|
|
2
|
+
import { t as createEkycPrefillManager } from "./ekycPrefillManager-D7l75f64.esm.js";
|
|
3
3
|
export { createEkycPrefillManager, ekycPrefillMachine, toEkycPrefillConfig };
|
package/dist/ekyc.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ekycMachine } from "./ekycStateMachine-
|
|
1
|
+
import { t as ekycMachine } from "./ekycStateMachine-CvJF9_XE.esm.js";
|
|
2
2
|
import { l as toEkycConfig } from "./ekycUtils-Cp9M-bBI.esm.js";
|
|
3
|
-
import { t as createEkycManager } from "./ekycManager-
|
|
3
|
+
import { t as createEkycManager } from "./ekycManager-at38HLKS.esm.js";
|
|
4
4
|
export { createEkycManager, ekycMachine, toEkycConfig };
|
|
@@ -3,7 +3,7 @@ import { t as createManagerInstrumentation } from "./events-CP3yOzAl.esm.js";
|
|
|
3
3
|
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
4
|
import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
|
|
5
5
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
6
|
-
import { i as isStepValid, n as buildEkycSteps, r as clampStepIndex, t as ekycMachine } from "./ekycStateMachine-
|
|
6
|
+
import { i as isStepValid, n as buildEkycSteps, r as clampStepIndex, t as ekycMachine } from "./ekycStateMachine-CvJF9_XE.esm.js";
|
|
7
7
|
//#region src/modules/ekyc/ekycActor.ts
|
|
8
8
|
/**
|
|
9
9
|
* Creates and starts an eKYC actor.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createManager } from "./Manager-BvXAwDv9.esm.js";
|
|
2
2
|
import { s as createActor } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
3
|
-
import { n as isAnyOfMissing, r as validateForm, t as ekycPrefillMachine } from "./ekycPrefillStateMachine-
|
|
3
|
+
import { n as isAnyOfMissing, r as validateForm, t as ekycPrefillMachine } from "./ekycPrefillStateMachine-Cyewb-5Y.esm.js";
|
|
4
4
|
//#region src/modules/ekyc-prefill/ekycPrefillActor.ts
|
|
5
5
|
/** Creates and starts an eKYC Pre-fill actor, idle until `LOAD`. */
|
|
6
6
|
function createEkycPrefillActor(options = {}) {
|
package/dist/{ekycPrefillStateMachine-BnmT7sbA.esm.js → ekycPrefillStateMachine-Cyewb-5Y.esm.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as api, u as endpoints } from "./api-CZpuJuZl.esm.js";
|
|
2
|
-
import { i as toIncodeApiError } from "./apiError-
|
|
2
|
+
import { i as toIncodeApiError } from "./apiError-BQTeQKk6.esm.js";
|
|
3
3
|
import { n as loadPhoneValidation } from "./phoneValidation-OggtfjRt.esm.js";
|
|
4
4
|
import { i as assign, t as setup } from "./xstate.esm-CIqUf_i6.esm.js";
|
|
5
5
|
import { n as fromPromise } from "./xstate-actors.esm-BCcwgosu.esm.js";
|
|
6
|
-
import {
|
|
6
|
+
import { i as cleanName, l as validateEkycField, n as projectRules, o as formatSSN } from "./ekycRules-BtKqNbSh.esm.js";
|
|
7
|
+
import { t as createBundledDefinitionSource } from "./definitionSource-BbeyVsUt.esm.js";
|
|
7
8
|
import { n as checkSupport, t as resolveForm } from "./resolveForm-DaaQSVWp.esm.js";
|
|
8
|
-
import { t as formatPhoneE164 } from "./phoneFormat-
|
|
9
|
-
import {
|
|
10
|
-
import { t as formatCPF } from "./idOcrCpfUtils-Nfln1Psb.esm.js";
|
|
9
|
+
import { t as formatPhoneE164 } from "./phoneFormat-C3q0Ukh4.esm.js";
|
|
10
|
+
import { t as formatCPF } from "./idOcrCpfUtils-D5Gwskxu.esm.js";
|
|
11
11
|
//#region src/modules/ekyc-prefill/ekycPrefillConfig.ts
|
|
12
12
|
const isString = (value) => typeof value === "string" && value !== "";
|
|
13
13
|
function toConfigField(raw) {
|
|
@@ -1,10 +1,201 @@
|
|
|
1
1
|
import { t as getLocalIsoDate } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
|
|
2
2
|
import { n as loadPhoneValidation, t as getPhoneValidation } from "./phoneValidation-OggtfjRt.esm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { t as isValidCurp } from "./curp-DZGvefg3.esm.js";
|
|
4
|
+
import { i as getPostalCodeErrorParams, o as validatePostalCode, r as getPostalCodeErrorKey, s as STREET_LEVEL_REQUIRED_ERROR } from "./definitionSource-BbeyVsUt.esm.js";
|
|
5
5
|
import { r as DYNAMIC_REQUIRED_KEY } from "./resolveForm-DaaQSVWp.esm.js";
|
|
6
|
-
import { t as validateCPF } from "./cpf-
|
|
7
|
-
import {
|
|
6
|
+
import { t as validateCPF } from "./cpf-DDXMTLYr.esm.js";
|
|
7
|
+
import { n as hasAllowedCharacters } from "./phoneFormat-C3q0Ukh4.esm.js";
|
|
8
|
+
//#region src/internal/forms/checks/esDni.ts
|
|
9
|
+
const DNI_LETTERS = "TRWAGMYFPDXBNJZSQVHLCKE";
|
|
10
|
+
/**
|
|
11
|
+
* Spanish DNI: 8 digits and the check letter for their value modulo 23
|
|
12
|
+
* (`12345678Z`). A space or hyphen before the letter is ignored. NIEs, the
|
|
13
|
+
* foreigners' IDs, are not DNIs and fail.
|
|
14
|
+
*/
|
|
15
|
+
function isValidEsDni(value) {
|
|
16
|
+
const dni = value.replace(/[\s-]/g, "").toUpperCase();
|
|
17
|
+
const match = /^([0-9]{8})([A-Z])$/.exec(dni);
|
|
18
|
+
if (!match) return false;
|
|
19
|
+
const [, digits, letter] = match;
|
|
20
|
+
return DNI_LETTERS[Number(digits) % 23] === letter;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/internal/forms/checks/fiPersonalIdentityCode.ts
|
|
24
|
+
const FI_CHECK_CHARACTERS = "0123456789ABCDEFHJKLMNPRSTUVWXY";
|
|
25
|
+
/** The first year of each century sign; the 2023 reform added Y-U and B-F. */
|
|
26
|
+
const FI_CENTURY = {
|
|
27
|
+
"+": 1800,
|
|
28
|
+
"-": 1900,
|
|
29
|
+
Y: 1900,
|
|
30
|
+
X: 1900,
|
|
31
|
+
W: 1900,
|
|
32
|
+
V: 1900,
|
|
33
|
+
U: 1900,
|
|
34
|
+
A: 2e3,
|
|
35
|
+
B: 2e3,
|
|
36
|
+
C: 2e3,
|
|
37
|
+
D: 2e3,
|
|
38
|
+
E: 2e3,
|
|
39
|
+
F: 2e3
|
|
40
|
+
};
|
|
41
|
+
const isLeapYear = (year) => year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
42
|
+
const daysInMonth = (year, month) => month === 2 ? isLeapYear(year) ? 29 : 28 : [
|
|
43
|
+
4,
|
|
44
|
+
6,
|
|
45
|
+
9,
|
|
46
|
+
11
|
|
47
|
+
].includes(month) ? 30 : 31;
|
|
48
|
+
/**
|
|
49
|
+
* Finnish personal identity code (henkilötunnus): `DDMMYY`, a century sign,
|
|
50
|
+
* a 3-digit individual number and a check character for the 9 digits modulo
|
|
51
|
+
* 31 (`131052-308T`). The date must exist.
|
|
52
|
+
*/
|
|
53
|
+
function isValidFiPersonalIdentityCode(value) {
|
|
54
|
+
const match = /^([0-9]{2})([0-9]{2})([0-9]{2})([-+A-FU-Y])([0-9]{3})([0-9A-Y])$/.exec(value.trim().toUpperCase());
|
|
55
|
+
if (!match) return false;
|
|
56
|
+
const [, dd, mm, yy, sign, individual, check] = match;
|
|
57
|
+
const year = FI_CENTURY[sign] + Number(yy);
|
|
58
|
+
const month = Number(mm);
|
|
59
|
+
const day = Number(dd);
|
|
60
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) return false;
|
|
61
|
+
return FI_CHECK_CHARACTERS[Number(`${dd}${mm}${yy}${individual}`) % 31] === check;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/internal/forms/checks/inDrivingLicenseNumber.ts
|
|
65
|
+
const IN_DRIVING_LICENSE_REGEX = /^[A-Z]{2}[-\s]?[0-9]{2}(?:[0-9]{2})?[-\s]?(?:19|20)[0-9]{2}[-\s]?[0-9]{7}$/i;
|
|
66
|
+
/**
|
|
67
|
+
* Indian driving licence number format, `SS-RR[RR]-YYYY-NNNNNNN`, with or
|
|
68
|
+
* without hyphens (`MH-12-2011-0012345`, `MH1220110012345`). Format only:
|
|
69
|
+
* the number has no check digit.
|
|
70
|
+
*/
|
|
71
|
+
function isValidInDrivingLicenseNumber(value) {
|
|
72
|
+
return IN_DRIVING_LICENSE_REGEX.test(value.trim());
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/internal/forms/checks/rut.ts
|
|
76
|
+
/**
|
|
77
|
+
* Chilean RUT/RUN: a 7- or 8-digit body and a check character, 0-9 or K,
|
|
78
|
+
* computed modulo 11. Dots, a hyphen and spaces are ignored
|
|
79
|
+
* (`12.345.678-5`, `12345678-5`, `123456785`).
|
|
80
|
+
*/
|
|
81
|
+
function isValidRut(value) {
|
|
82
|
+
const rut = value.replace(/[.\s-]/g, "").toUpperCase();
|
|
83
|
+
const match = /^([0-9]{7,8})([0-9K])$/.exec(rut);
|
|
84
|
+
if (!match) return false;
|
|
85
|
+
const [, body, check] = match;
|
|
86
|
+
let sum = 0;
|
|
87
|
+
let factor = 2;
|
|
88
|
+
for (let i = body.length - 1; i >= 0; i--) {
|
|
89
|
+
sum += Number(body[i]) * factor;
|
|
90
|
+
factor = factor === 7 ? 2 : factor + 1;
|
|
91
|
+
}
|
|
92
|
+
const rest = 11 - sum % 11;
|
|
93
|
+
return check === (rest === 11 ? "0" : rest === 10 ? "K" : String(rest));
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/internal/forms/checks/digitCount.ts
|
|
97
|
+
/** `digitCount`: only the digits 0-9, with a count in `lengths` or between `min` and `max`. */
|
|
98
|
+
function hasDigitCount(value, count) {
|
|
99
|
+
if (!/^[0-9]+$/.test(value)) return false;
|
|
100
|
+
const { length } = value;
|
|
101
|
+
if (count.lengths) return count.lengths.includes(length);
|
|
102
|
+
return (count.min === void 0 || length >= count.min) && (count.max === void 0 || length <= count.max);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The `digitCount` message: one length (`exactDigits`), a list of lengths
|
|
106
|
+
* (`digitsOneOf`), or a range (`digitsBetween`), with the counts as params.
|
|
107
|
+
*/
|
|
108
|
+
function digitCountError(count) {
|
|
109
|
+
if (count.lengths?.length === 1) return {
|
|
110
|
+
key: "verification.errors.exactDigits",
|
|
111
|
+
params: { length: count.lengths[0] }
|
|
112
|
+
};
|
|
113
|
+
if (count.lengths) return {
|
|
114
|
+
key: "verification.errors.digitsOneOf",
|
|
115
|
+
params: { lengths: [...count.lengths] }
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
key: "verification.errors.digitsBetween",
|
|
119
|
+
params: {
|
|
120
|
+
min: count.min ?? 0,
|
|
121
|
+
max: count.max ?? 0
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/internal/forms/checks/emailFormat.ts
|
|
127
|
+
/** One `@`, no whitespace, and a dot inside the domain. */
|
|
128
|
+
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
129
|
+
/** Whether a value has an email's shape: one `@`, no spaces, a dot in the domain. */
|
|
130
|
+
function isEmailFormat(value) {
|
|
131
|
+
return EMAIL_PATTERN.test(value);
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/internal/forms/checks/noPoBox.ts
|
|
135
|
+
const PO_BOX_PATTERN = /POBox|P\.O\.Box|pobox|postofficebox|postbox|po\.box|p\.o\.box/i;
|
|
136
|
+
/** Whether an address describes a P.O. box, ignoring whitespace and case. */
|
|
137
|
+
function isPoBox(address) {
|
|
138
|
+
return PO_BOX_PATTERN.test(address.replace(/\s/g, ""));
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/internal/forms/checks/charTemplate.ts
|
|
142
|
+
const escapeForPattern = (chars) => chars.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
143
|
+
/**
|
|
144
|
+
* `charTemplate`: the whole value matches one template, where `9` is a digit,
|
|
145
|
+
* `A` an uppercase letter A-Z and any other character stands for itself.
|
|
146
|
+
* `ignoreCase` also accepts lowercase letters and literals in either case.
|
|
147
|
+
*/
|
|
148
|
+
function matchesCharTemplate(value, templates, ignoreCase = false) {
|
|
149
|
+
return templates.some((template) => {
|
|
150
|
+
const pattern = [...template].map((char) => {
|
|
151
|
+
if (char === "9") return "[0-9]";
|
|
152
|
+
if (char === "A") return "[A-Z]";
|
|
153
|
+
return escapeForPattern(char);
|
|
154
|
+
}).join("");
|
|
155
|
+
return new RegExp(`^${pattern}$`, ignoreCase ? "iu" : "u").test(value);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/internal/forms/checks/maxAge.ts
|
|
160
|
+
/**
|
|
161
|
+
* `maxAge`: an ISO `YYYY-MM-DD` date of birth at most `years` full years
|
|
162
|
+
* before `today`, also ISO, in the user's calendar. As in SDK1, someone turns
|
|
163
|
+
* a year older on their birthday. A value that isn't an ISO date passes; the
|
|
164
|
+
* date input owns that.
|
|
165
|
+
*/
|
|
166
|
+
function isWithinMaxAge(value, today, years) {
|
|
167
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return true;
|
|
168
|
+
const [birthYear, birthMonthDay] = [value.slice(0, 4), value.slice(5)];
|
|
169
|
+
const [todayYear, todayMonthDay] = [today.slice(0, 4), today.slice(5)];
|
|
170
|
+
return Number(todayYear) - Number(birthYear) - (todayMonthDay < birthMonthDay ? 1 : 0) <= years;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/internal/forms/checks/nameCharacters.ts
|
|
174
|
+
const NAME_REGEX = /^[\p{L}\p{M} '’-]+$/u;
|
|
175
|
+
/** `nameCharacters`: letters from any script, spaces, hyphens and apostrophes. */
|
|
176
|
+
function hasNameCharacters(value) {
|
|
177
|
+
return NAME_REGEX.test(value);
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/internal/forms/checks/notFuture.ts
|
|
181
|
+
/**
|
|
182
|
+
* `notFuture`: an ISO `YYYY-MM-DD` date on or before `today`, also ISO, in
|
|
183
|
+
* the user's calendar. A value that isn't an ISO date passes; the date input
|
|
184
|
+
* owns that.
|
|
185
|
+
*/
|
|
186
|
+
function isNotFuture(value, today) {
|
|
187
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return true;
|
|
188
|
+
return value <= today;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/internal/forms/checks/numericRange.ts
|
|
192
|
+
/** `numericRange`: a whole number from `min` to `max`. */
|
|
193
|
+
function isInNumericRange(value, min, max) {
|
|
194
|
+
if (!/^-?[0-9]+$/.test(value)) return false;
|
|
195
|
+
const number = Number(value);
|
|
196
|
+
return number >= min && number <= max;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
8
199
|
//#region src/modules/ekyc/ekycValidators.ts
|
|
9
200
|
async function loadPhoneValidator() {
|
|
10
201
|
if (!await loadPhoneValidation()) throw new Error("Failed to load the phone validation rules");
|
|
@@ -25,11 +216,6 @@ function formatSSN(value) {
|
|
|
25
216
|
function cleanName(name) {
|
|
26
217
|
return (name ?? "").replace(/[^\p{L}\p{M}\s,'’´-]/gu, "").slice(0, 100);
|
|
27
218
|
}
|
|
28
|
-
const PO_BOX_REGEX = /POBox|P\.O\.Box|pobox|postofficebox|postbox|po\.box|p\.o\.box/i;
|
|
29
|
-
/** Returns true if the address looks like a P.O. Box */
|
|
30
|
-
function isPoBox(address) {
|
|
31
|
-
return PO_BOX_REGEX.test(address.replace(/\s/g, ""));
|
|
32
|
-
}
|
|
33
219
|
function validatePhone(phone, country) {
|
|
34
220
|
return getPhoneValidation()?.isValid(phone, country) ?? false;
|
|
35
221
|
}
|
|
@@ -42,24 +228,6 @@ const ONE_OF_REQUIRED_ERROR_KEY = "verification.errors.dobOrSsnRequired";
|
|
|
42
228
|
const oneOfRequiredErrorKey = (rule) => rule.message ?? "verification.errors.dobOrSsnRequired";
|
|
43
229
|
const PHONE_INVALID_KEY = "verification.errors.phoneInvalid";
|
|
44
230
|
const INVALID_ID_NUMBER_KEY = "verification.errors.invalidIdNumber";
|
|
45
|
-
/** The digitCount message: one length, a list of lengths, or a range. */
|
|
46
|
-
const digitCountError = (rule) => {
|
|
47
|
-
if (rule.lengths?.length === 1) return {
|
|
48
|
-
key: "verification.errors.exactDigits",
|
|
49
|
-
params: { length: rule.lengths[0] }
|
|
50
|
-
};
|
|
51
|
-
if (rule.lengths) return {
|
|
52
|
-
key: "verification.errors.digitsOneOf",
|
|
53
|
-
params: { lengths: rule.lengths }
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
key: "verification.errors.digitsBetween",
|
|
57
|
-
params: {
|
|
58
|
-
min: rule.min ?? 0,
|
|
59
|
-
max: rule.max ?? 0
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
231
|
/**
|
|
64
232
|
* A national ID check: blank passes, anything else must satisfy `isValid`.
|
|
65
233
|
* The error is the vocabulary's message for these rules; a definition names
|
|
@@ -72,14 +240,6 @@ const idNumberValidator = (isValid) => (value) => {
|
|
|
72
240
|
};
|
|
73
241
|
const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
|
|
74
242
|
const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
|
|
75
|
-
const EMAIL_FORMAT_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
76
|
-
const buildPostalCodeParams = (country) => {
|
|
77
|
-
const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
78
|
-
if (fixedLen !== void 0) return { length: fixedLen };
|
|
79
|
-
let maxLen = getPostalCodeMaxLength(country);
|
|
80
|
-
if (country === "US" || country === "BR") maxLen = maxLen - 1;
|
|
81
|
-
return { maxLength: maxLen };
|
|
82
|
-
};
|
|
83
243
|
const requiredError = (field) => {
|
|
84
244
|
const fieldName = field.displayLabel ?? field.label;
|
|
85
245
|
return fieldName ? {
|
|
@@ -128,7 +288,7 @@ const createValidators = () => {
|
|
|
128
288
|
if (validatePostalCode(value, rule.country)) return void 0;
|
|
129
289
|
return {
|
|
130
290
|
key: getPostalCodeErrorKey(rule.country),
|
|
131
|
-
params:
|
|
291
|
+
params: getPostalCodeErrorParams(rule.country)
|
|
132
292
|
};
|
|
133
293
|
},
|
|
134
294
|
phoneFormat: (value, rule) => {
|
|
@@ -139,7 +299,7 @@ const createValidators = () => {
|
|
|
139
299
|
},
|
|
140
300
|
emailFormat: (value) => {
|
|
141
301
|
if (value.trim().length === 0) return void 0;
|
|
142
|
-
return
|
|
302
|
+
return isEmailFormat(value) ? void 0 : { key: "verification.errors.emailInvalid" };
|
|
143
303
|
},
|
|
144
304
|
exactLength: (value, rule) => {
|
|
145
305
|
if (rule.type !== "exactLength") return void 0;
|