@incodetech/web 0.0.0-dev-20260428-98e9ebb → 0.0.0-dev-20260428-7b99b18

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.
@@ -7,9 +7,9 @@ import { t as d } from "../incodeModule-CHzKl22Y.js";
7
7
  import { a as f, c as p, d as m, i as h, l as g, n as _, o as v, p as y, r as b, s as x, t as S, u as C } from "../useModuleLoader-D_nCByUY.js";
8
8
  import { getDeviceClass as w } from "@incodetech/core/device";
9
9
  import { getRequiredWasmPipelines as T } from "@incodetech/core/flow";
10
- import { createSession as E, validateQrUuid as D } from "@incodetech/core/session";
10
+ import { QrValidationError as E, bootstrapSession as D, refreshQrUrlUuid as O } from "@incodetech/core/session";
11
11
  //#region src/shared/processing/useDelayedFlag.ts
12
- function O(e, n) {
12
+ function k(e, n) {
13
13
  let [r, i] = a(!1);
14
14
  return t(() => {
15
15
  if (e === !1) {
@@ -26,38 +26,30 @@ function O(e, n) {
26
26
  }
27
27
  //#endregion
28
28
  //#region src/modules/flow/createFlowSession.ts
29
- function k(e) {
29
+ function A(e) {
30
30
  return Array.from(new Uint8Array(e), (e) => e.toString(16).padStart(2, "0")).join("");
31
31
  }
32
- async function A(e) {
32
+ async function j(e) {
33
33
  let t = globalThis.crypto?.subtle;
34
34
  if (!t) throw Error("SHA-1 is not available in this environment");
35
- return k(await t.digest("SHA-1", new TextEncoder().encode(e)));
35
+ return A(await t.digest("SHA-1", new TextEncoder().encode(e)));
36
36
  }
37
- async function j(e) {
37
+ async function M(e) {
38
38
  if (typeof e.apiKey == "string") return e.apiKey;
39
- if (typeof e.clientId == "string") return A(e.clientId);
39
+ if (typeof e.clientId == "string") return j(e.clientId);
40
40
  throw Error("Flow self-loading mode requires apiKey or clientId");
41
41
  }
42
- async function M(e, t) {
43
- if (typeof e.urlUuid != "string" || e.urlUuid.length === 0) return;
44
- let n = await D({
45
- onboardingId: e.uuid ?? null,
46
- urlUuid: e.urlUuid
47
- }, t);
48
- return e.onUrlUuidRefreshed?.(n.urlUuid), n.urlUuid;
49
- }
50
42
  async function N(e, t) {
51
- let n = await j(e), r = await M(e, t);
52
- return E(n, {
43
+ return D(await M(e), {
53
44
  configurationId: e.configurationId,
54
45
  externalId: e.externalId,
55
46
  externalCustomerId: e.externalCustomerId,
56
47
  language: e.lang,
57
48
  customFields: e.customFields,
58
49
  uuid: e.uuid,
59
- urlUuid: r,
60
- interviewId: e.interviewId
50
+ urlUuid: e.urlUuid,
51
+ interviewId: e.interviewId,
52
+ onUrlUuidRefreshed: e.onUrlUuidRefreshed
61
53
  }, t);
62
54
  }
63
55
  //#endregion
@@ -95,6 +87,7 @@ function L(e) {
95
87
  }
96
88
  function R(e) {
97
89
  let { token: t } = e;
90
+ if (e.urlUuid) throw Error("preloadIncodeFlow does not support urlUuid; pass it to <IncodeFlow> directly so the SDK can rotate it on mount.");
98
91
  if (I.has(t)) return L(t);
99
92
  let n, r, i = new Promise((e, t) => {
100
93
  n = e, r = t;
@@ -179,20 +172,28 @@ function U(e) {
179
172
  flowManager: e.flowManager
180
173
  }));
181
174
  }).catch((e) => {
182
- let t = e instanceof Error ? e.message : "Preload failed";
175
+ let t = e instanceof Error ? e.message : "Preload failed", n = e instanceof E ? e.status : void 0;
183
176
  f({
184
177
  status: "error",
185
178
  error: t,
179
+ errorCode: n,
186
180
  flowManager: d.flowManager
187
- }), c?.(t);
181
+ }), c?.(t, n);
188
182
  });
189
183
  return;
190
184
  }
191
- m.current || (m.current = !0, (async () => {
185
+ if (m.current) return;
186
+ m.current = !0;
187
+ let r = new AbortController(), { signal: a } = r;
188
+ return (async () => {
192
189
  try {
193
190
  let t;
194
- if (P(e)) t = e.token;
195
- else if (F(e)) t = (await N(e)).token;
191
+ if (P(e)) t = e.token, e.urlUuid && await O({
192
+ urlUuid: e.urlUuid,
193
+ onboardingId: null,
194
+ onRefreshed: e.onUrlUuidRefreshed
195
+ }, a);
196
+ else if (F(e)) t = (await N(e, a)).token;
196
197
  else throw Error("Flow requires token, or configurationId with apiKey or clientId");
197
198
  await p({
198
199
  token: t,
@@ -201,20 +202,22 @@ function U(e) {
201
202
  });
202
203
  let r = i ? Promise.resolve() : x().then((e) => {
203
204
  e.uiConfig && s(e.uiConfig);
204
- }), a = d.flowManager.waitForReady();
205
- await Promise.all([a, r]), f({
205
+ }), o = d.flowManager.waitForReady();
206
+ await Promise.all([o, r]), f({
206
207
  status: "ready",
207
208
  flowManager: d.flowManager
208
209
  });
209
210
  } catch (e) {
210
- let t = e instanceof Error ? e.message : "Failed to initialize SDK";
211
+ if (a.aborted) return;
212
+ let t = e instanceof Error ? e.message : "Failed to initialize SDK", n = e instanceof E ? e.status : void 0;
211
213
  f({
212
214
  status: "error",
213
215
  error: t,
216
+ errorCode: n,
214
217
  flowManager: d.flowManager
215
- }), c?.(t);
218
+ }), c?.(t, n);
216
219
  }
217
- })());
220
+ })(), () => r.abort();
218
221
  }, [
219
222
  l,
220
223
  n,
@@ -242,7 +245,7 @@ var W = n(() => import("../homeScreen-CS1MmbXm.js").then((e) => ({ default: e.Ho
242
245
  moduleKey: d.status === "ready" && d.homeScreen.visible ? g : void 0,
243
246
  modules: f
244
247
  });
245
- let x = v.status === "loaded", w = n.enableHome === !0 && d.status === "ready" && d.flow.disableLaunchScreen !== !0 && d.currentStepIndex === 0 && d.homeScreen.visible === !1 && v.status === "loading", E = O(d.presentation.isAwaitingReady === !0, 150), D = O(d.status === "ready" && (v.status === "idle" || v.status === "loading" || v.status === "error"), 150);
248
+ let x = v.status === "loaded", w = n.enableHome === !0 && d.status === "ready" && d.flow.disableLaunchScreen !== !0 && d.currentStepIndex === 0 && d.homeScreen.visible === !1 && v.status === "loading", E = k(d.presentation.isAwaitingReady === !0, 150), D = k(d.status === "ready" && (v.status === "idle" || v.status === "loading" || v.status === "error"), 150);
246
249
  b(d?.status === "ready" ? d.steps : [], d?.status === "ready" ? d.currentStepIndex : -1, f, x), t(() => {
247
250
  if (n.onFlowEvent) return p.subscribeFlowEvent(n.onFlowEvent);
248
251
  }, [p, n.onFlowEvent]), t(() => {
@@ -268,7 +271,7 @@ var W = n(() => import("../homeScreen-CS1MmbXm.js").then((e) => ({ default: e.Ho
268
271
  ]), t(() => {
269
272
  d?.status === "ready" && d.currentStep === "ID" && d.steps.includes("TUTORIAL_ID") && p.completeModule();
270
273
  }, [d, p]);
271
- let k = !(n.spinnerConfig?.title || n.spinnerConfig?.subtitle);
274
+ let O = !(n.spinnerConfig?.title || n.spinnerConfig?.subtitle);
272
275
  if (l.status === "error") return /* @__PURE__ */ o("div", {
273
276
  class: "IncodeFlow",
274
277
  children: /* @__PURE__ */ o("div", { children: ["Error: ", l.error] })
@@ -287,14 +290,14 @@ var W = n(() => import("../homeScreen-CS1MmbXm.js").then((e) => ({ default: e.Ho
287
290
  class: "IncodeFlow",
288
291
  children: /* @__PURE__ */ o(u, {
289
292
  spinnerConfig: n.spinnerConfig,
290
- hideText: k
293
+ hideText: O
291
294
  })
292
295
  });
293
296
  if (d.presentation.isAwaitingReady) return E ? /* @__PURE__ */ o("div", {
294
297
  class: "IncodeFlow",
295
298
  children: /* @__PURE__ */ o(u, {
296
299
  spinnerConfig: n.spinnerConfig,
297
- hideText: k
300
+ hideText: O
298
301
  })
299
302
  }) : /* @__PURE__ */ o("div", { class: "IncodeFlow" });
300
303
  if (d.status === "error") return /* @__PURE__ */ o("div", {
@@ -308,7 +311,7 @@ var W = n(() => import("../homeScreen-CS1MmbXm.js").then((e) => ({ default: e.Ho
308
311
  class: "IncodeFlow",
309
312
  children: /* @__PURE__ */ o(u, {
310
313
  spinnerConfig: n.spinnerConfig,
311
- hideText: k
314
+ hideText: O
312
315
  })
313
316
  });
314
317
  if (v.status === "unsupported") return /* @__PURE__ */ o("div", {
@@ -322,7 +325,7 @@ var W = n(() => import("../homeScreen-CS1MmbXm.js").then((e) => ({ default: e.Ho
322
325
  class: "IncodeFlow",
323
326
  children: /* @__PURE__ */ o(u, {
324
327
  spinnerConfig: n.spinnerConfig,
325
- hideText: k
328
+ hideText: O
326
329
  })
327
330
  }) : /* @__PURE__ */ o("div", { class: "IncodeFlow" });
328
331
  let { Component: s } = v;
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -25,8 +25,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
25
25
  onFinish?: (result?: TResult) => void;
26
26
  /**
27
27
  * Callback invoked when a fatal module error occurs.
28
+ *
29
+ * @param error - Human-readable error message.
30
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
31
+ * the workflow and flow modules on QR validation failures —
32
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
28
33
  */
29
- onError?: (error: string | undefined) => void;
34
+ onError?: (error: string | undefined, errorCode?: number) => void;
30
35
  };
31
36
 
32
37
  export { }
@@ -23,8 +23,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
23
23
  onFinish?: (result?: TResult) => void;
24
24
  /**
25
25
  * Callback invoked when a fatal module error occurs.
26
+ *
27
+ * @param error - Human-readable error message.
28
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
29
+ * the workflow and flow modules on QR validation failures —
30
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
26
31
  */
27
- onError?: (error: string | undefined) => void;
32
+ onError?: (error: string | undefined, errorCode?: number) => void;
28
33
  };
29
34
 
30
35
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -25,8 +25,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
25
25
  onFinish?: (result?: TResult) => void;
26
26
  /**
27
27
  * Callback invoked when a fatal module error occurs.
28
+ *
29
+ * @param error - Human-readable error message.
30
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
31
+ * the workflow and flow modules on QR validation failures —
32
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
28
33
  */
29
- onError?: (error: string | undefined) => void;
34
+ onError?: (error: string | undefined, errorCode?: number) => void;
30
35
  };
31
36
 
32
37
  export { }
@@ -49,8 +49,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
49
49
  onFinish?: (result?: TResult) => void;
50
50
  /**
51
51
  * Callback invoked when a fatal module error occurs.
52
+ *
53
+ * @param error - Human-readable error message.
54
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
55
+ * the workflow and flow modules on QR validation failures —
56
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
52
57
  */
53
- onError?: (error: string | undefined) => void;
58
+ onError?: (error: string | undefined, errorCode?: number) => void;
54
59
  };
55
60
 
56
61
  export { }
@@ -414,8 +414,13 @@ export declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknow
414
414
  onFinish?: (result?: TResult) => void;
415
415
  /**
416
416
  * Callback invoked when a fatal module error occurs.
417
+ *
418
+ * @param error - Human-readable error message.
419
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
420
+ * the workflow and flow modules on QR validation failures —
421
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
417
422
  */
418
- onError?: (error: string | undefined) => void;
423
+ onError?: (error: string | undefined, errorCode?: number) => void;
419
424
  };
420
425
 
421
426
  declare type InferState<T> = T extends {
@@ -47,8 +47,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
47
47
  onFinish?: (result?: TResult) => void;
48
48
  /**
49
49
  * Callback invoked when a fatal module error occurs.
50
+ *
51
+ * @param error - Human-readable error message.
52
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
53
+ * the workflow and flow modules on QR validation failures —
54
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
50
55
  */
51
- onError?: (error: string | undefined) => void;
56
+ onError?: (error: string | undefined, errorCode?: number) => void;
52
57
  };
53
58
 
54
59
  export { }
@@ -65,11 +65,26 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
65
65
  onFinish?: (result?: TResult) => void;
66
66
  /**
67
67
  * Callback invoked when a fatal module error occurs.
68
+ *
69
+ * @param error - Human-readable error message.
70
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
71
+ * the workflow and flow modules on QR validation failures —
72
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
68
73
  */
69
- onError?: (error: string | undefined) => void;
74
+ onError?: (error: string | undefined, errorCode?: number) => void;
70
75
  };
71
76
 
72
- declare type PreloadConfig = TokenFlowRuntimeConfig;
77
+ /**
78
+ * Preload runs before the Flow component mounts and only prefetches the flow
79
+ * config + theme — it never burns a urlUuid. Allowing one would silently skip
80
+ * phishing-resistance rotation on mount (the consume path bypasses the init
81
+ * useEffect), so the field is forbidden at the type and runtime boundaries.
82
+ * Topology B (mobile leg of a desktop→mobile redirect) cannot use preload —
83
+ * pass `urlUuid` to `<IncodeFlow>` directly instead.
84
+ */
85
+ declare type PreloadConfig = Omit<TokenFlowRuntimeConfig, 'urlUuid'> & {
86
+ urlUuid?: never;
87
+ };
73
88
 
74
89
  export declare type PreloadHandle = {
75
90
  get isReady(): boolean;
@@ -96,6 +111,12 @@ declare type SpinnerSize = 'small' | 'medium' | 'large';
96
111
 
97
112
  declare type TokenFlowRuntimeConfig = FlowBaseConfig & {
98
113
  token: string;
114
+ /** QR anti-phishing token from the incoming URL (mobile leg of a desktop→mobile redirect).
115
+ * When provided, the SDK rotates it on mount via `validateQrUuid` and invokes
116
+ * `onUrlUuidRefreshed` so the host can update the address bar. Validation
117
+ * failures abort initialization via `onError` (with the HTTP status as
118
+ * `errorCode`). */
119
+ urlUuid?: string;
99
120
  apiKey?: never;
100
121
  clientId?: never;
101
122
  configurationId?: never;
@@ -103,7 +124,6 @@ declare type TokenFlowRuntimeConfig = FlowBaseConfig & {
103
124
  externalCustomerId?: never;
104
125
  customFields?: never;
105
126
  uuid?: never;
106
- urlUuid?: never;
107
127
  interviewId?: never;
108
128
  };
109
129
 
@@ -23,8 +23,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
23
23
  onFinish?: (result?: TResult) => void;
24
24
  /**
25
25
  * Callback invoked when a fatal module error occurs.
26
+ *
27
+ * @param error - Human-readable error message.
28
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
29
+ * the workflow and flow modules on QR validation failures —
30
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
26
31
  */
27
- onError?: (error: string | undefined) => void;
32
+ onError?: (error: string | undefined, errorCode?: number) => void;
28
33
  };
29
34
 
30
35
  export { }
@@ -22,8 +22,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
22
22
  onFinish?: (result?: TResult) => void;
23
23
  /**
24
24
  * Callback invoked when a fatal module error occurs.
25
+ *
26
+ * @param error - Human-readable error message.
27
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
28
+ * the workflow and flow modules on QR validation failures —
29
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
25
30
  */
26
- onError?: (error: string | undefined) => void;
31
+ onError?: (error: string | undefined, errorCode?: number) => void;
27
32
  };
28
33
 
29
34
  export { }
@@ -23,8 +23,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
23
23
  onFinish?: (result?: TResult) => void;
24
24
  /**
25
25
  * Callback invoked when a fatal module error occurs.
26
+ *
27
+ * @param error - Human-readable error message.
28
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
29
+ * the workflow and flow modules on QR validation failures —
30
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
26
31
  */
27
- onError?: (error: string | undefined) => void;
32
+ onError?: (error: string | undefined, errorCode?: number) => void;
28
33
  };
29
34
 
30
35
  export { }
@@ -23,8 +23,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
23
23
  onFinish?: (result?: TResult) => void;
24
24
  /**
25
25
  * Callback invoked when a fatal module error occurs.
26
+ *
27
+ * @param error - Human-readable error message.
28
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
29
+ * the workflow and flow modules on QR validation failures —
30
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
26
31
  */
27
- onError?: (error: string | undefined) => void;
32
+ onError?: (error: string | undefined, errorCode?: number) => void;
28
33
  };
29
34
 
30
35
  export { }
@@ -19,8 +19,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
19
19
  onFinish?: (result?: TResult) => void;
20
20
  /**
21
21
  * Callback invoked when a fatal module error occurs.
22
+ *
23
+ * @param error - Human-readable error message.
24
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
25
+ * the workflow and flow modules on QR validation failures —
26
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
22
27
  */
23
- onError?: (error: string | undefined) => void;
28
+ onError?: (error: string | undefined, errorCode?: number) => void;
24
29
  };
25
30
 
26
31
  /**
@@ -18,8 +18,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
18
18
  onFinish?: (result?: TResult) => void;
19
19
  /**
20
20
  * Callback invoked when a fatal module error occurs.
21
+ *
22
+ * @param error - Human-readable error message.
23
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
24
+ * the workflow and flow modules on QR validation failures —
25
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
21
26
  */
22
- onError?: (error: string | undefined) => void;
27
+ onError?: (error: string | undefined, errorCode?: number) => void;
23
28
  };
24
29
 
25
30
  export declare const QeSignature: FC<QeSignatureModuleProps>;
@@ -19,8 +19,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
19
19
  onFinish?: (result?: TResult) => void;
20
20
  /**
21
21
  * Callback invoked when a fatal module error occurs.
22
+ *
23
+ * @param error - Human-readable error message.
24
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
25
+ * the workflow and flow modules on QR validation failures —
26
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
22
27
  */
23
- onError?: (error: string | undefined) => void;
28
+ onError?: (error: string | undefined, errorCode?: number) => void;
24
29
  };
25
30
 
26
31
  export declare const Selfie: FC<SelfieProps>;
@@ -18,8 +18,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
18
18
  onFinish?: (result?: TResult) => void;
19
19
  /**
20
20
  * Callback invoked when a fatal module error occurs.
21
+ *
22
+ * @param error - Human-readable error message.
23
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
24
+ * the workflow and flow modules on QR validation failures —
25
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
21
26
  */
22
- onError?: (error: string | undefined) => void;
27
+ onError?: (error: string | undefined, errorCode?: number) => void;
23
28
  };
24
29
 
25
30
  export declare const Signature: FC<SignatureProps>;
@@ -18,8 +18,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
18
18
  onFinish?: (result?: TResult) => void;
19
19
  /**
20
20
  * Callback invoked when a fatal module error occurs.
21
+ *
22
+ * @param error - Human-readable error message.
23
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
24
+ * the workflow and flow modules on QR validation failures —
25
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
21
26
  */
22
- onError?: (error: string | undefined) => void;
27
+ onError?: (error: string | undefined, errorCode?: number) => void;
23
28
  };
24
29
 
25
30
  export declare const Watchlist: FC<WatchlistProps>;
@@ -20,8 +20,13 @@ declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
20
20
  onFinish?: (result?: TResult) => void;
21
21
  /**
22
22
  * Callback invoked when a fatal module error occurs.
23
+ *
24
+ * @param error - Human-readable error message.
25
+ * @param errorCode - Optional numeric code (e.g. HTTP status). Populated by
26
+ * the workflow and flow modules on QR validation failures —
27
+ * `4081` (`invalidQRuuid`) or `4083` (`onboardingUrlAlreadyUsed`).
23
28
  */
24
- onError?: (error: string | undefined) => void;
29
+ onError?: (error: string | undefined, errorCode?: number) => void;
25
30
  };
26
31
 
27
32
  export declare const IncodeWorkflow: FC<IncodeWorkflowProps>;
@@ -47,8 +52,17 @@ export declare type WorkflowComponentConfig = {
47
52
  isDesktop?: boolean;
48
53
  /** Authentication hint for AUTHENTICATION module. Required when workflow includes face authentication. */
49
54
  authHint?: string;
55
+ /**
56
+ * QR anti-phishing token from the incoming URL. When provided, the SDK burns
57
+ * it via `POST /omni/qr/validate` on mount and invokes `onUrlUuidRefreshed`
58
+ * with the rotated value so the host can update the address bar (e.g.,
59
+ * `history.replaceState`). Validation failures abort initialization via
60
+ * `onError`.
61
+ */
62
+ urlUuid?: string;
50
63
  onModuleLoading?: (moduleKey: string) => void;
51
64
  onModuleLoaded?: (moduleKey: string) => void;
65
+ onUrlUuidRefreshed?: (urlUuid: string) => void;
52
66
  };
53
67
 
54
68
  export { }
@@ -7,13 +7,14 @@ import { t as c } from "../transitionSpinner-DqDwaNM6.js";
7
7
  import { t as l } from "../incodeModule-CHzKl22Y.js";
8
8
  import { a as u, f as d, i as f, m as p, t as m } from "../useModuleLoader-D_nCByUY.js";
9
9
  import { resolveWasmConfig as h, warmupWasm as g } from "@incodetech/core/wasm";
10
- import { createWorkflowManager as _ } from "@incodetech/core/workflow";
10
+ import { QrValidationError as _, refreshQrUrlUuid as v } from "@incodetech/core/session";
11
+ import { createWorkflowManager as y } from "@incodetech/core/workflow";
11
12
  //#region src/modules/workflow/workflowInit.ts
12
- var v = {
13
+ var b = {
13
14
  ...u,
14
15
  REDIRECT_TO_MOBILE: () => import("../redirectToMobile-DgKIsArJ.js").then((e) => e.RedirectToMobile)
15
16
  };
16
- async function y() {
17
+ async function x() {
17
18
  try {
18
19
  let e = await p();
19
20
  return {
@@ -27,14 +28,14 @@ async function y() {
27
28
  return {};
28
29
  }
29
30
  }
30
- function b(e = {}) {
31
- return _({
31
+ function S(e = {}) {
32
+ return y({
32
33
  customModuleCallback: e.customModuleCallback,
33
34
  interviewId: e.interviewId,
34
35
  isDesktop: e.isDesktop
35
36
  });
36
37
  }
37
- function x(e) {
38
+ function C(e) {
38
39
  e !== !1 && g(h({
39
40
  ...e,
40
41
  pipelines: e?.pipelines ?? ["selfie", "idCapture"]
@@ -44,55 +45,65 @@ function x(e) {
44
45
  }
45
46
  //#endregion
46
47
  //#region src/modules/workflow/useWorkflowInitialization.ts
47
- function S(e) {
48
- let { token: i, lang: o, disableDashboardTheme: s, wasmConfig: c, customModuleCallback: l, interviewId: u, isDesktop: f, onError: p } = e, m = n(null), [h, g] = r(() => {
49
- let e = b({
48
+ function w(e) {
49
+ let { token: i, lang: o, disableDashboardTheme: s, wasmConfig: c, customModuleCallback: l, interviewId: u, isDesktop: f, urlUuid: p, onError: m, onUrlUuidRefreshed: h } = e, g = n(null), [y, b] = r(() => {
50
+ let e = S({
50
51
  customModuleCallback: l,
51
52
  interviewId: u,
52
53
  isDesktop: f
53
54
  });
54
- return m.current = e, {
55
+ return g.current = e, {
55
56
  status: "initializing",
56
57
  workflowManager: e
57
58
  };
58
- }), _ = n(!1);
59
+ }), w = n(!1);
59
60
  return t(() => {
60
- if (h.status !== "initializing" || _.current) return;
61
- _.current = !0;
62
- let e = m.current;
61
+ if (y.status !== "initializing" || w.current) return;
62
+ w.current = !0;
63
+ let e = g.current, t = new AbortController(), { signal: n } = t;
63
64
  return (async () => {
64
65
  try {
65
66
  await d({
66
67
  token: i,
67
68
  lang: o
68
- });
69
- let t = s ? Promise.resolve() : y().then((e) => {
69
+ }), p && await v({
70
+ urlUuid: p,
71
+ onboardingId: null,
72
+ onRefreshed: h
73
+ }, n);
74
+ let t = s ? Promise.resolve() : x().then((e) => {
70
75
  e.uiConfig && a(e.uiConfig);
71
76
  });
72
- x(c), e.load(), await t, g({
77
+ C(c), e.load(), await t, b({
73
78
  status: "ready",
74
79
  workflowManager: e
75
80
  });
76
81
  } catch (t) {
77
- let n = t instanceof Error ? t.message : "Failed to initialize SDK";
78
- g({
82
+ if (n.aborted) return;
83
+ let r = t instanceof Error ? t.message : "Failed to initialize SDK", i = t instanceof _ ? t.status : void 0;
84
+ b({
79
85
  status: "error",
80
- error: n,
86
+ error: r,
87
+ errorCode: i,
81
88
  workflowManager: e
82
- }), p?.(n);
89
+ }), m?.(r, i);
83
90
  }
84
- })(), () => e?.stop();
91
+ })(), () => {
92
+ t.abort(), e?.stop();
93
+ };
85
94
  }, [
86
95
  i,
87
96
  o,
88
97
  s,
89
98
  c,
90
- p
91
- ]), h;
99
+ p,
100
+ m,
101
+ h
102
+ ]), y;
92
103
  }
93
104
  //#endregion
94
105
  //#region src/modules/workflow/workflow.tsx
95
- function C(e) {
106
+ function T(e) {
96
107
  let { moduleKey: t, config: n, workflowId: r, authHint: i, lang: a, mergeSessionRecordings: o, ageAssurance: s } = e;
97
108
  switch (t) {
98
109
  case "AUTHENTICATION": return {
@@ -132,8 +143,8 @@ function C(e) {
132
143
  default: return n;
133
144
  }
134
145
  }
135
- var w = ({ config: r, onFinish: a, onError: s }) => {
136
- let { i18n: l } = e(), u = S({
146
+ var E = ({ config: r, onFinish: a, onError: s }) => {
147
+ let { i18n: l } = e(), u = w({
137
148
  token: r.token,
138
149
  lang: r.lang,
139
150
  disableDashboardTheme: r.disableDashboardTheme,
@@ -141,10 +152,12 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
141
152
  customModuleCallback: r.customModuleCallback,
142
153
  interviewId: r.interviewId,
143
154
  isDesktop: r.isDesktop,
144
- onError: s
155
+ urlUuid: r.urlUuid,
156
+ onError: s,
157
+ onUrlUuidRefreshed: r.onUrlUuidRefreshed
145
158
  }), [d, p] = o(() => u.workflowManager, { autoLoad: !1 }), h = m({
146
159
  moduleKey: d?.status === "ready" ? d.currentNode.moduleKey : void 0,
147
- modules: v,
160
+ modules: b,
148
161
  onModuleLoading: r.onModuleLoading,
149
162
  onModuleLoaded: r.onModuleLoaded,
150
163
  onError: s
@@ -160,7 +173,7 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
160
173
  a,
161
174
  d
162
175
  ]), t(() => {
163
- d?.status === "error" && s && s(d.error);
176
+ d?.status === "error" && s && s(d.error, d.errorCode);
164
177
  }, [
165
178
  d?.status,
166
179
  s,
@@ -169,7 +182,7 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
169
182
  let _ = () => /* @__PURE__ */ i("div", {
170
183
  class: "IncodeWorkflow",
171
184
  children: /* @__PURE__ */ i(c, { spinnerConfig: r.spinnerConfig })
172
- }), y = (e) => {
185
+ }), v = (e) => {
173
186
  p.errorModule(e ?? "Module error"), s?.(e ?? "Module error");
174
187
  };
175
188
  if (u.status === "error") return null;
@@ -183,11 +196,11 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
183
196
  })
184
197
  });
185
198
  if (h.status === "idle" || h.status === "loading" || h.status === "error") return _();
186
- let { Component: b } = h;
199
+ let { Component: y } = h;
187
200
  return /* @__PURE__ */ i("div", {
188
201
  class: "IncodeWorkflow",
189
- children: /* @__PURE__ */ i(b, {
190
- config: C({
202
+ children: /* @__PURE__ */ i(y, {
203
+ config: T({
191
204
  moduleKey: d.currentNode.moduleKey,
192
205
  config: d.config,
193
206
  workflowId: d.workflowConfig.id,
@@ -197,15 +210,15 @@ var w = ({ config: r, onFinish: a, onError: s }) => {
197
210
  ageAssurance: d.workflowConfig.ageAssurance
198
211
  }),
199
212
  onFinish: () => p.completeModule(),
200
- onError: y,
213
+ onError: v,
201
214
  ...d.currentNode.moduleKey === "REDIRECT_TO_MOBILE" ? { onContinue: () => p.completeModule() } : {}
202
215
  }, d.currentNode.id)
203
216
  });
204
- }, T = ({ config: e, onFinish: t, onError: n }) => /* @__PURE__ */ i(s, { children: e ? /* @__PURE__ */ i(w, {
217
+ }, D = ({ config: e, onFinish: t, onError: n }) => /* @__PURE__ */ i(s, { children: e ? /* @__PURE__ */ i(E, {
205
218
  config: e,
206
219
  onFinish: t,
207
220
  onError: n
208
221
  }) : null });
209
- l(T, "incode-workflow");
222
+ l(D, "incode-workflow");
210
223
  //#endregion
211
- export { T as IncodeWorkflow };
224
+ export { D as IncodeWorkflow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260428-98e9ebb",
3
+ "version": "0.0.0-dev-20260428-7b99b18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -230,7 +230,7 @@
230
230
  "qrcode": "^1.5.4",
231
231
  "signature_pad": "^5.1.3",
232
232
  "tailwindcss": "^4.1.17",
233
- "@incodetech/core": "0.0.0-dev-20260428-98e9ebb"
233
+ "@incodetech/core": "0.0.0-dev-20260428-7b99b18"
234
234
  },
235
235
  "devDependencies": {
236
236
  "@microsoft/api-extractor": "^7.53.3",
@@ -273,7 +273,7 @@
273
273
  "format": "prettier --write . --ignore-path ../../.prettierignore",
274
274
  "format:check": "prettier --check . --ignore-path ../../.prettierignore",
275
275
  "typecheck": "tsgo -p tsconfig.json --noEmit",
276
- "storybook": "storybook dev -p 6006",
277
- "build-storybook": "storybook build"
276
+ "storybook": "NODE_OPTIONS=--experimental-strip-types storybook dev -p 6006",
277
+ "build-storybook": "NODE_OPTIONS=--experimental-strip-types storybook build"
278
278
  }
279
279
  }