@incodetech/core 0.0.0-dev-20260402-43cf9b8 → 0.0.0-dev-20260402-7cf9db4

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.
@@ -2,10 +2,10 @@ import "./Actor-phIcsUhv.js";
2
2
  import "./camera-Dv2WEhGe.js";
3
3
  import { n as DocumentUploadContext, r as DocumentUploadInput, t as DocumentUploadConfig } from "./types-BWGxcjiZ.js";
4
4
  import { t as Manager } from "./Manager-BndLda4_.js";
5
- import * as xstate135 from "xstate";
5
+ import * as xstate140 from "xstate";
6
6
 
7
7
  //#region src/modules/document-upload/documentUploadStateMachine.d.ts
8
- declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContext, {
8
+ declare const documentUploadMachine: xstate140.StateMachine<DocumentUploadContext, {
9
9
  type: "START";
10
10
  } | {
11
11
  type: "CAPTURE";
@@ -18,52 +18,52 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
18
18
  } | {
19
19
  type: "CLOSE";
20
20
  }, {
21
- [x: string]: xstate135.ActorRefFromLogic<xstate135.PromiseActorLogic<MediaStream, void, xstate135.EventObject>> | xstate135.ActorRefFromLogic<xstate135.PromiseActorLogic<void, {
21
+ [x: string]: xstate140.ActorRefFromLogic<xstate140.PromiseActorLogic<MediaStream, void, xstate140.EventObject>> | xstate140.ActorRefFromLogic<xstate140.PromiseActorLogic<void, {
22
22
  imageBase64: string;
23
23
  documentType: string;
24
24
  onProgress: (progress: number) => void;
25
- }, xstate135.EventObject>> | undefined;
26
- }, xstate135.Values<{
25
+ }, xstate140.EventObject>> | undefined;
26
+ }, xstate140.Values<{
27
27
  initCamera: {
28
28
  src: "initCamera";
29
- logic: xstate135.PromiseActorLogic<MediaStream, void, xstate135.EventObject>;
29
+ logic: xstate140.PromiseActorLogic<MediaStream, void, xstate140.EventObject>;
30
30
  id: string | undefined;
31
31
  };
32
32
  uploadDocument: {
33
33
  src: "uploadDocument";
34
- logic: xstate135.PromiseActorLogic<void, {
34
+ logic: xstate140.PromiseActorLogic<void, {
35
35
  imageBase64: string;
36
36
  documentType: string;
37
37
  onProgress: (progress: number) => void;
38
- }, xstate135.EventObject>;
38
+ }, xstate140.EventObject>;
39
39
  id: string | undefined;
40
40
  };
41
- }>, xstate135.Values<{
41
+ }>, xstate140.Values<{
42
42
  setError: {
43
43
  type: "setError";
44
- params: xstate135.NonReducibleUnknown;
44
+ params: xstate140.NonReducibleUnknown;
45
45
  };
46
46
  clearError: {
47
47
  type: "clearError";
48
- params: xstate135.NonReducibleUnknown;
48
+ params: xstate140.NonReducibleUnknown;
49
49
  };
50
50
  setStream: {
51
51
  type: "setStream";
52
- params: xstate135.NonReducibleUnknown;
53
- };
54
- setImageAndClearError: {
55
- type: "setImageAndClearError";
56
- params: xstate135.NonReducibleUnknown;
52
+ params: xstate140.NonReducibleUnknown;
57
53
  };
58
54
  setProgress: {
59
55
  type: "setProgress";
60
- params: xstate135.NonReducibleUnknown;
56
+ params: xstate140.NonReducibleUnknown;
61
57
  };
62
58
  stopStream: {
63
59
  type: "stopStream";
64
- params: xstate135.NonReducibleUnknown;
60
+ params: xstate140.NonReducibleUnknown;
61
+ };
62
+ setImageAndClearError: {
63
+ type: "setImageAndClearError";
64
+ params: xstate140.NonReducibleUnknown;
65
65
  };
66
- }>, never, never, "error" | "idle" | "closed" | "finished" | "initCamera" | "capturing" | "uploading", string, DocumentUploadInput, xstate135.NonReducibleUnknown, xstate135.EventObject, xstate135.MetaObject, {
66
+ }>, never, never, "error" | "idle" | "finished" | "initCamera" | "capturing" | "closed" | "uploading", string, DocumentUploadInput, xstate140.NonReducibleUnknown, xstate140.EventObject, xstate140.MetaObject, {
67
67
  readonly id: "documentUpload";
68
68
  readonly initial: "idle";
69
69
  readonly context: ({
@@ -72,67 +72,67 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
72
72
  spawn: {
73
73
  <TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
74
74
  src: "initCamera";
75
- logic: xstate135.PromiseActorLogic<MediaStream, void, xstate135.EventObject>;
75
+ logic: xstate140.PromiseActorLogic<MediaStream, void, xstate140.EventObject>;
76
76
  id: string | undefined;
77
77
  } extends infer T ? T extends {
78
78
  src: "initCamera";
79
- logic: xstate135.PromiseActorLogic<MediaStream, void, xstate135.EventObject>;
79
+ logic: xstate140.PromiseActorLogic<MediaStream, void, xstate140.EventObject>;
80
80
  id: string | undefined;
81
81
  } ? T extends {
82
82
  src: TSrc;
83
- } ? xstate135.ConditionalRequired<[options?: ({
83
+ } ? xstate140.ConditionalRequired<[options?: ({
84
84
  id?: T["id"] | undefined;
85
85
  systemId?: string;
86
- input?: xstate135.InputFrom<T["logic"]> | undefined;
86
+ input?: xstate140.InputFrom<T["logic"]> | undefined;
87
87
  syncSnapshot?: boolean;
88
- } & { [K in xstate135.RequiredActorOptions<T>]: unknown }) | undefined], xstate135.IsNotNever<xstate135.RequiredActorOptions<T>>> : never : never : never) | ({
88
+ } & { [K in xstate140.RequiredActorOptions<T>]: unknown }) | undefined], xstate140.IsNotNever<xstate140.RequiredActorOptions<T>>> : never : never : never) | ({
89
89
  src: "uploadDocument";
90
- logic: xstate135.PromiseActorLogic<void, {
90
+ logic: xstate140.PromiseActorLogic<void, {
91
91
  imageBase64: string;
92
92
  documentType: string;
93
93
  onProgress: (progress: number) => void;
94
- }, xstate135.EventObject>;
94
+ }, xstate140.EventObject>;
95
95
  id: string | undefined;
96
96
  } extends infer T_1 ? T_1 extends {
97
97
  src: "uploadDocument";
98
- logic: xstate135.PromiseActorLogic<void, {
98
+ logic: xstate140.PromiseActorLogic<void, {
99
99
  imageBase64: string;
100
100
  documentType: string;
101
101
  onProgress: (progress: number) => void;
102
- }, xstate135.EventObject>;
102
+ }, xstate140.EventObject>;
103
103
  id: string | undefined;
104
104
  } ? T_1 extends {
105
105
  src: TSrc;
106
- } ? xstate135.ConditionalRequired<[options?: ({
106
+ } ? xstate140.ConditionalRequired<[options?: ({
107
107
  id?: T_1["id"] | undefined;
108
108
  systemId?: string;
109
- input?: xstate135.InputFrom<T_1["logic"]> | undefined;
109
+ input?: xstate140.InputFrom<T_1["logic"]> | undefined;
110
110
  syncSnapshot?: boolean;
111
- } & { [K_1 in xstate135.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate135.IsNotNever<xstate135.RequiredActorOptions<T_1>>> : never : never : never)): xstate135.ActorRefFromLogic<xstate135.GetConcreteByKey<xstate135.Values<{
111
+ } & { [K_1 in xstate140.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate140.IsNotNever<xstate140.RequiredActorOptions<T_1>>> : never : never : never)): xstate140.ActorRefFromLogic<xstate140.GetConcreteByKey<xstate140.Values<{
112
112
  initCamera: {
113
113
  src: "initCamera";
114
- logic: xstate135.PromiseActorLogic<MediaStream, void, xstate135.EventObject>;
114
+ logic: xstate140.PromiseActorLogic<MediaStream, void, xstate140.EventObject>;
115
115
  id: string | undefined;
116
116
  };
117
117
  uploadDocument: {
118
118
  src: "uploadDocument";
119
- logic: xstate135.PromiseActorLogic<void, {
119
+ logic: xstate140.PromiseActorLogic<void, {
120
120
  imageBase64: string;
121
121
  documentType: string;
122
122
  onProgress: (progress: number) => void;
123
- }, xstate135.EventObject>;
123
+ }, xstate140.EventObject>;
124
124
  id: string | undefined;
125
125
  };
126
126
  }>, "src", TSrc>["logic"]>;
127
- <TLogic extends xstate135.AnyActorLogic>(src: TLogic, ...[options]: xstate135.ConditionalRequired<[options?: ({
127
+ <TLogic extends xstate140.AnyActorLogic>(src: TLogic, ...[options]: xstate140.ConditionalRequired<[options?: ({
128
128
  id?: never;
129
129
  systemId?: string;
130
- input?: xstate135.InputFrom<TLogic> | undefined;
130
+ input?: xstate140.InputFrom<TLogic> | undefined;
131
131
  syncSnapshot?: boolean;
132
- } & { [K in xstate135.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate135.IsNotNever<xstate135.RequiredLogicInput<TLogic>>>): xstate135.ActorRefFromLogic<TLogic>;
132
+ } & { [K in xstate140.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate140.IsNotNever<xstate140.RequiredLogicInput<TLogic>>>): xstate140.ActorRefFromLogic<TLogic>;
133
133
  };
134
134
  input: DocumentUploadInput;
135
- self: xstate135.ActorRef<xstate135.MachineSnapshot<DocumentUploadContext, {
135
+ self: xstate140.ActorRef<xstate140.MachineSnapshot<DocumentUploadContext, {
136
136
  type: "START";
137
137
  } | {
138
138
  type: "CAPTURE";
@@ -144,7 +144,7 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
144
144
  type: "RETRY";
145
145
  } | {
146
146
  type: "CLOSE";
147
- }, Record<string, xstate135.AnyActorRef | undefined>, xstate135.StateValue, string, unknown, any, any>, {
147
+ }, Record<string, xstate140.AnyActorRef | undefined>, xstate140.StateValue, string, unknown, any, any>, {
148
148
  type: "START";
149
149
  } | {
150
150
  type: "CAPTURE";
@@ -156,7 +156,7 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
156
156
  type: "RETRY";
157
157
  } | {
158
158
  type: "CLOSE";
159
- }, xstate135.AnyEventObject>;
159
+ }, xstate140.AnyEventObject>;
160
160
  }) => {
161
161
  config: DocumentUploadConfig;
162
162
  stream: undefined;
@@ -226,7 +226,7 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
226
226
  } | {
227
227
  type: "CLOSE";
228
228
  };
229
- self: xstate135.ActorRef<xstate135.MachineSnapshot<DocumentUploadContext, {
229
+ self: xstate140.ActorRef<xstate140.MachineSnapshot<DocumentUploadContext, {
230
230
  type: "START";
231
231
  } | {
232
232
  type: "CAPTURE";
@@ -238,7 +238,7 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
238
238
  type: "RETRY";
239
239
  } | {
240
240
  type: "CLOSE";
241
- }, Record<string, xstate135.AnyActorRef>, xstate135.StateValue, string, unknown, any, any>, {
241
+ }, Record<string, xstate140.AnyActorRef>, xstate140.StateValue, string, unknown, any, any>, {
242
242
  type: "START";
243
243
  } | {
244
244
  type: "CAPTURE";
@@ -250,7 +250,7 @@ declare const documentUploadMachine: xstate135.StateMachine<DocumentUploadContex
250
250
  type: "RETRY";
251
251
  } | {
252
252
  type: "CLOSE";
253
- }, xstate135.AnyEventObject>;
253
+ }, xstate140.AnyEventObject>;
254
254
  }) => {
255
255
  imageBase64: string;
256
256
  documentType: string;
package/dist/email.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./Actor-phIcsUhv.js";
2
2
  import "./Manager-BndLda4_.js";
3
- import { a as emailMachine, n as EmailState, o as EmailConfig, r as createEmailManager, t as EmailManager } from "./emailManager-B-CZIR0O.js";
3
+ import { a as emailMachine, n as EmailState, o as EmailConfig, r as createEmailManager, t as EmailManager } from "./emailManager-BIq6pJa8.js";
4
4
  export { type EmailConfig, type EmailManager, type EmailState, createEmailManager, emailMachine };
package/dist/email.esm.js CHANGED
@@ -2,6 +2,6 @@ import "./api-3fZO5bmj.esm.js";
2
2
  import "./Manager-D_DMzMWz.esm.js";
3
3
  import "./endpoints-CCuj1KZH.esm.js";
4
4
  import "./BrowserTimerProvider-CRhCvln7.esm.js";
5
- import { r as emailMachine, t as createEmailManager } from "./emailManager-DJp8zUDV.esm.js";
5
+ import { r as emailMachine, t as createEmailManager } from "./emailManager-C5GCSw78.esm.js";
6
6
 
7
7
  export { createEmailManager, emailMachine };
@@ -105,9 +105,15 @@ type EmailAwaitingOtpState = {
105
105
  canResend: boolean;
106
106
  attemptsRemaining: number;
107
107
  };
108
- /** OTP code is being verified against the backend */
108
+ /**
109
+ * OTP code is being verified against the backend
110
+ * @property resendTimer - Seconds remaining on resend cooldown (unchanged while verifying)
111
+ * @property canResend - Whether resend is allowed (cooldown finished)
112
+ */
109
113
  type EmailVerifyingOtpState = {
110
114
  status: 'verifyingOtp';
115
+ resendTimer: number;
116
+ canResend: boolean;
111
117
  };
112
118
  /**
113
119
  * OTP verification failed - user can retry with `submitOtp()`
@@ -214,7 +220,7 @@ declare function createEmailManager(options: CreateEmailActorOptions): Manager<E
214
220
  /**
215
221
  * Submits the email address for verification.
216
222
  * Requires a valid email address to be set via `setEmail()`.
217
- * Transitions to 'submitting', then to 'sendingOtp' or 'success' (if no OTP).
223
+ * Transitions to 'submitting', then to 'sendingInitialOtp' or 'success' (if no OTP).
218
224
  */
219
225
  submit(): void;
220
226
  /**
@@ -282,7 +288,7 @@ declare function createEmailManagerFromActor(actor: EmailActor): Manager<EmailSt
282
288
  /**
283
289
  * Submits the email address for verification.
284
290
  * Requires a valid email address to be set via `setEmail()`.
285
- * Transitions to 'submitting', then to 'sendingOtp' or 'success' (if no OTP).
291
+ * Transitions to 'submitting', then to 'sendingInitialOtp' or 'success' (if no OTP).
286
292
  */
287
293
  submit(): void;
288
294
  /**
@@ -46,13 +46,14 @@ const emailMachine = setup({
46
46
  verifyOtp: fromPromise(async ({ input, signal }) => {
47
47
  return verifyEmailOtp(input.code, signal);
48
48
  }),
49
- resendTimer: fromCallback(({ sendBack }) => {
49
+ resendTimer: fromCallback(({ input, sendBack }) => {
50
50
  const timer = BrowserTimerProvider.getInstance();
51
- let seconds = RESEND_TIMER_SECONDS;
51
+ let remaining = input.seconds;
52
+ if (remaining <= 0) return () => {};
52
53
  const interval = timer.setInterval(() => {
53
- seconds -= 1;
54
54
  sendBack({ type: "TICK" });
55
- if (seconds <= 0) timer.clearInterval(interval);
55
+ remaining -= 1;
56
+ if (remaining <= 0) timer.clearInterval(interval);
56
57
  }, 1e3);
57
58
  return () => timer.clearInterval(interval);
58
59
  })
@@ -100,7 +101,6 @@ const emailMachine = setup({
100
101
  resendTimerActive: newTimer > 0
101
102
  };
102
103
  }),
103
- stopResendTimer: assign({ resendTimerActive: () => false }),
104
104
  resetContext: assign(({ context }) => ({
105
105
  config: context.config,
106
106
  email: "",
@@ -113,11 +113,7 @@ const emailMachine = setup({
113
113
  attemptsRemaining: context.config.maxOtpAttempts ?? 3,
114
114
  resendTimer: 0,
115
115
  resendTimerActive: false
116
- })),
117
- clearResendTimer: assign({
118
- resendTimer: () => 0,
119
- resendTimerActive: () => false
120
- })
116
+ }))
121
117
  },
122
118
  guards: {
123
119
  hasPrefill: ({ context }) => context.config.prefill,
@@ -171,7 +167,7 @@ const emailMachine = setup({
171
167
  src: "submitEmail",
172
168
  input: ({ context }) => ({ email: context.email }),
173
169
  onDone: [{
174
- target: "sendingOtp",
170
+ target: "sendingInitialOtp",
175
171
  guard: "hasOtpVerification"
176
172
  }, { target: "finished" }],
177
173
  onError: {
@@ -179,27 +175,42 @@ const emailMachine = setup({
179
175
  actions: "setEmailError"
180
176
  }
181
177
  } },
182
- sendingOtp: { invoke: {
178
+ sendingInitialOtp: { invoke: {
183
179
  id: "sendOtp",
184
180
  src: "sendOtp",
185
- onDone: { target: "awaitingOtp" },
181
+ onDone: {
182
+ target: "awaitingOtp",
183
+ actions: "startResendTimer"
184
+ },
186
185
  onError: {
187
186
  target: "awaitingOtp",
188
- actions: "setError"
187
+ actions: ["setError", "startResendTimer"]
188
+ }
189
+ } },
190
+ resendingOtp: { invoke: {
191
+ id: "sendOtp",
192
+ src: "sendOtp",
193
+ onDone: {
194
+ target: "awaitingOtp",
195
+ actions: "startResendTimer"
196
+ },
197
+ onError: {
198
+ target: "awaitingOtp",
199
+ actions: ["setError", "startResendTimer"]
189
200
  }
190
201
  } },
191
202
  awaitingOtp: {
192
- entry: "startResendTimer",
193
203
  invoke: {
194
204
  id: "resendTimer",
195
- src: "resendTimer"
205
+ src: "resendTimer",
206
+ input: ({ context }) => ({ seconds: context.resendTimer })
196
207
  },
197
208
  on: {
198
209
  TICK: { actions: "tickResendTimer" },
199
210
  OTP_CHANGED: { actions: "setOtpCode" },
200
211
  VERIFY_OTP: { target: "verifyingOtp" },
201
212
  RESEND_OTP: {
202
- target: "sendingOtp",
213
+ target: "resendingOtp",
203
214
  guard: "canResend"
204
215
  },
205
216
  BACK: { target: "inputting" }
@@ -237,14 +248,19 @@ const emailMachine = setup({
237
248
  }]
238
249
  } },
239
250
  otpError: {
240
- entry: "clearResendTimer",
251
+ invoke: {
252
+ id: "resendTimer",
253
+ src: "resendTimer",
254
+ input: ({ context }) => ({ seconds: context.resendTimer })
255
+ },
241
256
  on: {
257
+ TICK: { actions: "tickResendTimer" },
242
258
  OTP_CHANGED: {
243
259
  target: "awaitingOtp",
244
260
  actions: "setOtpCode"
245
261
  },
246
262
  RESEND_OTP: {
247
- target: "sendingOtp",
263
+ target: "resendingOtp",
248
264
  guard: "canResend"
249
265
  },
250
266
  BACK: { target: "inputting" }
@@ -373,7 +389,11 @@ function mapState(snapshot) {
373
389
  canResend: !context.resendTimerActive,
374
390
  attemptsRemaining: context.attemptsRemaining
375
391
  };
376
- if (typedSnapshot.matches("verifyingOtp")) return { status: "verifyingOtp" };
392
+ if (typedSnapshot.matches("verifyingOtp")) return {
393
+ status: "verifyingOtp",
394
+ resendTimer: context.resendTimer,
395
+ canResend: !context.resendTimerActive
396
+ };
377
397
  if (typedSnapshot.matches("otpError")) return {
378
398
  status: "otpError",
379
399
  otpError: context.otpError ?? "Invalid OTP code",
@@ -9,8 +9,8 @@ import "./Manager-BndLda4_.js";
9
9
  import { c as FaceCaptureEvent, f as SendFaceImageResponse, l as FaceCaptureInput, n as FaceCaptureManagerState, p as BaseWasmProvider, s as FaceCaptureContext, t as FaceCaptureManager, u as faceCaptureMachine } from "./faceCaptureManagerFactory-CN5-GRxP.js";
10
10
  import { a as ProcessFaceResponse, i as createSelfieManagerFromActor, n as SelfieState, t as SelfieManager } from "./selfieManager-BnfnTPcx.js";
11
11
  import { i as createAuthenticationManagerFromActor, n as AuthenticationState, t as AuthenticationManager } from "./authenticationManager-B5Yv9bDw.js";
12
- import { i as createEmailManagerFromActor, n as EmailState, t as EmailManager } from "./emailManager-B-CZIR0O.js";
13
- import { i as createPhoneManagerFromActor, n as PhoneState, t as PhoneManager } from "./phoneManager-DsMwQU5C.js";
12
+ import { i as createEmailManagerFromActor, n as EmailState, t as EmailManager } from "./emailManager-BIq6pJa8.js";
13
+ import { i as createPhoneManagerFromActor, n as PhoneState, t as PhoneManager } from "./phoneManager-Ba66ysK2.js";
14
14
 
15
15
  //#region src/modules/authentication/authenticationUploadService.d.ts
16
16
  type AuthenticationUploadResponse = {
@@ -15,9 +15,9 @@ import "./backCameraStream-BJwEXNl4.esm.js";
15
15
  import { t as WasmUtilProvider } from "./WasmUtilProvider-DctESPCy.esm.js";
16
16
  import { t as faceCaptureMachine } from "./faceCaptureSetup-DYRykM5Y.esm.js";
17
17
  import { n as createAuthenticationManagerFromActor } from "./authenticationManager-C9iQ1d2a.esm.js";
18
- import { n as createEmailManagerFromActor } from "./emailManager-DJp8zUDV.esm.js";
18
+ import { n as createEmailManagerFromActor } from "./emailManager-C5GCSw78.esm.js";
19
19
  import { n as createSelfieManagerFromActor } from "./selfieManager-DYW1C2GP.esm.js";
20
- import { n as createPhoneManagerFromActor } from "./phoneManager-2JbMadIR.esm.js";
20
+ import { n as createPhoneManagerFromActor } from "./phoneManager-CQJim-Ky.esm.js";
21
21
 
22
22
  //#region src/internal/fingerprint/fingerprintApi.ts
23
23
  async function getFingerprint(disableIpify) {