@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,156 +0,0 @@
1
- import "./api-CESGtpbH.esm.js";
2
- import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
3
- import "./endpoints-CnN3SyDa.esm.js";
4
- import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
5
- import "./ITimerCapability-C67ZRskg.esm.js";
6
- import "./camera-PA2Ljri3.esm.js";
7
- import "./platform-CfrjKhmi.esm.js";
8
- import "./backCameraStream-DMdMeGk2.esm.js";
9
- import { n as DOCUMENT_CAPTURE_ERROR_CODES, t as documentCaptureMachine } from "./documentCaptureStateMachine-BqzTDy9k.esm.js";
10
-
11
- //#region src/modules/document-capture/documentCaptureActor.ts
12
- function createDocumentCaptureActor(options) {
13
- return createActor(documentCaptureMachine, { input: { config: options.config } }).start();
14
- }
15
-
16
- //#endregion
17
- //#region src/modules/document-capture/documentCaptureManager.ts
18
- function mapState(snapshot) {
19
- const typedSnapshot = snapshot;
20
- const { context } = typedSnapshot;
21
- if (typedSnapshot.matches("tutorial")) {
22
- const isSecondPage = context.pageNumber > 1;
23
- return {
24
- status: "tutorial",
25
- title: isSecondPage ? context.config.step2Title ?? context.config.title : context.config.title,
26
- text: isSecondPage ? context.config.step2Text ?? context.config.text : context.config.text,
27
- allowSkipDocumentCapture: context.config.allowSkipDocumentCapture && context.pageNumber === 1,
28
- captureMode: context.config.captureMode,
29
- error: context.error,
30
- pageNumber: context.pageNumber
31
- };
32
- }
33
- if (typedSnapshot.matches("initCamera")) return { status: "initializingCamera" };
34
- if (typedSnapshot.matches("capturing")) return {
35
- status: "capturing",
36
- stream: context.stream,
37
- captureMode: context.config.captureMode,
38
- captureMethod: context.captureMethod,
39
- error: context.error,
40
- pageNumber: context.pageNumber
41
- };
42
- if (typedSnapshot.matches("preview")) return {
43
- status: "preview",
44
- imageBase64: context.capturedDocument?.imageBase64 ?? "",
45
- fileType: context.capturedDocument?.fileType ?? "",
46
- fileName: context.capturedDocument?.file.name ?? ""
47
- };
48
- if (typedSnapshot.matches("uploading")) return {
49
- status: "uploading",
50
- progress: context.progress,
51
- imageBase64: context.capturedDocument?.imageBase64 ?? "",
52
- fileType: context.capturedDocument?.fileType ?? "",
53
- fileName: context.capturedDocument?.file.name ?? ""
54
- };
55
- if (typedSnapshot.matches("success")) return {
56
- status: "success",
57
- imageBase64: context.capturedDocument?.imageBase64 ?? "",
58
- fileType: context.capturedDocument?.fileType ?? "",
59
- fileName: context.capturedDocument?.file.name ?? "",
60
- nextPageType: context.nextPageType
61
- };
62
- if (typedSnapshot.matches("failure")) return {
63
- status: "failure",
64
- error: context.error ?? DOCUMENT_CAPTURE_ERROR_CODES.UPLOAD_FAILED,
65
- attemptsRemaining: context.attemptsRemaining
66
- };
67
- if (typedSnapshot.matches("finished")) return { status: "finished" };
68
- if (typedSnapshot.matches("closed")) return { status: "closed" };
69
- if (typedSnapshot.matches("nextPage")) return {
70
- status: "nextPage",
71
- imageBase64: context.capturedDocument?.imageBase64 ?? "",
72
- fileType: context.capturedDocument?.fileType ?? "",
73
- fileName: context.capturedDocument?.file.name ?? "",
74
- pageNumber: context.pageNumber,
75
- nextPageType: context.nextPageType,
76
- captureMode: context.config.captureMode
77
- };
78
- if (typedSnapshot.matches("finalizing")) return { status: "finalizing" };
79
- return {
80
- status: "tutorial",
81
- title: void 0,
82
- text: void 0,
83
- allowSkipDocumentCapture: false,
84
- captureMode: "file",
85
- error: void 0,
86
- pageNumber: 1
87
- };
88
- }
89
- function createApi({ actor, trackElementClicked }) {
90
- return {
91
- capture() {
92
- trackElementClicked?.("capture");
93
- actor.send({ type: "CAPTURE" });
94
- },
95
- setFile(file, imageBase64) {
96
- actor.send({
97
- type: "FILE_SELECTED",
98
- file,
99
- imageBase64,
100
- fileType: file.type
101
- });
102
- },
103
- accept() {
104
- trackElementClicked?.("accept");
105
- actor.send({ type: "ACCEPT" });
106
- },
107
- retake() {
108
- trackElementClicked?.("retake");
109
- actor.send({ type: "RETAKE" });
110
- },
111
- retry() {
112
- trackElementClicked?.("retry");
113
- actor.send({ type: "RETRY" });
114
- },
115
- continue() {
116
- trackElementClicked?.("continue");
117
- actor.send({ type: "CONTINUE" });
118
- },
119
- skip() {
120
- trackElementClicked?.("skip");
121
- actor.send({ type: "SKIP" });
122
- },
123
- close() {
124
- trackElementClicked?.("close");
125
- actor.send({ type: "CLOSE" });
126
- },
127
- captureNextPageFromCamera() {
128
- trackElementClicked?.("captureNextPageFromCamera");
129
- actor.send({ type: "NEXT_PAGE_CAMERA" });
130
- },
131
- captureNextPageFromFile() {
132
- trackElementClicked?.("captureNextPageFromFile");
133
- actor.send({ type: "NEXT_PAGE_PHOTO_LIBRARY" });
134
- },
135
- finishPageCapture() {
136
- trackElementClicked?.("finishPageCapture");
137
- actor.send({ type: "ALL_PAGES_CAPTURED" });
138
- }
139
- };
140
- }
141
- function getDocumentCaptureErrorPayload(snapshot) {
142
- const errorCode = snapshot.context.error;
143
- if (errorCode === void 0) return;
144
- return { errorCode };
145
- }
146
- function createDocumentCaptureManager(options) {
147
- return createManager({
148
- actor: createDocumentCaptureActor(options),
149
- mapState,
150
- createApi,
151
- instrumentation: createManagerInstrumentation(eventModuleNames.document, { getErrorPayload: getDocumentCaptureErrorPayload })
152
- });
153
- }
154
-
155
- //#endregion
156
- export { DOCUMENT_CAPTURE_ERROR_CODES, createDocumentCaptureManager, documentCaptureMachine };
@@ -1,331 +0,0 @@
1
- import { t as Manager } from "./Manager-C8PrhBOx.js";
2
- import "./Actor-CI32dTbG.js";
3
- import "./camera-DBSxa6ML.js";
4
- import { n as DocumentUploadContext, r as DocumentUploadInput, t as DocumentUploadConfig } from "./types-CFV9G_7j.js";
5
- import * as xstate938 from "xstate";
6
-
7
- //#region src/modules/document-upload/documentUploadStateMachine.d.ts
8
- declare const documentUploadMachine: xstate938.StateMachine<DocumentUploadContext, {
9
- type: "START";
10
- } | {
11
- type: "CAPTURE";
12
- imageBase64: string;
13
- } | {
14
- type: "UPLOAD_PROGRESS";
15
- progress: number;
16
- } | {
17
- type: "RETRY";
18
- } | {
19
- type: "CLOSE";
20
- }, {
21
- [x: string]: xstate938.ActorRefFromLogic<xstate938.PromiseActorLogic<MediaStream, void, xstate938.EventObject>> | xstate938.ActorRefFromLogic<xstate938.PromiseActorLogic<void, {
22
- imageBase64: string;
23
- documentType: string;
24
- onProgress: (progress: number) => void;
25
- }, xstate938.EventObject>> | undefined;
26
- }, xstate938.Values<{
27
- uploadDocument: {
28
- src: "uploadDocument";
29
- logic: xstate938.PromiseActorLogic<void, {
30
- imageBase64: string;
31
- documentType: string;
32
- onProgress: (progress: number) => void;
33
- }, xstate938.EventObject>;
34
- id: string | undefined;
35
- };
36
- initCamera: {
37
- src: "initCamera";
38
- logic: xstate938.PromiseActorLogic<MediaStream, void, xstate938.EventObject>;
39
- id: string | undefined;
40
- };
41
- }>, xstate938.Values<{
42
- setError: {
43
- type: "setError";
44
- params: xstate938.NonReducibleUnknown;
45
- };
46
- clearError: {
47
- type: "clearError";
48
- params: xstate938.NonReducibleUnknown;
49
- };
50
- setStream: {
51
- type: "setStream";
52
- params: xstate938.NonReducibleUnknown;
53
- };
54
- setProgress: {
55
- type: "setProgress";
56
- params: xstate938.NonReducibleUnknown;
57
- };
58
- stopStream: {
59
- type: "stopStream";
60
- params: xstate938.NonReducibleUnknown;
61
- };
62
- setImageAndClearError: {
63
- type: "setImageAndClearError";
64
- params: xstate938.NonReducibleUnknown;
65
- };
66
- }>, never, never, "error" | "idle" | "uploading" | "closed" | "finished" | "initCamera" | "capturing", string, DocumentUploadInput, xstate938.NonReducibleUnknown, xstate938.EventObject, xstate938.MetaObject, {
67
- readonly id: "documentUpload";
68
- readonly initial: "idle";
69
- readonly context: ({
70
- input
71
- }: {
72
- spawn: {
73
- <TSrc extends "uploadDocument" | "initCamera">(logic: TSrc, ...[options]: ({
74
- src: "uploadDocument";
75
- logic: xstate938.PromiseActorLogic<void, {
76
- imageBase64: string;
77
- documentType: string;
78
- onProgress: (progress: number) => void;
79
- }, xstate938.EventObject>;
80
- id: string | undefined;
81
- } extends infer T ? T extends {
82
- src: "uploadDocument";
83
- logic: xstate938.PromiseActorLogic<void, {
84
- imageBase64: string;
85
- documentType: string;
86
- onProgress: (progress: number) => void;
87
- }, xstate938.EventObject>;
88
- id: string | undefined;
89
- } ? T extends {
90
- src: TSrc;
91
- } ? xstate938.ConditionalRequired<[options?: ({
92
- id?: T["id"] | undefined;
93
- systemId?: string;
94
- input?: xstate938.InputFrom<T["logic"]> | undefined;
95
- syncSnapshot?: boolean;
96
- } & { [K in xstate938.RequiredActorOptions<T>]: unknown }) | undefined], xstate938.IsNotNever<xstate938.RequiredActorOptions<T>>> : never : never : never) | ({
97
- src: "initCamera";
98
- logic: xstate938.PromiseActorLogic<MediaStream, void, xstate938.EventObject>;
99
- id: string | undefined;
100
- } extends infer T_1 ? T_1 extends {
101
- src: "initCamera";
102
- logic: xstate938.PromiseActorLogic<MediaStream, void, xstate938.EventObject>;
103
- id: string | undefined;
104
- } ? T_1 extends {
105
- src: TSrc;
106
- } ? xstate938.ConditionalRequired<[options?: ({
107
- id?: T_1["id"] | undefined;
108
- systemId?: string;
109
- input?: xstate938.InputFrom<T_1["logic"]> | undefined;
110
- syncSnapshot?: boolean;
111
- } & { [K_1 in xstate938.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate938.IsNotNever<xstate938.RequiredActorOptions<T_1>>> : never : never : never)): xstate938.ActorRefFromLogic<xstate938.GetConcreteByKey<xstate938.Values<{
112
- uploadDocument: {
113
- src: "uploadDocument";
114
- logic: xstate938.PromiseActorLogic<void, {
115
- imageBase64: string;
116
- documentType: string;
117
- onProgress: (progress: number) => void;
118
- }, xstate938.EventObject>;
119
- id: string | undefined;
120
- };
121
- initCamera: {
122
- src: "initCamera";
123
- logic: xstate938.PromiseActorLogic<MediaStream, void, xstate938.EventObject>;
124
- id: string | undefined;
125
- };
126
- }>, "src", TSrc>["logic"]>;
127
- <TLogic extends xstate938.AnyActorLogic>(src: TLogic, ...[options]: xstate938.ConditionalRequired<[options?: ({
128
- id?: never;
129
- systemId?: string;
130
- input?: xstate938.InputFrom<TLogic> | undefined;
131
- syncSnapshot?: boolean;
132
- } & { [K in xstate938.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate938.IsNotNever<xstate938.RequiredLogicInput<TLogic>>>): xstate938.ActorRefFromLogic<TLogic>;
133
- };
134
- input: DocumentUploadInput;
135
- self: xstate938.ActorRef<xstate938.MachineSnapshot<DocumentUploadContext, {
136
- type: "START";
137
- } | {
138
- type: "CAPTURE";
139
- imageBase64: string;
140
- } | {
141
- type: "UPLOAD_PROGRESS";
142
- progress: number;
143
- } | {
144
- type: "RETRY";
145
- } | {
146
- type: "CLOSE";
147
- }, Record<string, xstate938.AnyActorRef | undefined>, xstate938.StateValue, string, unknown, any, any>, {
148
- type: "START";
149
- } | {
150
- type: "CAPTURE";
151
- imageBase64: string;
152
- } | {
153
- type: "UPLOAD_PROGRESS";
154
- progress: number;
155
- } | {
156
- type: "RETRY";
157
- } | {
158
- type: "CLOSE";
159
- }, xstate938.AnyEventObject>;
160
- }) => {
161
- config: DocumentUploadConfig;
162
- stream: undefined;
163
- imageBase64: undefined;
164
- progress: number;
165
- error: undefined;
166
- };
167
- readonly states: {
168
- readonly idle: {
169
- readonly on: {
170
- readonly START: {
171
- readonly target: "initCamera";
172
- };
173
- };
174
- };
175
- readonly initCamera: {
176
- readonly invoke: {
177
- readonly id: "initCamera";
178
- readonly src: "initCamera";
179
- readonly input: undefined;
180
- readonly onDone: {
181
- readonly target: "capturing";
182
- readonly actions: "setStream";
183
- };
184
- readonly onError: {
185
- readonly target: "error";
186
- readonly actions: "setError";
187
- };
188
- };
189
- readonly on: {
190
- readonly CLOSE: {
191
- readonly target: "closed";
192
- };
193
- };
194
- };
195
- readonly capturing: {
196
- readonly on: {
197
- readonly CAPTURE: {
198
- readonly target: "uploading";
199
- readonly actions: "setImageAndClearError";
200
- };
201
- readonly CLOSE: {
202
- readonly target: "closed";
203
- readonly actions: "stopStream";
204
- };
205
- };
206
- };
207
- readonly uploading: {
208
- readonly invoke: {
209
- readonly id: "uploadDocument";
210
- readonly src: "uploadDocument";
211
- readonly input: ({
212
- context,
213
- self
214
- }: {
215
- context: DocumentUploadContext;
216
- event: {
217
- type: "START";
218
- } | {
219
- type: "CAPTURE";
220
- imageBase64: string;
221
- } | {
222
- type: "UPLOAD_PROGRESS";
223
- progress: number;
224
- } | {
225
- type: "RETRY";
226
- } | {
227
- type: "CLOSE";
228
- };
229
- self: xstate938.ActorRef<xstate938.MachineSnapshot<DocumentUploadContext, {
230
- type: "START";
231
- } | {
232
- type: "CAPTURE";
233
- imageBase64: string;
234
- } | {
235
- type: "UPLOAD_PROGRESS";
236
- progress: number;
237
- } | {
238
- type: "RETRY";
239
- } | {
240
- type: "CLOSE";
241
- }, Record<string, xstate938.AnyActorRef>, xstate938.StateValue, string, unknown, any, any>, {
242
- type: "START";
243
- } | {
244
- type: "CAPTURE";
245
- imageBase64: string;
246
- } | {
247
- type: "UPLOAD_PROGRESS";
248
- progress: number;
249
- } | {
250
- type: "RETRY";
251
- } | {
252
- type: "CLOSE";
253
- }, xstate938.AnyEventObject>;
254
- }) => {
255
- imageBase64: string;
256
- documentType: string;
257
- onProgress: (progress: number) => void;
258
- };
259
- readonly onDone: {
260
- readonly target: "finished";
261
- readonly actions: "stopStream";
262
- };
263
- readonly onError: {
264
- readonly target: "error";
265
- readonly actions: readonly ["setError", "stopStream"];
266
- };
267
- };
268
- readonly on: {
269
- readonly UPLOAD_PROGRESS: {
270
- readonly actions: "setProgress";
271
- };
272
- };
273
- };
274
- readonly error: {
275
- readonly on: {
276
- readonly RETRY: {
277
- readonly target: "initCamera";
278
- readonly actions: "clearError";
279
- };
280
- readonly CLOSE: {
281
- readonly target: "closed";
282
- readonly actions: "stopStream";
283
- };
284
- };
285
- };
286
- readonly finished: {
287
- readonly type: "final";
288
- };
289
- readonly closed: {
290
- readonly type: "final";
291
- };
292
- };
293
- }>;
294
- //#endregion
295
- //#region src/modules/document-upload/documentUploadActor.d.ts
296
- type CreateDocumentUploadActorOptions = {
297
- config: DocumentUploadConfig;
298
- };
299
- //#endregion
300
- //#region src/modules/document-upload/documentUploadManager.d.ts
301
- type DocumentUploadInitializingState = {
302
- status: 'initializing';
303
- };
304
- type DocumentUploadCapturingState = {
305
- status: 'capturing';
306
- stream: MediaStream;
307
- };
308
- type DocumentUploadUploadingState = {
309
- status: 'uploading';
310
- progress: number;
311
- };
312
- type DocumentUploadErrorState = {
313
- status: 'error';
314
- error: string;
315
- };
316
- type DocumentUploadFinishedState = {
317
- status: 'finished';
318
- };
319
- type DocumentUploadClosedState = {
320
- status: 'closed';
321
- };
322
- type DocumentUploadState = DocumentUploadInitializingState | DocumentUploadCapturingState | DocumentUploadUploadingState | DocumentUploadErrorState | DocumentUploadFinishedState | DocumentUploadClosedState;
323
- declare function createDocumentUploadManager(options: CreateDocumentUploadActorOptions): Manager<DocumentUploadState> & {
324
- load(): void;
325
- capture(imageBase64: string): void;
326
- retry(): void;
327
- close(): void;
328
- };
329
- type DocumentUploadManager = ReturnType<typeof createDocumentUploadManager>;
330
- //#endregion
331
- export { type DocumentUploadConfig, type DocumentUploadManager, type DocumentUploadState, createDocumentUploadManager, documentUploadMachine };
@@ -1,203 +0,0 @@
1
- import { t as api } from "./api-CESGtpbH.esm.js";
2
- import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
3
- import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
4
- import { a as fromPromise, c as createManager, r as assign, s as createActor, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
5
- import "./ITimerCapability-C67ZRskg.esm.js";
6
- import { i as stopCameraStream } from "./camera-PA2Ljri3.esm.js";
7
- import "./platform-CfrjKhmi.esm.js";
8
- import { t as getBackCameraStream } from "./backCameraStream-DMdMeGk2.esm.js";
9
-
10
- //#region src/modules/document-upload/documentUploadServices.ts
11
- async function uploadDocument({ imageBase64, documentType, onProgress, signal }) {
12
- const url = `${endpoints.addDocument}?type=${encodeURIComponent(documentType)}`;
13
- const response = await api.post(url, { base64Image: imageBase64 }, {
14
- signal,
15
- onUploadProgress: onProgress
16
- });
17
- if (!response.ok) throw new Error(`Document upload failed: ${response.status} ${response.statusText}`);
18
- }
19
-
20
- //#endregion
21
- //#region src/modules/document-upload/documentUploadStateMachine.ts
22
- const documentUploadMachine = setup({
23
- types: {
24
- context: {},
25
- events: {},
26
- input: {}
27
- },
28
- actors: {
29
- initCamera: fromPromise(async () => {
30
- const { stream } = await getBackCameraStream(void 0);
31
- return stream;
32
- }),
33
- uploadDocument: fromPromise(async ({ input, signal }) => {
34
- return uploadDocument({
35
- imageBase64: input.imageBase64,
36
- documentType: input.documentType,
37
- onProgress: input.onProgress,
38
- signal
39
- });
40
- })
41
- },
42
- actions: {
43
- setStream: assign(({ event }) => ({ stream: event.output })),
44
- setImageAndClearError: assign(({ event }) => {
45
- return {
46
- imageBase64: event.imageBase64,
47
- error: void 0
48
- };
49
- }),
50
- setProgress: assign(({ event }) => ({ progress: event.progress })),
51
- setError: assign(({ event }) => ({ error: String(event.error) })),
52
- clearError: assign({ error: () => void 0 }),
53
- stopStream: assign(({ context }) => {
54
- if (context.stream) stopCameraStream(context.stream);
55
- return { stream: void 0 };
56
- })
57
- }
58
- }).createMachine({
59
- id: "documentUpload",
60
- initial: "idle",
61
- context: ({ input }) => ({
62
- config: input.config,
63
- stream: void 0,
64
- imageBase64: void 0,
65
- progress: 0,
66
- error: void 0
67
- }),
68
- states: {
69
- idle: { on: { START: { target: "initCamera" } } },
70
- initCamera: {
71
- invoke: {
72
- id: "initCamera",
73
- src: "initCamera",
74
- input: void 0,
75
- onDone: {
76
- target: "capturing",
77
- actions: "setStream"
78
- },
79
- onError: {
80
- target: "error",
81
- actions: "setError"
82
- }
83
- },
84
- on: { CLOSE: { target: "closed" } }
85
- },
86
- capturing: { on: {
87
- CAPTURE: {
88
- target: "uploading",
89
- actions: "setImageAndClearError"
90
- },
91
- CLOSE: {
92
- target: "closed",
93
- actions: "stopStream"
94
- }
95
- } },
96
- uploading: {
97
- invoke: {
98
- id: "uploadDocument",
99
- src: "uploadDocument",
100
- input: ({ context, self }) => {
101
- const imageBase64 = context.imageBase64;
102
- if (!imageBase64) throw new Error("No image to upload");
103
- return {
104
- imageBase64,
105
- documentType: context.config.documentType,
106
- onProgress: (progress) => {
107
- self.send({
108
- type: "UPLOAD_PROGRESS",
109
- progress
110
- });
111
- }
112
- };
113
- },
114
- onDone: {
115
- target: "finished",
116
- actions: "stopStream"
117
- },
118
- onError: {
119
- target: "error",
120
- actions: ["setError", "stopStream"]
121
- }
122
- },
123
- on: { UPLOAD_PROGRESS: { actions: "setProgress" } }
124
- },
125
- error: { on: {
126
- RETRY: {
127
- target: "initCamera",
128
- actions: "clearError"
129
- },
130
- CLOSE: {
131
- target: "closed",
132
- actions: "stopStream"
133
- }
134
- } },
135
- finished: { type: "final" },
136
- closed: { type: "final" }
137
- }
138
- });
139
-
140
- //#endregion
141
- //#region src/modules/document-upload/documentUploadActor.ts
142
- function createDocumentUploadActor(options) {
143
- return createActor(documentUploadMachine, { input: { config: options.config } }).start();
144
- }
145
-
146
- //#endregion
147
- //#region src/modules/document-upload/documentUploadManager.ts
148
- function mapState(snapshot) {
149
- const typedSnapshot = snapshot;
150
- const { context } = typedSnapshot;
151
- if (typedSnapshot.matches("idle") || typedSnapshot.matches("initCamera")) return { status: "initializing" };
152
- if (typedSnapshot.matches("capturing")) {
153
- if (!context.stream) return { status: "initializing" };
154
- return {
155
- status: "capturing",
156
- stream: context.stream
157
- };
158
- }
159
- if (typedSnapshot.matches("uploading")) return {
160
- status: "uploading",
161
- progress: context.progress
162
- };
163
- if (typedSnapshot.matches("error")) return {
164
- status: "error",
165
- error: context.error ?? "Upload failed"
166
- };
167
- if (typedSnapshot.matches("finished")) return { status: "finished" };
168
- if (typedSnapshot.matches("closed")) return { status: "closed" };
169
- return { status: "initializing" };
170
- }
171
- function createApi({ actor, trackElementClicked }) {
172
- return {
173
- load() {
174
- actor.send({ type: "START" });
175
- },
176
- capture(imageBase64) {
177
- trackElementClicked?.("capture");
178
- actor.send({
179
- type: "CAPTURE",
180
- imageBase64
181
- });
182
- },
183
- retry() {
184
- trackElementClicked?.("retry");
185
- actor.send({ type: "RETRY" });
186
- },
187
- close() {
188
- trackElementClicked?.("close");
189
- actor.send({ type: "CLOSE" });
190
- }
191
- };
192
- }
193
- function createDocumentUploadManager(options) {
194
- return createManager({
195
- actor: createDocumentUploadActor(options),
196
- mapState,
197
- createApi,
198
- instrumentation: createManagerInstrumentation(eventModuleNames.document)
199
- });
200
- }
201
-
202
- //#endregion
203
- export { createDocumentUploadManager, documentUploadMachine };