@incodetech/core 0.0.0-dev-20260717-87fac45b → 0.0.0-dev-20260717-8aab9f6d

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 (59) hide show
  1. package/dist/ae-signature.esm.js +1 -1
  2. package/dist/{apiError-COvIGYWe.esm.js → apiError-B-PkYxln.esm.js} +13 -1
  3. package/dist/authentication.esm.js +2 -2
  4. package/dist/{authenticationManager-DK8fsUqL.esm.js → authenticationManager-CCsoE3a3.esm.js} +2 -2
  5. package/dist/{authenticationStateMachine-BlT8fkR6.esm.js → authenticationStateMachine-DfscLUkp.esm.js} +2 -2
  6. package/dist/consent.d.ts +1 -1
  7. package/dist/{consentManager-CsyToF8t.d.ts → consentManager-3Pbtj-RV.d.ts} +5 -5
  8. package/dist/cpf-ocr.d.ts +1 -1
  9. package/dist/{cpfOcrManager-CQkUAeWO.d.ts → cpfOcrManager-C-3PWS2h.d.ts} +1 -1
  10. package/dist/{deepsightLoader-C7HOhX6C.esm.js → deepsightLoader-Dv4RBBlg.esm.js} +1 -1
  11. package/dist/document-capture.d.ts +1 -1
  12. package/dist/{documentCaptureManager-DBqK5ner.d.ts → documentCaptureManager-CBP2DkPr.d.ts} +4 -4
  13. package/dist/dynamic-forms.esm.js +2 -2
  14. package/dist/{dynamicFormsManager-COik5bJ7.esm.js → dynamicFormsManager-DxDndOS0.esm.js} +1 -1
  15. package/dist/{dynamicFormsStateMachine-BV-Fn13x.esm.js → dynamicFormsStateMachine-kajUEkCO.esm.js} +1 -1
  16. package/dist/ekyb.esm.js +2 -2
  17. package/dist/{ekybManager-BMjf8ZNw.esm.js → ekybManager-CwzaAdjM.esm.js} +1 -1
  18. package/dist/{ekybStateMachine-DfpEPLzD.esm.js → ekybStateMachine-BOG89tFg.esm.js} +1 -1
  19. package/dist/electronic-signature.esm.js +1 -1
  20. package/dist/{electronicSignatureManager-DSZu9OHT.esm.js → electronicSignatureManager-Ty1oUQ8W.esm.js} +1 -1
  21. package/dist/extensibility.d.ts +7 -7
  22. package/dist/extensibility.esm.js +8 -8
  23. package/dist/{faceCaptureManagerFactory-BFv1KlL_.esm.js → faceCaptureManagerFactory-aKmM3ism.esm.js} +1 -1
  24. package/dist/{faceCaptureSetup-Bxo1VNVw.esm.js → faceCaptureSetup-CbLgaydb.esm.js} +2 -2
  25. package/dist/flow.esm.js +2 -2
  26. package/dist/{flowCompletionService-DQSC7Kso.esm.js → flowCompletionService-B30WLCxd.esm.js} +1 -1
  27. package/dist/{flowServices-ymcivfU0.esm.js → flowServices-CaH1ElaI.esm.js} +3 -3
  28. package/dist/geolocation.d.ts +1 -1
  29. package/dist/geolocation.esm.js +2 -2
  30. package/dist/geolocationManager-BOuGkRoP.d.ts +500 -0
  31. package/dist/{geolocationManager-D58ehBHU.esm.js → geolocationManager-CUchGjvz.esm.js} +28 -12
  32. package/dist/{geolocationStateMachine-BorcBNZ6.esm.js → geolocationStateMachine-DRAULUHq.esm.js} +46 -20
  33. package/dist/id-ocr.d.ts +1 -1
  34. package/dist/id.esm.js +2 -2
  35. package/dist/{idCaptureManager-BBfWW9Y0.esm.js → idCaptureManager-Cni6kB_4.esm.js} +1 -1
  36. package/dist/{idCaptureStateMachine-_1pROAbA.esm.js → idCaptureStateMachine-CZWjw6Qa.esm.js} +5 -5
  37. package/dist/{idOcrManager-vXa7GdRh.d.ts → idOcrManager-B-JyjyPb.d.ts} +1 -1
  38. package/dist/identity-reuse.d.ts +1 -1
  39. package/dist/{identityReuseManager-D6pD4hcZ.d.ts → identityReuseManager-v2TH5g7e.d.ts} +1 -1
  40. package/dist/index.esm.js +1 -1
  41. package/dist/mandatory-consent.d.ts +1 -1
  42. package/dist/{mandatoryConsentManager-BR8SLvd1.d.ts → mandatoryConsentManager-Bztc-cm2.d.ts} +5 -5
  43. package/dist/{onDeviceFaceResults-B3oTx-NK.esm.js → onDeviceFaceResults-wRyQ24qM.esm.js} +1 -1
  44. package/dist/personhood.esm.js +2 -2
  45. package/dist/qe-signature.esm.js +1 -1
  46. package/dist/{recordingService-Comyo6yK.esm.js → recordingService-5by5uVOf.esm.js} +1 -1
  47. package/dist/selfie.esm.js +4 -4
  48. package/dist/{selfieManager-CCR6VpoQ.esm.js → selfieManager-D57f1R4V.esm.js} +2 -2
  49. package/dist/{selfieStateMachine-D30gwMGq.esm.js → selfieStateMachine-nqQV3aNZ.esm.js} +2 -2
  50. package/dist/session-dUSz_co4.esm.js +1 -0
  51. package/dist/session.esm.js +4 -4
  52. package/dist/{sessionInitializer-CrzyJ4Y0.esm.js → sessionInitializer-CCiF0nzE.esm.js} +1 -1
  53. package/dist/{setup-CBijDJ0d.esm.js → setup-DmEcArzU.esm.js} +1 -1
  54. package/dist/video-selfie.esm.js +2 -2
  55. package/dist/wasm.esm.js +1 -1
  56. package/dist/workflow.esm.js +10 -10
  57. package/package.json +3 -3
  58. package/dist/geolocationManager-BWhRzBjk.d.ts +0 -155
  59. package/dist/session-B9KT6qnE.esm.js +0 -1
