@incodetech/core 0.0.0-dev-20260416-bf5b221 → 0.0.0-dev-20260417-78468b3
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/ae-signature.d.ts +1 -1
- package/dist/consent.d.ts +50 -50
- package/dist/document-capture.d.ts +76 -76
- package/dist/document-upload.d.ts +46 -46
- package/dist/ekyb.esm.js +2 -2
- package/dist/{ekybStateMachine-BfBs85Uj.esm.js → ekybStateMachine-BdztAoD6.esm.js} +1 -1
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/flow.d.ts +28 -3
- package/dist/flow.esm.js +248 -91
- package/dist/{flowServices-BjihIhLr.esm.js → flowServices-ibDApkcC.esm.js} +1 -9
- package/dist/home.d.ts +10 -10
- package/dist/identity-reuse.d.ts +40 -40
- package/dist/{index-D91wFwyA.d.ts → index-KnSX6CGk.d.ts} +119 -119
- package/dist/mandatory-consent.d.ts +50 -50
- package/dist/qe-signature.d.ts +1 -1
- package/dist/workflow.d.ts +114 -114
- package/dist/workflow.esm.js +2 -2
- package/package.json +1 -1
package/dist/flow.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import "./session-4kX3TYAC.esm.js";
|
|
|
4
4
|
import "./BrowserEnvironmentProvider-D7IR7V-D.esm.js";
|
|
5
5
|
import "./browserSimulation-UTYyQOiB.esm.js";
|
|
6
6
|
import { a as createActor, i as fromPromise, n as assign, o as createManager, t as setup } from "./xstate.esm-BlgyVBVv.esm.js";
|
|
7
|
-
import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-
|
|
7
|
+
import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-ibDApkcC.esm.js";
|
|
8
8
|
import { t as getFinishStatus } from "./flowCompletionService-BoRh9z5O.esm.js";
|
|
9
9
|
import { t as runChildModule } from "./runChildModule-CPESMGyI.esm.js";
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ function createFlowActor(options) {
|
|
|
137
137
|
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/modules/flow/flowManager.ts
|
|
140
|
-
function mapState
|
|
140
|
+
function mapState(snapshot) {
|
|
141
141
|
const { value, context } = snapshot;
|
|
142
142
|
switch (value) {
|
|
143
143
|
case "idle": return { status: "idle" };
|
|
@@ -161,7 +161,7 @@ function mapState$1(snapshot) {
|
|
|
161
161
|
default: return { status: "idle" };
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function createApi
|
|
164
|
+
function createApi({ actor, getSnapshot, trackElementClicked }) {
|
|
165
165
|
function getCanNext() {
|
|
166
166
|
const snapshot = getSnapshot();
|
|
167
167
|
const { currentStepIndex, steps } = snapshot.context;
|
|
@@ -239,8 +239,8 @@ function createApi$1({ actor, getSnapshot, trackElementClicked }) {
|
|
|
239
239
|
function createFlowManager(options) {
|
|
240
240
|
return createManager({
|
|
241
241
|
actor: createFlowActor(options),
|
|
242
|
-
mapState
|
|
243
|
-
createApi
|
|
242
|
+
mapState,
|
|
243
|
+
createApi,
|
|
244
244
|
instrumentation: createManagerInstrumentation("FLOW")
|
|
245
245
|
});
|
|
246
246
|
}
|
|
@@ -287,6 +287,48 @@ function createModuleLoader(registry) {
|
|
|
287
287
|
|
|
288
288
|
//#endregion
|
|
289
289
|
//#region src/modules/flow/orchestratedFlowStateMachine.ts
|
|
290
|
+
function createBaseContext(context, isHomeContinueLoading) {
|
|
291
|
+
return {
|
|
292
|
+
flow: void 0,
|
|
293
|
+
error: void 0,
|
|
294
|
+
steps: [],
|
|
295
|
+
currentStepIndex: -1,
|
|
296
|
+
currentStep: void 0,
|
|
297
|
+
config: void 0,
|
|
298
|
+
getFlow: context.getFlow,
|
|
299
|
+
registeredModules: context.registeredModules,
|
|
300
|
+
lazyRegisteredModules: context.lazyRegisteredModules,
|
|
301
|
+
currentModuleMachine: void 0,
|
|
302
|
+
getFinishStatus: context.getFinishStatus,
|
|
303
|
+
enableHome: context.enableHome,
|
|
304
|
+
finishStatus: void 0,
|
|
305
|
+
isHomeContinueLoading
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function createInitialContext(input) {
|
|
309
|
+
return createBaseContext({
|
|
310
|
+
getFlow: input.getFlow,
|
|
311
|
+
registeredModules: input.modules ?? {},
|
|
312
|
+
lazyRegisteredModules: input.lazyModules ?? {},
|
|
313
|
+
getFinishStatus: input.getFinishStatus ?? getFinishStatus,
|
|
314
|
+
enableHome: input.enableHome === true
|
|
315
|
+
}, false);
|
|
316
|
+
}
|
|
317
|
+
function shouldEnterHome(context) {
|
|
318
|
+
return context.enableHome === true && context.currentStepIndex === 0 && context.isHomeContinueLoading === false;
|
|
319
|
+
}
|
|
320
|
+
const prefetchedLazyModules = /* @__PURE__ */ new WeakSet();
|
|
321
|
+
function prefetchNextLazyModule(context) {
|
|
322
|
+
const nextStep = context.steps[context.currentStepIndex + 1];
|
|
323
|
+
if (!nextStep) return;
|
|
324
|
+
const nextLazyModule = context.lazyRegisteredModules[nextStep];
|
|
325
|
+
if (!nextLazyModule || prefetchedLazyModules.has(nextLazyModule)) return;
|
|
326
|
+
prefetchedLazyModules.add(nextLazyModule);
|
|
327
|
+
nextLazyModule().catch(() => {
|
|
328
|
+
prefetchedLazyModules.delete(nextLazyModule);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const homeContinueOn = { HOME_CONTINUE: { actions: "setHomeContinueLoading" } };
|
|
290
332
|
const orchestratedFlowMachine = setup({
|
|
291
333
|
types: {
|
|
292
334
|
context: {},
|
|
@@ -313,20 +355,10 @@ const orchestratedFlowMachine = setup({
|
|
|
313
355
|
})
|
|
314
356
|
},
|
|
315
357
|
actions: {
|
|
316
|
-
resetContext: assign(({ context }) => (
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
currentStepIndex: -1,
|
|
321
|
-
currentStep: void 0,
|
|
322
|
-
config: void 0,
|
|
323
|
-
getFlow: context.getFlow,
|
|
324
|
-
registeredModules: context.registeredModules,
|
|
325
|
-
lazyRegisteredModules: context.lazyRegisteredModules,
|
|
326
|
-
currentModuleMachine: void 0,
|
|
327
|
-
getFinishStatus: context.getFinishStatus,
|
|
328
|
-
finishStatus: void 0
|
|
329
|
-
})),
|
|
358
|
+
resetContext: assign(({ context }) => createBaseContext(context, false)),
|
|
359
|
+
resetContextForLoad: assign(({ context }) => createBaseContext(context, context.isHomeContinueLoading)),
|
|
360
|
+
setHomeContinueLoading: assign({ isHomeContinueLoading: true }),
|
|
361
|
+
clearHomeContinueLoading: assign({ isHomeContinueLoading: false }),
|
|
330
362
|
setFlowData: assign(({ event }) => {
|
|
331
363
|
const flow = event.output;
|
|
332
364
|
const flowModules = flow.flowModules ?? [];
|
|
@@ -360,11 +392,15 @@ const orchestratedFlowMachine = setup({
|
|
|
360
392
|
};
|
|
361
393
|
}),
|
|
362
394
|
setCurrentModuleMachine: assign(({ event }) => ({ currentModuleMachine: event.output })),
|
|
395
|
+
prefetchNextModule: ({ context }) => {
|
|
396
|
+
prefetchNextLazyModule(context);
|
|
397
|
+
},
|
|
363
398
|
setFinishStatus: assign(({ event }) => ({ finishStatus: event.output }))
|
|
364
399
|
},
|
|
365
400
|
guards: {
|
|
366
401
|
isLastStep: ({ context }) => context.currentStepIndex >= 0 && context.currentStepIndex === context.steps.length - 1,
|
|
367
402
|
canGoNext: ({ context }) => context.currentStepIndex >= 0 && context.currentStepIndex < context.steps.length - 1,
|
|
403
|
+
shouldEnterHome: ({ context }) => shouldEnterHome(context),
|
|
368
404
|
hasModule: ({ context, event }) => {
|
|
369
405
|
if (!("output" in event)) return false;
|
|
370
406
|
const firstModuleKey = event.output.flowModules?.[0]?.key;
|
|
@@ -379,25 +415,15 @@ const orchestratedFlowMachine = setup({
|
|
|
379
415
|
}).createMachine({
|
|
380
416
|
id: "orchestratedFlow",
|
|
381
417
|
initial: "idle",
|
|
382
|
-
context: ({ input }) => (
|
|
383
|
-
flow: void 0,
|
|
384
|
-
error: void 0,
|
|
385
|
-
steps: [],
|
|
386
|
-
currentStepIndex: -1,
|
|
387
|
-
currentStep: void 0,
|
|
388
|
-
config: void 0,
|
|
389
|
-
getFlow: input.getFlow,
|
|
390
|
-
registeredModules: input.modules ?? {},
|
|
391
|
-
lazyRegisteredModules: input.lazyModules ?? {},
|
|
392
|
-
currentModuleMachine: void 0,
|
|
393
|
-
getFinishStatus: input.getFinishStatus ?? getFinishStatus,
|
|
394
|
-
finishStatus: void 0
|
|
395
|
-
}),
|
|
418
|
+
context: ({ input }) => createInitialContext(input),
|
|
396
419
|
states: {
|
|
397
|
-
idle: { on: {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
420
|
+
idle: { on: {
|
|
421
|
+
LOAD: {
|
|
422
|
+
target: "loading",
|
|
423
|
+
actions: "resetContextForLoad"
|
|
424
|
+
},
|
|
425
|
+
...homeContinueOn
|
|
426
|
+
} },
|
|
401
427
|
loading: {
|
|
402
428
|
invoke: {
|
|
403
429
|
id: "fetchFlow",
|
|
@@ -419,10 +445,13 @@ const orchestratedFlowMachine = setup({
|
|
|
419
445
|
actions: "setError"
|
|
420
446
|
}
|
|
421
447
|
},
|
|
422
|
-
on: {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
448
|
+
on: {
|
|
449
|
+
CANCEL: {
|
|
450
|
+
target: "idle",
|
|
451
|
+
actions: "resetContext"
|
|
452
|
+
},
|
|
453
|
+
...homeContinueOn
|
|
454
|
+
}
|
|
426
455
|
},
|
|
427
456
|
resolvingModule: {
|
|
428
457
|
invoke: {
|
|
@@ -433,25 +462,47 @@ const orchestratedFlowMachine = setup({
|
|
|
433
462
|
modules: context.registeredModules,
|
|
434
463
|
lazyModules: context.lazyRegisteredModules
|
|
435
464
|
}),
|
|
436
|
-
onDone: [
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
465
|
+
onDone: [
|
|
466
|
+
{
|
|
467
|
+
target: "home",
|
|
468
|
+
guard: "shouldEnterHome",
|
|
469
|
+
actions: ["setCurrentModuleMachine", "prefetchNextModule"]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
target: "runningModule",
|
|
473
|
+
guard: "hasCurrentModuleMachine",
|
|
474
|
+
actions: ["setCurrentModuleMachine", "prefetchNextModule"]
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
target: "error",
|
|
478
|
+
actions: assign(({ context }) => ({ error: context.currentStep ? `No registered module found for: ${context.currentStep}` : "No registered module found: flow has no modules" }))
|
|
479
|
+
}
|
|
480
|
+
],
|
|
444
481
|
onError: {
|
|
445
482
|
target: "error",
|
|
446
483
|
actions: "setError"
|
|
447
484
|
}
|
|
448
485
|
},
|
|
449
|
-
on: {
|
|
486
|
+
on: {
|
|
487
|
+
RESET: {
|
|
488
|
+
target: "idle",
|
|
489
|
+
actions: "resetContext"
|
|
490
|
+
},
|
|
491
|
+
...homeContinueOn
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
home: { on: {
|
|
495
|
+
HOME_CONTINUE: {
|
|
496
|
+
target: "runningModule",
|
|
497
|
+
actions: "clearHomeContinueLoading"
|
|
498
|
+
},
|
|
499
|
+
RESET: {
|
|
450
500
|
target: "idle",
|
|
451
501
|
actions: "resetContext"
|
|
452
|
-
}
|
|
453
|
-
},
|
|
502
|
+
}
|
|
503
|
+
} },
|
|
454
504
|
runningModule: {
|
|
505
|
+
entry: "clearHomeContinueLoading",
|
|
455
506
|
invoke: {
|
|
456
507
|
id: "currentModule",
|
|
457
508
|
src: "runChildModule",
|
|
@@ -519,49 +570,124 @@ const orchestratedFlowMachine = setup({
|
|
|
519
570
|
target: "idle",
|
|
520
571
|
actions: "resetContext"
|
|
521
572
|
} } },
|
|
522
|
-
error: {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
573
|
+
error: {
|
|
574
|
+
entry: "clearHomeContinueLoading",
|
|
575
|
+
on: { RESET: {
|
|
576
|
+
target: "idle",
|
|
577
|
+
actions: "resetContext"
|
|
578
|
+
} }
|
|
579
|
+
}
|
|
526
580
|
}
|
|
527
581
|
});
|
|
528
582
|
|
|
529
583
|
//#endregion
|
|
530
584
|
//#region src/modules/flow/orchestratedFlowManager.ts
|
|
531
|
-
function
|
|
585
|
+
function deriveUiModel(snapshot, mappedStatus, isHomePhase, options) {
|
|
586
|
+
const { enableHome } = options;
|
|
587
|
+
const isTerminal = mappedStatus === "finished" || mappedStatus === "error";
|
|
588
|
+
const awaitingOrchestrator = mappedStatus === "idle" || mappedStatus === "loading";
|
|
589
|
+
const visible = isTerminal === false && enableHome === true ? awaitingOrchestrator || isHomePhase : false;
|
|
590
|
+
const lazyModuleKey = mappedStatus === "ready" && visible === false ? snapshot.context.currentStep : void 0;
|
|
591
|
+
const shouldPrefetchHome = isTerminal === false && enableHome === true && snapshot.context.isHomeContinueLoading === false && (awaitingOrchestrator || isHomePhase);
|
|
592
|
+
return {
|
|
593
|
+
homeScreen: {
|
|
594
|
+
visible,
|
|
595
|
+
isContinueLoading: isTerminal ? false : snapshot.context.isHomeContinueLoading
|
|
596
|
+
},
|
|
597
|
+
presentation: {
|
|
598
|
+
isAwaitingReady: awaitingOrchestrator,
|
|
599
|
+
lazyModuleKey,
|
|
600
|
+
shouldPrefetchHome
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function getMappedStatus(snapshot) {
|
|
605
|
+
const { value } = snapshot;
|
|
606
|
+
if (value === "idle") return "idle";
|
|
607
|
+
if (value === "loading" || value === "resolvingModule" || typeof value === "object") return "loading";
|
|
608
|
+
if (value === "finished") return "finished";
|
|
609
|
+
if (value === "error") return "error";
|
|
610
|
+
return "ready";
|
|
611
|
+
}
|
|
612
|
+
function mapOrchestratedFlowState(snapshot, uiOptions) {
|
|
532
613
|
const { value, context } = snapshot;
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
614
|
+
const mappedStatus = getMappedStatus(snapshot);
|
|
615
|
+
const uiModel = deriveUiModel(snapshot, mappedStatus, value === "home", uiOptions);
|
|
616
|
+
if (mappedStatus === "idle") return {
|
|
617
|
+
status: "idle",
|
|
618
|
+
homeScreen: uiModel.homeScreen,
|
|
619
|
+
presentation: uiModel.presentation
|
|
620
|
+
};
|
|
621
|
+
if (mappedStatus === "loading") return {
|
|
622
|
+
status: "loading",
|
|
623
|
+
homeScreen: uiModel.homeScreen,
|
|
624
|
+
presentation: uiModel.presentation
|
|
625
|
+
};
|
|
626
|
+
if (mappedStatus === "finished") return {
|
|
627
|
+
status: "finished",
|
|
628
|
+
flow: context.flow ?? {},
|
|
629
|
+
finishStatus: context.finishStatus ?? {
|
|
630
|
+
redirectionUrl: "",
|
|
631
|
+
action: "none",
|
|
632
|
+
scoreStatus: "UNKNOWN"
|
|
633
|
+
},
|
|
634
|
+
homeScreen: uiModel.homeScreen,
|
|
635
|
+
presentation: uiModel.presentation
|
|
636
|
+
};
|
|
637
|
+
if (mappedStatus === "error") return {
|
|
638
|
+
status: "error",
|
|
639
|
+
error: context.error ?? "Unknown error",
|
|
640
|
+
homeScreen: uiModel.homeScreen,
|
|
641
|
+
presentation: uiModel.presentation
|
|
642
|
+
};
|
|
643
|
+
const childSnapshot = value === "runningModule" ? snapshot.children.currentModule?.getSnapshot() : null;
|
|
644
|
+
return {
|
|
645
|
+
status: "ready",
|
|
646
|
+
flow: context.flow ?? {},
|
|
647
|
+
steps: context.steps,
|
|
648
|
+
currentStepIndex: context.currentStepIndex,
|
|
649
|
+
currentStep: context.currentStep,
|
|
650
|
+
config: context.config,
|
|
651
|
+
moduleState: childSnapshot ?? null,
|
|
652
|
+
homeScreen: uiModel.homeScreen,
|
|
653
|
+
presentation: uiModel.presentation
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
function waitForOrchestratorReadyFromActor(actor, mapState$1, isResolved) {
|
|
657
|
+
return new Promise((resolve, reject) => {
|
|
658
|
+
const initial = mapState$1(actor.getSnapshot());
|
|
659
|
+
if (isResolved(initial)) {
|
|
660
|
+
resolve();
|
|
661
|
+
return;
|
|
547
662
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
663
|
+
if (initial.status === "error") {
|
|
664
|
+
reject(new Error(initial.error));
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (initial.status === "finished") {
|
|
668
|
+
reject(/* @__PURE__ */ new Error("Flow finished"));
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const subscription = actor.subscribe(() => {
|
|
672
|
+
const next = mapState$1(actor.getSnapshot());
|
|
673
|
+
if (isResolved(next)) {
|
|
674
|
+
subscription.unsubscribe();
|
|
675
|
+
resolve();
|
|
676
|
+
} else if (next.status === "error") {
|
|
677
|
+
subscription.unsubscribe();
|
|
678
|
+
reject(new Error(next.error));
|
|
679
|
+
} else if (next.status === "finished") {
|
|
680
|
+
subscription.unsubscribe();
|
|
681
|
+
reject(/* @__PURE__ */ new Error("Flow finished"));
|
|
555
682
|
}
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
status: "error",
|
|
559
|
-
error: context.error ?? "Unknown error"
|
|
560
|
-
};
|
|
561
|
-
default: return { status: "idle" };
|
|
562
|
-
}
|
|
683
|
+
});
|
|
684
|
+
});
|
|
563
685
|
}
|
|
564
|
-
function
|
|
686
|
+
function createOrchestratedFlowApi({ actor, getSnapshot, trackElementClicked }, uiOptions) {
|
|
687
|
+
const { enableHome } = uiOptions;
|
|
688
|
+
function mapSnapshot() {
|
|
689
|
+
return mapOrchestratedFlowState(getSnapshot(), { enableHome });
|
|
690
|
+
}
|
|
565
691
|
function getCanNext() {
|
|
566
692
|
const snapshot = getSnapshot();
|
|
567
693
|
const { currentStepIndex, steps } = snapshot.context;
|
|
@@ -609,7 +735,34 @@ function createApi({ actor, getSnapshot, trackElementClicked }) {
|
|
|
609
735
|
return getCanNext();
|
|
610
736
|
},
|
|
611
737
|
getModuleConfig,
|
|
612
|
-
isModuleEnabled
|
|
738
|
+
isModuleEnabled,
|
|
739
|
+
isAwaitingOrchestratorReady() {
|
|
740
|
+
return mapSnapshot().presentation.isAwaitingReady;
|
|
741
|
+
},
|
|
742
|
+
getLazyModuleKey() {
|
|
743
|
+
return mapSnapshot().presentation.lazyModuleKey;
|
|
744
|
+
},
|
|
745
|
+
shouldRenderHomeScreen() {
|
|
746
|
+
return mapSnapshot().homeScreen.visible;
|
|
747
|
+
},
|
|
748
|
+
async continueFromHome() {
|
|
749
|
+
const state = mapSnapshot();
|
|
750
|
+
if (!state.homeScreen.visible) return;
|
|
751
|
+
if (state.status === "ready") {
|
|
752
|
+
trackElementClicked?.("homeContinue");
|
|
753
|
+
actor.send({ type: "HOME_CONTINUE" });
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (state.presentation.isAwaitingReady) {
|
|
757
|
+
trackElementClicked?.("homeContinue");
|
|
758
|
+
actor.send({ type: "HOME_CONTINUE" });
|
|
759
|
+
try {
|
|
760
|
+
await waitForOrchestratorReadyFromActor(actor, (snap) => mapOrchestratedFlowState(snap, { enableHome }), (next) => next.status === "ready" && next.homeScreen.visible === false);
|
|
761
|
+
} catch {
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
613
766
|
};
|
|
614
767
|
}
|
|
615
768
|
function createOrchestratedFlowActor(options) {
|
|
@@ -617,14 +770,18 @@ function createOrchestratedFlowActor(options) {
|
|
|
617
770
|
getFlow: options.getFlow ?? getFlow,
|
|
618
771
|
modules: options.modules,
|
|
619
772
|
lazyModules: options.lazyModules,
|
|
620
|
-
getFinishStatus: options.getFinishStatus
|
|
773
|
+
getFinishStatus: options.getFinishStatus,
|
|
774
|
+
enableHome: options.enableHome
|
|
621
775
|
} }).start();
|
|
622
776
|
}
|
|
623
777
|
function createOrchestratedFlowManager(options) {
|
|
778
|
+
const actor = createOrchestratedFlowActor(options);
|
|
779
|
+
const enableHome = options.enableHome === true;
|
|
780
|
+
const uiOpts = { enableHome };
|
|
624
781
|
return createManager({
|
|
625
|
-
actor
|
|
626
|
-
mapState,
|
|
627
|
-
createApi,
|
|
782
|
+
actor,
|
|
783
|
+
mapState: (snapshot) => mapOrchestratedFlowState(snapshot, uiOpts),
|
|
784
|
+
createApi: (apiOpts) => createOrchestratedFlowApi(apiOpts, { enableHome }),
|
|
628
785
|
instrumentation: createManagerInstrumentation("FLOW")
|
|
629
786
|
});
|
|
630
787
|
}
|
|
@@ -46,7 +46,6 @@ function getRequiredWasmPipelines(flow) {
|
|
|
46
46
|
*/
|
|
47
47
|
function normalizeFlowModules(flow, options = {}) {
|
|
48
48
|
let modules = normalizeIdModules(flow.flowModules);
|
|
49
|
-
if (options.enableHome === true && !hasModule(modules, "HOME")) modules = addHome(modules);
|
|
50
49
|
if (shouldInjectRedirect(flow, modules, options)) modules = addRedirect(flow, modules, options);
|
|
51
50
|
return modules;
|
|
52
51
|
}
|
|
@@ -72,17 +71,10 @@ function normalizeIdModules(modules) {
|
|
|
72
71
|
return [module];
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
|
-
function addHome(modules) {
|
|
76
|
-
return [{
|
|
77
|
-
key: "HOME",
|
|
78
|
-
configuration: {}
|
|
79
|
-
}, ...modules];
|
|
80
|
-
}
|
|
81
74
|
function shouldInjectRedirect(flow, modules, options) {
|
|
82
75
|
return options.isDesktop === true && flow.redirectDesktopToMobile === true && !hasModule(modules, "REDIRECT_TO_MOBILE");
|
|
83
76
|
}
|
|
84
77
|
function addRedirect(flow, modules, options) {
|
|
85
|
-
const modulesWithoutHome = modules.filter((module) => module.key !== "HOME");
|
|
86
78
|
return [{
|
|
87
79
|
key: "REDIRECT_TO_MOBILE",
|
|
88
80
|
configuration: {
|
|
@@ -93,7 +85,7 @@ function addRedirect(flow, modules, options) {
|
|
|
93
85
|
authHint: options.authHint,
|
|
94
86
|
lang: options.lang
|
|
95
87
|
}
|
|
96
|
-
}, ...
|
|
88
|
+
}, ...modules];
|
|
97
89
|
}
|
|
98
90
|
function hasModule(modules, key) {
|
|
99
91
|
return modules.some((module) => module.key === key);
|
package/dist/home.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { t as Manager } from "./Manager-C1r-74H0.js";
|
|
|
2
2
|
import "./camera-C1Lz6NFz.js";
|
|
3
3
|
import "./types-DGwsRYfm.js";
|
|
4
4
|
import { t as EmptyConfig } from "./types-x6tue2ld.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as xstate1140 from "xstate";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/home/types.d.ts
|
|
8
8
|
type HomeConfig = EmptyConfig;
|
|
@@ -34,41 +34,41 @@ type HomeContext = {
|
|
|
34
34
|
type HomeInput = {
|
|
35
35
|
config: EmptyConfig;
|
|
36
36
|
};
|
|
37
|
-
declare const homeMachine:
|
|
37
|
+
declare const homeMachine: xstate1140.StateMachine<HomeContext, {
|
|
38
38
|
type: "LOAD";
|
|
39
39
|
} | {
|
|
40
40
|
type: "COMPLETE";
|
|
41
41
|
} | {
|
|
42
42
|
type: "RESET";
|
|
43
|
-
}, {}, never, never, never, never, "idle" | "finished" | "main", string, HomeInput,
|
|
43
|
+
}, {}, never, never, never, never, "idle" | "finished" | "main", string, HomeInput, xstate1140.NonReducibleUnknown, xstate1140.EventObject, xstate1140.MetaObject, {
|
|
44
44
|
readonly id: "home";
|
|
45
45
|
readonly initial: "idle";
|
|
46
46
|
readonly context: ({
|
|
47
47
|
input
|
|
48
48
|
}: {
|
|
49
49
|
spawn: {
|
|
50
|
-
<TSrc extends never>(logic: TSrc, ...[options]: never):
|
|
51
|
-
<TLogic extends
|
|
50
|
+
<TSrc extends never>(logic: TSrc, ...[options]: never): xstate1140.ActorRefFromLogic<never>;
|
|
51
|
+
<TLogic extends xstate1140.AnyActorLogic>(src: TLogic, ...[options]: xstate1140.ConditionalRequired<[options?: ({
|
|
52
52
|
id?: never;
|
|
53
53
|
systemId?: string;
|
|
54
|
-
input?:
|
|
54
|
+
input?: xstate1140.InputFrom<TLogic> | undefined;
|
|
55
55
|
syncSnapshot?: boolean;
|
|
56
|
-
} & { [K in
|
|
56
|
+
} & { [K in xstate1140.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate1140.IsNotNever<xstate1140.RequiredLogicInput<TLogic>>>): xstate1140.ActorRefFromLogic<TLogic>;
|
|
57
57
|
};
|
|
58
58
|
input: HomeInput;
|
|
59
|
-
self:
|
|
59
|
+
self: xstate1140.ActorRef<xstate1140.MachineSnapshot<HomeContext, {
|
|
60
60
|
type: "LOAD";
|
|
61
61
|
} | {
|
|
62
62
|
type: "COMPLETE";
|
|
63
63
|
} | {
|
|
64
64
|
type: "RESET";
|
|
65
|
-
}, Record<string,
|
|
65
|
+
}, Record<string, xstate1140.AnyActorRef | undefined>, xstate1140.StateValue, string, unknown, any, any>, {
|
|
66
66
|
type: "LOAD";
|
|
67
67
|
} | {
|
|
68
68
|
type: "COMPLETE";
|
|
69
69
|
} | {
|
|
70
70
|
type: "RESET";
|
|
71
|
-
},
|
|
71
|
+
}, xstate1140.AnyEventObject>;
|
|
72
72
|
}) => {
|
|
73
73
|
config: EmptyConfig;
|
|
74
74
|
};
|