signer-test-sdk-core 0.0.1

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 (63) hide show
  1. package/README.md +81 -0
  2. package/dist/src/components/OnboardingUI/auth.d.ts +158 -0
  3. package/dist/src/components/OnboardingUI/auth.js +230 -0
  4. package/dist/src/components/OnboardingUI/auth.js.map +1 -0
  5. package/dist/src/components/OnboardingUI/index.d.ts +9 -0
  6. package/dist/src/components/OnboardingUI/index.js +9 -0
  7. package/dist/src/components/OnboardingUI/index.js.map +1 -0
  8. package/dist/src/components/OnboardingUI/types.d.ts +159 -0
  9. package/dist/src/components/OnboardingUI/types.js +5 -0
  10. package/dist/src/components/OnboardingUI/types.js.map +1 -0
  11. package/dist/src/core/AbstraxnWallet.d.ts +162 -0
  12. package/dist/src/core/AbstraxnWallet.js +593 -0
  13. package/dist/src/core/AbstraxnWallet.js.map +1 -0
  14. package/dist/src/core/AuthManager.d.ts +112 -0
  15. package/dist/src/core/AuthManager.js +685 -0
  16. package/dist/src/core/AuthManager.js.map +1 -0
  17. package/dist/src/core/Signer.d.ts +35 -0
  18. package/dist/src/core/Signer.js +156 -0
  19. package/dist/src/core/Signer.js.map +1 -0
  20. package/dist/src/index.d.ts +17 -0
  21. package/dist/src/index.js +19 -0
  22. package/dist/src/index.js.map +1 -0
  23. package/dist/src/interfaces/IAuth.d.ts +26 -0
  24. package/dist/src/interfaces/IAuth.js +2 -0
  25. package/dist/src/interfaces/IAuth.js.map +1 -0
  26. package/dist/src/interfaces/ISigner.d.ts +14 -0
  27. package/dist/src/interfaces/ISigner.js +2 -0
  28. package/dist/src/interfaces/ISigner.js.map +1 -0
  29. package/dist/src/interfaces/IStorage.d.ts +15 -0
  30. package/dist/src/interfaces/IStorage.js +2 -0
  31. package/dist/src/interfaces/IStorage.js.map +1 -0
  32. package/dist/src/interfaces/IWallet.d.ts +45 -0
  33. package/dist/src/interfaces/IWallet.js +2 -0
  34. package/dist/src/interfaces/IWallet.js.map +1 -0
  35. package/dist/src/services/ApiService.d.ts +131 -0
  36. package/dist/src/services/ApiService.js +626 -0
  37. package/dist/src/services/ApiService.js.map +1 -0
  38. package/dist/src/services/TokenService.d.ts +29 -0
  39. package/dist/src/services/TokenService.js +40 -0
  40. package/dist/src/services/TokenService.js.map +1 -0
  41. package/dist/src/services/TurnkeyService.d.ts +54 -0
  42. package/dist/src/services/TurnkeyService.js +91 -0
  43. package/dist/src/services/TurnkeyService.js.map +1 -0
  44. package/dist/src/storage/IndexedDBStorage.d.ts +39 -0
  45. package/dist/src/storage/IndexedDBStorage.js +280 -0
  46. package/dist/src/storage/IndexedDBStorage.js.map +1 -0
  47. package/dist/src/utils/constants.d.ts +52 -0
  48. package/dist/src/utils/constants.js +78 -0
  49. package/dist/src/utils/constants.js.map +1 -0
  50. package/dist/src/utils/errors.d.ts +23 -0
  51. package/dist/src/utils/errors.js +48 -0
  52. package/dist/src/utils/errors.js.map +1 -0
  53. package/dist/src/utils/helpers.d.ts +12 -0
  54. package/dist/src/utils/helpers.js +30 -0
  55. package/dist/src/utils/helpers.js.map +1 -0
  56. package/dist/src/utils/passkey.d.ts +33 -0
  57. package/dist/src/utils/passkey.js +122 -0
  58. package/dist/src/utils/passkey.js.map +1 -0
  59. package/dist/src/utils/types.d.ts +182 -0
  60. package/dist/src/utils/types.js +5 -0
  61. package/dist/src/utils/types.js.map +1 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -0
  63. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @abstraxn/signer-core
