@incodetech/web 0.0.0-dev-20260416-3692bda → 0.0.0-dev-20260417-7a073a7

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.
@@ -5,12 +5,48 @@ import { o as c, t as l } from "../incodeComponent-DIb7wDAq.js";
5
5
  import { t as u } from "../spinner-l6dvYqCg.js";
6
6
  import "../spinner-CFvndzMU.js";
7
7
  import { t as d } from "../incodeModule-D_r2n18O.js";
8
- import { a as f, c as p, d as m, i as h, l as g, n as _, o as v, r as y, s as b, t as x } from "../useModuleLoader-C8N5qfo6.js";
9
- import { getRequiredWasmPipelines as S } from "@incodetech/core/flow";
8
+ import { a as f, c as p, f as m, i as h, l as g, n as _, o as v, r as y, s as b, t as x, u as S } from "../useModuleLoader-B6JxxJWR.js";
9
+ import { getRequiredWasmPipelines as C } from "@incodetech/core/flow";
10
+ import { createSession as w } from "@incodetech/core/session";
11
+ //#region src/modules/flow/createFlowSession.ts
12
+ function T(e) {
13
+ return Array.from(new Uint8Array(e), (e) => e.toString(16).padStart(2, "0")).join("");
14
+ }
15
+ async function E(e) {
16
+ let t = globalThis.crypto?.subtle;
17
+ if (!t) throw Error("SHA-1 is not available in this environment");
18
+ return T(await t.digest("SHA-1", new TextEncoder().encode(e)));
19
+ }
20
+ async function D(e) {
21
+ if (typeof e.apiKey == "string") return e.apiKey;
22
+ if (typeof e.clientId == "string") return E(e.clientId);
23
+ throw Error("Flow self-loading mode requires apiKey or clientId");
24
+ }
25
+ async function O(e, t) {
26
+ return w(await D(e), {
27
+ configurationId: e.configurationId,
28
+ externalId: e.externalId,
29
+ externalCustomerId: e.externalCustomerId,
30
+ language: e.lang,
31
+ customFields: e.customFields,
32
+ uuid: e.uuid,
33
+ interviewId: e.interviewId
34
+ }, t);
35
+ }
36
+ //#endregion
37
+ //#region src/modules/flow/flowConfig.ts
38
+ function k(e) {
39
+ return typeof e.token == "string";
40
+ }
41
+ function A(e) {
42
+ let t = e;
43
+ return typeof t.configurationId == "string" && (typeof t.apiKey == "string" || typeof t.clientId == "string");
44
+ }
45
+ //#endregion
10
46
  //#region src/modules/flow/preloadFlow.ts
11
- var C = /* @__PURE__ */ new Map();
12
- function w(e) {
13
- let t = C.get(e);
47
+ var j = /* @__PURE__ */ new Map();
48
+ function M(e) {
49
+ let t = j.get(e);
14
50
  if (!t) throw Error("Preload state not found");
15
51
  return {
16
52
  get isReady() {
@@ -26,17 +62,17 @@ function w(e) {
26
62
  }
27
63
  },
28
64
  cancel() {
29
- t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), C.delete(e));
65
+ t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), j.delete(e));
30
66
  }
31
67
  };
32
68
  }
