@incodetech/web 0.0.0-dev-20260417-d5a60c8 → 0.0.0-dev-20260418-89e0d60

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.
@@ -8,46 +8,56 @@ import { t as d } from "../incodeModule-D_r2n18O.js";
8
8
  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-CjYPWq6s.js";
9
9
  import { getDeviceClass as w } from "@incodetech/core/device";
10
10
  import { getRequiredWasmPipelines as T } from "@incodetech/core/flow";
11
- import { createSession as E } from "@incodetech/core/session";
11
+ import { createSession as E, validateQrUuid as D } from "@incodetech/core/session";
12
12
  //#region src/modules/flow/createFlowSession.ts
13
- function D(e) {
13
+ function O(e) {
14
14
  return Array.from(new Uint8Array(e), (e) => e.toString(16).padStart(2, "0")).join("");
15
15
  }
16
- async function O(e) {
16
+ async function k(e) {
17
17
  let t = globalThis.crypto?.subtle;
18
18
  if (!t) throw Error("SHA-1 is not available in this environment");
19
- return D(await t.digest("SHA-1", new TextEncoder().encode(e)));
19
+ return O(await t.digest("SHA-1", new TextEncoder().encode(e)));
20
20
  }
21
- async function k(e) {
21
+ async function A(e) {
22
22
  if (typeof e.apiKey == "string") return e.apiKey;
23
- if (typeof e.clientId == "string") return O(e.clientId);
23
+ if (typeof e.clientId == "string") return k(e.clientId);
24
24
  throw Error("Flow self-loading mode requires apiKey or clientId");
25
25
  }
26
- async function A(e, t) {
27
- return E(await k(e), {
26
+ async function j(e, t) {
27
+ if (typeof e.urlUuid != "string" || e.urlUuid.length === 0) return;
28
+ let n = await D({
29
+ onboardingId: e.uuid ?? null,
30
+ urlUuid: e.urlUuid
31
+ }, t);
32
+ return e.onUrlUuidRefreshed?.(n.urlUuid), n.urlUuid;
33
+ }
34
+ async function M(e, t) {
35
+ let n = await A(e), r = await j(e, t);
36
+ return E(n, {
28
37
  configurationId: e.configurationId,
29
38
  externalId: e.externalId,
30
39
  externalCustomerId: e.externalCustomerId,
31
40
  language: e.lang,
32
41
  customFields: e.customFields,
33
42
  uuid: e.uuid,
43
+ urlUuid: r,
34
44
  interviewId: e.interviewId
35
45
  }, t);
36
46
  }
37
47
  //#endregion
38
48
  //#region src/modules/flow/flowConfig.ts
39
- function j(e) {
49
+ function N(e) {
40
50
  return typeof e.token == "string";
41
51
  }
42
- function M(e) {
52
+ function P(e) {
43
53
  let t = e;
44
54
  return typeof t.configurationId == "string" && (typeof t.apiKey == "string" || typeof t.clientId == "string");
45
55
  }
46
56
  //#endregion
47
57
  //#region src/modules/flow/preloadFlow.ts
48
- var N = /* @__PURE__ */ new Map();
49
- function P(e) {
50
- let t = N.get(e);
58
+ var F = /* @__PURE__ */ new Map();
59
+ function I(e) {
60
+ let t = F.get(e);
51
61
  if (!t) throw Error("Preload state not found");
52
62
  return {
53
63
  get isReady() {
@@ -63,13 +73,13 @@ function P(e) {
63
73
  }
64
74
  },
65
75
  cancel() {
66
- t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), N.delete(e));
76
+ t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), F.delete(e));
67
77
  }
68
78
  };
69
79
  }
70
- function F(e) {
80
+ function L(e) {
71
81
  let { token: t } = e;
72
- if (N.has(t)) return P(t);
82
+ if (F.has(t)) return I(t);
73
83
  let n, r, i = new Promise((e, t) => {
74
84
  n = e, r = t;
75
85
  }), a = v(e);
@@ -82,7 +92,7 @@ function F(e) {
82
92
  readyResolve: n,
83
93
  readyReject: r
84
94
  };
85
- return N.set(t, o), (async () => {
95
+ return F.set(t, o), (async () => {
86
96
  try {
87
97
  await p({
88
98
  apiURL: e.apiURL,
@@ -100,37 +110,37 @@ function F(e) {
100
110
  } else t.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = t.error, o.readyReject(Error(t.error)));
101
111
  }), await t;
102
112
  } catch (e) {
103
- o.status = "error", o.error = e instanceof Error ? e.message : "Failed to preload", o.readyReject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to preload")), N.delete(t);
113
+ o.status = "error", o.error = e instanceof Error ? e.message : "Failed to preload", o.readyReject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to preload")), F.delete(t);
104
114
  }
105
- })(), P(t);
115
+ })(), I(t);
106
116
  }
107
- function I(e) {
108
- return N.get(e) ?? null;
117
+ function R(e) {
118
+ return F.get(e) ?? null;
109
119
  }
110
- function L(e) {
111
- let t = I(e);
112
- return t && N.delete(e), t;
120
+ function z(e) {
121
+ let t = R(e);
122
+ return t && F.delete(e), t;
113
123
  }
114
124
  //#endregion
115
125
  //#region src/modules/flow/useFlowInitialization.ts
116
- function R(e) {
126
+ function B(e) {
117
127
  e.getState().presentation.shouldPrefetchHome && C();
118
128
  }
119
- function z() {
129
+ function V() {
120
130
  w() === "desktop" && m();
121
131
  }
122
- function B(e) {
123
- let { apiURL: n, lang: i, disableDashboardTheme: o, enableHome: c, onError: l } = e, u = j(e) ? e.token : void 0, d = r(null), [f, m] = a(() => {
124
- let t = u ? I(u) : null;
132
+ function H(e) {
133
+ let { apiURL: n, lang: i, disableDashboardTheme: o, enableHome: c, onError: l } = e, u = N(e) ? e.token : void 0, d = r(null), [f, m] = a(() => {
134
+ let t = u ? R(u) : null;
125
135
  if (u && t?.status === "ready") {
126
- let e = L(u);
127
- if (e) return d.current = e.flowManager, R(e.flowManager), z(), e.uiConfig && s(e.uiConfig), {
136
+ let e = z(u);
137
+ if (e) return d.current = e.flowManager, B(e.flowManager), V(), e.uiConfig && s(e.uiConfig), {
128
138
  status: "ready",
129
139
  flowManager: e.flowManager
130
140
  };
131
141
  }
132
142
  let n = v(e);
133
- return d.current = n, R(n), z(), t?.status === "error" ? {
143
+ return d.current = n, B(n), V(), t?.status === "error" ? {
134
144
  status: "error",
135
145
  error: t.error ?? "Preload failed",
136
146
  flowManager: n
@@ -141,11 +151,11 @@ function B(e) {
141
151
  }), h = r(!1);
142
152
  return t(() => {
143
153
  if (f.status !== "initializing") return;
144
- let t = u ? I(u) : null;
154
+ let t = u ? R(u) : null;
145
155
  if (u && t?.status === "loading") {
146
156
  t.readyPromise.then(() => {
147
- let e = L(u);
148
- e && (d.current = e.flowManager, R(e.flowManager), z(), e.uiConfig && s(e.uiConfig), m({
157
+ let e = z(u);
158
+ e && (d.current = e.flowManager, B(e.flowManager), V(), e.uiConfig && s(e.uiConfig), m({
149
159
  status: "ready",
150
160
  flowManager: e.flowManager
151
161
  }));
@@ -162,8 +172,8 @@ function B(e) {
162
172
  h.current || (h.current = !0, (async () => {
163
173
  try {
164
174
  let t;
165
- if (j(e)) t = e.token;
166
- else if (M(e)) t = (await A(e)).token;
175
+ if (N(e)) t = e.token;
176
+ else if (P(e)) t = (await M(e)).token;
167
177
  else throw Error("Flow requires token, or configurationId with apiKey or clientId");
168
178
  await p({
169
179
  apiURL: n,
@@ -198,8 +208,8 @@ function B(e) {
198
208
  }
199
209
  //#endregion
200
210
  //#region src/modules/flow/flow.tsx
201
- var V = n(() => import("../homeScreen-DISgp8BK.js").then((e) => ({ default: e.HomeScreen }))), H = ({ config: n, onFinish: r, onError: a }) => {
202
- let { t: s, i18n: l } = e(), d = B({
211
+ var U = n(() => import("../homeScreen-DISgp8BK.js").then((e) => ({ default: e.HomeScreen }))), W = ({ config: n, onFinish: r, onError: a }) => {
212
+ let { t: s, i18n: l } = e(), d = H({
203
213
  ...n,
204
214
  onError: a
205
215
  }), [p, m] = c(() => d.flowManager, { autoLoad: !1 }), g = p.presentation.lazyModuleKey, v = p.status === "ready" ? p.currentStep : void 0, x = S({
@@ -244,7 +254,7 @@ var V = n(() => import("../homeScreen-DISgp8BK.js").then((e) => ({ default: e.Ho
244
254
  class: "IncodeFlow",
245
255
  children: /* @__PURE__ */ o(i, {
246
256
  fallback: null,
247
- children: /* @__PURE__ */ o(V, {
257
+ children: /* @__PURE__ */ o(U, {
248
258
  isContinueLoading: p.homeScreen.isContinueLoading || D,
249
259
  onContinue: () => m.continueFromHome()
250
260
  })
@@ -533,11 +543,11 @@ var V = n(() => import("../homeScreen-DISgp8BK.js").then((e) => ({ default: e.Ho
533
543
  });
534
544
  }
535
545
  return null;
536
- }, U = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ o(l, { children: e ? /* @__PURE__ */ o(H, {
546
+ }, G = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ o(l, { children: e ? /* @__PURE__ */ o(W, {
537
547
  config: e,
538
548
  onFinish: t,
539
549
  onError: n
540
550
  }) : null });
541
- d(U, "incode-flow");
551
+ d(G, "incode-flow");
542
552
  //#endregion
543
- export { U as IncodeFlow, F as preloadIncodeFlow };
553
+ export { G as IncodeFlow, L as preloadIncodeFlow };
@@ -30,6 +30,7 @@ declare type FlowUiConfig = {
30
30
  onModuleLoading?: (moduleKey: string) => void;
31
31
  onModuleLoaded?: (moduleKey: string) => void;
32
32
  onWasmWarmup?: (pipelines: string[]) => void;
33
+ onUrlUuidRefreshed?: (urlUuid: string) => void;
33
34
  spinnerConfig?: SpinnerConfig;
34
35
  };
35
36
 
@@ -73,7 +74,7 @@ declare type SelfLoadingFlowRuntimeConfig = FlowBaseConfig & SelfLoadingSessionO
73
74
  token?: never;
74
75
  };
75
76
 
76
- declare type SelfLoadingSessionOptions = Pick<CreateSessionOptions, 'configurationId' | 'externalId' | 'externalCustomerId' | 'customFields' | 'uuid' | 'interviewId'>;
77
+ declare type SelfLoadingSessionOptions = Pick<CreateSessionOptions, 'configurationId' | 'externalId' | 'externalCustomerId' | 'customFields' | 'uuid' | 'urlUuid' | 'interviewId'>;
77
78
 
78
79
  declare type SpinnerConfig = {
79
80
  title?: string;
@@ -92,6 +93,7 @@ declare type TokenFlowRuntimeConfig = FlowBaseConfig & {
92
93
  externalCustomerId?: never;
93
94
  customFields?: never;
94
95
  uuid?: never;
96
+ urlUuid?: never;
95
97
  interviewId?: never;
96
98
  };
97
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260417-d5a60c8",
3
+ "version": "0.0.0-dev-20260418-89e0d60",
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-20260417-d5a60c8"
186
+ "@incodetech/core": "0.0.0-dev-20260418-89e0d60"
187
187
  },
188
188
  "devDependencies": {
189
189
  "@microsoft/api-extractor": "^7.53.3",