@incodetech/core 2.0.0 → 2.0.1-rc.0

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 (178) hide show
  1. package/dist/Actor-CI32dTbG.d.ts +2 -0
  2. package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
  3. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
  4. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
  5. package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
  6. package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
  7. package/dist/Manager-C8PrhBOx.d.ts +19 -0
  8. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  9. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  10. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  11. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  12. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  13. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  14. package/dist/ae-signature.d.ts +25 -0
  15. package/dist/ae-signature.esm.js +8 -0
  16. package/dist/antifraud.d.ts +57 -0
  17. package/dist/antifraud.esm.js +45 -0
  18. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  19. package/dist/api-CESGtpbH.esm.js +53 -0
  20. package/dist/authentication.d.ts +12 -0
  21. package/dist/authentication.esm.js +25 -0
  22. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  23. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  24. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  25. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  26. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  27. package/dist/camera-DBSxa6ML.d.ts +4 -0
  28. package/dist/camera-PA2Ljri3.esm.js +22 -0
  29. package/dist/camera.d.ts +15 -0
  30. package/dist/camera.esm.js +5 -0
  31. package/dist/chunk-CRF6K_H_.esm.js +49 -0
  32. package/dist/consent.d.ts +398 -0
  33. package/dist/consent.esm.js +79 -0
  34. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  35. package/dist/cpf-PPz2Njto.esm.js +38 -0
  36. package/dist/cpf-ocr.d.ts +204 -0
  37. package/dist/cpf-ocr.esm.js +177 -0
  38. package/dist/cross-document-data-match.d.ts +34 -0
  39. package/dist/cross-document-data-match.esm.js +71 -0
  40. package/dist/curp-validation.d.ts +188 -0
  41. package/dist/curp-validation.esm.js +110 -0
  42. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  43. package/dist/custom-fields.d.ts +115 -0
  44. package/dist/custom-fields.esm.js +177 -0
  45. package/dist/custom-watchlist.d.ts +66 -0
  46. package/dist/custom-watchlist.esm.js +86 -0
  47. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  48. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  49. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  50. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  51. package/dist/device.d.ts +46 -0
  52. package/dist/device.esm.js +106 -0
  53. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  54. package/dist/document-capture.d.ts +906 -0
  55. package/dist/document-capture.esm.js +156 -0
  56. package/dist/document-upload.d.ts +331 -0
  57. package/dist/document-upload.esm.js +203 -0
  58. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  59. package/dist/dynamic-forms.d.ts +178 -0
  60. package/dist/dynamic-forms.esm.js +323 -0
  61. package/dist/ekyb.d.ts +148 -0
  62. package/dist/ekyb.esm.js +127 -0
  63. package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
  64. package/dist/ekyc.d.ts +164 -0
  65. package/dist/ekyc.esm.js +104 -0
  66. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  67. package/dist/electronic-signature.d.ts +4 -0
  68. package/dist/electronic-signature.esm.js +7 -0
  69. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  70. package/dist/email.d.ts +4 -0
  71. package/dist/email.esm.js +9 -0
  72. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  73. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  74. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  75. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  76. package/dist/events-D6-e4vok.esm.js +596 -0
  77. package/dist/events.d.ts +265 -0
  78. package/dist/events.esm.js +4 -0
  79. package/dist/extensibility.d.ts +122 -0
  80. package/dist/extensibility.esm.js +43 -0
  81. package/dist/face-match.d.ts +228 -0
  82. package/dist/face-match.esm.js +173 -0
  83. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  84. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  85. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  86. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  87. package/dist/flow-events.d.ts +6 -0
  88. package/dist/flow-events.esm.js +0 -0
  89. package/dist/flow.d.ts +358 -0
  90. package/dist/flow.esm.js +825 -0
  91. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  92. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  93. package/dist/flowServices-DG3IdWw6.esm.js +188 -0
  94. package/dist/geolocation.d.ts +127 -0
  95. package/dist/geolocation.esm.js +89 -0
  96. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  97. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  98. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  99. package/dist/government-validation.d.ts +67 -0
  100. package/dist/government-validation.esm.js +81 -0
  101. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  102. package/dist/home.d.ts +99 -0
  103. package/dist/home.esm.js +61 -0
  104. package/dist/http.d.ts +68 -0
  105. package/dist/http.esm.js +3 -0
  106. package/dist/id-ocr.d.ts +635 -0
  107. package/dist/id-ocr.esm.js +86 -0
  108. package/dist/id-verification.d.ts +190 -0
  109. package/dist/id-verification.esm.js +43 -0
  110. package/dist/id.d.ts +24 -0
  111. package/dist/id.esm.js +164 -0
  112. package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
  113. package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
  114. package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
  115. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  116. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  117. package/dist/identity-reuse.d.ts +530 -0
  118. package/dist/identity-reuse.esm.js +274 -0
  119. package/dist/index-BcRG8rtJ.d.ts +97 -0
  120. package/dist/index-DZoqeAo9.d.ts +1177 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.esm.js +12 -0
  123. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  124. package/dist/lib-BB0B_qQX.esm.js +12499 -0
  125. package/dist/mandatory-consent.d.ts +412 -0
  126. package/dist/mandatory-consent.esm.js +78 -0
  127. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  128. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  129. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  130. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  131. package/dist/phone.d.ts +4 -0
  132. package/dist/phone.esm.js +9 -0
  133. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  134. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  135. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  136. package/dist/platform-CfrjKhmi.esm.js +83 -0
  137. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  138. package/dist/qe-signature.d.ts +25 -0
  139. package/dist/qe-signature.esm.js +8 -0
  140. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  141. package/dist/redirect-to-mobile.d.ts +107 -0
  142. package/dist/redirect-to-mobile.esm.js +102 -0
  143. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  144. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  145. package/dist/selfie.d.ts +26 -0
  146. package/dist/selfie.esm.js +146 -0
  147. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  148. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  149. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  150. package/dist/session-CGtQJJzB.esm.js +3206 -0
  151. package/dist/session.d.ts +217 -0
  152. package/dist/session.esm.js +9 -0
  153. package/dist/setup-C5AITV8m.d.ts +254 -0
  154. package/dist/setup-DsM8IG7k.esm.js +887 -0
  155. package/dist/signature.d.ts +94 -0
  156. package/dist/signature.esm.js +66 -0
  157. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  158. package/dist/stats-CIfiPzb1.esm.js +16 -0
  159. package/dist/stats.d.ts +16 -0
  160. package/dist/stats.esm.js +4 -0
  161. package/dist/trust-graph.d.ts +54 -0
  162. package/dist/trust-graph.esm.js +56 -0
  163. package/dist/types-B06Ypu2F.d.ts +49 -0
  164. package/dist/types-BP1m8VRw.d.ts +340 -0
  165. package/dist/types-CAD4va6a.d.ts +5 -0
  166. package/dist/types-CFV9G_7j.d.ts +24 -0
  167. package/dist/warmup-CEcppFiS.d.ts +63 -0
  168. package/dist/wasm.d.ts +15 -0
  169. package/dist/wasm.esm.js +12 -0
  170. package/dist/watchlist-for-business.d.ts +79 -0
  171. package/dist/watchlist-for-business.esm.js +148 -0
  172. package/dist/watchlist.d.ts +62 -0
  173. package/dist/watchlist.esm.js +86 -0
  174. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  175. package/dist/workflow.d.ts +907 -0
  176. package/dist/workflow.esm.js +702 -0
  177. package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
  178. package/package.json +1 -1
