@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,97 @@
1
+ import { n as Flow } from "./types-BP1m8VRw.js";
2
+ import { t as FinishStatus } from "./flowCompletionService-DhkT4SRY.js";
3
+
4
+ //#region src/internal/flow-events/flowEvents.d.ts
5
+ type FlowStartedEvent = {
6
+ type: 'flow.started';
7
+ interviewId?: string;
8
+ timestamp: number;
9
+ };
10
+ type FlowReadyEvent = {
11
+ type: 'flow.ready';
12
+ interviewId?: string;
13
+ flowId?: string;
14
+ payload: {
15
+ flow: Flow;
16
+ steps: string[];
17
+ currentStep?: string;
18
+ currentStepIndex: number;
19
+ };
20
+ timestamp: number;
21
+ };
22
+ type FlowCompletedEvent = {
23
+ type: 'flow.completed';
24
+ interviewId?: string;
25
+ flowId?: string;
26
+ payload?: FinishStatus;
27
+ timestamp: number;
28
+ };
29
+ type FlowErrorEvent = {
30
+ type: 'flow.error';
31
+ interviewId?: string;
32
+ flowId?: string;
33
+ error: string;
34
+ timestamp: number;
35
+ };
36
+ type FlowClosedEvent = {
37
+ type: 'flow.closed';
38
+ interviewId?: string;
39
+ flowId?: string;
40
+ timestamp: number;
41
+ };
42
+ type FlowModuleStartedEvent = {
43
+ type: 'flow.module.started';
44
+ interviewId?: string;
45
+ flowId?: string;
46
+ module: string;
47
+ payload: {
48
+ moduleIndex?: number;
49
+ totalModules?: number;
50
+ };
51
+ timestamp: number;
52
+ };
53
+ type FlowModuleCompletedEvent = {
54
+ type: 'flow.module.completed';
55
+ interviewId?: string;
56
+ flowId?: string;
57
+ module: string;
58
+ payload: {
59
+ moduleIndex?: number;
60
+ totalModules?: number;
61
+ };
62
+ timestamp: number;
63
+ };
64
+ /**
65
+ * Curated flow event for consumers that need stable integration milestones.
66
+ *
67
+ * This local-only stream covers high-level flow state changes such as loading,
68
+ * readiness, module changes, completion, errors, and closure. For raw analytics
69
+ * events such as `screenOpened`, `elementClicked`, and
70
+ * `captureAttemptFinished`, use `Event` from `@incodetech/core/events`.
71
+ */
72
+ type FlowEvent = FlowStartedEvent | FlowReadyEvent | FlowCompletedEvent | FlowErrorEvent | FlowClosedEvent | FlowModuleStartedEvent | FlowModuleCompletedEvent;
73
+ type FlowEventListener = (event: FlowEvent) => void;
74
+ /**
75
+ * Manager API for subscribing to curated flow milestones emitted by that
76
+ * specific manager instance.
77
+ *
78
+ * For raw SDK analytics events such as `screenOpened`, `elementClicked`, and
79
+ * `captureAttemptFinished`, use `subscribeEvent` from `@incodetech/core/events`.
80
+ */
81
+ type FlowEventSubscribable = {
82
+ /**
83
+ * Subscribes to curated flow milestones for this manager instance.
84
+ *
85
+ * Use this local-only stream for product and integration milestones such as
86
+ * `flow.started`, `flow.ready`, `flow.module.started`,
87
+ * `flow.module.completed`, `flow.completed`, and `flow.error`.
88
+ *
89
+ * This stream does not queue events or post to the analytics API.
90
+ *
91
+ * @param listener - Callback function that receives each flow event.
92
+ * @returns Unsubscribe function to remove the listener.
93
+ */
94
+ subscribeFlowEvent(listener: FlowEventListener): () => void;
95
+ };
96
+ //#endregion
97
+ export { FlowEventListener as a, FlowModuleStartedEvent as c, FlowEvent as i, FlowReadyEvent as l, FlowCompletedEvent as n, FlowEventSubscribable as o, FlowErrorEvent as r, FlowModuleCompletedEvent as s, FlowClosedEvent as t, FlowStartedEvent as u };
package/dist/index.d.ts CHANGED
@@ -1,226 +1,3 @@
1
- import { n as warmupWasm, t as WasmPipeline } from "./warmup-CEJTfxQr.js";
2
- import { n as PermissionStatus, t as PermissionResult } from "./types-iZi2rawo.js";
3
-
4
- //#region ../infra/src/http/types.d.ts
5
- type CreateApiConfig = {
6
- apiURL: string;
7
- customHeaders?: Record<string, string>;
8
- timeout?: number;
9
- };
10
- type RequestConfig = {
11
- method?: string;
12
- url: string;
13
- headers?: Record<string, string>;
14
- query?: Record<string, string | number | boolean | undefined>;
15
- params?: Record<string, string | number | boolean | undefined>;
16
- body?: unknown;
17
- signal?: AbortSignal;
18
- timeout?: number;
19
- parse?: 'json' | 'text' | 'blob' | 'arrayBuffer' | 'response';
20
- };
21
- type HttpResponse<T = unknown> = {
22
- ok: boolean;
23
- status: number;
24
- statusText: string;
25
- url: string;
26
- headers: Record<string, string>;
27
- data: T;
28
- };
29
- type HttpClient = {
30
- defaults: {
31
- baseURL: string;
32
- headers: Record<string, string>;
33
- };
34
- request<T = unknown>(config: RequestConfig): Promise<HttpResponse<T>>;
35
- get<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
36
- post<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
37
- put<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
38
- patch<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
39
- delete<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
40
- head<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
41
- options<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
42
- setHeader(name: string, value: string): void;
43
- };
44
- //#endregion
45
- //#region ../infra/src/http/createApi.d.ts
46
- declare const createApi: (config: CreateApiConfig) => HttpClient;
47
- //#endregion
48
- //#region src/internal/device/getBrowser.d.ts
49
- type Browser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'other';
50
- declare function getBrowser(): Browser;
51
- //#endregion
52
- //#region src/internal/device/getDeviceClass.d.ts
53
- type DeviceClass = 'ios' | 'android' | 'desktop';
54
- declare function getDeviceClass(): DeviceClass;
55
- //#endregion
56
- //#region src/internal/http/api.d.ts
57
- type MethodConfig = {
58
- headers?: Record<string, string>;
59
- signal?: AbortSignal;
60
- timeout?: number;
61
- query?: Record<string, string | number | boolean | undefined>;
62
- };
63
- type ApiClient = {
64
- get<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
65
- post<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
66
- put<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
67
- patch<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
68
- delete<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
69
- };
70
- declare function getApi(): HttpClient;
71
- declare const api: ApiClient;
72
- //#endregion
73
- //#region src/internal/permissions/permissionServices.d.ts
74
- /**
75
- * Checks the current camera permission state without prompting the user.
76
- */
77
- declare function checkPermission(): Promise<PermissionResult>;
78
- /**
79
- * Requests camera permission by attempting to access the camera, then immediately
80
- * stops the obtained stream. This function does not keep or return the stream.
81
- */
82
- declare function requestPermission(): Promise<PermissionResult>;
83
- //#endregion
84
- //#region src/internal/session/sessionService.d.ts
85
- type CreateSessionOptions = {
86
- /** The configuration/flow ID from the Incode dashboard */
87
- configurationId: string;
88
- /** External ID to associate with this session */
89
- externalId?: string;
90
- /** External customer ID */
91
- externalCustomerId?: string;
92
- /** Language for the session (e.g., 'en-US', 'es-MX') */
93
- language?: string;
94
- /** Custom fields to attach to the session */
95
- customFields?: Record<string, unknown>;
96
- /** UUID for continuing an existing session */
97
- uuid?: string;
98
- /** Interview ID for continuing an existing interview */
99
- interviewId?: string;
100
- };
101
- type Session = {
102
- token: string;
103
- interviewId: string;
104
- uuid?: string;
105
- regulationType?: string;
106
- showMandatoryConsent?: boolean;
107
- };
108
- /**
109
- * Creates a new onboarding session.
110
- *
111
- * @param apiKey - The API key from the Incode dashboard
112
- * @param options - Session creation options
113
- * @param signal - Optional AbortSignal for request cancellation
114
- * @returns The created session with token
115
- *
116
- * @example
117
- * ```ts
118
- * const session = await createSession('your-api-key', {
119
- * configurationId: 'your-flow-id',
120
- * language: 'en-US',
121
- * });
122
- * console.log(session.token); // Use this token for subsequent API calls
123
- * ```
124
- */
125
- declare function createSession(apiKey: string, options: CreateSessionOptions, signal?: AbortSignal): Promise<Session>;
126
- //#endregion
127
- //#region src/setup.d.ts
128
- /**
129
- * WASM warmup configuration.
130
- */
131
- type WasmConfig = {
132
- /** Path to the WASM binary */
133
- wasmPath: string;
134
- /** Path to the SIMD-optimized WASM binary (optional) */
135
- wasmSimdPath?: string;
136
- /** Path to the WASM glue code */
137
- glueCodePath: string;
138
- /** Whether to use SIMD optimizations (default: true) */
139
- useSimd?: boolean;
140
- /** Which pipelines to preload models for */
141
- pipelines?: WasmPipeline[];
142
- /**
143
- * Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
144
- * If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
145
- */
146
- modelsBasePath?: string;
147
- };
148
- /**
149
- * Configuration options for the SDK setup.
150
- */
151
- type SetupOptions = {
152
- /** The base URL for the API */
153
- apiURL: string;
154
- /** The session token for API requests (optional - can be set later or omitted for createSession calls) */
155
- token?: string;
156
- /** Custom headers to include in all requests */
157
- customHeaders?: Record<string, string>;
158
- /** Request timeout in milliseconds */
159
- timeout?: number;
160
- /** Optional WASM warmup config - if provided, preloads WASM and ML models */
161
- wasm?: WasmConfig;
162
- };
163
- /**
164
- * Initializes the SDK with the provided configuration.
165
- * Must be called before using any SDK functionality.
166
- *
167
- * If `wasm` config is provided, this function becomes async and will
168
- * preload WASM binary and ML models. Otherwise, it's synchronous.
169
- *
170
- * @param options - Configuration options for the SDK
171
- *
172
- * @example
173
- * ```ts
174
- * import { setup, createSession } from '@incodetech/core';
175
- *
176
- * // Setup with API URL first (for session creation)
177
- * await setup({ apiURL: 'https://api.incode.com' });
178
- * const session = await createSession('api-key', { configurationId: 'flow-id' });
179
- *
180
- * // Basic setup with token
181
- * await setup({
182
- * apiURL: 'https://api.incode.com',
183
- * token: 'session-token',
184
- * });
185
- *
186
- * // Setup with WASM warmup
187
- * await setup({
188
- * apiURL: 'https://api.incode.com',
189
- * token: 'session-token',
190
- * wasm: {
191
- * wasmPath: '/wasm/ml-wasm.wasm',
192
- * glueCodePath: '/wasm/ml-wasm.js',
193
- * pipelines: ['selfie', 'idCapture'],
194
- * },
195
- * });
196
- * ```
197
- */
198
- declare function setup(options: SetupOptions): Promise<void>;
199
- /**
200
- * Sets the WASM configuration without performing warmup.
201
- * Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
202
- *
203
- * @param config - WASM configuration to store
204
- */
205
- declare function setWasmConfig(config: WasmConfig): void;
206
- /**
207
- * Initializes WasmUtilProvider with the stored WASM configuration.
208
- * Should be called after warmupWasm() completes when using conditional warmup.
209
- * This ensures image encryption works properly.
210
- *
211
- * @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
212
- * @throws Error if no config is provided and none is stored
213
- */
214
- declare function initializeWasmUtil(config?: WasmConfig): Promise<void>;
215
- /**
216
- * Checks if the SDK has been configured.
217
- *
218
- * @returns true if setup() has been called, false otherwise
219
- */
220
- declare function isConfigured(): boolean;
221
- /**
222
- * Resets the SDK configuration. Useful for testing.
223
- */
224
- declare function reset(): void;
225
- //#endregion
226
- export { type Browser, type CreateSessionOptions, type DeviceClass, type HttpClient, type PermissionResult, type PermissionStatus, type Session, type SetupOptions, type WasmConfig, type WasmPipeline, api, checkPermission as checkCameraPermission, createApi, createSession, getApi, getBrowser, getDeviceClass, initializeWasmUtil, isConfigured, requestPermission as requestCameraPermission, reset, setWasmConfig, setup, warmupWasm };
1
+ import "./warmup-CEcppFiS.js";
2
+ import { a as reset, i as isConfigured, s as setup, t as SetupOptions } from "./setup-C5AITV8m.js";
3
+ export { type SetupOptions, isConfigured, reset, setup };
package/dist/index.esm.js CHANGED
@@ -1,155 +1,12 @@
1
- import { i as getBrowser, n as requestPermission, r as getDeviceClass, t as checkPermission } from "./permissionServices-I6vX6DBy.esm.js";
2
- import { _ as createApi_default, a as setClient, i as resetApi, l as warmupWasm, n as api, o as setToken, r as getApi, s as WasmUtilProvider, t as endpoints } from "./endpoints-BSTFaHYo.esm.js";
1
+ import { a as setup, n as isConfigured, r as reset } from "./setup-Buy-hyj4.esm.js";
2
+ import "./BaseWasmProvider-C_DLEI40.esm.js";
3
+ import "./WasmUtilProvider-j98OJf-S.esm.js";
4
+ import "./BrowserTimerProvider-DhNc_x02.esm.js";
5
+ import "./api-CESGtpbH.esm.js";
6
+ import "./events-D6-e4vok.esm.js";
7
+ import "./endpoints-CnN3SyDa.esm.js";
8
+ import "./session-BS-d_vuE.esm.js";
9
+ import "./IpifyProvider-D7jx52AL.esm.js";
10
+ import "./browserSimulation-gxD8cSpM.esm.js";
3
11
 
