@incodetech/core 0.0.0-dev-20260728-af4e1aee → 0.0.0-dev-20260729-e2dda0b0

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 (170) hide show
  1. package/dist/BrowserDiagnosticsCryptoProvider-BZqV7sJR.esm.js +96 -0
  2. package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +9 -0
  3. package/dist/{WasmUtilProvider-BrWOTaVG.esm.js → WasmUtilProvider-D13sxEmA.esm.js} +2 -406
  4. package/dist/{addressSearch-DEYnZoez.esm.js → addressSearch-D_0t2Wdn.esm.js} +2 -2
  5. package/dist/ae-signature.esm.js +1 -1
  6. package/dist/antifraud.esm.js +2 -2
  7. package/dist/{antifraudManager-CFsD4BgV.esm.js → antifraudManager-COYh4O_y.esm.js} +2 -2
  8. package/dist/{antifraudStateMachine-VB-aXHct.esm.js → antifraudStateMachine-NuzlVVte.esm.js} +2 -2
  9. package/dist/api-Bx3gKW_y.esm.js +129 -0
  10. package/dist/{apiError-B-PkYxln.esm.js → apiError-GA6MbJpI.esm.js} +12 -1
  11. package/dist/authentication.d.ts +3 -3
  12. package/dist/authentication.esm.js +2 -2
  13. package/dist/{authenticationManager-BDkpqQ-5.esm.js → authenticationManager-B7v0Jy-x.esm.js} +5 -5
  14. package/dist/{authenticationManager-B2KZQ9zw.d.ts → authenticationManager-BGM8bpD0.d.ts} +1 -1
  15. package/dist/{authenticationStateMachine-lTogTlQv.esm.js → authenticationStateMachine-DAh9ziFC.esm.js} +5 -5
  16. package/dist/camera.esm.js +1 -1
  17. package/dist/certificate-issuance.esm.js +2 -2
  18. package/dist/{certificateIssuanceStateMachine-Di_bLlkP.esm.js → certificateIssuanceStateMachine-N__sTAgu.esm.js} +2 -2
  19. package/dist/consent.d.ts +1 -1
  20. package/dist/consent.esm.js +2 -2
  21. package/dist/{consentManager-DLOyIZzt.d.ts → consentManager-BhYFeKiG.d.ts} +9 -9
  22. package/dist/{consentManager-0EiBXYtL.esm.js → consentManager-CWEAhAJ5.esm.js} +2 -2
  23. package/dist/{consentStateMachine-STURxpEc.esm.js → consentStateMachine-DWL-X0Jb.esm.js} +2 -2
  24. package/dist/cross-document-data-match.esm.js +1 -1
  25. package/dist/{crossDocumentDataMatchManager-Dw7euiiZ.esm.js → crossDocumentDataMatchManager-Bk4W2TDJ.esm.js} +3 -3
  26. package/dist/curp-validation.d.ts +1 -1
  27. package/dist/curp-validation.esm.js +2 -2
  28. package/dist/{curpValidationManager-BGj9U3E0.esm.js → curpValidationManager-B6gYKygj.esm.js} +2 -2
  29. package/dist/{curpValidationManager-BEWD-Lvo.d.ts → curpValidationManager-DVGr7Fq7.d.ts} +1 -1
  30. package/dist/{curpValidationStateMachine-Dq6l4oeZ.esm.js → curpValidationStateMachine-42RbYcam.esm.js} +2 -2
  31. package/dist/custom-fields.esm.js +3 -3
  32. package/dist/custom-watchlist.esm.js +2 -2
  33. package/dist/{customWatchlistStateMachine-BuQML-pk.esm.js → customWatchlistStateMachine-BbDtH5kk.esm.js} +2 -2
  34. package/dist/{deepsightLoader-DDu_KUyv.esm.js → deepsightLoader-CHG26pOB.esm.js} +14 -4
  35. package/dist/document-capture.d.ts +1 -1
  36. package/dist/document-capture.esm.js +2 -2
  37. package/dist/document-upload.d.ts +8 -8
  38. package/dist/document-upload.esm.js +3 -3
  39. package/dist/{documentCaptureManager-B-J1lXcH.d.ts → documentCaptureManager-BK_4RbHt.d.ts} +73 -73
  40. package/dist/{documentCaptureManager-DBRQX16v.esm.js → documentCaptureManager-FvcNYpkS.esm.js} +2 -2
  41. package/dist/{documentCaptureStateMachine-BXgH9gGq.esm.js → documentCaptureStateMachine-BlzN0-mU.esm.js} +4 -4
  42. package/dist/dynamic-forms.d.ts +2 -2
  43. package/dist/dynamic-forms.esm.js +2 -2
  44. package/dist/{dynamicFormsManager-DI0sCyVB.esm.js → dynamicFormsManager-CfJixpOW.esm.js} +8 -4
  45. package/dist/{dynamicFormsManager-BYac2uEY.d.ts → dynamicFormsManager-fhK0yINk.d.ts} +9 -1
  46. package/dist/{dynamicFormsStateMachine-BQqAwNQ-.esm.js → dynamicFormsStateMachine-DrPO1i45.esm.js} +71 -6
  47. package/dist/ekyb.d.ts +1 -1
  48. package/dist/ekyb.esm.js +3 -3
  49. package/dist/{ekybManager-BQQyRMqw.esm.js → ekybManager-DVCqaSzz.esm.js} +2 -2
  50. package/dist/{ekybStateMachine-jsiqdGjv.esm.js → ekybStateMachine-C3y-Qx1a.esm.js} +4 -4
  51. package/dist/ekyc.esm.js +2 -2
  52. package/dist/{ekycManager-Cl2e4Knv.esm.js → ekycManager-dimNksoE.esm.js} +2 -2
  53. package/dist/{ekycStateMachine-9Mm7LBea.esm.js → ekycStateMachine-Yl3sQmhm.esm.js} +3 -3
  54. package/dist/electronic-signature.esm.js +1 -1
  55. package/dist/{electronicSignatureManager-BXIpAJ5m.esm.js → electronicSignatureManager-D0X7P-de.esm.js} +4 -4
  56. package/dist/email.esm.js +2 -2
  57. package/dist/{emailManager-Dmt1YrtS.esm.js → emailManager-BqJMritP.esm.js} +2 -2
  58. package/dist/{emailStateMachine-DQS-QMgQ.esm.js → emailStateMachine-CLtrh2Ot.esm.js} +2 -2
  59. package/dist/{endpoints-CfRg7iAr.esm.js → endpoints-DOfmJylF.esm.js} +8 -1
  60. package/dist/{events-Dy8PyVO5.esm.js → events-CMFCCu1H.esm.js} +2 -9
  61. package/dist/events.esm.js +1 -1
  62. package/dist/extensibility.d.ts +13 -13
  63. package/dist/extensibility.esm.js +26 -32
  64. package/dist/face-match.esm.js +2 -2
  65. package/dist/{faceCaptureManagerFactory-B2TUje5s.d.ts → faceCaptureManagerFactory-B92LFT16.d.ts} +3 -3
  66. package/dist/{faceCaptureManagerFactory-DaYwl0Yq.esm.js → faceCaptureManagerFactory-D2pR3ZnX.esm.js} +3 -3
  67. package/dist/{faceCaptureSetup-DlmX-9nD.esm.js → faceCaptureSetup-DbhDPMjb.esm.js} +5 -5
  68. package/dist/{faceMatchManager-fPX11GnX.esm.js → faceMatchManager-XxTEAj9C.esm.js} +2 -2
  69. package/dist/{faceMatchStateMachine-D_7UX1rV.esm.js → faceMatchStateMachine-ubds4WlI.esm.js} +2 -2
  70. package/dist/field-comparison.esm.js +1 -1
  71. package/dist/{fieldComparisonManager-USUE9qDr.esm.js → fieldComparisonManager-BzaX4TvX.esm.js} +3 -3
  72. package/dist/fiscal-qr.esm.js +3 -3
  73. package/dist/flow-events.d.ts +1 -1
  74. package/dist/flow.d.ts +6 -6
  75. package/dist/flow.esm.js +4 -4
  76. package/dist/{flowCompletionService-D5oIlcza.esm.js → flowCompletionService-BdZR6HyE.esm.js} +3 -3
  77. package/dist/{flowServices-T5JoA_1N.esm.js → flowServices-CPti9am-.esm.js} +8 -6
  78. package/dist/geolocation.esm.js +2 -2
  79. package/dist/{geolocationManager-zeqAcVHC.esm.js → geolocationManager-DW27-LTL.esm.js} +2 -2
  80. package/dist/{geolocationStateMachine-DxSETS9_.esm.js → geolocationStateMachine-Cz3Q6az0.esm.js} +3 -3
  81. package/dist/government-validation.esm.js +2 -2
  82. package/dist/{governmentValidationStateMachine-loZfWcU9.esm.js → governmentValidationStateMachine-CtG3bIdM.esm.js} +2 -2
  83. package/dist/home.d.ts +1 -1
  84. package/dist/home.esm.js +1 -1
  85. package/dist/http.esm.js +1 -1
  86. package/dist/id-ocr.d.ts +1 -1
  87. package/dist/id-ocr.esm.js +2 -2
  88. package/dist/id-verification.esm.js +2 -2
  89. package/dist/id.d.ts +2 -2
  90. package/dist/id.esm.js +5 -5
  91. package/dist/{idCaptureDefaults-DCrjeNl5.esm.js → idCaptureDefaults-BDS43fFL.esm.js} +2 -2
  92. package/dist/{idCaptureManager-D6fKtXhM.d.ts → idCaptureManager-C-WjmsN4.d.ts} +2 -2
  93. package/dist/{idCaptureManager-DaqabBBZ.esm.js → idCaptureManager-CPzgzVu8.esm.js} +4 -4
  94. package/dist/{idCaptureStateMachine-CU1CsT7x.esm.js → idCaptureStateMachine-CAKztWBq.esm.js} +28 -17
  95. package/dist/{idOcrManager-dLuxey6y.d.ts → idOcrManager-DXc_xRN7.d.ts} +1 -1
  96. package/dist/{idOcrManager-CnIWzuqU.esm.js → idOcrManager-Drs6frVO.esm.js} +2 -2
  97. package/dist/{idOcrStateMachine-Cqi8173Y.esm.js → idOcrStateMachine-s08FLvEh.esm.js} +3 -3
  98. package/dist/{idVerificationManager-BTsyXjv6.esm.js → idVerificationManager-Df97Bf0n.esm.js} +2 -2
  99. package/dist/{idVerificationStateMachine-7BSciEJk.esm.js → idVerificationStateMachine-tAF7pvC8.esm.js} +2 -2
  100. package/dist/identity-reuse.d.ts +1 -1
  101. package/dist/identity-reuse.esm.js +2 -2
  102. package/dist/{identityReuseManager-BjMJHKLP.esm.js → identityReuseManager-0ZHGWr9T.esm.js} +2 -2
  103. package/dist/{identityReuseManager-D6pD4hcZ.d.ts → identityReuseManager-v2TH5g7e.d.ts} +1 -1
  104. package/dist/{identityReuseStateMachine-B0IFF3R7.esm.js → identityReuseStateMachine-DG8kbKuy.esm.js} +2 -2
  105. package/dist/{index-X9serOZT.d.ts → index-CLMF0QLQ.d.ts} +1 -1
  106. package/dist/index.d.ts +1 -1
  107. package/dist/index.esm.js +1 -1
  108. package/dist/{invokeOnCaptureCallback-B-QfsCQY.esm.js → invokeOnCaptureCallback-Cgl54qED.esm.js} +1 -1
  109. package/dist/mandatory-consent.d.ts +2 -2
  110. package/dist/mandatory-consent.esm.js +2 -2
  111. package/dist/{mandatoryConsentManager-IKpruo6V.d.ts → mandatoryConsentManager-CzsVFG33.d.ts} +6 -6
  112. package/dist/{mandatoryConsentManager-BOOjm7SU.esm.js → mandatoryConsentManager-DaKK7S4q.esm.js} +2 -2
  113. package/dist/{mandatoryConsentStateMachine-BP3npRnI.esm.js → mandatoryConsentStateMachine-CjKpOQXU.esm.js} +2 -2
  114. package/dist/{onDeviceFaceResults-bUR2uNg0.esm.js → onDeviceFaceResults-CVhk1BWp.esm.js} +13 -6
  115. package/dist/{permissionGuards-5Cu6a8iN.esm.js → permissionGuards-UMiLlPfq.esm.js} +1 -1
  116. package/dist/{permissionServices-CkHL1BjH.esm.js → permissionServices-C4qKxOl4.esm.js} +1 -1
  117. package/dist/personhood.d.ts +1 -1
  118. package/dist/personhood.esm.js +9 -22
  119. package/dist/phone.esm.js +2 -2
  120. package/dist/{phoneManager-C3aqq6jS.esm.js → phoneManager-WImoAp4i.esm.js} +2 -2
  121. package/dist/{phoneStateMachine-CLGcLA8t.esm.js → phoneStateMachine-FJ-_x1G4.esm.js} +2 -2
  122. package/dist/qe-signature.esm.js +1 -1
  123. package/dist/{recordingService-ChBo1rvx.esm.js → recordingService-BGPq5vGr.esm.js} +3 -3
  124. package/dist/redirect-to-mobile.esm.js +2 -2
  125. package/dist/{redirectToMobileManager-BO0BVfgM.esm.js → redirectToMobileManager-CxEu6KnV.esm.js} +2 -2
  126. package/dist/{redirectToMobileStateMachine-BQuhw8_L.esm.js → redirectToMobileStateMachine-jI5XPtZJ.esm.js} +2 -2
  127. package/dist/{runChildModule-Crz1nHwJ.esm.js → runChildModule-fagPe5Ct.esm.js} +6 -1
  128. package/dist/selfie.d.ts +3 -3
  129. package/dist/selfie.esm.js +9 -9
  130. package/dist/{selfieErrorUtils-BAEYvNVr.esm.js → selfieErrorUtils-DCRRRj38.esm.js} +3 -3
  131. package/dist/{selfieManager-BT7dmOHi.d.ts → selfieManager-CxeMb2tM.d.ts} +1 -1
  132. package/dist/{selfieManager-9Eci1f5e.esm.js → selfieManager-DTiBsQNn.esm.js} +5 -5
  133. package/dist/{selfieStateMachine-CKRTfYh8.esm.js → selfieStateMachine-CxabK5_3.esm.js} +3 -3
  134. package/dist/session-Ccob4IUP.esm.js +161 -0
  135. package/dist/session.d.ts +9 -2
  136. package/dist/session.esm.js +4 -152
  137. package/dist/{sessionInitializer-CgjN51b2.esm.js → sessionInitializer-DEd0CQ74.esm.js} +27 -32
  138. package/dist/{setup-BFGd-cxt.esm.js → setup-BR4G3NHV.esm.js} +78 -11
  139. package/dist/{setup-B1WTXTQV.d.ts → setup-Dj8n_YLP.d.ts} +22 -0
  140. package/dist/signature.esm.js +2 -2
  141. package/dist/{signatureStateMachine-zRLvEGTw.esm.js → signatureStateMachine-Dx92l8pR.esm.js} +2 -2
  142. package/dist/{stats-4DAk7TYl.esm.js → stats-6sK3f5pc.esm.js} +2 -2
  143. package/dist/stats.esm.js +1 -1
  144. package/dist/trueSight-4L5GCqKy.esm.js +1 -0
  145. package/dist/trueSightService-DKC-gmQC.esm.js +1891 -0
  146. package/dist/trust-graph.esm.js +1 -1
  147. package/dist/{types-BK-v1UYb.d.ts → types-BBQjIaK4.d.ts} +1 -1
  148. package/dist/{types-xIEGXWk8.d.ts → types-BSBzhHRH.d.ts} +9 -0
  149. package/dist/{types-DjHL5Wa9.d.ts → types-BX_XkMsQ.d.ts} +1 -1
  150. package/dist/{types-DznwkfTc.d.ts → types-C2n-6lCx.d.ts} +1 -1
  151. package/dist/types-CrUhpMDP.d.ts +6 -0
  152. package/dist/{types-NSJbROLr.d.ts → types-KPvmag_B.d.ts} +2 -0
  153. package/dist/video-selfie.d.ts +2 -2
  154. package/dist/video-selfie.esm.js +9 -9
  155. package/dist/wasm.d.ts +1 -1
  156. package/dist/wasm.esm.js +3 -3
  157. package/dist/{wasmDefaults-B4DUtYET.esm.js → wasmDefaults-DJiEvV7f.esm.js} +1 -1
  158. package/dist/wasmWebClient-DM8lkb0z.esm.js +407 -0
  159. package/dist/watchlist-for-business.esm.js +2 -2
  160. package/dist/watchlist.esm.js +2 -2
  161. package/dist/{watchlistForBusinessStateMachine-Rc6BAwlr.esm.js → watchlistForBusinessStateMachine-Eo-WEYha.esm.js} +2 -2
  162. package/dist/{watchlistManager-FRMpgcWW.esm.js → watchlistManager-DnVfNc1v.esm.js} +2 -2
  163. package/dist/{watchlistStateMachine-64y9XBjm.esm.js → watchlistStateMachine-DZSOauwp.esm.js} +2 -2
  164. package/dist/workflow.d.ts +17 -9
  165. package/dist/workflow.esm.js +55 -40
  166. package/package.json +3 -3
  167. package/dist/api-BDTZNnca.esm.js +0 -71
  168. package/dist/clientLifecycle-BX83zwtT.esm.js +0 -528
  169. package/dist/session-B3d0Xtee.esm.js +0 -1
  170. package/dist/types-sK-eGomM.d.ts +0 -6
