@incodetech/core 0.0.0-dev-20260909-14ef44cf → 0.0.0-dev-20260911-3c28f170

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.
Files changed (67) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-BqvOagjI.esm.js → BrowserDiagnosticsCryptoProvider-D8H3nWpr.esm.js} +1 -1
  2. package/dist/{MotionSensorProvider-nnSH-kVd.esm.js → MotionSensorProvider-Vlyhbcty.esm.js} +1 -1
  3. package/dist/ae-signature.esm.js +1 -1
  4. package/dist/{apiError-CE5YD5T0.esm.js → apiError-CY6lWIaQ.esm.js} +1 -1
  5. package/dist/authentication.esm.js +2 -2
  6. package/dist/{authenticationManager-BMqAIjH1.esm.js → authenticationManager-BxkiSz79.esm.js} +4 -4
  7. package/dist/{authenticationStateMachine-BKMxS3yH.esm.js → authenticationStateMachine-DAQ4dBAD.esm.js} +2 -2
  8. package/dist/camera.esm.js +1 -1
  9. package/dist/{deepsightLoader-nTArZgT2.esm.js → deepsightLoader-Cpjfw3EQ.esm.js} +5 -5
  10. package/dist/device.esm.js +5 -2
  11. package/dist/document-capture.esm.js +2 -2
  12. package/dist/{documentCaptureManager-BqY_B0Ii.esm.js → documentCaptureManager-BTpHZMgW.esm.js} +1 -1
  13. package/dist/{documentCaptureStateMachine-D_9dw5b1.esm.js → documentCaptureStateMachine-CPizkpcg.esm.js} +2 -2
  14. package/dist/dynamic-forms.esm.js +2 -2
  15. package/dist/{dynamicFormsManager-HVbJKaF8.esm.js → dynamicFormsManager-CKkEm4x5.esm.js} +1 -1
  16. package/dist/{dynamicFormsStateMachine-BGYqEGcO.esm.js → dynamicFormsStateMachine-CoBVJjYk.esm.js} +1 -1
  17. package/dist/ekyb.esm.js +3 -3
  18. package/dist/{ekybManager-D080qI3d.esm.js → ekybManager-hFZnmQzb.esm.js} +1 -1
  19. package/dist/{ekybStateMachine-4Ac_gP-0.esm.js → ekybStateMachine-CHzi9XHk.esm.js} +1 -1
  20. package/dist/electronic-signature.esm.js +1 -1
  21. package/dist/{electronicSignatureManager-CuZp9R8p.esm.js → electronicSignatureManager-vLj_aBwI.esm.js} +1 -1
  22. package/dist/extensibility.esm.js +12 -12
  23. package/dist/{faceCaptureManagerFactory-waLeHRj_.esm.js → faceCaptureManagerFactory-BRuA7cbI.esm.js} +3 -3
  24. package/dist/{faceCaptureSetup-JxQbmDt_.esm.js → faceCaptureSetup-Bhpk__dy.esm.js} +3 -3
  25. package/dist/{feature-management-DkbzJPHi.esm.js → feature-management-Dd_npJ0p.esm.js} +30 -5
  26. package/dist/feature-management.esm.js +1 -1
  27. package/dist/flow.d.ts +202 -177
  28. package/dist/flow.esm.js +107 -24
  29. package/dist/{flowCompletionService-1HFgv9BU.esm.js → flowCompletionService-cuWgokHI.esm.js} +1 -1
  30. package/dist/{flowServices-C2pUbFWe.esm.js → flowServices-CzgZ-VRv.esm.js} +83 -14
  31. package/dist/geolocation.esm.js +2 -2
  32. package/dist/{geolocationManager-CeDChUNS.esm.js → geolocationManager-Vh9KYMeo.esm.js} +1 -1
  33. package/dist/{geolocationStateMachine-C1fxKLJP.esm.js → geolocationStateMachine-BPzG-LrP.esm.js} +1 -1
  34. package/dist/id-selfie-flow.esm.js +8 -8
  35. package/dist/id.esm.js +4 -4
  36. package/dist/{idCaptureDefaults-CbCpNaoY.esm.js → idCaptureDefaults-Dic5mQfO.esm.js} +3 -2
  37. package/dist/{idCaptureManager-Cpd9uT8z.esm.js → idCaptureManager-De-5JavX.esm.js} +5 -5
  38. package/dist/{idCaptureServices-X5poMwbu.esm.js → idCaptureServices-BZvFZyyy.esm.js} +4 -4
  39. package/dist/{idCaptureStateMachine-BZPAUJzI.esm.js → idCaptureStateMachine-UTll8mMx.esm.js} +9 -9
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.esm.js +1 -1
  42. package/dist/{onDeviceFaceResults-BgIPrRr2.esm.js → onDeviceFaceResults-CU5XlhqG.esm.js} +6 -5
  43. package/dist/{permissionGuards-BHw_SD3h.esm.js → permissionGuards-DxbvOoZJ.esm.js} +1 -1
  44. package/dist/{permissionServices-J5S1dEIf.esm.js → permissionServices-f7nBnW5P.esm.js} +2 -2
  45. package/dist/personhood.esm.js +6 -6
  46. package/dist/qe-signature.esm.js +1 -1
  47. package/dist/{runChildModule-Bq791c2t.esm.js → runChildModule-6P8ofHxL.esm.js} +1 -1
  48. package/dist/safeStorage-Dp9m6aOh.esm.js +422 -0
  49. package/dist/{sdkVersion-Bc55H50S.esm.js → sdkVersion-DlL6SxXs.esm.js} +1 -1
  50. package/dist/selfie.esm.js +6 -6
  51. package/dist/{selfieManager-I_h3YE2X.esm.js → selfieManager-C4esDm_H.esm.js} +4 -4
  52. package/dist/{selfieStateMachine-DJwDxPAT.esm.js → selfieStateMachine-B7vhKLV7.esm.js} +2 -2
  53. package/dist/{session-CoY3St8F.esm.js → session-DWnBmR2a.esm.js} +3 -3
  54. package/dist/session.d.ts +16 -1
  55. package/dist/session.esm.js +5 -5
  56. package/dist/{sessionInitializer-BEjB0UVH.esm.js → sessionInitializer-DUpE6yBR.esm.js} +92 -33
  57. package/dist/{setup-DLn1eHU9.esm.js → setup-CQNSur1c.esm.js} +8 -6
  58. package/dist/{setup-B9s2jaZK.d.ts → setup-D6yz9se2.d.ts} +14 -0
  59. package/dist/{trueSightService-VUN8WK4N.esm.js → trueSightService-CvdDnFul.esm.js} +2 -2
  60. package/dist/video-selfie.esm.js +5 -5
  61. package/dist/{videoSelfieCameraWarmer-Dkey7P7h.esm.js → videoSelfieCameraWarmer-Gcgw9ze7.esm.js} +4 -4
  62. package/dist/{safeStorage-0bZuUtSP.esm.js → warmup-BOM-sD-6.esm.js} +14 -434
  63. package/dist/wasm.d.ts +1 -1
  64. package/dist/wasm.esm.js +2 -2
  65. package/dist/{wasmDsFlagSync-CyCdsfox.esm.js → wasmDsFlagSync-C3k_VK9o.esm.js} +1 -1
  66. package/dist/workflow.esm.js +15 -15
  67. package/package.json +3 -3
