@incodetech/core 2.0.1 → 2.1.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 (218) hide show
  1. package/dist/{BrowserStorageProvider-CuOW1Er2.esm.js → BrowserStorageProvider-BpJM-gIl.esm.js} +8 -1
  2. package/dist/{IpifyProvider-D7jx52AL.esm.js → IpifyProvider-D4LWD15E.esm.js} +28 -0
  3. package/dist/{MotionSensorProvider-4v7xkqAp.esm.js → MotionSensorProvider-Bx7Mpzt0.esm.js} +63 -13
  4. package/dist/{OpenViduRecordingProvider-CMu6XVdc.esm.js → OpenViduRecordingProvider-O4GjBseO.esm.js} +1 -1
  5. package/dist/StateMachine-BC_nGvrc.d.ts +2 -0
  6. package/dist/StreamCanvasCapture-ImiDQdVA.esm.js +118 -0
  7. package/dist/StreamCanvasCapture-yyl20qd9.d.ts +152 -0
  8. package/dist/{BaseWasmProvider-C_DLEI40.esm.js → WasmUtilProvider-CiEN7Gjn.esm.js} +183 -11
  9. package/dist/{addressSearch-BpTbTWCa.esm.js → addressSearch-DvmWXKZg.esm.js} +63 -57
  10. package/dist/{ae-signature-DDDZmWXj.esm.js → ae-signature-BFZta3TZ.esm.js} +1 -1
  11. package/dist/ae-signature.d.ts +3 -3
  12. package/dist/ae-signature.esm.js +6 -5
  13. package/dist/antifraud.d.ts +5 -46
  14. package/dist/antifraud.esm.js +6 -43
  15. package/dist/antifraudManager-CkV4u-LE.esm.js +55 -0
  16. package/dist/antifraudManager-CznnhyvD.d.ts +63 -0
  17. package/dist/{antifraudStateMachine-O0TMf6yc.esm.js → antifraudStateMachine-Ccrb-Jxc.esm.js} +2 -2
  18. package/dist/apiError-B-j-gyDx.esm.js +51 -0
  19. package/dist/authentication.d.ts +13 -11
  20. package/dist/authentication.esm.js +26 -22
  21. package/dist/{authenticationManager-C83GNIhl.d.ts → authenticationManager-CIVY80H9.d.ts} +4 -4
  22. package/dist/{authenticationManager-5M-fKzXx.esm.js → authenticationManager-ZNotsWnC.esm.js} +6 -6
  23. package/dist/{authenticationStateMachine-BMZqatiF.esm.js → authenticationStateMachine-DksVbF_H.esm.js} +21 -9
  24. package/dist/{backCameraStream-DMdMeGk2.esm.js → backCameraStream-D7Wo4Nbx.esm.js} +95 -7
  25. package/dist/{session-CrkWAs-q.esm.js → browserSimulation-B1dWiXp7.esm.js} +61 -476
  26. package/dist/camera.d.ts +4 -3
  27. package/dist/camera.esm.js +4 -3
  28. package/dist/canvas-SKcRBxsk.esm.js +230 -0
  29. package/dist/consent.d.ts +4 -398
  30. package/dist/consent.esm.js +6 -77
  31. package/dist/consentManager-BLd51QiW.d.ts +419 -0
  32. package/dist/consentManager-BYo9Nu1r.esm.js +90 -0
  33. package/dist/{consentStateMachine-CCT-B60O.esm.js → consentStateMachine-BG3yL8aC.esm.js} +9 -6
  34. package/dist/cpf-ocr.d.ts +4 -199
  35. package/dist/cpf-ocr.esm.js +8 -177
  36. package/dist/cpfOcrManager-BnieFXuG.d.ts +216 -0
  37. package/dist/cpfOcrManager-sSKegxox.esm.js +190 -0
  38. package/dist/cross-document-data-match.d.ts +1 -1
  39. package/dist/cross-document-data-match.esm.js +4 -4
  40. package/dist/curp-validation.d.ts +8 -158
  41. package/dist/curp-validation.esm.js +6 -108
  42. package/dist/curpValidationManager-CFem6zP9.esm.js +122 -0
  43. package/dist/curpValidationManager-RttixpIc.d.ts +184 -0
  44. package/dist/{curpValidationStateMachine-CitWLr2c.esm.js → curpValidationStateMachine-B7V_qp66.esm.js} +20 -13
  45. package/dist/custom-fields.d.ts +2 -2
  46. package/dist/custom-fields.esm.js +4 -4
  47. package/dist/custom-watchlist.d.ts +1 -1
  48. package/dist/custom-watchlist.esm.js +4 -41
  49. package/dist/customWatchlistStateMachine-HmFybXLX.esm.js +50 -0
  50. package/dist/{deepsightLoader-Cm4JIT_z.esm.js → deepsightLoader-65k1Appi.esm.js} +19 -10
  51. package/dist/{deepsightService-CEVxzehb.d.ts → deepsightService-B7ShOkWL.d.ts} +8 -160
  52. package/dist/deepsightService-CrHmvx8X.esm.js +276 -0
  53. package/dist/device.esm.js +4 -3
  54. package/dist/document-capture.d.ts +995 -86
  55. package/dist/document-capture.esm.js +34 -8
  56. package/dist/document-upload.d.ts +47 -47
  57. package/dist/document-upload.esm.js +7 -7
  58. package/dist/{documentCaptureStateMachine-BqzTDy9k.esm.js → documentCaptureStateMachine-WYV1r9le.esm.js} +90 -6
  59. package/dist/dynamic-forms.d.ts +20 -5
  60. package/dist/dynamic-forms.esm.js +150 -61
  61. package/dist/ekyb.d.ts +32 -13
  62. package/dist/ekyb.esm.js +25 -15
  63. package/dist/{ekybStateMachine-CyMx_kg-.esm.js → ekybStateMachine-aYixw2sL.esm.js} +319 -207
  64. package/dist/ekyc.d.ts +10 -78
  65. package/dist/ekyc.esm.js +17 -12
  66. package/dist/{ekycStateMachine-oeO0Iekd.esm.js → ekycStateMachine-CXbpaJJn.esm.js} +201 -113
  67. package/dist/electronic-signature.d.ts +3 -3
  68. package/dist/electronic-signature.esm.js +5 -4
  69. package/dist/{electronicSignatureManager-D9OHzTpG.esm.js → electronicSignatureManager-BaECdJ1u.esm.js} +91 -23
  70. package/dist/email.d.ts +4 -3
  71. package/dist/email.esm.js +6 -5
  72. package/dist/{emailManager-wAV0LE-H.esm.js → emailManager--D5G3ChB.esm.js} +30 -7
  73. package/dist/{emailManager-DIfnS5g1.d.ts → emailManager-lAzDoQOs.d.ts} +66 -8
  74. package/dist/{emailStateMachine-DOf4j58N.esm.js → emailStateMachine-CxTOMAjC.esm.js} +46 -11
  75. package/dist/{endpoints-CnN3SyDa.esm.js → endpoints-BeTK0Mlt.esm.js} +6 -3
  76. package/dist/{events-D6-e4vok.esm.js → events-Dvvriq9l.esm.js} +3 -1
  77. package/dist/events.d.ts +2 -0
  78. package/dist/events.esm.js +1 -1
  79. package/dist/extensibility.d.ts +32 -16
  80. package/dist/extensibility.esm.js +55 -33
  81. package/dist/face-match.d.ts +32 -2
  82. package/dist/face-match.esm.js +5 -5
  83. package/dist/{faceCaptureManagerFactory-yqtpxjnN.d.ts → faceCaptureManagerFactory-C_hRHx8a.d.ts} +35 -11
  84. package/dist/{faceCaptureManagerFactory-Dh2PdGlF.esm.js → faceCaptureManagerFactory-kqbUqtrr.esm.js} +21 -5
  85. package/dist/{faceCaptureSetup-B3faSpYA.esm.js → faceCaptureSetup-CtvHWd3x.esm.js} +68 -183
  86. package/dist/{faceMatchStateMachine-DNFrxTFS.esm.js → faceMatchStateMachine-DdGXUBnx.esm.js} +60 -6
  87. package/dist/field-comparison.d.ts +4 -0
  88. package/dist/field-comparison.esm.js +7 -0
  89. package/dist/fieldComparisonManager-Bu5TaSr3.d.ts +76 -0
  90. package/dist/fieldComparisonManager-COGI2ARD.esm.js +162 -0
  91. package/dist/fiscal-qr.d.ts +59 -0
  92. package/dist/fiscal-qr.esm.js +323 -0
  93. package/dist/flow-events.d.ts +6 -5
  94. package/dist/flow.d.ts +23 -15
  95. package/dist/flow.esm.js +63 -17
  96. package/dist/flowCompletionService-BdR2cGgB.d.ts +19 -0
  97. package/dist/flowCompletionService-DdGojV9K.esm.js +20 -0
  98. package/dist/{flowServices-PiNsxLfK.esm.js → flowServices-BTuHLHVr.esm.js} +10 -5
  99. package/dist/geolocation.d.ts +4 -4
  100. package/dist/geolocation.esm.js +6 -6
  101. package/dist/{geolocationStateMachine-asasuHY2.esm.js → geolocationStateMachine-Dvh7X0wF.esm.js} +5 -5
  102. package/dist/getBrowser-C8DP7oTB.esm.js +8 -0
  103. package/dist/{getBrowser-BSXUTWXw.esm.js → getDeviceClass-C0olyNFS.esm.js} +1 -8
  104. package/dist/{getDeviceClass-BSntT9_j.esm.js → getDeviceClass-C8Do2qYu.esm.js} +1 -1
  105. package/dist/government-validation.d.ts +28 -8
  106. package/dist/government-validation.esm.js +19 -8
  107. package/dist/{governmentValidationStateMachine-BDDYrJTo.esm.js → governmentValidationStateMachine-DcJ-BfsC.esm.js} +35 -77
  108. package/dist/home.d.ts +15 -14
  109. package/dist/home.esm.js +2 -2
  110. package/dist/http-Cai3IoLS.esm.js +0 -0
  111. package/dist/http.esm.js +1 -0
  112. package/dist/id-ocr.d.ts +54 -54
  113. package/dist/id-ocr.esm.js +5 -5
  114. package/dist/id-verification.d.ts +27 -27
  115. package/dist/id-verification.esm.js +4 -4
  116. package/dist/id.d.ts +12 -10
  117. package/dist/id.esm.js +36 -26
  118. package/dist/{idCaptureManager-Fyd0eam-.d.ts → idCaptureManager-D-QYESvF.d.ts} +28 -14
  119. package/dist/{idCaptureManager-D0ktk7Hh.esm.js → idCaptureManager-DGVv5l1_.esm.js} +22 -7
  120. package/dist/{idCaptureStateMachine-dwlBUjbC.esm.js → idCaptureStateMachine-DHi7HydI.esm.js} +172 -123
  121. package/dist/{idOcrStateMachine-YbjjC_Gg.esm.js → idOcrStateMachine-CDQ5d_VM.esm.js} +4 -4
  122. package/dist/{idVerificationStateMachine-xbw9HP1Z.esm.js → idVerificationStateMachine-kRxwImzO.esm.js} +2 -2
  123. package/dist/identity-reuse.d.ts +4 -530
  124. package/dist/identity-reuse.esm.js +8 -274
  125. package/dist/identityReuseManager-C6n_97dw.esm.js +95 -0
  126. package/dist/identityReuseManager-DwLtVzUn.d.ts +428 -0
  127. package/dist/identityReuseStateMachine-BfE5YiEr.esm.js +148 -0
  128. package/dist/{index-BcRG8rtJ.d.ts → index-B5hPA0Bg.d.ts} +2 -2
  129. package/dist/{index-ChHWNH48.d.ts → index-B9NysVDB.d.ts} +469 -195
  130. package/dist/index.d.ts +2 -2
  131. package/dist/index.esm.js +10 -8
  132. package/dist/{invokeOnCaptureCallback-rc6kBHo5.esm.js → invokeOnCaptureCallback-ygByVdnn.esm.js} +1 -1
  133. package/dist/{lib-BB0B_qQX.esm.js → lib-BY67lgbq.esm.js} +1 -1
  134. package/dist/mandatory-consent.d.ts +8 -412
  135. package/dist/mandatory-consent.esm.js +6 -76
  136. package/dist/mandatoryConsentManager-H6D18cZB.esm.js +89 -0
  137. package/dist/mandatoryConsentManager-KfIlURRY.d.ts +429 -0
  138. package/dist/{mandatoryConsentStateMachine-Cnco1jvn.esm.js → mandatoryConsentStateMachine-DtQNW1ji.esm.js} +6 -6
  139. package/dist/openviduLazy-B8L--0oe.esm.js +3 -0
  140. package/dist/{openviduLazy-Cok70ZSg.esm.js → openviduLazy-Dh14JNJc.esm.js} +2 -2
  141. package/dist/otp-CGMdUzBC.esm.js +33 -0
  142. package/dist/otp-DF5A0sFx.d.ts +8 -0
  143. package/dist/permissionGuards-C1ispV96.esm.js +23 -0
  144. package/dist/permissionServices-CG3bMSfG.esm.js +130 -0
  145. package/dist/phone.d.ts +4 -3
  146. package/dist/phone.esm.js +6 -5
  147. package/dist/{phoneManager-DAJbGhlY.esm.js → phoneManager-BmF-0Ez4.esm.js} +30 -7
  148. package/dist/{phoneManager-B6M30hKE.d.ts → phoneManager-fPmIBYQK.d.ts} +65 -7
  149. package/dist/{phoneStateMachine-CuPARRaT.esm.js → phoneStateMachine-BiV0yoEx.esm.js} +46 -11
  150. package/dist/{qe-signature-DFo_Cc-I.esm.js → qe-signature-CUYPcHVo.esm.js} +1 -1
  151. package/dist/qe-signature.d.ts +3 -3
  152. package/dist/qe-signature.esm.js +6 -5
  153. package/dist/{recordingService-Ig2UgbLv.esm.js → recordingService-Bn9EdCmz.esm.js} +197 -179
  154. package/dist/redirect-to-mobile.d.ts +6 -104
  155. package/dist/redirect-to-mobile.esm.js +6 -99
  156. package/dist/redirectToMobileManager-BNe3IzC_.d.ts +178 -0
  157. package/dist/redirectToMobileManager-Dy3t7o0C.esm.js +159 -0
  158. package/dist/{redirectToMobileStateMachine-BOEqe46A.esm.js → redirectToMobileStateMachine-DyAdRxfP.esm.js} +28 -19
  159. package/dist/{runChildModule-CqqwqAkW.esm.js → runChildModule-CuoHZ1cx.esm.js} +35 -3
  160. package/dist/selfie.d.ts +13 -11
  161. package/dist/selfie.esm.js +27 -23
  162. package/dist/{selfieManager-Duisl7qN.esm.js → selfieManager-BjCoKRy0.esm.js} +6 -6
  163. package/dist/{selfieManager-D0lSgd-J.d.ts → selfieManager-dUbKRzOh.d.ts} +4 -4
  164. package/dist/{selfieStateMachine-D76whWEf.esm.js → selfieStateMachine-b4F2q9zw.esm.js} +5 -3
  165. package/dist/session-DoVb-OcB.esm.js +152 -0
  166. package/dist/session.d.ts +37 -5
  167. package/dist/session.esm.js +12 -7
  168. package/dist/sessionInitializer-B8H5MsXM.esm.js +366 -0
  169. package/dist/{setup-C5AITV8m.d.ts → setup-BbkprdVv.d.ts} +57 -6
  170. package/dist/{setup-DPPAxmXf.esm.js → setup-BqEfrdja.esm.js} +162 -24
  171. package/dist/signature.d.ts +2 -2
  172. package/dist/signature.esm.js +4 -4
  173. package/dist/{signatureStateMachine-B5-QVUve.esm.js → signatureStateMachine-C5qqYLRz.esm.js} +3 -3
  174. package/dist/stats-BMNUG1AU.esm.js +41 -0
  175. package/dist/stats.d.ts +13 -2
  176. package/dist/stats.esm.js +3 -2
  177. package/dist/trust-graph.d.ts +33 -4
  178. package/dist/trust-graph.esm.js +21 -15
  179. package/dist/{types-CFV9G_7j.d.ts → types-Bj9hdFjU.d.ts} +1 -1
  180. package/dist/{types-BP1m8VRw.d.ts → types-DOUhndhT.d.ts} +14 -2
  181. package/dist/types-DsnEVMhr.esm.js +34 -0
  182. package/dist/types-DvGZI7BF.d.ts +131 -0
  183. package/dist/{types-B06Ypu2F.d.ts → types-NuT8ftBV.d.ts} +1 -1
  184. package/dist/types-ya0LN_MX.d.ts +5 -0
  185. package/dist/{warmup-CEcppFiS.d.ts → warmup-Dg8Lh-50.d.ts} +8 -0
  186. package/dist/wasm.d.ts +6 -4
  187. package/dist/wasm.esm.js +11 -9
  188. package/dist/watchlist-for-business.d.ts +1 -1
  189. package/dist/watchlist-for-business.esm.js +5 -73
  190. package/dist/watchlist.d.ts +1 -1
  191. package/dist/watchlist.esm.js +4 -41
  192. package/dist/watchlistForBusinessStateMachine-DMl8j2Ov.esm.js +74 -0
  193. package/dist/watchlistStateMachine-DmQlqI6L.esm.js +50 -0
  194. package/dist/workflow.d.ts +150 -97
  195. package/dist/workflow.esm.js +156 -80
  196. package/package.json +19 -1
  197. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  198. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  199. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  200. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  201. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  202. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  203. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  204. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  205. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  206. package/dist/stats-CIfiPzb1.esm.js +0 -16
  207. package/dist/types-CAD4va6a.d.ts +0 -5
  208. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  209. /package/dist/{Actor-CI32dTbG.d.ts → Actor-Y0_Fj-KL.d.ts} +0 -0
  210. /package/dist/{ITimerCapability-C67ZRskg.esm.js → ITimerCapability-CB0I1Uf2.esm.js} +0 -0
  211. /package/dist/{Manager-C8PrhBOx.d.ts → Manager-BHn8wH8K.d.ts} +0 -0
  212. /package/dist/{camera-PA2Ljri3.esm.js → camera-DJWm3V4g.esm.js} +0 -0
  213. /package/dist/{camera-DBSxa6ML.d.ts → camera-SRBpPq2X.d.ts} +0 -0
  214. /package/dist/{chunk-CRF6K_H_.esm.js → chunk-CMUKZ2uL.esm.js} +0 -0
  215. /package/dist/{cpf-PPz2Njto.esm.js → cpf-BRzggV8G.esm.js} +0 -0
  216. /package/dist/{dateUtils-UoN5xswP.esm.js → dateUtils-AksLQmgV.esm.js} +0 -0
  217. /package/dist/{platform-CfrjKhmi.esm.js → platform-SKvEfCBh.esm.js} +0 -0
  218. /package/dist/{xstate.esm-B70JrNqo.esm.js → xstate.esm-C9wncMQa.esm.js} +0 -0