@@ -1,528 +0,0 @@
1
- import { c as executeWasmRequest, d as setupWasmConnection, l as initializeWasmWebClient, s as WasmWebClientError, u as setWebApiHttpTransport } from "./WasmUtilProvider-BrWOTaVG.esm.js";
2
- import { o as setClient } from "./api-BDTZNnca.esm.js";
3
- //#region ../infra/src/http/createApi.ts
4
- var FetchHttpError = class extends Error {
5
- constructor(status, statusText, url, method, headers, data) {
6
- super(`HTTP ${status} ${statusText}`);
7
- this.ok = false;
8
- this.status = status;
9
- this.statusText = statusText;
10
- this.url = url;
11
- this.method = method;
12
- this.headers = headers;
13
- this.data = data;
14
- this.name = "FetchHttpError";
15
- }
16
- };
17
- const buildQueryString$1 = (query) => {
18
- if (!query) return "";
19
- const params = new URLSearchParams();
20
- Object.entries(query).forEach(([key, value]) => {
21
- if (value !== void 0 && value !== null) params.append(key, String(value));
22
- });
23
- const str = params.toString();
24
- return str ? `?${str}` : "";
25
- };
26
- const buildUrl$1 = (baseURL, url, query) => {
27
- const queryString = buildQueryString$1(query);
28
- if (url.startsWith("http://") || url.startsWith("https://")) return `${url}${queryString}`;
29
- return `${baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL}${url.startsWith("/") ? url : `/${url}`}${queryString}`;
30
- };
31
- const prepareBody$1 = (body) => {
32
- if (body === null || body === void 0) return null;
33
- if (body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer) return body;
34
- if (typeof body === "object") return JSON.stringify(body);
35
- return String(body);
36
- };
37
- const parseResponse = async (response, parseType) => {
38
- if (parseType === "response") return response;
39
- if (parseType === "blob") return await response.blob();
40
- if (parseType === "arrayBuffer") return await response.arrayBuffer();
41
- if (parseType === "text") return await response.text();
42
- const contentType = response.headers.get("content-type") ?? "";
43
- if (parseType === "json" || contentType.includes("application/json")) {
44
- const raw = await response.text();
45
- if (raw.length === 0) return "";
46
- try {
47
- return JSON.parse(raw);
48
- } catch {
49
- return raw;
50
- }
51
- }
52
- return await response.text();
53
- };
54
- const DEFAULT_TIMEOUT$1 = 3e4;
55
- const requestWithXHR = (fullUrl, method, mergedHeaders, requestBody, timeout, signal, onUploadProgress) => {
56
- return new Promise((resolve, reject) => {
57
- const xhr = new XMLHttpRequest();
58
- xhr.open(method, fullUrl, true);
59
- Object.entries(mergedHeaders).forEach(([key, value]) => {
60
- xhr.setRequestHeader(key, value);
61
- });
62
- xhr.timeout = timeout;
63
- xhr.upload.onprogress = (event) => {
64
- if (event.lengthComputable) {
65
- const percentComplete = event.loaded / event.total * 100;
66
- onUploadProgress(Math.round(percentComplete));
67
- }
68
- };
69
- xhr.onload = () => {
70
- const responseHeaders = {};
71
- xhr.getAllResponseHeaders().split("\r\n").forEach((line) => {
72
- const parts = line.split(": ");
73
- if (parts.length === 2) responseHeaders[parts[0].toLowerCase()] = parts[1];
74
- });
75
- let data;
76
- try {
77
- if ((xhr.getResponseHeader("content-type") ?? "").includes("application/json")) data = JSON.parse(xhr.responseText);
78
- else data = xhr.responseText;
79
- } catch {
80
- data = xhr.responseText;
81
- }
82
- if (xhr.status >= 200 && xhr.status < 300) resolve({
83
- ok: true,
84
- status: xhr.status,
85
- statusText: xhr.statusText,
86
- url: fullUrl,
87
- headers: responseHeaders,
88
- data
89
- });
90
- else reject(new FetchHttpError(xhr.status, xhr.statusText, fullUrl, method, responseHeaders, data));
91
- };
92
- xhr.onerror = () => {
93
- reject(new FetchHttpError(0, "Network Error", fullUrl, method, {}, null));
94
- };
95
- xhr.ontimeout = () => {
96
- reject(new FetchHttpError(0, "Request timeout", fullUrl, method, {}, null));
97
- };
98
- if (signal) signal.addEventListener("abort", () => {
99
- xhr.abort();
100
- reject(new FetchHttpError(0, "Request aborted", fullUrl, method, {}, null));
101
- });
102
- xhr.send(requestBody);
103
- });
104
- };
105
- const createApi = (config) => {
106
- const headers = {
107
- "Content-Type": "application/json",
108
- Accept: "application/json",
109
- "api-version": "1.0",
110
- ...config.customHeaders ?? {}
111
- };
112
- const defaults = {
113
- baseURL: config.apiURL,
114
- headers
115
- };
116
- const client = {
117
- defaults,
118
- async request(requestConfig) {
119
- const { method = "GET", url, headers = {}, query, params, body, signal, timeout = config.timeout ?? DEFAULT_TIMEOUT$1, parse, onUploadProgress, keepalive } = requestConfig;
120
- const fullUrl = buildUrl$1(defaults.baseURL, url, params ?? query);
121
- const mergedHeaders = {
122
- ...defaults.headers,
123
- ...headers
124
- };
125
- const requestBody = prepareBody$1(body);
126
- let finalHeaders = mergedHeaders;
127
- if (requestBody === null && (method === "POST" || method === "PUT" || method === "PATCH")) {
128
- const { "Content-Type": _, ...headersWithoutContentType } = mergedHeaders;
129
- finalHeaders = headersWithoutContentType;
130
- }
131
- if (onUploadProgress) {
132
- if (requestBody !== null && typeof ReadableStream !== "undefined" && requestBody instanceof ReadableStream) throw new Error("Upload progress tracking is not supported for ReadableStream bodies");
133
- return requestWithXHR(fullUrl, method, finalHeaders, requestBody, timeout, signal, onUploadProgress);
134
- }
135
- const controller = new AbortController();
136
- const abortSignal = signal ?? controller.signal;
137
- const timeoutId = setTimeout(() => controller.abort(), timeout);
138
- try {
139
- const response = await fetch(fullUrl, {
140
- method,
141
- headers: finalHeaders,
142
- body: requestBody,
143
- signal: abortSignal,
144
- keepalive
145
- });
146
- if (timeoutId) clearTimeout(timeoutId);
147
- const responseHeaders = {};
148
- response.headers.forEach((value, key) => {
149
- responseHeaders[key] = value;
150
- });
151
- const data = await parseResponse(response, parse);
152
- if (!response.ok) throw new FetchHttpError(response.status, response.statusText, fullUrl, method, responseHeaders, data);
153
- return {
154
- ok: true,
155
- status: response.status,
156
- statusText: response.statusText,
157
- url: fullUrl,
158
- headers: responseHeaders,
159
- data
160
- };
161
- } catch (error) {
162
- if (timeoutId) clearTimeout(timeoutId);
163
- if (error instanceof FetchHttpError) throw error;
164
- if (error instanceof Error && error.name === "AbortError") throw new FetchHttpError(0, "Request timeout", fullUrl, method, {}, null);
165
- throw error;
166
- }
167
- },
168
- get(url, config) {
169
- return client.request({
170
- ...config,
171
- url,
172
- method: "GET"
173
- });
174
- },
175
- post(url, body, config) {
176
- return client.request({
177
- ...config,
178
- url,
179
- body,
180
- method: "POST"
181
- });
182
- },
183
- put(url, body, config) {
184
- return client.request({
185
- ...config,
186
- url,
187
- body,
188
- method: "PUT"
189
- });
190
- },
191
- patch(url, body, config) {
192
- return client.request({
193
- ...config,
194
- url,
195
- body,
196
- method: "PATCH"
197
- });
198
- },
199
- delete(url, config) {
200
- return client.request({
201
- ...config,
202
- url,
203
- method: "DELETE"
204
- });
205
- },
206
- head(url, config) {
207
- return client.request({
208
- ...config,
209
- url,
210
- method: "HEAD"
211
- });
212
- },
213
- options(url, config) {
214
- return client.request({
215
- ...config,
216
- url,
217
- method: "OPTIONS"
218
- });
219
- },
220
- setHeader(name, value) {
221
- defaults.headers[name] = value;
222
- }
223
- };
224
- return client;
225
- };
226
- //#endregion
227
- //#region ../infra/src/http/createWasmApi.ts
228
- const RSA_OAEP_SHA256_SCHEME = "RSA/NONE/OAEPWITHSHA-256ANDMGF1PADDING";
229
- /**
230
- * Builds the base set of HTTP headers that the WASM WebClient sends on every
231
- * request (including the internal `/e2ee/key/v2` and `/e2ee/key` handshake
232
- * calls).
233
- */
234
- function buildWasmDefaultHeaders(customHeaders) {
235
- return {
236
- "Content-Type": "application/json",
237
- Accept: "application/json",
238
- "api-version": "1.0",
239
- ...customHeaders ?? {}
240
- };
241
- }
242
- var WasmHttpError = class extends Error {
243
- constructor(status, statusText, url, method, headers, data) {
244
- super(`HTTP ${status} ${statusText}`);
245
- this.ok = false;
246
- this.status = status;
247
- this.statusText = statusText;
248
- this.url = url;
249
- this.method = method;
250
- this.headers = headers;
251
- this.data = data;
252
- this.name = "WasmHttpError";
253
- }
254
- };
255
- const DEFAULT_TIMEOUT = 3e4;
256
- const HTTP_METHODS = /* @__PURE__ */ new Set([
257
- "GET",
258
- "POST",
259
- "PUT",
260
- "PATCH",
261
- "DELETE"
262
- ]);
263
- const buildQueryString = (query) => {
264
- if (!query) return "";
265
- const params = new URLSearchParams();
266
- Object.entries(query).forEach(([key, value]) => {
267
- if (value !== void 0 && value !== null) params.append(key, String(value));
268
- });
269
- const str = params.toString();
270
- return str ? `?${str}` : "";
271
- };
272
- const buildUrl = (baseURL, url, query) => {
273
- const queryString = buildQueryString(query);
274
- if (url.startsWith("http://") || url.startsWith("https://")) return `${url}${queryString}`;
275
- return `${baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL}${url.startsWith("/") ? url : `/${url}`}${queryString}`;
276
- };
277
- const prepareBody = (body) => {
278
- if (body === null || body === void 0) return void 0;
279
- if (body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer || body instanceof Uint8Array || typeof body === "string") return body;
280
- if (typeof body === "object") return body;
281
- return String(body);
282
- };
283
- const normalizeMethod = (method) => {
284
- const upper = method.toUpperCase();
285
- if (!HTTP_METHODS.has(upper)) throw new Error(`Unsupported HTTP method for WASM client: ${method}`);
286
- return upper;
287
- };
288
- const getErrorStatus = (error) => {
289
- if (error instanceof WasmWebClientError) return error.statusCode;
290
- if (typeof error === "object" && error !== null) {
291
- const record = error;
292
- if (typeof record.statusCode === "number") return record.statusCode;
293
- if (typeof record.status === "number") return record.status;
294
- }
295
- return 0;
296
- };
297
- const getErrorData = (error) => {
298
- if (error instanceof WasmWebClientError) return error.response?.data ?? null;
299
- return null;
300
- };
301
- const getErrorMessage = (error) => {
302
- if (error instanceof Error) return error.message;
303
- return "WasmWebClient request failed";
304
- };
305
- const withAbortSignal = async (promise, signal, error) => {
306
- if (!signal) return await promise;
307
- if (signal.aborted) throw error;
308
- return await new Promise((resolve, reject) => {
309
- const onAbort = () => reject(error);
310
- signal.addEventListener("abort", onAbort, { once: true });
311
- promise.then(resolve, reject).finally(() => {
312
- signal.removeEventListener("abort", onAbort);
313
- });
314
- });
315
- };
316
- const createWasmApi = async (config) => {
317
- const headers = buildWasmDefaultHeaders(config.customHeaders);
318
- const isEncryptionEnabled = config.isEncryptionEnabled ?? (() => false);
319
- const useSha256 = config.mgf1 === "sha256";
320
- await initializeWasmWebClient(config.wasm.wasmPath, config.wasm.wasmSimdPath ?? config.wasm.wasmPath, config.wasm.glueCodePath, config.wasm.glueCodeSimdPath ?? "", config.wasm.useSimd ?? true);
321
- await setupWasmConnection(config.apiURL, "", config.encryptionEnabled ?? false, headers, useSha256);
322
- const defaults = {
323
- baseURL: config.apiURL,
324
- headers
325
- };
326
- const client = {
327
- defaults,
328
- async request(requestConfig) {
329
- const { method = "GET", url, headers: requestHeaders = {}, query, params, body, signal, timeout = config.timeout ?? DEFAULT_TIMEOUT, onUploadProgress, ie = false } = requestConfig;
330
- const upperMethod = normalizeMethod(method);
331
- const requestParams = params ?? query;
332
- const fullUrl = buildUrl(defaults.baseURL, url, requestParams);
333
- const needsSchemeHeader = ie || useSha256 && isEncryptionEnabled();
334
- const mergedHeaders = {
335
- ...defaults.headers,
336
- ...needsSchemeHeader ? { "X-RSA-Encryption-Scheme": RSA_OAEP_SHA256_SCHEME } : {},
337
- ...requestHeaders
338
- };
339
- const requestBody = prepareBody(body);
340
- const wasmProgress = onUploadProgress ? (progress) => {
341
- if (progress.total > 0) onUploadProgress(Math.round(progress.loaded / progress.total * 100));
342
- } : void 0;
343
- const abortError = new WasmHttpError(0, "Request aborted", fullUrl, upperMethod, {}, null);
344
- if (signal?.aborted) throw abortError;
345
- try {
346
- const response = await withAbortSignal(executeWasmRequest(upperMethod, url, requestBody, mergedHeaders, requestParams, timeout, wasmProgress, ie), signal, abortError);
347
- if (response.status < 200 || response.status >= 300) throw new WasmHttpError(response.status, "", fullUrl, upperMethod, {}, response.data);
348
- return {
349
- ok: true,
350
- status: response.status,
351
- statusText: "",
352
- url: fullUrl,
353
- headers: {},
354
- data: response.data
355
- };
356
- } catch (error) {
357
- if (error instanceof WasmHttpError) throw error;
358
- throw new WasmHttpError(getErrorStatus(error), getErrorMessage(error), fullUrl, upperMethod, {}, getErrorData(error));
359
- }
360
- },
361
- get(url, requestConfig) {
362
- return client.request({
363
- ...requestConfig,
364
- url,
365
- method: "GET"
366
- });
367
- },
368
- post(url, body, requestConfig) {
369
- return client.request({
370
- ...requestConfig,
371
- url,
372
- body,
373
- method: "POST"
374
- });
375
- },
376
- put(url, body, requestConfig) {
377
- return client.request({
378
- ...requestConfig,
379
- url,
380
- body,
381
- method: "PUT"
382
- });
383
- },
384
- patch(url, body, requestConfig) {
385
- return client.request({
386
- ...requestConfig,
387
- url,
388
- body,
389
- method: "PATCH"
390
- });
391
- },
392
- delete(url, requestConfig) {
393
- return client.request({
394
- ...requestConfig,
395
- url,
396
- method: "DELETE"
397
- });
398
- },
399
- head() {
400
- return Promise.reject(/* @__PURE__ */ new Error("HEAD is not supported by the WASM HTTP client"));
401
- },
402
- options() {
403
- return Promise.reject(/* @__PURE__ */ new Error("OPTIONS is not supported by the WASM HTTP client"));
404
- },
405
- setHeader(name, value) {
406
- defaults.headers[name] = value;
407
- }
408
- };
409
- return client;
410
- };
411
- //#endregion
412
- //#region src/internal/http/clientLifecycle.ts
413
- /**
414
- * Wraps the active HttpClient as a transport for the C++ `WebApi` host
415
- * adapter. Lets the on-device face-results POST flow through the same
416
- * `httpClient.request()` pipeline as every other endpoint — header
417
- * injection, encryption-state handling, default headers, timeout — instead
418
- * of bypassing it via `executeWasmRequest` directly.
419
- */
420
- function bindWebApiTransport(client) {
421
- return async (url, body, config) => {
422
- const response = await client.request({
423
- method: "POST",
424
- url,
425
- body,
426
- headers: config.headers,
427
- params: config.params,
428
- timeout: config.timeout,
429
- ie: config.ie
430
- });
431
- return {
432
- data: response.data,
433
- status: response.status
434
- };
435
- };
436
- }
437
- function installClient(client) {
438
- setClient(client);
439
- setWebApiHttpTransport(bindWebApiTransport(client));
440
- }
441
- let storedHttpConfig;
442
- /** Reads the current HTTP-client config (or `undefined` if none installed). */
443
- function getStoredHttpConfig() {
444
- return storedHttpConfig;
445
- }
446
- /** Whether encryption is currently active on the installed HTTP client. */
447
- function isHttpEncrypted() {
448
- return storedHttpConfig?.encryption.enabled ?? false;
449
- }
450
- /** Clears all HTTP-client state. Called by `reset()`. */
451
- function resetHttpClientState() {
452
- storedHttpConfig = void 0;
453
- setWebApiHttpTransport(null);
454
- }
455
- /**
456
- * Builds (or replaces) the HTTP client when `setup()` receives an `apiURL`.
457
- * Picks `createWasmApi` when `effectiveWasm` is set, otherwise plain
458
- * `createApi`. Wraps the call in handshake-failure context when encryption
459
- * is requested.
460
- */
461
- async function installFreshHttpClient(apiURL, options, effectiveWasm, encryption) {
462
- installClient(effectiveWasm ? await withHandshakeFailureContext(encryption.enabled, () => createWasmApi({
463
- apiURL,
464
- customHeaders: options.customHeaders,
465
- timeout: options.timeout,
466
- wasm: effectiveWasm,
467
- encryptionEnabled: encryption.enabled,
468
- mgf1: encryption.mgf1,
469
- isEncryptionEnabled: isHttpEncrypted
470
- })) : createApi({
471
- apiURL,
472
- customHeaders: options.customHeaders,
473
- timeout: options.timeout
474
- }));
475
- storedHttpConfig = {
476
- apiURL,
477
- customHeaders: options.customHeaders,
478
- timeout: options.timeout,
479
- isWasm: Boolean(effectiveWasm),
480
- encryption
481
- };
482
- }
483
- /**
484
- * Replaces the active HTTP client with the WASM-backed one. Used internally
485
- * by lazy-loading UI components (`<incode-flow>`, `<incode-workflow>`) when
486
- * WASM finishes warming up.
487
- *
488
- * No-op when no apiURL was previously configured, or when the active client
489
- * is already WASM-backed. The encryption state (enabled + MGF1 scheme) is
490
- * preserved across the swap — this is *not* a user-facing encryption change.
491
- *
492
- * @internal NOT a public API. Application code should use
493
- * `setup({ wasm: {...} })` instead.
494
- */
495
- async function upgradeToWasmHttpClient(resolved) {
496
- const stored = storedHttpConfig;
497
- if (!stored || stored.isWasm) return;
498
- installClient(await createWasmApi({
499
- apiURL: stored.apiURL,
500
- customHeaders: stored.customHeaders,
501
- timeout: stored.timeout,
502
- wasm: resolved,
503
- encryptionEnabled: stored.encryption.enabled,
504
- mgf1: stored.encryption.mgf1,
505
- isEncryptionEnabled: isHttpEncrypted
506
- }));
507
- storedHttpConfig = {
508
- ...stored,
509
- isWasm: true
510
- };
511
- }
512
- /**
513
- * When `wantsEncryption` is true, wraps a call that triggers the in-binary
514
- * RSA/AES handshake so its rejection surfaces as a single, descriptive error
515
- * with the original error preserved as `cause`. Pass-through otherwise.
516
- */
517
- async function withHandshakeFailureContext(wantsEncryption, fn) {
518
- if (!wantsEncryption) return fn();
519
- try {
520
- return await fn();
521
- } catch (cause) {
522
- const error = /* @__PURE__ */ new Error("Failed to establish encrypted transport. The /e2ee/key handshake did not complete. Verify the apiURL is reachable and that the environment supports E2EE.");
523
- error.cause = cause;
524
- throw error;
525
- }
526
- }
527
- //#endregion
528
- export { createApi as a, upgradeToWasmHttpClient as i, installFreshHttpClient as n, resetHttpClientState as r, getStoredHttpConfig as t };
@@ -1 +0,0 @@
1
- import "./sessionInitializer-CgjN51b2.esm.js";
@@ -1,6 +0,0 @@
1
- import { i as FlowModuleConfig } from "./types-NSJbROLr.js";
2
- import { t as BaseFaceCaptureConfig } from "./types-BK-v1UYb.js";
3
- //#region src/modules/authentication/types.d.ts
4
- type AuthenticationConfig = FlowModuleConfig['AUTHENTICATION'] & BaseFaceCaptureConfig;
5
- //#endregion
6
- export { AuthenticationConfig as t };