@@ -0,0 +1,500 @@
1
+ import { A as StateMachine, C as StateValue, D as PromiseActorLogic, a as ActorRefFromLogic, b as RequiredActorOptions, c as AnyEventObject, g as IsNotNever, h as InputFrom, i as ActorRefFrom, k as MachineSnapshot, m as GetConcreteByKey, o as AnyActorLogic, p as EventObject, r as ActorRef, s as AnyActorRef, u as ConditionalRequired, v as MetaObject, w as Values, x as RequiredLogicInput, y as NonReducibleUnknown } from "./spawn-D9jgw9pW.js";
2
+ import "./StateMachine-EDpYWy0i.js";
3
+ import { t as Manager } from "./Manager-CQQ99QOI.js";
4
+ import "./Actor-iTq7YY48.js";
5
+ //#region ../infra/src/capabilities/IGeolocationCapability.d.ts
6
+ type GeolocationCoords = {
7
+ latitude: number;
8
+ longitude: number;
9
+ };
10
+ type IGeolocationCapability = {
11
+ getCurrentPosition(): Promise<GeolocationCoords>;
12
+ };
13
+ //#endregion
14
+ //#region src/modules/geolocation/types.d.ts
15
+ /**
16
+ * Configuration options for the Geolocation module.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const config: GeolocationConfig = {
21
+ * allowUserToSkipGeolocation: true,
22
+ * };
23
+ * ```
24
+ */
25
+ type GeolocationConfig = {
26
+ /**
27
+ * Whether the user is allowed to skip geolocation capture.
28
+ * When true, a skip button is shown on the permission-denied screen.
29
+ * Backend field name from flow/workflow configuration.
30
+ * @default false
31
+ */
32
+ allowUserToSkipGeolocation?: boolean;
33
+ /**
34
+ * Maximum number of backend submit attempts before the error screen stops
35
+ * offering "Try again" and falls back to skip/quit.
36
+ * @default 3
37
+ */
38
+ maxAttempts?: number;
39
+ };
40
+ type AddGeolocationParams = {
41
+ latitude: number;
42
+ longitude: number;
43
+ };
44
+ //#endregion
45
+ //#region src/modules/geolocation/geolocationStateMachine.d.ts
46
+ type GeolocationDeviceType = 'ios' | 'android' | 'desktop';
47
+ type GeolocationContext = {
48
+ config: GeolocationConfig;
49
+ geolocation: IGeolocationCapability;
50
+ coords: AddGeolocationParams | undefined;
51
+ location: string | null | undefined;
52
+ deviceType: GeolocationDeviceType;
53
+ attemptsRemaining: number;
54
+ };
55
+ type GeolocationInput = {
56
+ config: GeolocationConfig;
57
+ geolocation: IGeolocationCapability;
58
+ };
59
+ declare const geolocationMachine: StateMachine<GeolocationContext, {
60
+ type: "REQUEST";
61
+ } | {
62
+ type: "CONTINUE";
63
+ } | {
64
+ type: "SKIP";
65
+ } | {
66
+ type: "RETRY";
67
+ } | {
68
+ type: "QUIT";
69
+ }, {
70
+ [x: string]: ActorRefFromLogic<PromiseActorLogic<AddGeolocationParams, {
71
+ geolocation: IGeolocationCapability;
72
+ }, EventObject>> | ActorRefFromLogic<PromiseActorLogic<{
73
+ location: string | null;
74
+ }, AddGeolocationParams, EventObject>> | undefined;
75
+ }, Values<{
76
+ requestPosition: {
77
+ src: "requestPosition";
78
+ logic: PromiseActorLogic<AddGeolocationParams, {
79
+ geolocation: IGeolocationCapability;
80
+ }, EventObject>;
81
+ id: string | undefined;
82
+ };
83
+ submitPosition: {
84
+ src: "submitPosition";
85
+ logic: PromiseActorLogic<{
86
+ location: string | null;
87
+ }, AddGeolocationParams, EventObject>;
88
+ id: string | undefined;
89
+ };
90
+ }>, Values<{
91
+ setCoords: {
92
+ type: "setCoords";
93
+ params: NonReducibleUnknown;
94
+ };
95
+ setLocation: {
96
+ type: "setLocation";
97
+ params: NonReducibleUnknown;
98
+ };
99
+ setDeviceType: {
100
+ type: "setDeviceType";
101
+ params: NonReducibleUnknown;
102
+ };
103
+ decrementAttemptsRemaining: {
104
+ type: "decrementAttemptsRemaining";
105
+ params: NonReducibleUnknown;
106
+ };
107
+ }>, Values<{
108
+ canSkip: {
109
+ type: "canSkip";
110
+ params: unknown;
111
+ };
112
+ hasAttemptsRemaining: {
113
+ type: "hasAttemptsRemaining";
114
+ params: unknown;
115
+ };
116
+ isNetworkError: {
117
+ type: "isNetworkError";
118
+ params: unknown;
119
+ };
120
+ isPermissionDenied: {
121
+ type: "isPermissionDenied";
122
+ params: unknown;
123
+ };
124
+ }>, never, "error" | "idle" | "finished" | "requestingLocation" | "submitting" | "permissionDenied" | "locationAcquired" | "noNetwork", string, GeolocationInput, NonReducibleUnknown, EventObject, MetaObject, {
125
+ readonly id: "geolocation";
126
+ readonly initial: "idle";
127
+ readonly context: ({ input }: {
128
+ spawn: {
129
+ <TSrc extends "requestPosition" | "submitPosition">(logic: TSrc, ...[options]: ({
130
+ src: "requestPosition";
131
+ logic: PromiseActorLogic<AddGeolocationParams, {
132
+ geolocation: IGeolocationCapability;
133
+ }, EventObject>;
134
+ id: string | undefined;
135
+ } extends (infer T) ? T extends {
136
+ src: "requestPosition";
137
+ logic: PromiseActorLogic<AddGeolocationParams, {
138
+ geolocation: IGeolocationCapability;
139
+ }, EventObject>;
140
+ id: string | undefined;
141
+ } ? T extends {
142
+ src: TSrc;
143
+ } ? ConditionalRequired<[options?: ({
144
+ id?: T["id"] | undefined;
145
+ systemId?: string;
146
+ input?: InputFrom<T["logic"]> | undefined;
147
+ syncSnapshot?: boolean;
148
+ } & { [K in RequiredActorOptions<T>]: unknown; }) | undefined], IsNotNever<RequiredActorOptions<T>>> : never : never : never) | ({
149
+ src: "submitPosition";
150
+ logic: PromiseActorLogic<{
151
+ location: string | null;
152
+ }, AddGeolocationParams, EventObject>;
153
+ id: string | undefined;
154
+ } extends (infer T_1) ? T_1 extends {
155
+ src: "submitPosition";
156
+ logic: PromiseActorLogic<{
157
+ location: string | null;
158
+ }, AddGeolocationParams, EventObject>;
159
+ id: string | undefined;
160
+ } ? T_1 extends {
161
+ src: TSrc;
162
+ } ? ConditionalRequired<[options?: ({
163
+ id?: T_1["id"] | undefined;
164
+ systemId?: string;
165
+ input?: InputFrom<T_1["logic"]> | undefined;
166
+ syncSnapshot?: boolean;
167
+ } & { [K_1 in RequiredActorOptions<T_1>]: unknown; }) | undefined], IsNotNever<RequiredActorOptions<T_1>>> : never : never : never)): ActorRefFromLogic<GetConcreteByKey<Values<{
168
+ requestPosition: {
169
+ src: "requestPosition";
170
+ logic: PromiseActorLogic<AddGeolocationParams, {
171
+ geolocation: IGeolocationCapability;
172
+ }, EventObject>;
173
+ id: string | undefined;
174
+ };
175
+ submitPosition: {
176
+ src: "submitPosition";
177
+ logic: PromiseActorLogic<{
178
+ location: string | null;
179
+ }, AddGeolocationParams, EventObject>;
180
+ id: string | undefined;
181
+ };
182
+ }>, "src", TSrc>["logic"]>;
183
+ <TLogic extends AnyActorLogic>(src: TLogic, ...[options]: ConditionalRequired<[options?: ({
184
+ id?: never;
185
+ systemId?: string;
186
+ input?: InputFrom<TLogic> | undefined;
187
+ syncSnapshot?: boolean;
188
+ } & { [K in RequiredLogicInput<TLogic>]: unknown; }) | undefined], IsNotNever<RequiredLogicInput<TLogic>>>): ActorRefFromLogic<TLogic>;
189
+ };
190
+ input: GeolocationInput;
191
+ self: ActorRef<MachineSnapshot<GeolocationContext, {
192
+ type: "REQUEST";
193
+ } | {
194
+ type: "CONTINUE";
195
+ } | {
196
+ type: "SKIP";
197
+ } | {
198
+ type: "RETRY";
199
+ } | {
200
+ type: "QUIT";
201
+ }, Record<string, AnyActorRef | undefined>, StateValue, string, unknown, any, any>, {
202
+ type: "REQUEST";
203
+ } | {
204
+ type: "CONTINUE";
205
+ } | {
206
+ type: "SKIP";
207
+ } | {
208
+ type: "RETRY";
209
+ } | {
210
+ type: "QUIT";
211
+ }, AnyEventObject>;
212
+ }) => {
213
+ config: GeolocationConfig;
214
+ geolocation: IGeolocationCapability;
215
+ coords: undefined;
216
+ location: undefined;
217
+ deviceType: GeolocationDeviceType;
218
+ attemptsRemaining: number;
219
+ };
220
+ readonly states: {
221
+ readonly idle: {
222
+ readonly on: {
223
+ readonly REQUEST: {
224
+ readonly target: "requestingLocation";
225
+ };
226
+ };
227
+ };
228
+ readonly requestingLocation: {
229
+ readonly invoke: {
230
+ readonly id: "requestPosition";
231
+ readonly src: "requestPosition";
232
+ readonly input: ({ context }: {
233
+ context: GeolocationContext;
234
+ event: {
235
+ type: "REQUEST";
236
+ } | {
237
+ type: "CONTINUE";
238
+ } | {
239
+ type: "SKIP";
240
+ } | {
241
+ type: "RETRY";
242
+ } | {
243
+ type: "QUIT";
244
+ };
245
+ self: ActorRef<MachineSnapshot<GeolocationContext, {
246
+ type: "REQUEST";
247
+ } | {
248
+ type: "CONTINUE";
249
+ } | {
250
+ type: "SKIP";
251
+ } | {
252
+ type: "RETRY";
253
+ } | {
254
+ type: "QUIT";
255
+ }, Record<string, AnyActorRef>, StateValue, string, unknown, any, any>, {
256
+ type: "REQUEST";
257
+ } | {
258
+ type: "CONTINUE";
259
+ } | {
260
+ type: "SKIP";
261
+ } | {
262
+ type: "RETRY";
263
+ } | {
264
+ type: "QUIT";
265
+ }, AnyEventObject>;
266
+ }) => {
267
+ geolocation: IGeolocationCapability;
268
+ };
269
+ readonly onDone: {
270
+ readonly target: "submitting";
271
+ readonly actions: "setCoords";
272
+ };
273
+ readonly onError: readonly [{
274
+ readonly target: "permissionDenied";
275
+ readonly guard: "isPermissionDenied";
276
+ readonly actions: "setDeviceType";
277
+ }, {
278
+ readonly target: "error";
279
+ readonly actions: "decrementAttemptsRemaining";
280
+ }];
281
+ };
282
+ };
283
+ readonly submitting: {
284
+ readonly invoke: {
285
+ readonly id: "submitPosition";
286
+ readonly src: "submitPosition";
287
+ readonly input: ({ context }: {
288
+ context: GeolocationContext;
289
+ event: {
290
+ type: "REQUEST";
291
+ } | {
292
+ type: "CONTINUE";
293
+ } | {
294
+ type: "SKIP";
295
+ } | {
296
+ type: "RETRY";
297
+ } | {
298
+ type: "QUIT";
299
+ };
300
+ self: ActorRef<MachineSnapshot<GeolocationContext, {
301
+ type: "REQUEST";
302
+ } | {
303
+ type: "CONTINUE";
304
+ } | {
305
+ type: "SKIP";
306
+ } | {
307
+ type: "RETRY";
308
+ } | {
309
+ type: "QUIT";
310
+ }, Record<string, AnyActorRef>, StateValue, string, unknown, any, any>, {
311
+ type: "REQUEST";
312
+ } | {
313
+ type: "CONTINUE";
314
+ } | {
315
+ type: "SKIP";
316
+ } | {
317
+ type: "RETRY";
318
+ } | {
319
+ type: "QUIT";
320
+ }, AnyEventObject>;
321
+ }) => {
322
+ latitude: number;
323
+ longitude: number;
324
+ };
325
+ readonly onDone: {
326
+ readonly target: "locationAcquired";
327
+ readonly actions: "setLocation";
328
+ };
329
+ readonly onError: readonly [{
330
+ readonly target: "noNetwork";
331
+ readonly guard: "isNetworkError";
332
+ }, {
333
+ readonly target: "error";
334
+ readonly actions: "decrementAttemptsRemaining";
335
+ }];
336
+ };
337
+ };
338
+ readonly noNetwork: {};
339
+ readonly error: {
340
+ readonly on: {
341
+ readonly RETRY: {
342
+ readonly target: "idle";
343
+ readonly guard: "hasAttemptsRemaining";
344
+ };
345
+ readonly SKIP: {
346
+ readonly target: "finished";
347
+ readonly guard: "canSkip";
348
+ };
349
+ readonly QUIT: {
350
+ readonly target: "finished";
351
+ };
352
+ };
353
+ };
354
+ readonly locationAcquired: {
355
+ readonly on: {
356
+ readonly CONTINUE: {
357
+ readonly target: "finished";
358
+ };
359
+ };
360
+ };
361
+ readonly permissionDenied: {
362
+ readonly on: {
363
+ readonly SKIP: {
364
+ readonly target: "finished";
365
+ readonly guard: "canSkip";
366
+ };
367
+ };
368
+ };
369
+ readonly finished: {
370
+ readonly type: "final";
371
+ };
372
+ };
373
+ }>;
374
+ type GeolocationMachine = typeof geolocationMachine;
375
+ //#endregion
376
+ //#region src/modules/geolocation/geolocationActor.d.ts
377
+ type CreateGeolocationActorOptions = {
378
+ config: GeolocationConfig;
379
+ geolocation?: IGeolocationCapability;
380
+ };
381
+ type GeolocationActor = ActorRefFrom<GeolocationMachine>;
382
+ //#endregion
383
+ //#region src/modules/geolocation/geolocationManager.d.ts
384
+ /** Geolocation manager is in initial state, waiting for `request()` to be called */
385
+ type GeolocationIdleState = {
386
+ status: 'idle';
387
+ };
388
+ /** Browser geolocation permission prompt is active */
389
+ type GeolocationRequestingState = {
390
+ status: 'requestingLocation';
391
+ };
392
+ /** Coordinates are being submitted to the backend */
393
+ type GeolocationSubmittingState = {
394
+ status: 'submitting';
395
+ };
396
+ /**
397
+ * Location successfully acquired — call `continue()` to proceed
398
+ * @property location - Location name returned from backend, or null
399
+ */
400
+ type GeolocationAcquiredState = {
401
+ status: 'locationAcquired';
402
+ location: string | null;
403
+ };
404
+ type GeolocationErrorState = {
405
+ status: 'error';
406
+ attemptsRemaining: number;
407
+ canSkip: boolean;
408
+ };
409
+ /**
410
+ * A backend request failed due to lost connectivity (device offline/network
411
+ * error) = the user refreshes once the connection returns.
412
+ */
413
+ type GeolocationNoNetworkState = {
414
+ status: 'noNetwork';
415
+ };
416
+ /**
417
+ * User denied geolocation permission — shows device-specific instructions
418
+ * @property deviceType - Used by UI to render the correct instruction panel
419
+ * @property canSkip - Whether the skip button should be shown
420
+ */
421
+ type GeolocationPermissionDeniedState = {
422
+ status: 'permissionDenied';
423
+ deviceType: GeolocationDeviceType;
424
+ canSkip: boolean;
425
+ };
426
+ /** Geolocation flow completed successfully */
427
+ type GeolocationFinishedState = {
428
+ status: 'finished';
429
+ };
430
+ /**
431
+ * Union of all possible geolocation manager states.
432
+ *
433
+ * @example
434
+ * ```typescript
435
+ * const state = geolocationManager.getState();
436
+ * if (state.status === 'locationAcquired') {
437
+ * console.log(state.location);
438
+ * }
439
+ * if (state.status === 'permissionDenied') {
440
+ * console.log(state.deviceType); // 'ios' | 'android' | 'desktop'
441
+ * }
442
+ * ```
443
+ */
444
+ type GeolocationState = GeolocationIdleState | GeolocationRequestingState | GeolocationSubmittingState | GeolocationAcquiredState | GeolocationErrorState | GeolocationNoNetworkState | GeolocationPermissionDeniedState | GeolocationFinishedState;
445
+ /**
446
+ * Creates a geolocation manager for headless or UI-driven usage.
447
+ *
448
+ * @example Headless usage
449
+ * ```typescript
450
+ * const manager = createGeolocationManager({ config: { allowUserToSkipGeolocation: true } });
451
+ * manager.subscribe((state) => console.log(state.status));
452
+ * manager.request();
453
+ * ```
454
+ */
455
+ declare function createGeolocationManager(options: CreateGeolocationActorOptions): Manager<GeolocationState> & {
456
+ /**
457
+ * Initiates the browser geolocation permission request.
458
+ * Transitions from 'idle' to 'requestingLocation'.
459
+ */
460
+ request(): void;
461
+ /**
462
+ * Confirms the acquired location and completes the module.
463
+ * Should be called when state is 'locationAcquired'.
464
+ */
465
+ continue(): void;
466
+ /**
467
+ * Skips geolocation when the user has denied permission.
468
+ * Only works when `config.allowUserToSkipGeolocation` is true.
469
+ */
470
+ skip(): void;
471
+ retry(): void;
472
+ quit(): void;
473
+ };
474
+ /**
475
+ * Creates a geolocation manager from a pre-built actor.
476
+ * Use this when overriding the machine via `.provide()` for custom backends
477
+ * or for story-isolation testing.
478
+ */
479
+ declare function createGeolocationManagerFromActor(actor: GeolocationActor): Manager<GeolocationState> & {
480
+ /**
481
+ * Initiates the browser geolocation permission request.
482
+ * Transitions from 'idle' to 'requestingLocation'.
483
+ */
484
+ request(): void;
485
+ /**
486
+ * Confirms the acquired location and completes the module.
487
+ * Should be called when state is 'locationAcquired'.
488
+ */
489
+ continue(): void;
490
+ /**
491
+ * Skips geolocation when the user has denied permission.
492
+ * Only works when `config.allowUserToSkipGeolocation` is true.
493
+ */
494
+ skip(): void;
495
+ retry(): void;
496
+ quit(): void;
497
+ };
498
+ type GeolocationManager = ReturnType<typeof createGeolocationManager>;
499
+ //#endregion
500
+ export { GeolocationActor as a, createGeolocationManagerFromActor as i, GeolocationState as n, geolocationMachine as o, createGeolocationManager as r, GeolocationConfig as s, GeolocationManager as t };
@@ -1,6 +1,6 @@
1
1
  import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dy8PyVO5.esm.js";
