@incodetech/core 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (109) hide show
  1. package/dist/Manager-Cy9-TMC9.d.ts +19 -0
  2. package/dist/OpenViduLogger-20ZYS-mT.esm.js +3 -0
  3. package/dist/OpenViduLogger-5b7KqNTo.esm.js +803 -0
  4. package/dist/StateMachine-BqPpBhOz.d.ts +2 -0
  5. package/dist/addEvent-s2Za-pK3.esm.js +16 -0
  6. package/dist/chunk-C_Yo44FK.esm.js +49 -0
  7. package/dist/deepsightLoader-Bn2D0REl.esm.js +25 -0
  8. package/dist/email.d.ts +264 -0
  9. package/dist/email.esm.js +479 -0
  10. package/dist/endpoints-B0ltwtb5.esm.js +2335 -0
  11. package/dist/flow.d.ts +578 -0
  12. package/dist/flow.esm.js +628 -0
  13. package/dist/getBrowser-CLEzz0Hi.esm.js +8 -0
  14. package/dist/index.d.ts +226 -0
  15. package/dist/index.esm.js +156 -0
  16. package/dist/lib-CykGFCEr.esm.js +11700 -0
  17. package/dist/permissionServices-BhD0KxsO.esm.js +66 -0
  18. package/dist/phone.d.ts +292 -0
  19. package/dist/phone.esm.js +550 -0
  20. package/dist/recordingsRepository-CTjaf-ER.esm.js +256 -0
  21. package/dist/selfie.d.ts +821 -0
  22. package/dist/selfie.esm.js +1087 -0
  23. package/dist/types-Dif6MQmX.d.ts +5 -0
  24. package/dist/warmup-Cijuyvoc.d.ts +55 -0
  25. package/dist/xstate.esm-2T5fOCTq.esm.js +3261 -0
  26. package/package.json +14 -11
  27. package/src/camera/cameraActor.ts +0 -21
  28. package/src/camera/cameraService.test.ts +0 -437
  29. package/src/camera/cameraService.ts +0 -165
  30. package/src/camera/cameraServices.test.ts +0 -66
  31. package/src/camera/cameraServices.ts +0 -26
  32. package/src/camera/cameraStateMachine.test.ts +0 -602
  33. package/src/camera/cameraStateMachine.ts +0 -264
  34. package/src/camera/index.ts +0 -5
  35. package/src/camera/types.ts +0 -17
  36. package/src/device/getBrowser.ts +0 -31
  37. package/src/device/getDeviceClass.ts +0 -29
  38. package/src/device/index.ts +0 -2
  39. package/src/email/__mocks__/emailMocks.ts +0 -59
  40. package/src/email/emailActor.ts +0 -15
  41. package/src/email/emailManager.test.ts +0 -573
  42. package/src/email/emailManager.ts +0 -427
  43. package/src/email/emailServices.ts +0 -66
  44. package/src/email/emailStateMachine.test.ts +0 -741
  45. package/src/email/emailStateMachine.ts +0 -367
  46. package/src/email/index.ts +0 -39
  47. package/src/email/types.ts +0 -60
  48. package/src/events/addEvent.ts +0 -20
  49. package/src/events/types.ts +0 -7
  50. package/src/flow/__mocks__/flowMocks.ts +0 -84
  51. package/src/flow/flowActor.ts +0 -13
  52. package/src/flow/flowAnalyzer.test.ts +0 -266
  53. package/src/flow/flowAnalyzer.ts +0 -37
  54. package/src/flow/flowCompletionService.ts +0 -21
  55. package/src/flow/flowManager.test.ts +0 -560
  56. package/src/flow/flowManager.ts +0 -235
  57. package/src/flow/flowServices.test.ts +0 -109
  58. package/src/flow/flowServices.ts +0 -13
  59. package/src/flow/flowStateMachine.test.ts +0 -334
  60. package/src/flow/flowStateMachine.ts +0 -182
  61. package/src/flow/index.ts +0 -21
  62. package/src/flow/moduleLoader.test.ts +0 -136
  63. package/src/flow/moduleLoader.ts +0 -73
  64. package/src/flow/orchestratedFlowManager.test.ts +0 -240
  65. package/src/flow/orchestratedFlowManager.ts +0 -231
  66. package/src/flow/orchestratedFlowStateMachine.test.ts +0 -199
  67. package/src/flow/orchestratedFlowStateMachine.ts +0 -325
  68. package/src/flow/types.ts +0 -434
  69. package/src/http/__mocks__/api.ts +0 -88
  70. package/src/http/api.test.ts +0 -231
  71. package/src/http/api.ts +0 -90
  72. package/src/http/endpoints.ts +0 -17
  73. package/src/index.ts +0 -33
  74. package/src/permissions/index.ts +0 -2
  75. package/src/permissions/permissionServices.ts +0 -31
  76. package/src/permissions/types.ts +0 -3
  77. package/src/phone/__mocks__/phoneMocks.ts +0 -71
  78. package/src/phone/index.ts +0 -39
  79. package/src/phone/phoneActor.ts +0 -15
  80. package/src/phone/phoneManager.test.ts +0 -393
  81. package/src/phone/phoneManager.ts +0 -458
  82. package/src/phone/phoneServices.ts +0 -98
  83. package/src/phone/phoneStateMachine.test.ts +0 -918
  84. package/src/phone/phoneStateMachine.ts +0 -422
  85. package/src/phone/types.ts +0 -83
  86. package/src/recordings/recordingsRepository.test.ts +0 -87
  87. package/src/recordings/recordingsRepository.ts +0 -48
  88. package/src/recordings/streamingEvents.ts +0 -10
  89. package/src/selfie/__mocks__/selfieMocks.ts +0 -26
  90. package/src/selfie/index.ts +0 -14
  91. package/src/selfie/selfieActor.ts +0 -17
  92. package/src/selfie/selfieErrorUtils.test.ts +0 -116
  93. package/src/selfie/selfieErrorUtils.ts +0 -66
  94. package/src/selfie/selfieManager.test.ts +0 -297
  95. package/src/selfie/selfieManager.ts +0 -301
  96. package/src/selfie/selfieServices.ts +0 -362
  97. package/src/selfie/selfieStateMachine.test.ts +0 -283
  98. package/src/selfie/selfieStateMachine.ts +0 -804
  99. package/src/selfie/selfieUploadService.test.ts +0 -90
  100. package/src/selfie/selfieUploadService.ts +0 -81
  101. package/src/selfie/types.ts +0 -103
  102. package/src/session/index.ts +0 -5
  103. package/src/session/sessionService.ts +0 -78
  104. package/src/setup.test.ts +0 -61
  105. package/src/setup.ts +0 -171
  106. package/tsconfig.json +0 -13
  107. package/tsdown.config.ts +0 -22
  108. package/vitest.config.ts +0 -37
  109. package/vitest.setup.ts +0 -135