33
- function T(e) {
69
+ function N(e) {
34
70
  let { token: t } = e;
35
- if (C.has(t)) return w(t);
71
+ if (j.has(t)) return M(t);
36
72
  let n, r, i = new Promise((e, t) => {
37
73
  n = e, r = t;
38
- }), a = f(e);
39
- a.getState().presentation.shouldPrefetchHome && g();
74
+ }), a = v(e);
75
+ a.getState().presentation.shouldPrefetchHome && S();
40
76
  let o = {
41
77
  status: "loading",
42
78
  flowManager: a,
@@ -45,52 +81,52 @@ function T(e) {
45
81
  readyResolve: n,
46
82
  readyReject: r
47
83
  };
48
- return C.set(t, o), (async () => {
84
+ return j.set(t, o), (async () => {
49
85
  try {
50
- await b({
86
+ await p({
51
87
  apiURL: e.apiURL,
52
88
  token: e.token,
53
89
  lang: e.lang,
54
90
  flowManager: a
55
91
  });
56
- let t = e.disableDashboardTheme ? Promise.resolve({}) : v().then((e) => {
92
+ let t = e.disableDashboardTheme ? Promise.resolve({}) : b().then((e) => {
57
93
  o.theme = e.theme, o.uiConfig = e.uiConfig;
58
94
  });
59
95
  o.unsubscribe = a.subscribe((t) => {
60
96
  if (t.status === "ready") {
61
97
  let n = t;
62
- m(n, e.wasmConfig), p(n), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
98
+ m(n, e.wasmConfig), g(n), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
63
99
  } else t.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = t.error, o.readyReject(Error(t.error)));
64
100
  }), await t;
65
101
  } catch (e) {
66
- o.status = "error", o.error = e instanceof Error ? e.message : "Failed to preload", o.readyReject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to preload")), C.delete(t);
102
+ o.status = "error", o.error = e instanceof Error ? e.message : "Failed to preload", o.readyReject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to preload")), j.delete(t);
67
103
  }
68
- })(), w(t);
104
+ })(), M(t);
69
105
  }
70
- function E(e) {
71
- return C.get(e) ?? null;
106
+ function P(e) {
107
+ return j.get(e) ?? null;
72
108
  }
73
- function D(e) {
74
- let t = E(e);
75
- return t && C.delete(e), t;
109
+ function F(e) {
110
+ let t = P(e);
111
+ return t && j.delete(e), t;
76
112
  }
77
113
  //#endregion
78
114
  //#region src/modules/flow/useFlowInitialization.ts
79
- function O(e) {
80
- e.getState().presentation.shouldPrefetchHome && g();
115
+ function I(e) {
116
+ e.getState().presentation.shouldPrefetchHome && S();
81
117
  }
82
- function k(e) {
83
- let { apiURL: n, token: i, lang: o, disableDashboardTheme: c, enableHome: l, onError: u } = e, d = r(null), [p, m] = a(() => {
84
- let t = E(i);
85
- if (t?.status === "ready") {
86
- let e = D(i);
87
- if (e) return d.current = e.flowManager, O(e.flowManager), e.uiConfig && s(e.uiConfig), {
118
+ function L(e) {
119
+ let { apiURL: n, lang: i, disableDashboardTheme: o, enableHome: c, onError: l } = e, u = k(e) ? e.token : void 0, d = r(null), [f, m] = a(() => {
120
+ let t = u ? P(u) : null;
121
+ if (u && t?.status === "ready") {
122
+ let e = F(u);
123
+ if (e) return d.current = e.flowManager, I(e.flowManager), e.uiConfig && s(e.uiConfig), {
88
124
  status: "ready",
89
125
  flowManager: e.flowManager
90
126
  };
91
127
  }
92
- let n = f(e);
93
- return d.current = n, O(n), t?.status === "error" ? {
128
+ let n = v(e);
129
+ return d.current = n, I(n), t?.status === "error" ? {
94
130
  status: "error",
95
131
  error: t.error ?? "Preload failed",
96
132
  flowManager: n
@@ -100,12 +136,12 @@ function k(e) {
100
136
  };
101
137
  }), h = r(!1);
102
138
  return t(() => {
103
- if (p.status !== "initializing") return;
104
- let e = E(i);
105
- if (e?.status === "loading") {
106
- e.readyPromise.then(() => {
107
- let e = D(i);
108
- e && (d.current = e.flowManager, O(e.flowManager), e.uiConfig && s(e.uiConfig), m({
139
+ if (f.status !== "initializing") return;
140
+ let t = u ? P(u) : null;
141
+ if (u && t?.status === "loading") {
142
+ t.readyPromise.then(() => {
143
+ let e = F(u);
144
+ e && (d.current = e.flowManager, I(e.flowManager), e.uiConfig && s(e.uiConfig), m({
109
145
  status: "ready",
110
146
  flowManager: e.flowManager
111
147
  }));
@@ -114,94 +150,104 @@ function k(e) {
114
150
  m({
115
151
  status: "error",
116
152
  error: t,
117
- flowManager: p.flowManager
118
- }), u?.(t);
153
+ flowManager: f.flowManager
154
+ }), l?.(t);
119
155
  });
120
156
  return;
121
157
  }
122
158
  h.current || (h.current = !0, (async () => {
123
159
  try {
124
- await b({
160
+ let t;
161
+ if (k(e)) t = e.token;
162
+ else if (A(e)) t = (await O(e)).token;
163
+ else throw Error("Flow requires token, or configurationId with apiKey or clientId");
164
+ await p({
125
165
  apiURL: n,
126
- token: i,
127
- lang: o,
128
- flowManager: p.flowManager
129
- }), await (c ? Promise.resolve() : v().then((e) => {
166
+ token: t,
167
+ lang: i,
168
+ flowManager: f.flowManager
169
+ }), await (o ? Promise.resolve() : b().then((e) => {
130
170
  e.uiConfig && s(e.uiConfig);
131
171
  })), m({
132
172
  status: "ready",
133
- flowManager: p.flowManager
173
+ flowManager: f.flowManager
134
174
  });
135
175
  } catch (e) {
136
176
  let t = e instanceof Error ? e.message : "Failed to initialize SDK";
137
177
  m({
138
178
  status: "error",
139
179
  error: t,
140
- flowManager: p.flowManager
141
- }), u?.(t);
180
+ flowManager: f.flowManager
181
+ }), l?.(t);
142
182
  }
143
183
  })());
144
184
  }, [
145
185
  n,
186
+ u,
146
187
  i,
147
188
  o,
148
189
  c,
149
190
  l,
150
- u,
151
- p
152
- ]), p;
191
+ e,
192
+ f
193
+ ]), f;
153
194
  }
154
195
  //#endregion
155
196
  //#region src/modules/flow/flow.tsx
156
- var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.HomeScreen }))), j = ({ config: n, onFinish: r, onError: a }) => {
157
- let { t: s, i18n: l } = e(), d = k({
197
+ var R = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.HomeScreen }))), z = ({ config: n, onFinish: r, onError: a }) => {
198
+ let { t: s, i18n: l } = e(), d = L({
158
199
  ...n,
159
200
  onError: a
160
- }), [f, p] = c(() => d.flowManager, { autoLoad: !1 }), v = f.presentation.lazyModuleKey, b = x({
201
+ }), [p, g] = c(() => d.flowManager, { autoLoad: !1 }), v = p.presentation.lazyModuleKey, b = p.status === "ready" ? p.currentStep : void 0, w = x({
161
202
  moduleKey: v,
162
- modules: h,
203
+ modules: f,
163
204
  onModuleLoading: n.onModuleLoading,
164
205
  onModuleLoaded: n.onModuleLoaded,
165
206
  onError: a
166
- }), C = b.status === "loaded";
167
- if (_(f?.status === "ready" ? f.steps : [], f?.status === "ready" ? f.currentStepIndex : -1, h, C), t(() => {
168
- f.presentation.shouldPrefetchHome && g();
169
- }, [f.presentation.shouldPrefetchHome]), t(() => {
207
+ }), T = _({
208
+ moduleKey: p.status === "ready" && p.homeScreen.visible ? b : void 0,
209
+ modules: f
210
+ }), E = w.status === "loaded";
211
+ E === !1 && p.homeScreen.visible && (E = T);
212
+ let D = n.enableHome === !0 && p.status === "ready" && p.currentStepIndex === 0 && p.homeScreen.visible === !1 && w.status === "loading";
213
+ if (y(p?.status === "ready" ? p.steps : [], p?.status === "ready" ? p.currentStepIndex : -1, f, E), t(() => {
214
+ p.presentation.shouldPrefetchHome && S();
215
+ }, [p.presentation.shouldPrefetchHome]), t(() => {
170
216
  n.lang && l.language !== n.lang && l.changeLanguage(n.lang);
171
217
  }, [n.lang, l]), t(() => {
172
- if (f?.status === "ready") {
173
- let e = f, t = S(e.flow);
218
+ if (p?.status === "ready") {
219
+ let e = p, t = C(e.flow);
174
220
  t.length > 0 && (n.onWasmWarmup?.(t), m(e, n.wasmConfig));
175
221
  }
176
- }, [f, n]), t(() => {
177
- f?.status === "finished" && r(f.finishStatus);
222
+ }, [p, n]), t(() => {
223
+ p?.status === "finished" && r(p.finishStatus);
178
224
  }, [
179
- f?.status,
225
+ p?.status,
180
226
  r,
181
- f
227
+ p
182
228
  ]), t(() => {
183
- f?.status === "error" && a && a(f.error);
229
+ p?.status === "error" && a && a(p.error);
184
230
  }, [
185
- f?.status,
231
+ p?.status,
186
232
  a,
187
- f
233
+ p
188
234
  ]), t(() => {
189
- f?.status === "ready" && f.currentStep === "ID" && f.steps.includes("TUTORIAL_ID") && p.completeModule();
190
- }, [f, p]), d.status === "error") return /* @__PURE__ */ o("div", {
235
+ p?.status === "ready" && p.currentStep === "ID" && p.steps.includes("TUTORIAL_ID") && g.completeModule();
236
+ }, [p, g]), d.status === "error") return /* @__PURE__ */ o("div", {
191
237
  class: "IncodeFlow",
192
238
  children: /* @__PURE__ */ o("div", { children: ["Error: ", d.error] })
193
239
  });
194
- if (f.homeScreen.visible) return /* @__PURE__ */ o("div", {
240
+ if (p.homeScreen.visible || D) return /* @__PURE__ */ o("div", {
195
241
  class: "IncodeFlow",
196
242
  children: /* @__PURE__ */ o(i, {
197
243
  fallback: null,
198
- children: /* @__PURE__ */ o(A, {
199
- isContinueLoading: f.homeScreen.isContinueLoading,
200
- onContinue: () => p.continueFromHome()
244
+ children: /* @__PURE__ */ o(R, {
245
+ isContinueLoading: p.homeScreen.isContinueLoading || D,
246
+ onContinue: () => g.continueFromHome()
201
247
  })
202
248
  })
203
249
  });
204
- if (d.status === "initializing" || f.presentation.isAwaitingReady) return /* @__PURE__ */ o("div", {
250
+ if (d.status === "initializing" || p.presentation.isAwaitingReady) return /* @__PURE__ */ o("div", {
205
251
  class: "IncodeFlow",
206
252
  children: /* @__PURE__ */ o(u, {
207
253
  title: n.spinnerConfig?.title,
@@ -210,13 +256,13 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
210
256
  fullScreen: !0
211
257
  })
212
258
  });
213
- if (f.status === "error") return /* @__PURE__ */ o("div", {
259
+ if (p.status === "error") return /* @__PURE__ */ o("div", {
214
260
  class: "IncodeFlow",
215
- children: /* @__PURE__ */ o("div", { children: ["Error: ", f.error] })
261
+ children: /* @__PURE__ */ o("div", { children: ["Error: ", p.error] })
216
262
  });
217
- if (f.status === "finished") return null;
218
- if (f?.status === "ready") {
219
- let { currentStep: e, config: t, flow: { flowId: r } } = f;
263
+ if (p.status === "finished") return null;
264
+ if (p?.status === "ready") {
265
+ let { currentStep: e, config: t, flow: { flowId: r } } = p;
220
266
  if (!e || !t) return /* @__PURE__ */ o("div", {
221
267
  class: "IncodeFlow",
222
268
  children: /* @__PURE__ */ o(u, {
@@ -226,14 +272,14 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
226
272
  fullScreen: !0
227
273
  })
228
274
  });
229
- if (b.status === "unsupported") return /* @__PURE__ */ o("div", {
275
+ if (w.status === "unsupported") return /* @__PURE__ */ o("div", {
230
276
  class: "IncodeFlow",
231
- children: /* @__PURE__ */ o(y, {
277
+ children: /* @__PURE__ */ o(h, {
232
278
  moduleKey: e,
233
- onNext: () => p.completeModule()
279
+ onNext: () => g.completeModule()
234
280
  })
235
281
  });
236
- if (b.status === "idle" || b.status === "loading" || b.status === "error") return /* @__PURE__ */ o("div", {
282
+ if (w.status === "idle" || w.status === "loading" || w.status === "error") return /* @__PURE__ */ o("div", {
237
283
  class: "IncodeFlow",
238
284
  children: /* @__PURE__ */ o(u, {
239
285
  title: n.spinnerConfig?.title,
@@ -242,25 +288,25 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
242
288
  fullScreen: !0
243
289
  })
244
290
  });
245
- let { Component: i } = b;
291
+ let { Component: i } = w;
246
292
  if (e === "REDIRECT_TO_MOBILE") return /* @__PURE__ */ o("div", {
247
293
  class: "IncodeFlow",
248
294
  children: /* @__PURE__ */ o(i, {
249
295
  config: t,
250
- onFinish: () => p.completeFlow(),
251
- onContinue: () => p.completeModule(),
296
+ onFinish: () => g.completeFlow(),
297
+ onContinue: () => g.completeModule(),
252
298
  onError: a
253
- }, `redirect-to-mobile-${f.currentStepIndex}`)
299
+ }, `redirect-to-mobile-${p.currentStepIndex}`)
254
300
  });
255
301
  if (e === "SELFIE") return /* @__PURE__ */ o("div", {
256
302
  class: "IncodeFlow",
257
303
  children: /* @__PURE__ */ o(i, {
258
304
  config: t,
259
- onFinish: () => p.completeModule(),
305
+ onFinish: () => g.completeModule(),
260
306
  onError: (e) => {
261
307
  a?.(e ?? "Selfie verification error");
262
308
  }
263
- }, `selfie-${f.currentStepIndex}`)
309
+ }, `selfie-${p.currentStepIndex}`)
264
310
  });
265
311
  if (e === "AUTHENTICATION") return /* @__PURE__ */ o("div", {
266
312
  class: "IncodeFlow",
@@ -269,21 +315,21 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
269
315
  ...t,
270
316
  authHint: n.authHint
271
317
  },
272
- onFinish: () => p.completeModule(),
318
+ onFinish: () => g.completeModule(),
273
319
  onError: (e) => {
274
320
  a?.(e ?? "Authentication error");
275
321
  }
276
- }, `authentication-${f.currentStepIndex}`)
322
+ }, `authentication-${p.currentStepIndex}`)
277
323
  });
278
324
  if (e === "PHONE") return /* @__PURE__ */ o("div", {
279
325
  class: "IncodeFlow",
280
326
  children: /* @__PURE__ */ o(i, {
281
327
  config: t,
282
- onFinish: () => p.completeModule(),
328
+ onFinish: () => g.completeModule(),
283
329
  onError: (e) => {
284
330
  a?.(e ?? "Phone verification error");
285
331
  }
286
- }, `phone-${f.currentStepIndex}`)
332
+ }, `phone-${p.currentStepIndex}`)
287
333
  });
288
334
  if (e === "EMAIL") {
289
335
  let e = t;
@@ -294,11 +340,11 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
294
340
  class: "IncodeFlow",
295
341
  children: /* @__PURE__ */ o(i, {
296
342
  config: e,
297
- onFinish: () => p.completeModule(),
343
+ onFinish: () => g.completeModule(),
298
344
  onError: (e) => {
299
345
  a?.(e ?? "Email verification error");
300
346
  }
301
- }, `email-${f.currentStepIndex}`)
347
+ }, `email-${p.currentStepIndex}`)
302
348
  });
303
349
  }
304
350
  if (e === "ID" || e === "SECOND_ID") {
@@ -310,72 +356,72 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
310
356
  ...n,
311
357
  isSecondId: !0
312
358
  } : n,
313
- onFinish: () => p.completeModule(),
359
+ onFinish: () => g.completeModule(),
314
360
  onError: (e) => {
315
361
  a?.(e ?? "ID capture error");
316
362
  }
317
- }, `id-${f.currentStepIndex}`)
363
+ }, `id-${p.currentStepIndex}`)
318
364
  });
319
365
  }
320
366
  if (e === "FACE_MATCH") return /* @__PURE__ */ o("div", {
321
367
  class: "IncodeFlow",
322
368
  children: /* @__PURE__ */ o(i, {
323
369
  config: t,
324
- onFinish: () => p.completeModule(),
370
+ onFinish: () => g.completeModule(),
325
371
  onError: (e) => {
326
372
  a?.(e ?? "Face match error");
327
373
  }
328
- }, `face-match-${f.currentStepIndex}`)
374
+ }, `face-match-${p.currentStepIndex}`)
329
375
  });
330
376
  if (e === "CURP_VALIDATION") return /* @__PURE__ */ o("div", {
331
377
  class: "IncodeFlow",
332
378
  children: /* @__PURE__ */ o(i, {
333
379
  config: t,
334
- onFinish: () => p.completeModule(),
380
+ onFinish: () => g.completeModule(),
335
381
  onError: (e) => {
336
382
  a?.(e ?? "CURP validation error");
337
383
  }
338
- }, `curp-validation-${f.currentStepIndex}`)
384
+ }, `curp-validation-${p.currentStepIndex}`)
339
385
  });
340
386
  if (e === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ o("div", {
341
387
  class: "IncodeFlow",
342
388
  children: /* @__PURE__ */ o(i, {
343
389
  config: t,
344
- onFinish: () => p.completeModule(),
390
+ onFinish: () => g.completeModule(),
345
391
  onError: (e) => {
346
392
  a?.(e ?? "Government validation error");
347
393
  }
348
- }, `govt-validation-${f.currentStepIndex}`)
394
+ }, `govt-validation-${p.currentStepIndex}`)
349
395
  });
350
396
  if (e === "GEOLOCATION") return /* @__PURE__ */ o("div", {
351
397
  class: "IncodeFlow",
352
398
  children: /* @__PURE__ */ o(i, {
353
399
  config: t,
354
- onFinish: () => p.completeModule(),
400
+ onFinish: () => g.completeModule(),
355
401
  onError: (e) => {
356
402
  a?.(e ?? "Geolocation error");
357
403
  }
358
- }, `geolocation-${f.currentStepIndex}`)
404
+ }, `geolocation-${p.currentStepIndex}`)
359
405
  });
360
406
  if (e === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ o("div", {
361
407
  class: "IncodeFlow",
362
408
  children: /* @__PURE__ */ o(i, {
363
- config: { flowId: f.flow.flowId },
364
- onFinish: () => p.completeModule(),
409
+ config: { flowId: p.flow.flowId },
410
+ onFinish: () => g.completeModule(),
365
411
  onError: (e) => {
366
412
  a?.(e ?? "External verification error");
367
413
  }
368
- }, `ekyc-${f.currentStepIndex}`)
414
+ }, `ekyc-${p.currentStepIndex}`)
369
415
  });
