@incodetech/core 2.0.0 → 2.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actor-CI32dTbG.d.ts +2 -0
- package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
- package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
- package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
- package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
- package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
- package/dist/Manager-C8PrhBOx.d.ts +19 -0
- package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
- package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
- package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
- package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
- package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
- package/dist/ae-signature.d.ts +25 -0
- package/dist/ae-signature.esm.js +8 -0
- package/dist/antifraud.d.ts +57 -0
- package/dist/antifraud.esm.js +45 -0
- package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
- package/dist/api-CESGtpbH.esm.js +53 -0
- package/dist/authentication.d.ts +12 -0
- package/dist/authentication.esm.js +25 -0
- package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
- package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
- package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
- package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
- package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
- package/dist/camera-DBSxa6ML.d.ts +4 -0
- package/dist/camera-PA2Ljri3.esm.js +22 -0
- package/dist/camera.d.ts +15 -0
- package/dist/camera.esm.js +5 -0
- package/dist/chunk-CRF6K_H_.esm.js +49 -0
- package/dist/consent.d.ts +398 -0
- package/dist/consent.esm.js +79 -0
- package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
- package/dist/cpf-PPz2Njto.esm.js +38 -0
- package/dist/cpf-ocr.d.ts +204 -0
- package/dist/cpf-ocr.esm.js +177 -0
- package/dist/cross-document-data-match.d.ts +34 -0
- package/dist/cross-document-data-match.esm.js +71 -0
- package/dist/curp-validation.d.ts +188 -0
- package/dist/curp-validation.esm.js +110 -0
- package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
- package/dist/custom-fields.d.ts +115 -0
- package/dist/custom-fields.esm.js +177 -0
- package/dist/custom-watchlist.d.ts +66 -0
- package/dist/custom-watchlist.esm.js +86 -0
- package/dist/dateUtils-UoN5xswP.esm.js +23 -0
- package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
- package/dist/deepsightService-CEVxzehb.d.ts +412 -0
- package/dist/deepsightService-O74l4Y__.esm.js +489 -0
- package/dist/device.d.ts +46 -0
- package/dist/device.esm.js +106 -0
- package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
- package/dist/document-capture.d.ts +906 -0
- package/dist/document-capture.esm.js +156 -0
- package/dist/document-upload.d.ts +331 -0
- package/dist/document-upload.esm.js +203 -0
- package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
- package/dist/dynamic-forms.d.ts +178 -0
- package/dist/dynamic-forms.esm.js +323 -0
- package/dist/ekyb.d.ts +148 -0
- package/dist/ekyb.esm.js +127 -0
- package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
- package/dist/ekyc.d.ts +164 -0
- package/dist/ekyc.esm.js +104 -0
- package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
- package/dist/electronic-signature.d.ts +4 -0
- package/dist/electronic-signature.esm.js +7 -0
- package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
- package/dist/email.d.ts +4 -0
- package/dist/email.esm.js +9 -0
- package/dist/emailManager-DIfnS5g1.d.ts +352 -0
- package/dist/emailManager-wAV0LE-H.esm.js +238 -0
- package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
- package/dist/endpoints-CnN3SyDa.esm.js +87 -0
- package/dist/events-D6-e4vok.esm.js +596 -0
- package/dist/events.d.ts +265 -0
- package/dist/events.esm.js +4 -0
- package/dist/extensibility.d.ts +122 -0
- package/dist/extensibility.esm.js +43 -0
- package/dist/face-match.d.ts +228 -0
- package/dist/face-match.esm.js +173 -0
- package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
- package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
- package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
- package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
- package/dist/flow-events.d.ts +6 -0
- package/dist/flow-events.esm.js +0 -0
- package/dist/flow.d.ts +358 -0
- package/dist/flow.esm.js +825 -0
- package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
- package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
- package/dist/flowServices-DG3IdWw6.esm.js +188 -0
- package/dist/geolocation.d.ts +127 -0
- package/dist/geolocation.esm.js +89 -0
- package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
- package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
- package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
- package/dist/government-validation.d.ts +67 -0
- package/dist/government-validation.esm.js +81 -0
- package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
- package/dist/home.d.ts +99 -0
- package/dist/home.esm.js +61 -0
- package/dist/http.d.ts +68 -0
- package/dist/http.esm.js +3 -0
- package/dist/id-ocr.d.ts +635 -0
- package/dist/id-ocr.esm.js +86 -0
- package/dist/id-verification.d.ts +190 -0
- package/dist/id-verification.esm.js +43 -0
- package/dist/id.d.ts +24 -0
- package/dist/id.esm.js +164 -0
- package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
- package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
- package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
- package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
- package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
- package/dist/identity-reuse.d.ts +530 -0
- package/dist/identity-reuse.esm.js +274 -0
- package/dist/index-BcRG8rtJ.d.ts +97 -0
- package/dist/index-DZoqeAo9.d.ts +1177 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +12 -0
- package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
- package/dist/lib-BB0B_qQX.esm.js +12499 -0
- package/dist/mandatory-consent.d.ts +412 -0
- package/dist/mandatory-consent.esm.js +78 -0
- package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
- package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
- package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
- package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
- package/dist/phone.d.ts +4 -0
- package/dist/phone.esm.js +9 -0
- package/dist/phoneManager-B6M30hKE.d.ts +397 -0
- package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
- package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
- package/dist/platform-CfrjKhmi.esm.js +83 -0
- package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
- package/dist/qe-signature.d.ts +25 -0
- package/dist/qe-signature.esm.js +8 -0
- package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
- package/dist/redirect-to-mobile.d.ts +107 -0
- package/dist/redirect-to-mobile.esm.js +102 -0
- package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
- package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
- package/dist/selfie.d.ts +26 -0
- package/dist/selfie.esm.js +146 -0
- package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
- package/dist/selfieManager-Duisl7qN.esm.js +60 -0
- package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
- package/dist/session-CGtQJJzB.esm.js +3206 -0
- package/dist/session.d.ts +217 -0
- package/dist/session.esm.js +9 -0
- package/dist/setup-C5AITV8m.d.ts +254 -0
- package/dist/setup-DsM8IG7k.esm.js +887 -0
- package/dist/signature.d.ts +94 -0
- package/dist/signature.esm.js +66 -0
- package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
- package/dist/stats-CIfiPzb1.esm.js +16 -0
- package/dist/stats.d.ts +16 -0
- package/dist/stats.esm.js +4 -0
- package/dist/trust-graph.d.ts +54 -0
- package/dist/trust-graph.esm.js +56 -0
- package/dist/types-B06Ypu2F.d.ts +49 -0
- package/dist/types-BP1m8VRw.d.ts +340 -0
- package/dist/types-CAD4va6a.d.ts +5 -0
- package/dist/types-CFV9G_7j.d.ts +24 -0
- package/dist/warmup-CEcppFiS.d.ts +63 -0
- package/dist/wasm.d.ts +15 -0
- package/dist/wasm.esm.js +12 -0
- package/dist/watchlist-for-business.d.ts +79 -0
- package/dist/watchlist-for-business.esm.js +148 -0
- package/dist/watchlist.d.ts +62 -0
- package/dist/watchlist.esm.js +86 -0
- package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
- package/dist/workflow.d.ts +907 -0
- package/dist/workflow.esm.js +702 -0
- package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
- package/package.json +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
+
import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
|
|
3
|
+
import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/face-match/faceMatchServices.ts
|
|
6
|
+
/**
|
|
7
|
+
* Fetches cropped face images from the backend.
|
|
8
|
+
*/
|
|
9
|
+
async function fetchFaceMatchImages(signal) {
|
|
10
|
+
const res = await api.post(endpoints.getImagesV2, { images: [
|
|
11
|
+
"croppedFace",
|
|
12
|
+
"croppedIDFace",
|
|
13
|
+
"croppedAuthenticationSelfie"
|
|
14
|
+
] }, { signal });
|
|
15
|
+
if (!res.ok) throw new Error(`POST ${endpoints.getImagesV2} failed: ${res.status} ${res.statusText}`);
|
|
16
|
+
const data = res.data;
|
|
17
|
+
return {
|
|
18
|
+
idFace: data.croppedIDFace ?? null,
|
|
19
|
+
selfie: data.croppedFace ?? data.croppedAuthenticationSelfie ?? null,
|
|
20
|
+
secondIdFace: void 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetches face recognition score from the backend.
|
|
25
|
+
*/
|
|
26
|
+
async function fetchScore(signal) {
|
|
27
|
+
const res = await api.get(endpoints.getScore, { signal });
|
|
28
|
+
if (!res.ok) throw new Error(`GET ${endpoints.getScore} failed: ${res.status} ${res.statusText}`);
|
|
29
|
+
const data = res.data;
|
|
30
|
+
return {
|
|
31
|
+
matched: data.faceRecognition?.overall?.status === "OK" ? true : data.faceRecognition?.overall?.status === "FAIL" ? false : null,
|
|
32
|
+
liveness: data.deepsight ? data.deepsight.multimodalIntelligence?.overall?.status === "OK" : data.liveness?.overall?.status === "OK"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fetches second ID face images from the backend.
|
|
37
|
+
*/
|
|
38
|
+
async function fetchSecondIdImages(signal) {
|
|
39
|
+
const res = await api.post(endpoints.getImagesSecondId, { images: ["croppedIDFace"] }, { signal });
|
|
40
|
+
if (!res.ok) throw new Error(`POST ${endpoints.getImagesSecondId} failed: ${res.status} ${res.statusText}`);
|
|
41
|
+
return { secondIdFace: res.data.croppedIDFace ?? null };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fetches all face match data in parallel (images, score, and optionally second ID images).
|
|
45
|
+
*/
|
|
46
|
+
async function fetchFaceMatchData(config, signal) {
|
|
47
|
+
const promises = [fetchFaceMatchImages(signal), fetchScore(signal)];
|
|
48
|
+
if (config.matchingType === "secondId") promises.push(fetchSecondIdImages(signal));
|
|
49
|
+
const [imagesRes, resultRes, secondIdRes] = await Promise.all(promises);
|
|
50
|
+
return {
|
|
51
|
+
images: {
|
|
52
|
+
...imagesRes,
|
|
53
|
+
secondIdFace: secondIdRes?.secondIdFace ?? null
|
|
54
|
+
},
|
|
55
|
+
result: resultRes
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/modules/face-match/faceMatchStateMachine.ts
|
|
61
|
+
const faceMatchMachine = setup({
|
|
62
|
+
types: {
|
|
63
|
+
context: {},
|
|
64
|
+
events: {},
|
|
65
|
+
input: {}
|
|
66
|
+
},
|
|
67
|
+
actors: { fetchData: fromPromise(async ({ input, signal }) => {
|
|
68
|
+
return fetchFaceMatchData(input.config, signal);
|
|
69
|
+
}) },
|
|
70
|
+
actions: {
|
|
71
|
+
setData: assign(({ event }) => {
|
|
72
|
+
const output = event.output;
|
|
73
|
+
return {
|
|
74
|
+
images: output.images,
|
|
75
|
+
result: output.result
|
|
76
|
+
};
|
|
77
|
+
}),
|
|
78
|
+
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
79
|
+
clearError: assign({ error: () => void 0 }),
|
|
80
|
+
resetContext: assign(({ context }) => ({
|
|
81
|
+
config: context.config,
|
|
82
|
+
images: null,
|
|
83
|
+
result: null,
|
|
84
|
+
error: void 0
|
|
85
|
+
}))
|
|
86
|
+
},
|
|
87
|
+
guards: { isAnimationDisabled: ({ context }) => context.config.disableFaceMatchAnimation === true }
|
|
88
|
+
}).createMachine({
|
|
89
|
+
id: "faceMatch",
|
|
90
|
+
initial: "idle",
|
|
91
|
+
context: ({ input }) => ({
|
|
92
|
+
config: input.config,
|
|
93
|
+
images: null,
|
|
94
|
+
result: null,
|
|
95
|
+
error: void 0
|
|
96
|
+
}),
|
|
97
|
+
states: {
|
|
98
|
+
idle: { on: { LOAD: { target: "loading" } } },
|
|
99
|
+
loading: { invoke: {
|
|
100
|
+
id: "fetchData",
|
|
101
|
+
src: "fetchData",
|
|
102
|
+
input: ({ context }) => ({ config: context.config }),
|
|
103
|
+
onDone: [{
|
|
104
|
+
target: "finished",
|
|
105
|
+
guard: "isAnimationDisabled",
|
|
106
|
+
actions: "setData"
|
|
107
|
+
}, {
|
|
108
|
+
target: "animating",
|
|
109
|
+
actions: "setData"
|
|
110
|
+
}],
|
|
111
|
+
onError: {
|
|
112
|
+
target: "error",
|
|
113
|
+
actions: "setError"
|
|
114
|
+
}
|
|
115
|
+
} },
|
|
116
|
+
animating: { on: { ANIMATION_COMPLETE: { target: "result" } } },
|
|
117
|
+
result: { on: { CONTINUE: { target: "finished" } } },
|
|
118
|
+
finished: { type: "final" },
|
|
119
|
+
error: { on: { RESET: {
|
|
120
|
+
target: "idle",
|
|
121
|
+
actions: "resetContext"
|
|
122
|
+
} } }
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
export { faceMatchMachine as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./camera-DBSxa6ML.js";
|
|
2
|
+
import "./types-CFV9G_7j.js";
|
|
3
|
+
import "./types-BP1m8VRw.js";
|
|
4
|
+
import "./flowCompletionService-DhkT4SRY.js";
|
|
5
|
+
import { a as FlowEventListener, c as FlowModuleStartedEvent, i as FlowEvent, l as FlowReadyEvent, n as FlowCompletedEvent, o as FlowEventSubscribable, r as FlowErrorEvent, s as FlowModuleCompletedEvent, t as FlowClosedEvent, u as FlowStartedEvent } from "./index-BcRG8rtJ.js";
|
|
6
|
+
export { FlowClosedEvent, FlowCompletedEvent, FlowErrorEvent, FlowEvent, FlowEventListener, FlowEventSubscribable, FlowModuleCompletedEvent, FlowModuleStartedEvent, FlowReadyEvent, FlowStartedEvent };
|
|
File without changes
|
package/dist/flow.d.ts
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { n as WasmPipeline } from "./warmup-CEcppFiS.js";
|
|
2
|
+
import { t as Manager } from "./Manager-C8PrhBOx.js";
|
|
3
|
+
import { t as AnyStateMachine } from "./StateMachine-BCQrZJhf.js";
|
|
4
|
+
import "./camera-DBSxa6ML.js";
|
|
5
|
+
import "./types-CFV9G_7j.js";
|
|
6
|
+
import { i as FlowModuleConfig, n as Flow, r as FlowModule } from "./types-BP1m8VRw.js";
|
|
7
|
+
import { n as GetFinishStatusFn, t as FinishStatus } from "./flowCompletionService-DhkT4SRY.js";
|
|
8
|
+
import { o as FlowEventSubscribable } from "./index-BcRG8rtJ.js";
|
|
9
|
+
import { n as ModuleRegistry } from "./types-B06Ypu2F.js";
|
|
10
|
+
import * as xstate651 from "xstate";
|
|
11
|
+
|
|
12
|
+
//#region src/modules/flow/flowUtils.d.ts
|
|
13
|
+
type NormalizeFlowModulesOptions = {
|
|
14
|
+
isDesktop?: boolean;
|
|
15
|
+
authHint?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
useCPF?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type FlowForNormalization = Pick<Flow, 'flowId' | 'flowModules' | 'redirectDesktopToMobile' | 'disableSmsOption' | 'addContinueToDesktop' | 'qrPhishingResistance'>;
|
|
20
|
+
/**
|
|
21
|
+
* Analyzes a flow configuration and returns the WASM pipelines needed.
|
|
22
|
+
* Use this to conditionally warmup WASM only when required by the flow.
|
|
23
|
+
*
|
|
24
|
+
* Modules with `onDeviceFaceResultsSubmissionEnabled: true` (currently SELFIE
|
|
25
|
+
* and AUTHENTICATION) select the 6-model `'onDeviceSelfie'` bundle instead of
|
|
26
|
+
* the default 4-model `'selfie'` bundle.
|
|
27
|
+
*
|
|
28
|
+
* @param flow - The flow configuration from /omni/onboarding/flow
|
|
29
|
+
* @returns Array of WASM pipelines needed (e.g., ['selfie', 'idCapture'])
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const pipelines = getRequiredWasmPipelines(flow);
|
|
34
|
+
* if (pipelines.length > 0) {
|
|
35
|
+
* warmupWasm({ ...wasmConfig, pipelines });
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function getRequiredWasmPipelines(flow: Flow): WasmPipeline[];
|
|
40
|
+
/**
|
|
41
|
+
* Normalizes flow modules by expanding TUTORIAL_ID into ID + SECOND_ID
|
|
42
|
+
* based on configuration flags. Matches legacy flowService behavior.
|
|
43
|
+
*
|
|
44
|
+
* - TUTORIAL_ID becomes ID (with same config)
|
|
45
|
+
* - If secondId: true, adds SECOND_ID module with isSecondId: true
|
|
46
|
+
* - thirdId is deprecated and ignored; the flow continues to the next step
|
|
47
|
+
* - Bare ID following TUTORIAL_ID is dropped (already merged)
|
|
48
|
+
*/
|
|
49
|
+
declare function normalizeFlowModules(flow: FlowForNormalization, options?: NormalizeFlowModulesOptions): FlowModule[];
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/modules/flow/flowServices.d.ts
|
|
52
|
+
type GetFlowOptions = {
|
|
53
|
+
isDesktop?: boolean;
|
|
54
|
+
authHint?: string;
|
|
55
|
+
lang?: string;
|
|
56
|
+
useCPF?: boolean;
|
|
57
|
+
};
|
|
58
|
+
type GetFlow = (signal: AbortSignal, options?: GetFlowOptions) => Promise<Flow>;
|
|
59
|
+
declare const getFlow: GetFlow;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/modules/flow/noOpFlowModuleMachine.d.ts
|
|
62
|
+
declare const noOpFlowModuleMachine: xstate651.StateMachine<xstate651.MachineContext, xstate651.AnyEventObject, {}, never, never, never, never, "finished", string, xstate651.NonReducibleUnknown, xstate651.NonReducibleUnknown, xstate651.EventObject, xstate651.MetaObject, {
|
|
63
|
+
readonly id: "noOpFlowModule";
|
|
64
|
+
readonly initial: "finished";
|
|
65
|
+
readonly states: {
|
|
66
|
+
readonly finished: {
|
|
67
|
+
readonly type: "final";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/modules/flow/flowActor.d.ts
|
|
73
|
+
type CreateFlowActorOptions = {
|
|
74
|
+
getFlow?: GetFlow;
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/modules/flow/flowManager.d.ts
|
|
78
|
+
/** Flow manager is waiting to be started */
|
|
79
|
+
type FlowIdleState = {
|
|
80
|
+
status: 'idle';
|
|
81
|
+
};
|
|
82
|
+
/** Flow is being fetched from the server */
|
|
83
|
+
type FlowLoadingState = {
|
|
84
|
+
status: 'loading';
|
|
85
|
+
};
|
|
86
|
+
/** Flow is loaded and ready for navigation */
|
|
87
|
+
type FlowReadyState = {
|
|
88
|
+
status: 'ready';
|
|
89
|
+
/** The complete flow configuration from the server */
|
|
90
|
+
flow: Flow;
|
|
91
|
+
/** Array of module keys in order */
|
|
92
|
+
steps: string[];
|
|
93
|
+
/** Zero-based index of the current step */
|
|
94
|
+
currentStepIndex: number;
|
|
95
|
+
/** The module key of the current step (e.g., 'SELFIE', 'ID', 'FACE_MATCH') */
|
|
96
|
+
currentStep: string | undefined;
|
|
97
|
+
/** The configuration object for the current module. Type varies by module. */
|
|
98
|
+
config: unknown;
|
|
99
|
+
};
|
|
100
|
+
/** All steps have been completed */
|
|
101
|
+
type FlowFinishedState = {
|
|
102
|
+
status: 'finished';
|
|
103
|
+
/** The complete flow configuration */
|
|
104
|
+
flow: Flow;
|
|
105
|
+
};
|
|
106
|
+
/** An error occurred while loading or processing the flow */
|
|
107
|
+
type FlowErrorState = {
|
|
108
|
+
status: 'error';
|
|
109
|
+
/** The error message */
|
|
110
|
+
error: string;
|
|
111
|
+
};
|
|
112
|
+
/** Union of all possible flow states */
|
|
113
|
+
type FlowState = FlowIdleState | FlowLoadingState | FlowReadyState | FlowFinishedState | FlowErrorState;
|
|
114
|
+
/**
|
|
115
|
+
* Creates a flow manager instance for managing onboarding flow state and navigation.
|
|
116
|
+
*
|
|
117
|
+
* The flow manager provides:
|
|
118
|
+
* - State management with statuses: `idle`, `loading`, `ready`, `finished`, `error`
|
|
119
|
+
* - Step navigation with `nextStep()` and `prevStep()`
|
|
120
|
+
* - Current step info via `state.currentStep` and `state.config` when in `ready` state
|
|
121
|
+
* - Module configuration lookup via `getModuleConfig()`
|
|
122
|
+
*
|
|
123
|
+
* @param options - Optional configuration for the flow actor
|
|
124
|
+
* @param options.getFlow - Custom function to fetch flow data. Defaults to `getOnboardingFlow`
|
|
125
|
+
* @returns A manager instance with state subscription, API methods, and lifecycle controls
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const flowManager = createFlowManager();
|
|
130
|
+
*
|
|
131
|
+
* flowManager.subscribe((state) => {
|
|
132
|
+
* if (state.status === 'ready') {
|
|
133
|
+
* console.log(state.currentStep, state.config);
|
|
134
|
+
* }
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* flowManager.load({ token: 'session-token' });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function createFlowManager(options?: CreateFlowActorOptions): Manager<FlowState> & {
|
|
141
|
+
/**
|
|
142
|
+
* Loads the flow from the server.
|
|
143
|
+
* Transitions the state from `idle` to `loading`, then to `ready` on success or `error` on failure.
|
|
144
|
+
* Requires setup() to have been called with a token first.
|
|
145
|
+
*/
|
|
146
|
+
load(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Cancels the current loading operation and returns to `idle` state.
|
|
149
|
+
* Only effective when in `loading` state.
|
|
150
|
+
*/
|
|
151
|
+
cancel(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Resets the flow manager to its initial `idle` state.
|
|
154
|
+
* Can be called from `ready`, `finished`, or `error` states.
|
|
155
|
+
*/
|
|
156
|
+
reset(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Advances to the next step in the flow.
|
|
159
|
+
* If on the last step, transitions to `finished` state.
|
|
160
|
+
* Only effective when in `ready` state.
|
|
161
|
+
*/
|
|
162
|
+
nextStep(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Goes back to the previous step in the flow.
|
|
165
|
+
* Does nothing if already on the first step.
|
|
166
|
+
* Only effective when in `ready` state.
|
|
167
|
+
*/
|
|
168
|
+
prevStep(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Whether the flow can advance to the next step.
|
|
171
|
+
* Returns `true` if in `ready` state and not on the last step.
|
|
172
|
+
*/
|
|
173
|
+
readonly canNext: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Whether the flow can go back to the previous step.
|
|
176
|
+
* Returns `true` if in `ready` state and not on the first step.
|
|
177
|
+
*/
|
|
178
|
+
readonly canPrev: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Gets the configuration for a specific module by its key.
|
|
181
|
+
* Useful for accessing config of modules other than the current one.
|
|
182
|
+
* @param moduleKey - The unique key identifier of the module
|
|
183
|
+
* @returns The module configuration or `undefined` if not found or not in `ready` state
|
|
184
|
+
*/
|
|
185
|
+
getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Checks if a module is enabled in the current flow.
|
|
188
|
+
* @param moduleKey - The unique key identifier of the module
|
|
189
|
+
* @returns `true` if the module exists in the flow, `false` otherwise or if not in `ready` state
|
|
190
|
+
*/
|
|
191
|
+
isModuleEnabled: (moduleKey: string) => boolean;
|
|
192
|
+
} & FlowEventSubscribable;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/modules/flow/moduleLoader.d.ts
|
|
195
|
+
type LazyModule<T$1> = () => Promise<T$1>;
|
|
196
|
+
type ModuleLoaderRegistry = {
|
|
197
|
+
[key: string]: LazyModule<{
|
|
198
|
+
default: unknown;
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
interface ModuleLoader {
|
|
202
|
+
load<T$1>(moduleKey: string): Promise<T$1>;
|
|
203
|
+
prefetch(moduleKey: string): void;
|
|
204
|
+
isLoaded(moduleKey: string): boolean;
|
|
205
|
+
}
|
|
206
|
+
declare function createModuleLoader(registry: ModuleLoaderRegistry): ModuleLoader;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/modules/flow/orchestratedFlowStateMachine.d.ts
|
|
209
|
+
type GetFlowFn = (signal: AbortSignal) => Promise<Flow>;
|
|
210
|
+
type LazyModuleRegistry = {
|
|
211
|
+
[key: string]: (() => Promise<AnyStateMachine | {
|
|
212
|
+
default: AnyStateMachine;
|
|
213
|
+
}>) | undefined;
|
|
214
|
+
};
|
|
215
|
+
type OrchestratedFlowInput = {
|
|
216
|
+
getFlow: GetFlowFn;
|
|
217
|
+
modules?: ModuleRegistry;
|
|
218
|
+
lazyModules?: LazyModuleRegistry;
|
|
219
|
+
getFinishStatus?: GetFinishStatusFn;
|
|
220
|
+
enableHome?: boolean;
|
|
221
|
+
};
|
|
222
|
+
type OrchestratedFlowEvent = {
|
|
223
|
+
type: 'LOAD';
|
|
224
|
+
} | {
|
|
225
|
+
type: 'CANCEL';
|
|
226
|
+
} | {
|
|
227
|
+
type: 'RESET';
|
|
228
|
+
} | {
|
|
229
|
+
type: 'MODULE_COMPLETE';
|
|
230
|
+
} | {
|
|
231
|
+
type: 'COMPLETE_FLOW';
|
|
232
|
+
} | {
|
|
233
|
+
type: 'HOME_CONTINUE';
|
|
234
|
+
} | {
|
|
235
|
+
type: '*';
|
|
236
|
+
[key: string]: unknown;
|
|
237
|
+
} | {
|
|
238
|
+
type: string;
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
};
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/modules/flow/orchestratedFlowManager.d.ts
|
|
243
|
+
type OrchestratedFlowHomeScreen = {
|
|
244
|
+
visible: boolean;
|
|
245
|
+
isContinueLoading: boolean;
|
|
246
|
+
};
|
|
247
|
+
type OrchestratedFlowPresentation = {
|
|
248
|
+
isAwaitingReady: boolean;
|
|
249
|
+
lazyModuleKey: string | undefined;
|
|
250
|
+
shouldPrefetchHome: boolean;
|
|
251
|
+
};
|
|
252
|
+
type OrchestratedFlowIdleState = {
|
|
253
|
+
status: 'idle';
|
|
254
|
+
homeScreen: OrchestratedFlowHomeScreen;
|
|
255
|
+
presentation: OrchestratedFlowPresentation;
|
|
256
|
+
};
|
|
257
|
+
type OrchestratedFlowLoadingState = {
|
|
258
|
+
status: 'loading';
|
|
259
|
+
homeScreen: OrchestratedFlowHomeScreen;
|
|
260
|
+
presentation: OrchestratedFlowPresentation;
|
|
261
|
+
};
|
|
262
|
+
type OrchestratedFlowReadyState = {
|
|
263
|
+
status: 'ready';
|
|
264
|
+
flow: Flow;
|
|
265
|
+
steps: string[];
|
|
266
|
+
currentStepIndex: number;
|
|
267
|
+
currentStep: string | undefined;
|
|
268
|
+
config: unknown;
|
|
269
|
+
moduleState: unknown;
|
|
270
|
+
homeScreen: OrchestratedFlowHomeScreen;
|
|
271
|
+
presentation: OrchestratedFlowPresentation;
|
|
272
|
+
};
|
|
273
|
+
type OrchestratedFlowFinishedState = {
|
|
274
|
+
status: 'finished';
|
|
275
|
+
flow: Flow;
|
|
276
|
+
finishStatus: {
|
|
277
|
+
redirectionUrl: string;
|
|
278
|
+
action: 'approved' | 'rejected' | 'none';
|
|
279
|
+
scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
|
|
280
|
+
};
|
|
281
|
+
homeScreen: OrchestratedFlowHomeScreen;
|
|
282
|
+
presentation: OrchestratedFlowPresentation;
|
|
283
|
+
};
|
|
284
|
+
type OrchestratedFlowErrorState = {
|
|
285
|
+
status: 'error';
|
|
286
|
+
error: string;
|
|
287
|
+
errorCode?: number;
|
|
288
|
+
homeScreen: OrchestratedFlowHomeScreen;
|
|
289
|
+
presentation: OrchestratedFlowPresentation;
|
|
290
|
+
};
|
|
291
|
+
type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState;
|
|
292
|
+
type CreateOrchestratedFlowActorOptions = {
|
|
293
|
+
getFlow?: GetFlowFn;
|
|
294
|
+
modules?: ModuleRegistry;
|
|
295
|
+
lazyModules?: LazyModuleRegistry;
|
|
296
|
+
getFinishStatus?: OrchestratedFlowInput['getFinishStatus'];
|
|
297
|
+
enableHome?: boolean;
|
|
298
|
+
};
|
|
299
|
+
declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager<OrchestratedFlowState> & {
|
|
300
|
+
/**
|
|
301
|
+
* Start loading the flow configuration from the backend.
|
|
302
|
+
*/
|
|
303
|
+
load(): void;
|
|
304
|
+
/**
|
|
305
|
+
* Cancel an in-progress flow load.
|
|
306
|
+
*/
|
|
307
|
+
cancel(): void;
|
|
308
|
+
/**
|
|
309
|
+
* Reset the flow to its initial idle state.
|
|
310
|
+
*/
|
|
311
|
+
reset(): void;
|
|
312
|
+
/**
|
|
313
|
+
* Signal that the current module has completed successfully.
|
|
314
|
+
* Call this from your UI component's `onFinish` callback.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```tsx
|
|
318
|
+
* <Phone
|
|
319
|
+
* config={config}
|
|
320
|
+
* onFinish={() => flowManager.completeModule()}
|
|
321
|
+
* />
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
completeModule(): void;
|
|
325
|
+
/**
|
|
326
|
+
* Skip all remaining modules and go straight to the completion step.
|
|
327
|
+
* Used when the flow was completed externally (e.g. via redirect to mobile).
|
|
328
|
+
*/
|
|
329
|
+
completeFlow(): void;
|
|
330
|
+
/**
|
|
331
|
+
* Signal that the current module encountered an error.
|
|
332
|
+
* Call this from your UI component's `onError` callback if you want
|
|
333
|
+
* the flow to transition to an error state.
|
|
334
|
+
*
|
|
335
|
+
* @param error - Error message describing what went wrong
|
|
336
|
+
*/
|
|
337
|
+
errorModule(error: string): void;
|
|
338
|
+
/**
|
|
339
|
+
* Send a raw event to the flow state machine.
|
|
340
|
+
* Prefer using the typed methods (completeModule, errorModule) when possible.
|
|
341
|
+
*/
|
|
342
|
+
send(event: OrchestratedFlowEvent): void;
|
|
343
|
+
readonly canNext: boolean;
|
|
344
|
+
getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
|
|
345
|
+
isModuleEnabled: (moduleKey: string) => boolean;
|
|
346
|
+
isAwaitingOrchestratorReady(): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Resolve once the orchestrator has finished loading the flow and the first
|
|
349
|
+
* module is ready to render. Useful for gating an initialization spinner
|
|
350
|
+
* alongside other parallel async work (e.g. theme fetching).
|
|
351
|
+
*/
|
|
352
|
+
waitForReady(): Promise<void>;
|
|
353
|
+
getLazyModuleKey(): string | undefined;
|
|
354
|
+
shouldRenderHomeScreen(): boolean;
|
|
355
|
+
continueFromHome(): Promise<void>;
|
|
356
|
+
} & FlowEventSubscribable;
|
|
357
|
+
//#endregion
|
|
358
|
+
export { type FinishStatus, type Flow, type FlowModule, type FlowModuleConfig, type FlowReadyState, type FlowState, type LazyModule, type LazyModuleRegistry, type ModuleLoader, type ModuleLoaderRegistry, type ModuleRegistry, type OrchestratedFlowFinishedState, type OrchestratedFlowHomeScreen, type OrchestratedFlowInput, type OrchestratedFlowPresentation, type OrchestratedFlowReadyState, type OrchestratedFlowState, createFlowManager, createModuleLoader, createOrchestratedFlowManager, getFlow, getRequiredWasmPipelines, noOpFlowModuleMachine, normalizeFlowModules };
|