@incodetech/core 0.0.0-dev-20260403-eccc51c → 0.0.0-dev-20260407-4677d7f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/{BaseWasmProvider--AzPfwOm.esm.js → BaseWasmProvider-CQgeReKV.esm.js} +1 -785
  2. package/dist/MotionSensorProvider-BTDLt08l.esm.js +254 -0
  3. package/dist/StateMachine-8d441d6x.d.ts +2 -0
  4. package/dist/{WasmUtilProvider-BonqBWdj.esm.js → WasmUtilProvider-C45HStLj.esm.js} +1 -1
  5. package/dist/{addressSearch-DC5By0cC.esm.js → addressSearch-C5qzDvkN.esm.js} +15 -8
  6. package/dist/antifraud.d.ts +1 -1
  7. package/dist/antifraud.esm.js +3 -3
  8. package/dist/authentication.d.ts +11 -9
  9. package/dist/authentication.esm.js +18 -13
  10. package/dist/{authenticationManager-B4gSCgrO.esm.js → authenticationManager-CW4qxgcq.esm.js} +7 -6
  11. package/dist/{authenticationManager-Bd10YGSO.d.ts → authenticationManager-CiXsOTdM.d.ts} +2 -2
  12. package/dist/{backCameraStream-DF_d7hTz.esm.js → backCameraStream-CUo1USCT.esm.js} +2 -2
  13. package/dist/camera.d.ts +16 -0
  14. package/dist/camera.esm.js +5 -0
  15. package/dist/consent.d.ts +52 -52
  16. package/dist/consent.esm.js +3 -3
  17. package/dist/curp-validation.d.ts +5 -5
  18. package/dist/curp-validation.esm.js +3 -3
  19. package/dist/{deepsightLoader-DKgEdLIS.esm.js → deepsightLoader-Bs5jHgca.esm.js} +10 -7
  20. package/dist/deepsightService-C3gQ_9Ml.esm.js +493 -0
  21. package/dist/{deepsightService-Ciu0atv5.d.ts → deepsightService-CMAtxAC9.d.ts} +193 -197
  22. package/dist/device.d.ts +46 -0
  23. package/dist/device.esm.js +106 -0
  24. package/dist/document-capture.d.ts +78 -78
  25. package/dist/document-capture.esm.js +6 -6
  26. package/dist/document-upload.d.ts +53 -53
  27. package/dist/document-upload.esm.js +6 -6
  28. package/dist/ekyb.d.ts +3 -3
  29. package/dist/ekyb.esm.js +11 -10
  30. package/dist/ekyc.d.ts +3 -3
  31. package/dist/ekyc.esm.js +104 -22
  32. package/dist/email.d.ts +3 -3
  33. package/dist/email.esm.js +5 -5
  34. package/dist/{emailManager-CpAwvP3v.esm.js → emailManager-CZ2IGW0g.esm.js} +4 -4
  35. package/dist/{emailManager-BQPIJR_O.d.ts → emailManager-DEIxY7l6.d.ts} +2 -2
  36. package/dist/events-BlVGS-8F.esm.js +472 -0
  37. package/dist/events.d.ts +232 -0
  38. package/dist/events.esm.js +4 -0
  39. package/dist/extensibility.d.ts +15 -13
  40. package/dist/extensibility.esm.js +25 -20
  41. package/dist/face-match.d.ts +1 -1
  42. package/dist/face-match.esm.js +3 -3
  43. package/dist/{faceCaptureManagerFactory-CdwpYykv.d.ts → faceCaptureManagerFactory-CWj-nXdx.d.ts} +8 -6
  44. package/dist/{faceCaptureSetup-DbXgtcp7.esm.js → faceCaptureSetup-DIE5cftl.esm.js} +13 -10
  45. package/dist/flow.d.ts +7 -6
  46. package/dist/flow.esm.js +8 -8
  47. package/dist/{flowCompletionService-TnWijsSw.esm.js → flowCompletionService-N6-xypy-.esm.js} +2 -2
  48. package/dist/{flowServices-CO2sIR3D.esm.js → flowServices-xgqnJ64L.esm.js} +3 -3
  49. package/dist/geolocation.d.ts +2 -2
  50. package/dist/geolocation.esm.js +4 -4
  51. package/dist/getBrowser-B800KRAi.esm.js +41 -0
  52. package/dist/getDeviceClass-BKd2FOAf.esm.js +14 -0
  53. package/dist/government-validation.d.ts +2 -2
  54. package/dist/government-validation.esm.js +4 -4
  55. package/dist/http.d.ts +57 -0
  56. package/dist/http.esm.js +3 -0
  57. package/dist/id.d.ts +11 -10
  58. package/dist/id.esm.js +19 -15
  59. package/dist/{idCaptureManager-IdqsAASp.d.ts → idCaptureManager-H-rkXnbK.d.ts} +7 -6
  60. package/dist/{idCaptureManager-DaLU1ug7.esm.js → idCaptureManager-SHBRQ-X_.esm.js} +15 -11
  61. package/dist/index.d.ts +3 -611
  62. package/dist/index.esm.js +10 -562
  63. package/dist/{lib-i-4qLKdG.esm.js → lib-Cq5Wc-Hd.esm.js} +1 -1
  64. package/dist/mandatory-consent.d.ts +58 -58
  65. package/dist/mandatory-consent.esm.js +3 -3
  66. package/dist/permissionServices-CDqkkway.esm.js +50 -0
  67. package/dist/phone.d.ts +3 -3
  68. package/dist/phone.esm.js +5 -5
  69. package/dist/{phoneManager-DA8WUJtl.d.ts → phoneManager-Clfbrs6b.d.ts} +2 -2
  70. package/dist/{phoneManager-BAPHSXx8.esm.js → phoneManager-CscgaER2.esm.js} +4 -4
  71. package/dist/{StreamCanvasCapture-DkpkIgyL.esm.js → recordingsRepository-blYn-iKZ.esm.js} +157 -215
  72. package/dist/redirect-to-mobile.d.ts +2 -2
  73. package/dist/redirect-to-mobile.esm.js +4 -4
  74. package/dist/selfie.d.ts +11 -9
  75. package/dist/selfie.esm.js +18 -13
  76. package/dist/{selfieManager-BSkzncsa.esm.js → selfieManager-DeGqD5aN.esm.js} +5 -4
  77. package/dist/{selfieManager-Dft5wZQ_.d.ts → selfieManager-h_hhEefT.d.ts} +2 -2
  78. package/dist/{session-OglUYC9l.esm.js → session-PLjFj_T3.esm.js} +5 -19
  79. package/dist/session.d.ts +46 -2
  80. package/dist/session.esm.js +7 -4
  81. package/dist/setup-DJ3dFl5k.d.ts +120 -0
  82. package/dist/setup-fvDWE7f8.esm.js +450 -0
  83. package/dist/signature.d.ts +2 -2
  84. package/dist/signature.esm.js +3 -3
  85. package/dist/{stats-BVigf5Rn.esm.js → stats-BZ1kFW4p.esm.js} +1 -1
  86. package/dist/stats.esm.js +2 -2
  87. package/dist/{types-CiLyvJGb.d.ts → types-T0VjZW3T.d.ts} +1 -1
  88. package/dist/types-qhLxpptI.d.ts +5 -0
  89. package/dist/{types-D8Y1faI5.d.ts → types-zH5PDmSe.d.ts} +1 -1
  90. package/dist/{StateMachine-CM_aOfNL.d.ts → warmup-CEOVQKby.d.ts} +1 -4
  91. package/dist/wasm.d.ts +15 -0
  92. package/dist/wasm.esm.js +10 -0
  93. package/dist/{Manager-C6AGXEq_.esm.js → xstate.esm-BXrcOcSC.esm.js} +103 -507
  94. package/package.json +18 -2
  95. package/dist/endpoints-CI5-28jT.esm.js +0 -69
  96. package/dist/id-CzDAG_kM.esm.js +0 -0
  97. package/dist/index-BuVKc9bv.d.ts +0 -1
  98. /package/dist/{Actor-By8WNHi-.d.ts → Actor-C-jivmFF.d.ts} +0 -0
  99. /package/dist/{BrowserEnvironmentProvider-BECjyw3_.esm.js → BrowserEnvironmentProvider--xQUs3sg.esm.js} +0 -0
  100. /package/dist/{BrowserTimerProvider-CIqH6hJp.esm.js → BrowserTimerProvider-CkHEwJFa.esm.js} +0 -0
  101. /package/dist/{Manager-CCT_-HuZ.d.ts → Manager-BqFybBV-.d.ts} +0 -0
  102. /package/dist/{api-C2uzxrpN.esm.js → api-CyI8qTie.esm.js} +0 -0
  103. /package/dist/{browserSimulation-DYAk0Ipe.esm.js → browserSimulation-yzDdWSBf.esm.js} +0 -0
  104. /package/dist/{camera-6XJdOeBF.d.ts → camera-CKsQVNlH.d.ts} +0 -0
  105. /package/dist/{camera-DAuRUvnp.esm.js → camera-CsT06Zqy.esm.js} +0 -0
  106. /package/dist/{chunk-D6hkk-hd.esm.js → chunk-BcQWkoAq.esm.js} +0 -0
  107. /package/dist/{displayErrors-CGJwvrTl.d.ts → displayErrors-CjMXlBnu.d.ts} +0 -0
  108. /package/dist/{flowCompletionService-BOd4Rk8n.d.ts → flowCompletionService-BV6ThEJ1.d.ts} +0 -0
  109. /package/dist/{platform-DdhkonXk.esm.js → platform-Dcuv6w60.esm.js} +0 -0
