@incodetech/core 2.0.0 → 2.0.1-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 (178) 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/Manager-C8PrhBOx.d.ts +19 -0
  8. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  9. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  10. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  11. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  12. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  13. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  14. package/dist/ae-signature.d.ts +25 -0
  15. package/dist/ae-signature.esm.js +8 -0
  16. package/dist/antifraud.d.ts +57 -0
  17. package/dist/antifraud.esm.js +45 -0
  18. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  19. package/dist/api-CESGtpbH.esm.js +53 -0
  20. package/dist/authentication.d.ts +12 -0
  21. package/dist/authentication.esm.js +25 -0
  22. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  23. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  24. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  25. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  26. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  27. package/dist/camera-DBSxa6ML.d.ts +4 -0
  28. package/dist/camera-PA2Ljri3.esm.js +22 -0
  29. package/dist/camera.d.ts +15 -0
  30. package/dist/camera.esm.js +5 -0
  31. package/dist/chunk-CRF6K_H_.esm.js +49 -0
  32. package/dist/consent.d.ts +398 -0
  33. package/dist/consent.esm.js +79 -0
  34. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  35. package/dist/cpf-PPz2Njto.esm.js +38 -0
  36. package/dist/cpf-ocr.d.ts +204 -0
  37. package/dist/cpf-ocr.esm.js +177 -0
  38. package/dist/cross-document-data-match.d.ts +34 -0
  39. package/dist/cross-document-data-match.esm.js +71 -0
  40. package/dist/curp-validation.d.ts +188 -0
  41. package/dist/curp-validation.esm.js +110 -0
  42. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  43. package/dist/custom-fields.d.ts +115 -0
  44. package/dist/custom-fields.esm.js +177 -0
  45. package/dist/custom-watchlist.d.ts +66 -0
  46. package/dist/custom-watchlist.esm.js +86 -0
  47. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  48. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  49. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  50. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  51. package/dist/device.d.ts +46 -0
  52. package/dist/device.esm.js +106 -0
  53. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  54. package/dist/document-capture.d.ts +906 -0
  55. package/dist/document-capture.esm.js +156 -0
  56. package/dist/document-upload.d.ts +331 -0
  57. package/dist/document-upload.esm.js +203 -0
  58. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  59. package/dist/dynamic-forms.d.ts +178 -0
  60. package/dist/dynamic-forms.esm.js +323 -0
  61. package/dist/ekyb.d.ts +148 -0
  62. package/dist/ekyb.esm.js +127 -0
  63. package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
  64. package/dist/ekyc.d.ts +164 -0
  65. package/dist/ekyc.esm.js +104 -0
  66. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  67. package/dist/electronic-signature.d.ts +4 -0
  68. package/dist/electronic-signature.esm.js +7 -0
  69. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  70. package/dist/email.d.ts +4 -0
  71. package/dist/email.esm.js +9 -0
  72. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  73. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  74. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  75. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  76. package/dist/events-D6-e4vok.esm.js +596 -0
  77. package/dist/events.d.ts +265 -0
  78. package/dist/events.esm.js +4 -0
  79. package/dist/extensibility.d.ts +122 -0
  80. package/dist/extensibility.esm.js +43 -0
  81. package/dist/face-match.d.ts +228 -0
  82. package/dist/face-match.esm.js +173 -0
  83. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  84. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  85. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  86. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  87. package/dist/flow-events.d.ts +6 -0
  88. package/dist/flow-events.esm.js +0 -0
  89. package/dist/flow.d.ts +358 -0
  90. package/dist/flow.esm.js +825 -0
  91. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  92. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  93. package/dist/flowServices-DG3IdWw6.esm.js +188 -0
  94. package/dist/geolocation.d.ts +127 -0
  95. package/dist/geolocation.esm.js +89 -0
  96. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  97. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  98. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  99. package/dist/government-validation.d.ts +67 -0
  100. package/dist/government-validation.esm.js +81 -0
  101. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  102. package/dist/home.d.ts +99 -0
  103. package/dist/home.esm.js +61 -0
  104. package/dist/http.d.ts +68 -0
  105. package/dist/http.esm.js +3 -0
  106. package/dist/id-ocr.d.ts +635 -0
  107. package/dist/id-ocr.esm.js +86 -0
  108. package/dist/id-verification.d.ts +190 -0
  109. package/dist/id-verification.esm.js +43 -0
  110. package/dist/id.d.ts +24 -0
  111. package/dist/id.esm.js +164 -0
  112. package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
  113. package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
  114. package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
  115. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  116. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  117. package/dist/identity-reuse.d.ts +530 -0
  118. package/dist/identity-reuse.esm.js +274 -0
  119. package/dist/index-BcRG8rtJ.d.ts +97 -0
  120. package/dist/index-DZoqeAo9.d.ts +1177 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.esm.js +12 -0
  123. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  124. package/dist/lib-BB0B_qQX.esm.js +12499 -0
  125. package/dist/mandatory-consent.d.ts +412 -0
  126. package/dist/mandatory-consent.esm.js +78 -0
  127. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  128. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  129. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  130. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  131. package/dist/phone.d.ts +4 -0
  132. package/dist/phone.esm.js +9 -0
  133. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  134. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  135. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  136. package/dist/platform-CfrjKhmi.esm.js +83 -0
  137. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  138. package/dist/qe-signature.d.ts +25 -0
  139. package/dist/qe-signature.esm.js +8 -0
  140. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  141. package/dist/redirect-to-mobile.d.ts +107 -0
  142. package/dist/redirect-to-mobile.esm.js +102 -0
  143. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  144. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  145. package/dist/selfie.d.ts +26 -0
  146. package/dist/selfie.esm.js +146 -0
  147. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  148. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  149. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  150. package/dist/session-CGtQJJzB.esm.js +3206 -0
  151. package/dist/session.d.ts +217 -0
  152. package/dist/session.esm.js +9 -0
  153. package/dist/setup-C5AITV8m.d.ts +254 -0
  154. package/dist/setup-DsM8IG7k.esm.js +887 -0
  155. package/dist/signature.d.ts +94 -0
  156. package/dist/signature.esm.js +66 -0
  157. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  158. package/dist/stats-CIfiPzb1.esm.js +16 -0
  159. package/dist/stats.d.ts +16 -0
  160. package/dist/stats.esm.js +4 -0
  161. package/dist/trust-graph.d.ts +54 -0
  162. package/dist/trust-graph.esm.js +56 -0
  163. package/dist/types-B06Ypu2F.d.ts +49 -0
  164. package/dist/types-BP1m8VRw.d.ts +340 -0
  165. package/dist/types-CAD4va6a.d.ts +5 -0
  166. package/dist/types-CFV9G_7j.d.ts +24 -0
  167. package/dist/warmup-CEcppFiS.d.ts +63 -0
  168. package/dist/wasm.d.ts +15 -0
  169. package/dist/wasm.esm.js +12 -0
  170. package/dist/watchlist-for-business.d.ts +79 -0
  171. package/dist/watchlist-for-business.esm.js +148 -0
  172. package/dist/watchlist.d.ts +62 -0
  173. package/dist/watchlist.esm.js +86 -0
  174. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  175. package/dist/workflow.d.ts +907 -0
  176. package/dist/workflow.esm.js +702 -0
  177. package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
  178. package/package.json +1 -1