package/dist/flow.d.ts CHANGED
@@ -16,6 +16,192 @@ import { t as RedirectToMobileConfig } from "./types-DPIDuhut.js";
16
16
  import { a as TotalScore, c as getTotalScoreStatus, n as FinishStatus, o as classifyScoreStatus, r as GetFinishStatusFn, t as FinishScreenVariant } from "./flowCompletionService-BlAHsKyv.js";
17
17
  import { o as FlowEventSubscribable } from "./index-1PoJuUJ-.js";
18
18
  import { n as ModuleRegistry } from "./types-BfgmV7s7.js";
19
+ //#region src/modules/flow/orchestratedFlowStateMachine.d.ts
20
+ type GetFlowFn = (signal: AbortSignal) => Promise<Flow>;
21
+ type LazyModuleRegistry = {
22
+ [key: string]: (() => Promise<AnyStateMachine | {
23
+ default: AnyStateMachine;
24
+ }>) | undefined;
25
+ };
26
+ type OrchestratedFlowInput = {
27
+ getFlow: GetFlowFn;
28
+ modules?: ModuleRegistry;
29
+ lazyModules?: LazyModuleRegistry;
30
+ getFinishStatus?: GetFinishStatusFn;
31
+ enableHome?: boolean;
32
+ /**
33
+ * The flow was fetched with `getFlow(..., { deferActivation: true })`: the
34
+ * machine completes activation itself (feature-management flow id, then
35
+ * MANDATORY_CONSENT from the device fingerprint) right before the first
36
+ * module runs — on the Start tap when there is a home screen — so neither
37
+ * the flow fetch nor the home screen waits for feature-config, Statsig or
38
+ * the fingerprint.
39
+ */
40
+ deferActivation?: boolean;
41
+ };
42
+ type OrchestratedFlowEvent = {
43
+ type: 'LOAD';
44
+ } | {
45
+ type: 'CANCEL';
46
+ } | {
47
+ type: 'RESET';
48
+ } | {
49
+ type: 'MODULE_COMPLETE';
50
+ output?: unknown;
51
+ } | {
52
+ type: 'COMPLETE_FLOW';
53
+ } | {
54
+ type: 'FINISH_FLOW';
55
+ } | {
56
+ type: 'HOME_CONTINUE';
57
+ } | {
58
+ type: '*';
59
+ [key: string]: unknown;
60
+ } | {
61
+ type: string;
62
+ [key: string]: unknown;
63
+ };
64
+ //#endregion
65
+ //#region src/modules/flow/orchestratedFlowManager.d.ts
66
+ type OrchestratedFlowHomeScreen = {
67
+ visible: boolean;
68
+ isContinueLoading: boolean;
69
+ };
70
+ type OrchestratedFlowPresentation = {
71
+ isAwaitingReady: boolean;
72
+ lazyModuleKey: string | undefined;
73
+ shouldPrefetchHome: boolean;
74
+ };
75
+ type OrchestratedFlowIdleState = {
76
+ status: 'idle';
77
+ homeScreen: OrchestratedFlowHomeScreen;
78
+ presentation: OrchestratedFlowPresentation;
79
+ };
80
+ type OrchestratedFlowLoadingState = {
81
+ status: 'loading';
82
+ homeScreen: OrchestratedFlowHomeScreen;
83
+ presentation: OrchestratedFlowPresentation;
84
+ };
85
+ type OrchestratedFlowCompletingState = {
86
+ status: 'completing';
87
+ homeScreen: OrchestratedFlowHomeScreen;
88
+ presentation: OrchestratedFlowPresentation;
89
+ };
90
+ type OrchestratedFlowReadyState = {
91
+ status: 'ready';
92
+ flow: Flow;
93
+ steps: string[];
94
+ currentStepIndex: number;
95
+ currentStep: string | undefined;
96
+ config: unknown;
97
+ moduleState: unknown;
98
+ homeScreen: OrchestratedFlowHomeScreen;
99
+ presentation: OrchestratedFlowPresentation;
100
+ };
101
+ type OrchestratedFlowFinishedState = {
102
+ status: 'finished';
103
+ flow: Flow;
104
+ finishStatus: {
105
+ redirectionUrl: string;
106
+ action: 'approved' | 'rejected' | 'none';
107
+ scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
108
+ endScreenTitle: string | null;
109
+ endScreenText: string | null;
110
+ };
111
+ homeScreen: OrchestratedFlowHomeScreen;
112
+ presentation: OrchestratedFlowPresentation;
113
+ };
114
+ type OrchestratedFlowErrorState = {
115
+ status: 'error';
116
+ error?: string;
117
+ errorCode?: number;
118
+ moduleErrorCode?: string;
119
+ homeScreen: OrchestratedFlowHomeScreen;
120
+ presentation: OrchestratedFlowPresentation;
121
+ };
122
+ type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowCompletingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState;
123
+ type CreateOrchestratedFlowActorOptions = {
124
+ getFlow?: GetFlowFn;
125
+ modules?: ModuleRegistry;
126
+ lazyModules?: LazyModuleRegistry;
127
+ getFinishStatus?: OrchestratedFlowInput['getFinishStatus'];
128
+ enableHome?: boolean;
129
+ deferActivation?: OrchestratedFlowInput['deferActivation'];
130
+ };
131
+ declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager<OrchestratedFlowState> & {
132
+ /**
133
+ * Start loading the flow configuration from the backend.
134
+ */
135
+ load(): void;
136
+ /**
137
+ * Cancel an in-progress flow load.
138
+ */
139
+ cancel(): void;
140
+ /**
141
+ * Reset the flow to its initial idle state.
142
+ */
143
+ reset(): void;
144
+ /**
145
+ * Signal that the current module has completed successfully.
146
+ * Call this from your UI component's `onFinish` callback.
147
+ *
148
+ * @example
149
+ * ```tsx
150
+ * <Phone
151
+ * config={config}
152
+ * onFinish={() => flowManager.completeModule()}
153
+ * />
154
+ * ```
155
+ */
156
+ completeModule(output?: unknown): void;
157
+ /**
158
+ * Skip all remaining modules and complete the flow now, notifying the
159
+ * backend (getFinishStatus) on the way to the completion step.
160
+ */
161
+ completeFlow(): void;
162
+ /**
163
+ * Finish the flow because the onboarding was already completed externally —
164
+ * e.g. the REDIRECT_TO_MOBILE handoff finished end-to-end on mobile. Lands
165
+ * on the completion screen WITHOUT calling getFinishStatus: mobile already
166
+ * notified the backend, and the desktop never reached its own finish.
167
+ * Use this (not `completeFlow`) from REDIRECT_TO_MOBILE's `onFinish`.
168
+ */
169
+ finishFlow(): void;
170
+ /**
171
+ * Signal that the current module encountered a terminal error, optionally
172
+ * with its machine-readable `moduleErrorCode`. The flow machine decides what
173
+ * to do: an advanceable terminal error (e.g. `NONEXISTENT_CUSTOMER`,
174
+ * `HINT_NOT_PROVIDED`) advances to the next step; any other error transitions
175
+ * to the terminal error state. Callers always forward the code and let core
176
+ * classify — no per-module branching in the UI.
177
+ *
178
+ * @param error - Error message describing what went wrong. Omit it to let
179
+ * the UI fall back to its own generic error copy (e.g. TerminalErrorPage's
180
+ * `common.unexpectedError`) instead of surfacing a raw/technical string.
181
+ * @param moduleErrorCode - Optional machine-readable error code (a
182
+ * `FaceErrorCode`) used by the flow machine to decide advance vs terminate
183
+ */
184
+ errorModule(error?: string, moduleErrorCode?: string): void;
185
+ /**
186
+ * Send a raw event to the flow state machine.
187
+ * Prefer using the typed methods (completeModule, errorModule) when possible.
188
+ */
189
+ send(event: OrchestratedFlowEvent): void;
190
+ readonly canNext: boolean;
191
+ getModuleConfig: <T = unknown>(moduleKey: string) => T | undefined;
192
+ isModuleEnabled: (moduleKey: string) => boolean;
193
+ isAwaitingOrchestratorReady(): boolean;
194
+ /**
195
+ * Resolve once the orchestrator has finished loading the flow and the first
196
+ * module is ready to render. Useful for gating an initialization spinner
197
+ * alongside other parallel async work (e.g. theme fetching).
198
+ */
199
+ waitForReady(): Promise<void>;
200
+ getLazyModuleKey(): string | undefined;
201
+ shouldRenderHomeScreen(): boolean;
202
+ continueFromHome(): Promise<void>;
203
+ } & FlowEventSubscribable;
204
+ //#endregion
19
205
  //#region src/modules/flow/flowUtils.d.ts