370
416
  if (e === "DOCUMENT_CAPTURE") return /* @__PURE__ */ o("div", {
371
417
  class: "IncodeFlow",
372
418
  children: /* @__PURE__ */ o(i, {
373
419
  config: t,
374
- onFinish: () => p.completeModule(),
420
+ onFinish: () => g.completeModule(),
375
421
  onError: (e) => {
376
422
  a?.(e ?? "Document capture error");
377
423
  }
378
- }, `document-capture-${f.currentStepIndex}`)
424
+ }, `document-capture-${p.currentStepIndex}`)
379
425
  });
380
426
  if (e === "ADDRESS") return /* @__PURE__ */ o("div", {
381
427
  class: "IncodeFlow",
@@ -384,21 +430,21 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
384
430
  ...t,
385
431
  processingType: "addressStatement"
386
432
  },
387
- onFinish: () => p.completeModule(),
433
+ onFinish: () => g.completeModule(),
388
434
  onError: (e) => {
389
435
  a?.(e ?? "Address capture error");
390
436
  }
391
- }, `address-${f.currentStepIndex}`)
437
+ }, `address-${p.currentStepIndex}`)
392
438
  });
393
439
  if (e === "SIGNATURE") return /* @__PURE__ */ o("div", {
394
440
  class: "IncodeFlow",
395
441
  children: /* @__PURE__ */ o(i, {
396
442
  config: t,
397
- onFinish: () => p.completeModule(),
443
+ onFinish: () => g.completeModule(),
398
444
  onError: (e) => {
399
445
  a?.(e ?? "Signature capture error");
400
446
  }
401
- }, `signature-${f.currentStepIndex}`)
447
+ }, `signature-${p.currentStepIndex}`)
402
448
  });