@@ -0,0 +1,596 @@
1
+ import { t as api } from "./api-CESGtpbH.esm.js";
2
+
3
+ //#region ../infra/src/capabilities/IBrowserEnvironmentCapability.ts
4
+ function getTimestamp() {
5
+ return Date.now();
6
+ }
7
+ function revokeObjectURL(url) {
8
+ URL.revokeObjectURL(url);
9
+ }
10
+
11
+ //#endregion
12
+ //#region src/internal/events/eventBus.ts
13
+ function createEventBus() {
14
+ const listeners = [];
15
+ function subscribe(listener) {
16
+ listeners.push(listener);
17
+ return () => {
18
+ const index = listeners.indexOf(listener);
19
+ if (index > -1) listeners.splice(index, 1);
20
+ };
21
+ }
22
+ function emit(event) {
23
+ listeners.forEach((listener) => {
24
+ try {
25
+ listener(event);
26
+ } catch {
27
+ return;
28
+ }
29
+ });
30
+ }
31
+ function clear() {
32
+ listeners.length = 0;
33
+ }
34
+ return {
35
+ subscribe,
36
+ emit,
37
+ clear
38
+ };
39
+ }
40
+
41
+ //#endregion
42
+ //#region src/internal/events/addEvent.ts
43
+ const INTERVIEW_EVENTS_MAX_SCREEN_LENGTH = 50;
44
+ function normalizeScreenForInterviewEventsApi(screenValue) {
45
+ const limit = INTERVIEW_EVENTS_MAX_SCREEN_LENGTH;
46
+ if (screenValue.length <= limit) return screenValue;
47
+ const head = screenValue.slice(0, limit);
48
+ const lastDot = head.lastIndexOf(".");
49
+ const lastPlus = head.lastIndexOf("+");
50
+ const lastBoundary = Math.max(lastDot, lastPlus);
51
+ if (lastBoundary > 0) return head.slice(0, lastBoundary);
52
+ return head;
53
+ }
54
+ const eventBus = createEventBus();
55
+ let analyticsBatcher = null;
56
+ /**
57
+ * Buffer for events fired before any batcher has been registered (i.e. before
58
+ * `setup()` runs). Drained into the batcher's own buffer at registration time
59
+ * so these events ride the first flush. Subscribers receive them at emit time
60
+ * regardless.
61
+ */
62
+ const pendingEvents = [];
63
+ /**
64
+ * Registers the analytics batcher used by `addEvent` to ship events to the
65
+ * interview-events API. Disposes any previously-registered instance and drains
66
+ * any events queued before registration into the new batcher's buffer (FIFO).
67
+ *
68
+ * Returns the registered service so the caller can drive its lifecycle
69
+ * (e.g. call `.start()` after session initialization completes).
70
+ */
71
+ function setAnalyticsBatcher(service) {
72
+ analyticsBatcher?.dispose();
73
+ analyticsBatcher = service;
74
+ if (pendingEvents.length > 0) {
75
+ const drained = pendingEvents.splice(0);
76
+ for (const entry of drained) service.enqueue(entry);
77
+ }
78
+ return service;
79
+ }
80
+ /**
81
+ * Returns the currently-registered analytics batcher, or null if none.
82
+ * Used by `setup()` to reuse an existing batcher across multi-step setup
83
+ * calls instead of disposing the buffered events on re-registration.
84
+ */
85
+ function getAnalyticsBatcher() {
86
+ return analyticsBatcher;
87
+ }
88
+ /**
89
+ * Disposes the registered analytics batcher, clears the slot, and drops any
90
+ * events buffered in the pre-registration queue. Used by tests and `reset()`
91
+ * to return the events module to a clean state.
92
+ */
93
+ function resetAnalyticsBatcher() {
94
+ analyticsBatcher?.dispose();
95
+ analyticsBatcher = null;
96
+ pendingEvents.length = 0;
97
+ }
98
+ /**
99
+ * Subscribes to raw SDK analytics events.
100
+ *
101
+ * This stream includes noisy tracking events such as `screenOpened`,
102
+ * `elementClicked`, and `captureAttemptFinished`. These events are also used by
103
+ * the SDK analytics pipeline and may be queued or posted to the interview-events
104
+ * API.
105
+ *
106
+ * For curated flow milestones such as `flow.started`, `flow.ready`, and
107
+ * `flow.completed`, use `manager.subscribeFlowEvent()`. The `FlowEvent` type is
108
+ * exported from `@incodetech/core/flow-events`.
109
+ *
110
+ * @param listener - Callback function that receives each event
111
+ * @returns Unsubscribe function to remove the listener
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * const unsubscribe = subscribeEvent((event) => {
116
+ * console.log('[Event]', event.code, event.module);
117
+ * });
118
+ *
119
+ * // Later
120
+ * unsubscribe();
121
+ * ```
122
+ */
123
+ function subscribeEvent(listener) {
124
+ return eventBus.subscribe(listener);
125
+ }
126
+ /**
127
+ * Sends an event to the dashboard for tracking.
128
+ * Fire-and-forget: never blocks, never throws.
129
+ * Subscribers always receive the event at emit time. When a batcher is
130
+ * registered, the event is enqueued for batched delivery. Before any batcher
131
+ * is registered (events fired pre-`setup()`), the event is buffered in a
132
+ * one-shot pending queue and drained into the batcher when it's registered.
133
+ */
134
+ function addEvent(event) {
135
+ eventBus.emit(event);
136
+ const entry = {
137
+ code: event.code,
138
+ module: event.module,
139
+ screen: event.screen !== void 0 ? normalizeScreenForInterviewEventsApi(event.screen) : void 0,
140
+ clientTimestamp: event.clientTimestamp ?? getTimestamp(),
141
+ payload: event.payload ?? {}
142
+ };
143
+ if (!analyticsBatcher) {
144
+ pendingEvents.push(entry);
145
+ return;
146
+ }
147
+ analyticsBatcher.enqueue(entry);
148
+ }
149
+
150
+ //#endregion
151
+ //#region src/internal/events/AnalyticsBatchingService.ts
152
+ const DEFAULT_MAX_BATCH_SIZE = 50;
153
+ const DEFAULT_MAX_BATCH_AGE_MS = 1e3;
154
+ const DEFAULT_MAX_RETRIES = 2;
155
+ const RETRY_BASE_DELAY_MS = 250;
156
+ function isTransientStatus(status) {
157
+ return status === 0 || status >= 500 || status === 408 || status === 429;
158
+ }
159
+ function createAnalyticsBatchingService(options) {
160
+ const { endpoint, authToken, pageLifecycle, timer, apiBaseUrl, apiClient = api, maxBatchSize = DEFAULT_MAX_BATCH_SIZE, maxBatchAgeMs = DEFAULT_MAX_BATCH_AGE_MS, maxRetries = DEFAULT_MAX_RETRIES } = options;
161
+ let buffer = [];
162
+ let started = false;
163
+ let disposed = false;
164
+ let ageTimerHandle = null;
165
+ let unsubscribeLifecycle = null;
166
+ let warnedNullToken = false;
167
+ function clearAgeTimer() {
168
+ if (ageTimerHandle !== null) {
169
+ timer.clearTimeout(ageTimerHandle);
170
+ ageTimerHandle = null;
171
+ }
172
+ }
173
+ function armAgeTimerIfNeeded() {
174
+ if (ageTimerHandle === null) ageTimerHandle = timer.setTimeout(() => {
175
+ ageTimerHandle = null;
176
+ flush();
177
+ }, maxBatchAgeMs);
178
+ }
179
+ function dropTokenless() {
180
+ if (!warnedNullToken) {
181
+ warnedNullToken = true;
182
+ console.warn("[AnalyticsBatchingService] Dropping batch: no auth token at flush time.");
183
+ }
184
+ }
185
+ function sendBatch(batch, attempt) {
186
+ let promise;
187
+ try {
188
+ promise = apiClient.post(endpoint, batch, { keepalive: true });
189
+ } catch (error) {
190
+ handleSendError(batch, error, attempt);
191
+ return;
192
+ }
193
+ promise.catch((error) => handleSendError(batch, error, attempt));
194
+ }
195
+ function handleSendError(batch, error, attempt) {
196
+ if (disposed) return;
197
+ if (!isTransientStatus(error && typeof error === "object" && "status" in error ? Number(error.status) || 0 : 0)) return;
198
+ if (attempt >= maxRetries) return;
199
+ const delay = RETRY_BASE_DELAY_MS * 2 ** attempt;
200
+ timer.setTimeout(() => {
201
+ if (disposed) return;
202
+ sendBatch(batch, attempt + 1);
203
+ }, delay);
204
+ }
205
+ function flush() {
206
+ if (disposed || buffer.length === 0) return;
207
+ const batch = buffer;
208
+ buffer = [];
209
+ clearAgeTimer();
210
+ if (!authToken()) {
211
+ dropTokenless();
212
+ return;
213
+ }
214
+ sendBatch(batch, 0);
215
+ }
216
+ function handlePageHide() {
217
+ if (disposed || buffer.length === 0) return;
218
+ const batch = buffer;
219
+ buffer = [];
220
+ clearAgeTimer();
221
+ const token = authToken();
222
+ if (!token) {
223
+ dropTokenless();
224
+ return;
225
+ }
226
+ const url = `${apiBaseUrl().replace(/\/$/, "")}${endpoint}`;
227
+ const body = JSON.stringify({
228
+ token,
229
+ events: batch
230
+ });
231
+ pageLifecycle.sendBeacon(url, body);
232
+ }
233
+ function enqueue(entry) {
234
+ if (disposed) return;
235
+ buffer.push(entry);
236
+ if (!started) return;
237
+ if (buffer.length >= maxBatchSize) {
238
+ flush();
239
+ return;
240
+ }
241
+ armAgeTimerIfNeeded();
242
+ }
243
+ function start() {
244
+ if (started || disposed) return;
245
+ started = true;
246
+ unsubscribeLifecycle = pageLifecycle.onPageHide(handlePageHide);
247
+ if (buffer.length > 0) flush();
248
+ }
249
+ function dispose() {
250
+ if (disposed) return;
251
+ disposed = true;
252
+ clearAgeTimer();
253
+ unsubscribeLifecycle?.();
254
+ unsubscribeLifecycle = null;
255
+ buffer = [];
256
+ }
257
+ return {
258
+ enqueue,
259
+ start,
260
+ flush,
261
+ dispose
262
+ };
263
+ }
264
+
265
+ //#endregion
266
+ //#region src/internal/events/helpers.ts
267
+ function screenEvent(params) {
268
+ addEvent({
269
+ code: params.code,
270
+ module: params.module,
271
+ screen: params.screen,
272
+ clientTimestamp: getTimestamp(),
273
+ payload: params.payload
274
+ });
275
+ }
276
+ function moduleOpened(module, screen, payload) {
277
+ screenEvent({
278
+ module,
279
+ screen,
280
+ code: "moduleOpened",
281
+ payload
282
+ });
283
+ }
284
+ function moduleClosed(module, screen, payload) {
285
+ screenEvent({
286
+ module,
287
+ screen,
288
+ code: "moduleClosed",
289
+ payload
290
+ });
291
+ }
292
+ function screenOpened(module, screen, payload) {
293
+ screenEvent({
294
+ module,
295
+ screen,
296
+ code: "screenOpened",
297
+ payload
298
+ });
299
+ }
300
+ function screenClosed(module, screen, payload) {
301
+ screenEvent({
302
+ module,
303
+ screen,
304
+ code: "screenClosed",
305
+ payload
306
+ });
307
+ }
308
+ function errorTriggered(module, screen, payload) {
309
+ screenEvent({
310
+ module,
311
+ screen,
312
+ code: "errorTriggered",
313
+ payload
314
+ });
315
+ }
316
+ function elementClicked(module, screen, payload) {
317
+ screenEvent({
318
+ module,
319
+ screen,
320
+ code: "elementClicked",
321
+ payload
322
+ });
323
+ }
324
+ function captureAttemptFinished(module, screen, payload) {
325
+ screenEvent({
326
+ module,
327
+ screen,
328
+ code: "captureAttemptFinished",
329
+ payload
330
+ });
331
+ }
332
+
333
+ //#endregion
334
+ //#region src/internal/events/managerInstrumentation.ts
335
+ function normalizeSegment(segment) {
336
+ if (typeof segment !== "string") return "";
337
+ return segment.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
338
+ }
339
+ function normalizeDottedPath(path) {
340
+ return path.split("+").map((branch) => branch.split(".").map((segment) => normalizeSegment(segment)).filter((segment) => segment.length > 0).join(".")).filter((branch) => branch.length > 0).join("+");
341
+ }
342
+ function stateValueToScreenSegment(value) {
343
+ if (typeof value === "string" || typeof value === "number") {
344
+ const segment = normalizeSegment(String(value));
345
+ return segment.length > 0 ? segment : void 0;
346
+ }
347
+ if (typeof value !== "object" || value === null) return;
348
+ const entries = Object.entries(value).sort(([left], [right]) => {
349
+ if (left < right) return -1;
350
+ if (left > right) return 1;
351
+ return 0;
352
+ });
353
+ if (entries.length === 0) return;
354
+ const branches = entries.map(([key, nestedValue]) => {
355
+ const normalizedKey = normalizeSegment(key);
356
+ const nestedSegment = stateValueToScreenSegment(nestedValue);
357
+ if (normalizedKey.length === 0) return nestedSegment;
358
+ if (nestedSegment === void 0) return normalizedKey;
359
+ return `${normalizedKey}.${nestedSegment}`;
360
+ }).filter((branch) => branch !== void 0 && branch.length > 0);
361
+ if (branches.length === 0) return;
362
+ return branches.join("+");
363
+ }
364
+ function buildScreenName(moduleName, screenName) {
365
+ const normalizedModuleName = typeof moduleName === "string" ? moduleName.trim() : "";
366
+ const normalizedScreen = normalizeDottedPath(screenName);
367
+ if (normalizedModuleName.length === 0) return normalizedScreen;
368
+ if (normalizedScreen.length === 0) return normalizedModuleName;
369
+ return `${normalizedModuleName}.${normalizedScreen}`;
370
+ }
371
+ function getDefaultManagerScreenName(snapshot) {
372
+ return stateValueToScreenSegment(snapshot.value);
373
+ }
374
+ function getManagerScreenName(moduleName, snapshot, options) {
375
+ const eventScreen = options?.getEventScreenName?.(snapshot);
376
+ if (eventScreen !== void 0) return eventScreen;
377
+ const mappedScreen = options?.getScreenName?.(snapshot) ?? getDefaultManagerScreenName(snapshot);
378
+ if (mappedScreen === void 0) return;
379
+ return buildScreenName(moduleName, mappedScreen);
380
+ }
381
+ function isErrorLikeSegment(segment) {
382
+ return segment === "error" || segment.includes("error") || segment.includes("failed") || segment.includes("failure");
383
+ }
384
+ function getDefaultManagerErrorName(snapshot) {
385
+ const screenSegment = stateValueToScreenSegment(snapshot.value);
386
+ if (screenSegment === void 0) return;
387
+ const normalizedSegment = normalizeDottedPath(screenSegment);
388
+ if (normalizedSegment.length === 0) return;
389
+ if (normalizedSegment === "error") return "error.unknown";
390
+ if (!isErrorLikeSegment(normalizedSegment)) return;
391
+ return `error.${normalizedSegment}`;
392
+ }
393
+ function createManagerInstrumentation(moduleName, options) {
394
+ return {
395
+ moduleName,
396
+ onModuleOpened: moduleOpened,
397
+ onModuleClosed: moduleClosed,
398
+ onScreenOpened: screenOpened,
399
+ onScreenClosed: screenClosed,
400
+ onErrorTriggered: errorTriggered,
401
+ onElementClicked: (moduleName$1, screenName, payload) => elementClicked(moduleName$1, screenName, payload),
402
+ onCaptureAttemptFinished: (moduleName$1, screenName, payload) => captureAttemptFinished(moduleName$1, screenName, payload),
403
+ getScreenName: (snapshot) => getManagerScreenName(moduleName, snapshot, {
404
+ getEventScreenName: options?.getEventScreenName,
405
+ getScreenName: options?.getScreenName
406
+ }),
407
+ getErrorName: (snapshot) => {
408
+ const mappedError = options?.getErrorName?.(snapshot) ?? getDefaultManagerErrorName(snapshot);
409
+ if (mappedError === void 0) return;
410
+ return buildScreenName(moduleName, mappedError);
411
+ },
412
+ getErrorPayload: (snapshot) => options?.getErrorPayload?.(snapshot)
413
+ };
414
+ }
415
+
416
+ //#endregion
417
+ //#region src/internal/events/types.ts
418
+ const eventModuleNames = {
419
+ selfie: "SELFIE",
420
+ faceCapture: "faceCapture",
421
+ authentication: "AUTHENTICATION",
422
+ authFace: "authFace",
423
+ mlConsent: "ML_CONSENT",
424
+ combinedConsent: "COMBINED_CONSENT",
425
+ curpValidation: "CURP_VALIDATION",
426
+ faceMatch: "FACE_MATCH",
427
+ qr: "QR",
428
+ videoSelfie: "VIDEO_ONBOARDING",
429
+ passport: "ID",
430
+ front: "ID",
431
+ back: "ID",
432
+ id: "ID",
433
+ idCapture: "idCapture",
434
+ idOcr: "ID_OCR",
435
+ document: "DOCUMENT_CAPTURE",
436
+ creditCard: "CREDIT_CARD_FRONT",
437
+ creditCardBack: "CREDIT_CARD_BACK",
438
+ conference: "CONFERENCE",
439
+ otp: "OTP",
440
+ signature: "SIGNATURE",
441
+ ekyc: "EXTERNAL_VERIFICATION",
442
+ watchlist: "WATCHLIST",
443
+ globalWatchList: "GLOBAL_WATCHLIST",
444
+ customWatchList: "CUSTOM_WATCHLIST",
445
+ email: "EMAIL",
446
+ phone: "PHONE",
447
+ instantVerifyEmail: "INSTANT_VERIFY_EMAIL",
448
+ instantVerifyConsent: "INSTANT_VERIFY_CONSENT",
449
+ forms: "FORMS",
450
+ customModule: "CUSTOM_MODULE",
451
+ geolocation: "GEOLOCATION",
452
+ ekyb: "EKYB",
453
+ identityReuse: "IDENTITY_REUSE",
454
+ antifraud: "ANTIFRAUD",
455
+ aeSignature: "AE_SIGNATURE",
456
+ qeSignature: "QE_SIGNATURE",
457
+ crossDocumentDataMatch: "CROSS_DOCUMENT_DATA_MATCH",
458
+ customFields: "CUSTOM_FIELDS",
459
+ watchlistForBusiness: "WATCHLIST_FOR_BUSINESS",
460
+ trustGraph: "TRUST_GRAPH"
461
+ };
462
+ const eventScreenNames = {
463
+ faceMatch: "FACE_MATCH",
464
+ faceCaptureTutorial: "SELFIE_CAPTURE_TUTORIAL",
465
+ faceCaptureCamera: "SELFIE_CAMERA_CAPTURE",
466
+ faceCaptureError: "SELFIE_ATTEMPT_FAILED",
467
+ faceCaptureSuccess: "SELFIE_UPLOAD_SUCCEEDED",
468
+ faceCaptureUpload: "SELFIE_UPLOAD_PROGRESS",
469
+ mlConsent: "MACHINE_LEARNING_CONSENT",
470
+ combinedConsent: "COMBINED_CONSENT",
471
+ curpEnter: "ENTER_CURP",
472
+ curpValidate: "VALIDATE_CURP",
473
+ curpGenerate: "GENERATE_CURP",
474
+ curpValidation: "CURP_VALIDATION_PROGRESS",
475
+ curpValidationFailed: "CURP_VALIDATION_FAILED",
476
+ curpValidationSuccess: "CURP_VALIDATION_SUCCEEDED",
477
+ qrTutorial: "QR_TUTORIAL",
478
+ qrScan: "QR_SCAN",
479
+ smsOtp: "OTP",
480
+ simpleOTP: "OTP",
481
+ signatureInput: "SIGNATURE_INPUT",
482
+ frontTutorial: "FRONT_ID_CAPTURE_TUTORIAL",
483
+ frontCameraCapture: "FRONT_ID_CAMERA_CAPTURE",
484
+ frontHelp: "FRONT_ID_HELP",
485
+ frontReviewPhoto: "FRONT_ID_REVIEW_PHOTO",
486
+ frontUploadProgress: "FRONT_ID_UPLOAD_PROGRESS",
487
+ frontAttemptFailed: "FRONT_ID_ATTEMPT_FAILED",
488
+ frontUploadSuccess: "FRONT_ID_UPLOAD_SUCCEEDED",
489
+ backTutorial: "BACK_ID_CAPTURE_TUTORIAL",
490
+ backCameraCapture: "BACK_ID_CAMERA_CAPTURE",
491
+ backReviewPhoto: "BACK_ID_REVIEW_PHOTO",
492
+ backUploadProgress: "BACK_ID_UPLOAD_PROGRESS",
493
+ backAttemptFailed: "BACK_ID_ATTEMPT_FAILED",
494
+ backUploadSuccess: "BACK_ID_UPLOAD_SUCCEEDED",
495
+ backHelp: "BACK_ID_HELP",
496
+ passportTutorial: "TUTORIAL_PASSPORT",
497
+ documentTutorial: "DOCUMENT_CAPTURE_TUTORIAL",
498
+ documentCameraCapture: "DOCUMENT_CAMERA_CAPTURE",
499
+ documentHelp: "DOCUMENT_HELP",
500
+ documentReviewPhoto: "DOCUMENT_REVIEW_PHOTO",
501
+ documentUploadProgress: "DOCUMENT_UPLOAD_IN_PROGRESS",
502
+ documentAttemptFailed: "DOCUMENT_ATTEMPT_FAILED",
503
+ documentUploadSuccess: "DOCUMENT_UPLOAD_SUCCEEDED",
504
+ conferenceWait: "CONFERENCE_WAIT",
505
+ conferenceVideoChat: "CONFERENCE_VIDEO_CHAT",
506
+ conferenceMessageChat: "CONFERENCE_MESSAGE_CHAT",
507
+ videoSelfieTutorial: "VIDEO_SELFIE_TUTORIAL",
508
+ videoSelfie: "VIDEO_SELFIE",
509
+ videoSelfieFaceCapture: "VIDEO_SELFIE_FACE_CAPTURE",
510
+ videoSelfieFaceUploadProgress: "VIDEO_SELFIE_FACE_UPLOAD_PROGRESS",
511
+ videoSelfieFaceAttemptFailed: "VIDEO_SELFIE_FACE_ATTEMPT_FAILED",
512
+ videoSelfieFaceUploadSucceeded: "VIDEO_SELFIE_FACE_UPLOAD_SUCCEEDED",
513
+ videoSelfieFrontIdCapture: "VIDEO_SELFIE_FRONT_ID_CAPTURE",
514
+ videoSelfieFrontIdUploadProgress: "VIDEO_SELFIE_FRONT_ID_UPLOAD_PROGRESS",
515
+ videoSelfieFrontIdAttemptFailed: "VIDEO_SELFIE_FRONT_ID_ATTEMPT_FAILED",
516
+ videoSelfieFrontIdUploadSucceeded: "VIDEO_SELFIE_FRONT_ID_UPLOAD_SUCCEEDED",
517
+ videoSelfieBackIdCapture: "VIDEO_SELFIE_BACK_ID_CAPTURE",
518
+ videoSelfieBackIdUploadProgress: "VIDEO_SELFIE_BACK_ID_UPLOAD_PROGRESS",
519
+ videoSelfieBackIdAttemptFailed: "VIDEO_SELFIE_BACK_ID_ATTEMPT_FAILED",
520
+ videoSelfieBackIdUploadSucceeded: "VIDEO_SELFIE_BACK_ID_UPLOAD_SUCCEEDED",
521
+ videoSelfieDocumentCapture: "VIDEO_SELFIE_DOCUMENT_CAPTURE",
522
+ videoSelfieVoiceQuestion: "VIDEO_SELFIE_VOICE_QUESTION",
523
+ videoSelfieVoiceFinalQuestion: "VIDEO_SELFIE_VOICE_FINAL_QUESTION",
524
+ videoSelfieVideoUpload: "VIDEO SELFIE VIDEO UPLOAD",
525
+ ekycInput: "EKYC_INPUT",
526
+ ekycProgress: "EKYC_PROGRESS",
527
+ ekycSucceeded: "EKYC_SUCCEEDED",
528
+ ekycFailed: "EKYC_FAILED",
529
+ forms: "FORMS",
530
+ globalWatchListInput: "GLOBAL_WATCHLIST_INPUT",
531
+ globalWatchListProgress: "GLOBAL_WATCHLIST_PROGRESS",
532
+ globalWatchListSuccess: "GLOBAL_WATCHLIST_SUCCEEDED",
533
+ globalWatchListFailed: "GLOBAL_WATCHLIST_FAILED",
534
+ customWatchListInput: "CUSTOM_WATCHLIST_INPUT",
535
+ customWatchListProgress: "CUSTOM_WATCHLIST_PROGRESS",
536
+ customWatchListSuccess: "CUSTOM_WATCHLIST_SUCCEEDED",
537
+ customWatchListFailed: "CUSTOM_WATCHLIST_FAILED",
538
+ emailInput: "EMAIL_INPUT",
539
+ phoneInput: "PHONE_INPUT",
540
+ instantVerify: "INSTANT_VERIFY",
541
+ authFace: "AUTH_FACE",
542
+ authFaceError: "AUTH_FACE_ATTEMPT_FAILED",
543
+ authFaceUpload: "AUTH_FACE_UPLOAD_PROGRESS",
544
+ authFaceUploadSuccess: "AUTH_FACE_UPLOAD_SUCCEEDED",
545
+ authFaceUploadFailed: "AUTH_FACE_UPLOAD_FAILED",
546
+ authFaceTutorial: "AUTH_FACE_TUTORIAL",
547
+ customModuleCallback: "CUSTOM_MODULE_CALLBACK",
548
+ customModuleProcessing: "CUSTOM_MODULE_PROCESSING",
549
+ digitalIdFileSelection: "DIGITAL_ID_FILE_SELECTION",
550
+ digitalIdFileReview: "DIGITAL_ID_FILE_REVIEW",
551
+ digitalIdUploadProgress: "DIGITAL_ID_UPLOAD_PROGRESS",
552
+ digitalIdUploadSuccess: "DIGITAL_ID_UPLOAD_SUCCEEDED",
553
+ digitalIdUploadFailed: "DIGITAL_ID_UPLOAD_FAILED",
554
+ digitalIdAnalysisProgress: "DIGITAL_ID_ANALYSIS_PROGRESS",
555
+ digitalIdVerificationSuccess: "DIGITAL_ID_VERIFICATION_SUCCESS",
556
+ digitalIdVerificationFailed: "DIGITAL_ID_VERIFICATION_FAILED",
557
+ ekybForm: "EKYB_FORM"
558
+ };
559
+ const videoSelfieEvents = {
560
+ imageTooBlurry: "imageTooBlurry",
561
+ fillFrame: "fillFrame",
562
+ checkCameraOrLighting: "checkCameraOrLighting",
563
+ frontIdCaptureStarted: "frontIdCaptureStarted",
564
+ lookAtCamera: "lookAtCamera",
565
+ moveCloser: "moveCloser",
566
+ lookingForFrontId: "lookingForFrontId",
567
+ lookingForBackId: "lookingForBackId",
568
+ cameraSwitchToBack: "cameraSwitchToBack",
569
+ cameraSwitchToFront: "cameraSwitchToFront",
570
+ audioStreamOpened: "audioStreamOpened",
571
+ audioStreamClosed: "audioStreamClosed",
572
+ videoSelfieVideoUploadInProgress: "videoSelfieVideoUploadInProgress",
573
+ videoSelfieTosNotAccepted: "videoSelfieTosNotAccepted",
574
+ videoSelfieTosAccepted: "videoSelfieTosAccepted",
575
+ videoSelfieStreamCreated: "videoSelfieStreamCreated",
576
+ videoSelfieStreamDestroyed: "videoSelfieStreamDestroyed",
577
+ videoSelfieReconnecting: "videoSelfieReconnecting",
578
+ videoSelfieReconnected: "videoSelfieReconnected"
579
+ };
580
+ const tutorialScreenNamesMapper = {
581
+ passport: eventScreenNames.passportTutorial,
582
+ front: eventScreenNames.frontTutorial,
583
+ back: eventScreenNames.backTutorial,
584
+ selfie: eventScreenNames.faceCaptureTutorial
585
+ };
586
+ const cameraScreenNamesMapper = {
587
+ front: "front",
588
+ back: "back",
589
+ passport: "passport",
590
+ creditCard: "front",
591
+ creditCardBack: "back",
592
+ document: "document"
593
+ };
594
+
595
+ //#endregion
596
+ export { revokeObjectURL as S, resetAnalyticsBatcher as _, videoSelfieEvents as a, createEventBus as b, elementClicked as c, screenClosed as d, screenEvent as f, getAnalyticsBatcher as g, addEvent as h, tutorialScreenNamesMapper as i, moduleClosed as l, createAnalyticsBatchingService as m, eventModuleNames as n, createManagerInstrumentation as o, screenOpened as p, eventScreenNames as r, captureAttemptFinished as s, cameraScreenNamesMapper as t, moduleOpened as u, setAnalyticsBatcher as v, getTimestamp as x, subscribeEvent as y };