@incodetech/core 0.0.0-dev-20260126-4504c5b

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.
@@ -0,0 +1,285 @@
1
+ import { t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
2
+ import { i as isApiConfigured, r as getToken, t as api } from "./api-DfRLAneb.esm.js";
3
+
4
+ //#region ../infra/src/capabilities/IBrowserEnvironmentCapability.ts
5
+ function getTimestamp() {
6
+ return Date.now();
7
+ }
8
+ function revokeObjectURL(url) {
9
+ URL.revokeObjectURL(url);
10
+ }
11
+
12
+ //#endregion
13
+ //#region src/internal/events/addEvent.ts
14
+ const eventsQueue = [];
15
+ const eventSubscribers = [];
16
+ /**
17
+ * Subscribes to all SDK events for logging, debugging, or custom analytics.
18
+ * Returns an unsubscribe function.
19
+ *
20
+ * @param listener - Callback function that receives each event
21
+ * @returns Unsubscribe function to remove the listener
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const unsubscribe = subscribeEvent((event) => {
26
+ * console.log('[Event]', event.code, event.module);
27
+ * });
28
+ *
29
+ * // Later
30
+ * unsubscribe();
31
+ * ```
32
+ */
33
+ function subscribeEvent(listener) {
34
+ eventSubscribers.push(listener);
35
+ return () => {
36
+ const index = eventSubscribers.indexOf(listener);
37
+ if (index > -1) eventSubscribers.splice(index, 1);
38
+ };
39
+ }
40
+ function notifySubscribers(event) {
41
+ eventSubscribers.forEach((listener) => {
42
+ try {
43
+ listener(event);
44
+ } catch (_error) {}
45
+ });
46
+ }
47
+ /**
48
+ * Sends an event to the dashboard for tracking.
49
+ * Fire-and-forget: never blocks, never throws.
50
+ * Events are queued if SDK is not configured yet.
51
+ */
52
+ function addEvent(event) {
53
+ notifySubscribers(event);
54
+ const token = getToken();
55
+ if (!isApiConfigured() || !token) {
56
+ eventsQueue.push(event);
57
+ return;
58
+ }
59
+ api.post(endpoints.events, [{
60
+ code: event.code,
61
+ module: event.module,
62
+ screen: event.screen,
63
+ clientTimestamp: event.clientTimestamp ?? getTimestamp(),
64
+ payload: event.payload ?? {}
65
+ }]).catch(() => {});
66
+ }
67
+ /**
68
+ * Flushes any queued events that were sent before SDK was configured.
69
+ * Called automatically by setup() after token is set.
70
+ */
71
+ function flushEventQueue() {
72
+ if (!isApiConfigured() || !getToken()) return;
73
+ const queuedEvents = [...eventsQueue];
74
+ eventsQueue.length = 0;
75
+ for (const event of queuedEvents) addEvent(event);
76
+ }
77
+
78
+ //#endregion
79
+ //#region src/internal/events/helpers.ts
80
+ function screenEvent(params) {
81
+ addEvent({
82
+ code: params.code,
83
+ module: params.module,
84
+ screen: params.screen,
85
+ clientTimestamp: getTimestamp(),
86
+ payload: params.payload
87
+ });
88
+ }
89
+ function moduleOpened(module, screen, payload) {
90
+ screenEvent({
91
+ module,
92
+ screen,
93
+ code: "moduleOpened",
94
+ payload
95
+ });
96
+ }
97
+ function moduleClosed(module, screen, payload) {
98
+ screenEvent({
99
+ module,
100
+ screen,
101
+ code: "moduleClosed",
102
+ payload
103
+ });
104
+ }
105
+ function screenOpened(module, screen, payload) {
106
+ screenEvent({
107
+ module,
108
+ screen,
109
+ code: "screenOpened",
110
+ payload
111
+ });
112
+ }
113
+ function screenClosed(module, screen, payload) {
114
+ screenEvent({
115
+ module,
116
+ screen,
117
+ code: "screenClosed",
118
+ payload
119
+ });
120
+ }
121
+
122
+ //#endregion
123
+ //#region src/internal/events/types.ts
124
+ const eventModuleNames = {
125
+ selfie: "SELFIE",
126
+ authFace: "AUTH_FACE",
127
+ mlConsent: "ML_CONSENT",
128
+ combinedConsent: "COMBINED_CONSENT",
129
+ curpValidation: "CURP_VALIDATION",
130
+ faceMatch: "FACE_MATCH",
131
+ qr: "QR",
132
+ videoSelfie: "VIDEO_ONBOARDING",
133
+ passport: "ID",
134
+ front: "ID",
135
+ back: "ID",
136
+ id: "ID",
137
+ document: "DOCUMENT_CAPTURE",
138
+ creditCard: "CREDIT_CARD_FRONT",
139
+ creditCardBack: "CREDIT_CARD_BACK",
140
+ conference: "CONFERENCE",
141
+ otp: "OTP",
142
+ signature: "SIGNATURE",
143
+ ekyc: "EXTERNAL_VERIFICATION",
144
+ globalWatchList: "GLOBAL_WATCHLIST",
145
+ customWatchList: "CUSTOM_WATCHLIST",
146
+ email: "EMAIL",
147
+ phone: "PHONE",
148
+ instantVerifyEmail: "INSTANT_VERIFY_EMAIL",
149
+ instantVerifyConsent: "INSTANT_VERIFY_CONSENT",
150
+ forms: "FORMS",
151
+ customModule: "CUSTOM_MODULE"
152
+ };
153
+ const eventScreenNames = {
154
+ faceMatch: "FACE_MATCH",
155
+ faceCaptureTutorial: "SELFIE_CAPTURE_TUTORIAL",
156
+ faceCaptureCamera: "SELFIE_CAMERA_CAPTURE",
157
+ faceCaptureError: "SELFIE_ATTEMPT_FAILED",
158
+ faceCaptureSuccess: "SELFIE_UPLOAD_SUCCEEDED",
159
+ faceCaptureUpload: "SELFIE_UPLOAD_PROGRESS",
160
+ mlConsent: "MACHINE_LEARNING_CONSENT",
161
+ combinedConsent: "COMBINED_CONSENT",
162
+ curpEnter: "ENTER_CURP",
163
+ curpValidate: "VALIDATE_CURP",
164
+ curpGenerate: "GENERATE_CURP",
165
+ curpValidation: "CURP_VALIDATION_PROGRESS",
166
+ curpValidationFailed: "CURP_VALIDATION_FAILED",
167
+ curpValidationSuccess: "CURP_VALIDATION_SUCCEEDED",
168
+ qrTutorial: "QR_TUTORIAL",
169
+ qrScan: "QR_SCAN",
170
+ smsOtp: "OTP",
171
+ simpleOTP: "OTP",
172
+ signatureInput: "SIGNATURE_INPUT",
173
+ frontTutorial: "FRONT_ID_CAPTURE_TUTORIAL",
174
+ frontCameraCapture: "FRONT_ID_CAMERA_CAPTURE",
175
+ frontHelp: "FRONT_ID_HELP",
176
+ frontReviewPhoto: "FRONT_ID_REVIEW_PHOTO",
177
+ frontUploadProgress: "FRONT_ID_UPLOAD_PROGRESS",
178
+ frontAttemptFailed: "FRONT_ID_ATTEMPT_FAILED",
179
+ frontUploadSuccess: "FRONT_ID_UPLOAD_SUCCEEDED",
180
+ backTutorial: "BACK_ID_CAPTURE_TUTORIAL",
181
+ backCameraCapture: "BACK_ID_CAMERA_CAPTURE",
182
+ backReviewPhoto: "BACK_ID_REVIEW_PHOTO",
183
+ backUploadProgress: "BACK_ID_UPLOAD_PROGRESS",
184
+ backAttemptFailed: "BACK_ID_ATTEMPT_FAILED",
185
+ backUploadSuccess: "BACK_ID_UPLOAD_SUCCEEDED",
186
+ backHelp: "BACK_ID_HELP",
187
+ passportTutorial: "TUTORIAL_PASSPORT",
188
+ documentTutorial: "DOCUMENT_CAPTURE_TUTORIAL",
189
+ documentCameraCapture: "DOCUMENT_CAMERA_CAPTURE",
190
+ documentHelp: "DOCUMENT_HELP",
191
+ documentReviewPhoto: "DOCUMENT_REVIEW_PHOTO",
192
+ documentUploadProgress: "DOCUMENT_UPLOAD_IN_PROGRESS",
193
+ documentAttemptFailed: "DOCUMENT_ATTEMPT_FAILED",
194
+ documentUploadSuccess: "DOCUMENT_UPLOAD_SUCCEEDED",
195
+ conferenceWait: "CONFERENCE_WAIT",
196
+ conferenceVideoChat: "CONFERENCE_VIDEO_CHAT",
197
+ conferenceMessageChat: "CONFERENCE_MESSAGE_CHAT",
198
+ videoSelfieTutorial: "VIDEO_SELFIE_TUTORIAL",
199
+ videoSelfie: "VIDEO_SELFIE",
200
+ videoSelfieFaceCapture: "VIDEO_SELFIE_FACE_CAPTURE",
201
+ videoSelfieFaceUploadProgress: "VIDEO_SELFIE_FACE_UPLOAD_PROGRESS",
202
+ videoSelfieFaceAttemptFailed: "VIDEO_SELFIE_FACE_ATTEMPT_FAILED",
203
+ videoSelfieFaceUploadSucceeded: "VIDEO_SELFIE_FACE_UPLOAD_SUCCEEDED",
204
+ videoSelfieFrontIdCapture: "VIDEO_SELFIE_FRONT_ID_CAPTURE",
205
+ videoSelfieFrontIdUploadProgress: "VIDEO_SELFIE_FRONT_ID_UPLOAD_PROGRESS",
206
+ videoSelfieFrontIdAttemptFailed: "VIDEO_SELFIE_FRONT_ID_ATTEMPT_FAILED",
207
+ videoSelfieFrontIdUploadSucceeded: "VIDEO_SELFIE_FRONT_ID_UPLOAD_SUCCEEDED",
208
+ videoSelfieBackIdCapture: "VIDEO_SELFIE_BACK_ID_CAPTURE",
209
+ videoSelfieBackIdUploadProgress: "VIDEO_SELFIE_BACK_ID_UPLOAD_PROGRESS",
210
+ videoSelfieBackIdAttemptFailed: "VIDEO_SELFIE_BACK_ID_ATTEMPT_FAILED",
211
+ videoSelfieBackIdUploadSucceeded: "VIDEO_SELFIE_BACK_ID_UPLOAD_SUCCEEDED",
212
+ videoSelfieDocumentCapture: "VIDEO_SELFIE_DOCUMENT_CAPTURE",
213
+ videoSelfieVoiceQuestion: "VIDEO_SELFIE_VOICE_QUESTION",
214
+ videoSelfieVoiceFinalQuestion: "VIDEO_SELFIE_VOICE_FINAL_QUESTION",
215
+ videoSelfieVideoUpload: "VIDEO SELFIE VIDEO UPLOAD",
216
+ ekycInput: "EKYC_INPUT",
217
+ ekycProgress: "EKYC_PROGRESS",
218
+ ekycSucceeded: "EKYC_SUCCEEDED",
219
+ ekycFailed: "EKYC_FAILED",
220
+ forms: "FORMS",
221
+ globalWatchListInput: "GLOBAL_WATCHLIST_INPUT",
222
+ globalWatchListProgress: "GLOBAL_WATCHLIST_PROGRESS",
223
+ globalWatchListSuccess: "GLOBAL_WATCHLIST_SUCCEEDED",
224
+ globalWatchListFailed: "GLOBAL_WATCHLIST_FAILED",
225
+ customWatchListInput: "CUSTOM_WATCHLIST_INPUT",
226
+ customWatchListProgress: "CUSTOM_WATCHLIST_PROGRESS",
227
+ customWatchListSuccess: "CUSTOM_WATCHLIST_SUCCEEDED",
228
+ customWatchListFailed: "CUSTOM_WATCHLIST_FAILED",
229
+ emailInput: "EMAIL_INPUT",
230
+ phoneInput: "PHONE_INPUT",
231
+ instantVerify: "INSTANT_VERIFY",
232
+ authFace: "AUTH_FACE",
233
+ authFaceError: "AUTH_FACE_ATTEMPT_FAILED",
234
+ authFaceUpload: "AUTH_FACE_UPLOAD_PROGRESS",
235
+ authFaceUploadSuccess: "AUTH_FACE_UPLOAD_SUCCEEDED",
236
+ authFaceUploadFailed: "AUTH_FACE_UPLOAD_FAILED",
237
+ customModuleCallback: "CUSTOM_MODULE_CALLBACK",
238
+ customModuleProcessing: "CUSTOM_MODULE_PROCESSING",
239
+ digitalIdFileSelection: "DIGITAL_ID_FILE_SELECTION",
240
+ digitalIdFileReview: "DIGITAL_ID_FILE_REVIEW",
241
+ digitalIdUploadProgress: "DIGITAL_ID_UPLOAD_PROGRESS",
242
+ digitalIdUploadSuccess: "DIGITAL_ID_UPLOAD_SUCCEEDED",
243
+ digitalIdUploadFailed: "DIGITAL_ID_UPLOAD_FAILED",
244
+ digitalIdAnalysisProgress: "DIGITAL_ID_ANALYSIS_PROGRESS",
245
+ digitalIdVerificationSuccess: "DIGITAL_ID_VERIFICATION_SUCCESS",
246
+ digitalIdVerificationFailed: "DIGITAL_ID_VERIFICATION_FAILED"
247
+ };
248
+ const videoSelfieEvents = {
249
+ imageTooBlurry: "imageTooBlurry",
250
+ fillFrame: "fillFrame",
251
+ checkCameraOrLighting: "checkCameraOrLighting",
252
+ frontIdCaptureStarted: "frontIdCaptureStarted",
253
+ lookAtCamera: "lookAtCamera",
254
+ moveCloser: "moveCloser",
255
+ lookingForFrontId: "lookingForFrontId",
256
+ lookingForBackId: "lookingForBackId",
257
+ cameraSwitchToBack: "cameraSwitchToBack",
258
+ cameraSwitchToFront: "cameraSwitchToFront",
259
+ audioStreamOpened: "audioStreamOpened",
260
+ audioStreamClosed: "audioStreamClosed",
261
+ videoSelfieVideoUploadInProgress: "videoSelfieVideoUploadInProgress",
262
+ videoSelfieTosNotAccepted: "videoSelfieTosNotAccepted",
263
+ videoSelfieTosAccepted: "videoSelfieTosAccepted",
264
+ videoSelfieStreamCreated: "videoSelfieStreamCreated",
265
+ videoSelfieStreamDestroyed: "videoSelfieStreamDestroyed",
266
+ videoSelfieReconnecting: "videoSelfieReconnecting",
267
+ videoSelfieReconnected: "videoSelfieReconnected"
268
+ };
269
+ const tutorialScreenNamesMapper = {
270
+ passport: eventScreenNames.passportTutorial,
271
+ front: eventScreenNames.frontTutorial,
272
+ back: eventScreenNames.backTutorial,
273
+ selfie: eventScreenNames.faceCaptureTutorial
274
+ };
275
+ const cameraScreenNamesMapper = {
276
+ front: "front",
277
+ back: "back",
278
+ passport: "passport",
279
+ creditCard: "front",
280
+ creditCardBack: "back",
281
+ document: "document"
282
+ };
283
+
284
+ //#endregion
285
+ export { videoSelfieEvents as a, screenClosed as c, addEvent as d, flushEventQueue as f, tutorialScreenNamesMapper as i, screenEvent as l, revokeObjectURL as m, eventModuleNames as n, moduleClosed as o, subscribeEvent as p, eventScreenNames as r, moduleOpened as s, cameraScreenNamesMapper as t, screenOpened as u };
package/dist/flow.d.ts ADDED
@@ -0,0 +1,278 @@
1
+ import { a as AnyStateMachine, n as FlowModule, r as FlowModuleConfig, s as WasmPipeline, t as Flow } from "./types-CMR6NkxW.js";
2
+ import { t as Manager } from "./Manager-Co-PsiG9.js";
3
+
4
+ //#region src/modules/flow/flowAnalyzer.d.ts
5
+
6
+ /**
7
+ * Analyzes a flow configuration and returns the WASM pipelines needed.
8
+ * Use this to conditionally warmup WASM only when required by the flow.
9
+ *
10
+ * @param flow - The flow configuration from /omni/onboarding/flow
11
+ * @returns Array of WASM pipelines needed (e.g., ['selfie', 'idCapture'])
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const pipelines = getRequiredWasmPipelines(flow);
16
+ * if (pipelines.length > 0) {
17
+ * warmupWasm({ ...wasmConfig, pipelines });
18
+ * }
19
+ * ```
20
+ */
21
+ declare function getRequiredWasmPipelines(flow: Flow): WasmPipeline[];
22
+ //#endregion
23
+ //#region src/modules/flow/flowCompletionService.d.ts
24
+ type FinishStatus = {
25
+ redirectionUrl: string;
26
+ action: 'approved' | 'rejected' | 'none';
27
+ scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
28
+ };
29
+ type GetFinishStatusFn = (flowId: string | undefined | null, signal?: AbortSignal) => Promise<FinishStatus>;
30
+ //#endregion
31
+ //#region src/modules/flow/flowServices.d.ts
32
+ type GetFlow = (signal: AbortSignal) => Promise<Flow>;
33
+ //#endregion
34
+ //#region src/modules/flow/flowActor.d.ts
35
+ type CreateFlowActorOptions = {
36
+ getFlow?: GetFlow;
37
+ };
38
+ //#endregion
39
+ //#region src/modules/flow/flowManager.d.ts
40
+ /** Flow manager is waiting to be started */
41
+ type FlowIdleState = {
42
+ status: 'idle';
43
+ };
44
+ /** Flow is being fetched from the server */
45
+ type FlowLoadingState = {
46
+ status: 'loading';
47
+ };
48
+ /** Flow is loaded and ready for navigation */
49
+ type FlowReadyState = {
50
+ status: 'ready';
51
+ /** The complete flow configuration from the server */
52
+ flow: Flow;
53
+ /** Array of module keys in order */
54
+ steps: string[];
55
+ /** Zero-based index of the current step */
56
+ currentStepIndex: number;
57
+ /** The module key of the current step (e.g., 'SELFIE', 'ID', 'FACE_MATCH') */
58
+ currentStep: string | undefined;
59
+ /** The configuration object for the current module. Type varies by module. */
60
+ config: unknown;
61
+ };
62
+ /** All steps have been completed */
63
+ type FlowFinishedState = {
64
+ status: 'finished';
65
+ /** The complete flow configuration */
66
+ flow: Flow;
67
+ };
68
+ /** An error occurred while loading or processing the flow */
69
+ type FlowErrorState = {
70
+ status: 'error';
71
+ /** The error message */
72
+ error: string;
73
+ };
74
+ /** Union of all possible flow states */
75
+ type FlowState = FlowIdleState | FlowLoadingState | FlowReadyState | FlowFinishedState | FlowErrorState;
76
+ /**
77
+ * Creates a flow manager instance for managing onboarding flow state and navigation.
78
+ *
79
+ * The flow manager provides:
80
+ * - State management with statuses: `idle`, `loading`, `ready`, `finished`, `error`
81
+ * - Step navigation with `nextStep()` and `prevStep()`
82
+ * - Current step info via `state.currentStep` and `state.config` when in `ready` state
83
+ * - Module configuration lookup via `getModuleConfig()`
84
+ *
85
+ * @param options - Optional configuration for the flow actor
86
+ * @param options.getFlow - Custom function to fetch flow data. Defaults to `getOnboardingFlow`
87
+ * @returns A manager instance with state subscription, API methods, and lifecycle controls
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const flowManager = createFlowManager();
92
+ *
93
+ * flowManager.subscribe((state) => {
94
+ * if (state.status === 'ready') {
95
+ * console.log(state.currentStep, state.config);
96
+ * }
97
+ * });
98
+ *
99
+ * flowManager.load({ token: 'session-token' });
100
+ * ```
101
+ */
102
+ declare function createFlowManager(options?: CreateFlowActorOptions): Manager<FlowState> & {
103
+ /**
104
+ * Loads the flow from the server.
105
+ * Transitions the state from `idle` to `loading`, then to `ready` on success or `error` on failure.
106
+ * Requires setup() to have been called with a token first.
107
+ */
108
+ load(): void;
109
+ /**
110
+ * Cancels the current loading operation and returns to `idle` state.
111
+ * Only effective when in `loading` state.
112
+ */
113
+ cancel(): void;
114
+ /**
115
+ * Resets the flow manager to its initial `idle` state.
116
+ * Can be called from `ready`, `finished`, or `error` states.
117
+ */
118
+ reset(): void;
119
+ /**
120
+ * Advances to the next step in the flow.
121
+ * If on the last step, transitions to `finished` state.
122
+ * Only effective when in `ready` state.
123
+ */
124
+ nextStep(): void;
125
+ /**
126
+ * Goes back to the previous step in the flow.
127
+ * Does nothing if already on the first step.
128
+ * Only effective when in `ready` state.
129
+ */
130
+ prevStep(): void;
131
+ /**
132
+ * Whether the flow can advance to the next step.
133
+ * Returns `true` if in `ready` state and not on the last step.
134
+ */
135
+ readonly canNext: boolean;
136
+ /**
137
+ * Whether the flow can go back to the previous step.
138
+ * Returns `true` if in `ready` state and not on the first step.
139
+ */
140
+ readonly canPrev: boolean;
141
+ /**
142
+ * Gets the configuration for a specific module by its key.
143
+ * Useful for accessing config of modules other than the current one.
144
+ * @param moduleKey - The unique key identifier of the module
145
+ * @returns The module configuration or `undefined` if not found or not in `ready` state
146
+ */
147
+ getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
148
+ /**
149
+ * Checks if a module is enabled in the current flow.
150
+ * @param moduleKey - The unique key identifier of the module
151
+ * @returns `true` if the module exists in the flow, `false` otherwise or if not in `ready` state
152
+ */
153
+ isModuleEnabled: (moduleKey: string) => boolean;
154
+ };
155
+ //#endregion
156
+ //#region src/modules/flow/moduleLoader.d.ts
157
+ type LazyModule<T$1> = () => Promise<T$1>;
158
+ type ModuleLoaderRegistry = {
159
+ [key: string]: LazyModule<{
160
+ default: unknown;
161
+ }>;
162
+ };
163
+ interface ModuleLoader {
164
+ load<T$1>(moduleKey: string): Promise<T$1>;
165
+ prefetch(moduleKey: string): void;
166
+ isLoaded(moduleKey: string): boolean;
167
+ }
168
+ declare function createModuleLoader(registry: ModuleLoaderRegistry): ModuleLoader;
169
+ //#endregion
170
+ //#region src/modules/flow/orchestratedFlowStateMachine.d.ts
171
+ type GetFlowFn = (signal: AbortSignal) => Promise<Flow>;
172
+ type ModuleRegistry = {
173
+ PHONE?: AnyStateMachine;
174
+ EMAIL?: AnyStateMachine;
175
+ SELFIE?: AnyStateMachine;
176
+ [key: string]: AnyStateMachine | undefined;
177
+ };
178
+ type OrchestratedFlowInput = {
179
+ getFlow: GetFlowFn;
180
+ modules: ModuleRegistry;
181
+ getFinishStatus?: GetFinishStatusFn;
182
+ };
183
+ type OrchestratedFlowEvent = {
184
+ type: 'LOAD';
185
+ } | {
186
+ type: 'CANCEL';
187
+ } | {
188
+ type: 'RESET';
189
+ } | {
190
+ type: 'MODULE_COMPLETE';
191
+ } | {
192
+ type: '*';
193
+ [key: string]: unknown;
194
+ } | {
195
+ type: string;
196
+ [key: string]: unknown;
197
+ };
198
+ //#endregion
199
+ //#region src/modules/flow/orchestratedFlowManager.d.ts
200
+ type OrchestratedFlowIdleState = {
201
+ status: 'idle';
202
+ };
203
+ type OrchestratedFlowLoadingState = {
204
+ status: 'loading';
205
+ };
206
+ type OrchestratedFlowReadyState = {
207
+ status: 'ready';
208
+ flow: Flow;
209
+ steps: string[];
210
+ currentStepIndex: number;
211
+ currentStep: string | undefined;
212
+ config: unknown;
213
+ moduleState: unknown;
214
+ };
215
+ type OrchestratedFlowFinishedState = {
216
+ status: 'finished';
217
+ flow: Flow;
218
+ finishStatus: {
219
+ redirectionUrl: string;
220
+ action: 'approved' | 'rejected' | 'none';
221
+ scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
222
+ };
223
+ };
224
+ type OrchestratedFlowErrorState = {
225
+ status: 'error';
226
+ error: string;
227
+ };
228
+ type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState;
229
+ type CreateOrchestratedFlowActorOptions = {
230
+ getFlow?: GetFlowFn;
231
+ modules: ModuleRegistry;
232
+ getFinishStatus?: OrchestratedFlowInput['getFinishStatus'];
233
+ };
234
+ declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager<OrchestratedFlowState> & {
235
+ /**
236
+ * Start loading the flow configuration from the backend.
237
+ */
238
+ load(): void;
239
+ /**
240
+ * Cancel an in-progress flow load.
241
+ */
242
+ cancel(): void;
243
+ /**
244
+ * Reset the flow to its initial idle state.
245
+ */
246
+ reset(): void;
247
+ /**
248
+ * Signal that the current module has completed successfully.
249
+ * Call this from your UI component's `onFinish` callback.
250
+ *
251
+ * @example
252
+ * ```tsx
253
+ * <Phone
254
+ * config={config}
255
+ * onFinish={() => flowManager.completeModule()}
256
+ * />
257
+ * ```
258
+ */
259
+ completeModule(): void;
260
+ /**
261
+ * Signal that the current module encountered an error.
262
+ * Call this from your UI component's `onError` callback if you want
263
+ * the flow to transition to an error state.
264
+ *
265
+ * @param error - Error message describing what went wrong
266
+ */
267
+ errorModule(error: string): void;
268
+ /**
269
+ * Send a raw event to the flow state machine.
270
+ * Prefer using the typed methods (completeModule, errorModule) when possible.
271
+ */
272
+ send(event: OrchestratedFlowEvent): void;
273
+ readonly canNext: boolean;
274
+ getModuleConfig: <T$1 = unknown>(moduleKey: string) => T$1 | undefined;
275
+ isModuleEnabled: (moduleKey: string) => boolean;
276
+ };
277
+ //#endregion
278
+ 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 };