@incodetech/core 2.0.0-rc.0 → 2.0.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/package.json +3 -3
  2. package/dist/Actor-CI32dTbG.d.ts +0 -2
  3. package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
  4. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
  5. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
  6. package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
  7. package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
  8. package/dist/Manager-C8PrhBOx.d.ts +0 -19
  9. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
  10. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
  11. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  12. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  13. package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
  14. package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
  15. package/dist/ae-signature.d.ts +0 -25
  16. package/dist/ae-signature.esm.js +0 -8
  17. package/dist/antifraud.d.ts +0 -57
  18. package/dist/antifraud.esm.js +0 -45
  19. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
  20. package/dist/api-CESGtpbH.esm.js +0 -53
  21. package/dist/authentication.d.ts +0 -12
  22. package/dist/authentication.esm.js +0 -25
  23. package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
  24. package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
  25. package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
  26. package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
  27. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  28. package/dist/camera-DBSxa6ML.d.ts +0 -4
  29. package/dist/camera-PA2Ljri3.esm.js +0 -22
  30. package/dist/camera.d.ts +0 -15
  31. package/dist/camera.esm.js +0 -5
  32. package/dist/chunk-CRF6K_H_.esm.js +0 -49
  33. package/dist/consent.d.ts +0 -398
  34. package/dist/consent.esm.js +0 -79
  35. package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
  36. package/dist/cpf-PPz2Njto.esm.js +0 -38
  37. package/dist/cpf-ocr.d.ts +0 -204
  38. package/dist/cpf-ocr.esm.js +0 -177
  39. package/dist/cross-document-data-match.d.ts +0 -34
  40. package/dist/cross-document-data-match.esm.js +0 -71
  41. package/dist/curp-validation.d.ts +0 -188
  42. package/dist/curp-validation.esm.js +0 -110
  43. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
  44. package/dist/custom-fields.d.ts +0 -115
  45. package/dist/custom-fields.esm.js +0 -177
  46. package/dist/custom-watchlist.d.ts +0 -66
  47. package/dist/custom-watchlist.esm.js +0 -86
  48. package/dist/dateUtils-UoN5xswP.esm.js +0 -23
  49. package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
  50. package/dist/deepsightService-CEVxzehb.d.ts +0 -412
  51. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  52. package/dist/device.d.ts +0 -46
  53. package/dist/device.esm.js +0 -106
  54. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  55. package/dist/document-capture.d.ts +0 -906
  56. package/dist/document-capture.esm.js +0 -156
  57. package/dist/document-upload.d.ts +0 -331
  58. package/dist/document-upload.esm.js +0 -203
  59. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
  60. package/dist/dynamic-forms.d.ts +0 -178
  61. package/dist/dynamic-forms.esm.js +0 -323
  62. package/dist/ekyb.d.ts +0 -148
  63. package/dist/ekyb.esm.js +0 -127
  64. package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
  65. package/dist/ekyc.d.ts +0 -164
  66. package/dist/ekyc.esm.js +0 -104
  67. package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
  68. package/dist/electronic-signature.d.ts +0 -4
  69. package/dist/electronic-signature.esm.js +0 -7
  70. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
  71. package/dist/email.d.ts +0 -4
  72. package/dist/email.esm.js +0 -9
  73. package/dist/emailManager-DIfnS5g1.d.ts +0 -352
  74. package/dist/emailManager-wAV0LE-H.esm.js +0 -238
  75. package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
  76. package/dist/endpoints-CnN3SyDa.esm.js +0 -87
  77. package/dist/events-D6-e4vok.esm.js +0 -596
  78. package/dist/events.d.ts +0 -265
  79. package/dist/events.esm.js +0 -4
  80. package/dist/extensibility.d.ts +0 -122
  81. package/dist/extensibility.esm.js +0 -43
  82. package/dist/face-match.d.ts +0 -228
  83. package/dist/face-match.esm.js +0 -173
  84. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
  85. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
  86. package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
  87. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
  88. package/dist/flow-events.d.ts +0 -6
  89. package/dist/flow-events.esm.js +0 -0
  90. package/dist/flow.d.ts +0 -358
  91. package/dist/flow.esm.js +0 -825
  92. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  93. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  94. package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
  95. package/dist/geolocation.d.ts +0 -127
  96. package/dist/geolocation.esm.js +0 -89
  97. package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
  98. package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
  99. package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
  100. package/dist/government-validation.d.ts +0 -67
  101. package/dist/government-validation.esm.js +0 -81
  102. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
  103. package/dist/home.d.ts +0 -99
  104. package/dist/home.esm.js +0 -61
  105. package/dist/http.d.ts +0 -68
  106. package/dist/http.esm.js +0 -3
  107. package/dist/id-ocr.d.ts +0 -635
  108. package/dist/id-ocr.esm.js +0 -86
  109. package/dist/id-verification.d.ts +0 -190
  110. package/dist/id-verification.esm.js +0 -43
  111. package/dist/id.d.ts +0 -24
  112. package/dist/id.esm.js +0 -164
  113. package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
  114. package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
  115. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
  116. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
  117. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
  118. package/dist/identity-reuse.d.ts +0 -530
  119. package/dist/identity-reuse.esm.js +0 -274
  120. package/dist/index-BLKtMA0g.d.ts +0 -1177
  121. package/dist/index-BcRG8rtJ.d.ts +0 -97
  122. package/dist/index.d.ts +0 -3
  123. package/dist/index.esm.js +0 -12
  124. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
  125. package/dist/lib-BB0B_qQX.esm.js +0 -12499
  126. package/dist/mandatory-consent.d.ts +0 -412
  127. package/dist/mandatory-consent.esm.js +0 -78
  128. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
  129. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  130. package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
  131. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  132. package/dist/phone.d.ts +0 -4
  133. package/dist/phone.esm.js +0 -9
  134. package/dist/phoneManager-B6M30hKE.d.ts +0 -397
  135. package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
  136. package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
  137. package/dist/platform-CfrjKhmi.esm.js +0 -83
  138. package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
  139. package/dist/qe-signature.d.ts +0 -25
  140. package/dist/qe-signature.esm.js +0 -8
  141. package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
  142. package/dist/redirect-to-mobile.d.ts +0 -107
  143. package/dist/redirect-to-mobile.esm.js +0 -102
  144. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
  145. package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
  146. package/dist/selfie.d.ts +0 -26
  147. package/dist/selfie.esm.js +0 -146
  148. package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
  149. package/dist/selfieManager-Duisl7qN.esm.js +0 -60
  150. package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
  151. package/dist/session-BS-d_vuE.esm.js +0 -3206
  152. package/dist/session.d.ts +0 -217
  153. package/dist/session.esm.js +0 -9
  154. package/dist/setup-Buy-hyj4.esm.js +0 -887
  155. package/dist/setup-C5AITV8m.d.ts +0 -254
  156. package/dist/signature.d.ts +0 -94
  157. package/dist/signature.esm.js +0 -66
  158. package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
  159. package/dist/stats-CIfiPzb1.esm.js +0 -16
  160. package/dist/stats.d.ts +0 -16
  161. package/dist/stats.esm.js +0 -4
  162. package/dist/trust-graph.d.ts +0 -54
  163. package/dist/trust-graph.esm.js +0 -56
  164. package/dist/types-B06Ypu2F.d.ts +0 -49
  165. package/dist/types-BP1m8VRw.d.ts +0 -340
  166. package/dist/types-CAD4va6a.d.ts +0 -5
  167. package/dist/types-CFV9G_7j.d.ts +0 -24
  168. package/dist/warmup-CEcppFiS.d.ts +0 -63
  169. package/dist/wasm.d.ts +0 -15
  170. package/dist/wasm.esm.js +0 -12
  171. package/dist/watchlist-for-business.d.ts +0 -79
  172. package/dist/watchlist-for-business.esm.js +0 -148
  173. package/dist/watchlist.d.ts +0 -62
  174. package/dist/watchlist.esm.js +0 -86
  175. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  176. package/dist/workflow.d.ts +0 -907
  177. package/dist/workflow.esm.js +0 -702
  178. package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