2
+
3
+ **Core framework-agnostic SDK** for Abstraxn Wallet - email OTP, social authentication (Google, Discord, X), passkey, and wallet management.
4
+
5
+ This package contains the core wallet functionality that works with any framework or vanilla JavaScript.
6
+
7
+ ## 📦 Installation
8
+
9
+ ```bash
10
+ npm install @abstraxn/signer-core
11
+ ```
12
+
13
+ ## 🚀 Usage
14
+
15
+ ### Framework-Agnostic Core SDK
16
+
17
+ ```typescript
18
+ import { AbstraxnWallet } from '@abstraxn/signer-core';
19
+
20
+ const wallet = new AbstraxnWallet({
21
+ apiKey: 'your-api-key-here',
22
+ defaultChainId: 1,
23
+ autoConnect: true,
24
+ });
25
+
26
+ // Connect wallet
27
+ await wallet.connect();
28
+
29
+ // Get address
30
+ const address = wallet.getAddress();
31
+
32
+ // Sign message
33
+ const signature = await wallet.signMessage('Hello World');
34
+ ```
35
+
36
+ ### Vanilla JavaScript OnboardingUI
37
+
38
+ ```html
39
+ <!DOCTYPE html>
40
+ <html>
41
+ <head>
42
+ <link rel="stylesheet" href="node_modules/@abstraxn/signer-core/OnboardingUI.css">
43
+ </head>
44
+ <body>
45
+ <div id="onboarding-container"></div>
46
+
47
+ <script type="module">
48
+ import { OnboardingUI } from '@abstraxn/signer-core';
49
+
50
+ const onboarding = new OnboardingUI({
51
+ container: '#onboarding-container',
52
+ // ... configuration
53
+ });
54
+
55
+ onboarding.init();
56
+ </script>
57
+ </body>
58
+ </html>
59
+ ```
60
+
61
+ ## 📚 Exports
62
+
63
+ ### Core Classes
64
+ - `AbstraxnWallet` - Main wallet class
65
+ - `AuthManager` - Authentication manager
66
+ - `Signer` - Transaction signer
67
+ - `OnboardingUI` - Vanilla JS onboarding component
68
+
69
+ ### Types & Interfaces
70
+ - All TypeScript types and interfaces
71
+ - Error classes
72
+ - Constants
73
+
74
+ ## 🔗 Related Packages
75
+
76
+ - **@abstraxn/signer-react** - React components and hooks (uses this core package)
77
+ - **@abstraxn/signer** - Backward compatible wrapper (deprecated, use core + react instead)
78
+
79
+ ## 📝 License
80
+
81
+ MIT
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Authentication utility functions
3
+ * Direct functions for email-OTP and Google login
4
+ */
5
+ export interface EmailOtpConfig {
6
+ /**
7
+ * API endpoint for sending OTP
8
+ */
9
+ sendOtpEndpoint?: string;
10
+ /**
11
+ * API endpoint for verifying OTP
12
+ */
13
+ verifyOtpEndpoint?: string;
14
+ /**
15
+ * Custom function to send OTP
16
+ */
17
+ onSendOtp?: (email: string) => Promise<{
18
+ success: boolean;
19
+ message?: string;
20
+ }>;
21
+ /**
22
+ * Custom function to verify OTP
23
+ */
24
+ onVerifyOtp?: (email: string, otp: string) => Promise<{
25
+ success: boolean;
26
+ token?: string;
27
+ user?: any;
28
+ }>;
29
+ /**
30
+ * Request headers
31
+ */
32
+ headers?: Record<string, string>;
33
+ }
34
+ export interface GoogleLoginConfig {
35
+ /**
36
+ * Google OAuth endpoint
37
+ */
38
+ googleAuthEndpoint?: string;
39
+ /**
40
+ * Custom function to handle Google login
41
+ */
42
+ onGoogleLogin?: () => Promise<void>;
43
+ /**
44
+ * Redirect URL after successful login
45
+ */
46
+ redirectUrl?: string;
47
+ }
48
+ export interface AuthResponse {
49
+ success: boolean;
50
+ token?: string;
51
+ user?: any;
52
+ message?: string;
53
+ error?: string;
54
+ }
55
+ /**
56
+ * Send OTP to email address
57
+ *
58
+ * @param email - Email address to send OTP to
59
+ * @param config - Configuration options
60
+ * @returns Promise with success status
61
+ *
62
+ * @example
63
+ * ```javascript
64
+ * await initiateEmailOtp('user@example.com', {
65
+ * sendOtpEndpoint: '/api/auth/send-otp'
66
+ * });
67
+ * ```
68
+ */
69
+ export declare function initiateEmailOtp(email: string, config?: EmailOtpConfig): Promise<AuthResponse>;
70
+ /**
71
+ * Verify OTP and complete email login
72
+ *
73
+ * @param email - Email address
74
+ * @param otp - OTP code received via email
75
+ * @param config - Configuration options
76
+ * @returns Promise with authentication result including token
77
+ *
78
+ * @example
79
+ * ```javascript
80
+ * const result = await loginWithEmailOtp('user@example.com', '123456', {
81
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
82
+ * });
83
+ *
84
+ * if (result.success) {
85
+ * console.log('Token:', result.token);
86
+ * }
87
+ * ```
88
+ */
89
+ export declare function loginWithEmailOtp(email: string, otp: string, config?: EmailOtpConfig): Promise<AuthResponse>;
90
+ /**
91
+ * Complete email-OTP login flow (send OTP + verify in one call)
92
+ *
93
+ * @param email - Email address
94
+ * @param otp - OTP code (optional, if not provided, only sends OTP)
95
+ * @param config - Configuration options
96
+ * @returns Promise with authentication result
97
+ *
98
+ * @example
99
+ * ```javascript
100
+ * // Send OTP only
101
+ * await emailLogin('user@example.com', null, {
102
+ * sendOtpEndpoint: '/api/auth/send-otp'
103
+ * });
104
+ *
105
+ * // Verify OTP and login
106
+ * const result = await emailLogin('user@example.com', '123456', {
107
+ * sendOtpEndpoint: '/api/auth/send-otp',
108
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
109
+ * });
110
+ * ```
111
+ */
112
+ export declare function emailLogin(email: string, otp: string | null, config?: EmailOtpConfig): Promise<AuthResponse>;
113
+ /**
114
+ * Initiate Google OAuth login
115
+ *
116
+ * @param config - Configuration options
117
+ * @returns Promise that resolves when redirect starts
118
+ *
119
+ * @example
120
+ * ```javascript
121
+ * await loginWithGoogle({
122
+ * googleAuthEndpoint: '/api/auth/google'
123
+ * });
124
+ * ```
125
+ */
126
+ export declare function loginWithGoogle(config?: GoogleLoginConfig): Promise<void>;
127
+ /**
128
+ * Complete email-OTP authentication flow helper
129
+ * This function handles the full flow: send OTP, wait for user input, verify
130
+ *
131
+ * @param email - Email address
132
+ * @param config - Configuration options
133
+ * @returns Object with sendOtp function and verifyOtp function
134
+ *
135
+ * @example
136
+ * ```javascript
137
+ * const auth = createEmailAuth({
138
+ * sendOtpEndpoint: '/api/auth/send-otp',
139
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
140
+ * });
141
+ *
142
+ * // Send OTP
143
+ * await auth.sendOtp('user@example.com');
144
+ *
145
+ * // Later, verify OTP
146
+ * const result = await auth.verifyOtp('user@example.com', '123456');
147
+ * ```
148
+ */
149
+ export declare function createEmailAuth(config?: EmailOtpConfig): {
150
+ /**
151
+ * Send OTP to email
152
+ */
153
+ sendOtp: (email: string) => Promise<AuthResponse>;
154
+ /**
155
+ * Verify OTP and login
156
+ */
157
+ verifyOtp: (email: string, otp: string) => Promise<AuthResponse>;
158
+ };
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Authentication utility functions
3
+ * Direct functions for email-OTP and Google login
4
+ */
5
+ /**
6
+ * Send OTP to email address
7
+ *
8
+ * @param email - Email address to send OTP to
9
+ * @param config - Configuration options
10
+ * @returns Promise with success status
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * await initiateEmailOtp('user@example.com', {
15
+ * sendOtpEndpoint: '/api/auth/send-otp'
16
+ * });
17
+ * ```
18
+ */
19
+ export async function initiateEmailOtp(email, config) {
20
+ if (!email || !email.includes('@')) {
21
+ throw new Error('Valid email address is required');
22
+ }
23
+ try {
24
+ // Use custom function if provided
25
+ if (config?.onSendOtp) {
26
+ const result = await config.onSendOtp(email);
27
+ return {
28
+ success: result.success,
29
+ message: result.message,
30
+ };
31
+ }
32
+ // Use endpoint if provided
33
+ if (config?.sendOtpEndpoint) {
34
+ const response = await fetch(config.sendOtpEndpoint, {
35
+ method: 'POST',
36
+ headers: {
37
+ 'Content-Type': 'application/json',
38
+ ...config.headers,
39
+ },
40
+ body: JSON.stringify({ email }),
41
+ });
42
+ if (!response.ok) {
43
+ const errorData = await response.json().catch(() => ({}));
44
+ throw new Error(errorData.message || `HTTP error! status: ${response.status}`);
45
+ }
46
+ const data = await response.json();
47
+ return {
48
+ success: data.success !== false,
49
+ message: data.message || 'OTP sent successfully',
50
+ };
51
+ }
52
+ throw new Error('Either sendOtpEndpoint or onSendOtp must be provided');
53
+ }
54
+ catch (error) {
55
+ return {
56
+ success: false,
57
+ error: error instanceof Error ? error.message : 'Failed to send OTP',
58
+ };
59
+ }
60
+ }
61
+ /**
62
+ * Verify OTP and complete email login
63
+ *
64
+ * @param email - Email address
65
+ * @param otp - OTP code received via email
66
+ * @param config - Configuration options
67
+ * @returns Promise with authentication result including token
68
+ *
69
+ * @example
70
+ * ```javascript
71
+ * const result = await loginWithEmailOtp('user@example.com', '123456', {
72
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
73
+ * });
74
+ *
75
+ * if (result.success) {
76
+ * console.log('Token:', result.token);
77
+ * }
78
+ * ```
79
+ */
80
+ export async function loginWithEmailOtp(email, otp, config) {
81
+ if (!email || !email.includes('@')) {
82
+ throw new Error('Valid email address is required');
83
+ }
84
+ if (!otp || otp.length < 4) {
85
+ throw new Error('Valid OTP code is required');
86
+ }
87
+ try {
88
+ // Use custom function if provided
89
+ if (config?.onVerifyOtp) {
90
+ const result = await config.onVerifyOtp(email, otp);
91
+ return {
92
+ success: result.success,
93
+ token: result.token,
94
+ user: result.user,
95
+ };
96
+ }
97
+ // Use endpoint if provided
98
+ if (config?.verifyOtpEndpoint) {
99
+ const response = await fetch(config.verifyOtpEndpoint, {
100
+ method: 'POST',
101
+ headers: {
102
+ 'Content-Type': 'application/json',
103
+ ...config.headers,
104
+ },
105
+ body: JSON.stringify({ email, otp }),
106
+ });
107
+ if (!response.ok) {
108
+ const errorData = await response.json().catch(() => ({}));
109
+ throw new Error(errorData.message || `HTTP error! status: ${response.status}`);
110
+ }
111
+ const data = await response.json();
112
+ return {
113
+ success: data.success !== false,
114
+ token: data.token,
115
+ user: data.user,
116
+ message: data.message,
117
+ };
118
+ }
119
+ throw new Error('Either verifyOtpEndpoint or onVerifyOtp must be provided');
120
+ }
121
+ catch (error) {
122
+ return {
123
+ success: false,
124
+ error: error instanceof Error ? error.message : 'Failed to verify OTP',
125
+ };
126
+ }
127
+ }
128
+ /**
129
+ * Complete email-OTP login flow (send OTP + verify in one call)
130
+ *
131
+ * @param email - Email address
132
+ * @param otp - OTP code (optional, if not provided, only sends OTP)
133
+ * @param config - Configuration options
134
+ * @returns Promise with authentication result
135
+ *
136
+ * @example
137
+ * ```javascript
138
+ * // Send OTP only
139
+ * await emailLogin('user@example.com', null, {
140
+ * sendOtpEndpoint: '/api/auth/send-otp'
141
+ * });
142
+ *
143
+ * // Verify OTP and login
144
+ * const result = await emailLogin('user@example.com', '123456', {
145
+ * sendOtpEndpoint: '/api/auth/send-otp',
146
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
147
+ * });
148
+ * ```
149
+ */
150
+ export async function emailLogin(email, otp, config) {
151
+ if (!otp) {
152
+ // Just send OTP
153
+ return initiateEmailOtp(email, config);
154
+ }
155
+ else {
156
+ // Verify OTP and login
157
+ return loginWithEmailOtp(email, otp, config);
158
+ }
159
+ }
160
+ /**
161
+ * Initiate Google OAuth login
162
+ *
163
+ * @param config - Configuration options
164
+ * @returns Promise that resolves when redirect starts
165
+ *
166
+ * @example
167
+ * ```javascript
168
+ * await loginWithGoogle({
169
+ * googleAuthEndpoint: '/api/auth/google'
170
+ * });
171
+ * ```
172
+ */
173
+ export async function loginWithGoogle(config) {
174
+ try {
175
+ // Use custom function if provided
176
+ if (config?.onGoogleLogin) {
177
+ await config.onGoogleLogin();
178
+ return;
179
+ }
180
+ // Use endpoint if provided
181
+ if (config?.googleAuthEndpoint) {
182
+ const url = config.redirectUrl
183
+ ? `${config.googleAuthEndpoint}?redirect=${encodeURIComponent(config.redirectUrl)}`
184
+ : config.googleAuthEndpoint;
185
+ window.location.href = url;
186
+ return;
187
+ }
188
+ throw new Error('Either googleAuthEndpoint or onGoogleLogin must be provided');
189
+ }
190
+ catch (error) {
191
+ throw new Error(error instanceof Error
192
+ ? error.message
193
+ : 'Failed to initiate Google login');
194
+ }
195
+ }
196
+ /**
197
+ * Complete email-OTP authentication flow helper
198
+ * This function handles the full flow: send OTP, wait for user input, verify
199
+ *
200
+ * @param email - Email address
201
+ * @param config - Configuration options
202
+ * @returns Object with sendOtp function and verifyOtp function
203
+ *
204
+ * @example
205
+ * ```javascript
206
+ * const auth = createEmailAuth({
207
+ * sendOtpEndpoint: '/api/auth/send-otp',
208
+ * verifyOtpEndpoint: '/api/auth/verify-otp'
209
+ * });
210
+ *
211
+ * // Send OTP
212
+ * await auth.sendOtp('user@example.com');
213
+ *
214
+ * // Later, verify OTP
215
+ * const result = await auth.verifyOtp('user@example.com', '123456');
216
+ * ```
217
+ */
218
+ export function createEmailAuth(config) {
219
+ return {
220
+ /**
221
+ * Send OTP to email
222
+ */
223
+ sendOtp: (email) => initiateEmailOtp(email, config),
224
+ /**
225
+ * Verify OTP and login
226
+ */
227
+ verifyOtp: (email, otp) => loginWithEmailOtp(email, otp, config),
228
+ };
229
+ }
230
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/components/OnboardingUI/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsDH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAa,EACb,MAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC;QACH,kCAAkC;QAClC,IAAI,MAAM,EAAE,SAAS,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC7C,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;QAED,2BAA2B;QAC3B,IAAI,MAAM,EAAE,eAAe,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE;gBACnD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,GAAG,MAAM,CAAC,OAAO;iBAClB;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;aAChC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAA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AC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC;QAE3D;;WAEG;QACH,SAAS,EAAE,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC;KACjF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * OnboardingUI - Framework-agnostic exports
3
+ *
4
+ * Only exports authentication functions and types.
5
+ * UI components are in framework-specific packages.
6
+ */
7
+ export { initiateEmailOtp, loginWithEmailOtp, emailLogin, loginWithGoogle, createEmailAuth, } from './auth';
8
+ export type { EmailOtpConfig, GoogleLoginConfig, AuthResponse, } from './auth';
9
+ export type { OnboardingUIConfig, Theme } from './types';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * OnboardingUI - Framework-agnostic exports
3
+ *
4
+ * Only exports authentication functions and types.
5
+ * UI components are in framework-specific packages.
6
+ */
7
+ // Export authentication functions (framework-agnostic)
8
+ export { initiateEmailOtp, loginWithEmailOtp, emailLogin, loginWithGoogle, createEmailAuth, } from './auth';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/OnboardingUI/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uDAAuD;AACvD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,eAAe,GAChB,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Types for OnboardingUI component
3
+ */
4
+ export type Theme = 'light' | 'dark';
5
+ export interface OnboardingUIConfig {
6
+ /**
7
+ * Custom logo URL or HTML string
8
+ */
9
+ logo?: string;
10
+ /**
11
+ * Theme mode: 'light' or 'dark'
12
+ * @default 'light'
13
+ */
14
+ theme?: Theme;
15
+ /**
16
+ * Enable or disable footer
17
+ * @default true
18
+ */
19
+ showFooter?: boolean;
20
+ /**
21
+ * Onboarding title/heading
22
+ * @default 'Sign in'
23
+ */
24
+ onboardTitle?: string;
25
+ /**
26
+ * API endpoint for email OTP authentication
27
+ */
28
+ emailOtpEndpoint?: string;
29
+ /**
30
+ * API endpoint for Google authentication
31
+ */
32
+ googleAuthEndpoint?: string;
33
+ /**
34
+ * API endpoint for X (Twitter) authentication
35
+ */
36
+ twitterAuthEndpoint?: string;
37
+ /**
38
+ * API endpoint for Discord authentication
39
+ */
40
+ discordAuthEndpoint?: string;
41
+ /**
42
+ * Callback when email OTP login is initiated
43
+ */
44
+ onEmailOtpInitiate?: (email: string) => Promise<void>;
45
+ /**
46
+ * Callback when OTP is verified
47
+ */
48
+ onEmailOtpVerify?: (email: string, otp: string) => Promise<{
49
+ success: boolean;
50
+ token?: string;
51
+ }>;
52
+ /**
53
+ * Callback when Google login is initiated
54
+ */
55
+ onGoogleLogin?: () => Promise<void>;
56
+ /**
57
+ * Callback when login is successful
58
+ */
59
+ onLoginSuccess?: (data: {
60
+ token?: string;
61
+ user?: any;
62
+ }) => void;
63
+ /**
64
+ * Callback when login fails
65
+ */
66
+ onLoginError?: (error: Error) => void;
67
+ /**
68
+ * Custom CSS class name
69
+ */
70
+ className?: string;
71
+ /**
72
+ * Custom styles (as CSS string or object)
73
+ */
74
+ style?: string | Partial<CSSStyleDeclaration>;
75
+ /**
76
+ * Container element to mount the component
77
+ * If not provided, component will create its own container
78
+ */
79
+ container?: HTMLElement | string;
80
+ /**
81
+ * Show as modal overlay (like Alchemy)
82
+ * @default true
83
+ */
84
+ modal?: boolean;
85
+ /**
86
+ * Close modal when clicking outside
87
+ * @default true
88
+ */
89
+ closeOnBackdropClick?: boolean;
90
+ /**
91
+ * Show close button
92
+ * @default true
93
+ */
94
+ showCloseButton?: boolean;
95
+ /**
96
+ * Callback when modal is closed
97
+ */
98
+ onClose?: () => void;
99
+ /**
100
+ * Whether to handle URL parameters for social login callbacks
101
+ * @default true
102
+ */
103
+ handleUrlParams?: boolean;
104
+ /**
105
+ * Custom colors for theming
106
+ */
107
+ colors?: {
108
+ primary?: string;
109
+ primaryHover?: string;
110
+ background?: string;
111
+ text?: string;
112
+ border?: string;
113
+ error?: string;
114
+ success?: string;
115
+ };
116
+ /**
117
+ * Custom CSS overrides (injected as style tag)
118
+ */
119
+ customCSS?: string;
120
+ /**
121
+ * Authentication methods to show in UI
122
+ * If not provided, shows both email and Google options
123
+ * @default ['otp', 'google']
124
+ */
125
+ authMethods?: ('otp' | 'google' | 'passkey' | 'twitter' | 'discord')[];
126
+ /**
127
+ * Callback when passkey signup is initiated
128
+ */
129
+ onPasskeySignup?: () => Promise<void>;
130
+ /**
131
+ * Callback when passkey login is initiated
132
+ */
133
+ onPasskeyLogin?: () => Promise<void>;
134
+ /**
135
+ * Callback when Twitter login is initiated
136
+ */
137
+ onTwitterLogin?: () => Promise<void>;
138
+ /**
139
+ * Callback when Discord login is initiated
140
+ */
141
+ onDiscordLogin?: () => Promise<void>;
142
+ /**
143
+ * Custom labels for passkey buttons
144
+ */
145
+ labels?: {
146
+ emailLabel?: string;
147
+ emailPlaceholder?: string;
148
+ otpLabel?: string;
149
+ otpPlaceholder?: string;
150
+ emailButton?: string;
151
+ otpButton?: string;
152
+ googleButton?: string;
153
+ twitterButton?: string;
154
+ discordButton?: string;
155
+ passkeyLoginButton?: string;
156
+ passkeySignupButton?: string;
157
+ [key: string]: string | undefined;
158
+ };
159
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Types for OnboardingUI component
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/OnboardingUI/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}