@incodetech/core 2.0.0-alpha.1 → 2.0.0-alpha.3

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 (104) hide show
  1. package/dist/Manager-6BwbaI_H.d.ts +19 -0
  2. package/dist/StateMachine-7c1gcu94.d.ts +2 -0
  3. package/dist/addEvent-1Mi5CEiq.esm.js +16 -0
  4. package/dist/chunk-C_Yo44FK.esm.js +49 -0
  5. package/dist/email.d.ts +264 -0
  6. package/dist/email.esm.js +479 -0
  7. package/dist/endpoints-D_pUMaqA.esm.js +1701 -0
  8. package/dist/flow.d.ts +578 -0
  9. package/dist/flow.esm.js +628 -0
  10. package/dist/index.d.ts +226 -0
  11. package/dist/index.esm.js +155 -0
  12. package/dist/lib-CyIAFRfr.esm.js +12499 -0
  13. package/dist/permissionServices-CVR0Pq38.esm.js +72 -0
  14. package/dist/phone.d.ts +292 -0
  15. package/dist/phone.esm.js +550 -0
  16. package/dist/selfie.d.ts +758 -0
  17. package/dist/selfie.esm.js +978 -0
  18. package/dist/types-tq1ypYSL.d.ts +5 -0
  19. package/dist/warmup-Dr7OcFND.d.ts +55 -0
  20. package/dist/xstate.esm-B_rda9yU.esm.js +3261 -0
  21. package/package.json +14 -11
  22. package/src/camera/cameraActor.ts +0 -21
  23. package/src/camera/cameraService.test.ts +0 -437
  24. package/src/camera/cameraService.ts +0 -165
  25. package/src/camera/cameraServices.test.ts +0 -66
  26. package/src/camera/cameraServices.ts +0 -26
  27. package/src/camera/cameraStateMachine.test.ts +0 -602
  28. package/src/camera/cameraStateMachine.ts +0 -264
  29. package/src/camera/index.ts +0 -5
  30. package/src/camera/types.ts +0 -17
  31. package/src/device/getBrowser.ts +0 -31
  32. package/src/device/getDeviceClass.ts +0 -29
  33. package/src/device/index.ts +0 -2
  34. package/src/email/__mocks__/emailMocks.ts +0 -59
  35. package/src/email/emailActor.ts +0 -15
  36. package/src/email/emailManager.test.ts +0 -573
  37. package/src/email/emailManager.ts +0 -427
  38. package/src/email/emailServices.ts +0 -66
  39. package/src/email/emailStateMachine.test.ts +0 -741
  40. package/src/email/emailStateMachine.ts +0 -367
  41. package/src/email/index.ts +0 -39
  42. package/src/email/types.ts +0 -60
  43. package/src/events/addEvent.ts +0 -20
  44. package/src/events/types.ts +0 -7
  45. package/src/flow/__mocks__/flowMocks.ts +0 -84
  46. package/src/flow/flowActor.ts +0 -13
  47. package/src/flow/flowAnalyzer.test.ts +0 -266
  48. package/src/flow/flowAnalyzer.ts +0 -37
  49. package/src/flow/flowCompletionService.ts +0 -21
  50. package/src/flow/flowManager.test.ts +0 -560
  51. package/src/flow/flowManager.ts +0 -235
  52. package/src/flow/flowServices.test.ts +0 -109
  53. package/src/flow/flowServices.ts +0 -13
  54. package/src/flow/flowStateMachine.test.ts +0 -334
  55. package/src/flow/flowStateMachine.ts +0 -182
  56. package/src/flow/index.ts +0 -21
  57. package/src/flow/moduleLoader.test.ts +0 -136
  58. package/src/flow/moduleLoader.ts +0 -73
  59. package/src/flow/orchestratedFlowManager.test.ts +0 -240
  60. package/src/flow/orchestratedFlowManager.ts +0 -231
  61. package/src/flow/orchestratedFlowStateMachine.test.ts +0 -199
  62. package/src/flow/orchestratedFlowStateMachine.ts +0 -325
  63. package/src/flow/types.ts +0 -434
  64. package/src/http/__mocks__/api.ts +0 -88
  65. package/src/http/api.test.ts +0 -231
  66. package/src/http/api.ts +0 -90
  67. package/src/http/endpoints.ts +0 -17
  68. package/src/index.ts +0 -33
  69. package/src/permissions/index.ts +0 -2
  70. package/src/permissions/permissionServices.ts +0 -31
  71. package/src/permissions/types.ts +0 -3
  72. package/src/phone/__mocks__/phoneMocks.ts +0 -71
  73. package/src/phone/index.ts +0 -39
  74. package/src/phone/phoneActor.ts +0 -15
  75. package/src/phone/phoneManager.test.ts +0 -393
  76. package/src/phone/phoneManager.ts +0 -458
  77. package/src/phone/phoneServices.ts +0 -98
  78. package/src/phone/phoneStateMachine.test.ts +0 -918
  79. package/src/phone/phoneStateMachine.ts +0 -422
  80. package/src/phone/types.ts +0 -83
  81. package/src/recordings/recordingsRepository.test.ts +0 -87
  82. package/src/recordings/recordingsRepository.ts +0 -48
  83. package/src/recordings/streamingEvents.ts +0 -10
  84. package/src/selfie/__mocks__/selfieMocks.ts +0 -26
  85. package/src/selfie/index.ts +0 -14
  86. package/src/selfie/selfieActor.ts +0 -17
  87. package/src/selfie/selfieErrorUtils.test.ts +0 -116
  88. package/src/selfie/selfieErrorUtils.ts +0 -66
  89. package/src/selfie/selfieManager.test.ts +0 -297
  90. package/src/selfie/selfieManager.ts +0 -301
  91. package/src/selfie/selfieServices.ts +0 -362
  92. package/src/selfie/selfieStateMachine.test.ts +0 -283
  93. package/src/selfie/selfieStateMachine.ts +0 -804
  94. package/src/selfie/selfieUploadService.test.ts +0 -90
  95. package/src/selfie/selfieUploadService.ts +0 -81
  96. package/src/selfie/types.ts +0 -103
  97. package/src/session/index.ts +0 -5
  98. package/src/session/sessionService.ts +0 -78
  99. package/src/setup.test.ts +0 -61
  100. package/src/setup.ts +0 -171
  101. package/tsconfig.json +0 -13
  102. package/tsdown.config.ts +0 -22
  103. package/vitest.config.ts +0 -37
  104. package/vitest.setup.ts +0 -135
