@incodetech/core 2.0.0-rc.0 → 2.0.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/package.json +3 -3
- package/dist/Actor-CI32dTbG.d.ts +0 -2
- package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
- package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
- package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
- package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
- package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
- package/dist/Manager-C8PrhBOx.d.ts +0 -19
- package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
- package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
- package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
- package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
- package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
- package/dist/ae-signature.d.ts +0 -25
- package/dist/ae-signature.esm.js +0 -8
- package/dist/antifraud.d.ts +0 -57
- package/dist/antifraud.esm.js +0 -45
- package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
- package/dist/api-CESGtpbH.esm.js +0 -53
- package/dist/authentication.d.ts +0 -12
- package/dist/authentication.esm.js +0 -25
- package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
- package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
- package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
- package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
- package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
- package/dist/camera-DBSxa6ML.d.ts +0 -4
- package/dist/camera-PA2Ljri3.esm.js +0 -22
- package/dist/camera.d.ts +0 -15
- package/dist/camera.esm.js +0 -5
- package/dist/chunk-CRF6K_H_.esm.js +0 -49
- package/dist/consent.d.ts +0 -398
- package/dist/consent.esm.js +0 -79
- package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
- package/dist/cpf-PPz2Njto.esm.js +0 -38
- package/dist/cpf-ocr.d.ts +0 -204
- package/dist/cpf-ocr.esm.js +0 -177
- package/dist/cross-document-data-match.d.ts +0 -34
- package/dist/cross-document-data-match.esm.js +0 -71
- package/dist/curp-validation.d.ts +0 -188
- package/dist/curp-validation.esm.js +0 -110
- package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
- package/dist/custom-fields.d.ts +0 -115
- package/dist/custom-fields.esm.js +0 -177
- package/dist/custom-watchlist.d.ts +0 -66
- package/dist/custom-watchlist.esm.js +0 -86
- package/dist/dateUtils-UoN5xswP.esm.js +0 -23
- package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
- package/dist/deepsightService-CEVxzehb.d.ts +0 -412
- package/dist/deepsightService-O74l4Y__.esm.js +0 -489
- package/dist/device.d.ts +0 -46
- package/dist/device.esm.js +0 -106
- package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
- package/dist/document-capture.d.ts +0 -906
- package/dist/document-capture.esm.js +0 -156
- package/dist/document-upload.d.ts +0 -331
- package/dist/document-upload.esm.js +0 -203
- package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
- package/dist/dynamic-forms.d.ts +0 -178
- package/dist/dynamic-forms.esm.js +0 -323
- package/dist/ekyb.d.ts +0 -148
- package/dist/ekyb.esm.js +0 -127
- package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
- package/dist/ekyc.d.ts +0 -164
- package/dist/ekyc.esm.js +0 -104
- package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
- package/dist/electronic-signature.d.ts +0 -4
- package/dist/electronic-signature.esm.js +0 -7
- package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
- package/dist/email.d.ts +0 -4
- package/dist/email.esm.js +0 -9
- package/dist/emailManager-DIfnS5g1.d.ts +0 -352
- package/dist/emailManager-wAV0LE-H.esm.js +0 -238
- package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
- package/dist/endpoints-CnN3SyDa.esm.js +0 -87
- package/dist/events-D6-e4vok.esm.js +0 -596
- package/dist/events.d.ts +0 -265
- package/dist/events.esm.js +0 -4
- package/dist/extensibility.d.ts +0 -122
- package/dist/extensibility.esm.js +0 -43
- package/dist/face-match.d.ts +0 -228
- package/dist/face-match.esm.js +0 -173
- package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
- package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
- package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
- package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
- package/dist/flow-events.d.ts +0 -6
- package/dist/flow-events.esm.js +0 -0
- package/dist/flow.d.ts +0 -358
- package/dist/flow.esm.js +0 -825
- package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
- package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
- package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
- package/dist/geolocation.d.ts +0 -127
- package/dist/geolocation.esm.js +0 -89
- package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
- package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
- package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
- package/dist/government-validation.d.ts +0 -67
- package/dist/government-validation.esm.js +0 -81
- package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
- package/dist/home.d.ts +0 -99
- package/dist/home.esm.js +0 -61
- package/dist/http.d.ts +0 -68
- package/dist/http.esm.js +0 -3
- package/dist/id-ocr.d.ts +0 -635
- package/dist/id-ocr.esm.js +0 -86
- package/dist/id-verification.d.ts +0 -190
- package/dist/id-verification.esm.js +0 -43
- package/dist/id.d.ts +0 -24
- package/dist/id.esm.js +0 -164
- package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
- package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
- package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
- package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
- package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
- package/dist/identity-reuse.d.ts +0 -530
- package/dist/identity-reuse.esm.js +0 -274
- package/dist/index-BLKtMA0g.d.ts +0 -1177
- package/dist/index-BcRG8rtJ.d.ts +0 -97
- package/dist/index.d.ts +0 -3
- package/dist/index.esm.js +0 -12
- package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
- package/dist/lib-BB0B_qQX.esm.js +0 -12499
- package/dist/mandatory-consent.d.ts +0 -412
- package/dist/mandatory-consent.esm.js +0 -78
- package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
- package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
- package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
- package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
- package/dist/phone.d.ts +0 -4
- package/dist/phone.esm.js +0 -9
- package/dist/phoneManager-B6M30hKE.d.ts +0 -397
- package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
- package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
- package/dist/platform-CfrjKhmi.esm.js +0 -83
- package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
- package/dist/qe-signature.d.ts +0 -25
- package/dist/qe-signature.esm.js +0 -8
- package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
- package/dist/redirect-to-mobile.d.ts +0 -107
- package/dist/redirect-to-mobile.esm.js +0 -102
- package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
- package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
- package/dist/selfie.d.ts +0 -26
- package/dist/selfie.esm.js +0 -146
- package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
- package/dist/selfieManager-Duisl7qN.esm.js +0 -60
- package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
- package/dist/session-BS-d_vuE.esm.js +0 -3206
- package/dist/session.d.ts +0 -217
- package/dist/session.esm.js +0 -9
- package/dist/setup-Buy-hyj4.esm.js +0 -887
- package/dist/setup-C5AITV8m.d.ts +0 -254
- package/dist/signature.d.ts +0 -94
- package/dist/signature.esm.js +0 -66
- package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
- package/dist/stats-CIfiPzb1.esm.js +0 -16
- package/dist/stats.d.ts +0 -16
- package/dist/stats.esm.js +0 -4
- package/dist/trust-graph.d.ts +0 -54
- package/dist/trust-graph.esm.js +0 -56
- package/dist/types-B06Ypu2F.d.ts +0 -49
- package/dist/types-BP1m8VRw.d.ts +0 -340
- package/dist/types-CAD4va6a.d.ts +0 -5
- package/dist/types-CFV9G_7j.d.ts +0 -24
- package/dist/warmup-CEcppFiS.d.ts +0 -63
- package/dist/wasm.d.ts +0 -15
- package/dist/wasm.esm.js +0 -12
- package/dist/watchlist-for-business.d.ts +0 -79
- package/dist/watchlist-for-business.esm.js +0 -148
- package/dist/watchlist.d.ts +0 -62
- package/dist/watchlist.esm.js +0 -86
- package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
- package/dist/workflow.d.ts +0 -907
- package/dist/workflow.esm.js +0 -702
- package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
package/dist/workflow.esm.js
DELETED
|
@@ -1,702 +0,0 @@
|
|
|
1
|
-
import "./BaseWasmProvider-C_DLEI40.esm.js";
|
|
2
|
-
import "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
3
|
-
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
4
|
-
import { o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
|
|
5
|
-
import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
|
|
6
|
-
import { n as getSessionFingerprintResult, r as initializeSession } from "./session-BS-d_vuE.esm.js";
|
|
7
|
-
import "./IpifyProvider-D7jx52AL.esm.js";
|
|
8
|
-
import "./browserSimulation-gxD8cSpM.esm.js";
|
|
9
|
-
import { a as fromPromise, c as createManager, r as assign, s as createActor, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
|
|
10
|
-
import { n as electronicSignatureMachine } from "./electronicSignatureManager-D9OHzTpG.esm.js";
|
|
11
|
-
import "./ae-signature-DDDZmWXj.esm.js";
|
|
12
|
-
import { t as antifraudMachine } from "./antifraudStateMachine-O0TMf6yc.esm.js";
|
|
13
|
-
import "./faceCaptureSetup-B3faSpYA.esm.js";
|
|
14
|
-
import "./ITimerCapability-C67ZRskg.esm.js";
|
|
15
|
-
import "./camera-PA2Ljri3.esm.js";
|
|
16
|
-
import "./deepsightService-O74l4Y__.esm.js";
|
|
17
|
-
import "./recordingService-Ig2UgbLv.esm.js";
|
|
18
|
-
import "./platform-CfrjKhmi.esm.js";
|
|
19
|
-
import "./backCameraStream-DMdMeGk2.esm.js";
|
|
20
|
-
import "./getBrowser-BSXUTWXw.esm.js";
|
|
21
|
-
import "./stats-CIfiPzb1.esm.js";
|
|
22
|
-
import "./getDeviceClass-BSntT9_j.esm.js";
|
|
23
|
-
import "./MotionSensorProvider-4v7xkqAp.esm.js";
|
|
24
|
-
import "./permissionServices-D_i6nzEw.esm.js";
|
|
25
|
-
import { t as authenticationMachine } from "./authenticationStateMachine-BMZqatiF.esm.js";
|
|
26
|
-
import { t as consentMachine } from "./consentStateMachine-CCT-B60O.esm.js";
|
|
27
|
-
import "./cpf-PPz2Njto.esm.js";
|
|
28
|
-
import { t as curpValidationMachine } from "./curpValidationStateMachine-CitWLr2c.esm.js";
|
|
29
|
-
import { t as documentCaptureMachine } from "./documentCaptureStateMachine-BqzTDy9k.esm.js";
|
|
30
|
-
import { r as toEkybConfig, t as ekybMachine } from "./ekybStateMachine-B59rQjgj.esm.js";
|
|
31
|
-
import "./addressSearch-BpTbTWCa.esm.js";
|
|
32
|
-
import "./flowServices-DTsm-Vf1.esm.js";
|
|
33
|
-
import { r as toEkycConfig, t as ekycMachine } from "./ekycStateMachine-oeO0Iekd.esm.js";
|
|
34
|
-
import { t as emailMachine } from "./emailStateMachine-DOf4j58N.esm.js";
|
|
35
|
-
import { t as selfieMachine } from "./selfieStateMachine-D76whWEf.esm.js";
|
|
36
|
-
import { t as idCaptureMachine } from "./idCaptureStateMachine-Bq0fVZXl.esm.js";
|
|
37
|
-
import { t as phoneMachine } from "./phoneStateMachine-CuPARRaT.esm.js";
|
|
38
|
-
import { t as faceMatchMachine } from "./faceMatchStateMachine-DNFrxTFS.esm.js";
|
|
39
|
-
import { n as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-CqqwqAkW.esm.js";
|
|
40
|
-
import { t as getFinishStatus } from "./flowCompletionService-P54yzGvA.esm.js";
|
|
41
|
-
import { t as geolocationMachine } from "./geolocationStateMachine-asasuHY2.esm.js";
|
|
42
|
-
import { t as governmentValidationMachine } from "./governmentValidationStateMachine-BDDYrJTo.esm.js";
|
|
43
|
-
import { t as idOcrStateMachine } from "./idOcrStateMachine-YbjjC_Gg.esm.js";
|
|
44
|
-
import { t as idVerificationMachine } from "./idVerificationStateMachine-xbw9HP1Z.esm.js";
|
|
45
|
-
import { t as mandatoryConsentMachine } from "./mandatoryConsentStateMachine-Cnco1jvn.esm.js";
|
|
46
|
-
import "./qe-signature-DFo_Cc-I.esm.js";
|
|
47
|
-
import { t as redirectToMobileMachine } from "./redirectToMobileStateMachine-BOEqe46A.esm.js";
|
|
48
|
-
import { t as signatureMachine } from "./signatureStateMachine-B5-QVUve.esm.js";
|
|
49
|
-
|
|
50
|
-
//#region src/internal/orchestration/defaultModules.ts
|
|
51
|
-
/**
|
|
52
|
-
* Shared default module registry — single source of truth for module key → machine mappings.
|
|
53
|
-
* Used by Workflow (eager loading). Flow uses lazy imports instead (see flowInit.ts).
|
|
54
|
-
*
|
|
55
|
-
* When adding a new module to the SDK, add it here AND to Flow's getLazyCoreMachineLoader.
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* Base module registry with all known SDK modules.
|
|
59
|
-
* Module keys match what the backend sends in flow/workflow configuration.
|
|
60
|
-
*/
|
|
61
|
-
const DEFAULT_MODULE_REGISTRY = {
|
|
62
|
-
PHONE: phoneMachine,
|
|
63
|
-
EMAIL: emailMachine,
|
|
64
|
-
SELFIE: selfieMachine,
|
|
65
|
-
AUTHENTICATION: authenticationMachine,
|
|
66
|
-
ID: idCaptureMachine,
|
|
67
|
-
TUTORIAL_ID: idCaptureMachine,
|
|
68
|
-
SECOND_ID: idCaptureMachine,
|
|
69
|
-
FACE_MATCH: faceMatchMachine,
|
|
70
|
-
CURP_VALIDATION: curpValidationMachine,
|
|
71
|
-
GOVT_VALIDATION_PROVISIONING: governmentValidationMachine,
|
|
72
|
-
GEOLOCATION: geolocationMachine,
|
|
73
|
-
EXTERNAL_VERIFICATION: ekycMachine,
|
|
74
|
-
EKYB: ekybMachine,
|
|
75
|
-
DOCUMENT_CAPTURE: documentCaptureMachine,
|
|
76
|
-
ADDRESS: documentCaptureMachine,
|
|
77
|
-
COMBINED_CONSENT: consentMachine,
|
|
78
|
-
MANDATORY_CONSENT: mandatoryConsentMachine,
|
|
79
|
-
SIGNATURE: signatureMachine,
|
|
80
|
-
ANTIFRAUD: antifraudMachine,
|
|
81
|
-
ID_OCR: idOcrStateMachine,
|
|
82
|
-
AE_SIGNATURE: electronicSignatureMachine,
|
|
83
|
-
QE_SIGNATURE: electronicSignatureMachine
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Per-module config mappers for orchestrators (workflow / flow).
|
|
87
|
-
*
|
|
88
|
-
* The backend's workflow-node `moduleConfiguration` shape is not always the
|
|
89
|
-
* same as the module's `Config` type. Modules that need remapping register a
|
|
90
|
-
* mapper here; everything else falls through with identity.
|
|
91
|
-
*
|
|
92
|
-
* Owned by core so that core-only orchestrator consumers (no `@incodetech/web`)
|
|
93
|
-
* receive correctly shaped configs.
|
|
94
|
-
*
|
|
95
|
-
* When adding a new module whose workflow-node config differs from its
|
|
96
|
-
* manager's `Config` type, add a mapper entry below.
|
|
97
|
-
*/
|
|
98
|
-
const DEFAULT_MODULE_CONFIG_MAPPERS = {
|
|
99
|
-
EXTERNAL_VERIFICATION: (raw) => toEkycConfig(raw),
|
|
100
|
-
EKYB: (raw) => toEkybConfig(raw)
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Applies the module-specific config mapper (if registered) to the raw node
|
|
104
|
-
* config. Used by the workflow manager (`mapState`, `getModuleConfig`) and
|
|
105
|
-
* the workflow state machine (`runningModule.invoke.input`) so all surfaces
|
|
106
|
-
* agree on the shape consumers see.
|
|
107
|
-
*
|
|
108
|
-
* Mappers always return an object shape; the cast back to
|
|
109
|
-
* `Record<string, unknown>` preserves the surrounding API contract.
|
|
110
|
-
*/
|
|
111
|
-
function applyConfigMapper(moduleKey, raw, mappers) {
|
|
112
|
-
const mapper = moduleKey ? mappers[moduleKey] : void 0;
|
|
113
|
-
return mapper ? mapper(raw) : raw;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/modules/workflow/workflowServices.ts
|
|
118
|
-
function assertWorkflowNode(data, endpoint) {
|
|
119
|
-
const obj = data;
|
|
120
|
-
if (!obj || typeof obj.nodeType !== "string") throw new Error(`Invalid response from ${endpoint}: missing nodeType`);
|
|
121
|
-
}
|
|
122
|
-
function assertWorkflowConfig(data, endpoint) {
|
|
123
|
-
const obj = data;
|
|
124
|
-
if (!obj || typeof obj.id !== "string") throw new Error(`Invalid response from ${endpoint}: missing id`);
|
|
125
|
-
}
|
|
126
|
-
async function getCurrentNode(signal) {
|
|
127
|
-
const res = await api.get(endpoints.workflowCurrentNode, { signal });
|
|
128
|
-
if (!res.ok) throw new Error(`GET ${endpoints.workflowCurrentNode} failed: ${res.status} ${res.statusText}`);
|
|
129
|
-
assertWorkflowNode(res.data, endpoints.workflowCurrentNode);
|
|
130
|
-
return res.data;
|
|
131
|
-
}
|
|
132
|
-
async function processNode(signal) {
|
|
133
|
-
const res = await api.post(endpoints.workflowProcessNode, {}, { signal });
|
|
134
|
-
if (!res.ok) throw new Error(`POST ${endpoints.workflowProcessNode} failed: ${res.status} ${res.statusText}`);
|
|
135
|
-
assertWorkflowNode(res.data, endpoints.workflowProcessNode);
|
|
136
|
-
return res.data;
|
|
137
|
-
}
|
|
138
|
-
async function getWorkflowConfig(signal) {
|
|
139
|
-
const res = await api.get(endpoints.workflowInfo, { signal });
|
|
140
|
-
if (!res.ok) throw new Error(`GET ${endpoints.workflowInfo} failed: ${res.status} ${res.statusText}`);
|
|
141
|
-
assertWorkflowConfig(res.data, endpoints.workflowInfo);
|
|
142
|
-
return res.data;
|
|
143
|
-
}
|
|
144
|
-
async function processCustomNode(data, signal) {
|
|
145
|
-
const res = await api.post(endpoints.customModuleExecution, data, { signal });
|
|
146
|
-
if (!res.ok) throw new Error(`POST ${endpoints.customModuleExecution} failed: ${res.status} ${res.statusText}`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/modules/workflow/workflowActors.ts
|
|
151
|
-
async function loadWorkflow(input, signal) {
|
|
152
|
-
await initializeSession({ signal }).catch(() => void 0);
|
|
153
|
-
const workflowConfig = await getWorkflowConfig(signal);
|
|
154
|
-
const realNode = await getCurrentNode(signal);
|
|
155
|
-
const fingerprintResult = getSessionFingerprintResult();
|
|
156
|
-
let currentNode = realNode;
|
|
157
|
-
let firstNode;
|
|
158
|
-
let isInjectedNode = false;
|
|
159
|
-
if (fingerprintResult?.showMandatoryConsent) {
|
|
160
|
-
firstNode = realNode;
|
|
161
|
-
isInjectedNode = true;
|
|
162
|
-
currentNode = {
|
|
163
|
-
id: "injected-mandatory-consent",
|
|
164
|
-
nodeType: "MODULE",
|
|
165
|
-
moduleKey: "MANDATORY_CONSENT",
|
|
166
|
-
moduleConfiguration: { consentType: fingerprintResult.regulationType ?? "Other" },
|
|
167
|
-
status: "INJECTED",
|
|
168
|
-
workflowId: workflowConfig.id
|
|
169
|
-
};
|
|
170
|
-
} else if (workflowConfig.redirectDesktopToMobile && input.isDesktop) {
|
|
171
|
-
firstNode = realNode;
|
|
172
|
-
isInjectedNode = true;
|
|
173
|
-
currentNode = {
|
|
174
|
-
id: "injected-redirect-to-mobile",
|
|
175
|
-
nodeType: "MODULE",
|
|
176
|
-
moduleKey: "REDIRECT_TO_MOBILE",
|
|
177
|
-
moduleConfiguration: {
|
|
178
|
-
disableSmsOption: workflowConfig.disableSmsOption ?? false,
|
|
179
|
-
addContinueToDesktop: workflowConfig.addContinueToDesktop ?? false,
|
|
180
|
-
qrPhishingResistance: workflowConfig.qrPhishingResistance ?? false
|
|
181
|
-
},
|
|
182
|
-
status: "INJECTED",
|
|
183
|
-
workflowId: workflowConfig.id
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
workflowConfig,
|
|
188
|
-
currentNode,
|
|
189
|
-
firstNode,
|
|
190
|
-
isInjectedNode
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
async function processNextNode(input, signal) {
|
|
194
|
-
if (input.isInjectedNode && input.firstNode) {
|
|
195
|
-
if (input.currentNodeModuleKey === "MANDATORY_CONSENT" && input.workflowRedirectDesktopToMobile && input.isDesktop) return {
|
|
196
|
-
nextNode: {
|
|
197
|
-
id: "injected-redirect-to-mobile",
|
|
198
|
-
nodeType: "MODULE",
|
|
199
|
-
moduleKey: "REDIRECT_TO_MOBILE",
|
|
200
|
-
moduleConfiguration: {
|
|
201
|
-
disableSmsOption: input.workflowDisableSmsOption,
|
|
202
|
-
addContinueToDesktop: input.workflowAddContinueToDesktop,
|
|
203
|
-
qrPhishingResistance: input.workflowQrPhishingResistance
|
|
204
|
-
},
|
|
205
|
-
status: "INJECTED",
|
|
206
|
-
workflowId: input.workflowConfigId ?? ""
|
|
207
|
-
},
|
|
208
|
-
isInjectedNode: true
|
|
209
|
-
};
|
|
210
|
-
return {
|
|
211
|
-
nextNode: input.firstNode,
|
|
212
|
-
isInjectedNode: false
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
nextNode: await processNode(signal),
|
|
217
|
-
isInjectedNode: false
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
async function handleCustomModule(input, signal) {
|
|
221
|
-
const { currentNode, interviewId, customModuleCallback } = input;
|
|
222
|
-
const callbackName = currentNode.moduleConfiguration?.callbackName ?? "";
|
|
223
|
-
const customData = {
|
|
224
|
-
interviewId,
|
|
225
|
-
status: "UNKNOWN",
|
|
226
|
-
message: null,
|
|
227
|
-
callbackName,
|
|
228
|
-
nodeId: currentNode.id
|
|
229
|
-
};
|
|
230
|
-
if (customModuleCallback) {
|
|
231
|
-
const result = await new Promise((resolve, reject) => {
|
|
232
|
-
const onAbort = () => reject(/* @__PURE__ */ new Error("Custom module aborted"));
|
|
233
|
-
signal.addEventListener("abort", onAbort);
|
|
234
|
-
customModuleCallback({
|
|
235
|
-
onSuccess: (message) => {
|
|
236
|
-
signal.removeEventListener("abort", onAbort);
|
|
237
|
-
resolve({
|
|
238
|
-
status: "OK",
|
|
239
|
-
message: message ?? null
|
|
240
|
-
});
|
|
241
|
-
},
|
|
242
|
-
onError: (message) => {
|
|
243
|
-
signal.removeEventListener("abort", onAbort);
|
|
244
|
-
resolve({
|
|
245
|
-
status: "FAIL",
|
|
246
|
-
message: message ?? null
|
|
247
|
-
});
|
|
248
|
-
},
|
|
249
|
-
interviewId,
|
|
250
|
-
nodeId: currentNode.id,
|
|
251
|
-
name: callbackName
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
customData.status = result.status;
|
|
255
|
-
customData.message = result.message;
|
|
256
|
-
}
|
|
257
|
-
await processCustomNode(customData, signal);
|
|
258
|
-
return await processNode(signal);
|
|
259
|
-
}
|
|
260
|
-
async function resolveModule(input) {
|
|
261
|
-
const entry = input.registeredModules[input.moduleKey];
|
|
262
|
-
if (!entry) throw new Error(`Unknown module type: ${input.moduleKey}. Ensure all workflow modules are registered.`);
|
|
263
|
-
if (typeof entry === "function") return entry();
|
|
264
|
-
return entry;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/modules/workflow/workflowStateMachine.ts
|
|
269
|
-
function extractErrorInfo(err) {
|
|
270
|
-
const error = err;
|
|
271
|
-
return {
|
|
272
|
-
message: error?.message ?? String(err),
|
|
273
|
-
code: error?.status
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function extractNodeFromOutput(output) {
|
|
277
|
-
const obj = output;
|
|
278
|
-
if ("nextNode" in obj) return obj.nextNode;
|
|
279
|
-
if ("currentNode" in obj) return obj.currentNode;
|
|
280
|
-
if ("nodeType" in obj) return obj;
|
|
281
|
-
throw new Error("Unexpected actor output shape: cannot extract WorkflowNode");
|
|
282
|
-
}
|
|
283
|
-
const workflowMachine = setup({
|
|
284
|
-
types: {
|
|
285
|
-
context: {},
|
|
286
|
-
events: {},
|
|
287
|
-
input: {}
|
|
288
|
-
},
|
|
289
|
-
actors: {
|
|
290
|
-
loadWorkflow: fromPromise(({ input, signal }) => loadWorkflow(input, signal)),
|
|
291
|
-
processNextNode: fromPromise(({ input, signal }) => processNextNode(input, signal)),
|
|
292
|
-
handleCustomModule: fromPromise(({ input, signal }) => handleCustomModule(input, signal)),
|
|
293
|
-
resolveModule: fromPromise(({ input }) => resolveModule(input)),
|
|
294
|
-
notifyBackend: fromPromise(async ({ input, signal }) => {
|
|
295
|
-
return input.getFinishStatus(input.workflowId, signal);
|
|
296
|
-
}),
|
|
297
|
-
runChildModule
|
|
298
|
-
},
|
|
299
|
-
actions: {
|
|
300
|
-
setLoadingResult: assign(({ event }) => {
|
|
301
|
-
const result = event.output;
|
|
302
|
-
return {
|
|
303
|
-
workflowConfig: result.workflowConfig,
|
|
304
|
-
currentNode: result.currentNode,
|
|
305
|
-
firstNode: result.firstNode,
|
|
306
|
-
isInjectedNode: result.isInjectedNode
|
|
307
|
-
};
|
|
308
|
-
}),
|
|
309
|
-
setNextNode: assign(({ event }) => {
|
|
310
|
-
const result = event.output;
|
|
311
|
-
return {
|
|
312
|
-
currentNode: result.nextNode,
|
|
313
|
-
isInjectedNode: result.isInjectedNode
|
|
314
|
-
};
|
|
315
|
-
}),
|
|
316
|
-
setCustomModuleResult: assign(({ event }) => {
|
|
317
|
-
return {
|
|
318
|
-
currentNode: event.output,
|
|
319
|
-
isInjectedNode: false
|
|
320
|
-
};
|
|
321
|
-
}),
|
|
322
|
-
setResolvedMachine: assign(({ event }) => ({ resolvedMachine: event.output })),
|
|
323
|
-
setFinishStatus: assign(({ event }) => ({ finishStatus: event.output })),
|
|
324
|
-
setError: assign(({ event }) => {
|
|
325
|
-
const { message, code } = extractErrorInfo(event.error);
|
|
326
|
-
return {
|
|
327
|
-
error: message,
|
|
328
|
-
errorCode: code
|
|
329
|
-
};
|
|
330
|
-
}),
|
|
331
|
-
setModuleError: assign(({ event }) => ({ error: String(event.error) })),
|
|
332
|
-
setHomeContinueLoading: assign({ isHomeContinueLoading: true }),
|
|
333
|
-
clearHomeContinueLoading: assign({ isHomeContinueLoading: false })
|
|
334
|
-
},
|
|
335
|
-
guards: {
|
|
336
|
-
isModuleNode: ({ event }) => {
|
|
337
|
-
const output = event.output;
|
|
338
|
-
return extractNodeFromOutput(output).nodeType === "MODULE";
|
|
339
|
-
},
|
|
340
|
-
isFinishNode: ({ event }) => {
|
|
341
|
-
const output = event.output;
|
|
342
|
-
return extractNodeFromOutput(output).nodeType === "FINISH";
|
|
343
|
-
},
|
|
344
|
-
isAsyncResolutionNode: ({ event }) => {
|
|
345
|
-
const output = event.output;
|
|
346
|
-
return extractNodeFromOutput(output).nodeType === "ASYNC_RESOLUTION";
|
|
347
|
-
},
|
|
348
|
-
isCustomModule: ({ context }) => {
|
|
349
|
-
return context.currentNode?.moduleKey === "CUSTOM_MODULE";
|
|
350
|
-
},
|
|
351
|
-
shouldEnterHome: ({ event }) => {
|
|
352
|
-
const result = event.output;
|
|
353
|
-
if (!result || result.currentNode.nodeType !== "MODULE") return false;
|
|
354
|
-
if (result.workflowConfig.disableLaunchScreen === true) return false;
|
|
355
|
-
if (result.currentNode.moduleKey === "REDIRECT_TO_MOBILE") return false;
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}).createMachine({
|
|
360
|
-
id: "workflow",
|
|
361
|
-
initial: "idle",
|
|
362
|
-
context: ({ input }) => ({
|
|
363
|
-
workflowConfig: void 0,
|
|
364
|
-
currentNode: void 0,
|
|
365
|
-
firstNode: void 0,
|
|
366
|
-
resolvedMachine: void 0,
|
|
367
|
-
error: void 0,
|
|
368
|
-
errorCode: void 0,
|
|
369
|
-
registeredModules: input.modules,
|
|
370
|
-
configMappers: input.configMappers ?? {},
|
|
371
|
-
finishStatus: void 0,
|
|
372
|
-
customModuleCallback: input.customModuleCallback,
|
|
373
|
-
interviewId: input.interviewId ?? "",
|
|
374
|
-
isDesktop: input.isDesktop ?? true,
|
|
375
|
-
isInjectedNode: false,
|
|
376
|
-
isHomeContinueLoading: false,
|
|
377
|
-
getFinishStatus: input.getFinishStatus ?? getFinishStatus
|
|
378
|
-
}),
|
|
379
|
-
states: {
|
|
380
|
-
idle: { on: { LOAD: "loading" } },
|
|
381
|
-
loading: { invoke: {
|
|
382
|
-
id: "loadWorkflow",
|
|
383
|
-
src: "loadWorkflow",
|
|
384
|
-
input: ({ context }) => ({ isDesktop: context.isDesktop }),
|
|
385
|
-
onDone: [
|
|
386
|
-
{
|
|
387
|
-
target: "home",
|
|
388
|
-
guard: "shouldEnterHome",
|
|
389
|
-
actions: "setLoadingResult"
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
target: "resolvingModule",
|
|
393
|
-
guard: "isModuleNode",
|
|
394
|
-
actions: "setLoadingResult"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
target: "completing",
|
|
398
|
-
guard: "isFinishNode",
|
|
399
|
-
actions: "setLoadingResult"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
target: "asyncResolution",
|
|
403
|
-
guard: "isAsyncResolutionNode",
|
|
404
|
-
actions: "setLoadingResult"
|
|
405
|
-
}
|
|
406
|
-
],
|
|
407
|
-
onError: {
|
|
408
|
-
target: "error",
|
|
409
|
-
actions: "setError"
|
|
410
|
-
}
|
|
411
|
-
} },
|
|
412
|
-
home: { on: { HOME_CONTINUE: {
|
|
413
|
-
target: "resolvingModule",
|
|
414
|
-
actions: "setHomeContinueLoading"
|
|
415
|
-
} } },
|
|
416
|
-
resolvingModule: {
|
|
417
|
-
always: [{
|
|
418
|
-
target: "handlingCustomModule",
|
|
419
|
-
guard: "isCustomModule"
|
|
420
|
-
}],
|
|
421
|
-
invoke: {
|
|
422
|
-
id: "resolveModule",
|
|
423
|
-
src: "resolveModule",
|
|
424
|
-
input: ({ context }) => ({
|
|
425
|
-
moduleKey: context.currentNode.moduleKey,
|
|
426
|
-
registeredModules: context.registeredModules
|
|
427
|
-
}),
|
|
428
|
-
onDone: {
|
|
429
|
-
target: "runningModule",
|
|
430
|
-
actions: "setResolvedMachine"
|
|
431
|
-
},
|
|
432
|
-
onError: {
|
|
433
|
-
target: "error",
|
|
434
|
-
actions: "setError"
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
runningModule: {
|
|
439
|
-
entry: "clearHomeContinueLoading",
|
|
440
|
-
invoke: {
|
|
441
|
-
id: "currentModule",
|
|
442
|
-
src: "runChildModule",
|
|
443
|
-
input: ({ context }) => {
|
|
444
|
-
const config = applyConfigMapper(context.currentNode?.moduleKey, {
|
|
445
|
-
...context.currentNode?.moduleConfiguration,
|
|
446
|
-
ds: context.workflowConfig?.ds
|
|
447
|
-
}, context.configMappers);
|
|
448
|
-
return {
|
|
449
|
-
machine: context.resolvedMachine,
|
|
450
|
-
config
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
on: {
|
|
455
|
-
MODULE_COMPLETE: "processingNode",
|
|
456
|
-
MODULE_ERROR: {
|
|
457
|
-
target: "error",
|
|
458
|
-
actions: "setModuleError"
|
|
459
|
-
},
|
|
460
|
-
COMPLETE_FLOW: "completing"
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
handlingCustomModule: { invoke: {
|
|
464
|
-
id: "customModule",
|
|
465
|
-
src: "handleCustomModule",
|
|
466
|
-
input: ({ context }) => ({
|
|
467
|
-
currentNode: context.currentNode,
|
|
468
|
-
interviewId: context.interviewId,
|
|
469
|
-
customModuleCallback: context.customModuleCallback
|
|
470
|
-
}),
|
|
471
|
-
onDone: [
|
|
472
|
-
{
|
|
473
|
-
target: "resolvingModule",
|
|
474
|
-
guard: "isModuleNode",
|
|
475
|
-
actions: "setCustomModuleResult"
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
target: "completing",
|
|
479
|
-
guard: "isFinishNode",
|
|
480
|
-
actions: "setCustomModuleResult"
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
target: "asyncResolution",
|
|
484
|
-
guard: "isAsyncResolutionNode",
|
|
485
|
-
actions: "setCustomModuleResult"
|
|
486
|
-
}
|
|
487
|
-
],
|
|
488
|
-
onError: {
|
|
489
|
-
target: "error",
|
|
490
|
-
actions: "setError"
|
|
491
|
-
}
|
|
492
|
-
} },
|
|
493
|
-
processingNode: { invoke: {
|
|
494
|
-
id: "processNext",
|
|
495
|
-
src: "processNextNode",
|
|
496
|
-
input: ({ context }) => ({
|
|
497
|
-
isInjectedNode: context.isInjectedNode,
|
|
498
|
-
firstNode: context.firstNode,
|
|
499
|
-
currentNodeModuleKey: context.currentNode?.moduleKey,
|
|
500
|
-
workflowConfigId: context.workflowConfig?.id,
|
|
501
|
-
workflowRedirectDesktopToMobile: context.workflowConfig?.redirectDesktopToMobile ?? false,
|
|
502
|
-
workflowDisableSmsOption: context.workflowConfig?.disableSmsOption ?? false,
|
|
503
|
-
workflowAddContinueToDesktop: context.workflowConfig?.addContinueToDesktop ?? false,
|
|
504
|
-
workflowQrPhishingResistance: context.workflowConfig?.qrPhishingResistance ?? false,
|
|
505
|
-
isDesktop: context.isDesktop
|
|
506
|
-
}),
|
|
507
|
-
onDone: [
|
|
508
|
-
{
|
|
509
|
-
target: "resolvingModule",
|
|
510
|
-
guard: "isModuleNode",
|
|
511
|
-
actions: "setNextNode",
|
|
512
|
-
reenter: true
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
target: "completing",
|
|
516
|
-
guard: "isFinishNode",
|
|
517
|
-
actions: "setNextNode"
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
target: "asyncResolution",
|
|
521
|
-
guard: "isAsyncResolutionNode",
|
|
522
|
-
actions: "setNextNode"
|
|
523
|
-
}
|
|
524
|
-
],
|
|
525
|
-
onError: {
|
|
526
|
-
target: "error",
|
|
527
|
-
actions: "setError"
|
|
528
|
-
}
|
|
529
|
-
} },
|
|
530
|
-
completing: { invoke: {
|
|
531
|
-
id: "notifyBackend",
|
|
532
|
-
src: "notifyBackend",
|
|
533
|
-
input: ({ context }) => ({
|
|
534
|
-
getFinishStatus: context.getFinishStatus,
|
|
535
|
-
workflowId: context.workflowConfig?.id
|
|
536
|
-
}),
|
|
537
|
-
onDone: {
|
|
538
|
-
target: "finished",
|
|
539
|
-
actions: "setFinishStatus"
|
|
540
|
-
},
|
|
541
|
-
onError: {
|
|
542
|
-
target: "error",
|
|
543
|
-
actions: "setError"
|
|
544
|
-
}
|
|
545
|
-
} },
|
|
546
|
-
finished: { type: "final" },
|
|
547
|
-
asyncResolution: { type: "final" },
|
|
548
|
-
closed: { type: "final" },
|
|
549
|
-
error: { type: "final" }
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
//#endregion
|
|
554
|
-
//#region src/modules/workflow/workflowActor.ts
|
|
555
|
-
function createWorkflowActor(options) {
|
|
556
|
-
return createActor(workflowMachine, { input: {
|
|
557
|
-
modules: options.modules,
|
|
558
|
-
configMappers: options.configMappers,
|
|
559
|
-
customModuleCallback: options.customModuleCallback,
|
|
560
|
-
interviewId: options.interviewId,
|
|
561
|
-
isDesktop: options.isDesktop
|
|
562
|
-
} }).start();
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/internal/orchestration/identity-search/identitySearchStateMachine.ts
|
|
567
|
-
const identitySearchMachine = setup({ types: {
|
|
568
|
-
context: {},
|
|
569
|
-
input: {}
|
|
570
|
-
} }).createMachine({
|
|
571
|
-
id: "identitySearch",
|
|
572
|
-
initial: "done",
|
|
573
|
-
context: {},
|
|
574
|
-
states: { done: { type: "final" } }
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
//#endregion
|
|
578
|
-
//#region src/modules/workflow/workflowManager.ts
|
|
579
|
-
const WORKFLOW_DEFAULT_MODULES = {
|
|
580
|
-
...DEFAULT_MODULE_REGISTRY,
|
|
581
|
-
IDENTITY_SEARCH: identitySearchMachine,
|
|
582
|
-
ID_CAPTURE: idCaptureMachine,
|
|
583
|
-
ID: idVerificationMachine,
|
|
584
|
-
REDIRECT_TO_MOBILE: redirectToMobileMachine
|
|
585
|
-
};
|
|
586
|
-
function deriveHomeScreen(snapshot) {
|
|
587
|
-
return {
|
|
588
|
-
visible: snapshot.matches("home"),
|
|
589
|
-
isContinueLoading: snapshot.context.isHomeContinueLoading
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Builds the current node's config and applies the module-specific config
|
|
594
|
-
* mapper (if any). Single source of truth for the shape consumers see —
|
|
595
|
-
* used by both `mapState` and `getModuleConfig`. The same `applyConfigMapper`
|
|
596
|
-
* is invoked at the child-actor boundary in `workflowStateMachine` so all
|
|
597
|
-
* surfaces agree.
|
|
598
|
-
*/
|
|
599
|
-
function resolveCurrentModuleConfig(moduleKey, moduleConfiguration, ds, mappers) {
|
|
600
|
-
return applyConfigMapper(moduleKey, {
|
|
601
|
-
...moduleConfiguration ?? {},
|
|
602
|
-
ds
|
|
603
|
-
}, mappers);
|
|
604
|
-
}
|
|
605
|
-
function mapState(snapshot) {
|
|
606
|
-
const { context } = snapshot;
|
|
607
|
-
const homeScreen = deriveHomeScreen(snapshot);
|
|
608
|
-
if (snapshot.matches("idle")) return {
|
|
609
|
-
status: "idle",
|
|
610
|
-
homeScreen
|
|
611
|
-
};
|
|
612
|
-
if (snapshot.matches("runningModule")) {
|
|
613
|
-
const childSnapshot = snapshot.children.currentModule?.getSnapshot();
|
|
614
|
-
return {
|
|
615
|
-
status: "ready",
|
|
616
|
-
workflowConfig: context.workflowConfig,
|
|
617
|
-
currentNode: context.currentNode,
|
|
618
|
-
config: resolveCurrentModuleConfig(context.currentNode?.moduleKey, context.currentNode?.moduleConfiguration, context.workflowConfig?.ds, context.configMappers),
|
|
619
|
-
moduleState: childSnapshot ?? null,
|
|
620
|
-
homeScreen
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
if (snapshot.matches("finished")) return {
|
|
624
|
-
status: "finished",
|
|
625
|
-
workflowConfig: context.workflowConfig,
|
|
626
|
-
finishStatus: context.finishStatus ?? {
|
|
627
|
-
redirectionUrl: "",
|
|
628
|
-
action: "none",
|
|
629
|
-
scoreStatus: "UNKNOWN"
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
if (snapshot.matches("asyncResolution")) return {
|
|
633
|
-
status: "asyncResolution",
|
|
634
|
-
workflowConfig: context.workflowConfig,
|
|
635
|
-
currentNode: context.currentNode
|
|
636
|
-
};
|
|
637
|
-
if (snapshot.matches("closed")) return { status: "closed" };
|
|
638
|
-
if (snapshot.matches("error")) return {
|
|
639
|
-
status: "error",
|
|
640
|
-
error: context.error ?? "Unknown error",
|
|
641
|
-
errorCode: context.errorCode
|
|
642
|
-
};
|
|
643
|
-
return {
|
|
644
|
-
status: "loading",
|
|
645
|
-
homeScreen
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
function createApi({ actor, getSnapshot, trackElementClicked }) {
|
|
649
|
-
return {
|
|
650
|
-
load() {
|
|
651
|
-
actor.send({ type: "LOAD" });
|
|
652
|
-
},
|
|
653
|
-
completeModule() {
|
|
654
|
-
trackElementClicked?.("completeModule");
|
|
655
|
-
actor.send({ type: "MODULE_COMPLETE" });
|
|
656
|
-
},
|
|
657
|
-
completeFlow() {
|
|
658
|
-
trackElementClicked?.("completeFlow");
|
|
659
|
-
actor.send({ type: "COMPLETE_FLOW" });
|
|
660
|
-
},
|
|
661
|
-
errorModule(error) {
|
|
662
|
-
actor.send({
|
|
663
|
-
type: "MODULE_ERROR",
|
|
664
|
-
error
|
|
665
|
-
});
|
|
666
|
-
},
|
|
667
|
-
continueFromHome() {
|
|
668
|
-
trackElementClicked?.("homeContinue");
|
|
669
|
-
actor.send({ type: "HOME_CONTINUE" });
|
|
670
|
-
},
|
|
671
|
-
getModuleConfig() {
|
|
672
|
-
const snapshot = getSnapshot();
|
|
673
|
-
if (snapshot.value !== "runningModule") return void 0;
|
|
674
|
-
return resolveCurrentModuleConfig(snapshot.context.currentNode?.moduleKey, snapshot.context.currentNode?.moduleConfiguration, snapshot.context.workflowConfig?.ds, snapshot.context.configMappers);
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Creates a workflow manager for server-driven onboarding flows.
|
|
680
|
-
*
|
|
681
|
-
* Only one orchestrator (Flow or Workflow) should be active per session.
|
|
682
|
-
* Each session token maps to a single orchestrator run. To start a new
|
|
683
|
-
* workflow, create a new session and call `setup()` with the new token
|
|
684
|
-
* before creating a new manager.
|
|
685
|
-
*/
|
|
686
|
-
function createWorkflowManager(options = {}) {
|
|
687
|
-
return attachFlowEventEmitter(createManager({
|
|
688
|
-
actor: createWorkflowActor({
|
|
689
|
-
modules: WORKFLOW_DEFAULT_MODULES,
|
|
690
|
-
configMappers: DEFAULT_MODULE_CONFIG_MAPPERS,
|
|
691
|
-
customModuleCallback: options.customModuleCallback,
|
|
692
|
-
interviewId: options.interviewId,
|
|
693
|
-
isDesktop: options.isDesktop
|
|
694
|
-
}),
|
|
695
|
-
mapState,
|
|
696
|
-
createApi,
|
|
697
|
-
instrumentation: createManagerInstrumentation("WORKFLOW")
|
|
698
|
-
}), { interviewId: options.interviewId });
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
//#endregion
|
|
702
|
-
export { createWorkflowManager, workflowMachine };
|