20
206
  type NormalizeFlowModulesOptions = {
21
207
  isDesktop?: boolean;
@@ -45,6 +231,12 @@ declare function enrichFlowModuleConfig(module: FlowModule, flow: Flow): Record<
45
231
  * ```
46
232
  */
47
233
  declare function getRequiredWasmPipelines(flow: Flow): WasmPipeline[];
234
+ /**
235
+ * The current capture requirement, then one capture ahead once it is ready.
236
+ * Home never looks past its first capture, and redirects stop lookahead.
237
+ * @internal Used by the shared flow shell after rendering.
238
+ */
239
+ declare function getNextRequiredWasmPipelines(state: Pick<OrchestratedFlowReadyState, 'flow' | 'currentStepIndex' | 'homeScreen'>, loadedPipelines?: readonly WasmPipeline[]): WasmPipeline[];
48
240
  /**
49
241
  * Normalizes flow modules by expanding TUTORIAL_ID into ID + SECOND_ID
50
242
  * based on configuration flags. Matches legacy flowService behavior.
@@ -68,6 +260,15 @@ type GetFlowOptions = {
68
260
  authHint?: string;
69
261
  lang?: string;
70
262
  useCPF?: boolean;
263
+ /**
264
+ * Return the flow as soon as it is fetched and normalized, without waiting
265
+ * for session activation: the Statsig `flow_id` update and the
266
+ * mandatory-consent injection (which rides on the device fingerprint) are
267
+ * left to `completeDeferredActivation`, which the caller must run before the
268
+ * first module starts — the orchestrated flow machine does this on the Start
269
+ * tap when there is a home screen, right after loading otherwise.
270
+ */
271
+ deferActivation?: boolean;
71
272
  };
72
273
  type GetFlow = (signal: AbortSignal, options?: GetFlowOptions) => Promise<Flow>;
73
274
  type DashboardResolvedModuleConfigMap = {
@@ -245,180 +446,4 @@ interface ModuleLoader {
245
446
  }
246
447
  declare function createModuleLoader(registry: ModuleLoaderRegistry): ModuleLoader;
247
448
  //#endregion
248
- //#region src/modules/flow/orchestratedFlowStateMachine.d.ts
249
- type GetFlowFn = (signal: AbortSignal) => Promise<Flow>;
250
- type LazyModuleRegistry = {
251
- [key: string]: (() => Promise<AnyStateMachine | {
252
- default: AnyStateMachine;
253
- }>) | undefined;
254
- };
255
- type OrchestratedFlowInput = {
256
- getFlow: GetFlowFn;
257
- modules?: ModuleRegistry;
258
- lazyModules?: LazyModuleRegistry;
259
- getFinishStatus?: GetFinishStatusFn;
260
- enableHome?: boolean;
261
- };
262
- type OrchestratedFlowEvent = {
263
- type: 'LOAD';
264
- } | {
265
- type: 'CANCEL';
266
- } | {
267
- type: 'RESET';
268
- } | {
269
- type: 'MODULE_COMPLETE';
270
- output?: unknown;
271
- } | {
272
- type: 'COMPLETE_FLOW';
273
- } | {
274
- type: 'FINISH_FLOW';
275
- } | {
276
- type: 'HOME_CONTINUE';
277
- } | {
278
- type: '*';
279
- [key: string]: unknown;
280
- } | {
281
- type: string;
282
- [key: string]: unknown;
283
- };
284
- //#endregion
285
- //#region src/modules/flow/orchestratedFlowManager.d.ts
286
- type OrchestratedFlowHomeScreen = {
287
- visible: boolean;
288
- isContinueLoading: boolean;
289
- };
290
- type OrchestratedFlowPresentation = {
291
- isAwaitingReady: boolean;
292
- lazyModuleKey: string | undefined;
293
- shouldPrefetchHome: boolean;
294
- };
295
- type OrchestratedFlowIdleState = {
296
- status: 'idle';
297
- homeScreen: OrchestratedFlowHomeScreen;
298
- presentation: OrchestratedFlowPresentation;
299
- };
300
- type OrchestratedFlowLoadingState = {
301
- status: 'loading';
302
- homeScreen: OrchestratedFlowHomeScreen;
303
- presentation: OrchestratedFlowPresentation;
304
- };
305
- type OrchestratedFlowCompletingState = {
306
- status: 'completing';
307
- homeScreen: OrchestratedFlowHomeScreen;
308
- presentation: OrchestratedFlowPresentation;
309
- };
310
- type OrchestratedFlowReadyState = {
311
- status: 'ready';
312
- flow: Flow;
313
- steps: string[];
314
- currentStepIndex: number;
315
- currentStep: string | undefined;
316
- config: unknown;
317
- moduleState: unknown;
318
- homeScreen: OrchestratedFlowHomeScreen;
319
- presentation: OrchestratedFlowPresentation;
320
- };
321
- type OrchestratedFlowFinishedState = {
322
- status: 'finished';
323
- flow: Flow;
324
- finishStatus: {
325
- redirectionUrl: string;
326
- action: 'approved' | 'rejected' | 'none';
327
- scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
328
- endScreenTitle: string | null;
329
- endScreenText: string | null;
330
- };
331
- homeScreen: OrchestratedFlowHomeScreen;
332
- presentation: OrchestratedFlowPresentation;
333
- };
334
- type OrchestratedFlowErrorState = {
335
- status: 'error';
336
- error?: string;
337
- errorCode?: number;
338
- moduleErrorCode?: string;
339
- homeScreen: OrchestratedFlowHomeScreen;
340
- presentation: OrchestratedFlowPresentation;
341
- };
342
- type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowCompletingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState;
343
- type CreateOrchestratedFlowActorOptions = {
344
- getFlow?: GetFlowFn;
345
- modules?: ModuleRegistry;
346
- lazyModules?: LazyModuleRegistry;
347
- getFinishStatus?: OrchestratedFlowInput['getFinishStatus'];
348
- enableHome?: boolean;
349
- };
350
- declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager<OrchestratedFlowState> & {
351
- /**
352
- * Start loading the flow configuration from the backend.
353
- */
354
- load(): void;
355
- /**
356
- * Cancel an in-progress flow load.
357
- */
358
- cancel(): void;
359
- /**
360
- * Reset the flow to its initial idle state.
361
- */
362
- reset(): void;
363
- /**
364
- * Signal that the current module has completed successfully.
365
- * Call this from your UI component's `onFinish` callback.
366
- *
367
- * @example
368
- * ```tsx
369
- * <Phone
370
- * config={config}
371
- * onFinish={() => flowManager.completeModule()}
372
- * />
373
- * ```
374
- */
375
- completeModule(output?: unknown): void;
376
- /**
377
- * Skip all remaining modules and complete the flow now, notifying the
378
- * backend (getFinishStatus) on the way to the completion step.
379
- */
380
- completeFlow(): void;
381
- /**
382
- * Finish the flow because the onboarding was already completed externally —
383
- * e.g. the REDIRECT_TO_MOBILE handoff finished end-to-end on mobile. Lands
384
- * on the completion screen WITHOUT calling getFinishStatus: mobile already
385
- * notified the backend, and the desktop never reached its own finish.
386
- * Use this (not `completeFlow`) from REDIRECT_TO_MOBILE's `onFinish`.
387
- */
388
- finishFlow(): void;
389
- /**
390
- * Signal that the current module encountered a terminal error, optionally
391
- * with its machine-readable `moduleErrorCode`. The flow machine decides what
392
- * to do: an advanceable terminal error (e.g. `NONEXISTENT_CUSTOMER`,
393
- * `HINT_NOT_PROVIDED`) advances to the next step; any other error transitions
394
- * to the terminal error state. Callers always forward the code and let core
395
- * classify — no per-module branching in the UI.
396
- *
397
- * @param error - Error message describing what went wrong. Omit it to let
398
- * the UI fall back to its own generic error copy (e.g. TerminalErrorPage's
399
- * `common.unexpectedError`) instead of surfacing a raw/technical string.
400
- * @param moduleErrorCode - Optional machine-readable error code (a
401
- * `FaceErrorCode`) used by the flow machine to decide advance vs terminate
402
- */
403
- errorModule(error?: string, moduleErrorCode?: string): void;
404
- /**
405
- * Send a raw event to the flow state machine.
406
- * Prefer using the typed methods (completeModule, errorModule) when possible.
407
- */
408
- send(event: OrchestratedFlowEvent): void;
409
- readonly canNext: boolean;
410
- getModuleConfig: <T = unknown>(moduleKey: string) => T | undefined;
411
- isModuleEnabled: (moduleKey: string) => boolean;
412
- isAwaitingOrchestratorReady(): boolean;
413
- /**
414
- * Resolve once the orchestrator has finished loading the flow and the first
415
- * module is ready to render. Useful for gating an initialization spinner
416
- * alongside other parallel async work (e.g. theme fetching).
417
- */
418
- waitForReady(): Promise<void>;
419
- getLazyModuleKey(): string | undefined;
420
- shouldRenderHomeScreen(): boolean;
421
- continueFromHome(): Promise<void>;
422
- } & FlowEventSubscribable;
423
- //#endregion
424
- export { type DeepPartial, type FinishScreenVariant, type FinishStatus, type Flow, type FlowModule, type FlowModuleConfig, type FlowReadyState, type FlowState, type LazyModule, type LazyModuleRegistry, type ModuleLoader, type ModuleLoaderRegistry, type ModuleRegistry, type OrchestratedFlowCompletingState, type OrchestratedFlowFinishedState, type OrchestratedFlowHomeScreen, type OrchestratedFlowInput, type OrchestratedFlowPresentation, type OrchestratedFlowReadyState, type OrchestratedFlowState, type ResolveDashboardModuleConfigOptions, type ResolvedDashboardModuleConfig, type TotalScore, classifyScoreStatus, createFlowManager, createModuleLoader, createOrchestratedFlowManager, enrichFlowModuleConfig, getFlow, getRequiredWasmPipelines, getTotalScoreStatus, mergeDashboardConfig, noOpFlowModuleMachine, normalizeFlowModules, preloadDashboardFlow, resolveDashboardModuleConfig };
449
+ export { type DeepPartial, type FinishScreenVariant, type FinishStatus, type Flow, type FlowModule, type FlowModuleConfig, type FlowReadyState, type FlowState, type LazyModule, type LazyModuleRegistry, type ModuleLoader, type ModuleLoaderRegistry, type ModuleRegistry, type OrchestratedFlowCompletingState, type OrchestratedFlowFinishedState, type OrchestratedFlowHomeScreen, type OrchestratedFlowInput, type OrchestratedFlowPresentation, type OrchestratedFlowReadyState, type OrchestratedFlowState, type ResolveDashboardModuleConfigOptions, type ResolvedDashboardModuleConfig, type TotalScore, classifyScoreStatus, createFlowManager, createModuleLoader, createOrchestratedFlowManager, enrichFlowModuleConfig, getFlow, getNextRequiredWasmPipelines, getRequiredWasmPipelines, getTotalScoreStatus, mergeDashboardConfig, noOpFlowModuleMachine, normalizeFlowModules, preloadDashboardFlow, resolveDashboardModuleConfig };
package/dist/flow.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { v as addEvent } from "./events-ijlbX_Wx.esm.js";
2
- import { a as enrichFlowModuleConfig, c as resolveFlowModuleConfig, i as resolveDashboardModuleConfig, k as mergeDashboardConfig, n as preloadDashboardFlow, o as getRequiredWasmPipelines, s as normalizeFlowModules, t as getFlow } from "./flowServices-C2pUbFWe.esm.js";
2
+ import { a as resolveDashboardModuleConfig, c as getRequiredWasmPipelines, j as mergeDashboardConfig, l as normalizeFlowModules, n as getFlow, o as enrichFlowModuleConfig, r as preloadDashboardFlow, s as getNextRequiredWasmPipelines, t as completeDeferredActivation, u as resolveFlowModuleConfig } from "./flowServices-CzgZ-VRv.esm.js";
3
3
  import { i as assign, s as createActor, t as setup, u as createManager } from "./xstate.esm-BuFLFuzz.esm.js";
4
4
  import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
5
- import { n as getFinishStatus, r as getTotalScoreStatus, t as classifyScoreStatus } from "./flowCompletionService-1HFgv9BU.esm.js";
6
- import { n as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-Bq791c2t.esm.js";
5
+ import { n as getFinishStatus, r as getTotalScoreStatus, t as classifyScoreStatus } from "./flowCompletionService-cuWgokHI.esm.js";
6
+ import { n as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-6P8ofHxL.esm.js";
7
7
  import { n as isAdvanceableError } from "./advanceableErrors-CpF2cBy6.esm.js";
8
8
  //#region src/modules/flow/noOpFlowModuleMachine.ts
9
9
  const noOpFlowModuleMachine = setup({}).createMachine({
@@ -363,6 +363,8 @@ function createBaseContext(context, isHomeContinueLoading) {
363
363
  enableHome: context.enableHome,
364
364
  finishStatus: void 0,
365
365
  isHomeContinueLoading,
366
+ deferActivation: context.deferActivation,
367
+ activationResolved: false,
366
368
  skipFaceMatch: false
367
369
  };
368
370
  }
@@ -372,13 +374,21 @@ function createInitialContext(input) {
372
374
  registeredModules: input.modules ?? {},
373
375
  lazyRegisteredModules: input.lazyModules ?? {},
374
376
  getFinishStatus: input.getFinishStatus ?? getFinishStatus,
375
- enableHome: input.enableHome === true
377
+ enableHome: input.enableHome === true,
378
+ deferActivation: input.deferActivation === true
376
379
  }, false);
377
380
  }
381
+ /**
382
+ * Whether this flow shows a home screen at all. Shared by `shouldEnterHome`
383
+ * (step-position aware) and the `activatesBeforeFirstModule` guard (which runs
384
+ * before `setFlowData`, so it reads the freshly fetched flow instead of
385
+ * `context.flow`) — keep the home-screen conditions in this one place.
386
+ */
387
+ function homeScreenEnabled(context, flow) {
388
+ return context.enableHome === true && flow?.disableLaunchScreen !== true && context.isHomeContinueLoading !== true;
389
+ }
378
390
  function shouldEnterHome(context) {
379
- if (context.enableHome !== true) return false;
380
- if (context.flow?.disableLaunchScreen === true) return false;
381
- if (context.isHomeContinueLoading === true) return false;
391
+ if (!homeScreenEnabled(context, context.flow)) return false;
382
392
  const firstRealIndex = context.steps[0] === "REDIRECT_TO_MOBILE" ? 1 : 0;
383
393
  return context.currentStepIndex === firstRealIndex;
384
394
  }
@@ -408,6 +418,10 @@ const orchestratedFlowMachine = setup({
408
418
  return await input.getFinishStatus(input.flowId, signal);
409
419
  }),
410
420
  runChildModule,
421
+ resolveActivation: fromPromise(async ({ input, signal }) => {
422
+ if (!input.flow) throw new Error("No flow loaded");
423
+ return completeDeferredActivation(input.flow, signal);
424
+ }),
411
425
  resolveCurrentModuleMachine: fromPromise(async ({ input }) => {
412
426
  if (!input.moduleKey) return;
413
427
  const eagerMachine = input.modules[input.moduleKey];
@@ -438,6 +452,25 @@ const orchestratedFlowMachine = setup({
438
452
  currentModuleMachine: void 0
439
453
  };
440
454
  }),
455
+ setActivatedFlow: assign(({ context, event }) => {
456
+ const flow = event.output;
457
+ const flowModules = flow.flowModules ?? [];
458
+ const steps = flowModules.map((m) => m.key);
459
+ let insertedAt = steps.findIndex((key, i) => key !== context.steps[i]);
460
+ if (insertedAt === -1) insertedAt = steps.length;
461
+ const currentStepIndex = steps.length === context.steps.length ? context.currentStepIndex : Math.min(context.currentStepIndex, insertedAt);
462
+ const module = flowModules[currentStepIndex];
463
+ return {
464
+ flow,
465
+ steps,
466
+ currentStepIndex,
467
+ currentStep: module?.key,
468
+ config: getModuleConfig(module, flow),
469
+ currentModuleMachine: void 0,
470
+ activationResolved: true
471
+ };
472
+ }),
473
+ markActivationResolved: assign({ activationResolved: true }),
441
474
  setError: assign(({ event }) => {
442
475
  const err = event.error;
443
476
  return {
@@ -492,6 +525,16 @@ const orchestratedFlowMachine = setup({
492
525
  canGoNext: ({ context }) => context.currentStepIndex >= 0 && context.currentStepIndex < context.steps.length - 1,
493
526
  isOnboardingFinishedSignal: ({ event }) => event.output?.action === "onboardingFinished",
494
527
  shouldEnterHome: ({ context }) => shouldEnterHome(context),
528
+ needsActivation: ({ context }) => context.deferActivation && !context.activationResolved && context.currentStep !== "REDIRECT_TO_MOBILE",
529
+ activatesBeforeFirstModule: ({ context, event }) => {
530
+ if (!("output" in event)) return false;
531
+ if (!context.deferActivation || context.activationResolved) return false;
532
+ const flow = event.output;
533
+ const firstModuleKey = flow.flowModules?.[0]?.key;
534
+ if (!firstModuleKey || firstModuleKey === "REDIRECT_TO_MOBILE") return false;
535
+ if (!(context.registeredModules[firstModuleKey] != null || context.lazyRegisteredModules[firstModuleKey] != null)) return false;
536
+ return !homeScreenEnabled(context, flow);
537
+ },
495
538
  hasModule: ({ context, event }) => {
496
539
  if (!("output" in event)) return false;
497
540
  const firstModuleKey = event.output.flowModules?.[0]?.key;
@@ -520,17 +563,25 @@ const orchestratedFlowMachine = setup({
520
563
  id: "fetchFlow",
521
564
  src: "fetchFlow",
522
565
  input: ({ context }) => ({ getFlow: context.getFlow }),
523
- onDone: [{
524
- target: "resolvingModule",
525
- guard: "hasModule",
526
- actions: "setFlowData"
527
- }, {
528
- target: "error",
529
- actions: assign({ error: ({ event }) => {
530
- const firstModuleKey = event.output.flowModules?.[0]?.key;
531
- return firstModuleKey ? `No registered module found for: ${firstModuleKey}` : "No registered module found: flow has no modules";
532
- } })
533
- }],
566
+ onDone: [
567
+ {
568
+ target: "resolvingActivation",
569
+ guard: "activatesBeforeFirstModule",
570
+ actions: "setFlowData"
571
+ },
572
+ {
573
+ target: "resolvingModule",
574
+ guard: "hasModule",
575
+ actions: "setFlowData"
576
+ },
577
+ {
578
+ target: "error",
579
+ actions: assign({ error: ({ event }) => {
580
+ const firstModuleKey = event.output.flowModules?.[0]?.key;
581
+ return firstModuleKey ? `No registered module found for: ${firstModuleKey}` : "No registered module found: flow has no modules";
582
+ } })
583
+ }
584
+ ],
534
585
  onError: {
535
586
  target: "error",
536
587
  actions: "setError"
@@ -559,6 +610,11 @@ const orchestratedFlowMachine = setup({
559
610
  guard: "shouldEnterHome",
560
611
  actions: ["setCurrentModuleMachine"]
561
612
  },
613
+ {
614
+ target: "resolvingActivation",
615
+ guard: "needsActivation",
616
+ actions: ["setCurrentModuleMachine"]
617
+ },
562
618
  {
563
619
  target: "runningModule",
564
620
  guard: "hasCurrentModuleMachine",
@@ -583,15 +639,41 @@ const orchestratedFlowMachine = setup({
583
639
  }
584
640
  },
585
641
  home: { on: {
586
- HOME_CONTINUE: {
642
+ HOME_CONTINUE: [{
643
+ target: "resolvingActivation",
644
+ guard: "needsActivation",
645
+ actions: "setHomeContinueLoading"
646
+ }, {
587
647
  target: "runningModule",
588
648
  actions: ["clearHomeContinueLoading", "prefetchNextModule"]
589
- },
649
+ }],
590
650
  RESET: {
591
651
  target: "idle",
592
652
  actions: "resetContext"
593
653
  }
594
654
  } },
655
+ resolvingActivation: {
656
+ invoke: {
657
+ id: "resolveActivation",
658
+ src: "resolveActivation",
659
+ input: ({ context }) => ({ flow: context.flow }),
660
+ onDone: {
661
+ target: "resolvingModule",
662
+ actions: "setActivatedFlow"
663
+ },
664
+ onError: {
665
+ target: "resolvingModule",
666
+ actions: "markActivationResolved"
667
+ }
668
+ },
669
+ on: {
670
+ RESET: {
671
+ target: "idle",
672
+ actions: "resetContext"
673
+ },
674
+ ...homeContinueOn
675
+ }
676
+ },
595
677
  runningModule: {
596
678
  entry: "clearHomeContinueLoading",
597
679
  invoke: {
@@ -705,7 +787,7 @@ function deriveUiModel(snapshot, mappedStatus, isHomePhase, options) {
705
787
  const isCompletingPhase = snapshot.value === "completing";
706
788
  const firstRealIndex = snapshot.context.steps[0] === "REDIRECT_TO_MOBILE" ? 1 : 0;
707
789
  const isAtFirstRealModule = snapshot.context.currentStepIndex === firstRealIndex;
708
- const isResolvingHomeAnchor = snapshot.value === "resolvingModule" && effectiveEnableHome && isAtFirstRealModule;
790
+ const isResolvingHomeAnchor = (snapshot.value === "resolvingModule" || snapshot.value === "resolvingActivation") && effectiveEnableHome && isAtFirstRealModule;
709
791
  const isHomeBoundPhase = isHomePhase || isResolvingHomeAnchor;
710
792
  const canShowHome = isTerminal === false && effectiveEnableHome && isCompletingPhase === false;
711
793
  const visible = canShowHome ? isHomeBoundPhase : false;
@@ -727,7 +809,7 @@ function getMappedStatus(snapshot) {
727
809
  const { value } = snapshot;
728
810
  if (value === "idle") return "idle";
729
811
  if (value === "completing") return "completing";
730
- if (value === "loading" || value === "resolvingModule" || typeof value === "object") return "loading";
812
+ if (value === "loading" || value === "resolvingModule" || value === "resolvingActivation" || typeof value === "object") return "loading";
731
813
  if (value === "finished") return "finished";
732
814
  if (value === "error") return "error";
733
815
  return "ready";
@@ -969,7 +1051,8 @@ function createOrchestratedFlowActor(options) {
969
1051
  modules: options.modules,
970
1052
  lazyModules: options.lazyModules,
971
1053
  getFinishStatus: options.getFinishStatus,
972
- enableHome: options.enableHome
1054
+ enableHome: options.enableHome,
1055
+ deferActivation: options.deferActivation
973
1056
  } }).start();
974
1057
  }
975
1058
  function createOrchestratedFlowManager(options) {
@@ -983,4 +1066,4 @@ function createOrchestratedFlowManager(options) {
983
1066
  }));
984
1067
  }
985
1068
  //#endregion
986
- export { classifyScoreStatus, createFlowManager, createModuleLoader, createOrchestratedFlowManager, enrichFlowModuleConfig, getFlow, getRequiredWasmPipelines, getTotalScoreStatus, mergeDashboardConfig, noOpFlowModuleMachine, normalizeFlowModules, preloadDashboardFlow, resolveDashboardModuleConfig };
1069
+ export { classifyScoreStatus, createFlowManager, createModuleLoader, createOrchestratedFlowManager, enrichFlowModuleConfig, getFlow, getNextRequiredWasmPipelines, getRequiredWasmPipelines, getTotalScoreStatus, mergeDashboardConfig, noOpFlowModuleMachine, normalizeFlowModules, preloadDashboardFlow, resolveDashboardModuleConfig };
@@ -1,6 +1,6 @@
1
1
  import { t as api } from "./api-Bx3gKW_y.esm.js";
2
2
  import { t as endpoints } from "./endpoints-D3B9mUHh.esm.js";
3
- import { i as toIncodeApiError } from "./apiError-CE5YD5T0.esm.js";
3
+ import { i as toIncodeApiError } from "./apiError-CY6lWIaQ.esm.js";
4
4
  //#region src/modules/flow/flowCompletionService.ts
5
5
  const getFinishStatus = async (flowId, signal) => {
6
6
  const url = `${endpoints.finishStatus}${flowId ? `?flowId=${flowId}` : ""}`;