@lumoauth/react 0.0.0-stage → 1.0.0

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.
@@ -0,0 +1,678 @@
1
+ import { EmailCheckResult, TokenStorage, AbacCheckRequest, LumoAuth, ZanzibarCheckRequest } from '@lumoauth/client';
2
+ export { LumoAuth, LumoAuthConfig } from '@lumoauth/client';
3
+ import * as react from 'react';
4
+ import react__default from 'react';
5
+
6
+ interface LumoAuthUser {
7
+ /** Unique user ID */
8
+ id: string | number;
9
+ /** Primary email */
10
+ email: string;
11
+ /** First name */
12
+ firstName?: string;
13
+ /** Last name */
14
+ lastName?: string;
15
+ /** Display name (computed: firstName + lastName or email) */
16
+ displayName: string;
17
+ /** URL to user's avatar/profile image */
18
+ avatarUrl?: string;
19
+ /** Whether email has been verified */
20
+ emailVerified: boolean;
21
+ /** Whether MFA is enabled */
22
+ mfaEnabled: boolean;
23
+ /** List of role slugs */
24
+ roles: string[];
25
+ /** List of group names */
26
+ groups: string[];
27
+ /** OIDC subject identifier */
28
+ sub?: string;
29
+ /** Any additional custom claims from the ID token or UserInfo */
30
+ claims: Record<string, unknown>;
31
+ }
32
+ type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
33
+ interface AuthState {
34
+ /** Current auth status */
35
+ status: AuthStatus;
36
+ /** Authenticated user, or null */
37
+ user: LumoAuthUser | null;
38
+ /** Whether the initial auth check has completed */
39
+ isLoaded: boolean;
40
+ /** Shorthand: status === 'authenticated' */
41
+ isSignedIn: boolean;
42
+ }
43
+ interface LumoAuthProviderProps {
44
+ /** Your LumoAuth instance domain (e.g. "https://auth.example.com") */
45
+ domain: string;
46
+ /** Your organization ID (e.g. "acme-corp") */
47
+ orgId: string;
48
+ /** OAuth client ID */
49
+ clientId: string;
50
+ /**
51
+ * Authentication strategy.
52
+ * - `'pkce'` — OAuth 2.0 Authorization Code + PKCE (default, recommended)
53
+ * - `'password'` — Resource Owner Password Credentials grant (legacy)
54
+ *
55
+ * @default 'pkce'
56
+ */
57
+ authStrategy?: 'pkce' | 'password';
58
+ /** OAuth redirect URI for the callback page (required for PKCE mode) */
59
+ redirectUri?: string;
60
+ /** URL to redirect after sign-in (defaults to current page) */
61
+ afterSignInUrl?: string;
62
+ /** URL to redirect after sign-up */
63
+ afterSignUpUrl?: string;
64
+ /** URL to redirect after sign-out (defaults to "/") */
65
+ afterSignOutUrl?: string;
66
+ /**
67
+ * Where to keep tokens. Defaults to `sessionStorage` in the browser and
68
+ * memory on the server.
69
+ *
70
+ * Import an adapter from `@lumoauth/client`:
71
+ * `sessionStorageAdapter` (default, per-tab), `localStorageAdapter`
72
+ * (shared across tabs, survives restart), `memoryStorageAdapter`, or
73
+ * `cookieStorageAdapter` — the last keeps tokens in an httpOnly cookie so
74
+ * they are never readable by JavaScript, which is the only option that
75
+ * survives XSS. It requires a same-origin backend to own the exchange and
76
+ * refresh (see `@lumoauth/express`).
77
+ */
78
+ storage?: TokenStorage;
79
+ /**
80
+ * Share the session across browser tabs: a refresh in one tab is broadcast
81
+ * to the others, and a Web Lock elects a single refresher so tabs do not
82
+ * race on a rotated refresh token.
83
+ * @default true
84
+ */
85
+ crossTab?: boolean;
86
+ /** React children */
87
+ children: React.ReactNode;
88
+ }
89
+ interface AppearanceProps {
90
+ /** Force light or dark theme (defaults to system preference) */
91
+ theme?: 'light' | 'dark';
92
+ /** Override CSS custom properties */
93
+ variables?: Record<string, string>;
94
+ /** Additional className applied to the component root */
95
+ className?: string;
96
+ }
97
+ interface SignInProps {
98
+ /** URL to redirect after successful sign-in */
99
+ afterSignInUrl?: string;
100
+ /** URL for the sign-up link */
101
+ signUpUrl?: string;
102
+ /** Appearance overrides */
103
+ appearance?: AppearanceProps;
104
+ /**
105
+ * Social providers to offer, e.g. `['google', 'apple']`.
106
+ *
107
+ * Defaults to `[]` (no buttons). There is deliberately no default list:
108
+ * which providers an organization has enabled is only readable through
109
+ * `/orgs/{orgId}/api/v1/admin/social-providers`, which requires admin
110
+ * credentials and so is unreachable from an unauthenticated sign-in card.
111
+ * A hardcoded default would advertise providers the organization may not
112
+ * have configured.
113
+ *
114
+ * Each button deep-links straight to that provider: the SDK passes
115
+ * `?provider=` to `/oauth/authorize`, which redirects to the provider's
116
+ * flow with the PKCE challenge preserved. A provider the organization has
117
+ * not configured falls back to the hosted login page rather than erroring,
118
+ * so a wrong value degrades instead of breaking.
119
+ *
120
+ * Recognised icons: `google`, `github`, `microsoft`, `apple`. Any other
121
+ * value renders with a label and no icon.
122
+ */
123
+ socialProviders?: string[];
124
+ }
125
+ interface SignUpProps {
126
+ /** URL to redirect after successful sign-up */
127
+ afterSignUpUrl?: string;
128
+ /** URL for the sign-in link */
129
+ signInUrl?: string;
130
+ /** Appearance overrides */
131
+ appearance?: AppearanceProps;
132
+ }
133
+ interface UserButtonProps {
134
+ /** URL to redirect after sign-out */
135
+ afterSignOutUrl?: string;
136
+ /** Show the user's name next to the avatar */
137
+ showName?: boolean;
138
+ /** Appearance overrides */
139
+ appearance?: AppearanceProps;
140
+ }
141
+ interface ProtectProps {
142
+ /** RBAC permission slug to check */
143
+ permission?: string;
144
+ /** Zanzibar ReBAC check */
145
+ zanzibar?: {
146
+ object: string;
147
+ relation: string;
148
+ subject?: string;
149
+ };
150
+ /** ABAC policy check */
151
+ abac?: {
152
+ resourceType: string;
153
+ action: string;
154
+ resourceId?: string;
155
+ };
156
+ /** Component to show when access is denied */
157
+ fallback?: React.ReactNode;
158
+ /** React children (shown when access is granted) */
159
+ children: React.ReactNode;
160
+ }
161
+ interface AuthCallbackProps {
162
+ /** URL to redirect after successful authentication (defaults to afterSignInUrl) */
163
+ afterSignInUrl?: string;
164
+ /** Custom loading component */
165
+ loading?: React.ReactNode;
166
+ /** Custom error component */
167
+ error?: React.ReactNode | ((error: string) => React.ReactNode);
168
+ }
169
+ interface SignedInProps {
170
+ /** React children (shown only when user is authenticated) */
171
+ children: React.ReactNode;
172
+ }
173
+ interface SignedOutProps {
174
+ /** React children (shown only when user is NOT authenticated) */
175
+ children: React.ReactNode;
176
+ }
177
+ interface SignInButtonProps {
178
+ /** Custom children to render inside the button */
179
+ children?: React.ReactNode;
180
+ /** Force redirect to a specific sign-in URL */
181
+ signInUrl?: string;
182
+ /** Additional class name */
183
+ className?: string;
184
+ }
185
+ interface SignUpButtonProps {
186
+ /** Custom children to render inside the button */
187
+ children?: React.ReactNode;
188
+ /** Force redirect to a specific sign-up URL */
189
+ signUpUrl?: string;
190
+ /** Additional class name */
191
+ className?: string;
192
+ }
193
+ interface SignOutButtonProps {
194
+ /** Custom children to render inside the button */
195
+ children?: React.ReactNode;
196
+ /** URL to redirect after sign-out */
197
+ afterSignOutUrl?: string;
198
+ /** Additional class name */
199
+ className?: string;
200
+ }
201
+ interface UserAvatarProps {
202
+ /** Avatar size in pixels */
203
+ size?: number;
204
+ /** Avatar shape */
205
+ shape?: 'circle' | 'square';
206
+ /** Appearance overrides */
207
+ appearance?: AppearanceProps;
208
+ }
209
+ interface UserProfileProps {
210
+ /** URL to redirect after sign-out */
211
+ afterSignOutUrl?: string;
212
+ /**
213
+ * Display mode:
214
+ * - `'full'` — shows all sections (account, security, roles)
215
+ * - `'compact'` — shows only account details
216
+ * @default 'full'
217
+ */
218
+ mode?: 'full' | 'compact';
219
+ /** Appearance overrides */
220
+ appearance?: AppearanceProps;
221
+ }
222
+ interface RedirectToSignInProps {
223
+ /** Override sign-in URL */
224
+ signInUrl?: string;
225
+ }
226
+ /**
227
+ * Return type of the {@link useMagicLink} hook.
228
+ * Provides the `sendMagicLink` action plus loading/sent/error state.
229
+ */
230
+ interface UseMagicLinkReturn {
231
+ /**
232
+ * Send a magic sign-in link to the given email.
233
+ * The server never reveals whether the email exists.
234
+ */
235
+ sendMagicLink: (email: string, redirectUri?: string) => Promise<void>;
236
+ /** True while the request is in-flight */
237
+ isLoading: boolean;
238
+ /** True after the request completes (link was dispatched) */
239
+ isSent: boolean;
240
+ /** Error message if the request failed */
241
+ error: string | null;
242
+ /** Reset sent/error state back to idle */
243
+ reset: () => void;
244
+ }
245
+ /**
246
+ * Return type of the {@link useEmailFirst} hook.
247
+ * Provides the `checkEmail` action plus loading/result state.
248
+ */
249
+ interface UseEmailFirstReturn {
250
+ /**
251
+ * Discover which sign-in methods this identifier can actually use.
252
+ *
253
+ * Returns the organization's enabled methods AND what this user has
254
+ * enrolled (passkey, push device, magic link, password), so a sign-in card
255
+ * can render only the options that will work.
256
+ */
257
+ checkEmail: (email: string) => Promise<EmailCheckResult>;
258
+ /** True while the check is in-flight */
259
+ isLoading: boolean;
260
+ /** Full result of the last check, or null if not yet checked */
261
+ result: EmailCheckResult | null;
262
+ /** Shorthand for `result?.exists`, or null if not yet checked */
263
+ exists: boolean | null;
264
+ /** Reset state back to idle */
265
+ reset: () => void;
266
+ }
267
+ interface LumoAuthContextValue extends AuthState {
268
+ /**
269
+ * Sign in.
270
+ * - **PKCE mode:** Call with no args to initiate redirect-based sign-in.
271
+ * - **Password mode:** Call with `(email, password)` for inline sign-in.
272
+ */
273
+ signIn: (email?: string, password?: string) => Promise<void> | void;
274
+ /** Sign in by redirecting to the LumoAuth authorization endpoint (PKCE). */
275
+ signInWithRedirect: () => void;
276
+ /** Sign in with a social provider using PKCE. */
277
+ signInWithSocial: (provider: string) => void;
278
+ /** Sign up with email, password, and optional name (password mode only). */
279
+ signUp: (params: {
280
+ email: string;
281
+ password: string;
282
+ firstName?: string;
283
+ lastName?: string;
284
+ }) => Promise<void>;
285
+ /**
286
+ * Sign out the current user. Revokes the access token, clears local
287
+ * tokens, and redirects the browser through the OIDC RP-initiated
288
+ * logout endpoint so the IdP session cookie is also invalidated.
289
+ */
290
+ signOut: (options?: {
291
+ afterSignOutUrl?: string;
292
+ }) => Promise<void>;
293
+ /** Get the current access token (refreshes if expired) */
294
+ getToken: () => Promise<string | null>;
295
+ /** Handle the OAuth callback — exchange code for tokens */
296
+ handleCallback: () => Promise<void>;
297
+ /**
298
+ * Request a magic sign-in link for the given email.
299
+ * Shows a "Check your inbox" page — works for both email-first and
300
+ * magic-link-only organization configurations.
301
+ */
302
+ sendMagicLink: (email: string, redirectUri?: string) => Promise<void>;
303
+ /**
304
+ * Check whether an account with the given email exists in the organization.
305
+ * Used to implement email-first login flows.
306
+ */
307
+ checkEmail: (email: string) => Promise<EmailCheckResult>;
308
+ /** The authentication strategy in use */
309
+ authStrategy: 'pkce' | 'password';
310
+ /** Provider configuration */
311
+ config: {
312
+ domain: string;
313
+ orgId: string;
314
+ clientId: string;
315
+ redirectUri?: string;
316
+ afterSignInUrl?: string;
317
+ afterSignUpUrl?: string;
318
+ afterSignOutUrl?: string;
319
+ };
320
+ }
321
+
322
+ declare function LumoAuthProvider({ domain, orgId, clientId, authStrategy, redirectUri, afterSignInUrl, afterSignUpUrl, afterSignOutUrl, storage, crossTab, children, }: LumoAuthProviderProps): react.JSX.Element;
323
+
324
+ /**
325
+ * Drop-in sign-in component.
326
+ *
327
+ * - **PKCE mode (default):** Renders social login buttons and a
328
+ * "Sign in with email" button that redirects to the LumoAuth
329
+ * hosted login page. No inline password form.
330
+ *
331
+ * - **Password mode:** Renders the classic inline email/password form
332
+ * with social login buttons.
333
+ *
334
+ * @example
335
+ * ```tsx
336
+ * import { SignIn } from '@lumoauth/react';
337
+ * <SignIn afterSignInUrl="/dashboard" />
338
+ * ```
339
+ */
340
+ declare function SignIn({ afterSignInUrl, signUpUrl, appearance, socialProviders, }: SignInProps): react__default.JSX.Element | null;
341
+
342
+ /**
343
+ * Drop-in sign-up/registration component.
344
+ *
345
+ * - **PKCE mode (default):** Renders a button that redirects to the
346
+ * LumoAuth hosted registration page.
347
+ *
348
+ * - **Password mode:** Renders the inline registration form with
349
+ * password strength indicator.
350
+ *
351
+ * @example
352
+ * ```tsx
353
+ * import { SignUp } from '@lumoauth/react';
354
+ * <SignUp afterSignUpUrl="/onboarding" />
355
+ * ```
356
+ */
357
+ declare function SignUp({ afterSignUpUrl, signInUrl, appearance, }: SignUpProps): react__default.JSX.Element | null;
358
+
359
+ /**
360
+ * Handles the OAuth callback after a PKCE redirect.
361
+ * Place this component on your callback route (e.g. `/auth/callback`).
362
+ *
363
+ * Automatically:
364
+ * 1. Parses the authorization code and state from the URL
365
+ * 2. Exchanges the code for tokens using the PKCE verifier
366
+ * 3. Redirects to `afterSignInUrl` on success
367
+ *
368
+ * @example
369
+ * ```tsx
370
+ * // In your router, at the /auth/callback route:
371
+ * import { AuthCallback } from '@lumoauth/react';
372
+ *
373
+ * export function CallbackPage() {
374
+ * return <AuthCallback afterSignInUrl="/dashboard" />;
375
+ * }
376
+ * ```
377
+ */
378
+ declare function AuthCallback({ afterSignInUrl, loading, error: errorComponent, }: AuthCallbackProps): react.JSX.Element;
379
+
380
+ /**
381
+ * Clerk-style user avatar button with dropdown menu.
382
+ *
383
+ * @example
384
+ * ```tsx
385
+ * import { UserButton } from '@lumoauth/react';
386
+ * <UserButton afterSignOutUrl="/" />
387
+ * ```
388
+ */
389
+ declare function UserButton({ afterSignOutUrl, showName, appearance, }: UserButtonProps): react__default.JSX.Element | null;
390
+
391
+ /**
392
+ * Renders the current user's avatar. Displays the profile image
393
+ * if available, otherwise shows initials.
394
+ *
395
+ * @example
396
+ * ```tsx
397
+ * import { UserAvatar } from '@lumoauth/react';
398
+ *
399
+ * // Default (32px)
400
+ * <UserAvatar />
401
+ *
402
+ * // Large with custom size
403
+ * <UserAvatar size={48} />
404
+ *
405
+ * // Square shape
406
+ * <UserAvatar shape="square" />
407
+ * ```
408
+ */
409
+ declare function UserAvatar({ size, shape, appearance, }: UserAvatarProps): react__default.JSX.Element;
410
+
411
+ /**
412
+ * Renders a user profile card showing account details, roles,
413
+ * security status, and a sign-out action.
414
+ *
415
+ * @example
416
+ * ```tsx
417
+ * import { UserProfile } from '@lumoauth/react';
418
+ *
419
+ * // Full profile card
420
+ * <UserProfile />
421
+ *
422
+ * // With sign-out redirect
423
+ * <UserProfile afterSignOutUrl="/" />
424
+ *
425
+ * // Compact mode (hides roles and security sections)
426
+ * <UserProfile mode="compact" />
427
+ * ```
428
+ */
429
+ declare function UserProfile({ afterSignOutUrl, mode, appearance, }: UserProfileProps): react__default.JSX.Element | null;
430
+
431
+ /**
432
+ * Authorization gate component. Renders children only if the user
433
+ * has the required permission, relationship, or policy access.
434
+ *
435
+ * Supports RBAC, ReBAC (Zanzibar), and ABAC checks.
436
+ *
437
+ * @example
438
+ * ```tsx
439
+ * // RBAC
440
+ * <Protect permission="documents.edit" fallback={<NoAccess />}>
441
+ * <EditForm />
442
+ * </Protect>
443
+ *
444
+ * // ReBAC (Zanzibar)
445
+ * <Protect zanzibar={{ object: 'doc:123', relation: 'editor', subject: 'user:alice' }}>
446
+ * <EditForm />
447
+ * </Protect>
448
+ *
449
+ * // ABAC
450
+ * <Protect abac={{ resourceType: 'document', action: 'read', resourceId: 'doc-123' }}>
451
+ * <ReadView />
452
+ * </Protect>
453
+ * ```
454
+ */
455
+ declare function Protect({ permission, zanzibar, abac, fallback, children, }: ProtectProps): react__default.JSX.Element;
456
+
457
+ /**
458
+ * Renders children only when the user is authenticated.
459
+ *
460
+ * @example
461
+ * ```tsx
462
+ * <SignedIn>
463
+ * <p>Welcome back!</p>
464
+ * </SignedIn>
465
+ * ```
466
+ */
467
+ declare function SignedIn({ children }: SignedInProps): react.JSX.Element | null;
468
+ /**
469
+ * Renders children only when the user is NOT authenticated.
470
+ *
471
+ * @example
472
+ * ```tsx
473
+ * <SignedOut>
474
+ * <p>Please sign in to continue.</p>
475
+ * </SignedOut>
476
+ * ```
477
+ */
478
+ declare function SignedOut({ children }: SignedOutProps): react.JSX.Element | null;
479
+ /**
480
+ * Unstyled button that triggers sign-in.
481
+ * In PKCE mode, initiates the redirect flow.
482
+ * In password mode, navigates to the sign-in page.
483
+ *
484
+ * @example
485
+ * ```tsx
486
+ * <SignInButton>
487
+ * <button className="my-custom-btn">Sign in</button>
488
+ * </SignInButton>
489
+ * ```
490
+ */
491
+ declare function SignInButton({ children, signInUrl, className }: SignInButtonProps): react.JSX.Element;
492
+ /**
493
+ * Unstyled button that navigates to the sign-up page.
494
+ *
495
+ * @example
496
+ * ```tsx
497
+ * <SignUpButton>
498
+ * <button className="my-custom-btn">Sign up</button>
499
+ * </SignUpButton>
500
+ * ```
501
+ */
502
+ declare function SignUpButton({ children, signUpUrl, className }: SignUpButtonProps): react.JSX.Element;
503
+ /**
504
+ * Unstyled button that triggers sign-out.
505
+ *
506
+ * @example
507
+ * ```tsx
508
+ * <SignOutButton afterSignOutUrl="/">
509
+ * <button>Log out</button>
510
+ * </SignOutButton>
511
+ * ```
512
+ */
513
+ declare function SignOutButton({ children, afterSignOutUrl, className }: SignOutButtonProps): react.JSX.Element;
514
+ /**
515
+ * Automatically redirects to the sign-in page when rendered.
516
+ * Useful for protecting routes.
517
+ *
518
+ * @example
519
+ * ```tsx
520
+ * // In your protected route:
521
+ * <SignedOut>
522
+ * <RedirectToSignIn />
523
+ * </SignedOut>
524
+ * ```
525
+ */
526
+ declare function RedirectToSignIn({ signInUrl }: RedirectToSignInProps): null;
527
+
528
+ /**
529
+ * Primary hook for accessing auth state and actions.
530
+ *
531
+ * @example
532
+ * ```tsx
533
+ * const { user, isSignedIn, signIn, signOut } = useAuth();
534
+ * ```
535
+ */
536
+ declare function useAuth(): LumoAuthContextValue;
537
+ /**
538
+ * Returns the current user object, or null if not signed in.
539
+ *
540
+ * @example
541
+ * ```tsx
542
+ * const user = useUser();
543
+ * if (user) console.log(user.email);
544
+ * ```
545
+ */
546
+ declare function useUser(): LumoAuthUser | null;
547
+ /**
548
+ * Returns sign-in utilities.
549
+ *
550
+ * @example
551
+ * ```tsx
552
+ * const { signIn, signInWithRedirect, isLoading } = useSignIn();
553
+ * ```
554
+ */
555
+ declare function useSignIn(): {
556
+ signIn: (email?: string, password?: string) => Promise<void> | void;
557
+ signInWithRedirect: () => void;
558
+ isLoading: boolean;
559
+ };
560
+ /**
561
+ * Returns session-related state.
562
+ *
563
+ * @example
564
+ * ```tsx
565
+ * const { isActive, isLoaded, getToken } = useSession();
566
+ * ```
567
+ */
568
+ declare function useSession(): {
569
+ isActive: boolean;
570
+ isLoaded: boolean;
571
+ getToken: () => Promise<string | null>;
572
+ status: AuthStatus;
573
+ };
574
+ /**
575
+ * Returns a configured `LumoAuth` SDK client for making authorization
576
+ * checks (RBAC, ReBAC, ABAC). The client's token is automatically
577
+ * wired to the current session.
578
+ *
579
+ * @example
580
+ * ```tsx
581
+ * const client = useLumoAuth();
582
+ * const canEdit = await client.permissions.check('documents.edit');
583
+ * ```
584
+ */
585
+ declare function useLumoAuth(): LumoAuth;
586
+ /**
587
+ * Check an RBAC permission. Returns loading and allowed states.
588
+ *
589
+ * @example
590
+ * ```tsx
591
+ * const { allowed, isLoading } = usePermission('documents.edit');
592
+ * if (isLoading) return <Spinner />;
593
+ * if (!allowed) return <NoAccess />;
594
+ * ```
595
+ */
596
+ declare function usePermission(slug: string): {
597
+ allowed: boolean;
598
+ isLoading: boolean;
599
+ };
600
+ /**
601
+ * Check a Zanzibar ReBAC relationship. Returns loading and allowed states.
602
+ *
603
+ * @example
604
+ * ```tsx
605
+ * const { allowed, isLoading } = useZanzibar({
606
+ * object: 'document:readme',
607
+ * relation: 'editor',
608
+ * subject: 'user:alice',
609
+ * });
610
+ * ```
611
+ */
612
+ declare function useZanzibar(request: ZanzibarCheckRequest): {
613
+ allowed: boolean;
614
+ isLoading: boolean;
615
+ };
616
+ /**
617
+ * Check an ABAC policy. Returns loading and allowed states.
618
+ *
619
+ * @example
620
+ * ```tsx
621
+ * const { allowed, isLoading } = useAbac({
622
+ * resourceType: 'document',
623
+ * action: 'read',
624
+ * resourceId: 'doc-123',
625
+ * });
626
+ * ```
627
+ */
628
+ declare function useAbac(request: AbacCheckRequest): {
629
+ allowed: boolean;
630
+ isLoading: boolean;
631
+ };
632
+ /**
633
+ * Hook for requesting a magic sign-in link.
634
+ *
635
+ * Handles loading/sent/error state so you can build a fully-controlled
636
+ * "passwordless sign-in" form without any extra local state.
637
+ *
638
+ * @example
639
+ * ```tsx
640
+ * const { sendMagicLink, isLoading, isSent, error, reset } = useMagicLink();
641
+ *
642
+ * if (isSent) return <p>Check your inbox!</p>;
643
+ *
644
+ * return (
645
+ * <form onSubmit={e => { e.preventDefault(); sendMagicLink(email); }}>
646
+ * <input value={email} onChange={e => setEmail(e.target.value)} type="email" />
647
+ * <button type="submit" disabled={isLoading}>
648
+ * {isLoading ? 'Sending…' : 'Send sign-in link'}
649
+ * </button>
650
+ * {error && <p>{error}</p>}
651
+ * </form>
652
+ * );
653
+ * ```
654
+ */
655
+ declare function useMagicLink(): UseMagicLinkReturn;
656
+ /**
657
+ * Hook for email-first login flows.
658
+ *
659
+ * Checks whether an account exists for the given email before showing
660
+ * the password or magic-link step.
661
+ *
662
+ * @example
663
+ * ```tsx
664
+ * const { checkEmail, isLoading, exists, reset } = useEmailFirst();
665
+ *
666
+ * async function handleEmailSubmit(email: string) {
667
+ * const found = await checkEmail(email);
668
+ * if (found) {
669
+ * // show password / magic-link step
670
+ * } else {
671
+ * // show "no account found" or sign-up prompt
672
+ * }
673
+ * }
674
+ * ```
675
+ */
676
+ declare function useEmailFirst(): UseEmailFirstReturn;
677
+
678
+ export { type AppearanceProps, AuthCallback, type AuthCallbackProps, type AuthState, type AuthStatus, type LumoAuthContextValue, LumoAuthProvider, type LumoAuthProviderProps, type LumoAuthUser, Protect, type ProtectProps, RedirectToSignIn, type RedirectToSignInProps, SignIn, SignInButton, type SignInButtonProps, type SignInProps, SignOutButton, type SignOutButtonProps, SignUp, SignUpButton, type SignUpButtonProps, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, type UseEmailFirstReturn, type UseMagicLinkReturn, UserAvatar, type UserAvatarProps, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, useAbac, useAuth, useEmailFirst, useLumoAuth, useMagicLink, usePermission, useSession, useSignIn, useUser, useZanzibar };