@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,146 +0,0 @@
1
- import "./BaseWasmProvider-C_DLEI40.esm.js";
2
- import { t as WasmUtilProvider } from "./WasmUtilProvider-j98OJf-S.esm.js";
3
- import "./api-CESGtpbH.esm.js";
4
- import { n as eventModuleNames } from "./events-D6-e4vok.esm.js";
5
- import "./endpoints-CnN3SyDa.esm.js";
6
- import "./browserSimulation-gxD8cSpM.esm.js";
7
- import { a as fromPromise, r as assign, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
8
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-Dh2PdGlF.esm.js";
9
- import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CuOW1Er2.esm.js";
10
- import { t as faceCaptureMachine } from "./faceCaptureSetup-B3faSpYA.esm.js";
11
- import "./ITimerCapability-C67ZRskg.esm.js";
12
- import "./camera-PA2Ljri3.esm.js";
13
- import "./deepsightService-O74l4Y__.esm.js";
14
- import { f as processFace } from "./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 selfieMachine } from "./selfieStateMachine-D76whWEf.esm.js";
23
- import { t as createSelfieManager } from "./selfieManager-Duisl7qN.esm.js";
24
- import { t as invokeOnCaptureCallback } from "./invokeOnCaptureCallback-rc6kBHo5.esm.js";
25
-
26
- //#region src/modules/selfie/selfieCaptureOnlyStateMachine.ts
27
- /**
28
- * Performs local finalization of a captured face frame: stops local video
29
- * recording (if any), runs deepsight metadata extraction, and assembles the
30
- * rich payload delivered to the integrator's `onCapture` callback.
31
- */
32
- async function finalizeFaceCaptureOnly(ctx, signal) {
33
- const canvas = ctx.capturedImage;
34
- if (!canvas) throw new Error("selfieCaptureOnly: no captured image");
35
- let videoBase64;
36
- try {
37
- videoBase64 = (await ctx.recordingService?.stopAndGetVideo())?.videoBase64;
38
- } catch {
39
- videoBase64 = void 0;
40
- }
41
- if (signal.aborted) throw new DOMException("Aborted", "AbortError");
42
- let metadata = "";
43
- try {
44
- if (ctx.deepsightService) {
45
- const imageData = canvas.getImageData();
46
- if (imageData) await ctx.deepsightService.analyzeFrame(imageData);
47
- if (signal.aborted) throw new DOMException("Aborted", "AbortError");
48
- metadata = ctx.deepsightService.getMetadata();
49
- }
50
- } catch (error) {
51
- if (error?.name === "AbortError") throw error;
52
- metadata = "";
53
- }
54
- const imageBase64 = canvas.getBase64Image() ?? "";
55
- const blobData = canvas.getBlobData();
56
- if (!blobData) throw new Error("selfieCaptureOnly: failed to build image blob");
57
- return {
58
- imageBase64,
59
- blob: blobData.blob,
60
- url: blobData.url,
61
- metadata,
62
- videoBase64
63
- };
64
- }
65
- const _selfieCaptureOnlyMachine = faceCaptureMachine.provide({
66
- actors: {
67
- prepareFaceUpload: fromPromise(async () => ({
68
- encryptedBase64Image: "",
69
- recordingId: null
70
- })),
71
- uploadFace: fromPromise(async ({ input, signal }) => {
72
- return await finalizeFaceCaptureOnly(input, signal);
73
- }),
74
- processFace: fromPromise(async () => ({}))
75
- },
76
- actions: { setUploadResponseFromEvent: assign({ captureOnlyResult: ({ event }) => event.output }) },
77
- guards: {
78
- hasUploadValidationError: () => false,
79
- isTerminalUploadError: () => false
80
- }
81
- });
82
- /**
83
- * Selfie state machine variant for the captureOnly flow. Shares the full base
84
- * face-capture state tree; only the upload/process step is local instead of
85
- * remote.
86
- */
87
- const selfieCaptureOnlyMachine = _selfieCaptureOnlyMachine;
88
-
89
- //#endregion
90
- //#region src/modules/selfie/selfieCaptureOnlyActor.ts
91
- function createSelfieCaptureOnlyActor(options) {
92
- const dependencies = options.dependencies ?? {
93
- storage: new BrowserStorageProvider(),
94
- getWasmUtil: () => WasmUtilProvider.getInstance()
95
- };
96
- return createActor(selfieCaptureOnlyMachine, { input: {
97
- config: options.config,
98
- dependencies
99
- } }).start();
100
- }
101
-
102
- //#endregion
103
- //#region src/modules/selfie/selfieCaptureOnlyManager.ts
104
- /**
105
- * Wraps a selfie captureOnly actor with a manager that fires `onCapture`
106
- * exactly once when the actor reaches the `finished` final state. XState's
107
- * `complete` lifecycle fires for both `finished` and `closed` (both are
108
- * `type: 'final'` per the SDK terminal-state convention) — gating on
109
- * `finished` prevents a user-quit mid-capture from delivering a partial
110
- * payload.
111
- */
112
- function attachOnCaptureFiring(actor, config) {
113
- const subscription = actor.subscribe({ complete: () => {
114
- const snapshot = actor.getSnapshot();
115
- if (!snapshot.matches("finished")) return;
116
- const payload = snapshot.context.captureOnlyResult;
117
- if (!payload) return;
118
- const response = { image: payload };
119
- invokeOnCaptureCallback(config.onCapture, response, eventModuleNames.selfie);
120
- } });
121
- return () => subscription.unsubscribe();
122
- }
123
- function createSelfieCaptureOnlyManagerFromActor(actor, config) {
124
- const unsubscribe = attachOnCaptureFiring(actor, config);
125
- const manager = createFaceCaptureManagerFromActor(actor, eventModuleNames.selfie);
126
- return {
127
- ...manager,
128
- stop: () => {
129
- unsubscribe();
130
- manager.stop();
131
- }
132
- };
133
- }
134
- /**
135
- * Creates a captureOnly selfie manager.
136
- *
137
- * Unlike {@link createSelfieManager}, the captured face image is delivered
138
- * locally to the integrator's `onCapture` callback instead of being uploaded
139
- * to the Incode backend. `onCapture` is required.
140
- */
141
- function createSelfieCaptureOnlyManager(options) {
142
- return createSelfieCaptureOnlyManagerFromActor(createSelfieCaptureOnlyActor(options), options.config);
143
- }
144
-
145
- //#endregion
146
- export { createSelfieCaptureOnlyManager, createSelfieCaptureOnlyManagerFromActor, createSelfieManager, processFace, selfieCaptureOnlyMachine, selfieMachine };
@@ -1,68 +0,0 @@
1
- import { t as Manager } from "./Manager-C8PrhBOx.js";
2
- import { c as SelfieActor, n as FaceCaptureManagerState, s as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-yqtpxjnN.js";
3
-
4
- //#region src/modules/selfie/selfieUploadService.d.ts
5
- type ProcessFaceImageType = 'selfie' | 'videoSelfie';
6
- type ProcessFaceResponse = {
7
- faceMatch: boolean;
8
- confidence: number;
9
- existingUser: boolean;
10
- };
11
- declare function processFace(imageType?: ProcessFaceImageType, signal?: AbortSignal): Promise<ProcessFaceResponse>;
12
- //#endregion
13
- //#region src/modules/selfie/selfieManager.d.ts
14
- type SelfieState = FaceCaptureManagerState;
15
- declare function createSelfieManagerFromActor(actor: SelfieActor): Manager<FaceCaptureManagerState> & {
16
- load(): void;
17
- nextStep(): void;
18
- requestPermission(): void;
19
- goToLearnMore(): void;
20
- back(): void;
21
- close(): void;
22
- reset(): void;
23
- retryCapture(): void;
24
- capture(): void;
25
- };
26
- /**
27
- * Creates a selfie manager instance for handling selfie capture flow.
28
- *
29
- * The selfie 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 selfie actor
38
- * @param options.config - The selfie module configuration from the flow
39
- * @returns A manager instance with state subscription, API methods, and lifecycle controls
40
- *
41
- * @example
42
- * ```ts
43
- * const selfieManager = createSelfieManager({ config: selfieConfig });
44
- *
45
- * selfieManager.subscribe((state) => {
46
- * if (state.status === 'capture') {
47
- * console.log('Camera ready:', state.stream);
48
- * console.log('Detection status:', state.detectionStatus);
49
- * }
50
- * });
51
- *
52
- * selfieManager.load();
53
- * ```
54
- */
55
- declare function createSelfieManager(options: CreateSelfieActorOptions): Manager<FaceCaptureManagerState> & {
56
- load(): void;
57
- nextStep(): void;
58
- requestPermission(): void;
59
- goToLearnMore(): void;
60
- back(): void;
61
- close(): void;
62
- reset(): void;
63
- retryCapture(): void;
64
- capture(): void;
65
- };
66
- type SelfieManager = FaceCaptureManager;
67
- //#endregion
68
- export { ProcessFaceResponse as a, createSelfieManagerFromActor as i, SelfieState as n, processFace as o, createSelfieManager as r, SelfieManager as t };
@@ -1,60 +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 selfieMachine } from "./selfieStateMachine-D76whWEf.esm.js";
7
-
8
- //#region src/modules/selfie/selfieActor.ts
9
- function createSelfieActor(options) {
10
- const dependencies = options.dependencies ?? {
11
- storage: new BrowserStorageProvider(),
12
- getWasmUtil: () => WasmUtilProvider.getInstance()
13
- };
14
- return createActor(selfieMachine, { input: {
15
- config: options.config,
16
- dependencies,
17
- authHint: options.authHint
18
- } }).start();
19
- }
20
-
21
- //#endregion
22
- //#region src/modules/selfie/selfieManager.ts
23
- function createSelfieManagerFromActor(actor) {
24
- return createFaceCaptureManagerFromActor(actor, eventModuleNames.faceCapture);
25
- }
26
- /**
27
- * Creates a selfie manager instance for handling selfie capture flow.
28
- *
29
- * The selfie 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 selfie actor
38
- * @param options.config - The selfie module configuration from the flow
39
- * @returns A manager instance with state subscription, API methods, and lifecycle controls
40
- *
41
- * @example
42
- * ```ts
43
- * const selfieManager = createSelfieManager({ config: selfieConfig });
44
- *
45
- * selfieManager.subscribe((state) => {
46
- * if (state.status === 'capture') {
47
- * console.log('Camera ready:', state.stream);
48
- * console.log('Detection status:', state.detectionStatus);
49
- * }
50
- * });
51
- *
52
- * selfieManager.load();
53
- * ```
54
- */
55
- function createSelfieManager(options) {
56
- return createFaceCaptureManagerFromActor(createSelfieActor(options), eventModuleNames.faceCapture);
57
- }
58
-
59
- //#endregion
60
- export { createSelfieManagerFromActor as n, createSelfieManager as t };
@@ -1,68 +0,0 @@
1
- import { a as fromPromise, r as assign } from "./xstate.esm-B70JrNqo.esm.js";
2
- import { a as prepareOnDeviceFaceUpload, i as postOnDeviceFaceResults, n as defaultPrepareFaceUpload, r as isOnDeviceMode, t as faceCaptureMachine } from "./faceCaptureSetup-B3faSpYA.esm.js";
3
- import { f as processFace, m as FACE_ERROR_CODES, p as uploadSelfie } from "./recordingService-Ig2UgbLv.esm.js";
4
-
5
- //#region src/modules/selfie/selfieErrorUtils.ts
6
- const FACE_ERROR_CODE_VALUES = Object.values(FACE_ERROR_CODES);
7
- const validateUploadResponse = ({ config, response }) => {
8
- if (!response) return FACE_ERROR_CODES.SERVER;
9
- if (response.confidence !== 0) return FACE_ERROR_CODES.LIVENESS;
10
- if (config.validateBrightness && !response.isBright) return FACE_ERROR_CODES.BRIGHTNESS;
11
- if (config.validateLenses && response.hasLenses) return FACE_ERROR_CODES.LENSES;
12
- if (config.validateFaceMask && response.hasFaceMask) return FACE_ERROR_CODES.MASK;
13
- if (config.validateClosedEyes && response.hasClosedEyes) return FACE_ERROR_CODES.CLOSED_EYES;
14
- if (config.validateHeadCover && response.hasHeadCover) return FACE_ERROR_CODES.HEAD_COVER;
15
- };
16
-
17
- //#endregion
18
- //#region src/modules/selfie/selfieStateMachine.ts
19
- const _selfieMachine = faceCaptureMachine.provide({
20
- actors: {
21
- prepareFaceUpload: fromPromise(async ({ input }) => {
22
- const ctx = input;
23
- return isOnDeviceMode(ctx.config) ? prepareOnDeviceFaceUpload(ctx) : defaultPrepareFaceUpload(ctx);
24
- }),
25
- uploadFace: fromPromise(async ({ input, signal }) => {
26
- const ctx = input;
27
- if (isOnDeviceMode(ctx.config)) return postOnDeviceFaceResults(ctx, signal);
28
- return uploadSelfie({
29
- encryptedBase64Image: ctx.encryptedBase64Image,
30
- faceCoordinates: ctx.faceCoordinates,
31
- metadata: ctx.deepsightService?.getMetadata(),
32
- recordingId: ctx.uploadRecordingId,
33
- signal
34
- });
35
- }),
36
- processFace: fromPromise(async ({ input, signal }) => {
37
- if (isOnDeviceMode(input.config)) return {};
38
- return processFace("selfie", signal);
39
- })
40
- },
41
- actions: { setUploadErrorFromUploadValidation: assign({ uploadError: ({ context }) => {
42
- if (isOnDeviceMode(context.config)) return;
43
- return validateUploadResponse({
44
- config: context.config,
45
- response: context.uploadResponse
46
- }) ?? FACE_ERROR_CODES.SERVER;
47
- } }) },
48
- guards: {
49
- hasUploadValidationError: ({ context }) => {
50
- if (isOnDeviceMode(context.config)) return false;
51
- return validateUploadResponse({
52
- config: context.config,
53
- response: context.uploadResponse
54
- }) !== void 0;
55
- },
56
- isTerminalUploadError: () => false
57
- }
58
- });
59
- /**
60
- * The selfie capture state machine.
61
- *
62
- * Note: Uses AnyStateMachine type for declaration file portability.
63
- * Type safety is ensured via the machine configuration.
64
- */
65
- const selfieMachine = _selfieMachine;
66
-
67
- //#endregion
68
- export { selfieMachine as t };