@@ -1,25 +0,0 @@
1
- import "./BaseWasmProvider-C_DLEI40.esm.js";
2
- import "./WasmUtilProvider-j98OJf-S.esm.js";
3
- import "./api-CESGtpbH.esm.js";
4
- import "./events-D6-e4vok.esm.js";
5
- import "./endpoints-CnN3SyDa.esm.js";
6
- import "./browserSimulation-gxD8cSpM.esm.js";
7
- import "./xstate.esm-B70JrNqo.esm.js";
8
- import "./faceCaptureManagerFactory-Dh2PdGlF.esm.js";
9
- import "./BrowserStorageProvider-CuOW1Er2.esm.js";
10
- import "./faceCaptureSetup-B3faSpYA.esm.js";
11
- import "./ITimerCapability-C67ZRskg.esm.js";
12
- import "./camera-PA2Ljri3.esm.js";
13
- import "./deepsightService-O74l4Y__.esm.js";
14
- import "./recordingService-Ig2UgbLv.esm.js";
15
- import "./platform-CfrjKhmi.esm.js";
16
- import "./backCameraStream-DMdMeGk2.esm.js";
17
- import "./getBrowser-BSXUTWXw.esm.js";
18
- import "./stats-CIfiPzb1.esm.js";
19
- import "./getDeviceClass-BSntT9_j.esm.js";
20
- import "./MotionSensorProvider-4v7xkqAp.esm.js";
21
- import "./permissionServices-D_i6nzEw.esm.js";
22
- import { t as authenticationMachine } from "./authenticationStateMachine-BMZqatiF.esm.js";
23
- import { r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-5M-fKzXx.esm.js";
24
-
25
- export { authenticationMachine, createAuthenticationActor, createAuthenticationManager };
@@ -1,67 +0,0 @@
1
- import { t as WasmUtilProvider } from "./WasmUtilProvider-j98OJf-S.esm.js";
2
- import { n as eventModuleNames } from "./events-D6-e4vok.esm.js";
3
- import { s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
4
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-Dh2PdGlF.esm.js";
5
- import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CuOW1Er2.esm.js";
6
- import { t as authenticationMachine } from "./authenticationStateMachine-BMZqatiF.esm.js";
7
-
8
- //#region src/modules/authentication/authenticationActor.ts
9
- function createAuthenticationActor(options) {
10
- const dependencies = options.dependencies ?? {
11
- storage: new BrowserStorageProvider(),
12
- getWasmUtil: () => WasmUtilProvider.getInstance()
13
- };
14
- return createActor(authenticationMachine, { input: {
15
- config: options.config,
16
- dependencies,
17
- authHint: options.authHint
18
- } }).start();
19
- }
20
-
21
- //#endregion
22
- //#region src/modules/authentication/authenticationManager.ts
23
- function createAuthenticationManagerFromActor(actor) {
24
- return createFaceCaptureManagerFromActor(actor, eventModuleNames.authFace);
25
- }
26
- /**
27
- * Creates an authentication manager instance for handling face authentication flow.
28
- *
29
- * The authentication manager provides:
30
- * - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
31
- * - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
32
- * - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
33
- * - Camera stream access when in `capture` state
34
- * - Detection status feedback during face detection
35
- * - Attempt tracking with `attemptsRemaining`
36
- *
37
- * @param options - Configuration for the authentication actor
38
- * @param options.config - The authentication module configuration from the flow
39
- * @param options.authHint - Hint for identifying the user (e.g., phone number, email)
40
- * @returns A manager instance with state subscription, API methods, and lifecycle controls
41
- *
42
- * @example
43
- * ```ts
44
- * const authManager = createAuthenticationManager({
45
- * config: authConfig,
46
- * authHint: 'user@example.com'
47
- * });
48
- *
49
- * authManager.subscribe((state) => {
50
- * if (state.status === 'capture') {
51
- * console.log('Camera ready:', state.stream);
52
- * console.log('Detection status:', state.detectionStatus);
53
- * }
54
- * if (state.status === 'finished') {
55
- * console.log('Authentication successful!');
56
- * }
57
- * });
58
- *
59
- * authManager.load();
60
- * ```
61
- */
62
- function createAuthenticationManager(options) {
63
- return createFaceCaptureManagerFromActor(createAuthenticationActor(options), eventModuleNames.authFace);
64
- }
65
-
66
- //#endregion
67
- export { createAuthenticationManagerFromActor as n, createAuthenticationActor as r, createAuthenticationManager as t };
@@ -1,66 +0,0 @@
1
- import { t as Manager } from "./Manager-C8PrhBOx.js";
2
- import { b as CreateAuthenticationActorOptions, n as FaceCaptureManagerState, t as FaceCaptureManager, y as AuthenticationActor } from "./faceCaptureManagerFactory-yqtpxjnN.js";
3
-
4
- //#region src/modules/authentication/authenticationManager.d.ts
5
- type AuthenticationState = FaceCaptureManagerState;
6
- declare function createAuthenticationManagerFromActor(actor: AuthenticationActor): Manager<FaceCaptureManagerState> & {
7
- load(): void;
8
- nextStep(): void;
9
- requestPermission(): void;
10
- goToLearnMore(): void;
11
- back(): void;
12
- close(): void;
13
- reset(): void;
14
- retryCapture(): void;
15
- capture(): void;
16
- };
17
- /**
18
- * Creates an authentication manager instance for handling face authentication flow.
19
- *
20
- * The authentication manager provides:
21
- * - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
22
- * - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
23
- * - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
24
- * - Camera stream access when in `capture` state
25
- * - Detection status feedback during face detection
26
- * - Attempt tracking with `attemptsRemaining`
27
- *
28
- * @param options - Configuration for the authentication actor
29
- * @param options.config - The authentication module configuration from the flow
30
- * @param options.authHint - Hint for identifying the user (e.g., phone number, email)
31
- * @returns A manager instance with state subscription, API methods, and lifecycle controls
32
- *
33
- * @example
34
- * ```ts
35
- * const authManager = createAuthenticationManager({
36
- * config: authConfig,
37
- * authHint: 'user@example.com'
38
- * });
39
- *
40
- * authManager.subscribe((state) => {
41
- * if (state.status === 'capture') {
42
- * console.log('Camera ready:', state.stream);
43
- * console.log('Detection status:', state.detectionStatus);
44
- * }
45
- * if (state.status === 'finished') {
46
- * console.log('Authentication successful!');
47
- * }
48
- * });
49
- *
50
- * authManager.load();
51
- * ```
52
- */
53
- declare function createAuthenticationManager(options: CreateAuthenticationActorOptions): Manager<FaceCaptureManagerState> & {
54
- load(): void;
55
- nextStep(): void;
56
- requestPermission(): void;
57
- goToLearnMore(): void;
58
- back(): void;
59
- close(): void;
60
- reset(): void;
61
- retryCapture(): void;
62
- capture(): void;
63
- };
64
- type AuthenticationManager = FaceCaptureManager;
65
- //#endregion
66
- export { createAuthenticationManagerFromActor as i, AuthenticationState as n, createAuthenticationManager as r, AuthenticationManager as t };
@@ -1,139 +0,0 @@
1
- import { t as api } from "./api-CESGtpbH.esm.js";
2
- import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
3
- import { a as fromPromise, r as assign } from "./xstate.esm-B70JrNqo.esm.js";
4
- import { a as prepareOnDeviceFaceUpload, i as postOnDeviceFaceResults, n as defaultPrepareFaceUpload, r as isOnDeviceMode, t as faceCaptureMachine } from "./faceCaptureSetup-B3faSpYA.esm.js";
5
- import { m as FACE_ERROR_CODES } from "./recordingService-Ig2UgbLv.esm.js";
6
- import { t as getDeviceClass } from "./getDeviceClass-BSntT9_j.esm.js";
7
-
8
- //#region src/modules/authentication/authenticationErrorUtils.ts
9
- const AUTH_ERROR_MAP = {
10
- SPOOF_ATTEMPT_DETECTED: FACE_ERROR_CODES.SPOOF_ATTEMPT_DETECTED,
11
- SELFIE_FACE_OCCLUDED: FACE_ERROR_CODES.FACE_OCCLUDED,
12
- FACE_OCCLUDED: FACE_ERROR_CODES.FACE_OCCLUDED,
13
- FACE_TOO_DARK: FACE_ERROR_CODES.FACE_TOO_DARK,
14
- LENSES_DETECTED: FACE_ERROR_CODES.LENSES_DETECTED,
15
- FACE_MASK_DETECTED: FACE_ERROR_CODES.FACE_MASK_DETECTED,
16
- CLOSED_EYES_DETECTED: FACE_ERROR_CODES.CLOSED_EYES_DETECTED,
17
- HEAD_COVER_DETECTED: FACE_ERROR_CODES.HEAD_COVER_DETECTED,
18
- FACE_NOT_FOUND: FACE_ERROR_CODES.FACE_NOT_FOUND,
19
- FACE_CROPPING_FAILED: FACE_ERROR_CODES.FACE_CROPPING_FAILED,
20
- FACE_TOO_SMALL: FACE_ERROR_CODES.FACE_TOO_SMALL,
21
- FACE_TOO_BLURRY: FACE_ERROR_CODES.FACE_TOO_BLURRY,
22
- BAD_PHOTO_QUALITY: FACE_ERROR_CODES.BAD_PHOTO_QUALITY,
23
- PROCESSING_ERROR: FACE_ERROR_CODES.PROCESSING_ERROR,
24
- BAD_REQUEST: FACE_ERROR_CODES.BAD_REQUEST,
25
- SERVER: FACE_ERROR_CODES.SERVER,
26
- USER_IS_NOT_RECOGNIZED: FACE_ERROR_CODES.USER_IS_NOT_RECOGNIZED,
27
- NONEXISTENT_CUSTOMER: FACE_ERROR_CODES.NONEXISTENT_CUSTOMER,
28
- HINT_NOT_PROVIDED: FACE_ERROR_CODES.HINT_NOT_PROVIDED
29
- };
30
- const TERMINAL_AUTH_ERROR_CODES = [FACE_ERROR_CODES.NONEXISTENT_CUSTOMER, FACE_ERROR_CODES.HINT_NOT_PROVIDED];
31
- const validateAuthUploadResponse = (response) => {
32
- if (!response) return FACE_ERROR_CODES.SERVER;
33
- if (response.overallStatus !== "PASS") return AUTH_ERROR_MAP[response.error?.name] ?? FACE_ERROR_CODES.SERVER;
34
- };
35
- const isTerminalAuthError = (response, attemptsRemaining) => {
36
- if (!response) return false;
37
- const mappedError = AUTH_ERROR_MAP[response.error?.name];
38
- if (mappedError && TERMINAL_AUTH_ERROR_CODES.includes(mappedError)) return true;
39
- if (attemptsRemaining <= 0) return true;
40
- return false;
41
- };
42
-
43
- //#endregion
44
- //#region src/modules/authentication/authenticationUploadService.ts
45
- async function uploadAuthFace(params) {
46
- try {
47
- const payload = {
48
- base64Image: params.encryptedBase64Image,
49
- faceCoordinates: params.faceCoordinates ?? void 0,
50
- encrypted: true,
51
- clientInfo: { deviceClass: getDeviceClass() },
52
- metadata: params.metadata ?? void 0,
53
- ...params.authHint !== void 0 && { hint: params.authHint }
54
- };
55
- const query = {};
56
- if (params.recordingId) query.recordingId = params.recordingId;
57
- const res = await api.post(endpoints.authenticate, payload, {
58
- signal: params.signal,
59
- query
60
- });
61
- if (!res.ok) throw new Error(`POST ${endpoints.authenticate} failed: ${res.status} ${res.statusText}`);
62
- return res.data;
63
- } catch (error) {
64
- const errorCode = getAuthErrorCodeFromHttpError(error);
65
- if (errorCode) throw new Error(errorCode);
66
- throw new Error(FACE_ERROR_CODES.SERVER);
67
- }
68
- }
69
- const getAuthErrorCodeFromHttpError = (error) => {
70
- const err = error;
71
- if (err.ok !== false || typeof err.status !== "number") return;
72
- if (err.status !== 400) return FACE_ERROR_CODES.SERVER;
73
- const errorName = err.data?.error?.name;
74
- if (!errorName) return FACE_ERROR_CODES.BAD_REQUEST;
75
- return AUTH_ERROR_MAP[errorName] ?? FACE_ERROR_CODES.BAD_REQUEST;
76
- };
77
-
78
- //#endregion
79
- //#region src/modules/authentication/authenticationStateMachine.ts
80
- const _authenticationMachine = faceCaptureMachine.provide({
81
- actors: {
82
- prepareFaceUpload: fromPromise(async ({ input }) => {
83
- const ctx = input;
84
- return isOnDeviceMode(ctx.config) ? prepareOnDeviceFaceUpload(ctx) : defaultPrepareFaceUpload(ctx);
85
- }),
86
- uploadFace: fromPromise(async ({ input, signal }) => {
87
- const ctx = input;
88
- if (isOnDeviceMode(ctx.config)) return postOnDeviceFaceResults(ctx, signal);
89
- return uploadAuthFace({
90
- encryptedBase64Image: ctx.encryptedBase64Image,
91
- faceCoordinates: ctx.faceCoordinates,
92
- authHint: ctx.authHint,
93
- metadata: ctx.deepsightService?.getMetadata(),
94
- recordingId: ctx.uploadRecordingId,
95
- signal
96
- });
97
- }),
98
- processFace: fromPromise(async () => ({}))
99
- },
100
- actions: {
101
- setUploadErrorFromUploadValidation: assign({ uploadError: ({ context }) => {
102
- if (isOnDeviceMode(context.config)) return;
103
- const resp = context.uploadResponse;
104
- return validateAuthUploadResponse(resp) ?? FACE_ERROR_CODES.SERVER;
105
- } }),
106
- setTerminalError: assign({ error: ({ context }) => {
107
- const resp = context.uploadResponse;
108
- if (context.attemptsRemaining <= 0) return {
109
- type: "FACE_AUTH_ERROR",
110
- message: "No more attempts remaining"
111
- };
112
- if (!resp) return {
113
- type: "FACE_AUTH_ERROR",
114
- message: "Authentication failed"
115
- };
116
- return {
117
- type: "FACE_AUTH_ERROR",
118
- message: resp.error?.message ?? resp.error?.name ?? "Face authentication error"
119
- };
120
- } })
121
- },
122
- guards: {
123
- hasUploadValidationError: ({ context }) => {
124
- if (isOnDeviceMode(context.config)) return false;
125
- const resp = context.uploadResponse;
126
- return validateAuthUploadResponse(resp) !== void 0;
127
- },
128
- isTerminalUploadError: ({ context }) => {
129
- if (isOnDeviceMode(context.config)) return false;
130
- const resp = context.uploadResponse;
131
- return isTerminalAuthError(resp, context.attemptsRemaining);
132
- },
133
- isNoAttemptsTerminal: () => true
134
- }
135
- });
136
- const authenticationMachine = _authenticationMachine;
137
-
138
- //#endregion
139
- export { authenticationMachine as t };
@@ -1,346 +0,0 @@
1
- import { t as sleep } from "./ITimerCapability-C67ZRskg.esm.js";
2
- import { i as stopCameraStream, n as enumerateVideoDevices, r as requestCameraAccess, t as applyTrackConstraints } from "./camera-PA2Ljri3.esm.js";
3
- import { a as isIPhone14OrHigher, o as isSafari, r as isIOS, t as isAndroid } from "./platform-CfrjKhmi.esm.js";
4
-
5
- //#region src/internal/camera/backCameraStream.ts
6
- const BACK_CAMERA_KEYWORDS = [
7
- "rear",
8
- "back",
9
- "rück",
10
- "arrière",
11
- "trasera",
12
- "trás",
13
- "traseira",
14
- "posteriore",
15
- "后面",
16
- "後面",
17
- "背面",
18
- "后置",
19
- "後置",
20
- "背置",
21
- "задней",
22
- "الخلفية",
23
- "후",
24
- "arka",
25
- "achterzijde",
26
- "หลัง",
27
- "baksidan",
28
- "bagside",
29
- "sau",
30
- "bak",
31
- "tylny",
32
- "takakamera",
33
- "belakang",
34
- "אחורית",
35
- "πίσω",
36
- "spate",
37
- "hátsó",
38
- "zadní",
39
- "darrere",
40
- "zadná",
41
- "задня",
42
- "stražnja",
43
- "बैक"
44
- ];
45
- function isBackCameraLabel(label) {
46
- const lowercaseLabel = label.toLowerCase();
47
- return BACK_CAMERA_KEYWORDS.some((keyword) => lowercaseLabel.includes(keyword));
48
- }
49
- function classifyCamera(device, index, totalDevices) {
50
- let cameraType;
51
- if (device.label === "") cameraType = totalDevices === 1 || index + 1 <= totalDevices / 2 ? "front" : "back";
52
- else cameraType = isBackCameraLabel(device.label) ? "back" : "front";
53
- return {
54
- deviceId: device.deviceId,
55
- label: device.label,
56
- cameraType
57
- };
58
- }
59
- async function getCameras() {
60
- const videoDevices = await enumerateVideoDevices();
61
- const cameras = videoDevices.map((d, i) => classifyCamera(d, i, videoDevices.length));
62
- if (cameras.length > 1 && !cameras.some((c) => c.cameraType === "back")) {
63
- const resolutions = cameras.map((c) => {
64
- const match = c.label.match(/\b([0-9]+)MP?\b/i);
65
- return match ? parseInt(match[1], 10) : NaN;
66
- });
67
- let backCameraIndex = cameras.length - 1;
68
- if (!resolutions.some(isNaN)) backCameraIndex = resolutions.lastIndexOf(Math.max(...resolutions));
69
- cameras[backCameraIndex].cameraType = "back";
70
- }
71
- return cameras;
72
- }
73
- function selectBestBackCamera(track, backCameras) {
74
- if (backCameras.length === 0) return void 0;
75
- if (backCameras.length === 1) return backCameras[0];
76
- const withMp = backCameras.map((c) => {
77
- const match = c.label.match(/\b([0-9]+)\s*MP?\b/i);
78
- return {
79
- camera: c,
80
- mp: match ? parseInt(match[1], 10) : 0
81
- };
82
- });
83
- const maxMp = Math.max(...withMp.map((w) => w.mp));
84
- if (maxMp > 0) {
85
- const best = withMp.find((w) => w.mp === maxMp);
86
- if (best) return best.camera;
87
- }
88
- const settings = track.getSettings();
89
- const browserPick = backCameras.find((c) => c.deviceId === settings.deviceId || c.label === track.label);
90
- if (browserPick) return browserPick;
91
- return backCameras[0];
92
- }
93
- function selectMainCameraFromStream(track, cameras) {
94
- const settings = track.getSettings();
95
- const activeCamera = cameras.find((c) => c.deviceId === settings.deviceId || c.label !== "" && c.label === track.label);
96
- if (!activeCamera) return void 0;
97
- if ((settings.facingMode === "environment" || isBackCameraLabel(track.label)) && cameras.length > 1) {
98
- cameras.forEach((camera) => {
99
- if (camera.deviceId === activeCamera.deviceId) camera.cameraType = "back";
100
- else if (!isBackCameraLabel(camera.label)) camera.cameraType = "front";
101
- });
102
- return selectBestBackCamera(track, cameras.filter((c) => c.cameraType === "back"));
103
- }
104
- if (cameras.length === 1) return activeCamera;
105
- }
106
- function getAndroidVideoConstraints(level) {
107
- const base = {
108
- resizeMode: "none",
109
- facingMode: "environment"
110
- };
111
- switch (level) {
112
- case 0: return {
113
- ...base,
114
- height: { ideal: 720 }
115
- };
116
- case 1: return {
117
- ...base,
118
- width: {
119
- min: 3200,
120
- ideal: 3840,
121
- max: 4096
122
- },
123
- height: {
124
- min: 1800,
125
- ideal: 2160,
126
- max: 2400
127
- }
128
- };
129
- case 2: return {
130
- ...base,
131
- width: {
132
- min: 1400,
133
- ideal: 1920,
134
- max: 2160
135
- },
136
- height: {
137
- min: 900,
138
- ideal: 1080,
139
- max: 1440
140
- }
141
- };
142
- case 3: return {
143
- ...base,
144
- width: {
145
- min: 800,
146
- ideal: 1400,
147
- max: 1920
148
- },
149
- height: {
150
- min: 600,
151
- ideal: 900,
152
- max: 1080
153
- }
154
- };
155
- case 4: return {
156
- ...base,
157
- width: {
158
- min: 640,
159
- ideal: 800,
160
- max: 1400
161
- },
162
- height: {
163
- min: 480,
164
- ideal: 480,
165
- max: 900
166
- }
167
- };
168
- case 5: return {
169
- ...base,
170
- width: {
171
- min: 640,
172
- ideal: 640,
173
- max: 800
174
- },
175
- height: {
176
- min: 480,
177
- ideal: 480,
178
- max: 600
179
- }
180
- };
181
- default: return {};
182
- }
183
- }
184
- function getAndroidFinalConstraints(mainCamera, fallbackLevel) {
185
- const base = {
186
- deviceId: { exact: mainCamera.deviceId },
187
- resizeMode: "none"
188
- };
189
- if (fallbackLevel <= 1) return {
190
- ...base,
191
- width: { ideal: 1920 },
192
- height: { ideal: 1080 }
193
- };
194
- const full = getAndroidVideoConstraints(fallbackLevel);
195
- return {
196
- ...base,
197
- width: full.width,
198
- height: full.height
199
- };
200
- }
201
- async function getAndroidBackCameraStream(fallbackLevel = 0) {
202
- if (fallbackLevel > 5) throw new Error("Failed to get camera after all fallback attempts");
203
- try {
204
- const initialStream = await requestCameraAccess({ video: getAndroidVideoConstraints(fallbackLevel) });
205
- const track = initialStream.getVideoTracks()[0];
206
- const mainCamera = selectMainCameraFromStream(track, await getCameras());
207
- stopCameraStream(initialStream);
208
- if (!mainCamera) throw new Error("Could not identify main camera");
209
- const finalStream = await requestCameraAccess({ video: getAndroidFinalConstraints(mainCamera, fallbackLevel) });
210
- await applyFocusHint(finalStream);
211
- return {
212
- stream: finalStream,
213
- fallbackLevel
214
- };
215
- } catch (error) {
216
- const errorName = error instanceof Error ? error.name : "UnknownError";
217
- const nextLevel = Math.min(fallbackLevel + 1, 5);
218
- if (errorName === "NotReadableError") {
219
- await sleep(300);
220
- return getAndroidBackCameraStream(nextLevel);
221
- }
222
- if (errorName === "AbortError") {
223
- await sleep(300);
224
- return getAndroidBackCameraStream(fallbackLevel);
225
- }
226
- return getAndroidBackCameraStream(nextLevel);
227
- }
228
- }
229
- async function applyFocusHint(stream) {
230
- const videoTrack = stream.getVideoTracks()[0];
231
- try {
232
- await applyTrackConstraints(videoTrack, { advanced: [{ focusDistance: 1 }] });
233
- } catch {}
234
- }
235
- function getIOSConstraints() {
236
- return {
237
- audio: false,
238
- video: {
239
- resizeMode: "none",
240
- facingMode: "environment",
241
- height: { ideal: isIPhone14OrHigher() ? 1080 : 720 }
242
- }
243
- };
244
- }
245
- async function getIOSCameraStream() {
246
- const stream = await requestCameraAccess(getIOSConstraints());
247
- await applyFocusHint(stream);
248
- return stream;
249
- }
250
- function getDesktopVideoConstraints(level) {
251
- switch (level) {
252
- case 0: return {
253
- width: {
254
- min: 3200,
255
- ideal: 3840,
256
- max: 4096
257
- },
258
- height: {
259
- min: 1800,
260
- ideal: 2160,
261
- max: 2400
262
- }
263
- };
264
- case 1: return {
265
- width: {
266
- min: 1400,
267
- ideal: 1920,
268
- max: 2160
269
- },
270
- height: {
271
- min: 900,
272
- ideal: 1080,
273
- max: 1440
274
- }
275
- };
276
- case 2: return {
277
- width: {
278
- min: 800,
279
- ideal: 1400,
280
- max: 1920
281
- },
282
- height: {
283
- min: 600,
284
- ideal: 900,
285
- max: 1080
286
- }
287
- };
288
- case 3: return {
289
- width: {
290
- min: 640,
291
- ideal: 800,
292
- max: 1400
293
- },
294
- height: {
295
- min: 480,
296
- ideal: 480,
297
- max: 900
298
- }
299
- };
300
- case 4: return {
301
- width: {
302
- min: 640,
303
- ideal: 640,
304
- max: 800
305
- },
306
- height: {
307
- min: 480,
308
- ideal: 480,
309
- max: 600
310
- }
311
- };
312
- case 5:
313
- default: return {};
314
- }
315
- }
316
- function getDesktopConstraints(options, level = 0) {
317
- const { deviceId } = options;
318
- const resolution = getDesktopVideoConstraints(level);
319
- return {
320
- audio: isSafari(),
321
- video: {
322
- facingMode: "user",
323
- deviceId: deviceId ? { exact: deviceId } : void 0,
324
- ...resolution
325
- }
326
- };
327
- }
328
- async function getDesktopCameraStream(options, fallbackLevel = 0) {
329
- if (fallbackLevel > 5) throw new Error("Failed to get desktop camera after all fallback attempts");
330
- const constraints = getDesktopConstraints(options, fallbackLevel);
331
- try {
332
- return await requestCameraAccess(constraints);
333
- } catch (error) {
334
- const nextLevel = fallbackLevel + 1;
335
- if (nextLevel > 5) throw error;
336
- return getDesktopCameraStream(options, nextLevel);
337
- }
338
- }
339
- async function getBackCameraStream(deviceId) {
340
- if (isIOS()) return { stream: await getIOSCameraStream() };
341
- if (isAndroid()) return getAndroidBackCameraStream(0);
342
- return { stream: await getDesktopCameraStream({ deviceId }) };
343
- }
344
-
345
- //#endregion
346
- export { getDesktopCameraStream as n, getBackCameraStream as t };
@@ -1,20 +0,0 @@
1
- //#region src/internal/device/browserSimulation.ts
2
- const AUTOMATION_MARKERS = {
3
- window: [
4
- "callPhantom",
5
- "_phantom",
6
- "phantom",
7
- "__nightmare",
8
- "domAutomation",
9
- "domAutomationController"
10
- ],
11
- navigator: ["webdriver"]
12
- };
13
- function isBrowserSimulation(browserEnv) {
14
- for (const prop of AUTOMATION_MARKERS.window) if (browserEnv.getWindowProperty(prop)) return true;
15
- for (const prop of AUTOMATION_MARKERS.navigator) if (browserEnv.getNavigatorProperty(prop)) return true;
16
- return false;
17
- }
18
-
19
- //#endregion
20
- export { isBrowserSimulation as t };
@@ -1,4 +0,0 @@
1
- //#region ../infra/src/media/camera.d.ts
2
- type CameraStream = MediaStream;
3
- //#endregion
4
- export { CameraStream as t };
@@ -1,22 +0,0 @@
1
- //#region ../infra/src/media/camera.ts
2
- /**
3
- * Request camera access with specific constraints.
4
- * Throws if the request fails - no automatic fallback.
5
- */
6
- async function requestCameraAccess(constraints) {
7
- if (typeof navigator === "undefined" || !navigator.mediaDevices) throw new Error("MediaDevices API not available");
8
- return navigator.mediaDevices.getUserMedia(constraints);
9
- }
10
- function stopCameraStream(stream) {
11
- for (const track of stream.getTracks()) track.stop();
12
- }
13
- async function enumerateVideoDevices() {
14
- if (typeof navigator === "undefined" || !navigator.mediaDevices) return [];
15
- return (await navigator.mediaDevices.enumerateDevices()).filter((d) => d.kind === "videoinput");
16
- }
17
- async function applyTrackConstraints(track, constraints) {
18
- await track.applyConstraints(constraints);
19
- }
20
-
21
- //#endregion
22
- export { stopCameraStream as i, enumerateVideoDevices as n, requestCameraAccess as r, applyTrackConstraints as t };