4
- //#region src/internal/session/sessionService.ts
5
- /**
6
- * Creates a new onboarding session.
7
- *
8
- * @param apiKey - The API key from the Incode dashboard
9
- * @param options - Session creation options
10
- * @param signal - Optional AbortSignal for request cancellation
11
- * @returns The created session with token
12
- *
13
- * @example
14
- * ```ts
15
- * const session = await createSession('your-api-key', {
16
- * configurationId: 'your-flow-id',
17
- * language: 'en-US',
18
- * });
19
- * console.log(session.token); // Use this token for subsequent API calls
20
- * ```
21
- */
22
- async function createSession(apiKey, options, signal) {
23
- const res = await getApi().post(endpoints.createSession, {
24
- configurationId: options.configurationId,
25
- externalId: options.externalId,
26
- externalCustomerId: options.externalCustomerId,
27
- language: options.language ?? "en-US",
28
- customFields: options.customFields,
29
- uuid: options.uuid ?? null,
30
- interviewId: options.interviewId ?? null
31
- }, {
32
- headers: {
33
- "x-api-key": apiKey,
34
- "api-version": "1.0"
35
- },
36
- signal
37
- });
38
- if (!res.ok) throw new Error(`POST ${endpoints.createSession} failed: ${res.status} ${res.statusText}`);
39
- return res.data;
40
- }
41
-
42
- //#endregion
43
- //#region src/setup.ts
44
- let wasmConfig;
45
- let configured = false;
46
- /**
47
- * Initializes the SDK with the provided configuration.
48
- * Must be called before using any SDK functionality.
49
- *
50
- * If `wasm` config is provided, this function becomes async and will
51
- * preload WASM binary and ML models. Otherwise, it's synchronous.
52
- *
53
- * @param options - Configuration options for the SDK
54
- *
55
- * @example
56
- * ```ts
57
- * import { setup, createSession } from '@incodetech/core';
58
- *
59
- * // Setup with API URL first (for session creation)
60
- * await setup({ apiURL: 'https://api.incode.com' });
61
- * const session = await createSession('api-key', { configurationId: 'flow-id' });
62
- *
63
- * // Basic setup with token
64
- * await setup({
65
- * apiURL: 'https://api.incode.com',
66
- * token: 'session-token',
67
- * });
68
- *
69
- * // Setup with WASM warmup
70
- * await setup({
71
- * apiURL: 'https://api.incode.com',
72
- * token: 'session-token',
73
- * wasm: {
74
- * wasmPath: '/wasm/ml-wasm.wasm',
75
- * glueCodePath: '/wasm/ml-wasm.js',
76
- * pipelines: ['selfie', 'idCapture'],
77
- * },
78
- * });
79
- * ```
80
- */
81
- async function setup(options) {
82
- setClient(createApi_default({
83
- apiURL: options.apiURL,
84
- customHeaders: options.customHeaders,
85
- timeout: options.timeout
86
- }));
87
- if (options.token) setToken(options.token);
88
- configured = true;
89
- if (options.wasm) {
90
- await warmupWasm({
91
- wasmPath: options.wasm.wasmPath,
92
- wasmSimdPath: options.wasm.wasmSimdPath,
93
- glueCodePath: options.wasm.glueCodePath,
94
- useSimd: options.wasm.useSimd,
95
- pipelines: options.wasm.pipelines,
96
- modelsBasePath: options.wasm.modelsBasePath
97
- });
98
- await (await WasmUtilProvider.getInstance()).initialize({
99
- wasmPath: options.wasm.wasmPath,
100
- wasmSimdPath: options.wasm.wasmSimdPath,
101
- glueCodePath: options.wasm.glueCodePath,
102
- useSimd: options.wasm.useSimd,
103
- pipelines: options.wasm.pipelines,
104
- modelsBasePath: options.wasm.modelsBasePath
105
- });
106
- }
107
- }
108
- /**
109
- * Sets the WASM configuration without performing warmup.
110
- * Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
111
- *
112
- * @param config - WASM configuration to store
113
- */
114
- function setWasmConfig(config) {
115
- wasmConfig = config;
116
- }
117
- /**
118
- * Initializes WasmUtilProvider with the stored WASM configuration.
119
- * Should be called after warmupWasm() completes when using conditional warmup.
120
- * This ensures image encryption works properly.
121
- *
122
- * @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
123
- * @throws Error if no config is provided and none is stored
124
- */
125
- async function initializeWasmUtil(config) {
126
- const wasmConfigToUse = config ?? wasmConfig;
127
- if (!wasmConfigToUse) throw new Error("WASM config is required. Provide config parameter or call setWasmConfig() first.");
128
- await (await WasmUtilProvider.getInstance()).initialize({
129
- wasmPath: wasmConfigToUse.wasmPath,
130
- wasmSimdPath: wasmConfigToUse.wasmSimdPath,
131
- glueCodePath: wasmConfigToUse.glueCodePath,
132
- useSimd: wasmConfigToUse.useSimd,
133
- pipelines: wasmConfigToUse.pipelines,
134
- modelsBasePath: wasmConfigToUse.modelsBasePath
135
- });
136
- }
137
- /**
138
- * Checks if the SDK has been configured.
139
- *
140
- * @returns true if setup() has been called, false otherwise
141
- */
142
- function isConfigured() {
143
- return configured;
144
- }
145
- /**
146
- * Resets the SDK configuration. Useful for testing.
147
- */
148
- function reset() {
149
- resetApi();
150
- configured = false;
151
- WasmUtilProvider.resetInstance();
152
- }
153
-
154
- //#endregion
155
- export { api, checkPermission as checkCameraPermission, createApi_default as createApi, createSession, getApi, getBrowser, getDeviceClass, initializeWasmUtil, isConfigured, requestPermission as requestCameraPermission, reset, setWasmConfig, setup, warmupWasm };
12
+ export { isConfigured, reset, setup };
@@ -0,0 +1,30 @@
1
+ import { h as addEvent } from "./events-D6-e4vok.esm.js";
2
+
3
+ //#region src/internal/captureOnly/invokeOnCaptureCallback.ts
4
+ /**
5
+ * Invokes an integrator-provided `onCapture` callback with the assembled
6
+ * payload. Catches sync throws and rejected promises and reports them via
7
+ * telemetry so an integration bug never escapes into the state machine —
8
+ * the machine has already reached its terminal `finished` state by the
9
+ * time this runs, so there is nothing to unwind.
10
+ */
11
+ function invokeOnCaptureCallback(callback, payload, module) {
12
+ try {
13
+ const result = callback(payload);
14
+ if (result && typeof result.then === "function") result.catch((error) => {
15
+ reportError(error, module);
16
+ });
17
+ } catch (error) {
18
+ reportError(error, module);
19
+ }
20
+ }
21
+ function reportError(error, module) {
22
+ addEvent({
23
+ code: "onCaptureCallbackError",
24
+ module,
25
+ payload: { message: error instanceof Error ? error.message : String(error) }
26
+ });
27
+ }
28
+
29
+ //#endregion
30
+ export { invokeOnCaptureCallback as t };