@aaspai/react 0.0.0 → 0.0.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/README.md +720 -8
- package/dist/atoms.cjs +3565 -0
- package/dist/atoms.cjs.map +1 -0
- package/dist/atoms.d.cts +255 -0
- package/dist/atoms.d.ts +255 -0
- package/dist/atoms.js +3530 -0
- package/dist/atoms.js.map +1 -0
- package/dist/components.cjs +5397 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +362 -0
- package/dist/components.d.ts +362 -0
- package/dist/components.js +5344 -0
- package/dist/components.js.map +1 -0
- package/dist/forms.cjs +3928 -0
- package/dist/forms.cjs.map +1 -0
- package/dist/forms.d.cts +135 -0
- package/dist/forms.d.ts +135 -0
- package/dist/forms.js +3903 -0
- package/dist/forms.js.map +1 -0
- package/dist/hooks.cjs +74 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +138 -0
- package/dist/hooks.d.ts +138 -0
- package/dist/hooks.js +70 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +6030 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +248 -0
- package/dist/index.d.ts +248 -0
- package/dist/index.js +5952 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.cjs +139 -0
- package/dist/lib.cjs.map +1 -0
- package/dist/lib.d.cts +111 -0
- package/dist/lib.d.ts +111 -0
- package/dist/lib.js +128 -0
- package/dist/lib.js.map +1 -0
- package/dist/navigation.cjs +56 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.cts +65 -0
- package/dist/navigation.d.ts +65 -0
- package/dist/navigation.js +51 -0
- package/dist/navigation.js.map +1 -0
- package/dist/styles.css +839 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +17 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -28
- package/index.cjs +0 -10
- package/index.d.ts +0 -6
- package/index.js +0 -5
- package/styles.css +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export { ConditionalProps, ForgotPassword, ForgotPasswordProps, Protect, ProtectProps, ResetPassword, ResetPasswordProps, SignIn, SignInButton, SignInButtonProps, SignInProps, SignOutButton, SignOutButtonProps, SignUp, SignUpButton, SignUpButtonProps, SignUpProps, SignedIn, SignedOut, UserButton, UserButtonProps, UserProfileModal, UserProfileModalProps, VerifyEmail, VerifyEmailProps } from './components.cjs';
|
|
2
|
+
export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.cjs';
|
|
3
|
+
export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.cjs';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import { AaspaiUser, AaspaiContextValue, OAuthProvider } from '@aaspai/shared';
|
|
7
|
+
export { AaspaiAuthConfig, AaspaiAuthMethods, AaspaiAuthState, AaspaiContextValue, AaspaiUser, OAuthProvider } from '@aaspai/shared';
|
|
8
|
+
import { AASPAIClient } from '@aaspai/sdk';
|
|
9
|
+
export { useAuth, usePublicAuthConfig, useUser } from './hooks.cjs';
|
|
10
|
+
export { LegacyAuthSession, buildLegacyAuthUrl, checkPasswordStrength, createPasswordSchema, emailSchema, isHostedAuthEnvironment, passwordSchema, resolveAuthPath, resolveAuthUrl, validateEmail, validatePassword } from './lib.cjs';
|
|
11
|
+
import { OAuthProviderConfig } from './types.cjs';
|
|
12
|
+
export { AuthConfig, EmailVerificationMethod } from './types.cjs';
|
|
13
|
+
export { BrowserNavigationAdapter, NavigationAdapter, NavigationProvider, NavigationProviderProps, useNavigationAdapter, useSearchParams } from './navigation.cjs';
|
|
14
|
+
import '@aaspai/shared-schemas';
|
|
15
|
+
import 'zod';
|
|
16
|
+
|
|
17
|
+
interface InitialAuthState {
|
|
18
|
+
user?: AaspaiUser | null;
|
|
19
|
+
userId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
interface AaspaiProviderProps {
|
|
22
|
+
/**
|
|
23
|
+
* The base URL of the AASPAI backend.
|
|
24
|
+
* @deprecated This prop is no longer used.
|
|
25
|
+
* Use the client prop instead.
|
|
26
|
+
*/
|
|
27
|
+
baseUrl?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The AASPAI SDK client instance.
|
|
31
|
+
*/
|
|
32
|
+
client: AASPAIClient;
|
|
33
|
+
/**
|
|
34
|
+
* URL to redirect to after successful sign in (when token is detected in URL)
|
|
35
|
+
* @default '/'
|
|
36
|
+
*/
|
|
37
|
+
afterSignInUrl?: string;
|
|
38
|
+
onAuthChange?: (user: AaspaiUser | null) => void;
|
|
39
|
+
onSignIn?: (authToken: string, user: AaspaiUser) => Promise<void>;
|
|
40
|
+
onSignOut?: () => Promise<void>;
|
|
41
|
+
onRefresh?: (authToken: string, user: AaspaiUser) => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Initial auth state from server (for SSR hydration)
|
|
44
|
+
* @internal - Not intended for public use, used by Next.js package
|
|
45
|
+
*/
|
|
46
|
+
initialState?: InitialAuthState;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Unified Aaspai Provider - manages authentication state and configuration
|
|
50
|
+
*
|
|
51
|
+
* Uses singleton AaspaiManager to manage state across packages.
|
|
52
|
+
* Context only subscribes to Manager and triggers React re-renders.
|
|
53
|
+
*
|
|
54
|
+
* Architecture (pattern learned from Clerk):
|
|
55
|
+
* - AaspaiMethodsContext: Stable method references (NEVER change)
|
|
56
|
+
* - AaspaiAuthStateContext: Reactive auth state (changes on sign in/out)
|
|
57
|
+
* - AaspaiConfigContext: Static configuration values
|
|
58
|
+
* - AaspaiContext: Combined context for backward compatibility
|
|
59
|
+
*
|
|
60
|
+
* This architecture prevents useEffect re-runs when auth state changes,
|
|
61
|
+
* solving the "duplicate request" bug in components like VerifyEmail.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Basic usage (React/Vite)
|
|
66
|
+
* import { AaspaiProvider } from '@aaspai/react';
|
|
67
|
+
* import { createClient } from '@aaspai/sdk';
|
|
68
|
+
*
|
|
69
|
+
* const client = createClient({
|
|
70
|
+
* baseUrl: import.meta.env.VITE_INSFORGE_BASE_URL,
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* export default function MyApp() {
|
|
74
|
+
* return (
|
|
75
|
+
* <AaspaiProvider client={client}>
|
|
76
|
+
* <App />
|
|
77
|
+
* </AaspaiProvider>
|
|
78
|
+
* );
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // With cookie sync (Next.js optimization)
|
|
85
|
+
* <AaspaiProvider
|
|
86
|
+
* client={client}
|
|
87
|
+
* afterSignInUrl="/dashboard"
|
|
88
|
+
* onSignIn={async (authToken) => {
|
|
89
|
+
* await signIn(authToken);
|
|
90
|
+
* }}
|
|
91
|
+
* onSignOut={async () => {
|
|
92
|
+
* await signOut();
|
|
93
|
+
* }}
|
|
94
|
+
* >
|
|
95
|
+
* {children}
|
|
96
|
+
* </AaspaiProvider>
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
declare function AaspaiProviderCore({ children, client, afterSignInUrl, onAuthChange, onSignIn, onSignOut, onRefresh, initialState, }: AaspaiProviderProps): react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare function AaspaiProvider(props: AaspaiProviderProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* Hook to access Aaspai context
|
|
103
|
+
*
|
|
104
|
+
* Works seamlessly across packages thanks to singleton Manager.
|
|
105
|
+
* Context instance is guaranteed to be consistent.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* function MyComponent() {
|
|
110
|
+
* const { user, isSignedIn, signOut } = useAaspai();
|
|
111
|
+
*
|
|
112
|
+
* if (!isSignedIn) return <SignIn />;
|
|
113
|
+
*
|
|
114
|
+
* return (
|
|
115
|
+
* <div>
|
|
116
|
+
* <p>Welcome {user.email}</p>
|
|
117
|
+
* <button onClick={signOut}>Sign Out</button>
|
|
118
|
+
* </div>
|
|
119
|
+
* );
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function useAaspai(): AaspaiContextValue;
|
|
124
|
+
|
|
125
|
+
declare const OAUTH_PROVIDER_CONFIG: Record<OAuthProvider, OAuthProviderConfig>;
|
|
126
|
+
/**
|
|
127
|
+
* Get OAuth provider configuration by provider name
|
|
128
|
+
*/
|
|
129
|
+
declare function getProviderConfig(provider: OAuthProvider): OAuthProviderConfig | null;
|
|
130
|
+
/**
|
|
131
|
+
* Get all available OAuth provider configurations
|
|
132
|
+
*/
|
|
133
|
+
declare function getAllProviderConfigs(): Partial<Record<OAuthProvider, OAuthProviderConfig>>;
|
|
134
|
+
|
|
135
|
+
interface StyleProviderProps {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
/** Optional nonce value for CSP (Content Security Policy) */
|
|
138
|
+
nonce?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Provides Emotion CSS-in-JS styling context for Aaspai components.
|
|
142
|
+
*
|
|
143
|
+
* This ensures styles are injected dynamically at runtime, preventing FOUC
|
|
144
|
+
* in SSR environments like Next.js.
|
|
145
|
+
*
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
declare function StyleProvider({ children, nonce }: StyleProviderProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Aaspai Design System Theme
|
|
152
|
+
*
|
|
153
|
+
* Complete design tokens for all components
|
|
154
|
+
*/
|
|
155
|
+
declare const theme: {
|
|
156
|
+
readonly colors: {
|
|
157
|
+
readonly primary: "#000000";
|
|
158
|
+
readonly primaryHover: "#1f1f1f";
|
|
159
|
+
readonly text: "#000000";
|
|
160
|
+
readonly textSecondary: "#828282";
|
|
161
|
+
readonly textMuted: "#a3a3a3";
|
|
162
|
+
readonly textGray: "#525252";
|
|
163
|
+
readonly border: "#d4d4d4";
|
|
164
|
+
readonly borderGray: "#e4e4e7";
|
|
165
|
+
readonly borderHover: "#9ca3af";
|
|
166
|
+
readonly borderFocus: "#000000";
|
|
167
|
+
readonly bgWhite: "#ffffff";
|
|
168
|
+
readonly bgLight: "#fafafa";
|
|
169
|
+
readonly bgGray: "#f5f5f5";
|
|
170
|
+
readonly bgHover: "#f9fafb";
|
|
171
|
+
readonly error: "#dc2626";
|
|
172
|
+
readonly errorBg: "#fee2e2";
|
|
173
|
+
readonly success: "#16a34a";
|
|
174
|
+
readonly successBg: "#d1fae5";
|
|
175
|
+
readonly successDark: "#059669";
|
|
176
|
+
readonly black: "#000000";
|
|
177
|
+
readonly zinc900: "#09090b";
|
|
178
|
+
};
|
|
179
|
+
readonly spacing: {
|
|
180
|
+
readonly 1: "0.25rem";
|
|
181
|
+
readonly 2: "0.5rem";
|
|
182
|
+
readonly 3: "0.75rem";
|
|
183
|
+
readonly 4: "1rem";
|
|
184
|
+
readonly 6: "1.5rem";
|
|
185
|
+
readonly 8: "2rem";
|
|
186
|
+
readonly 10: "2.5rem";
|
|
187
|
+
};
|
|
188
|
+
readonly radius: {
|
|
189
|
+
readonly xs: "0.125rem";
|
|
190
|
+
readonly sm: "0.25rem";
|
|
191
|
+
readonly md: "0.375rem";
|
|
192
|
+
readonly lg: "0.5rem";
|
|
193
|
+
readonly xl: "0.75rem";
|
|
194
|
+
readonly full: "9999px";
|
|
195
|
+
};
|
|
196
|
+
readonly fontSize: {
|
|
197
|
+
readonly xs: "0.75rem";
|
|
198
|
+
readonly sm: "0.875rem";
|
|
199
|
+
readonly base: "1rem";
|
|
200
|
+
readonly lg: "1.125rem";
|
|
201
|
+
readonly xl: "1.25rem";
|
|
202
|
+
readonly '2xl': "1.5rem";
|
|
203
|
+
};
|
|
204
|
+
readonly lineHeight: {
|
|
205
|
+
readonly tight: "1rem";
|
|
206
|
+
readonly normal: "1.25rem";
|
|
207
|
+
readonly relaxed: "1.5rem";
|
|
208
|
+
readonly loose: "2rem";
|
|
209
|
+
};
|
|
210
|
+
readonly fontFamily: {
|
|
211
|
+
readonly base: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif";
|
|
212
|
+
readonly manrope: "'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif";
|
|
213
|
+
};
|
|
214
|
+
readonly fontWeight: {
|
|
215
|
+
readonly normal: 400;
|
|
216
|
+
readonly medium: 500;
|
|
217
|
+
readonly semibold: 600;
|
|
218
|
+
};
|
|
219
|
+
readonly shadow: {
|
|
220
|
+
readonly sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)";
|
|
221
|
+
readonly md: "0 1px 2px 0 rgba(0, 0, 0, 0.1)";
|
|
222
|
+
readonly lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)";
|
|
223
|
+
};
|
|
224
|
+
readonly transition: {
|
|
225
|
+
readonly fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
226
|
+
readonly base: "200ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
227
|
+
};
|
|
228
|
+
readonly sizes: {
|
|
229
|
+
readonly input: {
|
|
230
|
+
readonly height: "2.5rem";
|
|
231
|
+
};
|
|
232
|
+
readonly button: {
|
|
233
|
+
readonly height: "2.5rem";
|
|
234
|
+
readonly heightOAuth: "2.25rem";
|
|
235
|
+
};
|
|
236
|
+
readonly avatar: "2rem";
|
|
237
|
+
readonly icon: "1.25rem";
|
|
238
|
+
readonly iconSm: "1.125rem";
|
|
239
|
+
readonly iconLg: "1.5rem";
|
|
240
|
+
readonly verifyCode: "3rem";
|
|
241
|
+
readonly verifyIcon: "4rem";
|
|
242
|
+
readonly verifyIconInner: "2rem";
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
type Theme = typeof theme;
|
|
246
|
+
|
|
247
|
+
export { type InitialAuthState, AaspaiProvider, AaspaiProviderCore, type AaspaiProviderProps, OAUTH_PROVIDER_CONFIG, OAuthProviderConfig, StyleProvider, type Theme, getAllProviderConfigs, getProviderConfig, theme, useAaspai };
|
|
248
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export { ConditionalProps, ForgotPassword, ForgotPasswordProps, Protect, ProtectProps, ResetPassword, ResetPasswordProps, SignIn, SignInButton, SignInButtonProps, SignInProps, SignOutButton, SignOutButtonProps, SignUp, SignUpButton, SignUpButtonProps, SignUpProps, SignedIn, SignedOut, UserButton, UserButtonProps, UserProfileModal, UserProfileModalProps, VerifyEmail, VerifyEmailProps } from './components.js';
|
|
2
|
+
export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.js';
|
|
3
|
+
export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.js';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import { AaspaiUser, AaspaiContextValue, OAuthProvider } from '@aaspai/shared';
|
|
7
|
+
export { AaspaiAuthConfig, AaspaiAuthMethods, AaspaiAuthState, AaspaiContextValue, AaspaiUser, OAuthProvider } from '@aaspai/shared';
|
|
8
|
+
import { AASPAIClient } from '@aaspai/sdk';
|
|
9
|
+
export { useAuth, usePublicAuthConfig, useUser } from './hooks.js';
|
|
10
|
+
export { LegacyAuthSession, buildLegacyAuthUrl, checkPasswordStrength, createPasswordSchema, emailSchema, isHostedAuthEnvironment, passwordSchema, resolveAuthPath, resolveAuthUrl, validateEmail, validatePassword } from './lib.js';
|
|
11
|
+
import { OAuthProviderConfig } from './types.js';
|
|
12
|
+
export { AuthConfig, EmailVerificationMethod } from './types.js';
|
|
13
|
+
export { BrowserNavigationAdapter, NavigationAdapter, NavigationProvider, NavigationProviderProps, useNavigationAdapter, useSearchParams } from './navigation.js';
|
|
14
|
+
import '@aaspai/shared-schemas';
|
|
15
|
+
import 'zod';
|
|
16
|
+
|
|
17
|
+
interface InitialAuthState {
|
|
18
|
+
user?: AaspaiUser | null;
|
|
19
|
+
userId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
interface AaspaiProviderProps {
|
|
22
|
+
/**
|
|
23
|
+
* The base URL of the AASPAI backend.
|
|
24
|
+
* @deprecated This prop is no longer used.
|
|
25
|
+
* Use the client prop instead.
|
|
26
|
+
*/
|
|
27
|
+
baseUrl?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The AASPAI SDK client instance.
|
|
31
|
+
*/
|
|
32
|
+
client: AASPAIClient;
|
|
33
|
+
/**
|
|
34
|
+
* URL to redirect to after successful sign in (when token is detected in URL)
|
|
35
|
+
* @default '/'
|
|
36
|
+
*/
|
|
37
|
+
afterSignInUrl?: string;
|
|
38
|
+
onAuthChange?: (user: AaspaiUser | null) => void;
|
|
39
|
+
onSignIn?: (authToken: string, user: AaspaiUser) => Promise<void>;
|
|
40
|
+
onSignOut?: () => Promise<void>;
|
|
41
|
+
onRefresh?: (authToken: string, user: AaspaiUser) => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Initial auth state from server (for SSR hydration)
|
|
44
|
+
* @internal - Not intended for public use, used by Next.js package
|
|
45
|
+
*/
|
|
46
|
+
initialState?: InitialAuthState;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Unified Aaspai Provider - manages authentication state and configuration
|
|
50
|
+
*
|
|
51
|
+
* Uses singleton AaspaiManager to manage state across packages.
|
|
52
|
+
* Context only subscribes to Manager and triggers React re-renders.
|
|
53
|
+
*
|
|
54
|
+
* Architecture (pattern learned from Clerk):
|
|
55
|
+
* - AaspaiMethodsContext: Stable method references (NEVER change)
|
|
56
|
+
* - AaspaiAuthStateContext: Reactive auth state (changes on sign in/out)
|
|
57
|
+
* - AaspaiConfigContext: Static configuration values
|
|
58
|
+
* - AaspaiContext: Combined context for backward compatibility
|
|
59
|
+
*
|
|
60
|
+
* This architecture prevents useEffect re-runs when auth state changes,
|
|
61
|
+
* solving the "duplicate request" bug in components like VerifyEmail.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Basic usage (React/Vite)
|
|
66
|
+
* import { AaspaiProvider } from '@aaspai/react';
|
|
67
|
+
* import { createClient } from '@aaspai/sdk';
|
|
68
|
+
*
|
|
69
|
+
* const client = createClient({
|
|
70
|
+
* baseUrl: import.meta.env.VITE_INSFORGE_BASE_URL,
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* export default function MyApp() {
|
|
74
|
+
* return (
|
|
75
|
+
* <AaspaiProvider client={client}>
|
|
76
|
+
* <App />
|
|
77
|
+
* </AaspaiProvider>
|
|
78
|
+
* );
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // With cookie sync (Next.js optimization)
|
|
85
|
+
* <AaspaiProvider
|
|
86
|
+
* client={client}
|
|
87
|
+
* afterSignInUrl="/dashboard"
|
|
88
|
+
* onSignIn={async (authToken) => {
|
|
89
|
+
* await signIn(authToken);
|
|
90
|
+
* }}
|
|
91
|
+
* onSignOut={async () => {
|
|
92
|
+
* await signOut();
|
|
93
|
+
* }}
|
|
94
|
+
* >
|
|
95
|
+
* {children}
|
|
96
|
+
* </AaspaiProvider>
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
declare function AaspaiProviderCore({ children, client, afterSignInUrl, onAuthChange, onSignIn, onSignOut, onRefresh, initialState, }: AaspaiProviderProps): react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare function AaspaiProvider(props: AaspaiProviderProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* Hook to access Aaspai context
|
|
103
|
+
*
|
|
104
|
+
* Works seamlessly across packages thanks to singleton Manager.
|
|
105
|
+
* Context instance is guaranteed to be consistent.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* function MyComponent() {
|
|
110
|
+
* const { user, isSignedIn, signOut } = useAaspai();
|
|
111
|
+
*
|
|
112
|
+
* if (!isSignedIn) return <SignIn />;
|
|
113
|
+
*
|
|
114
|
+
* return (
|
|
115
|
+
* <div>
|
|
116
|
+
* <p>Welcome {user.email}</p>
|
|
117
|
+
* <button onClick={signOut}>Sign Out</button>
|
|
118
|
+
* </div>
|
|
119
|
+
* );
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function useAaspai(): AaspaiContextValue;
|
|
124
|
+
|
|
125
|
+
declare const OAUTH_PROVIDER_CONFIG: Record<OAuthProvider, OAuthProviderConfig>;
|
|
126
|
+
/**
|
|
127
|
+
* Get OAuth provider configuration by provider name
|
|
128
|
+
*/
|
|
129
|
+
declare function getProviderConfig(provider: OAuthProvider): OAuthProviderConfig | null;
|
|
130
|
+
/**
|
|
131
|
+
* Get all available OAuth provider configurations
|
|
132
|
+
*/
|
|
133
|
+
declare function getAllProviderConfigs(): Partial<Record<OAuthProvider, OAuthProviderConfig>>;
|
|
134
|
+
|
|
135
|
+
interface StyleProviderProps {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
/** Optional nonce value for CSP (Content Security Policy) */
|
|
138
|
+
nonce?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Provides Emotion CSS-in-JS styling context for Aaspai components.
|
|
142
|
+
*
|
|
143
|
+
* This ensures styles are injected dynamically at runtime, preventing FOUC
|
|
144
|
+
* in SSR environments like Next.js.
|
|
145
|
+
*
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
declare function StyleProvider({ children, nonce }: StyleProviderProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Aaspai Design System Theme
|
|
152
|
+
*
|
|
153
|
+
* Complete design tokens for all components
|
|
154
|
+
*/
|
|
155
|
+
declare const theme: {
|
|
156
|
+
readonly colors: {
|
|
157
|
+
readonly primary: "#000000";
|
|
158
|
+
readonly primaryHover: "#1f1f1f";
|
|
159
|
+
readonly text: "#000000";
|
|
160
|
+
readonly textSecondary: "#828282";
|
|
161
|
+
readonly textMuted: "#a3a3a3";
|
|
162
|
+
readonly textGray: "#525252";
|
|
163
|
+
readonly border: "#d4d4d4";
|
|
164
|
+
readonly borderGray: "#e4e4e7";
|
|
165
|
+
readonly borderHover: "#9ca3af";
|
|
166
|
+
readonly borderFocus: "#000000";
|
|
167
|
+
readonly bgWhite: "#ffffff";
|
|
168
|
+
readonly bgLight: "#fafafa";
|
|
169
|
+
readonly bgGray: "#f5f5f5";
|
|
170
|
+
readonly bgHover: "#f9fafb";
|
|
171
|
+
readonly error: "#dc2626";
|
|
172
|
+
readonly errorBg: "#fee2e2";
|
|
173
|
+
readonly success: "#16a34a";
|
|
174
|
+
readonly successBg: "#d1fae5";
|
|
175
|
+
readonly successDark: "#059669";
|
|
176
|
+
readonly black: "#000000";
|
|
177
|
+
readonly zinc900: "#09090b";
|
|
178
|
+
};
|
|
179
|
+
readonly spacing: {
|
|
180
|
+
readonly 1: "0.25rem";
|
|
181
|
+
readonly 2: "0.5rem";
|
|
182
|
+
readonly 3: "0.75rem";
|
|
183
|
+
readonly 4: "1rem";
|
|
184
|
+
readonly 6: "1.5rem";
|
|
185
|
+
readonly 8: "2rem";
|
|
186
|
+
readonly 10: "2.5rem";
|
|
187
|
+
};
|
|
188
|
+
readonly radius: {
|
|
189
|
+
readonly xs: "0.125rem";
|
|
190
|
+
readonly sm: "0.25rem";
|
|
191
|
+
readonly md: "0.375rem";
|
|
192
|
+
readonly lg: "0.5rem";
|
|
193
|
+
readonly xl: "0.75rem";
|
|
194
|
+
readonly full: "9999px";
|
|
195
|
+
};
|
|
196
|
+
readonly fontSize: {
|
|
197
|
+
readonly xs: "0.75rem";
|
|
198
|
+
readonly sm: "0.875rem";
|
|
199
|
+
readonly base: "1rem";
|
|
200
|
+
readonly lg: "1.125rem";
|
|
201
|
+
readonly xl: "1.25rem";
|
|
202
|
+
readonly '2xl': "1.5rem";
|
|
203
|
+
};
|
|
204
|
+
readonly lineHeight: {
|
|
205
|
+
readonly tight: "1rem";
|
|
206
|
+
readonly normal: "1.25rem";
|
|
207
|
+
readonly relaxed: "1.5rem";
|
|
208
|
+
readonly loose: "2rem";
|
|
209
|
+
};
|
|
210
|
+
readonly fontFamily: {
|
|
211
|
+
readonly base: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif";
|
|
212
|
+
readonly manrope: "'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif";
|
|
213
|
+
};
|
|
214
|
+
readonly fontWeight: {
|
|
215
|
+
readonly normal: 400;
|
|
216
|
+
readonly medium: 500;
|
|
217
|
+
readonly semibold: 600;
|
|
218
|
+
};
|
|
219
|
+
readonly shadow: {
|
|
220
|
+
readonly sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)";
|
|
221
|
+
readonly md: "0 1px 2px 0 rgba(0, 0, 0, 0.1)";
|
|
222
|
+
readonly lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)";
|
|
223
|
+
};
|
|
224
|
+
readonly transition: {
|
|
225
|
+
readonly fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
226
|
+
readonly base: "200ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
227
|
+
};
|
|
228
|
+
readonly sizes: {
|
|
229
|
+
readonly input: {
|
|
230
|
+
readonly height: "2.5rem";
|
|
231
|
+
};
|
|
232
|
+
readonly button: {
|
|
233
|
+
readonly height: "2.5rem";
|
|
234
|
+
readonly heightOAuth: "2.25rem";
|
|
235
|
+
};
|
|
236
|
+
readonly avatar: "2rem";
|
|
237
|
+
readonly icon: "1.25rem";
|
|
238
|
+
readonly iconSm: "1.125rem";
|
|
239
|
+
readonly iconLg: "1.5rem";
|
|
240
|
+
readonly verifyCode: "3rem";
|
|
241
|
+
readonly verifyIcon: "4rem";
|
|
242
|
+
readonly verifyIconInner: "2rem";
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
type Theme = typeof theme;
|
|
246
|
+
|
|
247
|
+
export { type InitialAuthState, AaspaiProvider, AaspaiProviderCore, type AaspaiProviderProps, OAUTH_PROVIDER_CONFIG, OAuthProviderConfig, StyleProvider, type Theme, getAllProviderConfigs, getProviderConfig, theme, useAaspai };
|
|
248
|
+
|