package/dist/flow.d.ts ADDED
@@ -0,0 +1,578 @@
1
+ import { t as WasmPipeline } from "./warmup-Cijuyvoc.js";
2
+ import { t as Manager } from "./Manager-Cy9-TMC9.js";
3
+ import { t as AnyStateMachine } from "./StateMachine-BqPpBhOz.js";
4
+
5
+ //#region src/modules/flow/types.d.ts
6
+ type EmptyConfig = Record<string, never>;
7
+ type RegulationTypes = 'US' | 'Worldwide' | 'Other' | 'US_Illinois' | 'US_Texas' | 'US_California' | 'US_Washington';
8
+ type TutorialIdConfig = {
9
+ showTutorial: boolean;
10
+ enableId: boolean;
11
+ enablePassport: boolean;
12
+ onlyFront: boolean;
13
+ onlyBack: boolean;
14
+ barcodeCapture: boolean;
15
+ fetchAdditionalPage: boolean;
16
+ secondId: boolean;
17
+ thirdId: boolean;
18
+ autoCaptureTimeout: number;
19
+ deviceIdleTimeout: number;
20
+ captureAttempts: number;
21
+ manualUploadIdCapture: boolean;
22
+ digitalIdsUpload: boolean;
23
+ showDocumentChooserScreen: boolean;
24
+ enableIdRecording: boolean;
25
+ usSmartCapture: boolean;
26
+ perCountryPerDocOverrides: Record<string, Record<string, {
27
+ onlyFront: boolean;
28
+ onlyBack: boolean;
29
+ fetchAdditionalPage: boolean;
30
+ }>>;
31
+ };
32
+ type FlowModuleConfig = {
33
+ AUTHENTICATION: {
34
+ showTutorial: boolean;
35
+ autoCaptureTimeout: number;
36
+ numberOfAttempts: number;
37
+ type: 'ONE_TO_ONE';
38
+ deepsightLiveness: 'SINGLE_FRAME' | 'MULTIMODAL' | 'VIDEOLIVENESS';
39
+ validateClosedEyes: boolean;
40
+ validateFaceMask: boolean;
41
+ validateHeadCover: boolean;
42
+ validateLenses: boolean;
43
+ };
44
+ ADDRESS: {
45
+ disableSkipPoa: boolean;
46
+ title: string;
47
+ text: string;
48
+ };
49
+ AE_SIGNATURE: {
50
+ uploadDocument: boolean;
51
+ downloadDocument: boolean;
52
+ issuePermanentCertificate: boolean;
53
+ allowWithoutScoreValidation: boolean;
54
+ validationsToSkip: ('ID' | 'FACE_RECOGNITION' | 'OTP' | 'TOTAL_SCORE')[];
55
+ };
56
+ CURP_VALIDATION: {
57
+ curpDataMatch: boolean;
58
+ deceasedStatusVerification: boolean;
59
+ };
60
+ CUSTOM_FIELDS: {
61
+ title: string;
62
+ customFields: {
63
+ name: string;
64
+ alias: string;
65
+ type: 'INTEGER' | 'DOUBLE' | 'BOOLEAN' | 'STRING';
66
+ }[];
67
+ };
68
+ DOCUMENT_CAPTURE: {
69
+ processingType: 'capture' | 'processPoaOcr' | 'processLoaOcr' | 'processAsylumSeekerVisaZaf' | 'processBankStatementOCR' | 'processBankCheck' | 'processV5CLogbook' | 'processCarInvoice' | 'processCirculationCard' | 'processFinanceSettlement';
70
+ title: string;
71
+ text: string;
72
+ allowSkipDocumentCapture: boolean;
73
+ };
74
+ EKYB: {
75
+ checkBusinessName: boolean;
76
+ businessNameSource: 'userInput';
77
+ checkAddress: boolean;
78
+ address: 'userInput';
79
+ checkTaxId: boolean;
80
+ taxIdSource: 'userInput';
81
+ checkUniqueBeneficialOwner: boolean;
82
+ uniqueBeneficialOwnerSource: 'userInput';
83
+ };
84
+ EXTERNAL_VERIFICATION: {
85
+ source: 'US_DRIVERS_LICENSE_1' | 'US_TELCO_1' | 'US_TELCO_2' | 'US_CONSUMER_1' | 'US_CREDIT_BUREAU_1' | 'MX_CONSUMER_1' | 'BR_GOVT_1' | 'CA_RES_CREDIT' | 'UK_CREDIT_BUREAU_1' | 'ES_1' | 'CL_1' | 'AR_1' | 'GR_1' | 'GT_1' | 'BR_CPF_1';
86
+ checkName: boolean;
87
+ nameSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
88
+ checkEmail: boolean;
89
+ emailSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
90
+ checkAddress: boolean;
91
+ addressSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
92
+ checkPhone: boolean;
93
+ phoneSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
94
+ checkSsn: boolean;
95
+ ssnSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
96
+ checkDob: boolean;
97
+ dobSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
98
+ checkNationality: boolean;
99
+ nationalitySource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
100
+ checkDlNumber: boolean;
101
+ dlNumberSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
102
+ checkDlState: boolean;
103
+ dlStateSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
104
+ checkDlExpireAt: boolean;
105
+ dlExpireAtSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
106
+ checkLast4SSN: boolean;
107
+ last4SSNSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
108
+ checkIdNum: boolean;
109
+ idNumSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
110
+ checkIdNum1: boolean;
111
+ idNum1Source: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
112
+ checkGender: boolean;
113
+ genderSource: 'userInput' | 'document' | 'poa' | 'phoneModuleInput' | 'emailModuleInput';
114
+ };
115
+ EMAIL: {
116
+ otpVerification: boolean;
117
+ otpExpirationInMinutes: number;
118
+ prefill?: boolean;
119
+ };
120
+ FACE_MATCH: {
121
+ matchingType: 'selfieVsId' | 'selfieVsNfc' | 'idVsNfc' | 'nfc3Way';
122
+ disableFaceMatchAnimation: boolean;
123
+ };
124
+ FINISH_GPT: {
125
+ finishgptCompanyName: string;
126
+ };
127
+ GEOLOCATION: {
128
+ allowUserToSkipGeolocation: boolean;
129
+ };
130
+ INE_VALIDATION: {
131
+ facialValidation: boolean;
132
+ alternativeFacialValidation: boolean;
133
+ fallbackEnabled: boolean;
134
+ scrapingMethod: boolean;
135
+ scrapingV2: boolean;
136
+ scrapingV3: boolean;
137
+ failUnsupportedId: boolean;
138
+ dataValidation: boolean;
139
+ backgroundExecution: boolean;
140
+ mockConnectionError: boolean;
141
+ mockUserNotFoundError: boolean;
142
+ mockOK: boolean;
143
+ };
144
+ GOVT_VALIDATION_PROVISIONING: {
145
+ validationCountries: string[];
146
+ facialValidation: boolean;
147
+ dataValidation: boolean;
148
+ faceAndDataValidation: boolean;
149
+ addressValidation: boolean;
150
+ backgroundExecution: boolean;
151
+ faceMatchOverrideDataScore: boolean;
152
+ useCroppedIdFacePhoto: boolean;
153
+ };
154
+ TUTORIAL_ID: TutorialIdConfig;
155
+ ID: TutorialIdConfig;
156
+ SECOND_ID: TutorialIdConfig;
157
+ THIRD_ID: TutorialIdConfig;
158
+ ID_OCR: {
159
+ editableOcr: boolean;
160
+ };
161
+ INCODE_WATCHLIST: {
162
+ failIfFaceOnBlocklist: boolean;
163
+ addSuspectedFraudAutomatically: boolean;
164
+ autoExecution: boolean;
165
+ };
166
+ INSTANT_BAV: {
167
+ bavVendorCountry: 'US' | 'CA' | 'AU' | 'NZ' | 'BR' | 'MX' | 'CO' | 'UK' | 'EU';
168
+ bavNumberOfRetries: number;
169
+ };
170
+ ML_CONSENT: {
171
+ consentType: RegulationTypes;
172
+ };
173
+ NFC_SCAN: {
174
+ nfcAvailability: boolean;
175
+ nfcValidation: boolean;
176
+ showInitialDataConfirmationScreen: boolean;
177
+ };
178
+ PHONE: {
179
+ otpVerification: boolean;
180
+ otpExpirationInMinutes: number;
181
+ prefill: boolean;
182
+ };
183
+ SELFIE: {
184
+ showTutorial: boolean;
185
+ showPreview: boolean;
186
+ assistedOnboarding: boolean;
187
+ enableFaceRecording: boolean;
188
+ autoCaptureTimeout: number;
189
+ captureAttempts: number;
190
+ validateLenses: boolean;
191
+ validateFaceMask: boolean;
192
+ validateHeadCover: boolean;
193
+ validateClosedEyes: boolean;
194
+ validateBrightness: boolean;
195
+ deepsightLiveness: 'SINGLE_FRAME' | 'MULTIMODAL' | 'VIDEOLIVENESS';
196
+ };
197
+ SIGNATURE: {
198
+ title: string;
199
+ subTitle: string;
200
+ };
201
+ USER_CONSENT: {
202
+ title: string;
203
+ text: string;
204
+ };
205
+ CONFERENCE: {
206
+ enableConferenceOtp: boolean;
207
+ };
208
+ VIDEO_ONBOARDING: {
209
+ useAsSelfie: boolean;
210
+ showTutorials: boolean;
211
+ companyName: string;
212
+ checkLiveness: boolean;
213
+ checkIdScan: boolean;
214
+ checkDocumentScan: boolean;
215
+ compareIdEnabled: boolean;
216
+ compareOcrEnabled: boolean;
217
+ compareBackIdEnabled: boolean;
218
+ compareBackOcrEnabled: boolean;
219
+ checkVoiceConsent: boolean;
220
+ voiceConsentQuestions: number;
221
+ selfieQualityAffectsScore: boolean;
222
+ maxWaitingVideoSelfieFile: number;
223
+ lastSecondsVideoQualityCheck: boolean;
224
+ lastSecondsVideoQualityCheckDuration: number;
225
+ validateClosedEyes: boolean;
226
+ validateFaceMask: boolean;
227
+ validateHeadCover: boolean;
228
+ validateLenses: boolean;
229
+ };
230
+ DYNAMIC_FORMS: {
231
+ screens: {
232
+ title: string;
233
+ hideTitle: boolean;
234
+ questions: {
235
+ questionId: string;
236
+ overrides: string | null;
237
+ isPredefined: boolean;
238
+ predefinedQuestionType: string | null;
239
+ question: string;
240
+ inputType: 'NUMBER' | 'CPF' | 'COUNTRY' | 'NATIONALITY' | 'DATE' | 'PHONE' | 'EMAIL' | 'TEXT' | 'MULTISELECT' | 'YESNO' | 'SELECT';
241
+ options: string[];
242
+ }[];
243
+ }[];
244
+ };
245
+ COMBINED_CONSENT: {
246
+ combinedConsents: string;
247
+ };
248
+ QE_SIGNATURE: {
249
+ uploadDocument: boolean;
250
+ downloadDocument: boolean;
251
+ };
252
+ CERTIFICATE_ISSUANCE: {
253
+ region: string;
254
+ type: 'ONE_TIME' | 'SHORT_TERM' | 'LONG_TERM';
255
+ };
256
+ ANTIFRAUD: EmptyConfig;
257
+ CHECKBOX_SIGNATURE: EmptyConfig;
258
+ CROSS_DOCUMENT_DATA_MATCH: EmptyConfig;
259
+ DEVICE_FINGERPRINT: EmptyConfig;
260
+ FACE_ONBOARDING: EmptyConfig;
261
+ FIELD_COMPARISON: EmptyConfig;
262
+ FISCAL_QR: EmptyConfig;
263
+ GENERATE_QR: EmptyConfig;
264
+ INSTANT_VERIFY: EmptyConfig;
265
+ IP_ADDRESS: EmptyConfig;
266
+ NAME_CAPTURE: EmptyConfig;
267
+ SHOW_RESULTS: EmptyConfig;
268
+ STADIUM_SELECTOR: EmptyConfig;
269
+ UNIVERSAL_IDENTITY: EmptyConfig;
270
+ WATCHLIST: EmptyConfig;
271
+ TRUST_GRAPH: EmptyConfig;
272
+ WATCHLIST_BUSINESS: EmptyConfig;
273
+ };
274
+ type FlowModule = { [K in keyof FlowModuleConfig]: {
275
+ key: K;
276
+ configuration: FlowModuleConfig[K];
277
+ } }[keyof FlowModuleConfig];
278
+ type Flow = {
279
+ flowId: string;
280
+ name: string;
281
+ autoApproveEnabled?: boolean;
282
+ autoApproveLevel?: 'LOW' | 'MEDIUM' | 'HIGH';
283
+ checkTutorials?: boolean;
284
+ checkAuthorization?: boolean;
285
+ redirectDesktopToMobile?: boolean;
286
+ disableUnsupportedBrowserScreen?: boolean;
287
+ qrPhishingResistance?: boolean;
288
+ addContinueToDesktop?: boolean;
289
+ redirectOriginOnly?: boolean;
290
+ displayOnboardingResultOnDesktop?: boolean;
291
+ enableMultipleOnboardings?: boolean;
292
+ disableLaunchScreen?: boolean;
293
+ enableSardineRisk?: boolean;
294
+ mandatoryConsentCheck?: boolean;
295
+ disableSmsOption?: boolean;
296
+ mergeSessionRecordings?: boolean;
297
+ ageAssurance?: boolean;
298
+ flowModules: FlowModule[];
299
+ enforceCaptureAttemptLimits?: boolean;
300
+ enableFraudAi?: boolean;
301
+ getEnableIdOnlyIdentity?: boolean;
302
+ ds?: boolean;
303
+ };
304
+ //#endregion
305
+ //#region src/modules/flow/flowAnalyzer.d.ts
306
+ /**
307
+ * Analyzes a flow configuration and returns the WASM pipelines needed.
308
+ * Use this to conditionally warmup WASM only when required by the flow.
309
+ *
310
+ * @param flow - The flow configuration from /omni/onboarding/flow
311
+ * @returns Array of WASM pipelines needed (e.g., ['selfie', 'idCapture'])
312
+ *
313
+ * @example
314
+ * ```typescript
315
+ * const pipelines = getRequiredWasmPipelines(flow);
316
+ * if (pipelines.length > 0) {
317
+ * warmupWasm({ ...wasmConfig, pipelines });
318
+ * }
319
+ * ```
320
+ */
321
+ declare function getRequiredWasmPipelines(flow: Flow): WasmPipeline[];
322
+ //#endregion
323
+ //#region src/modules/flow/flowCompletionService.d.ts
324
+ type FinishStatus = {
325
+ redirectionUrl: string;
326
+ action: 'approved' | 'rejected' | 'none';
327
+ scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
328
+ };
329
+ type GetFinishStatusFn = (flowId: string | undefined | null, signal?: AbortSignal) => Promise<FinishStatus>;
330
+ //#endregion
331
+ //#region src/modules/flow/flowServices.d.ts
332
+ type GetFlow = (signal: AbortSignal) => Promise<Flow>;
333
+ //#endregion
334
+ //#region src/modules/flow/flowActor.d.ts
335
+ type CreateFlowActorOptions = {
336
+ getFlow?: GetFlow;
337
+ };
338
+ //#endregion
339
+ //#region src/modules/flow/flowManager.d.ts
340
+ /** Flow manager is waiting to be started */
341
+ type FlowIdleState = {
342
+ status: 'idle';
343
+ };
344
+ /** Flow is being fetched from the server */
345
+ type FlowLoadingState = {
346
+ status: 'loading';
347
+ };
348
+ /** Flow is loaded and ready for navigation */
349
+ type FlowReadyState = {
350
+ status: 'ready';
351
+ /** The complete flow configuration from the server */
352
+ flow: Flow;
353
+ /** Array of module keys in order */
354
+ steps: string[];
355
+ /** Zero-based index of the current step */
356
+ currentStepIndex: number;
357
+ /** The module key of the current step (e.g., 'SELFIE', 'ID', 'FACE_MATCH') */
358
+ currentStep: string | undefined;
359
+ /** The configuration object for the current module. Type varies by module. */
360
+ config: unknown;
361
+ };
362
+ /** All steps have been completed */
363
+ type FlowFinishedState = {
364
+ status: 'finished';
365
+ /** The complete flow configuration */
366
+ flow: Flow;
367
+ };
368
+ /** An error occurred while loading or processing the flow */
369
+ type FlowErrorState = {
370
+ status: 'error';
371
+ /** The error message */
372
+ error: string;
373
+ };
374
+ /** Union of all possible flow states */
375
+ type FlowState = FlowIdleState | FlowLoadingState | FlowReadyState | FlowFinishedState | FlowErrorState;
376
+ /**
377
+ * Creates a flow manager instance for managing onboarding flow state and navigation.
378
+ *
379
+ * The flow manager provides:
380
+ * - State management with statuses: `idle`, `loading`, `ready`, `finished`, `error`
381
+ * - Step navigation with `nextStep()` and `prevStep()`
382
+ * - Current step info via `state.currentStep` and `state.config` when in `ready` state
383
+ * - Module configuration lookup via `getModuleConfig()`
384
+ *
385
+ * @param options - Optional configuration for the flow actor
386
+ * @param options.getFlow - Custom function to fetch flow data. Defaults to `getOnboardingFlow`
387
+ * @returns A manager instance with state subscription, API methods, and lifecycle controls
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * const flowManager = createFlowManager();
392
+ *
393
+ * flowManager.subscribe((state) => {
394
+ * if (state.status === 'ready') {
395
+ * console.log(state.currentStep, state.config);
396
+ * }
397
+ * });
398
+ *
399
+ * flowManager.load({ token: 'session-token' });
400
+ * ```
401
+ */
402
+ declare function createFlowManager(options?: CreateFlowActorOptions): Manager<FlowState> & {
403
+ /**
404
+ * Loads the flow from the server.
405
+ * Transitions the state from `idle` to `loading`, then to `ready` on success or `error` on failure.
406
+ * Requires setup() to have been called with a token first.
407
+ */
408
+ load(): void;
409
+ /**
410
+ * Cancels the current loading operation and returns to `idle` state.
411
+ * Only effective when in `loading` state.
412
+ */
413
+ cancel(): void;
414
+ /**
415
+ * Resets the flow manager to its initial `idle` state.
416
+ * Can be called from `ready`, `finished`, or `error` states.
417
+ */
418
+ reset(): void;
419
+ /**
420
+ * Advances to the next step in the flow.
421
+ * If on the last step, transitions to `finished` state.
422
+ * Only effective when in `ready` state.
423
+ */
424
+ nextStep(): void;
425
+ /**
426
+ * Goes back to the previous step in the flow.
427
+ * Does nothing if already on the first step.
428
+ * Only effective when in `ready` state.
429
+ */
430
+ prevStep(): void;
431
+ /**
432
+ * Whether the flow can advance to the next step.
433
+ * Returns `true` if in `ready` state and not on the last step.
434
+ */
435
+ readonly canNext: boolean;
436
+ /**
437
+ * Whether the flow can go back to the previous step.
438
+ * Returns `true` if in `ready` state and not on the first step.
439
+ */
440
+ readonly canPrev: boolean;
441
+ /**
442
+ * Gets the configuration for a specific module by its key.
443
+ * Useful for accessing config of modules other than the current one.
444
+ * @param moduleKey - The unique key identifier of the module
445
+ * @returns The module configuration or `undefined` if not found or not in `ready` state
446
+ */
447
+ getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
448
+ /**
449
+ * Checks if a module is enabled in the current flow.
450
+ * @param moduleKey - The unique key identifier of the module
451
+ * @returns `true` if the module exists in the flow, `false` otherwise or if not in `ready` state
452
+ */
453
+ isModuleEnabled: (moduleKey: string) => boolean;
454
+ };
455
+ //#endregion
456
+ //#region src/modules/flow/moduleLoader.d.ts
457
+ type LazyModule<T$1> = () => Promise<T$1>;
458
+ type ModuleLoaderRegistry = {
459
+ [key: string]: LazyModule<{
460
+ default: unknown;
461
+ }>;
462
+ };
463
+ interface ModuleLoader {
464
+ load<T$1>(moduleKey: string): Promise<T$1>;
465
+ prefetch(moduleKey: string): void;
466
+ isLoaded(moduleKey: string): boolean;
467
+ }
468
+ declare function createModuleLoader(registry: ModuleLoaderRegistry): ModuleLoader;
469
+ //#endregion
470
+ //#region src/modules/flow/orchestratedFlowStateMachine.d.ts
471
+ type GetFlowFn = (signal: AbortSignal) => Promise<Flow>;
472
+ type ModuleRegistry = {
473
+ PHONE?: AnyStateMachine;
474
+ EMAIL?: AnyStateMachine;
475
+ SELFIE?: AnyStateMachine;
476
+ [key: string]: AnyStateMachine | undefined;
477
+ };
478
+ type OrchestratedFlowInput = {
479
+ getFlow: GetFlowFn;
480
+ modules: ModuleRegistry;
481
+ getFinishStatus?: GetFinishStatusFn;
482
+ };
483
+ type OrchestratedFlowEvent = {
484
+ type: 'LOAD';
485
+ } | {
486
+ type: 'CANCEL';
487
+ } | {
488
+ type: 'RESET';
489
+ } | {
490
+ type: 'MODULE_COMPLETE';
491
+ } | {
492
+ type: '*';
493
+ [key: string]: unknown;
494
+ } | {
495
+ type: string;
496
+ [key: string]: unknown;
497
+ };
498
+ //#endregion
499
+ //#region src/modules/flow/orchestratedFlowManager.d.ts
500
+ type OrchestratedFlowIdleState = {
501
+ status: 'idle';
502
+ };
503
+ type OrchestratedFlowLoadingState = {
504
+ status: 'loading';
505
+ };
506
+ type OrchestratedFlowReadyState = {
507
+ status: 'ready';
508
+ flow: Flow;
509
+ steps: string[];
510
+ currentStepIndex: number;
511
+ currentStep: string | undefined;
512
+ config: unknown;
513
+ moduleState: unknown;
514
+ };
515
+ type OrchestratedFlowFinishedState = {
516
+ status: 'finished';
517
+ flow: Flow;
518
+ finishStatus: {
519
+ redirectionUrl: string;
520
+ action: 'approved' | 'rejected' | 'none';
521
+ scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
522
+ };
523
+ };
524
+ type OrchestratedFlowErrorState = {
525
+ status: 'error';
526
+ error: string;
527
+ };
528
+ type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState;
529
+ type CreateOrchestratedFlowActorOptions = {
530
+ getFlow?: GetFlowFn;
531
+ modules: ModuleRegistry;
532
+ getFinishStatus?: OrchestratedFlowInput['getFinishStatus'];
533
+ };
534
+ declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager<OrchestratedFlowState> & {
535
+ /**
536
+ * Start loading the flow configuration from the backend.
537
+ */
538
+ load(): void;
539
+ /**
540
+ * Cancel an in-progress flow load.
541
+ */
542
+ cancel(): void;
543
+ /**
544
+ * Reset the flow to its initial idle state.
545
+ */
546
+ reset(): void;
547
+ /**
548
+ * Signal that the current module has completed successfully.
549
+ * Call this from your UI component's `onFinish` callback.
550
+ *
551
+ * @example
552
+ * ```tsx
553
+ * <Phone
554
+ * config={config}
555
+ * onFinish={() => flowManager.completeModule()}
556
+ * />
557
+ * ```
558
+ */
559
+ completeModule(): void;
560
+ /**
561
+ * Signal that the current module encountered an error.
562
+ * Call this from your UI component's `onError` callback if you want
563
+ * the flow to transition to an error state.
564
+ *
565
+ * @param error - Error message describing what went wrong
566
+ */
567
+ errorModule(error: string): void;
568
+ /**
569
+ * Send a raw event to the flow state machine.
570
+ * Prefer using the typed methods (completeModule, errorModule) when possible.
571
+ */
572
+ send(event: OrchestratedFlowEvent): void;
573
+ readonly canNext: boolean;
574
+ getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
575
+ isModuleEnabled: (moduleKey: string) => boolean;
576
+ };
577
+ //#endregion
578
+ export { type FinishStatus, type Flow, type FlowModule, type FlowModuleConfig, type FlowReadyState, type FlowState, type LazyModule, type ModuleLoader, type ModuleLoaderRegistry, type ModuleRegistry, type OrchestratedFlowFinishedState, type OrchestratedFlowInput, type OrchestratedFlowReadyState, type OrchestratedFlowState, createFlowManager, createModuleLoader, createOrchestratedFlowManager, getRequiredWasmPipelines };