@incodetech/core 0.0.0-dev-20260402-682edb5 → 0.0.0-dev-20260402-7cf9db4
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.
- package/dist/Actor-phIcsUhv.d.ts +2 -0
- package/dist/BaseWasmProvider-BFXU7jj8.esm.js +1536 -0
- package/dist/BrowserEnvironmentProvider-DApG6lNu.esm.js +89 -0
- package/dist/BrowserTimerProvider-CRhCvln7.esm.js +22 -0
- package/dist/Manager-BndLda4_.d.ts +19 -0
- package/dist/{events-Cc1xUUgF.esm.js → Manager-D_DMzMWz.esm.js} +114 -11
- package/dist/{warmup-CzfSiaMj.d.ts → StateMachine-CGAi8x_b.d.ts} +4 -1
- package/dist/StreamCanvasCapture-9VAzOfOv.esm.js +410 -0
- package/dist/WasmUtilProvider-DctESPCy.esm.js +114 -0
- package/dist/{addressSearch-DzOdaNEA.esm.js → addressSearch-CYGzuJJ3.esm.js} +3 -3
- package/dist/authentication.d.ts +9 -7
- package/dist/authentication.esm.js +12 -10
- package/dist/{authenticationManager-TaI12wf3.d.ts → authenticationManager-B5Yv9bDw.d.ts} +2 -2
- package/dist/{authenticationManager-CBSPCdJc.esm.js → authenticationManager-C9iQ1d2a.esm.js} +5 -5
- package/dist/{backCameraStream-BGAbuvw1.esm.js → backCameraStream-BJwEXNl4.esm.js} +2 -1
- package/dist/camera-D-MPXRbZ.esm.js +22 -0
- package/dist/camera-Dv2WEhGe.d.ts +4 -0
- package/dist/consent.d.ts +55 -54
- package/dist/consent.esm.js +2 -3
- package/dist/curp-validation.d.ts +5 -3
- package/dist/curp-validation.esm.js +2 -3
- package/dist/deepsightLoader-D2MKmB5z.esm.js +48 -0
- package/dist/{deepsightService-DxA--87N.d.ts → deepsightService-CWnhwXLw.d.ts} +223 -17
- package/dist/document-capture.d.ts +58 -56
- package/dist/document-capture.esm.js +5 -4
- package/dist/document-upload.d.ts +47 -45
- package/dist/document-upload.esm.js +5 -4
- package/dist/ekyb.d.ts +3 -2
- package/dist/ekyb.esm.js +8 -7
- package/dist/ekyc.d.ts +3 -2
- package/dist/ekyc.esm.js +133 -123
- package/dist/email.d.ts +3 -2
- package/dist/email.esm.js +4 -4
- package/dist/{emailManager-DN_q_zxy.d.ts → emailManager-BIq6pJa8.d.ts} +11 -4
- package/dist/{emailManager-DSR9gQLX.esm.js → emailManager-C5GCSw78.esm.js} +43 -23
- package/dist/extensibility.d.ts +45 -43
- package/dist/extensibility.esm.js +26 -15
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +2 -3
- package/dist/{faceCaptureManagerFactory-CGpkO_S3.d.ts → faceCaptureManagerFactory-CN5-GRxP.d.ts} +89 -142
- package/dist/{faceCaptureSetup-Rr7LUbBm.esm.js → faceCaptureSetup-DYRykM5Y.esm.js} +413 -7
- package/dist/flow.d.ts +6 -5
- package/dist/flow.esm.js +7 -7
- package/dist/{flowCompletionService-Bkaerugt.esm.js → flowCompletionService-CBvXiMKa.esm.js} +1 -1
- package/dist/{flowServices-Bt6lMLUI.esm.js → flowServices-CQ3rTJLE.esm.js} +2 -2
- package/dist/geolocation.d.ts +2 -1
- package/dist/geolocation.esm.js +16 -3
- package/dist/government-validation.d.ts +2 -1
- package/dist/government-validation.esm.js +3 -3
- package/dist/id.d.ts +9 -6
- package/dist/id.esm.js +14 -11
- package/dist/{idCaptureManager-Dc2NJMy_.d.ts → idCaptureManager-B1RWflj0.d.ts} +15 -12
- package/dist/{idCaptureManager-QyM4nIKM.esm.js → idCaptureManager-D5rjCu9r.esm.js} +178 -8
- package/dist/index.d.ts +68 -21
- package/dist/index.esm.js +440 -11
- package/dist/mandatory-consent.d.ts +58 -56
- package/dist/mandatory-consent.esm.js +2 -3
- package/dist/phone.d.ts +3 -2
- package/dist/phone.esm.js +4 -4
- package/dist/{phoneManager-D2A0hXXq.d.ts → phoneManager-Ba66ysK2.d.ts} +9 -2
- package/dist/{phoneManager-D2nZtu-b.esm.js → phoneManager-CQJim-Ky.esm.js} +32 -21
- package/dist/platform-B3nGssGZ.esm.js +83 -0
- package/dist/redirect-to-mobile.d.ts +2 -1
- package/dist/redirect-to-mobile.esm.js +3 -3
- package/dist/selfie.d.ts +9 -7
- package/dist/selfie.esm.js +12 -10
- package/dist/{selfieManager-B4Nnp7ws.d.ts → selfieManager-BnfnTPcx.d.ts} +2 -2
- package/dist/{selfieManager-CvE35L72.esm.js → selfieManager-DYW1C2GP.esm.js} +4 -3
- package/dist/session-TBPhHmyy.esm.js +3130 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +2 -2
- package/dist/signature.d.ts +3 -3
- package/dist/signature.esm.js +3 -4
- package/dist/{stats-D0m3TvIg.esm.js → stats-D4C7iDy1.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{types-oveF7RrS.d.ts → types-BWGxcjiZ.d.ts} +1 -1
- package/dist/{types-mQLzH6uw.d.ts → types-BX1ZlbSR.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/deepsightLoader-B93Oa9pS.esm.js +0 -24
- package/dist/deepsightService-CLUMQ5ee.esm.js +0 -235
- package/dist/index-BTaLQSj9.d.ts +0 -219
- package/dist/recordingsRepository-Djt_In2b.esm.js +0 -122
- package/dist/session-CUy9-Yzi.esm.js +0 -250
- package/dist/src-8rn6DoH7.esm.js +0 -6554
- /package/dist/{api-G4JA8CXK.esm.js → api-3fZO5bmj.esm.js} +0 -0
- /package/dist/{browserSimulation-C8gNnn5p.esm.js → browserSimulation-zWJAZ1vA.esm.js} +0 -0
- /package/dist/{displayErrors-BgtBHbfb.d.ts → displayErrors-DzzB3fcR.d.ts} +0 -0
- /package/dist/{flowCompletionService-De8JDo87.d.ts → flowCompletionService-C_CShl_d.d.ts} +0 -0
- /package/dist/{id-B30uqGbp.esm.js → id-Dv0it9CY.esm.js} +0 -0
- /package/dist/{index-LKrIp3Oo.d.ts → index-CuY8tqBC.d.ts} +0 -0
- /package/dist/{lib-qeMam2F_.esm.js → lib-B5byelWf.esm.js} +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -1,16 +1,445 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
6
|
-
import { a as
|
|
1
|
+
import { i as isIPad } from "./platform-B3nGssGZ.esm.js";
|
|
2
|
+
import { c as warmupWasm, s as getUserAgent } from "./BaseWasmProvider-BFXU7jj8.esm.js";
|
|
3
|
+
import { c as requestPermission, p as getDeviceClass, s as checkPermission } from "./StreamCanvasCapture-9VAzOfOv.esm.js";
|
|
4
|
+
import "./browserSimulation-zWJAZ1vA.esm.js";
|
|
5
|
+
import { a as resetApi, n as getApi, o as setClient, s as setToken, t as api } from "./api-3fZO5bmj.esm.js";
|
|
6
|
+
import { _ as flushEventQueue, a as tutorialScreenNamesMapper, d as moduleClosed, f as moduleOpened, g as addEvent, h as screenOpened, i as eventScreenNames, l as captureAttemptFinished, m as screenEvent, n as cameraScreenNamesMapper, o as videoSelfieEvents, p as screenClosed, r as eventModuleNames, u as elementClicked, v as subscribeEvent } from "./Manager-D_DMzMWz.esm.js";
|
|
7
7
|
import "./endpoints-CCuj1KZH.esm.js";
|
|
8
|
-
import { a as isSessionInitialized,
|
|
9
|
-
import
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
8
|
+
import { a as isSessionInitialized, i as initializeSession, n as getSessionFeatures, o as resetSessionInit, t as getDisableIpify, u as createSession } from "./session-TBPhHmyy.esm.js";
|
|
9
|
+
import "./BrowserEnvironmentProvider-DApG6lNu.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-D5rjCu9r.esm.js";
|
|
11
|
+
import "./BrowserTimerProvider-CRhCvln7.esm.js";
|
|
12
|
+
import "./camera-D-MPXRbZ.esm.js";
|
|
13
|
+
import "./stats-D4C7iDy1.esm.js";
|
|
14
|
+
import "./backCameraStream-BJwEXNl4.esm.js";
|
|
15
|
+
import "./id-Dv0it9CY.esm.js";
|
|
16
|
+
import { t as WasmUtilProvider } from "./WasmUtilProvider-DctESPCy.esm.js";
|
|
13
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
|
|
14
443
|
//#region src/setup.ts
|
|
15
444
|
let wasmConfig;
|
|
16
445
|
let configured = false;
|