@incodetech/core 2.0.0-alpha.8 → 2.0.0-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 (184) 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/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  8. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  9. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  10. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  11. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  12. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  13. package/dist/ae-signature.d.ts +25 -0
  14. package/dist/ae-signature.esm.js +8 -0
  15. package/dist/antifraud.d.ts +57 -0
  16. package/dist/antifraud.esm.js +45 -0
  17. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  18. package/dist/api-CESGtpbH.esm.js +53 -0
  19. package/dist/authentication.d.ts +12 -0
  20. package/dist/authentication.esm.js +25 -0
  21. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  22. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  23. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  24. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  25. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  26. package/dist/camera-DBSxa6ML.d.ts +4 -0
  27. package/dist/camera-PA2Ljri3.esm.js +22 -0
  28. package/dist/camera.d.ts +15 -0
  29. package/dist/camera.esm.js +5 -0
  30. package/dist/consent.d.ts +398 -0
  31. package/dist/consent.esm.js +79 -0
  32. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  33. package/dist/cpf-PPz2Njto.esm.js +38 -0
  34. package/dist/cpf-ocr.d.ts +204 -0
  35. package/dist/cpf-ocr.esm.js +177 -0
  36. package/dist/cross-document-data-match.d.ts +34 -0
  37. package/dist/cross-document-data-match.esm.js +71 -0
  38. package/dist/curp-validation.d.ts +188 -0
  39. package/dist/curp-validation.esm.js +110 -0
  40. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  41. package/dist/custom-fields.d.ts +115 -0
  42. package/dist/custom-fields.esm.js +177 -0
  43. package/dist/custom-watchlist.d.ts +66 -0
  44. package/dist/custom-watchlist.esm.js +86 -0
  45. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  46. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  47. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  48. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  49. package/dist/device.d.ts +46 -0
  50. package/dist/device.esm.js +106 -0
  51. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  52. package/dist/document-capture.d.ts +906 -0
  53. package/dist/document-capture.esm.js +156 -0
  54. package/dist/document-upload.d.ts +331 -0
  55. package/dist/document-upload.esm.js +203 -0
  56. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  57. package/dist/dynamic-forms.d.ts +178 -0
  58. package/dist/dynamic-forms.esm.js +323 -0
  59. package/dist/ekyb.d.ts +148 -0
  60. package/dist/ekyb.esm.js +127 -0
  61. package/dist/ekybStateMachine-B59rQjgj.esm.js +674 -0
  62. package/dist/ekyc.d.ts +164 -0
  63. package/dist/ekyc.esm.js +104 -0
  64. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  65. package/dist/electronic-signature.d.ts +4 -0
  66. package/dist/electronic-signature.esm.js +7 -0
  67. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  68. package/dist/email.d.ts +3 -263
  69. package/dist/email.esm.js +7 -477
  70. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  71. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  72. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  73. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  74. package/dist/events-D6-e4vok.esm.js +596 -0
  75. package/dist/events.d.ts +265 -0
  76. package/dist/events.esm.js +4 -0
  77. package/dist/extensibility.d.ts +122 -0
  78. package/dist/extensibility.esm.js +43 -0
  79. package/dist/face-match.d.ts +228 -0
  80. package/dist/face-match.esm.js +173 -0
  81. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  82. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  83. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  84. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  85. package/dist/flow-events.d.ts +6 -0
  86. package/dist/flow-events.esm.js +0 -0
  87. package/dist/flow.d.ts +101 -321
  88. package/dist/flow.esm.js +370 -173
  89. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  90. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  91. package/dist/flowServices-DTsm-Vf1.esm.js +188 -0
  92. package/dist/geolocation.d.ts +127 -0
  93. package/dist/geolocation.esm.js +89 -0
  94. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  95. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  96. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  97. package/dist/government-validation.d.ts +67 -0
  98. package/dist/government-validation.esm.js +81 -0
  99. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  100. package/dist/home.d.ts +99 -0
  101. package/dist/home.esm.js +61 -0
  102. package/dist/http.d.ts +68 -0
  103. package/dist/http.esm.js +3 -0
  104. package/dist/id-ocr.d.ts +635 -0
  105. package/dist/id-ocr.esm.js +86 -0
  106. package/dist/id-verification.d.ts +190 -0
  107. package/dist/id-verification.esm.js +43 -0
  108. package/dist/id.d.ts +24 -0
  109. package/dist/id.esm.js +164 -0
  110. package/dist/idCaptureManager-B9TGA5dq.d.ts +956 -0
  111. package/dist/idCaptureManager-DMK0GIt3.esm.js +581 -0
  112. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +2954 -0
  113. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  114. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  115. package/dist/identity-reuse.d.ts +530 -0
  116. package/dist/identity-reuse.esm.js +274 -0
  117. package/dist/index-BLKtMA0g.d.ts +1177 -0
  118. package/dist/index-BcRG8rtJ.d.ts +97 -0
  119. package/dist/index.d.ts +3 -226
  120. package/dist/index.esm.js +11 -154
  121. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  122. package/dist/{lib-Bu9XGMBW.esm.js → lib-BB0B_qQX.esm.js} +801 -2
  123. package/dist/mandatory-consent.d.ts +412 -0
  124. package/dist/mandatory-consent.esm.js +78 -0
  125. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  126. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  127. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  128. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  129. package/dist/phone.d.ts +3 -291
  130. package/dist/phone.esm.js +7 -548
  131. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  132. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  133. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  134. package/dist/platform-CfrjKhmi.esm.js +83 -0
  135. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  136. package/dist/qe-signature.d.ts +25 -0
  137. package/dist/qe-signature.esm.js +8 -0
  138. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  139. package/dist/redirect-to-mobile.d.ts +107 -0
  140. package/dist/redirect-to-mobile.esm.js +102 -0
  141. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  142. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  143. package/dist/selfie.d.ts +21 -754
  144. package/dist/selfie.esm.js +113 -962
  145. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  146. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  147. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  148. package/dist/session-BS-d_vuE.esm.js +3206 -0
  149. package/dist/session.d.ts +217 -0
  150. package/dist/session.esm.js +9 -0
  151. package/dist/setup-Buy-hyj4.esm.js +887 -0
  152. package/dist/setup-C5AITV8m.d.ts +254 -0
  153. package/dist/signature.d.ts +94 -0
  154. package/dist/signature.esm.js +66 -0
  155. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  156. package/dist/stats-CIfiPzb1.esm.js +16 -0
  157. package/dist/stats.d.ts +16 -0
  158. package/dist/stats.esm.js +4 -0
  159. package/dist/trust-graph.d.ts +54 -0
  160. package/dist/trust-graph.esm.js +56 -0
  161. package/dist/types-B06Ypu2F.d.ts +49 -0
  162. package/dist/types-BP1m8VRw.d.ts +340 -0
  163. package/dist/types-CFV9G_7j.d.ts +24 -0
  164. package/dist/{warmup-CEJTfxQr.d.ts → warmup-CEcppFiS.d.ts} +11 -3
  165. package/dist/wasm.d.ts +15 -0
  166. package/dist/wasm.esm.js +12 -0
  167. package/dist/watchlist-for-business.d.ts +79 -0
  168. package/dist/watchlist-for-business.esm.js +148 -0
  169. package/dist/watchlist.d.ts +62 -0
  170. package/dist/watchlist.esm.js +86 -0
  171. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  172. package/dist/workflow.d.ts +907 -0
  173. package/dist/workflow.esm.js +702 -0
  174. package/dist/{xstate.esm-B_rda9yU.esm.js → xstate.esm-B70JrNqo.esm.js} +144 -1
  175. package/package.json +203 -6
  176. package/dist/OpenViduLogger-BdPfiZO6.esm.js +0 -3
  177. package/dist/OpenViduLogger-CQyDxBvM.esm.js +0 -803
  178. package/dist/StateMachine-DRE1oH2B.d.ts +0 -2
  179. package/dist/addEvent-W0ORK0jT.esm.js +0 -16
  180. package/dist/endpoints-BSTFaHYo.esm.js +0 -1706
  181. package/dist/permissionServices-I6vX6DBy.esm.js +0 -72
  182. /package/dist/{Manager-BGfxEmyv.d.ts → Manager-C8PrhBOx.d.ts} +0 -0
  183. /package/dist/{chunk-C_Yo44FK.esm.js → chunk-CRF6K_H_.esm.js} +0 -0
  184. /package/dist/{types-iZi2rawo.d.ts → types-CAD4va6a.d.ts} +0 -0
@@ -0,0 +1,25 @@
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 };
@@ -0,0 +1,67 @@
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 };
@@ -0,0 +1,66 @@
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 };
@@ -0,0 +1,139 @@
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 };
@@ -0,0 +1,346 @@
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 };
@@ -0,0 +1,20 @@
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 };
@@ -0,0 +1,4 @@
1
+ //#region ../infra/src/media/camera.d.ts
2
+ type CameraStream = MediaStream;
3
+ //#endregion
4
+ export { CameraStream as t };
@@ -0,0 +1,22 @@
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 };