@incodetech/core 2.0.0-rc.0 → 2.0.0

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