@incodetech/core 2.0.0-alpha.1 → 2.0.0-alpha.2
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.
- package/.turbo/turbo-build.log +33 -0
- package/.turbo/turbo-coverage.log +22 -0
- package/.turbo/turbo-format.log +6 -0
- package/.turbo/turbo-lint$colon$fix.log +77 -0
- package/.turbo/turbo-lint.log +95 -0
- package/.turbo/turbo-test.log +870 -0
- package/.turbo/turbo-typecheck.log +5 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +221 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/src/camera/cameraService.ts.html +580 -0
- package/coverage/src/camera/cameraServices.ts.html +163 -0
- package/coverage/src/camera/cameraStateMachine.ts.html +877 -0
- package/coverage/src/camera/index.html +146 -0
- package/coverage/src/email/emailActor.ts.html +130 -0
- package/coverage/src/email/emailManager.ts.html +1366 -0
- package/coverage/src/email/emailStateMachine.ts.html +1186 -0
- package/coverage/src/email/index.html +146 -0
- package/coverage/src/flow/flowActor.ts.html +124 -0
- package/coverage/src/flow/flowAnalyzer.ts.html +196 -0
- package/coverage/src/flow/flowManager.ts.html +790 -0
- package/coverage/src/flow/flowServices.ts.html +124 -0
- package/coverage/src/flow/flowStateMachine.ts.html +631 -0
- package/coverage/src/flow/index.html +221 -0
- package/coverage/src/flow/moduleLoader.ts.html +304 -0
- package/coverage/src/flow/orchestratedFlowManager.ts.html +778 -0
- package/coverage/src/flow/orchestratedFlowStateMachine.ts.html +1060 -0
- package/coverage/src/http/api.ts.html +355 -0
- package/coverage/src/http/endpoints.ts.html +136 -0
- package/coverage/src/http/index.html +131 -0
- package/coverage/src/index.html +116 -0
- package/coverage/src/phone/index.html +146 -0
- package/coverage/src/phone/phoneActor.ts.html +130 -0
- package/coverage/src/phone/phoneManager.ts.html +1459 -0
- package/coverage/src/phone/phoneStateMachine.ts.html +1351 -0
- package/coverage/src/recordings/index.html +116 -0
- package/coverage/src/recordings/recordingsRepository.ts.html +229 -0
- package/coverage/src/selfie/index.html +191 -0
- package/coverage/src/selfie/selfieActor.ts.html +136 -0
- package/coverage/src/selfie/selfieErrorUtils.ts.html +283 -0
- package/coverage/src/selfie/selfieManager.ts.html +988 -0
- package/coverage/src/selfie/selfieStateMachine.ts.html +2497 -0
- package/coverage/src/selfie/selfieUploadService.ts.html +328 -0
- package/coverage/src/selfie/types.ts.html +394 -0
- package/coverage/src/setup.ts.html +598 -0
- package/dist/Manager-6BwbaI_H.d.ts +19 -0
- package/dist/StateMachine-7c1gcu94.d.ts +2 -0
- package/dist/addEvent-1Mi5CEiq.esm.js +16 -0
- package/dist/chunk-C_Yo44FK.esm.js +49 -0
- package/dist/email.d.ts +264 -0
- package/dist/email.esm.js +479 -0
- package/dist/endpoints-D_pUMaqA.esm.js +1701 -0
- package/dist/flow.d.ts +578 -0
- package/dist/flow.esm.js +628 -0
- package/dist/index.d.ts +226 -0
- package/dist/index.esm.js +155 -0
- package/dist/lib-CyIAFRfr.esm.js +12499 -0
- package/dist/permissionServices-CVR0Pq38.esm.js +72 -0
- package/dist/phone.d.ts +292 -0
- package/dist/phone.esm.js +550 -0
- package/dist/selfie.d.ts +758 -0
- package/dist/selfie.esm.js +978 -0
- package/dist/types-tq1ypYSL.d.ts +5 -0
- package/dist/warmup-Dr7OcFND.d.ts +55 -0
- package/dist/xstate.esm-B_rda9yU.esm.js +3261 -0
- package/package.json +11 -11
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __export = (all, symbols) => {
|
|
15
|
+
let target = {};
|
|
16
|
+
for (var name in all) {
|
|
17
|
+
__defProp(target, name, {
|
|
18
|
+
get: all[name],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (symbols) {
|
|
23
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
30
|
+
key = keys[i];
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
32
|
+
__defProp(to, key, {
|
|
33
|
+
get: ((k) => from[k]).bind(null, key),
|
|
34
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return to;
|
|
40
|
+
};
|
|
41
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
42
|
+
value: mod,
|
|
43
|
+
enumerable: true
|
|
44
|
+
}) : target, mod));
|
|
45
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { __toDynamicImportESM as a, __toCommonJS as i, __esm as n, __export as r, __commonJS as t };
|
package/dist/email.d.ts
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { t as Manager } from "./Manager-6BwbaI_H.js";
|
|
2
|
+
|
|
3
|
+
//#region src/email/types.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for email verification.
|
|
7
|
+
*
|
|
8
|
+
* @example Standard OTP verification
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const config: EmailConfig = {
|
|
11
|
+
* otpVerification: true,
|
|
12
|
+
* otpExpirationInMinutes: 5,
|
|
13
|
+
* prefill: false,
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example With all options
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const config: EmailConfig = {
|
|
20
|
+
* otpVerification: true,
|
|
21
|
+
* otpExpirationInMinutes: 10,
|
|
22
|
+
* prefill: true,
|
|
23
|
+
* maxOtpAttempts: 3,
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
type EmailConfig = {
|
|
28
|
+
/**
|
|
29
|
+
* Whether to require OTP (email code) verification.
|
|
30
|
+
* If false, email is verified immediately after submission.
|
|
31
|
+
*/
|
|
32
|
+
otpVerification: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* How long the OTP code remains valid, in minutes.
|
|
35
|
+
* After expiration, user must request a new code.
|
|
36
|
+
*/
|
|
37
|
+
otpExpirationInMinutes: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to pre-populate with user's previously stored email address.
|
|
40
|
+
* Useful for returning users.
|
|
41
|
+
*/
|
|
42
|
+
prefill: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum number of OTP verification attempts before lockout.
|
|
45
|
+
* After exhausting attempts, user sees an error state.
|
|
46
|
+
* @default 3
|
|
47
|
+
*/
|
|
48
|
+
maxOtpAttempts?: number;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/email/emailStateMachine.d.ts
|
|
52
|
+
|
|
53
|
+
declare const emailMachine: any;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/email/emailActor.d.ts
|
|
56
|
+
type CreateEmailActorOptions = {
|
|
57
|
+
config: EmailConfig;
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/email/emailManager.d.ts
|
|
61
|
+
/** Email manager is in initial state, waiting for `load()` to be called */
|
|
62
|
+
type EmailIdleState = {
|
|
63
|
+
status: 'idle';
|
|
64
|
+
};
|
|
65
|
+
/** Loading prefilled email address from backend (if prefill is enabled) */
|
|
66
|
+
type EmailLoadingPrefillState = {
|
|
67
|
+
status: 'loadingPrefill';
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Ready for email input - use `setEmail()` and `submit()`
|
|
71
|
+
* @property prefilledEmail - Pre-populated email address (if prefill enabled)
|
|
72
|
+
* @property emailError - Validation error message if email was rejected
|
|
73
|
+
*/
|
|
74
|
+
type EmailInputtingState = {
|
|
75
|
+
status: 'inputting';
|
|
76
|
+
prefilledEmail?: string;
|
|
77
|
+
emailError?: string;
|
|
78
|
+
};
|
|
79
|
+
/** Email address is being submitted to the backend */
|
|
80
|
+
type EmailSubmittingState = {
|
|
81
|
+
status: 'submitting';
|
|
82
|
+
};
|
|
83
|
+
/** OTP is being sent to the email address */
|
|
84
|
+
type EmailSendingOtpState = {
|
|
85
|
+
status: 'sendingOtp';
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Waiting for OTP code - use `submitOtp()`, `resendOtp()`, or `back()`
|
|
89
|
+
* @property resendTimer - Seconds remaining before resend is allowed
|
|
90
|
+
* @property canResend - Whether the resend button should be enabled
|
|
91
|
+
* @property attemptsRemaining - Number of OTP verification attempts left
|
|
92
|
+
*/
|
|
93
|
+
type EmailAwaitingOtpState = {
|
|
94
|
+
status: 'awaitingOtp';
|
|
95
|
+
resendTimer: number;
|
|
96
|
+
canResend: boolean;
|
|
97
|
+
attemptsRemaining: number;
|
|
98
|
+
};
|
|
99
|
+
/** OTP code is being verified against the backend */
|
|
100
|
+
type EmailVerifyingOtpState = {
|
|
101
|
+
status: 'verifyingOtp';
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* OTP verification failed - user can retry with `submitOtp()`
|
|
105
|
+
* @property error - Error message describing why verification failed
|
|
106
|
+
* @property attemptsRemaining - Number of remaining attempts before lockout
|
|
107
|
+
*/
|
|
108
|
+
type EmailOtpErrorState = {
|
|
109
|
+
status: 'otpError';
|
|
110
|
+
error: string;
|
|
111
|
+
attemptsRemaining: number;
|
|
112
|
+
};
|
|
113
|
+
/** Email verification completed successfully - call `reset()` to start over */
|
|
114
|
+
type EmailSuccessState = {
|
|
115
|
+
status: 'success';
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Fatal error occurred - call `reset()` to start over
|
|
119
|
+
* @property error - Error message describing what went wrong
|
|
120
|
+
*/
|
|
121
|
+
type EmailErrorState = {
|
|
122
|
+
status: 'error';
|
|
123
|
+
error: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Union of all possible email manager states.
|
|
127
|
+
* Use discriminated union pattern to narrow the type:
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const state = emailManager.getState();
|
|
132
|
+
* if (state.status === 'inputting') {
|
|
133
|
+
* // TypeScript knows state has prefilledEmail, emailError, etc.
|
|
134
|
+
* console.log(state.prefilledEmail);
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
type EmailState = EmailIdleState | EmailLoadingPrefillState | EmailInputtingState | EmailSubmittingState | EmailSendingOtpState | EmailAwaitingOtpState | EmailVerifyingOtpState | EmailOtpErrorState | EmailSuccessState | EmailErrorState;
|
|
139
|
+
/**
|
|
140
|
+
* Creates an email verification manager for headless or UI-driven usage.
|
|
141
|
+
*
|
|
142
|
+
* The manager provides a state machine-based API for email address verification
|
|
143
|
+
* with optional OTP (one-time password) verification.
|
|
144
|
+
*
|
|
145
|
+
* @param options - Configuration options
|
|
146
|
+
* @param options.config - Email verification configuration
|
|
147
|
+
* @param options.config.otpVerification - Whether to require OTP verification
|
|
148
|
+
* @param options.config.otpExpirationInMinutes - How long the OTP is valid
|
|
149
|
+
* @param options.config.prefill - Whether to fetch a pre-filled email address
|
|
150
|
+
* @param options.config.maxOtpAttempts - Maximum OTP verification attempts (default: 3)
|
|
151
|
+
*
|
|
152
|
+
* @returns Email manager with state, API methods, and subscription
|
|
153
|
+
*
|
|
154
|
+
* @example Headless usage
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const manager = createEmailManager({
|
|
157
|
+
* config: { otpVerification: true, otpExpirationInMinutes: 5, prefill: false },
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* manager.subscribe((state) => console.log(state.status));
|
|
161
|
+
* manager.load();
|
|
162
|
+
* manager.setEmail('user@example.com', true);
|
|
163
|
+
* manager.submit();
|
|
164
|
+
* // ... wait for 'awaitingOtp' state ...
|
|
165
|
+
* manager.submitOtp('ABC123');
|
|
166
|
+
* manager.stop();
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @example With React/Preact UI hook
|
|
170
|
+
* ```tsx
|
|
171
|
+
* const [state, manager] = useManager(() => createEmailManager({ config }));
|
|
172
|
+
*
|
|
173
|
+
* if (state.status === 'inputting') {
|
|
174
|
+
* return <input onChange={(e) => manager.setEmail(e.target.value, true)} />;
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare function createEmailManager(options: CreateEmailActorOptions): Manager<EmailState> & {
|
|
179
|
+
/**
|
|
180
|
+
* Initializes the email verification flow.
|
|
181
|
+
* Transitions from 'idle' to 'loadingPrefill' or 'inputting'.
|
|
182
|
+
* Must be called before any other method.
|
|
183
|
+
*/
|
|
184
|
+
load(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Sets the email address for verification.
|
|
187
|
+
* Should be called when state is 'inputting'.
|
|
188
|
+
*
|
|
189
|
+
* @param email - Email address (e.g., 'user@example.com')
|
|
190
|
+
* @param isValid - Whether the email address passes validation
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* // Using regex for validation
|
|
195
|
+
* const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
196
|
+
* const email = 'user@example.com';
|
|
197
|
+
* emailManager.setEmail(email, emailRegex.test(email));
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
setEmail(email: string, isValid: boolean): void;
|
|
201
|
+
/**
|
|
202
|
+
* Submits the email address for verification.
|
|
203
|
+
* Requires a valid email address to be set via `setEmail()`.
|
|
204
|
+
* Transitions to 'submitting', then to 'sendingOtp' or 'success' (if no OTP).
|
|
205
|
+
*/
|
|
206
|
+
submit(): void;
|
|
207
|
+
/**
|
|
208
|
+
* Sets the OTP code without submitting.
|
|
209
|
+
* Use this for controlled input components.
|
|
210
|
+
*
|
|
211
|
+
* @param code - The OTP code entered by the user
|
|
212
|
+
*/
|
|
213
|
+
setOtpCode(code: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* Sets and submits the OTP code in one call.
|
|
216
|
+
* Should be called when state is 'awaitingOtp' or 'otpError'.
|
|
217
|
+
*
|
|
218
|
+
* @param code - The complete OTP code (typically 6 alphanumeric characters)
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* // Submit OTP when user completes entry
|
|
223
|
+
* emailManager.submitOtp('HH36LP');
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
submitOtp(code: string): void;
|
|
227
|
+
/**
|
|
228
|
+
* Requests a new OTP code to be sent.
|
|
229
|
+
* Only works when state is 'awaitingOtp' and `canResend` is true.
|
|
230
|
+
* Resets the resend timer.
|
|
231
|
+
*/
|
|
232
|
+
resendOtp(): void;
|
|
233
|
+
/**
|
|
234
|
+
* Returns to the email input screen from OTP entry.
|
|
235
|
+
* Allows the user to change their email address.
|
|
236
|
+
* Transitions from 'awaitingOtp' or 'otpError' back to 'inputting'.
|
|
237
|
+
*/
|
|
238
|
+
back(): void;
|
|
239
|
+
/**
|
|
240
|
+
* Resets the manager to initial state.
|
|
241
|
+
* Can be called from 'success' or 'error' states to start over.
|
|
242
|
+
* Clears all stored data including email address and OTP.
|
|
243
|
+
*/
|
|
244
|
+
reset(): void;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Type representing an email manager instance.
|
|
248
|
+
* Includes state access, API methods, and lifecycle management.
|
|
249
|
+
*
|
|
250
|
+
* @property getState - Returns the current EmailState
|
|
251
|
+
* @property subscribe - Subscribes to state changes, returns unsubscribe function
|
|
252
|
+
* @property stop - Stops the manager and cleans up resources
|
|
253
|
+
* @property load - Initializes the verification flow
|
|
254
|
+
* @property setEmail - Sets the email address
|
|
255
|
+
* @property submit - Submits the email address
|
|
256
|
+
* @property setOtpCode - Sets OTP code without submitting
|
|
257
|
+
* @property submitOtp - Sets and submits OTP code
|
|
258
|
+
* @property resendOtp - Requests new OTP code
|
|
259
|
+
* @property back - Returns to email input from OTP screen
|
|
260
|
+
* @property reset - Resets to initial state
|
|
261
|
+
*/
|
|
262
|
+
type EmailManager = ReturnType<typeof createEmailManager>;
|
|
263
|
+
//#endregion
|
|
264
|
+
export { type EmailConfig, type EmailManager, type EmailState, createEmailManager, emailMachine };
|