2
2
  import { c as createManager, o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.js";
3
- import { t as geolocationMachine } from "./geolocationStateMachine-BorcBNZ6.esm.js";
3
+ import { t as geolocationMachine } from "./geolocationStateMachine-DRAULUHq.esm.js";
4
4
  //#region ../infra/src/providers/browser/BrowserGeolocationProvider.ts
5
5
  var BrowserGeolocationProvider = class {
6
6
  getCurrentPosition() {
@@ -8,7 +8,7 @@ var BrowserGeolocationProvider = class {
8
8
  navigator.geolocation.getCurrentPosition((pos) => resolve({
9
9
  latitude: pos.coords.latitude,
10
10
  longitude: pos.coords.longitude
11
- }), reject);
11
+ }), (err) => reject(Object.assign(new Error(err.message), { code: err.code })));
12
12
  });
13
13
  }
14
14
  };
@@ -32,11 +32,17 @@ function createGeolocationActor(options) {
32
32
  * Source of truth: Geolocation Figma file → Tracked Events canvas
33
33
  * (`https://www.figma.com/design/xg1t3GnUS95A4bLrM3lyOG/Geolocation---Latest-Design?node-id=2652-17008`).
34
34
  *
35
- * Deferred Figma screens that have no state-machine counterpart yet:
36
- * `Geolocation.error.locationUnavailable` and `Geolocation.error.noNetwork`.
37
- * Both kinds of failure currently collapse into `permissionDenied`
38
- * (`requestPosition` `onError`) or `locationAcquired` with `location: null`
39
- * (`submitPosition` `onError`), so the machine cannot distinguish them today.
35
+ * Failure mapping: a device-level failure (`requestPosition` `onError`) splits
36
+ * by `GeolocationPositionError.code` a real permission denial (code 1) routes
37
+ * to `permissionDenied` (device-specific "enable location" instructions), while
38
+ * a transient failure (position unavailable / timeout, e.g. the browser's
39
+ * `kCLErrorLocationUnknown`) routes to the attempt-limited `error` state so the
40
+ * user can retry. A backend submit failure (`submitPosition` `onError`) splits
41
+ * by cause: a connectivity error routes to `noNetwork`
42
+ * (`Geolocation.error.noNetwork`), while a server-side rejection routes to the
43
+ * same attempt-limited `error` state (`Geolocation.error`). The deferred Figma
44
+ * sub-screen `Geolocation.error.locationUnavailable` shares the `Geolocation.error`
45
+ * screen name for now rather than emitting a distinct one.
40
46
  */
41
47
  function getGeolocationScreenName(snapshot) {
42
48
  const { value } = snapshot;
@@ -48,6 +54,8 @@ function getGeolocationScreenName(snapshot) {
48
54
  case "locationAcquired":
49
55
  case "finished": return "Geolocation.continue";
50
56
  case "permissionDenied": return "Geolocation.allowLocation";
57
+ case "error": return "Geolocation.error";
58
+ case "noNetwork": return "Geolocation.error.noNetwork";
51
59
  default: return;
52
60
  }
53
61
  }
@@ -66,6 +74,12 @@ function mapState(snapshot) {
66
74
  deviceType: context.deviceType,
67
75
  canSkip: context.config.allowUserToSkipGeolocation === true
68
76
  };
77
+ if (typedSnapshot.matches("error")) return {
78
+ status: "error",
79
+ attemptsRemaining: context.attemptsRemaining,
80
+ canSkip: context.config.allowUserToSkipGeolocation === true
81
+ };
82
+ if (typedSnapshot.matches("noNetwork")) return { status: "noNetwork" };
69
83
  if (typedSnapshot.matches("finished")) return { status: "finished" };
70
84
  return { status: "idle" };
71
85
  }