@@ -0,0 +1,489 @@
1
+ import { t as api } from "./api-CESGtpbH.esm.js";
2
+ import { t as isBrowserSimulation } from "./browserSimulation-gxD8cSpM.esm.js";
3
+ import { i as stopCameraStream, r as requestCameraAccess } from "./camera-PA2Ljri3.esm.js";
4
+ import { n as getDeviceInfo, t as getUserAgent } from "./getBrowser-BSXUTWXw.esm.js";
5
+ import { t as addDeviceStats } from "./stats-CIfiPzb1.esm.js";
6
+
7
+ //#region ../infra/src/media/canvas.ts
8
+ /**
9
+ * Class representing a canvas element for image capture and manipulation.
10
+ */
11
+ var IncodeCanvas = class IncodeCanvas {
12
+ /**
13
+ * Creates an {@link IncodeCanvas} from a raw {@link ImageData} frame.
14
+ * @param imageData - Frame pixels in RGBA format
15
+ * @returns An {@link IncodeCanvas} containing the provided pixels
16
+ */
17
+ static fromImageData(imageData) {
18
+ const canvas = document.createElement("canvas");
19
+ canvas.width = imageData.width;
20
+ canvas.height = imageData.height;
21
+ const context = canvas.getContext("2d", { willReadFrequently: true });
22
+ if (!context) return new IncodeCanvas(canvas);
23
+ if ("putImageData" in context) context.putImageData(imageData, 0, 0);
24
+ return new IncodeCanvas(canvas);
25
+ }
26
+ /**
27
+ * Create a new canvas element.
28
+ * @param canvas_ - The canvas element to clone.
29
+ */
30
+ constructor(canvas_) {
31
+ this.base64Image = null;
32
+ this.blobData = null;
33
+ this.canvas = document.createElement("canvas");
34
+ this.canvas.width = canvas_.width;
35
+ this.canvas.height = canvas_.height;
36
+ const context = this.canvas.getContext("2d");
37
+ if (context) context.drawImage(canvas_, 0, 0);
38
+ }
39
+ /**
40
+ * Check if the current canvas is valid.
41
+ */
42
+ checkCanvas() {
43
+ return this.canvas && this.canvas.width > 1 && this.canvas.height > 1;
44
+ }
45
+ /**
46
+ * Disposes of resources, including revoking object URLs to prevent memory leaks.
47
+ */
48
+ dispose() {
49
+ if (this.blobData?.url) {
50
+ URL.revokeObjectURL(this.blobData.url);
51
+ this.blobData = null;
52
+ }
53
+ this.base64Image = null;
54
+ }
55
+ /**
56
+ * Release the data stored by IncodeCanvas.
57
+ */
58
+ release() {
59
+ if (!this.checkCanvas()) return;
60
+ this.canvas.width = 1;
61
+ this.canvas.height = 1;
62
+ this.canvas.getContext("2d")?.clearRect(0, 0, 1, 1);
63
+ this.base64Image = null;
64
+ if (this.blobData?.url) URL.revokeObjectURL(this.blobData.url);
65
+ this.blobData = null;
66
+ }
67
+ /**
68
+ * Revokes the object URL if one exists, preventing memory leaks.
69
+ * Use this when you no longer need the preview image URL.
70
+ */
71
+ revokeObjectURL() {
72
+ if (this.blobData?.url) {
73
+ URL.revokeObjectURL(this.blobData.url);
74
+ this.blobData = {
75
+ ...this.blobData,
76
+ url: ""
77
+ };
78
+ }
79
+ }
80
+ /**
81
+ * Get the width of the canvas.
82
+ */
83
+ width() {
84
+ if (!this.checkCanvas()) return null;
85
+ return this.canvas.width;
86
+ }
87
+ /**
88
+ * Get the height of the canvas.
89
+ */
90
+ height() {
91
+ if (!this.checkCanvas()) return null;
92
+ return this.canvas.height;
93
+ }
94
+ /**
95
+ * Set the width of the canvas.
96
+ */
97
+ setWidth(width) {
98
+ if (!this.checkCanvas()) return;
99
+ this.canvas.width = width;
100
+ }
101
+ /**
102
+ * Set the height of the canvas.
103
+ */
104
+ setHeight(height) {
105
+ if (!this.checkCanvas()) return;
106
+ this.canvas.height = height;
107
+ }
108
+ /**
109
+ * Clone the current canvas.
110
+ */
111
+ clone() {
112
+ if (!this.checkCanvas()) return null;
113
+ const cloned = new IncodeCanvas(this.canvas);
114
+ cloned.setBase64Image(this.base64Image);
115
+ return cloned;
116
+ }
117
+ /**
118
+ * Deep clone the current IncodeCanvas including blob data.
119
+ */
120
+ async deepClone() {
121
+ const cloned = this.clone();
122
+ if (!cloned) return null;
123
+ if (this.blobData) await cloned.setBlobData(this.blobData);
124
+ return cloned;
125
+ }
126
+ /**
127
+ * Returns the drawing context on the canvas.
128
+ */
129
+ getContext(contextId, contextAttributes) {
130
+ if (!this.checkCanvas()) return null;
131
+ const context = this.canvas.getContext(contextId, contextAttributes);
132
+ return context instanceof CanvasRenderingContext2D ? context : null;
133
+ }
134
+ /**
135
+ * Retrieves the image data from the canvas.
136
+ */
137
+ getImageData() {
138
+ if (!this.checkCanvas()) return null;
139
+ const context = this.canvas.getContext("2d", { willReadFrequently: true });
140
+ if (!context) return null;
141
+ return context.getImageData(0, 0, this.canvas.width, this.canvas.height);
142
+ }
143
+ /**
144
+ * Updates the base64 representation of the current canvas image.
145
+ */
146
+ updateBase64Image(jpegQuality = 1) {
147
+ if (!this.checkCanvas()) return;
148
+ this.base64Image = this.canvas.toDataURL("image/jpeg", jpegQuality);
149
+ }
150
+ /**
151
+ * Converts the current canvas element to a base64 string.
152
+ */
153
+ getBase64Image(jpegQuality = 1, includeDataURLPrefix = false) {
154
+ if (!this.checkCanvas()) return null;
155
+ if (this.base64Image === null) this.updateBase64Image(jpegQuality);
156
+ const base64Image = this.base64Image;
157
+ if (base64Image === null) return null;
158
+ if (includeDataURLPrefix) return base64Image;
159
+ const commaIndex = base64Image.indexOf(",");
160
+ if (commaIndex === -1) return base64Image;
161
+ return base64Image.slice(commaIndex + 1);
162
+ }
163
+ /**
164
+ * Sets the base64 representation of the current canvas image.
165
+ */
166
+ setBase64Image(base64Image) {
167
+ this.base64Image = base64Image;
168
+ }
169
+ /**
170
+ * Updates the Blob representation of the current canvas image.
171
+ */
172
+ updateBlob(jpegQuality = 1, includeDataURLPrefix = false) {
173
+ if (!this.checkCanvas()) return;
174
+ if (this.base64Image === null) this.updateBase64Image(jpegQuality);
175
+ const base64 = this.getBase64Image(jpegQuality, includeDataURLPrefix);
176
+ if (base64) this.blobData = IncodeCanvas.base64ToBlob(base64);
177
+ }
178
+ /**
179
+ * Converts a base64 string to a Blob and creates a URL for it.
180
+ */
181
+ static base64ToBlob(base64) {
182
+ try {
183
+ const binary = atob(base64);
184
+ const array = [];
185
+ for (let i = 0; i < binary.length; i++) array.push(binary.charCodeAt(i));
186
+ const blob = new Blob([new Uint8Array(array)]);
187
+ return {
188
+ blob,
189
+ url: URL.createObjectURL(blob)
190
+ };
191
+ } catch (error) {
192
+ console.error("Failed to convert base64 string to Blob:", error);
193
+ }
194
+ return null;
195
+ }
196
+ /**
197
+ * Retrieves the Blob data and its URL from the current canvas.
198
+ */
199
+ getBlobData(jpegQuality = 1, includeDataURLPrefix = false) {
200
+ if (!this.checkCanvas()) return null;
201
+ if (this.blobData === null) this.updateBlob(jpegQuality, includeDataURLPrefix);
202
+ return this.blobData;
203
+ }
204
+ /**
205
+ * Sets the Blob data of the current canvas image.
206
+ */
207
+ async setBlobData(blobData) {
208
+ const blobDataArrayBuffer = await blobData.blob.arrayBuffer();
209
+ this.blobData = {
210
+ blob: new Blob([blobDataArrayBuffer], { type: blobData.blob.type }),
211
+ url: blobData.url
212
+ };
213
+ }
214
+ /**
215
+ * Returns a resized canvas according to video element size.
216
+ */
217
+ getResizedCanvas(videoElementWidth, videoElementHeight) {
218
+ if (!this.checkCanvas()) return null;
219
+ const cameraOffsetX = Math.abs(videoElementWidth - window.innerWidth);
220
+ const resized = new IncodeCanvas(document.createElement("canvas"));
221
+ const canvasHeight = this.height();
222
+ if (!canvasHeight) return null;
223
+ const ratio = canvasHeight / videoElementHeight;
224
+ const newWidth = window.innerWidth;
225
+ const newHeight = window.innerHeight;
226
+ resized.setWidth(newWidth);
227
+ resized.setHeight(newHeight);
228
+ const context = resized.getContext("2d");
229
+ if (!context) return null;
230
+ context.drawImage(this.canvas, ratio * cameraOffsetX / 2, 0, ratio * newWidth, ratio * newHeight, 0, 0, newWidth, newHeight);
231
+ return resized;
232
+ }
233
+ };
234
+
235
+ //#endregion
236
+ //#region ../infra/src/media/video.ts
237
+ /**
238
+ * Creates a hidden video element for a stream and appends it to document.body.
239
+ */
240
+ function createHiddenVideoElement(stream) {
241
+ if (typeof document === "undefined") throw new Error("Document not available");
242
+ const video = document.createElement("video");
243
+ video.autoplay = true;
244
+ video.playsInline = true;
245
+ video.muted = true;
246
+ video.srcObject = stream;
247
+ video.style.width = "0px";
248
+ video.style.height = "0px";
249
+ video.style.position = "absolute";
250
+ video.style.top = "0";
251
+ video.style.left = "0";
252
+ video.style.zIndex = "-1";
253
+ document.body.appendChild(video);
254
+ return {
255
+ element: video,
256
+ dispose: () => {
257
+ video.srcObject = null;
258
+ if (video.parentElement) video.parentElement.removeChild(video);
259
+ }
260
+ };
261
+ }
262
+
263
+ //#endregion
264
+ //#region src/internal/deepsight/metadataService.ts
265
+ function createMetadataService(wasmUtil, visibility, browserEnv, ipLookup) {
266
+ return {
267
+ async initialize(sdkVersion, disableIpify = false) {
268
+ wasmUtil.setSdkPlatform("WEBAPP");
269
+ wasmUtil.setSdkVersion(sdkVersion);
270
+ const ua = getUserAgent();
271
+ const isMobile = /Android|iPhone|iPad|iPod/i.test(ua);
272
+ const deviceInfo = getDeviceInfo();
273
+ const visitorId = browserEnv.generateCanvasFingerprint();
274
+ const ip = disableIpify ? "" : await ipLookup.getIp();
275
+ const screenDimensions = browserEnv.getScreenDimensions();
276
+ const deviceMetadata = {
277
+ kind: isMobile ? "mobile" : "desktop",
278
+ model: "",
279
+ os: void 0,
280
+ osVersion: void 0,
281
+ screenDimensions,
282
+ numTouchPoints: deviceInfo.maxTouchPoints,
283
+ fingerprintHash: visitorId,
284
+ ip,
285
+ backgroundMode: false
286
+ };
287
+ wasmUtil.setDeviceInfo(deviceMetadata);
288
+ const navigatorPrefixes = browserEnv.getNavigatorPrefixes();
289
+ const browserInfo = {
290
+ userAgent: ua,
291
+ getUserMediaAvailability: {
292
+ webkit: navigatorPrefixes.webkit,
293
+ moz: navigatorPrefixes.moz,
294
+ o: navigatorPrefixes.o,
295
+ ms: navigatorPrefixes.ms
296
+ },
297
+ webglFingerprint: browserEnv.getWebGLRenderer(),
298
+ inspectorOpened: false,
299
+ isMockedBrowser: isBrowserSimulation(browserEnv)
300
+ };
301
+ wasmUtil.setBrowserInfo(browserInfo, false);
302
+ },
303
+ updateCameraInfo(videoTrack) {
304
+ const settings = videoTrack.getSettings();
305
+ const capabilities = videoTrack.getCapabilities?.() ?? {};
306
+ const labels = videoTrack.label ? [videoTrack.label] : [];
307
+ const cameraInfo = {
308
+ facingMode: settings.facingMode === "user" ? "frontal" : settings.facingMode === "environment" ? "back" : settings.facingMode || "unknown",
309
+ settings,
310
+ capabilities,
311
+ labels
312
+ };
313
+ wasmUtil.setCameraInfo(cameraInfo);
314
+ },
315
+ async checkForVirtualCameraByLabel(videoTrack = null) {
316
+ try {
317
+ if (!videoTrack) {
318
+ const labels = await browserEnv.enumerateVideoDeviceLabels();
319
+ for (const label of labels) if (wasmUtil.isVirtualCamera(label)) return true;
320
+ }
321
+ if (videoTrack && wasmUtil.isVirtualCamera(videoTrack.label)) return true;
322
+ return false;
323
+ } catch {
324
+ return false;
325
+ }
326
+ },
327
+ async analyzeFrame(imageData) {
328
+ await wasmUtil.analyzeFrame(imageData);
329
+ },
330
+ setMotionStatus(status) {
331
+ wasmUtil.setMotionStatus(status);
332
+ },
333
+ setBackgroundMode(backgroundMode) {
334
+ wasmUtil.setBackgroundMode(backgroundMode || visibility.wasBackgrounded);
335
+ visibility.reset();
336
+ },
337
+ estimatePerformance() {
338
+ return wasmUtil.estimatePerformance();
339
+ },
340
+ getMetadata() {
341
+ return wasmUtil.getMetadata();
342
+ },
343
+ getCheck() {
344
+ return wasmUtil.getCheck();
345
+ },
346
+ getPipelineState() {
347
+ return wasmUtil.getPipelineState();
348
+ },
349
+ preparePipelineState() {
350
+ wasmUtil.getPipelineState();
351
+ }
352
+ };
353
+ }
354
+
355
+ //#endregion
356
+ //#region src/internal/deepsight/motionStatusService.ts
357
+ function createMotionStatusService(motionSensor) {
358
+ return {
359
+ async requestPermission() {
360
+ return motionSensor.requestPermission();
361
+ },
362
+ async start() {
363
+ await motionSensor.start();
364
+ },
365
+ stop() {
366
+ motionSensor.stop();
367
+ },
368
+ check() {
369
+ return motionSensor.check();
370
+ },
371
+ get isRunning() {
372
+ return motionSensor.isRunning;
373
+ },
374
+ get hasPermission() {
375
+ return motionSensor.hasPermission;
376
+ }
377
+ };
378
+ }
379
+
380
+ //#endregion
381
+ //#region src/internal/virtualCameraCheck.ts
382
+ /**
383
+ * Sends the analyzed frame image to the backend for logging.
384
+ */
385
+ async function logFrame({ source, base64Image, token }) {
386
+ try {
387
+ return (await api.post("/omni/log/frame/v2", { base64Image }, {
388
+ query: { source },
389
+ headers: { "X-Incode-Hardware-Id": token }
390
+ })).data;
391
+ } catch {
392
+ return;
393
+ }
394
+ }
395
+ /**
396
+ * Runs the WASM virtual camera check and handles logging and stats.
397
+ */
398
+ async function runVirtualCameraCheck({ wasmUtil, source, token }) {
399
+ const output = {
400
+ canvas: null,
401
+ itr: null,
402
+ skipped: null
403
+ };
404
+ await wasmUtil.poc(output);
405
+ if (output.skipped !== false) return;
406
+ if (output.canvas && token) {
407
+ const base64Image = new IncodeCanvas(output.canvas).getBase64Image();
408
+ if (base64Image) await logFrame({
409
+ source,
410
+ base64Image,
411
+ token
412
+ });
413
+ }
414
+ if (output.itr === true) {
415
+ addDeviceStats({ virtualCameraDetected: true });
416
+ wasmUtil.setZc("FAIL");
417
+ } else if (output.itr === false) wasmUtil.setZc("PASS");
418
+ }
419
+
420
+ //#endregion
421
+ //#region src/internal/deepsight/deepsightService.ts
422
+ function createDeepsightService(config) {
423
+ const metadata = createMetadataService(config.wasmUtil, config.visibility, config.browserEnv, config.ipLookup);
424
+ const motion = createMotionStatusService(config.motionSensor);
425
+ return {
426
+ metadata,
427
+ motion,
428
+ async initialize(disableIpify = false) {
429
+ await metadata.initialize(config.sdkVersion, disableIpify);
430
+ metadata.estimatePerformance();
431
+ },
432
+ async requestMotionPermission() {
433
+ return motion.requestPermission();
434
+ },
435
+ async startMotionSensors() {
436
+ await motion.start();
437
+ },
438
+ stopMotionSensors() {
439
+ motion.stop();
440
+ },
441
+ async checkVirtualCamera(videoTrack) {
442
+ metadata.updateCameraInfo(videoTrack);
443
+ return metadata.checkForVirtualCameraByLabel(videoTrack);
444
+ },
445
+ async performVirtualCameraCheck(sessionToken, source) {
446
+ await runVirtualCameraCheck({
447
+ wasmUtil: config.wasmUtil,
448
+ source,
449
+ token: sessionToken
450
+ });
451
+ },
452
+ async performPrcCheck(params) {
453
+ const prcStream = await requestCameraAccess(params.constraints);
454
+ const hiddenVideo = createHiddenVideoElement(prcStream);
455
+ try {
456
+ await config.wasmUtil.prc();
457
+ } finally {
458
+ hiddenVideo.dispose();
459
+ stopCameraStream(prcStream);
460
+ }
461
+ },
462
+ async analyzeFrame(imageData) {
463
+ await metadata.analyzeFrame(imageData);
464
+ metadata.preparePipelineState();
465
+ const motionStatus = motion.check();
466
+ metadata.setMotionStatus(motionStatus);
467
+ metadata.getCheck();
468
+ metadata.setBackgroundMode(false);
469
+ },
470
+ getMetadata() {
471
+ return metadata.getMetadata();
472
+ },
473
+ getMotionStatus() {
474
+ return motion.check();
475
+ },
476
+ getAnalysisStatus() {
477
+ return metadata.getCheck();
478
+ },
479
+ getPipelineState() {
480
+ return metadata.getPipelineState();
481
+ },
482
+ cleanup() {
483
+ motion.stop();
484
+ }
485
+ };
486
+ }
487
+
488
+ //#endregion
489
+ export { IncodeCanvas as n, createDeepsightService as t };
@@ -0,0 +1,46 @@
1
+ //#region ../infra/src/capabilities/platform.d.ts
2
+
3
+ declare function isIPad(userAgent?: string): boolean;
4
+ //#endregion
5
+ //#region ../infra/src/capabilities/IScreenOrientationCapability.d.ts
6
+ type ScreenOrientationState = 'portrait' | 'landscape';
7
+ type IScreenOrientationCapability = {
8
+ readonly current: ScreenOrientationState;
9
+ subscribe(callback: (state: ScreenOrientationState) => void): () => void;
10
+ cleanup(): void;
11
+ };
12
+ //#endregion
13
+ //#region ../infra/src/providers/browser/ScreenOrientationProvider.d.ts
14
+ declare class ScreenOrientationProvider implements IScreenOrientationCapability {
15
+ private _current;
16
+ private subscribers;
17
+ private orientationChangeHandler;
18
+ private resizeHandler;
19
+ private mediaQueryList;
20
+ private mediaQueryHandler;
21
+ constructor();
22
+ get current(): ScreenOrientationState;
23
+ subscribe(callback: (state: ScreenOrientationState) => void): () => void;
24
+ cleanup(): void;
25
+ private handleOrientationChange;
26
+ private handleResize;
27
+ private updateState;
28
+ }
29
+ //#endregion
30
+ //#region src/internal/device/getBrowser.d.ts
31
+ type Browser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'opera' | 'other' | 'samsung_browser';
32
+ declare function getBrowser(): Browser;
33
+ //#endregion
34
+ //#region src/internal/device/getDeviceClass.d.ts
35
+ type DeviceClass = 'ios' | 'android' | 'desktop';
36
+ declare function getDeviceClass(): DeviceClass;
37
+ //#endregion
38
+ //#region src/internal/device/screenOrientation.d.ts
39
+ type ScreenOrientationObserver = {
40
+ get isLandscapeMobile(): boolean;
41
+ subscribe(callback: (isLandscapeMobile: boolean) => void): () => void;
42
+ cleanup(): void;
43
+ };
44
+ declare function createScreenOrientationObserver(provider: IScreenOrientationCapability, deviceClass: DeviceClass): ScreenOrientationObserver;
45
+ //#endregion
46
+ export { type Browser, type DeviceClass, type ScreenOrientationObserver, ScreenOrientationProvider, createScreenOrientationObserver, getBrowser, getDeviceClass, isIPad };
@@ -0,0 +1,106 @@
1
+ import { i as isIPad } from "./platform-CfrjKhmi.esm.js";
2
+ import { t as getUserAgent } from "./getBrowser-BSXUTWXw.esm.js";
3
+ import { t as getDeviceClass } from "./getDeviceClass-BSntT9_j.esm.js";
4
+
5
+ //#region src/internal/device/getBrowser.ts
6
+ function getBrowser() {
7
+ const userAgent = getUserAgent();
8
+ if (!userAgent) return "other";
9
+ const ua = userAgent.toLowerCase();
10
+ if (ua.includes("edg/") || ua.includes("edgios/")) return "edge";
11
+ if (ua.includes("samsungbrowser/")) return "samsung_browser";
12
+ if (ua.includes("opr/") || ua.includes("opera") || ua.includes("opios/") || ua.includes("opt/")) return "opera";
13
+ if (ua.includes("chrome") || ua.includes("crios")) return "chrome";
14
+ if (ua.includes("firefox") || ua.includes("fxios")) return "firefox";
15
+ if (ua.includes("safari")) return "safari";
16
+ return "other";
17
+ }
18
+
19
+ //#endregion
20
+ //#region src/internal/device/screenOrientation.ts
21
+ function createScreenOrientationObserver(provider, deviceClass) {
22
+ const getIsLandscapeMobile = () => deviceClass !== "desktop" && !isIPad() && provider.current === "landscape";
23
+ return {
24
+ get isLandscapeMobile() {
25
+ return getIsLandscapeMobile();
26
+ },
27
+ subscribe(callback) {
28
+ return provider.subscribe(() => {
29
+ callback(getIsLandscapeMobile());
30
+ });
31
+ },
32
+ cleanup: () => provider.cleanup()
33
+ };
34
+ }
35
+
36
+ //#endregion
37
+ //#region ../infra/src/providers/browser/ScreenOrientationProvider.ts
38
+ function isPortrait() {
39
+ if (typeof window === "undefined" || typeof screen === "undefined") return true;
40
+ if (typeof window.matchMedia === "function") return !window.matchMedia("(orientation: landscape)").matches;
41
+ if (screen.orientation?.type?.includes("portrait")) return true;
42
+ if (screen.orientation?.type?.includes("landscape")) return false;
43
+ const orientation = window.orientation;
44
+ if (typeof orientation === "number") return Math.abs(orientation) === 0;
45
+ return window.innerHeight >= window.innerWidth;
46
+ }
47
+ function toState(portrait) {
48
+ return portrait ? "portrait" : "landscape";
49
+ }
50
+ var ScreenOrientationProvider = class {
51
+ constructor() {
52
+ this._current = toState(isPortrait());
53
+ this.subscribers = /* @__PURE__ */ new Set();
54
+ this.orientationChangeHandler = this.handleOrientationChange.bind(this);
55
+ this.resizeHandler = this.handleResize.bind(this);
56
+ this.mediaQueryList = null;
57
+ this.mediaQueryHandler = this.handleResize.bind(this);
58
+ if (typeof window === "undefined") return;
59
+ if (screen.orientation) screen.orientation.addEventListener("change", this.orientationChangeHandler);
60
+ else window.addEventListener("orientationchange", this.orientationChangeHandler);
61
+ window.addEventListener("resize", this.resizeHandler);
62
+ if (typeof window.matchMedia === "function") {
63
+ this.mediaQueryList = window.matchMedia("(orientation: landscape)");
64
+ this.mediaQueryList.addEventListener("change", this.mediaQueryHandler);
65
+ }
66
+ }
67
+ get current() {
68
+ return this._current;
69
+ }
70
+ subscribe(callback) {
71
+ this.subscribers.add(callback);
72
+ callback(this._current);
73
+ return () => {
74
+ this.subscribers.delete(callback);
75
+ };
76
+ }
77
+ cleanup() {
78
+ if (typeof window === "undefined") return;
79
+ if (screen.orientation) screen.orientation.removeEventListener("change", this.orientationChangeHandler);
80
+ else window.removeEventListener("orientationchange", this.orientationChangeHandler);
81
+ window.removeEventListener("resize", this.resizeHandler);
82
+ this.mediaQueryList?.removeEventListener("change", this.mediaQueryHandler);
83
+ this.mediaQueryList = null;
84
+ this.subscribers.clear();
85
+ }
86
+ handleOrientationChange() {
87
+ setTimeout(() => {
88
+ this.updateState();
89
+ if (document.activeElement instanceof HTMLElement) document.activeElement.blur();
90
+ window.focus();
91
+ }, 0);
92
+ }
93
+ handleResize() {
94
+ this.updateState();
95
+ }
96
+ updateState() {
97
+ const next = toState(isPortrait());
98
+ if (next !== this._current) {
99
+ this._current = next;
100
+ for (const cb of this.subscribers) cb(this._current);
101
+ }
102
+ }
103
+ };
104
+
105
+ //#endregion
106
+ export { ScreenOrientationProvider, createScreenOrientationObserver, getBrowser, getDeviceClass, isIPad };
@@ -0,0 +1,39 @@
1
+ //#region src/shared/types.d.ts
2
+ /** A single form field definition for dynamic rendering. */
3
+ type FieldDef = {
4
+ name: string;
5
+ type: 'text' | 'tel' | 'date' | 'dropdown' | 'phone' | 'radio';
6
+ label: string;
7
+ displayLabel?: string;
8
+ placeholder?: string;
9
+ placeholderParams?: Record<string, string>;
10
+ required: boolean;
11
+ optional?: boolean;
12
+ maxLength?: number;
13
+ options?: {
14
+ value: string;
15
+ label: string;
16
+ }[];
17
+ readonly?: boolean;
18
+ section?: string;
19
+ disableCountrySelector?: boolean;
20
+ };
21
+ /** An address suggestion returned by the address autocomplete API. */
22
+ type AddressSuggestion = {
23
+ id: string | number;
24
+ label: string;
25
+ street?: string;
26
+ city?: string;
27
+ stateCode?: string;
28
+ postalCode?: string;
29
+ houseNumber?: string;
30
+ countryCode?: string;
31
+ };
32
+ //#endregion
33
+ //#region src/shared/displayErrors.d.ts
34
+ type DisplayErrorsResult = {
35
+ displayErrors: Record<string, string>;
36
+ errorParams: Record<string, Record<string, string | number>>;
37
+ };
38
+ //#endregion
39
+ export { AddressSuggestion as n, FieldDef as r, DisplayErrorsResult as t };