@incodetech/core 2.0.0-alpha.8 → 2.0.0-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/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/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-B59rQjgj.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 +3 -263
- package/dist/email.esm.js +7 -477
- 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 +101 -321
- package/dist/flow.esm.js +370 -173
- package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
- package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
- package/dist/flowServices-DTsm-Vf1.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-B9TGA5dq.d.ts +956 -0
- package/dist/idCaptureManager-DMK0GIt3.esm.js +581 -0
- package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +2954 -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-BLKtMA0g.d.ts +1177 -0
- package/dist/index-BcRG8rtJ.d.ts +97 -0
- package/dist/index.d.ts +3 -226
- package/dist/index.esm.js +11 -154
- package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
- package/dist/{lib-Bu9XGMBW.esm.js → lib-BB0B_qQX.esm.js} +801 -2
- 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 +3 -291
- package/dist/phone.esm.js +7 -548
- 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 +21 -754
- package/dist/selfie.esm.js +113 -962
- 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-BS-d_vuE.esm.js +3206 -0
- package/dist/session.d.ts +217 -0
- package/dist/session.esm.js +9 -0
- package/dist/setup-Buy-hyj4.esm.js +887 -0
- package/dist/setup-C5AITV8m.d.ts +254 -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-CFV9G_7j.d.ts +24 -0
- package/dist/{warmup-CEJTfxQr.d.ts → warmup-CEcppFiS.d.ts} +11 -3
- 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-B_rda9yU.esm.js → xstate.esm-B70JrNqo.esm.js} +144 -1
- package/package.json +203 -6
- package/dist/OpenViduLogger-BdPfiZO6.esm.js +0 -3
- package/dist/OpenViduLogger-CQyDxBvM.esm.js +0 -803
- package/dist/StateMachine-DRE1oH2B.d.ts +0 -2
- package/dist/addEvent-W0ORK0jT.esm.js +0 -16
- package/dist/endpoints-BSTFaHYo.esm.js +0 -1706
- package/dist/permissionServices-I6vX6DBy.esm.js +0 -72
- /package/dist/{Manager-BGfxEmyv.d.ts → Manager-C8PrhBOx.d.ts} +0 -0
- /package/dist/{chunk-C_Yo44FK.esm.js → chunk-CRF6K_H_.esm.js} +0 -0
- /package/dist/{types-iZi2rawo.d.ts → types-CAD4va6a.d.ts} +0 -0
package/dist/flow.esm.js
CHANGED
|
@@ -1,48 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./api-CESGtpbH.esm.js";
|
|
2
|
+
import "./events-D6-e4vok.esm.js";
|
|
3
|
+
import "./endpoints-CnN3SyDa.esm.js";
|
|
4
|
+
import "./session-BS-d_vuE.esm.js";
|
|
5
|
+
import "./IpifyProvider-D7jx52AL.esm.js";
|
|
6
|
+
import "./browserSimulation-gxD8cSpM.esm.js";
|
|
7
|
+
import { a as fromPromise, c as createManager, r as assign, s as createActor, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
|
|
8
|
+
import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-DTsm-Vf1.esm.js";
|
|
9
|
+
import { n as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-CqqwqAkW.esm.js";
|
|
10
|
+
import { t as getFinishStatus } from "./flowCompletionService-P54yzGvA.esm.js";
|
|
3
11
|
|
|
4
|
-
//#region src/modules/flow/
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ID: "idCapture",
|
|
11
|
-
TUTORIAL_ID: "idCapture",
|
|
12
|
-
SECOND_ID: "idCapture",
|
|
13
|
-
THIRD_ID: "idCapture"
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Analyzes a flow configuration and returns the WASM pipelines needed.
|
|
17
|
-
* Use this to conditionally warmup WASM only when required by the flow.
|
|
18
|
-
*
|
|
19
|
-
* @param flow - The flow configuration from /omni/onboarding/flow
|
|
20
|
-
* @returns Array of WASM pipelines needed (e.g., ['selfie', 'idCapture'])
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const pipelines = getRequiredWasmPipelines(flow);
|
|
25
|
-
* if (pipelines.length > 0) {
|
|
26
|
-
* warmupWasm({ ...wasmConfig, pipelines });
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
function getRequiredWasmPipelines(flow) {
|
|
31
|
-
const pipelines = /* @__PURE__ */ new Set();
|
|
32
|
-
for (const module of flow.flowModules) {
|
|
33
|
-
const pipeline = WASM_MODULE_PIPELINES[module.key];
|
|
34
|
-
if (pipeline) pipelines.add(pipeline);
|
|
35
|
-
}
|
|
36
|
-
return [...pipelines];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/modules/flow/flowServices.ts
|
|
41
|
-
const getFlow = async (signal) => {
|
|
42
|
-
const res = await api.get(endpoints.flow, { signal });
|
|
43
|
-
if (!res.ok) throw new Error(`GET /flow failed: ${res.status} ${res.statusText}`);
|
|
44
|
-
return res.data;
|
|
45
|
-
};
|
|
12
|
+
//#region src/modules/flow/noOpFlowModuleMachine.ts
|
|
13
|
+
const noOpFlowModuleMachine = setup({}).createMachine({
|
|
14
|
+
id: "noOpFlowModule",
|
|
15
|
+
initial: "finished",
|
|
16
|
+
states: { finished: { type: "final" } }
|
|
17
|
+
});
|
|
46
18
|
|
|
47
19
|
//#endregion
|
|
48
20
|
//#region src/modules/flow/flowStateMachine.ts
|
|
@@ -174,7 +146,7 @@ function createFlowActor(options) {
|
|
|
174
146
|
|
|
175
147
|
//#endregion
|
|
176
148
|
//#region src/modules/flow/flowManager.ts
|
|
177
|
-
function mapState
|
|
149
|
+
function mapState(snapshot) {
|
|
178
150
|
const { value, context } = snapshot;
|
|
179
151
|
switch (value) {
|
|
180
152
|
case "idle": return { status: "idle" };
|
|
@@ -198,7 +170,7 @@ function mapState$1(snapshot) {
|
|
|
198
170
|
default: return { status: "idle" };
|
|
199
171
|
}
|
|
200
172
|
}
|
|
201
|
-
function createApi
|
|
173
|
+
function createApi({ actor, getSnapshot, trackElementClicked }) {
|
|
202
174
|
function getCanNext() {
|
|
203
175
|
const snapshot = getSnapshot();
|
|
204
176
|
const { currentStepIndex, steps } = snapshot.context;
|
|
@@ -208,7 +180,7 @@ function createApi$1({ actor, getSnapshot }) {
|
|
|
208
180
|
const snapshot = getSnapshot();
|
|
209
181
|
return snapshot.matches("ready") && snapshot.context.currentStepIndex > 0;
|
|
210
182
|
}
|
|
211
|
-
function getModuleConfig(moduleKey) {
|
|
183
|
+
function getModuleConfig$1(moduleKey) {
|
|
212
184
|
const snapshot = getSnapshot();
|
|
213
185
|
if (!snapshot.matches("ready")) return;
|
|
214
186
|
return (snapshot.context.flow?.flowModules.find((m) => m.key === moduleKey))?.configuration;
|
|
@@ -223,15 +195,18 @@ function createApi$1({ actor, getSnapshot }) {
|
|
|
223
195
|
actor.send({ type: "LOAD" });
|
|
224
196
|
},
|
|
225
197
|
cancel() {
|
|
198
|
+
trackElementClicked?.("cancel");
|
|
226
199
|
actor.send({ type: "CANCEL" });
|
|
227
200
|
},
|
|
228
201
|
reset() {
|
|
229
202
|
actor.send({ type: "RESET" });
|
|
230
203
|
},
|
|
231
204
|
nextStep() {
|
|
205
|
+
trackElementClicked?.("nextStep");
|
|
232
206
|
actor.send({ type: "NEXT_STEP" });
|
|
233
207
|
},
|
|
234
208
|
prevStep() {
|
|
209
|
+
trackElementClicked?.("prevStep");
|
|
235
210
|
actor.send({ type: "PREV_STEP" });
|
|
236
211
|
},
|
|
237
212
|
get canNext() {
|
|
@@ -240,7 +215,7 @@ function createApi$1({ actor, getSnapshot }) {
|
|
|
240
215
|
get canPrev() {
|
|
241
216
|
return getCanPrev();
|
|
242
217
|
},
|
|
243
|
-
getModuleConfig,
|
|
218
|
+
getModuleConfig: getModuleConfig$1,
|
|
244
219
|
isModuleEnabled
|
|
245
220
|
};
|
|
246
221
|
}
|
|
@@ -271,11 +246,11 @@ function createApi$1({ actor, getSnapshot }) {
|
|
|
271
246
|
* ```
|
|
272
247
|
*/
|
|
273
248
|
function createFlowManager(options) {
|
|
274
|
-
return createManager({
|
|
249
|
+
return attachFlowEventEmitter(createManager({
|
|
275
250
|
actor: createFlowActor(options),
|
|
276
|
-
mapState
|
|
277
|
-
createApi
|
|
278
|
-
});
|
|
251
|
+
mapState,
|
|
252
|
+
createApi
|
|
253
|
+
}));
|
|
279
254
|
}
|
|
280
255
|
|
|
281
256
|
//#endregion
|
|
@@ -318,17 +293,66 @@ function createModuleLoader(registry) {
|
|
|
318
293
|
return new ModuleLoaderImpl(registry);
|
|
319
294
|
}
|
|
320
295
|
|
|
321
|
-
//#endregion
|
|
322
|
-
//#region src/modules/flow/flowCompletionService.ts
|
|
323
|
-
const getFinishStatus = async (flowId, signal) => {
|
|
324
|
-
const url = `/omni/finish-status${flowId ? `?flowId=${flowId}` : ""}`;
|
|
325
|
-
const res = await api.get(url, { signal });
|
|
326
|
-
if (!res.ok) throw new Error(`GET ${url} failed: ${res.status} ${res.statusText}`);
|
|
327
|
-
return res.data;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
296
|
//#endregion
|
|
331
297
|
//#region src/modules/flow/orchestratedFlowStateMachine.ts
|
|
298
|
+
function getModuleConfig(module, flow) {
|
|
299
|
+
const config = {
|
|
300
|
+
...module?.configuration,
|
|
301
|
+
ds: flow?.ds
|
|
302
|
+
};
|
|
303
|
+
if (module?.key === "ID" || module?.key === "TUTORIAL_ID" || module?.key === "SECOND_ID" || module?.key === "SELFIE") return {
|
|
304
|
+
...config,
|
|
305
|
+
ageAssurance: config.ageAssurance ?? flow?.ageAssurance
|
|
306
|
+
};
|
|
307
|
+
return config;
|
|
308
|
+
}
|
|
309
|
+
function createBaseContext(context, isHomeContinueLoading) {
|
|
310
|
+
return {
|
|
311
|
+
flow: void 0,
|
|
312
|
+
error: void 0,
|
|
313
|
+
errorCode: void 0,
|
|
314
|
+
steps: [],
|
|
315
|
+
currentStepIndex: -1,
|
|
316
|
+
currentStep: void 0,
|
|
317
|
+
config: void 0,
|
|
318
|
+
getFlow: context.getFlow,
|
|
319
|
+
registeredModules: context.registeredModules,
|
|
320
|
+
lazyRegisteredModules: context.lazyRegisteredModules,
|
|
321
|
+
currentModuleMachine: void 0,
|
|
322
|
+
getFinishStatus: context.getFinishStatus,
|
|
323
|
+
enableHome: context.enableHome,
|
|
324
|
+
finishStatus: void 0,
|
|
325
|
+
isHomeContinueLoading
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function createInitialContext(input) {
|
|
329
|
+
return createBaseContext({
|
|
330
|
+
getFlow: input.getFlow,
|
|
331
|
+
registeredModules: input.modules ?? {},
|
|
332
|
+
lazyRegisteredModules: input.lazyModules ?? {},
|
|
333
|
+
getFinishStatus: input.getFinishStatus ?? getFinishStatus,
|
|
334
|
+
enableHome: input.enableHome === true
|
|
335
|
+
}, false);
|
|
336
|
+
}
|
|
337
|
+
function shouldEnterHome(context) {
|
|
338
|
+
if (context.enableHome !== true) return false;
|
|
339
|
+
if (context.flow?.disableLaunchScreen === true) return false;
|
|
340
|
+
if (context.isHomeContinueLoading === true) return false;
|
|
341
|
+
const firstRealIndex = context.steps[0] === "REDIRECT_TO_MOBILE" ? 1 : 0;
|
|
342
|
+
return context.currentStepIndex === firstRealIndex;
|
|
343
|
+
}
|
|
344
|
+
const prefetchedLazyModules = /* @__PURE__ */ new WeakSet();
|
|
345
|
+
function prefetchNextLazyModule(context) {
|
|
346
|
+
const nextStep = context.steps[context.currentStepIndex + 1];
|
|
347
|
+
if (!nextStep) return;
|
|
348
|
+
const nextLazyModule = context.lazyRegisteredModules[nextStep];
|
|
349
|
+
if (!nextLazyModule || prefetchedLazyModules.has(nextLazyModule)) return;
|
|
350
|
+
prefetchedLazyModules.add(nextLazyModule);
|
|
351
|
+
nextLazyModule().catch(() => {
|
|
352
|
+
prefetchedLazyModules.delete(nextLazyModule);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
const homeContinueOn = { HOME_CONTINUE: { actions: "setHomeContinueLoading" } };
|
|
332
356
|
const orchestratedFlowMachine = setup({
|
|
333
357
|
types: {
|
|
334
358
|
context: {},
|
|
@@ -342,125 +366,174 @@ const orchestratedFlowMachine = setup({
|
|
|
342
366
|
notifyBackend: fromPromise(async ({ input, signal }) => {
|
|
343
367
|
return await input.getFinishStatus(input.flowId, signal);
|
|
344
368
|
}),
|
|
345
|
-
runChildModule
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
error: err
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
actor.start();
|
|
360
|
-
return () => {
|
|
361
|
-
subscription.unsubscribe();
|
|
362
|
-
actor.stop();
|
|
363
|
-
};
|
|
369
|
+
runChildModule,
|
|
370
|
+
resolveCurrentModuleMachine: fromPromise(async ({ input }) => {
|
|
371
|
+
if (!input.moduleKey) return;
|
|
372
|
+
const eagerMachine = input.modules[input.moduleKey];
|
|
373
|
+
if (eagerMachine) return eagerMachine;
|
|
374
|
+
const lazyLoader = input.lazyModules[input.moduleKey];
|
|
375
|
+
if (!lazyLoader) return;
|
|
376
|
+
const loaded = await lazyLoader();
|
|
377
|
+
if (loaded && typeof loaded === "object" && "default" in loaded && loaded.default) return loaded.default;
|
|
378
|
+
return loaded;
|
|
364
379
|
})
|
|
365
380
|
},
|
|
366
381
|
actions: {
|
|
367
|
-
resetContext: assign(({ context }) => (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
currentStepIndex: -1,
|
|
372
|
-
currentStep: void 0,
|
|
373
|
-
config: void 0,
|
|
374
|
-
getFlow: context.getFlow,
|
|
375
|
-
registeredModules: context.registeredModules,
|
|
376
|
-
getFinishStatus: context.getFinishStatus,
|
|
377
|
-
finishStatus: void 0
|
|
378
|
-
})),
|
|
382
|
+
resetContext: assign(({ context }) => createBaseContext(context, false)),
|
|
383
|
+
resetContextForLoad: assign(({ context }) => createBaseContext(context, context.isHomeContinueLoading)),
|
|
384
|
+
setHomeContinueLoading: assign({ isHomeContinueLoading: true }),
|
|
385
|
+
clearHomeContinueLoading: assign({ isHomeContinueLoading: false }),
|
|
379
386
|
setFlowData: assign(({ event }) => {
|
|
380
387
|
const flow = event.output;
|
|
388
|
+
const flowModules = flow.flowModules ?? [];
|
|
389
|
+
const firstModule = flowModules[0];
|
|
390
|
+
const config = getModuleConfig(firstModule, flow);
|
|
381
391
|
return {
|
|
382
392
|
flow,
|
|
383
|
-
steps:
|
|
384
|
-
currentStepIndex:
|
|
385
|
-
currentStep:
|
|
386
|
-
config
|
|
393
|
+
steps: flowModules.map((m) => m.key),
|
|
394
|
+
currentStepIndex: flowModules.length > 0 ? 0 : -1,
|
|
395
|
+
currentStep: firstModule?.key,
|
|
396
|
+
config,
|
|
397
|
+
currentModuleMachine: void 0
|
|
398
|
+
};
|
|
399
|
+
}),
|
|
400
|
+
setError: assign(({ event }) => {
|
|
401
|
+
const err = event.error;
|
|
402
|
+
return {
|
|
403
|
+
error: err?.message ?? String(err),
|
|
404
|
+
errorCode: err?.status
|
|
387
405
|
};
|
|
388
406
|
}),
|
|
389
|
-
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
390
407
|
incrementStep: assign(({ context }) => {
|
|
391
408
|
const nextIndex = context.currentStepIndex + 1;
|
|
392
409
|
const module = context.flow?.flowModules?.[nextIndex];
|
|
410
|
+
const config = getModuleConfig(module, context.flow);
|
|
393
411
|
return {
|
|
394
412
|
currentStepIndex: nextIndex,
|
|
395
413
|
currentStep: module?.key,
|
|
396
|
-
config
|
|
414
|
+
config,
|
|
415
|
+
currentModuleMachine: void 0
|
|
397
416
|
};
|
|
398
417
|
}),
|
|
418
|
+
setCurrentModuleMachine: assign(({ event }) => ({ currentModuleMachine: event.output })),
|
|
419
|
+
prefetchNextModule: ({ context }) => {
|
|
420
|
+
prefetchNextLazyModule(context);
|
|
421
|
+
},
|
|
399
422
|
setFinishStatus: assign(({ event }) => ({ finishStatus: event.output }))
|
|
400
423
|
},
|
|
401
424
|
guards: {
|
|
402
425
|
isLastStep: ({ context }) => context.currentStepIndex >= 0 && context.currentStepIndex === context.steps.length - 1,
|
|
403
426
|
canGoNext: ({ context }) => context.currentStepIndex >= 0 && context.currentStepIndex < context.steps.length - 1,
|
|
427
|
+
shouldEnterHome: ({ context }) => shouldEnterHome(context),
|
|
404
428
|
hasModule: ({ context, event }) => {
|
|
405
429
|
if (!("output" in event)) return false;
|
|
406
430
|
const firstModuleKey = event.output.flowModules?.[0]?.key;
|
|
407
431
|
if (!firstModuleKey) return false;
|
|
408
|
-
return context.registeredModules[firstModuleKey] != null;
|
|
432
|
+
return context.registeredModules[firstModuleKey] != null || context.lazyRegisteredModules[firstModuleKey] != null;
|
|
433
|
+
},
|
|
434
|
+
hasCurrentModuleMachine: ({ event }) => {
|
|
435
|
+
if (!("output" in event)) return false;
|
|
436
|
+
return event.output != null;
|
|
409
437
|
}
|
|
410
438
|
}
|
|
411
439
|
}).createMachine({
|
|
412
440
|
id: "orchestratedFlow",
|
|
413
441
|
initial: "idle",
|
|
414
|
-
context: ({ input }) => (
|
|
415
|
-
flow: void 0,
|
|
416
|
-
error: void 0,
|
|
417
|
-
steps: [],
|
|
418
|
-
currentStepIndex: -1,
|
|
419
|
-
currentStep: void 0,
|
|
420
|
-
config: void 0,
|
|
421
|
-
getFlow: input.getFlow,
|
|
422
|
-
registeredModules: input.modules,
|
|
423
|
-
getFinishStatus: input.getFinishStatus ?? getFinishStatus,
|
|
424
|
-
finishStatus: void 0
|
|
425
|
-
}),
|
|
442
|
+
context: ({ input }) => createInitialContext(input),
|
|
426
443
|
states: {
|
|
427
|
-
idle: { on: {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
444
|
+
idle: { on: {
|
|
445
|
+
LOAD: {
|
|
446
|
+
target: "loading",
|
|
447
|
+
actions: "resetContextForLoad"
|
|
448
|
+
},
|
|
449
|
+
...homeContinueOn
|
|
450
|
+
} },
|
|
431
451
|
loading: {
|
|
432
452
|
invoke: {
|
|
433
453
|
id: "fetchFlow",
|
|
434
454
|
src: "fetchFlow",
|
|
435
455
|
input: ({ context }) => ({ getFlow: context.getFlow }),
|
|
436
456
|
onDone: [{
|
|
437
|
-
target: "
|
|
457
|
+
target: "resolvingModule",
|
|
438
458
|
guard: "hasModule",
|
|
439
459
|
actions: "setFlowData"
|
|
440
460
|
}, {
|
|
441
461
|
target: "error",
|
|
442
|
-
actions: assign({ error: () =>
|
|
462
|
+
actions: assign({ error: ({ event }) => {
|
|
463
|
+
const firstModuleKey = event.output.flowModules?.[0]?.key;
|
|
464
|
+
return firstModuleKey ? `No registered module found for: ${firstModuleKey}` : "No registered module found: flow has no modules";
|
|
465
|
+
} })
|
|
443
466
|
}],
|
|
444
467
|
onError: {
|
|
445
468
|
target: "error",
|
|
446
469
|
actions: "setError"
|
|
447
470
|
}
|
|
448
471
|
},
|
|
449
|
-
on: {
|
|
472
|
+
on: {
|
|
473
|
+
CANCEL: {
|
|
474
|
+
target: "idle",
|
|
475
|
+
actions: "resetContext"
|
|
476
|
+
},
|
|
477
|
+
...homeContinueOn
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
resolvingModule: {
|
|
481
|
+
invoke: {
|
|
482
|
+
id: "resolveCurrentModuleMachine",
|
|
483
|
+
src: "resolveCurrentModuleMachine",
|
|
484
|
+
input: ({ context }) => ({
|
|
485
|
+
moduleKey: context.currentStep,
|
|
486
|
+
modules: context.registeredModules,
|
|
487
|
+
lazyModules: context.lazyRegisteredModules
|
|
488
|
+
}),
|
|
489
|
+
onDone: [
|
|
490
|
+
{
|
|
491
|
+
target: "home",
|
|
492
|
+
guard: "shouldEnterHome",
|
|
493
|
+
actions: ["setCurrentModuleMachine"]
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
target: "runningModule",
|
|
497
|
+
guard: "hasCurrentModuleMachine",
|
|
498
|
+
actions: ["setCurrentModuleMachine", "prefetchNextModule"]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
target: "error",
|
|
502
|
+
actions: assign(({ context }) => ({ error: context.currentStep ? `No registered module found for: ${context.currentStep}` : "No registered module found: flow has no modules" }))
|
|
503
|
+
}
|
|
504
|
+
],
|
|
505
|
+
onError: {
|
|
506
|
+
target: "error",
|
|
507
|
+
actions: "setError"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
on: {
|
|
511
|
+
RESET: {
|
|
512
|
+
target: "idle",
|
|
513
|
+
actions: "resetContext"
|
|
514
|
+
},
|
|
515
|
+
...homeContinueOn
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
home: { on: {
|
|
519
|
+
HOME_CONTINUE: {
|
|
520
|
+
target: "runningModule",
|
|
521
|
+
actions: ["clearHomeContinueLoading", "prefetchNextModule"]
|
|
522
|
+
},
|
|
523
|
+
RESET: {
|
|
450
524
|
target: "idle",
|
|
451
525
|
actions: "resetContext"
|
|
452
|
-
}
|
|
453
|
-
},
|
|
526
|
+
}
|
|
527
|
+
} },
|
|
454
528
|
runningModule: {
|
|
529
|
+
entry: "clearHomeContinueLoading",
|
|
455
530
|
invoke: {
|
|
456
531
|
id: "currentModule",
|
|
457
532
|
src: "runChildModule",
|
|
458
533
|
input: ({ context }) => {
|
|
459
534
|
if (!context.currentStep) throw new Error("No current step");
|
|
460
|
-
const machine = context.registeredModules[context.currentStep];
|
|
461
|
-
if (!machine) throw new Error(`Module ${context.currentStep} not registered`);
|
|
462
535
|
return {
|
|
463
|
-
machine,
|
|
536
|
+
machine: context.currentModuleMachine,
|
|
464
537
|
config: context.config
|
|
465
538
|
};
|
|
466
539
|
},
|
|
@@ -468,9 +541,8 @@ const orchestratedFlowMachine = setup({
|
|
|
468
541
|
target: "completing",
|
|
469
542
|
guard: "isLastStep"
|
|
470
543
|
}, {
|
|
471
|
-
target: "
|
|
472
|
-
actions: "incrementStep"
|
|
473
|
-
reenter: true
|
|
544
|
+
target: "resolvingModule",
|
|
545
|
+
actions: "incrementStep"
|
|
474
546
|
}],
|
|
475
547
|
onError: {
|
|
476
548
|
target: "error",
|
|
@@ -482,14 +554,14 @@ const orchestratedFlowMachine = setup({
|
|
|
482
554
|
target: "completing",
|
|
483
555
|
guard: "isLastStep"
|
|
484
556
|
}, {
|
|
485
|
-
target: "
|
|
486
|
-
actions: "incrementStep"
|
|
487
|
-
reenter: true
|
|
557
|
+
target: "resolvingModule",
|
|
558
|
+
actions: "incrementStep"
|
|
488
559
|
}],
|
|
489
560
|
MODULE_ERROR: {
|
|
490
561
|
target: "error",
|
|
491
562
|
actions: assign(({ event }) => ({ error: String(event.error) }))
|
|
492
563
|
},
|
|
564
|
+
COMPLETE_FLOW: { target: "completing" },
|
|
493
565
|
RESET: {
|
|
494
566
|
target: "idle",
|
|
495
567
|
actions: "resetContext"
|
|
@@ -522,55 +594,139 @@ const orchestratedFlowMachine = setup({
|
|
|
522
594
|
target: "idle",
|
|
523
595
|
actions: "resetContext"
|
|
524
596
|
} } },
|
|
525
|
-
error: {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
597
|
+
error: {
|
|
598
|
+
entry: "clearHomeContinueLoading",
|
|
599
|
+
on: { RESET: {
|
|
600
|
+
target: "idle",
|
|
601
|
+
actions: "resetContext"
|
|
602
|
+
} }
|
|
603
|
+
}
|
|
529
604
|
}
|
|
530
605
|
});
|
|
531
606
|
|
|
532
607
|
//#endregion
|
|
533
608
|
//#region src/modules/flow/orchestratedFlowManager.ts
|
|
534
|
-
function
|
|
609
|
+
function deriveUiModel(snapshot, mappedStatus, isHomePhase, options) {
|
|
610
|
+
const { enableHome } = options;
|
|
611
|
+
const serverDisablesLaunch = snapshot.context.flow?.disableLaunchScreen === true;
|
|
612
|
+
const effectiveEnableHome = enableHome === true && serverDisablesLaunch === false;
|
|
613
|
+
const isTerminal = mappedStatus === "finished" || mappedStatus === "error";
|
|
614
|
+
const awaitingOrchestrator = mappedStatus === "idle" || mappedStatus === "loading";
|
|
615
|
+
const isCompletingPhase = snapshot.value === "completing";
|
|
616
|
+
const firstRealIndex = snapshot.context.steps[0] === "REDIRECT_TO_MOBILE" ? 1 : 0;
|
|
617
|
+
const isAtFirstRealModule = snapshot.context.currentStepIndex === firstRealIndex;
|
|
618
|
+
const isResolvingHomeAnchor = snapshot.value === "resolvingModule" && effectiveEnableHome && isAtFirstRealModule;
|
|
619
|
+
const isHomeBoundPhase = isHomePhase || isResolvingHomeAnchor;
|
|
620
|
+
const canShowHome = isTerminal === false && effectiveEnableHome && isCompletingPhase === false;
|
|
621
|
+
const visible = canShowHome ? isHomeBoundPhase : false;
|
|
622
|
+
const lazyModuleKey = mappedStatus === "ready" && visible === false ? snapshot.context.currentStep : void 0;
|
|
623
|
+
const shouldPrefetchHome = canShowHome && snapshot.context.isHomeContinueLoading === false && isHomeBoundPhase;
|
|
624
|
+
return {
|
|
625
|
+
homeScreen: {
|
|
626
|
+
visible,
|
|
627
|
+
isContinueLoading: isTerminal ? false : snapshot.context.isHomeContinueLoading
|
|
628
|
+
},
|
|
629
|
+
presentation: {
|
|
630
|
+
isAwaitingReady: awaitingOrchestrator,
|
|
631
|
+
lazyModuleKey,
|
|
632
|
+
shouldPrefetchHome
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function getMappedStatus(snapshot) {
|
|
637
|
+
const { value } = snapshot;
|
|
638
|
+
if (value === "idle") return "idle";
|
|
639
|
+
if (value === "loading" || value === "resolvingModule" || value === "completing" || typeof value === "object") return "loading";
|
|
640
|
+
if (value === "finished") return "finished";
|
|
641
|
+
if (value === "error") return "error";
|
|
642
|
+
return "ready";
|
|
643
|
+
}
|
|
644
|
+
function mapOrchestratedFlowState(snapshot, uiOptions) {
|
|
535
645
|
const { value, context } = snapshot;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
646
|
+
const mappedStatus = getMappedStatus(snapshot);
|
|
647
|
+
const uiModel = deriveUiModel(snapshot, mappedStatus, value === "home", uiOptions);
|
|
648
|
+
if (mappedStatus === "idle") return {
|
|
649
|
+
status: "idle",
|
|
650
|
+
homeScreen: uiModel.homeScreen,
|
|
651
|
+
presentation: uiModel.presentation
|
|
652
|
+
};
|
|
653
|
+
if (mappedStatus === "loading") return {
|
|
654
|
+
status: "loading",
|
|
655
|
+
homeScreen: uiModel.homeScreen,
|
|
656
|
+
presentation: uiModel.presentation
|
|
657
|
+
};
|
|
658
|
+
if (mappedStatus === "finished") return {
|
|
659
|
+
status: "finished",
|
|
660
|
+
flow: context.flow ?? {},
|
|
661
|
+
finishStatus: context.finishStatus ?? {
|
|
662
|
+
redirectionUrl: "",
|
|
663
|
+
action: "none",
|
|
664
|
+
scoreStatus: "UNKNOWN"
|
|
665
|
+
},
|
|
666
|
+
homeScreen: uiModel.homeScreen,
|
|
667
|
+
presentation: uiModel.presentation
|
|
668
|
+
};
|
|
669
|
+
if (mappedStatus === "error") return {
|
|
670
|
+
status: "error",
|
|
671
|
+
error: context.error ?? "Unknown error",
|
|
672
|
+
errorCode: context.errorCode,
|
|
673
|
+
homeScreen: uiModel.homeScreen,
|
|
674
|
+
presentation: uiModel.presentation
|
|
675
|
+
};
|
|
676
|
+
const childSnapshot = value === "runningModule" ? snapshot.children.currentModule?.getSnapshot() : null;
|
|
677
|
+
return {
|
|
678
|
+
status: "ready",
|
|
679
|
+
flow: context.flow ?? {},
|
|
680
|
+
steps: context.steps,
|
|
681
|
+
currentStepIndex: context.currentStepIndex,
|
|
682
|
+
currentStep: context.currentStep,
|
|
683
|
+
config: context.config,
|
|
684
|
+
moduleState: childSnapshot ?? null,
|
|
685
|
+
homeScreen: uiModel.homeScreen,
|
|
686
|
+
presentation: uiModel.presentation
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
function waitForOrchestratorReadyFromActor(actor, mapState$1, isResolved) {
|
|
690
|
+
return new Promise((resolve, reject) => {
|
|
691
|
+
const initial = mapState$1(actor.getSnapshot());
|
|
692
|
+
if (isResolved(initial)) {
|
|
693
|
+
resolve();
|
|
694
|
+
return;
|
|
550
695
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
696
|
+
if (initial.status === "error") {
|
|
697
|
+
reject(new Error(initial.error));
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
if (initial.status === "finished") {
|
|
701
|
+
reject(/* @__PURE__ */ new Error("Flow finished"));
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const subscription = actor.subscribe(() => {
|
|
705
|
+
const next = mapState$1(actor.getSnapshot());
|
|
706
|
+
if (isResolved(next)) {
|
|
707
|
+
subscription.unsubscribe();
|
|
708
|
+
resolve();
|
|
709
|
+
} else if (next.status === "error") {
|
|
710
|
+
subscription.unsubscribe();
|
|
711
|
+
reject(new Error(next.error));
|
|
712
|
+
} else if (next.status === "finished") {
|
|
713
|
+
subscription.unsubscribe();
|
|
714
|
+
reject(/* @__PURE__ */ new Error("Flow finished"));
|
|
558
715
|
}
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
status: "error",
|
|
562
|
-
error: context.error ?? "Unknown error"
|
|
563
|
-
};
|
|
564
|
-
default: return { status: "idle" };
|
|
565
|
-
}
|
|
716
|
+
});
|
|
717
|
+
});
|
|
566
718
|
}
|
|
567
|
-
function
|
|
719
|
+
function createOrchestratedFlowApi({ actor, getSnapshot, trackElementClicked }, uiOptions) {
|
|
720
|
+
const { enableHome } = uiOptions;
|
|
721
|
+
function mapSnapshot() {
|
|
722
|
+
return mapOrchestratedFlowState(getSnapshot(), { enableHome });
|
|
723
|
+
}
|
|
568
724
|
function getCanNext() {
|
|
569
725
|
const snapshot = getSnapshot();
|
|
570
726
|
const { currentStepIndex, steps } = snapshot.context;
|
|
571
727
|
return snapshot.value === "runningModule" && currentStepIndex >= 0 && currentStepIndex < steps.length - 1;
|
|
572
728
|
}
|
|
573
|
-
function getModuleConfig(moduleKey) {
|
|
729
|
+
function getModuleConfig$1(moduleKey) {
|
|
574
730
|
const snapshot = getSnapshot();
|
|
575
731
|
if (snapshot.value !== "runningModule") return;
|
|
576
732
|
return (snapshot.context.flow?.flowModules.find((m) => m.key === moduleKey))?.configuration;
|
|
@@ -585,14 +741,20 @@ function createApi({ actor, getSnapshot }) {
|
|
|
585
741
|
actor.send({ type: "LOAD" });
|
|
586
742
|
},
|
|
587
743
|
cancel() {
|
|
744
|
+
trackElementClicked?.("cancel");
|
|
588
745
|
actor.send({ type: "CANCEL" });
|
|
589
746
|
},
|
|
590
747
|
reset() {
|
|
591
748
|
actor.send({ type: "RESET" });
|
|
592
749
|
},
|
|
593
750
|
completeModule() {
|
|
751
|
+
trackElementClicked?.("completeModule");
|
|
594
752
|
actor.send({ type: "MODULE_COMPLETE" });
|
|
595
753
|
},
|
|
754
|
+
completeFlow() {
|
|
755
|
+
trackElementClicked?.("completeFlow");
|
|
756
|
+
actor.send({ type: "COMPLETE_FLOW" });
|
|
757
|
+
},
|
|
596
758
|
errorModule(error) {
|
|
597
759
|
actor.send({
|
|
598
760
|
type: "MODULE_ERROR",
|
|
@@ -605,24 +767,59 @@ function createApi({ actor, getSnapshot }) {
|
|
|
605
767
|
get canNext() {
|
|
606
768
|
return getCanNext();
|
|
607
769
|
},
|
|
608
|
-
getModuleConfig,
|
|
609
|
-
isModuleEnabled
|
|
770
|
+
getModuleConfig: getModuleConfig$1,
|
|
771
|
+
isModuleEnabled,
|
|
772
|
+
isAwaitingOrchestratorReady() {
|
|
773
|
+
return mapSnapshot().presentation.isAwaitingReady;
|
|
774
|
+
},
|
|
775
|
+
async waitForReady() {
|
|
776
|
+
return waitForOrchestratorReadyFromActor(actor, (snap) => mapOrchestratedFlowState(snap, { enableHome }), (next) => next.status === "ready" && next.presentation.isAwaitingReady === false);
|
|
777
|
+
},
|
|
778
|
+
getLazyModuleKey() {
|
|
779
|
+
return mapSnapshot().presentation.lazyModuleKey;
|
|
780
|
+
},
|
|
781
|
+
shouldRenderHomeScreen() {
|
|
782
|
+
return mapSnapshot().homeScreen.visible;
|
|
783
|
+
},
|
|
784
|
+
async continueFromHome() {
|
|
785
|
+
const state = mapSnapshot();
|
|
786
|
+
if (!state.homeScreen.visible) return;
|
|
787
|
+
if (state.status === "ready") {
|
|
788
|
+
trackElementClicked?.("homeContinue");
|
|
789
|
+
actor.send({ type: "HOME_CONTINUE" });
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
if (state.presentation.isAwaitingReady) {
|
|
793
|
+
trackElementClicked?.("homeContinue");
|
|
794
|
+
actor.send({ type: "HOME_CONTINUE" });
|
|
795
|
+
try {
|
|
796
|
+
await waitForOrchestratorReadyFromActor(actor, (snap) => mapOrchestratedFlowState(snap, { enableHome }), (next) => next.status === "ready" && next.homeScreen.visible === false);
|
|
797
|
+
} catch {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
610
802
|
};
|
|
611
803
|
}
|
|
612
804
|
function createOrchestratedFlowActor(options) {
|
|
613
805
|
return createActor(orchestratedFlowMachine, { input: {
|
|
614
806
|
getFlow: options.getFlow ?? getFlow,
|
|
615
807
|
modules: options.modules,
|
|
616
|
-
|
|
808
|
+
lazyModules: options.lazyModules,
|
|
809
|
+
getFinishStatus: options.getFinishStatus,
|
|
810
|
+
enableHome: options.enableHome
|
|
617
811
|
} }).start();
|
|
618
812
|
}
|
|
619
813
|
function createOrchestratedFlowManager(options) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
814
|
+
const actor = createOrchestratedFlowActor(options);
|
|
815
|
+
const enableHome = options.enableHome === true;
|
|
816
|
+
const uiOpts = { enableHome };
|
|
817
|
+
return attachFlowEventEmitter(createManager({
|
|
818
|
+
actor,
|
|
819
|
+
mapState: (snapshot) => mapOrchestratedFlowState(snapshot, uiOpts),
|
|
820
|
+
createApi: (apiOpts) => createOrchestratedFlowApi(apiOpts, { enableHome })
|
|
821
|
+
}));
|
|
625
822
|
}
|
|
626
823
|
|
|
627
824
|
//#endregion
|
|
628
|
-
export { createFlowManager, createModuleLoader, createOrchestratedFlowManager, getRequiredWasmPipelines };
|
|
825
|
+
export { createFlowManager, createModuleLoader, createOrchestratedFlowManager, getFlow, getRequiredWasmPipelines, noOpFlowModuleMachine, normalizeFlowModules };
|