403
449
  if (e === "EKYB") {
404
450
  let e = t;
@@ -412,32 +458,32 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
412
458
  checkTaxId: e.checkTaxId,
413
459
  checkUniqueBeneficialOwner: e.checkUniqueBeneficialOwner
414
460
  },
415
- onFinish: () => p.completeModule(),
461
+ onFinish: () => g.completeModule(),
416
462
  onError: (e) => {
417
463
  a?.(e ?? "eKYB verification error");
418
464
  }
419
- }, `ekyb-${f.currentStepIndex}`)
465
+ }, `ekyb-${p.currentStepIndex}`)
420
466
  });
421
467
  }
422
468
  if (e === "COMBINED_CONSENT") return /* @__PURE__ */ o("div", {
423
469
  class: "IncodeFlow",
424
470
  children: /* @__PURE__ */ o(i, {
425
471
  config: t,
426
- onFinish: () => p.completeModule(),
472
+ onFinish: () => g.completeModule(),
427
473
  onError: (e) => {
428
474
  a?.(e ?? "Combined consent error");
429
475
  }
430
- }, `combined-consent-${f.currentStepIndex}`)
476
+ }, `combined-consent-${p.currentStepIndex}`)
431
477
  });
432
478
  if (e === "MANDATORY_CONSENT") return /* @__PURE__ */ o("div", {
433
479
  class: "IncodeFlow",
434
480
  children: /* @__PURE__ */ o(i, {
435
481
  config: t,
436
- onFinish: () => p.completeModule(),
482
+ onFinish: () => g.completeModule(),
437
483
  onError: (e) => {
438
484
  a?.(e ?? "Mandatory consent error");
439
485
  }
440
- }, `mandatory-consent-${f.currentStepIndex}`)
486
+ }, `mandatory-consent-${p.currentStepIndex}`)
441
487
  });