@@ -95,11 +109,13 @@ function createApi({ actor, trackElementClicked }) {
95
109
  trackElementClicked?.("skip");
96
110
  actor.send({ type: "SKIP" });
97
111
  },
98
- /**
99
- * Resets the manager back to initial state.
100
- */
101
- reset() {
102
- actor.send({ type: "RESET" });
112
+ retry() {
113
+ trackElementClicked?.("retry");
114
+ actor.send({ type: "RETRY" });
115
+ },
116
+ quit() {
117
+ trackElementClicked?.("quit");
118
+ actor.send({ type: "QUIT" });
103
119
  }
104
120
  };
105
121
  }
@@ -3,6 +3,7 @@ import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
3
3
  import { r as isIOS, t as isAndroid } from "./platform-wmV7oTAJ.esm.js";
4
4
  import { r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
5
5
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
6
+ import { n as isConnectivityError } from "./apiError-B-PkYxln.esm.js";
6
7
  //#region src/modules/geolocation/geolocationServices.ts
7
8
  async function addGeolocation(params, signal) {
8
9
  const res = await api.post(endpoints.addGeolocation, {
@@ -19,6 +20,16 @@ function detectDeviceType() {
19
20
  if (isAndroid()) return "android";
20
21
  return "desktop";
21
22
  }
23
+ const DEFAULT_MAX_ATTEMPTS = 3;
24
+ /**
25
+ * `GeolocationPositionError.PERMISSION_DENIED`. Only this code means the user
26
+ * has to change a setting; the other codes (`POSITION_UNAVAILABLE`, `TIMEOUT`)
27
+ * are transient device failures that route to the retryable `error` flow.
28
+ */
29
+ const GEOLOCATION_PERMISSION_DENIED = 1;
30
+ function resolveMaxAttempts(config) {
31
+ return config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
32
+ }
22
33
  const geolocationMachine = setup({
23
34
  types: {
24
35
  context: {},
@@ -30,26 +41,21 @@ const geolocationMachine = setup({
30
41
  return input.geolocation.getCurrentPosition();
31
42
  }),
32
43
  submitPosition: fromPromise(async ({ input, signal }) => {
33
- try {
34
- return await addGeolocation(input, signal);
35
- } catch {
36
- return { location: null };
37
- }
44
+ return await addGeolocation(input, signal);
38
45
  })
39
46
  },
40
47
  actions: {
41
48
  setCoords: assign(({ event }) => ({ coords: event.output })),
42
49
  setLocation: assign(({ event }) => ({ location: event.output.location })),
43
50
  setDeviceType: assign({ deviceType: () => detectDeviceType() }),
44
- resetContext: assign(({ context }) => ({
45
- config: context.config,
46
- geolocation: context.geolocation,
47
- coords: void 0,
48
- location: void 0,
49
- deviceType: detectDeviceType()
50
- }))
51
+ decrementAttemptsRemaining: assign(({ context }) => ({ attemptsRemaining: context.attemptsRemaining - 1 }))
51
52
  },
52
- guards: { canSkip: ({ context }) => context.config.allowUserToSkipGeolocation === true }
53
+ guards: {
54
+ canSkip: ({ context }) => context.config.allowUserToSkipGeolocation === true,
55
+ hasAttemptsRemaining: ({ context }) => context.attemptsRemaining > 0,
56
+ isNetworkError: ({ event }) => isConnectivityError(event.error),
57
+ isPermissionDenied: ({ event }) => event.error?.code === GEOLOCATION_PERMISSION_DENIED
58
+ }
53
59
  }).createMachine({
54
60
  id: "geolocation",
55
61
  initial: "idle",
@@ -58,7 +64,8 @@ const geolocationMachine = setup({
58
64
  geolocation: input.geolocation,
59
65
  coords: void 0,
60
66
  location: void 0,
61
- deviceType: detectDeviceType()
67
+ deviceType: detectDeviceType(),
68
+ attemptsRemaining: resolveMaxAttempts(input.config)
62
69
  }),
63
70
  states: {
64
71
  idle: { on: { REQUEST: { target: "requestingLocation" } } },
@@ -70,10 +77,14 @@ const geolocationMachine = setup({
70
77
  target: "submitting",
71
78
  actions: "setCoords"
72
79
  },
73
- onError: {
80
+ onError: [{
74
81
  target: "permissionDenied",
82
+ guard: "isPermissionDenied",
75
83
  actions: "setDeviceType"
76
- }
84
+ }, {
85
+ target: "error",
86
+ actions: "decrementAttemptsRemaining"
87
+ }]
77
88
  } },
78
89
  submitting: { invoke: {
79
90
  id: "submitPosition",
@@ -86,10 +97,25 @@ const geolocationMachine = setup({
86
97
  target: "locationAcquired",
87
98
  actions: "setLocation"
88
99
  },
89
- onError: {
90
- target: "locationAcquired",
91
- actions: assign({ location: () => null })
92
- }
100
+ onError: [{
101
+ target: "noNetwork",
102
+ guard: "isNetworkError"
103
+ }, {
104
+ target: "error",
105
+ actions: "decrementAttemptsRemaining"
106
+ }]
107
+ } },
108
+ noNetwork: {},
109
+ error: { on: {
110
+ RETRY: {
111
+ target: "idle",
112
+ guard: "hasAttemptsRemaining"
113
+ },
114
+ SKIP: {
115
+ target: "finished",
116
+ guard: "canSkip"
117
+ },
118
+ QUIT: { target: "finished" }
93
119
  } },
94
120
  locationAcquired: { on: { CONTINUE: { target: "finished" } } },
95
121
  permissionDenied: { on: { SKIP: {
package/dist/id-ocr.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as IdOcrActor, c as IdOcrConfig, d as UpdateOcrDataParams, f as ValidationRule, i as createIdOcrManagerFromActor, l as OcrData, n as IdOcrState, o as IdOcrOcrDocument, r as createIdOcrManager, s as idOcrStateMachine, t as IdOcrManager, u as OcrFieldConfig } from "./idOcrManager-vXa7GdRh.js";
1
+ import { a as IdOcrActor, c as IdOcrConfig, d as UpdateOcrDataParams, f as ValidationRule, i as createIdOcrManagerFromActor, l as OcrData, n as IdOcrState, o as IdOcrOcrDocument, r as createIdOcrManager, s as idOcrStateMachine, t as IdOcrManager, u as OcrFieldConfig } from "./idOcrManager-B-JyjyPb.js";
2
2
  //#region src/modules/id-ocr/idOcrFields.d.ts
3
3
  declare const OCR_FIELDS: OcrFieldConfig[];
4
4
  declare const getOcrFields: (config: Pick<IdOcrConfig, "flowId">) => OcrFieldConfig[];