@@ -1,422 +0,0 @@
1
- import { assign, fromCallback, fromPromise, setup } from '@incodetech/infra';
2
- import { addEvent } from '../events/addEvent';
3
- import {
4
- addPhone,
5
- addPhoneInstantVerify,
6
- fetchPhone,
7
- fetchStartInfo,
8
- sendOtp,
9
- verifyOtp,
10
- } from './phoneServices';
11
- import type { PhoneConfig, StartInfo } from './types';
12
-
13
- export type PhoneContext = {
14
- config: PhoneConfig;
15
- phone: string;
16
- isValid: boolean;
17
- phoneError: string | undefined;
18
- countryCode: string;
19
- phonePrefix: string;
20
- prefilledPhone: string | undefined;
21
- optInGranted: boolean;
22
- startInfo: StartInfo | undefined;
23
- error: string | undefined;
24
- otpCode: string;
25
- otpError: string | undefined;
26
- attemptsRemaining: number;
27
- resendTimer: number;
28
- resendTimerActive: boolean;
29
- };
30
-
31
- export type PhoneEvent =
32
- | { type: 'LOAD' }
33
- | { type: 'PHONE_CHANGED'; phone: string; isValid: boolean }
34
- | { type: 'OPT_IN_CHANGED'; granted: boolean }
35
- | { type: 'SUBMIT' }
36
- | { type: 'OTP_CHANGED'; code: string }
37
- | { type: 'VERIFY_OTP' }
38
- | { type: 'RESEND_OTP' }
39
- | { type: 'BACK' }
40
- | { type: 'RESET' };
41
-
42
- export type PhoneInput = {
43
- config: PhoneConfig;
44
- };
45
-
46
- const RESEND_TIMER_SECONDS = 30;
47
-
48
- export const phoneMachine = setup({
49
- types: {
50
- context: {} as PhoneContext,
51
- events: {} as PhoneEvent,
52
- input: {} as PhoneInput,
53
- },
54
- actors: {
55
- fetchPhone: fromPromise<{ phone: string }, void>(async ({ signal }) => {
56
- return fetchPhone(signal);
57
- }),
58
- fetchStartInfo: fromPromise<StartInfo, void>(async ({ signal }) => {
59
- return fetchStartInfo(signal);
60
- }),
61
- submitPhone: fromPromise<
62
- { success: boolean },
63
- { phone: string; optInGranted?: boolean; isInstantVerify: boolean }
64
- >(async ({ input, signal }) => {
65
- if (input.isInstantVerify) {
66
- return addPhoneInstantVerify(
67
- { phone: input.phone, optInGranted: input.optInGranted },
68
- signal,
69
- );
70
- }
71
- return addPhone(
72
- { phone: input.phone, optInGranted: input.optInGranted },
73
- signal,
74
- );
75
- }),
76
- sendOtp: fromPromise<void, void>(async ({ signal }) => {
77
- return sendOtp(signal);
78
- }),
79
- verifyOtp: fromPromise<{ success: boolean }, { code: string }>(
80
- async ({ input, signal }) => {
81
- return verifyOtp(input.code, signal);
82
- },
83
- ),
84
- resendTimer: fromCallback(({ sendBack }) => {
85
- let seconds = RESEND_TIMER_SECONDS;
86
- const interval = setInterval(() => {
87
- seconds -= 1;
88
- sendBack({ type: 'TICK' });
89
- if (seconds <= 0) {
90
- clearInterval(interval);
91
- }
92
- }, 1000);
93
- return () => clearInterval(interval);
94
- }),
95
- },
96
- actions: {
97
- setStartInfo: assign(({ event }) => {
98
- const info = (event as unknown as { output: StartInfo }).output;
99
- return {
100
- startInfo: info,
101
- countryCode: info.ipIsoCode,
102
- phonePrefix: info.phonePrefix,
103
- };
104
- }),
105
- setPrefilledPhone: assign(({ event }) => {
106
- const phone = (event as unknown as { output: { phone: string } }).output
107
- .phone;
108
- return {
109
- prefilledPhone: phone,
110
- phone,
111
- };
112
- }),
113
- setPhone: assign(({ event }) => {
114
- const e = event as {
115
- type: 'PHONE_CHANGED';
116
- phone: string;
117
- isValid: boolean;
118
- };
119
- return {
120
- phone: e.phone,
121
- isValid: e.isValid,
122
- phoneError: e.isValid ? undefined : 'Invalid phone number',
123
- };
124
- }),
125
- setPhoneError: assign(({ event }) => ({
126
- phoneError: String((event as unknown as { error: unknown }).error),
127
- })),
128
- setOptInGranted: assign(({ event }) => ({
129
- optInGranted: (event as { type: 'OPT_IN_CHANGED'; granted: boolean })
130
- .granted,
131
- })),
132
- setError: assign(({ event }) => ({
133
- error: String((event as unknown as { error: unknown }).error),
134
- })),
135
- clearError: assign({
136
- error: () => undefined,
137
- }),
138
- clearPhoneError: assign({
139
- phoneError: () => undefined,
140
- }),
141
- setOtpCode: assign(({ event }) => ({
142
- otpCode: (event as { type: 'OTP_CHANGED'; code: string }).code,
143
- otpError: undefined,
144
- })),
145
- setOtpError: assign(({ context, event }) => ({
146
- otpError: String((event as unknown as { error: unknown }).error),
147
- attemptsRemaining: context.attemptsRemaining - 1,
148
- })),
149
- clearOtpError: assign({
150
- otpError: () => undefined,
151
- otpCode: () => '',
152
- }),
153
- startResendTimer: assign({
154
- resendTimer: () => RESEND_TIMER_SECONDS,
155
- resendTimerActive: () => true,
156
- }),
157
- tickResendTimer: assign(({ context }) => {
158
- const newTimer = Math.max(0, context.resendTimer - 1);
159
- return {
160
- resendTimer: newTimer,
161
- resendTimerActive: newTimer > 0,
162
- };
163
- }),
164
- stopResendTimer: assign({
165
- resendTimerActive: () => false,
166
- }),
167
- resetContext: assign(({ context }) => ({
168
- config: context.config,
169
- phone: '',
170
- isValid: false,
171
- phoneError: undefined,
172
- countryCode: '',
173
- phonePrefix: '',
174
- prefilledPhone: undefined,
175
- optInGranted: false,
176
- startInfo: undefined,
177
- error: undefined,
178
- otpCode: '',
179
- otpError: undefined,
180
- attemptsRemaining: context.config.maxOtpAttempts ?? 3,
181
- resendTimer: 0,
182
- resendTimerActive: false,
183
- })),
184
- sendPhoneSubmitEvent: () => {
185
- addEvent({
186
- code: 'continue',
187
- module: 'phone',
188
- screen: 'phoneInput',
189
- });
190
- },
191
- },
192
- guards: {
193
- hasPrefill: ({ context }): boolean => context.config.prefill,
194
- hasOtpVerification: ({ context }): boolean =>
195
- context.config.otpVerification,
196
- isValidPhone: ({ context }): boolean => context.isValid,
197
- hasAttemptsRemaining: ({ context }): boolean =>
198
- context.attemptsRemaining > 0,
199
- canResend: ({ context }): boolean => !context.resendTimerActive,
200
- },
201
- }).createMachine({
202
- id: 'phone',
203
- initial: 'idle',
204
- context: ({ input }) => ({
205
- config: input.config,
206
- phone: '',
207
- isValid: false,
208
- phoneError: undefined,
209
- countryCode: '',
210
- phonePrefix: '',
211
- prefilledPhone: undefined,
212
- optInGranted: false,
213
- startInfo: undefined,
214
- error: undefined,
215
- otpCode: '',
216
- otpError: undefined,
217
- attemptsRemaining: input.config.maxOtpAttempts ?? 3,
218
- resendTimer: 0,
219
- resendTimerActive: false,
220
- }),
221
- states: {
222
- idle: {
223
- on: {
224
- LOAD: [
225
- {
226
- target: 'loadingPrefill',
227
- guard: 'hasPrefill',
228
- },
229
- {
230
- target: 'loadingStartInfo',
231
- },
232
- ],
233
- },
234
- },
235
-
236
- loadingPrefill: {
237
- invoke: {
238
- id: 'fetchPhone',
239
- src: 'fetchPhone',
240
- onDone: {
241
- target: 'loadingStartInfo',
242
- actions: 'setPrefilledPhone',
243
- },
244
- onError: {
245
- target: 'loadingStartInfo',
246
- },
247
- },
248
- },
249
-
250
- loadingStartInfo: {
251
- invoke: {
252
- id: 'fetchStartInfo',
253
- src: 'fetchStartInfo',
254
- onDone: {
255
- target: 'inputting',
256
- actions: 'setStartInfo',
257
- },
258
- onError: {
259
- target: 'inputting',
260
- },
261
- },
262
- },
263
-
264
- inputting: {
265
- entry: 'clearPhoneError',
266
- on: {
267
- PHONE_CHANGED: {
268
- actions: 'setPhone',
269
- },
270
- OPT_IN_CHANGED: {
271
- actions: 'setOptInGranted',
272
- },
273
- SUBMIT: {
274
- target: 'submitting',
275
- guard: 'isValidPhone',
276
- },
277
- },
278
- },
279
-
280
- submitting: {
281
- invoke: {
282
- id: 'submitPhone',
283
- src: 'submitPhone',
284
- input: ({ context }) => ({
285
- phone: context.phone,
286
- optInGranted: context.config.optinEnabled
287
- ? context.optInGranted
288
- : undefined,
289
- isInstantVerify: context.config.isInstantVerify ?? false,
290
- }),
291
- onDone: [
292
- {
293
- target: 'sendingOtp',
294
- guard: 'hasOtpVerification',
295
- actions: 'sendPhoneSubmitEvent',
296
- },
297
- {
298
- target: 'success',
299
- actions: 'sendPhoneSubmitEvent',
300
- },
301
- ],
302
- onError: {
303
- target: 'inputting',
304
- actions: 'setPhoneError',
305
- },
306
- },
307
- },
308
-
309
- sendingOtp: {
310
- invoke: {
311
- id: 'sendOtp',
312
- src: 'sendOtp',
313
- onDone: {
314
- target: 'awaitingOtp',
315
- },
316
- onError: {
317
- target: 'awaitingOtp',
318
- actions: 'setError',
319
- },
320
- },
321
- },
322
-
323
- awaitingOtp: {
324
- entry: 'startResendTimer',
325
- invoke: {
326
- id: 'resendTimer',
327
- src: 'resendTimer',
328
- },
329
- on: {
330
- TICK: {
331
- actions: 'tickResendTimer',
332
- },
333
- OTP_CHANGED: {
334
- actions: 'setOtpCode',
335
- },
336
- VERIFY_OTP: {
337
- target: 'verifyingOtp',
338
- },
339
- RESEND_OTP: {
340
- target: 'sendingOtp',
341
- guard: 'canResend',
342
- },
343
- BACK: {
344
- target: 'inputting',
345
- },
346
- },
347
- },
348
-
349
- verifyingOtp: {
350
- invoke: {
351
- id: 'verifyOtp',
352
- src: 'verifyOtp',
353
- input: ({ context }) => ({
354
- code: context.otpCode,
355
- }),
356
- onDone: [
357
- {
358
- target: 'success',
359
- guard: ({ event }) => event.output.success === true,
360
- },
361
- {
362
- target: 'otpError',
363
- guard: 'hasAttemptsRemaining',
364
- actions: assign(({ context }) => ({
365
- otpError: 'Invalid OTP code',
366
- attemptsRemaining: context.attemptsRemaining - 1,
367
- })),
368
- },
369
- {
370
- target: 'error',
371
- actions: assign({
372
- error: () => 'Maximum OTP attempts exceeded',
373
- }),
374
- },
375
- ],
376
- onError: [
377
- {
378
- target: 'otpError',
379
- guard: 'hasAttemptsRemaining',
380
- actions: 'setOtpError',
381
- },
382
- {
383
- target: 'error',
384
- actions: 'setError',
385
- },
386
- ],
387
- },
388
- },
389
-
390
- otpError: {
391
- on: {
392
- OTP_CHANGED: {
393
- target: 'awaitingOtp',
394
- actions: 'setOtpCode',
395
- },
396
- RESEND_OTP: {
397
- target: 'sendingOtp',
398
- guard: 'canResend',
399
- },
400
- BACK: {
401
- target: 'inputting',
402
- },
403
- },
404
- },
405
-
406
- success: {
407
- type: 'final',
408
- },
409
-
410
- error: {
411
- on: {
412
- RESET: {
413
- target: 'idle',
414
- actions: 'resetContext',
415
- },
416
- },
417
- },
418
- },
419
- // biome-ignore lint/suspicious/noExplicitAny: XState type inference issue with guards in declaration files
420
- }) as any;
421
-
422
- export type PhoneMachine = typeof phoneMachine;
@@ -1,83 +0,0 @@
1
- /**
2
- * Configuration options for phone verification.
3
- *
4
- * @example Standard OTP verification
5
- * ```typescript
6
- * const config: PhoneConfig = {
7
- * otpVerification: true,
8
- * otpExpirationInMinutes: 5,
9
- * prefill: false,
10
- * };
11
- * ```
12
- *
13
- * @example With all options
14
- * ```typescript
15
- * const config: PhoneConfig = {
16
- * otpVerification: true,
17
- * otpExpirationInMinutes: 10,
18
- * prefill: true,
19
- * isInstantVerify: false,
20
- * optinEnabled: true,
21
- * maxOtpAttempts: 3,
22
- * };
23
- * ```
24
- */
25
- export type PhoneConfig = {
26
- /**
27
- * Whether to require OTP (SMS code) verification.
28
- * If false, phone is verified immediately after submission.
29
- */
30
- otpVerification: boolean;
31
-
32
- /**
33
- * How long the OTP code remains valid, in minutes.
34
- * After expiration, user must request a new code.
35
- */
36
- otpExpirationInMinutes: number;
37
-
38
- /**
39
- * Whether to pre-populate with user's previously stored phone number.
40
- * Useful for returning users.
41
- */
42
- prefill: boolean;
43
-
44
- /**
45
- * Use carrier-based instant verification instead of OTP.
46
- * Not available in all regions.
47
- * @default false
48
- */
49
- isInstantVerify?: boolean;
50
-
51
- /**
52
- * Show a marketing opt-in checkbox in the UI.
53
- * User's preference is sent with the phone submission.
54
- * @default false
55
- */
56
- optinEnabled?: boolean;
57
-
58
- /**
59
- * Maximum number of OTP verification attempts before lockout.
60
- * After exhausting attempts, user sees an error state.
61
- * @default 3
62
- */
63
- maxOtpAttempts?: number;
64
- };
65
-
66
- export type StartInfo = {
67
- phonePrefix: string;
68
- country: string;
69
- ipIsoCode: string;
70
- };
71
-
72
- export type AddPhoneResponse = {
73
- success: boolean;
74
- };
75
-
76
- export type VerifyOtpResponse = {
77
- success: boolean;
78
- };
79
-
80
- export type AddPhoneParams = {
81
- phone: string;
82
- optInGranted?: boolean;
83
- };
@@ -1,87 +0,0 @@
1
- import { describe, expect, it, vi } from 'vitest';
2
- import { endpoints } from '../http/endpoints';
3
- import {
4
- createRecordingSession,
5
- startRecording,
6
- stopRecording,
7
- } from './recordingsRepository';
8
-
9
- vi.mock('../http/api', () => ({
10
- api: {
11
- post: vi.fn(),
12
- },
13
- }));
14
-
15
- describe('recordingsRepository', () => {
16
- it('creates a recording session using the v2 endpoint', async () => {
17
- const { api } = await import('../http/api');
18
- vi.mocked(api.post).mockResolvedValueOnce({
19
- ok: true,
20
- status: 200,
21
- statusText: 'OK',
22
- url: 'x',
23
- headers: {},
24
- data: {
25
- token: 't',
26
- videoRecordingId: 'v',
27
- sessionId: 's',
28
- },
29
- });
30
-
31
- await expect(createRecordingSession('selfie')).resolves.toEqual({
32
- token: 't',
33
- videoRecordingId: 'v',
34
- sessionId: 's',
35
- });
36
-
37
- expect(api.post).toHaveBeenCalledWith(endpoints.recordingCreateSessionV2, {
38
- type: 'selfie',
39
- });
40
- });
41
-
42
- it('starts recording with v2 endpoint and composed output', async () => {
43
- const { api } = await import('../http/api');
44
- vi.mocked(api.post).mockResolvedValueOnce({
45
- ok: true,
46
- status: 200,
47
- statusText: 'OK',
48
- url: 'x',
49
- headers: {},
50
- data: { ok: true },
51
- });
52
-
53
- await startRecording({
54
- videoRecordingId: 'vid',
55
- type: 'selfie',
56
- resolution: '640x480',
57
- hasAudio: true,
58
- });
59
-
60
- expect(api.post).toHaveBeenCalledWith(endpoints.recordingStartV2, {
61
- videoRecordingId: 'vid',
62
- frameRate: 30,
63
- outputMode: 'COMPOSED',
64
- resolution: '640x480',
65
- type: 'selfie',
66
- hasAudio: true,
67
- });
68
- });
69
-
70
- it('stops recording with v2 endpoint', async () => {
71
- const { api } = await import('../http/api');
72
- vi.mocked(api.post).mockResolvedValueOnce({
73
- ok: true,
74
- status: 200,
75
- statusText: 'OK',
76
- url: 'x',
77
- headers: {},
78
- data: { ok: true },
79
- });
80
-
81
- await stopRecording('vid');
82
-
83
- expect(api.post).toHaveBeenCalledWith(endpoints.recordingStopV2, {
84
- videoRecordingId: 'vid',
85
- });
86
- });
87
- });
@@ -1,48 +0,0 @@
1
- import { api } from '../http/api';
2
- import { endpoints } from '../http/endpoints';
3
-
4
- export type CreateRecordingSessionResponse = {
5
- token: string;
6
- videoRecordingId: string;
7
- sessionId: string;
8
- };
9
-
10
- export async function createRecordingSession(
11
- type: string,
12
- ): Promise<CreateRecordingSessionResponse> {
13
- const response = await api.post<CreateRecordingSessionResponse>(
14
- endpoints.recordingCreateSessionV2,
15
- { type },
16
- );
17
- return response.data;
18
- }
19
-
20
- export type StartRecordingParams = {
21
- videoRecordingId: string;
22
- type?: string;
23
- resolution?: string;
24
- hasAudio?: boolean;
25
- };
26
-
27
- export async function startRecording(
28
- params: StartRecordingParams,
29
- ): Promise<unknown> {
30
- const response = await api.post(endpoints.recordingStartV2, {
31
- videoRecordingId: params.videoRecordingId,
32
- frameRate: 30,
33
- outputMode: 'COMPOSED',
34
- resolution: params.resolution,
35
- type: params.type,
36
- hasAudio: params.hasAudio ?? false,
37
- });
38
- return response.data;
39
- }
40
-
41
- export async function stopRecording(
42
- videoRecordingId: string,
43
- ): Promise<unknown> {
44
- const response = await api.post(endpoints.recordingStopV2, {
45
- videoRecordingId,
46
- });
47
- return response.data;
48
- }
@@ -1,10 +0,0 @@
1
- export const streamingEvents = {
2
- strSessionDidConnect: 'strSessionDidConnect',
3
- strSessionDidDisconnect: 'strSessionDidDisconnect',
4
- strSessionDidFailWithError: 'strSessionDidFailWithError',
5
- strStreamVideoCaptureStart: 'strStreamVideoCaptureStart',
6
- strStreamVideoCaptureStop: 'strStreamVideoCaptureStop',
7
- strStreamPublisherCreated: 'strStreamPublisherCreated',
8
- strStreamPublisherDestroyed: 'strStreamPublisherDestroyed',
9
- strStreamPublisherDidFailWithError: 'strStreamPublisherDidFailWithError',
10
- } as const;
@@ -1,26 +0,0 @@
1
- import type { SelfieConfig } from '../types';
2
-
3
- export const mockSelfieConfig: SelfieConfig = {
4
- showTutorial: false,
5
- showPreview: false,
6
- assistedOnboarding: false,
7
- enableFaceRecording: false,
8
- autoCaptureTimeout: 10_000,
9
- captureAttempts: 2,
10
- validateLenses: false,
11
- validateFaceMask: false,
12
- validateHeadCover: false,
13
- validateClosedEyes: false,
14
- validateBrightness: false,
15
- deepsightLiveness: 'SINGLE_FRAME',
16
- };
17
-
18
- export const mockSelfieConfigWithTutorial: SelfieConfig = {
19
- ...mockSelfieConfig,
20
- showTutorial: true,
21
- };
22
-
23
- export const mockSelfieConfigWithOneAttempt: SelfieConfig = {
24
- ...mockSelfieConfig,
25
- captureAttempts: 1,
26
- };
@@ -1,14 +0,0 @@
1
- export {
2
- createSelfieManager,
3
- type SelfieManager,
4
- type SelfieState,
5
- } from './selfieManager';
6
- export type { CameraStream } from './selfieServices';
7
- export { type SelfieMachine, selfieMachine } from './selfieStateMachine';
8
- export type {
9
- DetectionStatus,
10
- FaceErrorCode,
11
- PermissionResult,
12
- PermissionStatus,
13
- SelfieConfig,
14
- } from './types';
@@ -1,17 +0,0 @@
1
- import { type ActorRefFrom, createActor } from '@incodetech/infra';
2
- import { type SelfieMachine, selfieMachine } from './selfieStateMachine';
3
- import type { SelfieConfig } from './types';
4
-
5
- export type CreateSelfieActorOptions = {
6
- config: SelfieConfig;
7
- };
8
-
9
- export type SelfieActor = ActorRefFrom<SelfieMachine>;
10
-
11
- export function createSelfieActor(
12
- options: CreateSelfieActorOptions,
13
- ): SelfieActor {
14
- return createActor(selfieMachine, {
15
- input: { config: options.config },
16
- }).start();
17
- }