442
488
  if (e === "AE_SIGNATURE" || e === "QE_SIGNATURE") {
443
489
  let n = t, r = e === "QE_SIGNATURE" ? "qe" : "ae";
@@ -448,47 +494,47 @@ var A = n(() => import("../homeScreen-C0-81utl.js").then((e) => ({ default: e.Ho
448
494
  uploadDocument: n.uploadDocument,
449
495
  downloadDocument: n.downloadDocument
450
496
  },
451
- onFinish: () => p.completeModule(),
497
+ onFinish: () => g.completeModule(),
452
498
  onError: (e) => {
453
499
  a?.(e ?? `${r.toUpperCase()} Signature error`);
454
500
  }
455
- }, `${r}-signature-${f.currentStepIndex}`)
501
+ }, `${r}-signature-${p.currentStepIndex}`)
456
502
  });
457
503
  }
458
504
  if (e === "ANTIFRAUD") return /* @__PURE__ */ o("div", {
459
505
  class: "IncodeFlow",
460
506
  children: /* @__PURE__ */ o(i, {
461
- onFinish: () => p.completeModule(),
507
+ onFinish: () => g.completeModule(),
462
508
  onError: (e) => {
463
509
  a?.(e ?? "Antifraud check error");
464
510
  }
465
- }, `antifraud-${f.currentStepIndex}`)
511
+ }, `antifraud-${p.currentStepIndex}`)
466
512
  });