@@ -0,0 +1,428 @@
1
+ import { t as Manager } from "./Manager-BHn8wH8K.js";
2
+ import { t as ActorRefFrom } from "./Actor-Y0_Fj-KL.js";
3
+ import * as xstate0 from "xstate";
4
+
5
+ //#region src/modules/identity-reuse/types.d.ts
6
+
7
+ /**
8
+ * Configuration options for the IdentityReuse module.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const config: IdentityReuseConfig = {};
13
+ * ```
14
+ */
15
+ type IdentityReuseConfig = {};
16
+ /**
17
+ * A reusable identity document previously verified with a partner organization.
18
+ * Internal shape consumed by the state machine, manager, and UI; the service
19
+ * layer adapts the raw backend payload to this shape.
20
+ *
21
+ * Backend orders the array — the first entry is the best match. The
22
+ * "Recommended" tag in the UI is purely positional; no backend field for it.
23
+ */
24
+ type ReusableDocument = {
25
+ /** Stable document identifier (uuid). Used as `documentId` in submit. */
26
+ id: string;
27
+ /** Document category, normalized to camelCase (e.g. "driversLicense"). */
28
+ documentType: string;
29
+ /** Masked identifier shown to the user (e.g. "00*****29"). */
30
+ maskedNumber: string;
31
+ /**
32
+ * Country code as returned by the backend (ISO 3166-1 alpha-3, e.g. "SRB").
33
+ * UI is responsible for any presentation transforms (flag emoji, etc.).
34
+ */
35
+ countryCode: string;
36
+ /**
37
+ * Verification timestamp as a Unix epoch in seconds (may include fractional
38
+ * milliseconds). Pass-through from the backend's `validatedAt`; the UI layer
39
+ * is responsible for any Date construction or formatting.
40
+ */
41
+ verifiedAt: number;
42
+ };
43
+ /**
44
+ * Documents returned by the service layer after adapting the backend payload.
45
+ * Always an array; ordered by backend with the best match first.
46
+ */
47
+ type FetchDocumentsResponse = ReusableDocument[];
48
+ /**
49
+ * @internal Request body for POST /omni/identity-reuse/submit.
50
+ *
51
+ * - `{ accepted: true, documentId }` — user is reusing the selected document.
52
+ * - `{ accepted: false }` — user opted to scan a new document instead.
53
+ */
54
+ type SubmitParams = {
55
+ accepted: true;
56
+ documentId: string;
57
+ } | {
58
+ accepted: false;
59
+ };
60
+ /** @internal Response from POST /omni/identity-reuse/submit — shape TBD */
61
+ type SubmitResponse = {};
62
+ //#endregion
63
+ //#region src/modules/identity-reuse/identityReuseStateMachine.d.ts
64
+ /**
65
+ * Sentinel selection value for the "Scan a new document" row in the picker.
66
+ * Picked + SUBMIT calls /submit with `{ accepted: false }`, then finishes.
67
+ */
68
+ declare const SCAN_NEW_DOCUMENT: "scanNew";
69
+ type SelectedDocumentId = string | typeof SCAN_NEW_DOCUMENT;
70
+ type IdentityReuseContext = {
71
+ config: IdentityReuseConfig;
72
+ documents: ReusableDocument[];
73
+ selectedDocumentId: SelectedDocumentId | undefined;
74
+ error: string | undefined;
75
+ };
76
+ type IdentityReuseInput = {
77
+ config: IdentityReuseConfig;
78
+ };
79
+ declare const identityReuseMachine: xstate0.StateMachine<IdentityReuseContext, {
80
+ type: "LOAD";
81
+ } | {
82
+ type: "DOCUMENT_CHOSEN";
83
+ documentId: SelectedDocumentId;
84
+ } | {
85
+ type: "SUBMIT";
86
+ } | {
87
+ type: "SKIP";
88
+ } | {
89
+ type: "RETRY";
90
+ }, {
91
+ [x: string]: xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<FetchDocumentsResponse, void, xstate0.EventObject>> | xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<SubmitResponse, SubmitParams, xstate0.EventObject>> | undefined;
92
+ }, xstate0.Values<{
93
+ fetchDocuments: {
94
+ src: "fetchDocuments";
95
+ logic: xstate0.PromiseActorLogic<FetchDocumentsResponse, void, xstate0.EventObject>;
96
+ id: string | undefined;
97
+ };
98
+ submitDocument: {
99
+ src: "submitDocument";
100
+ logic: xstate0.PromiseActorLogic<SubmitResponse, SubmitParams, xstate0.EventObject>;
101
+ id: string | undefined;
102
+ };
103
+ }>, xstate0.Values<{
104
+ setDocuments: {
105
+ type: "setDocuments";
106
+ params: xstate0.NonReducibleUnknown;
107
+ };
108
+ setSelectedDocument: {
109
+ type: "setSelectedDocument";
110
+ params: xstate0.NonReducibleUnknown;
111
+ };
112
+ setError: {
113
+ type: "setError";
114
+ params: xstate0.NonReducibleUnknown;
115
+ };
116
+ clearError: {
117
+ type: "clearError";
118
+ params: xstate0.NonReducibleUnknown;
119
+ };
120
+ }>, xstate0.Values<{
121
+ hasDocuments: {
122
+ type: "hasDocuments";
123
+ params: unknown;
124
+ };
125
+ hasSelection: {
126
+ type: "hasSelection";
127
+ params: unknown;
128
+ };
129
+ }>, never, "error" | "idle" | "finished" | "loading" | "documentsFound" | "submitting", string, IdentityReuseInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
130
+ readonly id: "identityReuse";
131
+ readonly initial: "idle";
132
+ readonly context: ({
133
+ input
134
+ }: {
135
+ spawn: {
136
+ <TSrc extends "fetchDocuments" | "submitDocument">(logic: TSrc, ...[options]: ({
137
+ src: "fetchDocuments";
138
+ logic: xstate0.PromiseActorLogic<FetchDocumentsResponse, void, xstate0.EventObject>;
139
+ id: string | undefined;
140
+ } extends infer T ? T extends {
141
+ src: "fetchDocuments";
142
+ logic: xstate0.PromiseActorLogic<FetchDocumentsResponse, void, xstate0.EventObject>;
143
+ id: string | undefined;
144
+ } ? T extends {
145
+ src: TSrc;
146
+ } ? xstate0.ConditionalRequired<[options?: ({
147
+ id?: T["id"] | undefined;
148
+ systemId?: string;
149
+ input?: xstate0.InputFrom<T["logic"]> | undefined;
150
+ syncSnapshot?: boolean;
151
+ } & { [K in xstate0.RequiredActorOptions<T>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T>>> : never : never : never) | ({
152
+ src: "submitDocument";
153
+ logic: xstate0.PromiseActorLogic<SubmitResponse, SubmitParams, xstate0.EventObject>;
154
+ id: string | undefined;
155
+ } extends infer T_1 ? T_1 extends {
156
+ src: "submitDocument";
157
+ logic: xstate0.PromiseActorLogic<SubmitResponse, SubmitParams, xstate0.EventObject>;
158
+ id: string | undefined;
159
+ } ? T_1 extends {
160
+ src: TSrc;
161
+ } ? xstate0.ConditionalRequired<[options?: ({
162
+ id?: T_1["id"] | undefined;
163
+ systemId?: string;
164
+ input?: xstate0.InputFrom<T_1["logic"]> | undefined;
165
+ syncSnapshot?: boolean;
166
+ } & { [K_1 in xstate0.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T_1>>> : never : never : never)): xstate0.ActorRefFromLogic<xstate0.GetConcreteByKey<xstate0.Values<{
167
+ fetchDocuments: {
168
+ src: "fetchDocuments";
169
+ logic: xstate0.PromiseActorLogic<FetchDocumentsResponse, void, xstate0.EventObject>;
170
+ id: string | undefined;
171
+ };
172
+ submitDocument: {
173
+ src: "submitDocument";
174
+ logic: xstate0.PromiseActorLogic<SubmitResponse, SubmitParams, xstate0.EventObject>;
175
+ id: string | undefined;
176
+ };
177
+ }>, "src", TSrc>["logic"]>;
178
+ <TLogic extends xstate0.AnyActorLogic>(src: TLogic, ...[options]: xstate0.ConditionalRequired<[options?: ({
179
+ id?: never;
180
+ systemId?: string;
181
+ input?: xstate0.InputFrom<TLogic> | undefined;
182
+ syncSnapshot?: boolean;
183
+ } & { [K in xstate0.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredLogicInput<TLogic>>>): xstate0.ActorRefFromLogic<TLogic>;
184
+ };
185
+ input: IdentityReuseInput;
186
+ self: xstate0.ActorRef<xstate0.MachineSnapshot<IdentityReuseContext, {
187
+ type: "LOAD";
188
+ } | {
189
+ type: "DOCUMENT_CHOSEN";
190
+ documentId: SelectedDocumentId;
191
+ } | {
192
+ type: "SUBMIT";
193
+ } | {
194
+ type: "SKIP";
195
+ } | {
196
+ type: "RETRY";
197
+ }, Record<string, xstate0.AnyActorRef | undefined>, xstate0.StateValue, string, unknown, any, any>, {
198
+ type: "LOAD";
199
+ } | {
200
+ type: "DOCUMENT_CHOSEN";
201
+ documentId: SelectedDocumentId;
202
+ } | {
203
+ type: "SUBMIT";
204
+ } | {
205
+ type: "SKIP";
206
+ } | {
207
+ type: "RETRY";
208
+ }, xstate0.AnyEventObject>;
209
+ }) => {
210
+ config: IdentityReuseConfig;
211
+ documents: never[];
212
+ selectedDocumentId: undefined;
213
+ error: undefined;
214
+ };
215
+ readonly states: {
216
+ readonly idle: {
217
+ readonly on: {
218
+ readonly LOAD: {
219
+ readonly target: "loading";
220
+ };
221
+ };
222
+ };
223
+ readonly loading: {
224
+ readonly invoke: {
225
+ readonly id: "fetchDocuments";
226
+ readonly src: "fetchDocuments";
227
+ readonly onDone: readonly [{
228
+ readonly target: "documentsFound";
229
+ readonly guard: "hasDocuments";
230
+ readonly actions: "setDocuments";
231
+ }, {
232
+ readonly target: "finished";
233
+ }];
234
+ readonly onError: {
235
+ readonly target: "error";
236
+ readonly actions: "setError";
237
+ };
238
+ };
239
+ };
240
+ readonly documentsFound: {
241
+ readonly on: {
242
+ readonly DOCUMENT_CHOSEN: {
243
+ readonly actions: "setSelectedDocument";
244
+ };
245
+ readonly SUBMIT: {
246
+ readonly target: "submitting";
247
+ readonly guard: "hasSelection";
248
+ };
249
+ readonly SKIP: {
250
+ readonly target: "finished";
251
+ };
252
+ };
253
+ };
254
+ readonly submitting: {
255
+ readonly invoke: {
256
+ readonly id: "submitDocument";
257
+ readonly src: "submitDocument";
258
+ readonly input: ({
259
+ context
260
+ }: {
261
+ context: IdentityReuseContext;
262
+ }) => SubmitParams;
263
+ readonly onDone: {
264
+ readonly target: "finished";
265
+ };
266
+ readonly onError: {
267
+ readonly target: "error";
268
+ readonly actions: "setError";
269
+ };
270
+ };
271
+ };
272
+ readonly finished: {
273
+ readonly type: "final";
274
+ };
275
+ readonly error: {
276
+ readonly on: {
277
+ readonly RETRY: {
278
+ readonly target: "loading";
279
+ readonly actions: "clearError";
280
+ };
281
+ readonly SKIP: {
282
+ readonly target: "finished";
283
+ };
284
+ };
285
+ };
286
+ };
287
+ }>;
288
+ type IdentityReuseMachine = typeof identityReuseMachine;
289
+ //#endregion
290
+ //#region src/modules/identity-reuse/identityReuseActor.d.ts
291
+ /**
292
+ * Options for creating an IdentityReuse actor.
293
+ */
294
+ type CreateIdentityReuseActorOptions = {
295
+ /** Module configuration */
296
+ config: IdentityReuseConfig;
297
+ };
298
+ /**
299
+ * Type representing a running IdentityReuse actor.
300
+ */
301
+ type IdentityReuseActor = ActorRefFrom<IdentityReuseMachine>;
302
+ //#endregion
303
+ //#region src/modules/identity-reuse/identityReuseManager.d.ts
304
+ /** IdentityReuse manager is in initial state, waiting for `load()` */
305
+ type IdentityReuseIdleState = {
306
+ status: 'idle';
307
+ };
308
+ /** Fetching reusable documents from the backend */
309
+ type IdentityReuseLoadingState = {
310
+ status: 'loading';
311
+ };
312
+ /**
313
+ * Documents are available — user picks one (or "scan new") and confirms.
314
+ * The first document in the list is the recommended one; the UI surfaces a
315
+ * "Recommended" tag based on position alone.
316
+ *
317
+ * @property documents - Ordered documents; index 0 is the best match.
318
+ * @property selectedDocumentId - Currently selected document id, or
319
+ * `'scanNew'` if the user picked the scan-new row. Auto-populated to
320
+ * `documents[0].id` on entry.
321
+ */
322
+ type IdentityReuseDocumentsFoundState = {
323
+ status: 'documentsFound';
324
+ documents: ReusableDocument[];
325
+ selectedDocumentId: SelectedDocumentId | undefined;
326
+ };
327
+ /** Submitting the chosen document for reuse */
328
+ type IdentityReuseSubmittingState = {
329
+ status: 'submitting';
330
+ };
331
+ /** Module completed successfully */
332
+ type IdentityReuseFinishedState = {
333
+ status: 'finished';
334
+ };
335
+ /**
336
+ * A recoverable error occurred — user can retry or skip
337
+ * @property error - Error message describing what went wrong
338
+ */
339
+ type IdentityReuseErrorState = {
340
+ status: 'error';
341
+ error: string;
342
+ };
343
+ /**
344
+ * Union of all possible IdentityReuse manager states.
345
+ *
346
+ * @example
347
+ * ```typescript
348
+ * const state = manager.getState();
349
+ * if (state.status === 'documentsFound') {
350
+ * console.log(state.documents);
351
+ * }
352
+ * ```
353
+ */
354
+ type IdentityReuseState = IdentityReuseIdleState | IdentityReuseLoadingState | IdentityReuseDocumentsFoundState | IdentityReuseSubmittingState | IdentityReuseFinishedState | IdentityReuseErrorState;
355
+ /**
356
+ * Creates an IdentityReuse manager for headless or UI-driven usage.
357
+ *
358
+ * @example Headless usage
359
+ * ```typescript
360
+ * const manager = createIdentityReuseManager({ config: {} });
361
+ * manager.subscribe((state) => {
362
+ * if (state.status === 'documentsFound') manager.submit();
363
+ * if (state.status === 'finished') console.log('Done!');
364
+ * });
365
+ * manager.load();
366
+ * ```
367
+ */
368
+ declare function createIdentityReuseManager(options: CreateIdentityReuseActorOptions): Manager<IdentityReuseState> & {
369
+ /**
370
+ * Fetches reusable documents from the backend.
371
+ * Transitions from 'idle' to 'loading'.
372
+ */
373
+ load(): void;
374
+ /**
375
+ * Selects a document by id, or the `'scanNew'` sentinel to indicate the
376
+ * user prefers to scan a new document instead of reusing one.
377
+ */
378
+ chooseDocument(documentId: SelectedDocumentId): void;
379
+ /**
380
+ * Confirms the current selection. If a document is selected, submits it
381
+ * for reuse; if the scan-new row is selected, finishes the module without
382
+ * submitting (orchestration will load the next node).
383
+ */
384
+ submit(): void;
385
+ /**
386
+ * Skips identity reuse entirely. Finishes the module without submitting;
387
+ * orchestration moves on to the next node.
388
+ */
389
+ skip(): void;
390
+ /**
391
+ * Retries loading documents after an error.
392
+ */
393
+ retry(): void;
394
+ };
395
+ /**
396
+ * Creates an IdentityReuse manager from a pre-built actor.
397
+ * Use this when overriding the machine via `.provide()` for custom backends or testing.
398
+ */
399
+ declare function createIdentityReuseManagerFromActor(actor: IdentityReuseActor): Manager<IdentityReuseState> & {
400
+ /**
401
+ * Fetches reusable documents from the backend.
402
+ * Transitions from 'idle' to 'loading'.
403
+ */
404
+ load(): void;
405
+ /**
406
+ * Selects a document by id, or the `'scanNew'` sentinel to indicate the
407
+ * user prefers to scan a new document instead of reusing one.
408
+ */
409
+ chooseDocument(documentId: SelectedDocumentId): void;
410
+ /**
411
+ * Confirms the current selection. If a document is selected, submits it
412
+ * for reuse; if the scan-new row is selected, finishes the module without
413
+ * submitting (orchestration will load the next node).
414
+ */
415
+ submit(): void;
416
+ /**
417
+ * Skips identity reuse entirely. Finishes the module without submitting;
418
+ * orchestration moves on to the next node.
419
+ */
420
+ skip(): void;
421
+ /**
422
+ * Retries loading documents after an error.
423
+ */
424
+ retry(): void;
425
+ };
426
+ type IdentityReuseManager = ReturnType<typeof createIdentityReuseManager>;
427
+ //#endregion
428
+ export { IdentityReuseActor as a, identityReuseMachine as c, ReusableDocument as d, SubmitResponse as f, createIdentityReuseManagerFromActor as i, FetchDocumentsResponse as l, IdentityReuseState as n, SCAN_NEW_DOCUMENT as o, createIdentityReuseManager as r, SelectedDocumentId as s, IdentityReuseManager as t, IdentityReuseConfig as u };
@@ -0,0 +1,148 @@
1
+ import { t as api } from "./api-CESGtpbH.esm.js";
2
+ import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
3
+ import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
4
+
5
+ //#region src/modules/identity-reuse/identityReuseServices.ts
6
+ function lowerFirstLetter(value) {
7
+ if (!value) return value;
8
+ return value.charAt(0).toLowerCase() + value.slice(1);
9
+ }
10
+ /**
11
+ * Coerces a backend timestamp into a finite number (unix seconds).
12
+ * Backend sends `validatedAt` as a JSON number but some gateways serialize
13
+ * floats as strings; this guard accepts both and yields NaN otherwise so the
14
+ * UI can hide the verified line for unparseable values.
15
+ */
16
+ function coerceTimestamp(value) {
17
+ if (typeof value === "number") return value;
18
+ if (typeof value === "string") {
19
+ const parsed = Number(value);
20
+ if (Number.isFinite(parsed)) return parsed;
21
+ }
22
+ return NaN;
23
+ }
24
+ function adaptDocument(doc) {
25
+ return {
26
+ id: doc.documentId,
27
+ documentType: lowerFirstLetter(doc.type),
28
+ maskedNumber: doc.documentNumber,
29
+ countryCode: doc.countryCode,
30
+ verifiedAt: coerceTimestamp(doc.validatedAt)
31
+ };
32
+ }
33
+ /** Fetches reusable identity documents. Throws on failure. */
34
+ async function fetchDocuments(signal) {
35
+ const res = await api.get(endpoints.identityReuseDocuments, { signal });
36
+ if (!res.ok) throw new Error(`GET ${endpoints.identityReuseDocuments} failed: ${res.status} ${res.statusText} — ${JSON.stringify(res.data)}`);
37
+ return (res.data?.documents ?? []).map(adaptDocument);
38
+ }
39
+ /** Submits the chosen document (or scan-new) for reuse. Throws on failure. */
40
+ async function submitDocument(params, signal) {
41
+ const res = await api.post(endpoints.identityReuseSubmit, params, { signal });
42
+ if (!res.ok) throw new Error(`POST ${endpoints.identityReuseSubmit} failed: ${res.status} ${res.statusText} — ${JSON.stringify(res.data)}`);
43
+ return res.data;
44
+ }
45
+
46
+ //#endregion
47
+ //#region src/modules/identity-reuse/identityReuseStateMachine.ts
48
+ /**
49
+ * Sentinel selection value for the "Scan a new document" row in the picker.
50
+ * Picked + SUBMIT calls /submit with `{ accepted: false }`, then finishes.
51
+ */
52
+ const SCAN_NEW_DOCUMENT = "scanNew";
53
+ function deriveSubmitParams(selectedDocumentId) {
54
+ if (selectedDocumentId === SCAN_NEW_DOCUMENT || !selectedDocumentId) return { accepted: false };
55
+ return {
56
+ accepted: true,
57
+ documentId: selectedDocumentId
58
+ };
59
+ }
60
+ const identityReuseMachine = setup({
61
+ types: {
62
+ context: {},
63
+ events: {},
64
+ input: {}
65
+ },
66
+ actors: {
67
+ fetchDocuments: fromPromise(async ({ signal }) => {
68
+ return fetchDocuments(signal);
69
+ }),
70
+ submitDocument: fromPromise(async ({ input, signal }) => {
71
+ return submitDocument(input, signal);
72
+ })
73
+ },
74
+ actions: {
75
+ setDocuments: assign(({ event }) => {
76
+ const output = event.output;
77
+ return {
78
+ documents: output,
79
+ selectedDocumentId: output[0]?.id
80
+ };
81
+ }),
82
+ setSelectedDocument: assign(({ event }) => {
83
+ return { selectedDocumentId: event.documentId };
84
+ }),
85
+ setError: assign(({ event }) => ({ error: String(event.error) })),
86
+ clearError: assign({ error: () => void 0 })
87
+ },
88
+ guards: {
89
+ hasDocuments: ({ event }) => {
90
+ return event.output.length > 0;
91
+ },
92
+ hasSelection: ({ context }) => context.selectedDocumentId !== void 0
93
+ }
94
+ }).createMachine({
95
+ id: "identityReuse",
96
+ initial: "idle",
97
+ context: ({ input }) => ({
98
+ config: input.config,
99
+ documents: [],
100
+ selectedDocumentId: void 0,
101
+ error: void 0
102
+ }),
103
+ states: {
104
+ idle: { on: { LOAD: { target: "loading" } } },
105
+ loading: { invoke: {
106
+ id: "fetchDocuments",
107
+ src: "fetchDocuments",
108
+ onDone: [{
109
+ target: "documentsFound",
110
+ guard: "hasDocuments",
111
+ actions: "setDocuments"
112
+ }, { target: "finished" }],
113
+ onError: {
114
+ target: "error",
115
+ actions: "setError"
116
+ }
117
+ } },
118
+ documentsFound: { on: {
119
+ DOCUMENT_CHOSEN: { actions: "setSelectedDocument" },
120
+ SUBMIT: {
121
+ target: "submitting",
122
+ guard: "hasSelection"
123
+ },
124
+ SKIP: { target: "finished" }
125
+ } },
126
+ submitting: { invoke: {
127
+ id: "submitDocument",
128
+ src: "submitDocument",
129
+ input: ({ context }) => deriveSubmitParams(context.selectedDocumentId),
130
+ onDone: { target: "finished" },
131
+ onError: {
132
+ target: "error",
133
+ actions: "setError"
134
+ }
135
+ } },
136
+ finished: { type: "final" },
137
+ error: { on: {
138
+ RETRY: {
139
+ target: "loading",
140
+ actions: "clearError"
141
+ },
142
+ SKIP: { target: "finished" }
143
+ } }
144
+ }
145
+ });
146
+
147
+ //#endregion
148
+ export { identityReuseMachine as n, SCAN_NEW_DOCUMENT as t };
@@ -1,5 +1,5 @@
1
- import { n as Flow } from "./types-BP1m8VRw.js";
2
- import { t as FinishStatus } from "./flowCompletionService-DhkT4SRY.js";
1
+ import { n as Flow } from "./types-DOUhndhT.js";
2
+ import { t as FinishStatus } from "./flowCompletionService-BdR2cGgB.js";
3
3
 
4
4
  //#region src/internal/flow-events/flowEvents.d.ts
5
5
  type FlowStartedEvent = {