package/dist/index.esm.js CHANGED
@@ -1,562 +1,10 @@
1
- import { i as isIPad } from "./platform-DdhkonXk.esm.js";
2
- import { c as warmupWasm, s as getUserAgent } from "./BaseWasmProvider--AzPfwOm.esm.js";
3
- import { c as requestPermission, p as getDeviceClass, s as checkPermission } from "./StreamCanvasCapture-DkpkIgyL.esm.js";
4
- import "./browserSimulation-DYAk0Ipe.esm.js";
5
- import { a as resetApi, n as getApi, o as setClient, s as setToken, t as api } from "./api-C2uzxrpN.esm.js";
6
- import { _ as subscribeEvent, a as tutorialScreenNamesMapper, c as captureAttemptFinished, d as moduleOpened, f as screenClosed, g as flushEventQueue, h as addEvent, i as eventScreenNames, l as elementClicked, m as screenOpened, n as cameraScreenNamesMapper, o as videoSelfieEvents, p as screenEvent, r as eventModuleNames, u as moduleClosed } from "./Manager-C6AGXEq_.esm.js";
7
- import "./endpoints-CI5-28jT.esm.js";
8
- import { a as isSessionInitialized, i as initializeSession, n as getSessionFeatures, o as resetSessionInit, t as getDisableIpify, u as createSession } from "./session-OglUYC9l.esm.js";
9
- import "./BrowserEnvironmentProvider-BECjyw3_.esm.js";
10
- import { a as initializeIdCapture, c as stopRecording, d as validateUploadResponse, f as ID_ERROR_CODES, i as idCaptureMachine, l as stopStream, o as processId, r as createIdCaptureActor, s as startRecordingSession, t as createIdCaptureManager, u as uploadIdImage } from "./idCaptureManager-DaLU1ug7.esm.js";
11
- import "./BrowserTimerProvider-CIqH6hJp.esm.js";
12
- import "./camera-DAuRUvnp.esm.js";
13
- import "./stats-BVigf5Rn.esm.js";
14
- import "./backCameraStream-DF_d7hTz.esm.js";
15
- import "./id-CzDAG_kM.esm.js";
16
- import { t as WasmUtilProvider } from "./WasmUtilProvider-BonqBWdj.esm.js";
17
-
18
- //#region ../infra/src/wasm/wasmDefaults.ts
19
- const WASM_CDN_BASE_URL = "https://cdn.incodesmile.com/ml-wasm-kit-release";
20
- /** The WASM version bundled and tested with this SDK release. */
21
- const DEFAULT_WASM_VERSION = "v2.12.84";
22
- const PATH_KEYS = [
23
- "wasmPath",
24
- "wasmSimdPath",
25
- "glueCodePath",
26
- "modelsBasePath"
27
- ];
28
- function isBlank(value) {
29
- return value.trim() === "";
30
- }
31
- function hasDisallowedControlChars(value) {
32
- for (let i = 0; i < value.length; i += 1) {
33
- const code = value.charCodeAt(i);
34
- if (code < 32 || code === 127) return true;
35
- }
36
- return false;
37
- }
38
- function isMalformedPath(value) {
39
- const trimmed = value.trim();
40
- if (trimmed === "") return false;
41
- if (hasDisallowedControlChars(trimmed)) return true;
42
- if (/^https?:\/\//i.test(trimmed)) try {
43
- new URL(trimmed);
44
- return false;
45
- } catch {
46
- return true;
47
- }
48
- return false;
49
- }
50
- function warnInvalidWasmPath(field, reason) {
51
- if (reason === "empty") {
52
- console.warn(`[Incode SDK] wasm.${field} is empty. Falling back to CDN default.`);
53
- return;
54
- }
55
- console.warn(`[Incode SDK] wasm.${field} appears malformed. Falling back to CDN default.`);
56
- }
57
- function warnMalformedWasmPath(field) {
58
- console.warn(`[Incode SDK] wasm.${field} appears malformed. Check the URL or path.`);
59
- }
60
- /**
61
- * Validates merged WASM path strings. When overrides contained blank path
62
- * values, callers should have already fallen back to defaults before this runs.
63
- */
64
- function validateWasmPaths(config) {
65
- for (const key of PATH_KEYS) {
66
- const value = config[key];
67
- if (typeof value === "string" && isMalformedPath(value)) warnMalformedWasmPath(key);
68
- }
69
- }
70
- function pickPath(key, overrides, defaultValue) {
71
- if (!overrides || !(key in overrides)) return defaultValue;
72
- const raw = overrides[key];
73
- if (raw === void 0) return defaultValue;
74
- if (typeof raw !== "string") return defaultValue;
75
- if (isBlank(raw)) {
76
- warnInvalidWasmPath(key, "empty");
77
- return defaultValue;
78
- }
79
- if (isMalformedPath(raw)) {
80
- warnInvalidWasmPath(key, "malformed");
81
- return defaultValue;
82
- }
83
- return raw.trim();
84
- }
85
- /** Builds the standard WarmupConfig from the Incode CDN. */
86
- function buildDefaultWasmConfig() {
87
- const base = `${WASM_CDN_BASE_URL}/${DEFAULT_WASM_VERSION}`;
88
- return {
89
- wasmPath: `${base}/webLib.wasm`,
90
- wasmSimdPath: `${base}/webLibSimd.wasm`,
91
- glueCodePath: `${base}/webLib.js`,
92
- modelsBasePath: `${base}/models`
93
- };
94
- }
95
- /**
96
- * Merges optional WASM path overrides with CDN defaults. Explicit non-blank
97
- * paths take precedence. Blank override strings log a warning and fall back to defaults.
98
- */
99
- function resolveWasmConfig(overrides) {
100
- const defaults = buildDefaultWasmConfig();
101
- if (!overrides) return defaults;
102
- const simdDefault = defaults.wasmSimdPath ?? defaults.wasmPath;
103
- const modelsDefault = defaults.modelsBasePath ?? (() => {
104
- const lastSlash = defaults.wasmPath.lastIndexOf("/");
105
- return lastSlash === -1 ? "models" : `${defaults.wasmPath.substring(0, lastSlash)}/models`;
106
- })();
107
- const merged = {
108
- wasmPath: pickPath("wasmPath", overrides, defaults.wasmPath),
109
- wasmSimdPath: pickPath("wasmSimdPath", overrides, simdDefault),
110
- glueCodePath: pickPath("glueCodePath", overrides, defaults.glueCodePath),
111
- modelsBasePath: pickPath("modelsBasePath", overrides, modelsDefault),
112
- useSimd: overrides.useSimd,
113
- pipelines: overrides.pipelines,
114
- pipelineModels: overrides.pipelineModels
115
- };
116
- validateWasmPaths(merged);
117
- return merged;
118
- }
119
-
120
- //#endregion
121
- //#region ../infra/src/http/createApi.ts
122
- var FetchHttpError = class extends Error {
123
- constructor(status, statusText, url, method, headers, data) {
124
- super(`HTTP ${status} ${statusText}`);
125
- this.ok = false;
126
- this.status = status;
127
- this.statusText = statusText;
128
- this.url = url;
129
- this.method = method;
130
- this.headers = headers;
131
- this.data = data;
132
- this.name = "FetchHttpError";
133
- }
134
- };
135
- const buildQueryString = (query) => {
136
- if (!query) return "";
137
- const params = new URLSearchParams();
138
- Object.entries(query).forEach(([key, value]) => {
139
- if (value !== void 0 && value !== null) params.append(key, String(value));
140
- });
141
- const str = params.toString();
142
- return str ? `?${str}` : "";
143
- };
144
- const buildUrl = (baseURL, url, query) => {
145
- const queryString = buildQueryString(query);
146
- if (url.startsWith("http://") || url.startsWith("https://")) return `${url}${queryString}`;
147
- return `${baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL}${url.startsWith("/") ? url : `/${url}`}${queryString}`;
148
- };
149
- const prepareBody = (body) => {
150
- if (body === null || body === void 0) return null;
151
- if (body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer) return body;
152
- if (typeof body === "object") return JSON.stringify(body);
153
- return String(body);
154
- };
155
- const parseResponse = async (response, parseType) => {
156
- if (parseType === "response") return response;
157
- if (parseType === "blob") return await response.blob();
158
- if (parseType === "arrayBuffer") return await response.arrayBuffer();
159
- if (parseType === "text") return await response.text();
160
- const contentType = response.headers.get("content-type") ?? "";
161
- if (parseType === "json" || contentType.includes("application/json")) try {
162
- return await response.json();
163
- } catch {
164
- return await response.text();
165
- }
166
- return await response.text();
167
- };
168
- const DEFAULT_TIMEOUT = 3e4;
169
- const requestWithXHR = (fullUrl, method, mergedHeaders, requestBody, timeout, signal, onUploadProgress) => {
170
- return new Promise((resolve, reject) => {
171
- const xhr = new XMLHttpRequest();
172
- xhr.open(method, fullUrl, true);
173
- Object.entries(mergedHeaders).forEach(([key, value]) => {
174
- xhr.setRequestHeader(key, value);
175
- });
176
- xhr.timeout = timeout;
177
- xhr.upload.onprogress = (event) => {
178
- if (event.lengthComputable) {
179
- const percentComplete = event.loaded / event.total * 100;
180
- onUploadProgress(Math.round(percentComplete));
181
- }
182
- };
183
- xhr.onload = () => {
184
- const responseHeaders = {};
185
- xhr.getAllResponseHeaders().split("\r\n").forEach((line) => {
186
- const parts = line.split(": ");
187
- if (parts.length === 2) responseHeaders[parts[0].toLowerCase()] = parts[1];
188
- });
189
- let data;
190
- try {
191
- if ((xhr.getResponseHeader("content-type") ?? "").includes("application/json")) data = JSON.parse(xhr.responseText);
192
- else data = xhr.responseText;
193
- } catch {
194
- data = xhr.responseText;
195
- }
196
- if (xhr.status >= 200 && xhr.status < 300) resolve({
197
- ok: true,
198
- status: xhr.status,
199
- statusText: xhr.statusText,
200
- url: fullUrl,
201
- headers: responseHeaders,
202
- data
203
- });
204
- else reject(new FetchHttpError(xhr.status, xhr.statusText, fullUrl, method, responseHeaders, data));
205
- };
206
- xhr.onerror = () => {
207
- reject(new FetchHttpError(0, "Network Error", fullUrl, method, {}, null));
208
- };
209
- xhr.ontimeout = () => {
210
- reject(new FetchHttpError(0, "Request timeout", fullUrl, method, {}, null));
211
- };
212
- if (signal) signal.addEventListener("abort", () => {
213
- xhr.abort();
214
- reject(new FetchHttpError(0, "Request aborted", fullUrl, method, {}, null));
215
- });
216
- xhr.send(requestBody);
217
- });
218
- };
219
- const createApi = (config) => {
220
- const headers = {
221
- "Content-Type": "application/json",
222
- Accept: "application/json",
223
- "api-version": "1.0",
224
- ...config.customHeaders ?? {}
225
- };
226
- const defaults = {
227
- baseURL: config.apiURL,
228
- headers
229
- };
230
- const client = {
231
- defaults,
232
- async request(requestConfig) {
233
- const { method = "GET", url, headers: headers$1 = {}, query, params, body, signal, timeout = config.timeout ?? DEFAULT_TIMEOUT, parse, onUploadProgress } = requestConfig;
234
- const fullUrl = buildUrl(defaults.baseURL, url, params ?? query);
235
- const mergedHeaders = {
236
- ...defaults.headers,
237
- ...headers$1
238
- };
239
- const requestBody = prepareBody(body);
240
- let finalHeaders = mergedHeaders;
241
- if (requestBody === null && (method === "POST" || method === "PUT" || method === "PATCH")) {
242
- const { "Content-Type": _, ...headersWithoutContentType } = mergedHeaders;
243
- finalHeaders = headersWithoutContentType;
244
- }
245
- if (onUploadProgress) {
246
- if (requestBody !== null && typeof ReadableStream !== "undefined" && requestBody instanceof ReadableStream) throw new Error("Upload progress tracking is not supported for ReadableStream bodies");
247
- return requestWithXHR(fullUrl, method, finalHeaders, requestBody, timeout, signal, onUploadProgress);
248
- }
249
- const controller = new AbortController();
250
- const abortSignal = signal ?? controller.signal;
251
- const timeoutId = setTimeout(() => controller.abort(), timeout);
252
- try {
253
- const response = await fetch(fullUrl, {
254
- method,
255
- headers: finalHeaders,
256
- body: requestBody,
257
- signal: abortSignal
258
- });
259
- if (timeoutId) clearTimeout(timeoutId);
260
- const responseHeaders = {};
261
- response.headers.forEach((value, key) => {
262
- responseHeaders[key] = value;
263
- });
264
- const data = await parseResponse(response, parse);
265
- if (!response.ok) throw new FetchHttpError(response.status, response.statusText, fullUrl, method, responseHeaders, data);
266
- return {
267
- ok: true,
268
- status: response.status,
269
- statusText: response.statusText,
270
- url: fullUrl,
271
- headers: responseHeaders,
272
- data
273
- };
274
- } catch (error) {
275
- if (timeoutId) clearTimeout(timeoutId);
276
- if (error instanceof FetchHttpError) throw error;
277
- if (error instanceof Error && error.name === "AbortError") throw new FetchHttpError(0, "Request timeout", fullUrl, method, {}, null);
278
- throw error;
279
- }
280
- },
281
- get(url, config$1) {
282
- return client.request({
283
- ...config$1,
284
- url,
285
- method: "GET"
286
- });
287
- },
288
- post(url, body, config$1) {
289
- return client.request({
290
- ...config$1,
291
- url,
292
- body,
293
- method: "POST"
294
- });
295
- },
296
- put(url, body, config$1) {
297
- return client.request({
298
- ...config$1,
299
- url,
300
- body,
301
- method: "PUT"
302
- });
303
- },
304
- patch(url, body, config$1) {
305
- return client.request({
306
- ...config$1,
307
- url,
308
- body,
309
- method: "PATCH"
310
- });
311
- },
312
- delete(url, config$1) {
313
- return client.request({
314
- ...config$1,
315
- url,
316
- method: "DELETE"
317
- });
318
- },
319
- head(url, config$1) {
320
- return client.request({
321
- ...config$1,
322
- url,
323
- method: "HEAD"
324
- });
325
- },
326
- options(url, config$1) {
327
- return client.request({
328
- ...config$1,
329
- url,
330
- method: "OPTIONS"
331
- });
332
- },
333
- setHeader(name, value) {
334
- defaults.headers[name] = value;
335
- }
336
- };
337
- return client;
338
- };
339
- var createApi_default = createApi;
340
-
341
- //#endregion
342
- //#region ../infra/src/providers/browser/ScreenOrientationProvider.ts
343
- function isPortrait() {
344
- if (typeof window === "undefined" || typeof screen === "undefined") return true;
345
- if (typeof window.matchMedia === "function") return !window.matchMedia("(orientation: landscape)").matches;
346
- if (screen.orientation?.type?.includes("portrait")) return true;
347
- if (screen.orientation?.type?.includes("landscape")) return false;
348
- const orientation = window.orientation;
349
- if (typeof orientation === "number") return Math.abs(orientation) === 0;
350
- return window.innerHeight >= window.innerWidth;
351
- }
352
- function toState(portrait) {
353
- return portrait ? "portrait" : "landscape";
354
- }
355
- var ScreenOrientationProvider = class {
356
- constructor() {
357
- this._current = toState(isPortrait());
358
- this.subscribers = /* @__PURE__ */ new Set();
359
- this.orientationChangeHandler = this.handleOrientationChange.bind(this);
360
- this.resizeHandler = this.handleResize.bind(this);
361
- this.mediaQueryList = null;
362
- this.mediaQueryHandler = this.handleResize.bind(this);
363
- if (typeof window === "undefined") return;
364
- if (screen.orientation) screen.orientation.addEventListener("change", this.orientationChangeHandler);
365
- else window.addEventListener("orientationchange", this.orientationChangeHandler);
366
- window.addEventListener("resize", this.resizeHandler);
367
- if (typeof window.matchMedia === "function") {
368
- this.mediaQueryList = window.matchMedia("(orientation: landscape)");
369
- this.mediaQueryList.addEventListener("change", this.mediaQueryHandler);
370
- }
371
- }
372
- get current() {
373
- return this._current;
374
- }
375
- subscribe(callback) {
376
- this.subscribers.add(callback);
377
- callback(this._current);
378
- return () => {
379
- this.subscribers.delete(callback);
380
- };
381
- }
382
- cleanup() {
383
- if (typeof window === "undefined") return;
384
- if (screen.orientation) screen.orientation.removeEventListener("change", this.orientationChangeHandler);
385
- else window.removeEventListener("orientationchange", this.orientationChangeHandler);
386
- window.removeEventListener("resize", this.resizeHandler);
387
- this.mediaQueryList?.removeEventListener("change", this.mediaQueryHandler);
388
- this.mediaQueryList = null;
389
- this.subscribers.clear();
390
- }
391
- handleOrientationChange() {
392
- setTimeout(() => {
393
- this.updateState();
394
- if (document.activeElement instanceof HTMLElement) document.activeElement.blur();
395
- window.focus();
396
- }, 0);
397
- }
398
- handleResize() {
399
- this.updateState();
400
- }
401
- updateState() {
402
- const next = toState(isPortrait());
403
- if (next !== this._current) {
404
- this._current = next;
405
- for (const cb of this.subscribers) cb(this._current);
406
- }
407
- }
408
- };
409
-
410
- //#endregion
411
- //#region src/internal/device/getBrowser.ts
412
- function getBrowser() {
413
- const userAgent = getUserAgent();
414
- if (!userAgent) return "other";
415
- const ua = userAgent.toLowerCase();
416
- if (ua.includes("edg/") || ua.includes("edgios/")) return "edge";
417
- if (ua.includes("samsungbrowser/")) return "samsung_browser";
418
- if (ua.includes("opr/") || ua.includes("opera") || ua.includes("opios/") || ua.includes("opt/")) return "opera";
419
- if (ua.includes("chrome") || ua.includes("crios")) return "chrome";
420
- if (ua.includes("firefox") || ua.includes("fxios")) return "firefox";
421
- if (ua.includes("safari")) return "safari";
422
- return "other";
423
- }
424
-
425
- //#endregion
426
- //#region src/internal/device/screenOrientation.ts
427
- function createScreenOrientationObserver(provider, deviceClass) {
428
- const getIsLandscapeMobile = () => deviceClass !== "desktop" && !isIPad() && provider.current === "landscape";
429
- return {
430
- get isLandscapeMobile() {
431
- return getIsLandscapeMobile();
432
- },
433
- subscribe(callback) {
434
- return provider.subscribe(() => {
435
- callback(getIsLandscapeMobile());
436
- });
437
- },
438
- cleanup: () => provider.cleanup()
439
- };
440
- }
441
-
442
- //#endregion
443
- //#region src/setup.ts
444
- let wasmConfig;
445
- let configured = false;
446
- /**
447
- * Initializes the SDK with the provided configuration.
448
- * Must be called before using any SDK functionality.
449
- *
450
- * WASM loads automatically from the Incode CDN unless explicitly disabled or overridden.
451
- *
452
- * @param options - Configuration options for the SDK
453
- *
454
- * @example
455
- * ```ts
456
- * import { setup, createSession } from '@incodetech/core';
457
- *
458
- * // Zero-config: WASM loads automatically from CDN
459
- * await setup({ apiURL: 'https://api.incode.com', token: 'session-token' });
460
- *
461
- * // Opt out of WASM
462
- * await setup({ apiURL: 'https://api.incode.com', token: 'session-token', wasm: false });
463
- *
464
- * // Self-hosted / custom version (full or partial path overrides)
465
- * await setup({
466
- * apiURL: 'https://api.incode.com',
467
- * token: 'session-token',
468
- * wasm: {
469
- * wasmPath: '/my-cdn/webLib.wasm',
470
- * glueCodePath: '/my-cdn/webLib.js',
471
- * },
472
- * });
473
- *
474
- * // Partial override: only models path, rest from CDN
475
- * await setup({
476
- * apiURL: 'https://api.incode.com',
477
- * token: 'session-token',
478
- * wasm: { modelsBasePath: 'https://my-cdn/models' },
479
- * });
480
- *
481
- * // Sessionless setup (all API actors overridden via .provide())
482
- * await setup({
483
- * wasm: {
484
- * wasmPath: '/wasm/ml-wasm.wasm',
485
- * glueCodePath: '/wasm/ml-wasm.js',
486
- * pipelines: ['selfie'],
487
- * },
488
- * });
489
- * ```
490
- */
491
- async function setup(options) {
492
- if (options.apiURL) {
493
- setClient(createApi_default({
494
- apiURL: options.apiURL,
495
- customHeaders: options.customHeaders,
496
- timeout: options.timeout
497
- }));
498
- if (options.token) {
499
- setToken(options.token);
500
- flushEventQueue();
501
- initializeSession({ hostingApp: options.hostingApp }).catch((error) => {
502
- console.warn("Session initialization failed:", error);
503
- });
504
- }
505
- }
506
- configured = true;
507
- const effectiveWasm = options.wasm === false ? void 0 : resolveWasmConfig(options.wasm);
508
- if (effectiveWasm) {
509
- await warmupWasm(effectiveWasm);
510
- await (await WasmUtilProvider.getInstance()).initialize({
511
- ...effectiveWasm,
512
- pipelines: effectiveWasm.pipelines ? [...effectiveWasm.pipelines] : void 0
513
- });
514
- }
515
- }
516
- /**
517
- * Sets the WASM configuration without performing warmup.
518
- * Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
519
- *
520
- * @param config - WASM configuration to store
521
- */
522
- function setWasmConfig(config) {
523
- wasmConfig = config;
524
- }
525
- /**
526
- * Initializes WasmUtilProvider with the stored WASM configuration.
527
- * Should be called after warmupWasm() completes when using conditional warmup.
528
- * This ensures image encryption works properly.
529
- *
530
- * @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
531
- * @throws Error if no config is provided and none is stored
532
- */
533
- async function initializeWasmUtil(config) {
534
- const wasmConfigToUse = config ?? wasmConfig;
535
- if (!wasmConfigToUse) throw new Error("WASM config is required. Provide config parameter or call setWasmConfig() first.");
536
- const resolved = resolveWasmConfig(wasmConfigToUse);
537
- await (await WasmUtilProvider.getInstance()).initialize({
538
- ...resolved,
539
- pipelines: resolved.pipelines ? [...resolved.pipelines] : void 0
540
- });
541
- }
542
- /**
543
- * Checks if the SDK has been configured.
544
- *
545
- * @returns true if setup() has been called, false otherwise
546
- */
547
- function isConfigured() {
548
- return configured;
549
- }
550
- /**
551
- * Resets the SDK configuration. Useful for testing.
552
- */
553
- function reset() {
554
- resetApi();
555
- resetSessionInit();
556
- configured = false;
557
- wasmConfig = void 0;
558
- WasmUtilProvider.resetInstance();
559
- }
560
-
561
- //#endregion
562
- export { DEFAULT_WASM_VERSION, ID_ERROR_CODES, ScreenOrientationProvider, addEvent, api, buildDefaultWasmConfig, cameraScreenNamesMapper, captureAttemptFinished, checkPermission as checkCameraPermission, createApi_default as createApi, createIdCaptureActor, createIdCaptureManager, createScreenOrientationObserver, createSession, elementClicked, eventModuleNames, eventScreenNames, flushEventQueue, getApi, getBrowser, getDeviceClass, getDisableIpify, getSessionFeatures, idCaptureMachine, initializeIdCapture, initializeSession, initializeWasmUtil, isConfigured, isIPad, isSessionInitialized, moduleClosed, moduleOpened, processId, requestPermission as requestCameraPermission, reset, resetSessionInit, resolveWasmConfig, screenClosed, screenEvent, screenOpened, setWasmConfig, setup, startRecordingSession, stopRecording, stopStream, subscribeEvent, tutorialScreenNamesMapper, uploadIdImage, validateUploadResponse, videoSelfieEvents, warmupWasm };
1
+ import { a as setup, n as isConfigured, r as reset } from "./setup-fvDWE7f8.esm.js";
2
+ import "./BaseWasmProvider-CQgeReKV.esm.js";
3
+ import "./WasmUtilProvider-C45HStLj.esm.js";
4
+ import "./api-CyI8qTie.esm.js";
5
+ import "./events-BlVGS-8F.esm.js";
6
+ import "./session-PLjFj_T3.esm.js";
7
+ import "./BrowserEnvironmentProvider--xQUs3sg.esm.js";
8
+ import "./browserSimulation-yzDdWSBf.esm.js";
9
+
10
+ export { isConfigured, reset, setup };
@@ -1,4 +1,4 @@
1
- import { i as __toCommonJS, n as __esm, r as __export, t as __commonJS } from "./chunk-D6hkk-hd.esm.js";
1
+ import { i as __toCommonJS, n as __esm, r as __export, t as __commonJS } from "./chunk-BcQWkoAq.esm.js";
2
2
 
3
3
  //#region ../../node_modules/.pnpm/jsnlog@2.30.0/node_modules/jsnlog/jsnlog.js
4
4
  var require_jsnlog = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/jsnlog@2.30.0/node_modules/jsnlog/jsnlog.js": ((exports) => {