467
513
  if (e === "WATCHLIST") return /* @__PURE__ */ o("div", {
468
514
  class: "IncodeFlow",
469
515
  children: /* @__PURE__ */ o(i, {
470
- onFinish: () => p.completeModule(),
516
+ onFinish: () => g.completeModule(),
471
517
  onError: (e) => {
472
518
  a?.(e ?? "Watchlist check error");
473
519
  }
474
- }, `watchlist-${f.currentStepIndex}`)
520
+ }, `watchlist-${p.currentStepIndex}`)
475
521
  });
476
522
  if (e === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ o("div", {
477
523
  class: "IncodeFlow",
478
524
  children: /* @__PURE__ */ o(i, {
479
- onFinish: () => p.completeModule(),
525
+ onFinish: () => g.completeModule(),
480
526
  onError: (e) => {
481
527
  a?.(e ?? "Cross document data match error");
482
528
  }
483
- }, `cross-document-data-match-${f.currentStepIndex}`)
529
+ }, `cross-document-data-match-${p.currentStepIndex}`)
484
530
  });
485
531
  }
486
532
  return null;
487
- }, M = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ o(l, { children: e ? /* @__PURE__ */ o(j, {
533
+ }, B = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ o(l, { children: e ? /* @__PURE__ */ o(z, {
488
534
  config: e,
489
535
  onFinish: t,
490
536
  onError: n
491
537
  }) : null });
492
- d(M, "incode-flow");
538
+ d(B, "incode-flow");
493
539
  //#endregion
494
- export { M as IncodeFlow, T as preloadIncodeFlow };
540
+ export { B as IncodeFlow, N as preloadIncodeFlow };
@@ -1,17 +1,20 @@
1
+ import { CreateSessionOptions } from '@incodetech/core/session';
1
2
  import { FC } from 'preact/compat';
2
3
  import { FinishStatus } from '@incodetech/core/flow';
3
4
  import { WasmConfig } from '@incodetech/core/wasm';
4
5
 
5
- export declare type FlowConfig = FlowRuntimeConfig & {
6
- onModuleLoading?: (moduleKey: string) => void;
7
- onModuleLoaded?: (moduleKey: string) => void;
8
- onWasmWarmup?: (pipelines: string[]) => void;
9
- spinnerConfig?: SpinnerConfig;
6
+ declare type ApiKeySessionBootstrap = {
7
+ apiKey: string;
8
+ clientId?: string;
9
+ };
10
+
11
+ declare type ClientIdSessionBootstrap = {
12
+ apiKey?: string;
13
+ clientId: string;
10
14
  };
11
15
 
12
- declare type FlowRuntimeConfig = {
16
+ declare type FlowBaseConfig = {
13
17
  apiURL: string;
14
- token: string;
15
18
  authHint?: string;
16
19
  wasmConfig?: WasmConfig;
17
20
  lang?: string;
@@ -19,6 +22,17 @@ declare type FlowRuntimeConfig = {
19
22
  enableHome?: boolean;
20
23
  };
21
24
 
25
+ export declare type FlowConfig = FlowRuntimeConfig & FlowUiConfig;
26
+
27
+ declare type FlowRuntimeConfig = TokenFlowRuntimeConfig | SelfLoadingFlowRuntimeConfig;
28
+
29
+ declare type FlowUiConfig = {
30
+ onModuleLoading?: (moduleKey: string) => void;
31
+ onModuleLoaded?: (moduleKey: string) => void;
32
+ onWasmWarmup?: (pipelines: string[]) => void;
33
+ spinnerConfig?: SpinnerConfig;
34
+ };
35
+
22
36
  export declare const IncodeFlow: FC<IncodeFlowProps>;
23
37
 
24
38
  declare type IncodeFlowProps = IncodeModuleProps<FlowConfig, FinishStatus>;
@@ -44,7 +58,7 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
44
58
  onError?: (error: string | undefined) => void;
45
59
  };
46
60
 
47
- declare type PreloadConfig = FlowRuntimeConfig;
61
+ declare type PreloadConfig = TokenFlowRuntimeConfig;
48
62
 
49
63
  export declare type PreloadHandle = {
50
64
  get isReady(): boolean;
@@ -55,6 +69,12 @@ export declare type PreloadHandle = {
55
69
 
56
70
  export declare function preloadIncodeFlow(config: PreloadConfig): PreloadHandle;
57
71
 
72
+ declare type SelfLoadingFlowRuntimeConfig = FlowBaseConfig & SelfLoadingSessionOptions & (ApiKeySessionBootstrap | ClientIdSessionBootstrap) & {
73
+ token?: never;
74
+ };
75
+
76
+ declare type SelfLoadingSessionOptions = Pick<CreateSessionOptions, 'configurationId' | 'externalId' | 'externalCustomerId' | 'customFields' | 'uuid' | 'interviewId'>;
77
+
58
78
  declare type SpinnerConfig = {
59
79
  title?: string;
60
80
  subtitle?: string;
@@ -63,6 +83,18 @@ declare type SpinnerConfig = {
63
83
 
64
84
  declare type SpinnerSize = 'small' | 'medium' | 'large';
65
85
 
86
+ declare type TokenFlowRuntimeConfig = FlowBaseConfig & {
87
+ token: string;
88
+ apiKey?: never;
89
+ clientId?: never;
90
+ configurationId?: never;
91
+ externalId?: never;
92
+ externalCustomerId?: never;
93
+ customFields?: never;
94
+ uuid?: never;
95
+ interviewId?: never;
96
+ };
97
+
66
98
  export { }
67
99
 
68
100
  declare global {
@@ -350,11 +350,15 @@ function H(t) {
350
350
  } : { status: "idle" };
351
351
  }
352
352
  function U(e) {
353
+ let { moduleKey: t, modules: n } = e, r = t ? n[t] : void 0, i = V({ loader: r });
354
+ return r != null && i.status === "loaded";
355
+ }
356
+ function W(e) {
353
357
  typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
354
358
  e();
355
359
  }) : setTimeout(e, 0);
356
360
  }
357
- function W(n, r, i, a) {
361
+ function G(n, r, i, a) {
358
362
  let o = t(/* @__PURE__ */ new Set());
359
363
  e(() => {
360
364
  if (a && r < n.length - 1) {
@@ -362,7 +366,7 @@ function W(n, r, i, a) {
362
366
  if (e && !o.current.has(e)) {
363
367
  o.current.add(e);
364
368
  let t = i[e];
365
- t && U(() => {
369
+ t && W(() => {
366
370
  t().catch(() => {
367
371
  o.current.delete(e);
368
372
  });
@@ -377,4 +381,4 @@ function W(n, r, i, a) {
377
381
  ]);
378
382
  }
379
383
  //#endregion
380
- export { N as a, R as c, L as d, w as f, A as i, M as l, W as n, I as o, z as r, F as s, H as t, P as u };
384
+ export { A as a, F as c, P as d, L as f, z as i, R as l, U as n, N as o, w as p, G as r, I as s, H as t, M as u };
@@ -5,17 +5,17 @@ import { o, t as s } from "../incodeComponent-DIb7wDAq.js";
5
5
  import { t as c } from "../spinner-l6dvYqCg.js";
6
6
  import "../spinner-CFvndzMU.js";
7
7
  import { t as l } from "../incodeModule-D_r2n18O.js";
8
- import { f as u, i as d, r as f, t as p, u as m } from "../useModuleLoader-C8N5qfo6.js";
8
+ import { a as u, d, i as f, p, t as m } from "../useModuleLoader-B6JxxJWR.js";
9
9
  import { resolveWasmConfig as h, warmupWasm as g } from "@incodetech/core/wasm";
10
10
  import { createWorkflowManager as _ } from "@incodetech/core/workflow";
11
11
  //#region src/modules/workflow/workflowInit.ts
12
12
  var v = {
13
- ...d,
13
+ ...u,
14
14
  REDIRECT_TO_MOBILE: () => import("../redirectToMobile-1oLWg6QJ.js").then((e) => e.RedirectToMobile)
15
15
  };
16
16
  async function y() {
17
17
  try {
18
- let e = await u();
18
+ let e = await p();
19
19
  return {
20
20
  theme: e,
21
21
  uiConfig: {
@@ -45,11 +45,11 @@ function x(e) {
45
45
  //#endregion
46
46
  //#region src/modules/workflow/useWorkflowInitialization.ts
47
47
  function S(e) {
48
- let { apiURL: i, token: o, lang: s, disableDashboardTheme: c, wasmConfig: l, customModuleCallback: u, interviewId: d, isDesktop: f, onError: p } = e, h = n(null), [g, _] = r(() => {
48
+ let { apiURL: i, token: o, lang: s, disableDashboardTheme: c, wasmConfig: l, customModuleCallback: u, interviewId: f, isDesktop: p, onError: m } = e, h = n(null), [g, _] = r(() => {
49
49
  let e = b({
50
50
  customModuleCallback: u,
51
- interviewId: d,
52
- isDesktop: f
51
+ interviewId: f,
52
+ isDesktop: p
53
53
  });
54
54
  return h.current = e, {
55
55
  status: "initializing",
@@ -62,7 +62,7 @@ function S(e) {
62
62
  let e = h.current;
63
63
  return (async () => {
64
64
  try {
65
- await m({
65
+ await d({
66
66
  apiURL: i,
67
67
  token: o,
68
68
  lang: s
@@ -80,7 +80,7 @@ function S(e) {
80
80
  status: "error",
81
81
  error: n,
82
82
  workflowManager: e
83
- }), p?.(n);
83
+ }), m?.(n);
84
84
  }
85
85
  })(), () => e?.stop();
86
86
  }, [
@@ -89,7 +89,7 @@ function S(e) {
89
89
  s,
90
90
  c,
91
91
  l,
92
- p
92
+ m
93
93
  ]), g;
94
94
  }
95
95
  //#endregion
@@ -145,7 +145,7 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
145
145
  interviewId: r.interviewId,
146
146
  isDesktop: r.isDesktop,
147
147
  onError: s
148
- }), [d, m] = o(() => u.workflowManager, { autoLoad: !1 }), h = p({
148
+ }), [d, p] = o(() => u.workflowManager, { autoLoad: !1 }), h = m({
149
149
  moduleKey: d?.status === "ready" ? d.currentNode.moduleKey : void 0,
150
150
  modules: v,
151
151
  onModuleLoading: r.onModuleLoading,
@@ -178,7 +178,7 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
178
178
  fullScreen: !0
179
179
  })
180
180
  }), y = (e) => {
181
- m.errorModule(e ?? "Module error"), s?.(e ?? "Module error");
181
+ p.errorModule(e ?? "Module error"), s?.(e ?? "Module error");
182
182
  };
183
183
  if (u.status === "error") return null;
184
184
  if (u.status === "initializing" || !d || d.status === "idle" || d.status === "loading") return _();
@@ -187,7 +187,7 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
187
187
  class: "IncodeWorkflow",
188
188
  children: /* @__PURE__ */ i(f, {
189
189
  moduleKey: d.currentNode.moduleKey,
190
- onNext: () => m.completeModule()
190
+ onNext: () => p.completeModule()
191
191
  })
192
192
  });
193
193
  if (h.status === "idle" || h.status === "loading" || h.status === "error") return _();
@@ -204,9 +204,9 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
204
204
  mergeSessionRecordings: d.workflowConfig.mergeSessionRecordings,
205
205
  ageAssurance: d.workflowConfig.ageAssurance
206
206
  }),
207
- onFinish: () => m.completeModule(),
207
+ onFinish: () => p.completeModule(),
208
208
  onError: y,
209
- ...d.currentNode.moduleKey === "REDIRECT_TO_MOBILE" ? { onContinue: () => m.completeModule() } : {}
209
+ ...d.currentNode.moduleKey === "REDIRECT_TO_MOBILE" ? { onContinue: () => p.completeModule() } : {}
210
210
  }, d.currentNode.id)
211
211
  });
212
212
  }, T = ({ config: e, onFinish: t, onError: n }) => /* @__PURE__ */ i(s, { children: e ? /* @__PURE__ */ i(w, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260416-3692bda",
3
+ "version": "0.0.0-dev-20260417-7a073a7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -183,7 +183,7 @@
183
183
  "qrcode": "^1.5.4",
184
184
  "signature_pad": "^5.1.3",
185
185
  "tailwindcss": "^4.1.17",
186
- "@incodetech/core": "0.0.0-dev-20260416-3692bda"
186
+ "@incodetech/core": "0.0.0-dev-20260417-7a073a7"
187
187
  },
188
188
  "devDependencies": {
189
189
  "@microsoft/api-extractor": "^7.53.3",