@authowl/react 0.14.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.
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/THIRD_PARTY_NOTICES.md +36 -0
- package/dist/index.cjs +8243 -0
- package/dist/index.d.cts +825 -0
- package/dist/index.d.ts +825 -0
- package/dist/index.js +8151 -0
- package/dist/styles.css +350 -0
- package/package.json +74 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AuthConfig, Locale, AuthOwlClient, PublicConfig, ConsentStatus, OrganizationDetails, OrganizationMembership, HasParams, AuthUser, AuthClientError, SessionState, Organization, AuthOwlErrorCode } from '@authowl/core';
|
|
3
|
+
export { AuthOwlError, AuthPasskey, ConsentStatus, HasParams, InvalidKeyError, Organization, OrganizationDetails, OrganizationInvitation, OrganizationMember, OrganizationMemberWithUser, OrganizationMembership, OrganizationRoleSummary, OrganizationTeam, OrganizationUserInvitation, PublicConfig, RateLimitedError, createMembershipHas, membershipHas, membershipHasPermission, membershipHasTeam } from '@authowl/core';
|
|
4
|
+
|
|
5
|
+
type Appearance = {
|
|
6
|
+
theme?: 'light' | 'dark' | 'system';
|
|
7
|
+
/** Primary accent color (CSS color). Falls back to project branding. */
|
|
8
|
+
primaryColor?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Loading state of the fetched public config. */
|
|
11
|
+
type ConfigState = 'loading' | 'ready' | 'error';
|
|
12
|
+
type Ctx = {
|
|
13
|
+
client: AuthOwlClient;
|
|
14
|
+
appearance: Appearance | undefined;
|
|
15
|
+
/** Project public config (methods, social providers, branding). */
|
|
16
|
+
config: PublicConfig | null;
|
|
17
|
+
configState: ConfigState;
|
|
18
|
+
/** Resolved component locale (drives every t() call and the dir attribute). */
|
|
19
|
+
locale: Locale;
|
|
20
|
+
};
|
|
21
|
+
type AuthOwlProviderProps = AuthConfig & {
|
|
22
|
+
appearance?: Appearance;
|
|
23
|
+
/**
|
|
24
|
+
* Component locale. `'en' | 'ar'` forces it; `'auto'` detects from the host
|
|
25
|
+
* page (`<html lang/dir>`, then `navigator.language`); omitted = the
|
|
26
|
+
* project's default from public-config ('en' until the config loads).
|
|
27
|
+
*/
|
|
28
|
+
locale?: Locale | 'auto';
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
declare function AuthOwlProvider({ publishableKey, apiUrl, fetch, appearance, locale: localeProp, children, }: AuthOwlProviderProps): React.JSX.Element;
|
|
32
|
+
declare function useAuthOwlContext(): Ctx;
|
|
33
|
+
|
|
34
|
+
/** The active component locale (resolved by <AuthOwlProvider>). */
|
|
35
|
+
declare function useLocale(): "en" | "ar";
|
|
36
|
+
/**
|
|
37
|
+
* Bidi-isolate an LTR value (email address, manual key, code) embedded in a
|
|
38
|
+
* possibly-RTL sentence, so punctuation and order render correctly.
|
|
39
|
+
*/
|
|
40
|
+
declare function Bidi({ children }: {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Brand accent derivation (audit P1-5).
|
|
46
|
+
*
|
|
47
|
+
* The operator picks ONE brand color in the AuthOwl dashboard. This module turns
|
|
48
|
+
* that single hex into the full set of accent tokens the drop-in forms and the
|
|
49
|
+
* hosted account portal need - a filled button that IS the brand color, a
|
|
50
|
+
* contrast-correct label on it, perceptually-darkened hover/active states that
|
|
51
|
+
* stay ON hue, and a readable link/ring variant - WITHOUT the old
|
|
52
|
+
* `color-mix(in srgb, primary 40%, black)` that collapsed chroma to mud
|
|
53
|
+
* (gold #F5B84C -> #624A1E).
|
|
54
|
+
*
|
|
55
|
+
* The math is OKLab/OKLCH (Bjorn Ottosson) so lightness moves are perceptual and
|
|
56
|
+
* hue+chroma are preserved; contrast is WCAG 2.x relative luminance. Everything
|
|
57
|
+
* here is pure, synchronous, dependency-free and SSR-safe - `deriveBrandRamp`
|
|
58
|
+
* runs during render on the server (the portal's ramp is in the SSR HTML, so the
|
|
59
|
+
* brand is correct at first paint with zero client listeners).
|
|
60
|
+
*/
|
|
61
|
+
/** The single default brand color for BOTH the SDK forms and the hosted portal
|
|
62
|
+
* when an operator has not chosen one - the AuthOwl gold. Exported so the app
|
|
63
|
+
* (hosted portal) can default to the exact same value; one source of truth. */
|
|
64
|
+
declare const DEFAULT_BRAND_COLOR = "#F5B84C";
|
|
65
|
+
|
|
66
|
+
declare function useAuthClient(): AuthOwlClient;
|
|
67
|
+
type UseAccountResult = AuthOwlClient['account'];
|
|
68
|
+
/** Signed-in account profile, credential, session, provider, and deletion actions. */
|
|
69
|
+
declare function useAccount(): UseAccountResult;
|
|
70
|
+
type UsePublicConfigResult = {
|
|
71
|
+
config: PublicConfig | null;
|
|
72
|
+
isLoading: boolean;
|
|
73
|
+
isError: boolean;
|
|
74
|
+
};
|
|
75
|
+
/** The project's fetched public config (enabled methods, social providers, branding). */
|
|
76
|
+
declare function usePublicConfig(): UsePublicConfigResult;
|
|
77
|
+
declare function useSession(): SessionState;
|
|
78
|
+
type UseUserResult = {
|
|
79
|
+
/**
|
|
80
|
+
* Stays populated for a session held at required-MFA enrolment even though
|
|
81
|
+
* `isSignedIn` is false - <MFARequiredGate/>'s enrolment UI needs it.
|
|
82
|
+
* Gate app content on `isSignedIn`, not on `user`.
|
|
83
|
+
*/
|
|
84
|
+
user: AuthUser | null;
|
|
85
|
+
isLoaded: boolean;
|
|
86
|
+
/** False for a session held at required-MFA enrolment (CONTRACTS §5). */
|
|
87
|
+
isSignedIn: boolean;
|
|
88
|
+
/** The signed-in-enough-to-enrol state: route to <MFARequiredGate/>. */
|
|
89
|
+
needsMfaEnrollment: boolean;
|
|
90
|
+
error: AuthClientError | null;
|
|
91
|
+
};
|
|
92
|
+
declare function useUser(): UseUserResult;
|
|
93
|
+
type UseAuthResult = {
|
|
94
|
+
/** False while the session is still being fetched. */
|
|
95
|
+
isLoaded: boolean;
|
|
96
|
+
isSignedIn: boolean;
|
|
97
|
+
/** The signed-in user's id, else null. Consumers key token freshness on it. */
|
|
98
|
+
userId: string | null;
|
|
99
|
+
/** Active organization id (when the organization plugin is in use), else null. */
|
|
100
|
+
orgId: string | null;
|
|
101
|
+
/**
|
|
102
|
+
* Clerk-compatible: mint a short-lived JWT for third-party backends
|
|
103
|
+
* (Convex/Supabase/Hasura). Requires the project's JWT issuer toggle.
|
|
104
|
+
* Resolves null when signed out. Named templates use
|
|
105
|
+
* `{ template: 'convex' }`; `forceRefresh` bypasses only the selected entry.
|
|
106
|
+
*/
|
|
107
|
+
getToken: AuthOwlClient['getToken'];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Clerk-compatible auth snapshot + token minting. This is the hook
|
|
111
|
+
* `<ConvexProviderWithAuthOwl useAuth={useAuth}>` consumes - its shape mirrors
|
|
112
|
+
* what Clerk's `useAuth` provides to `ConvexProviderWithClerk`, so swapping
|
|
113
|
+
* providers is a one-line change.
|
|
114
|
+
*/
|
|
115
|
+
declare function useAuth(): UseAuthResult;
|
|
116
|
+
type UseOrganizationResult = {
|
|
117
|
+
/** The active organization's full details (members + invitations), or null. */
|
|
118
|
+
organization: OrganizationDetails | null;
|
|
119
|
+
/** The active-org membership: canonical role + advisory permission claim, or null. */
|
|
120
|
+
membership: OrganizationMembership | null;
|
|
121
|
+
/**
|
|
122
|
+
* Team ids the member holds in the active organization, from the session claim.
|
|
123
|
+
* Empty when they hold none; empty also when the session predates teams, so treat
|
|
124
|
+
* it as "no proven teams" rather than proof of absence.
|
|
125
|
+
*
|
|
126
|
+
* Teams are pure grouping - membership grants nothing by itself.
|
|
127
|
+
*/
|
|
128
|
+
teams: string[];
|
|
129
|
+
/** The member's active team within the active organization, or null. */
|
|
130
|
+
activeTeamId: string | null;
|
|
131
|
+
/**
|
|
132
|
+
* Clerk-style `has({ role?, permission?, teamId? })` bound to the active
|
|
133
|
+
* membership. PURE + advisory (reads the local session claim, never the server) -
|
|
134
|
+
* gate real authorization server-side over the verified token
|
|
135
|
+
* (`@authowl/next` `has()`).
|
|
136
|
+
*/
|
|
137
|
+
has: (params: HasParams) => boolean;
|
|
138
|
+
/** `hasPermission({ permission })` bound to the active membership. Pure + advisory. */
|
|
139
|
+
hasPermission: (params: {
|
|
140
|
+
permission: string;
|
|
141
|
+
}) => boolean;
|
|
142
|
+
/** False until the session (and, when there is an active org, its details) has loaded. */
|
|
143
|
+
isLoaded: boolean;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Active organization, its membership, and a bound `has()` - the permission-aware
|
|
147
|
+
* companion to <Protect role|permission>. `membership`/`has` resolve
|
|
148
|
+
* synchronously from the session claim (no fetch); `organization` is loaded from
|
|
149
|
+
* the active org when one is set. Advisory, like the rest of the client surface.
|
|
150
|
+
*/
|
|
151
|
+
declare function useOrganization(): UseOrganizationResult;
|
|
152
|
+
type UseSignInResult = {
|
|
153
|
+
/** Email + password sign-in. */
|
|
154
|
+
signIn: AuthOwlClient['signIn']['email'];
|
|
155
|
+
/** Username + password sign-in. */
|
|
156
|
+
signInUsername: AuthOwlClient['signIn']['username'];
|
|
157
|
+
/** Social provider sign-in (Google, GitHub, etc). */
|
|
158
|
+
signInSocial: AuthOwlClient['signIn']['social'];
|
|
159
|
+
/** Enterprise SSO (OIDC/SAML) sign-in - redirects to the tenant's IdP. */
|
|
160
|
+
signInSso: AuthOwlClient['signIn']['sso'];
|
|
161
|
+
/** Passwordless: email a one-time sign-in link. */
|
|
162
|
+
signInMagicLink: AuthOwlClient['signIn']['magicLink'];
|
|
163
|
+
/** Passwordless: sign in with a registered passkey (WebAuthn). */
|
|
164
|
+
signInPasskey: AuthOwlClient['signIn']['passkey'];
|
|
165
|
+
/** Passwordless: request an emailed one-time code. */
|
|
166
|
+
sendEmailOtp: AuthOwlClient['emailOtp']['sendVerificationOtp'];
|
|
167
|
+
/** Passwordless: complete sign-in with the emailed code. */
|
|
168
|
+
signInEmailOtp: AuthOwlClient['signIn']['emailOtp'];
|
|
169
|
+
/** Managed SMS: request a phone verification code. */
|
|
170
|
+
startPhoneOtp: AuthOwlClient['phoneOtp']['start'];
|
|
171
|
+
/** Managed SMS: verify the phone code and establish a session. */
|
|
172
|
+
verifyPhoneOtp: AuthOwlClient['phoneOtp']['verify'];
|
|
173
|
+
};
|
|
174
|
+
declare function useSignIn(): UseSignInResult;
|
|
175
|
+
type UsePasskeysResult = {
|
|
176
|
+
/** List the signed-in user's registered passkeys. */
|
|
177
|
+
listPasskeys: AuthOwlClient['passkey']['listUserPasskeys'];
|
|
178
|
+
/** Register a new passkey for the signed-in user. */
|
|
179
|
+
addPasskey: AuthOwlClient['passkey']['addPasskey'];
|
|
180
|
+
/** Rename an existing passkey. */
|
|
181
|
+
updatePasskey: AuthOwlClient['passkey']['updatePasskey'];
|
|
182
|
+
/** Remove an existing passkey. */
|
|
183
|
+
deletePasskey: AuthOwlClient['passkey']['deletePasskey'];
|
|
184
|
+
};
|
|
185
|
+
/** Passkey management for the signed-in user (drives {@link PasskeyManager}). */
|
|
186
|
+
declare function usePasskeys(): UsePasskeysResult;
|
|
187
|
+
type UseMFAResult = {
|
|
188
|
+
/** Begin TOTP enrolment (password-gated): returns the TOTP URI + backup codes. */
|
|
189
|
+
enable: AuthOwlClient['twoFactor']['enable'];
|
|
190
|
+
/** Turn two-factor off for the signed-in user (password-gated). */
|
|
191
|
+
disable: AuthOwlClient['twoFactor']['disable'];
|
|
192
|
+
/** Verify a TOTP code: activates a pending factor, or clears a sign-in challenge. */
|
|
193
|
+
verifyTotp: AuthOwlClient['twoFactor']['verifyTotp'];
|
|
194
|
+
/** Clear a sign-in challenge with a single-use backup code. */
|
|
195
|
+
verifyBackupCode: AuthOwlClient['twoFactor']['verifyBackupCode'];
|
|
196
|
+
/** Email a fallback second-factor code for the pending challenge (lost authenticator). */
|
|
197
|
+
sendOtp: AuthOwlClient['twoFactor']['sendOtp'];
|
|
198
|
+
/** Clear a sign-in challenge with the emailed fallback code. */
|
|
199
|
+
verifyOtp: AuthOwlClient['twoFactor']['verifyOtp'];
|
|
200
|
+
/** Regenerate the backup codes (password-gated), invalidating the previous set. */
|
|
201
|
+
regenerateBackupCodes: AuthOwlClient['twoFactor']['generateBackupCodes'];
|
|
202
|
+
};
|
|
203
|
+
/** TOTP two-factor actions (drives <MFAEnrollment/> and <MFAChallenge/>). */
|
|
204
|
+
declare function useMFA(): UseMFAResult;
|
|
205
|
+
type UsePasswordResetResult = {
|
|
206
|
+
/** Email a reset link to the user. */
|
|
207
|
+
requestPasswordReset: AuthOwlClient['requestPasswordReset'];
|
|
208
|
+
/** Set a new password with the token from the reset link. */
|
|
209
|
+
resetPassword: AuthOwlClient['resetPassword'];
|
|
210
|
+
};
|
|
211
|
+
/** Password-reset actions (drives <ForgotPassword/> and <ResetPassword/>). */
|
|
212
|
+
declare function usePasswordReset(): UsePasswordResetResult;
|
|
213
|
+
type UseEmailVerificationResult = {
|
|
214
|
+
/** (Re)send the email-verification link. */
|
|
215
|
+
sendVerificationEmail: AuthOwlClient['sendVerificationEmail'];
|
|
216
|
+
/** Send an email ownership-verification code. */
|
|
217
|
+
sendVerificationCode: AuthOwlClient['emailOtp']['sendVerificationOtp'];
|
|
218
|
+
/** Verify an email ownership code. */
|
|
219
|
+
verifyEmailCode: AuthOwlClient['emailOtp']['verifyEmail'];
|
|
220
|
+
};
|
|
221
|
+
/** Email-verification actions for link and code ceremonies. */
|
|
222
|
+
declare function useEmailVerification(): UseEmailVerificationResult;
|
|
223
|
+
type UseConsentResult = {
|
|
224
|
+
/** Consent status is still being fetched. */
|
|
225
|
+
isLoading: boolean;
|
|
226
|
+
/** The signed-in user must (re-)accept the current terms version to continue. */
|
|
227
|
+
needsConsent: boolean;
|
|
228
|
+
/** Full status (version + doc URLs) once loaded. */
|
|
229
|
+
status: ConsentStatus | null;
|
|
230
|
+
/** Record acceptance of the current version, then refresh (clears needsConsent). */
|
|
231
|
+
accept: () => Promise<void>;
|
|
232
|
+
/** Re-fetch the status (e.g. after the user navigates back). */
|
|
233
|
+
refresh: () => Promise<void>;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Legal-consent status for the signed-in user, driving the re-consent gate: when
|
|
237
|
+
* the operator bumps the terms version, `needsConsent` flips true until the user
|
|
238
|
+
* accepts. Re-fetches when the signed-in identity changes (sign-in/out). Used by
|
|
239
|
+
* <ConsentGate/>; also usable standalone.
|
|
240
|
+
*/
|
|
241
|
+
declare function useConsent(): UseConsentResult;
|
|
242
|
+
type UseSignUpResult = {
|
|
243
|
+
signUp: AuthOwlClient['signUp']['email'];
|
|
244
|
+
};
|
|
245
|
+
declare function useSignUp(): UseSignUpResult;
|
|
246
|
+
type UseWaitlistResult = AuthOwlClient['waitlist'];
|
|
247
|
+
declare function useWaitlist(): UseWaitlistResult;
|
|
248
|
+
type UseSignOutResult = {
|
|
249
|
+
signOut: AuthOwlClient['signOut'];
|
|
250
|
+
};
|
|
251
|
+
declare function useSignOut(): UseSignOutResult;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Pure, DOM-free resolution of which sign-in surfaces to render from a project's
|
|
255
|
+
* public config. Kept out of <SignIn/> so the branching is unit-testable without
|
|
256
|
+
* a renderer, and so the "which methods, and why nothing" decision lives in one
|
|
257
|
+
* place.
|
|
258
|
+
*/
|
|
259
|
+
/** Method slugs the SDK can render a UI for (server contract, canonical snake_case). */
|
|
260
|
+
declare const KNOWN_METHODS: readonly ["password", "magic_link", "email_otp", "phone_otp", "passkey", "sso"];
|
|
261
|
+
type KnownMethod = (typeof KNOWN_METHODS)[number];
|
|
262
|
+
/**
|
|
263
|
+
* Which email input carries the `webauthn` autocomplete token for passkey
|
|
264
|
+
* conditional mediation. Exactly one input can host it, so this names the first
|
|
265
|
+
* email-bearing method in render-priority order (or null when passkey is off /
|
|
266
|
+
* there is no email input to attach to).
|
|
267
|
+
*/
|
|
268
|
+
type AutofillHost = 'password' | 'magic_link' | 'email_otp' | 'sso' | null;
|
|
269
|
+
/**
|
|
270
|
+
* The primary sign-in action - the one bound to <SignIn/>'s form submit (Enter
|
|
271
|
+
* key), rendered as the single filled button. Password wins when enabled;
|
|
272
|
+
* otherwise the first passwordless email method in priority order. The other
|
|
273
|
+
* email methods render as secondary (outlined) buttons reusing the same email.
|
|
274
|
+
* `null` when no email method is enabled (social/passkey only). SSO is last in
|
|
275
|
+
* priority: it is the filled submit only when it is the sole email method.
|
|
276
|
+
*/
|
|
277
|
+
type SignInPrimary = 'password' | 'magic' | 'otp' | 'sso' | null;
|
|
278
|
+
type SignInPlan = {
|
|
279
|
+
password: boolean;
|
|
280
|
+
username: boolean;
|
|
281
|
+
magicLink: boolean;
|
|
282
|
+
emailOtp: boolean;
|
|
283
|
+
phoneOtp: boolean;
|
|
284
|
+
passkey: boolean;
|
|
285
|
+
/** Inbound enterprise SSO - an email-domain-resolved redirect method. */
|
|
286
|
+
sso: boolean;
|
|
287
|
+
social: string[];
|
|
288
|
+
/** True when at least one surface can render. */
|
|
289
|
+
renderable: boolean;
|
|
290
|
+
/** The primary action (filled submit button); see {@link SignInPrimary}. */
|
|
291
|
+
primary: SignInPrimary;
|
|
292
|
+
/**
|
|
293
|
+
* Why nothing renders, when `renderable` is false:
|
|
294
|
+
* - 'unsupported': the project enabled only methods this SDK build cannot show
|
|
295
|
+
* (the consumer needs to upgrade the SDK);
|
|
296
|
+
* - 'none': the project has no sign-in methods enabled at all.
|
|
297
|
+
*/
|
|
298
|
+
emptyReason: 'unsupported' | 'none' | null;
|
|
299
|
+
/**
|
|
300
|
+
* The single email input that should arm passkey autofill. The priority order
|
|
301
|
+
* here MUST match the order <SignIn/> renders these methods, so the token lands
|
|
302
|
+
* on the first visible email field.
|
|
303
|
+
*/
|
|
304
|
+
autofillHost: AutofillHost;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Autocomplete value for a sign-in email input. Appends the WebAuthn token when
|
|
308
|
+
* this input is the passkey conditional-mediation host so the browser surfaces
|
|
309
|
+
* passkeys inline. One place owns the token string.
|
|
310
|
+
*/
|
|
311
|
+
declare function emailAutocomplete(isPasskeyHost: boolean): string;
|
|
312
|
+
/**
|
|
313
|
+
* Resolve the sign-in surfaces from a project's public config. On a config error
|
|
314
|
+
* (`config` null) fall back to password - the safe default that always renders -
|
|
315
|
+
* rather than showing nothing.
|
|
316
|
+
*/
|
|
317
|
+
declare function resolveSignInMethods(config: PublicConfig | null): SignInPlan;
|
|
318
|
+
|
|
319
|
+
type SignInProps = {
|
|
320
|
+
redirectTo?: string;
|
|
321
|
+
/** Optional callback after successful sign-in. */
|
|
322
|
+
onSignedIn?: () => void;
|
|
323
|
+
/**
|
|
324
|
+
* URL of your reset page (where <ResetPassword/> is mounted). When set and
|
|
325
|
+
* password sign-in is enabled, a "Forgot password?" link appears that switches
|
|
326
|
+
* to an inline reset-request form. Omit it to hide the link.
|
|
327
|
+
*/
|
|
328
|
+
resetPasswordUrl?: string;
|
|
329
|
+
/**
|
|
330
|
+
* Force the "Secured by AuthOwl" badge on even when the plan would hide it
|
|
331
|
+
* (paid/comped projects). Free projects always show it regardless.
|
|
332
|
+
*/
|
|
333
|
+
showBadge?: boolean;
|
|
334
|
+
};
|
|
335
|
+
declare function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge }?: SignInProps): React.JSX.Element;
|
|
336
|
+
|
|
337
|
+
type PhoneOTPProps = {
|
|
338
|
+
redirectTo?: string;
|
|
339
|
+
onSignedIn?: () => void;
|
|
340
|
+
/** Optional navigation affordance when embedded in another sign-in surface. */
|
|
341
|
+
onBack?: () => void;
|
|
342
|
+
};
|
|
343
|
+
/** Egyptian phone sign-in with managed Turnstile, retry-safe send, and code verification. */
|
|
344
|
+
declare function PhoneOTP({ redirectTo, onSignedIn, onBack }: PhoneOTPProps): React.JSX.Element;
|
|
345
|
+
|
|
346
|
+
type SignUpProps = {
|
|
347
|
+
redirectTo?: string;
|
|
348
|
+
onSignedUp?: () => void;
|
|
349
|
+
/**
|
|
350
|
+
* URL of your verify page (where <VerifyEmail/> is mounted). When the project
|
|
351
|
+
* requires email verification, the emailed link redirects here after confirming.
|
|
352
|
+
* Passed as the sign-up callbackURL; its origin must be an allowed origin.
|
|
353
|
+
*/
|
|
354
|
+
verifyEmailUrl?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Force the "Secured by AuthOwl" badge on even when the plan would hide it
|
|
357
|
+
* (paid/comped projects). Free projects always show it regardless.
|
|
358
|
+
*/
|
|
359
|
+
showBadge?: boolean;
|
|
360
|
+
/** Called after an enrollment request is accepted while waitlist mode is active. */
|
|
361
|
+
onWaitlisted?: () => void;
|
|
362
|
+
};
|
|
363
|
+
declare function SignUp({ redirectTo, onSignedUp, verifyEmailUrl, showBadge, onWaitlisted, }?: SignUpProps): React.JSX.Element;
|
|
364
|
+
|
|
365
|
+
type WaitlistProps = {
|
|
366
|
+
onJoined?: () => void;
|
|
367
|
+
/**
|
|
368
|
+
* Force the "Secured by AuthOwl" badge on even when the plan would hide it.
|
|
369
|
+
* Free projects always show it regardless.
|
|
370
|
+
*/
|
|
371
|
+
showBadge?: boolean;
|
|
372
|
+
};
|
|
373
|
+
declare function Waitlist({ onJoined, showBadge }?: WaitlistProps): React.JSX.Element;
|
|
374
|
+
|
|
375
|
+
type ConsentGateProps = {
|
|
376
|
+
/** The protected app content shown once consent is satisfied. */
|
|
377
|
+
children: React.ReactNode;
|
|
378
|
+
/** Optional heading for the re-consent screen. */
|
|
379
|
+
title?: string;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Re-consent gate for signed-in users: when the operator bumps the project's
|
|
383
|
+
* legal terms version, this interposes an "accept the updated terms" screen
|
|
384
|
+
* until the user accepts, then renders {@link children}.
|
|
385
|
+
*
|
|
386
|
+
* Non-blocking by design — until the status resolves (and whenever consent isn't
|
|
387
|
+
* needed, the overwhelmingly common case) it renders children immediately, so it
|
|
388
|
+
* costs nothing to wrap your app with. It's a UX affordance; the authoritative
|
|
389
|
+
* enforcement and recording happen server-side. Signed-out users and projects
|
|
390
|
+
* without an active consent gate always pass through.
|
|
391
|
+
*/
|
|
392
|
+
declare function ConsentGate({ children, title }: ConsentGateProps): React.JSX.Element;
|
|
393
|
+
|
|
394
|
+
type MFARequiredGateProps = {
|
|
395
|
+
/** The protected app content shown once the session is fully authenticated. */
|
|
396
|
+
children: React.ReactNode;
|
|
397
|
+
/** Optional heading for the enrolment screen. */
|
|
398
|
+
title?: string;
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* Required-MFA gate (B.5c): on projects with "Require MFA for everyone", a
|
|
402
|
+
* factor-less user's session is held at enrolment (CONTRACTS §5) - `useUser`
|
|
403
|
+
* reads it as signed OUT while `needsMfaEnrollment` is true. Wrap your app in
|
|
404
|
+
* this gate to interpose the enrolment screen until the user activates a
|
|
405
|
+
* factor; free to wrap unconditionally (it renders children untouched in
|
|
406
|
+
* every other state, same non-blocking design as <ConsentGate/>).
|
|
407
|
+
*
|
|
408
|
+
* PLACEMENT: the gate must wrap a layout that includes your SIGN-IN route.
|
|
409
|
+
* Server pages that `redirect('/sign-in')` on a null `auth()` bounce pending
|
|
410
|
+
* users there (a pending session reads as signed out server-side) - if the
|
|
411
|
+
* gate only wraps protected content, they re-sign-in into another pending
|
|
412
|
+
* session without ever seeing enrolment.
|
|
413
|
+
*
|
|
414
|
+
* Before showing enrolment it CONFIRMS with an uncached session read: the
|
|
415
|
+
* cookie-cached pending flag can be stale-true for up to 5 minutes after
|
|
416
|
+
* another device completed enrolment, and re-running enrolment would
|
|
417
|
+
* regenerate the user's TOTP secret.
|
|
418
|
+
*/
|
|
419
|
+
declare function MFARequiredGate({ children, title }: MFARequiredGateProps): React.JSX.Element | null;
|
|
420
|
+
|
|
421
|
+
type BackupCodesManagerProps = {
|
|
422
|
+
/** Optional heading; pass null to hide it. */
|
|
423
|
+
title?: string | null;
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Backup-codes management (B.5d): regenerate the signed-in user's single-use
|
|
427
|
+
* backup codes (password-confirmed; the previous set stops working) and show
|
|
428
|
+
* the new set ONCE. Renders nothing for users without 2FA enrolled - mount it
|
|
429
|
+
* unconditionally in an account/security page alongside <MFAEnrollment/>.
|
|
430
|
+
*/
|
|
431
|
+
declare function BackupCodesManager({ title }: BackupCodesManagerProps): React.JSX.Element | null;
|
|
432
|
+
|
|
433
|
+
type ConsentDocLinksProps = {
|
|
434
|
+
termsUrl?: string;
|
|
435
|
+
privacyUrl?: string;
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* Renders the "Terms of Service and Privacy Policy" links for whichever docs the
|
|
439
|
+
* project configured (one, the other, or both joined with "and"). Returns null
|
|
440
|
+
* when neither is set. Shared by <SignUp/>'s consent checkbox and <ConsentGate/>
|
|
441
|
+
* so the link copy lives in one place. The caller supplies the surrounding
|
|
442
|
+
* sentence ("I agree to the …", "We've updated our …").
|
|
443
|
+
*/
|
|
444
|
+
declare function ConsentDocLinks({ termsUrl, privacyUrl }: ConsentDocLinksProps): React.JSX.Element | null;
|
|
445
|
+
|
|
446
|
+
type SocialButtonsProps = {
|
|
447
|
+
providers: string[];
|
|
448
|
+
/** Where to send the browser after the OAuth round-trip. */
|
|
449
|
+
callbackURL?: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Renders one "Continue with <provider>" button per configured social provider.
|
|
453
|
+
* A social sign-in also creates the account on first use, so this is shared by
|
|
454
|
+
* both <SignIn/> and <SignUp/>.
|
|
455
|
+
*/
|
|
456
|
+
declare function SocialButtons({ providers, callbackURL }: SocialButtonsProps): React.JSX.Element | null;
|
|
457
|
+
|
|
458
|
+
type MagicLinkFormProps = {
|
|
459
|
+
/** Where to land after the emailed link is followed. */
|
|
460
|
+
callbackURL?: string;
|
|
461
|
+
/** Append the `webauthn` autofill token to the email input (passkey host). */
|
|
462
|
+
webauthnAutofill?: boolean;
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Passwordless magic-link request: collects an email and asks the server to send
|
|
466
|
+
* a one-time sign-in link. No session is issued here - the session is created
|
|
467
|
+
* when the user follows the emailed link, so there is no redirect on submit.
|
|
468
|
+
*/
|
|
469
|
+
declare function MagicLinkForm({ callbackURL, webauthnAutofill }: MagicLinkFormProps): React.JSX.Element;
|
|
470
|
+
|
|
471
|
+
type EmailOtpFormProps = {
|
|
472
|
+
redirectTo?: string;
|
|
473
|
+
/** Called after the code is verified and a session is issued. */
|
|
474
|
+
onSignedIn?: () => void;
|
|
475
|
+
/** Append the `webauthn` autofill token to the email input (passkey host). */
|
|
476
|
+
webauthnAutofill?: boolean;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Passwordless email one-time-code sign-in, in two stages: request a code for an
|
|
480
|
+
* email, then verify the emailed code to complete sign-in. A session is issued
|
|
481
|
+
* on successful verification (unlike magic-link, which round-trips via email).
|
|
482
|
+
*/
|
|
483
|
+
declare function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }: EmailOtpFormProps): React.JSX.Element;
|
|
484
|
+
|
|
485
|
+
type PasskeyButtonProps = {
|
|
486
|
+
redirectTo?: string;
|
|
487
|
+
/** Called after a passkey ceremony issues a session. */
|
|
488
|
+
onSignedIn?: () => void;
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Explicit passkey (WebAuthn) sign-in: opens the browser's passkey prompt on
|
|
492
|
+
* click. Complements the inline conditional-mediation autofill armed by
|
|
493
|
+
* <SignIn/> - the button always works even where autofill is unavailable.
|
|
494
|
+
*/
|
|
495
|
+
declare function PasskeyButton({ redirectTo, onSignedIn }: PasskeyButtonProps): React.JSX.Element;
|
|
496
|
+
|
|
497
|
+
type ForgotPasswordProps = {
|
|
498
|
+
/**
|
|
499
|
+
* The URL of your reset page (where <ResetPassword/> is mounted). The emailed
|
|
500
|
+
* link validates the token then redirects here with `?token=`. Its origin must
|
|
501
|
+
* be one of the project's allowed origins.
|
|
502
|
+
*/
|
|
503
|
+
resetPasswordUrl?: string;
|
|
504
|
+
/** Optional "back to sign in" affordance (shown when embedded in <SignIn/>). */
|
|
505
|
+
onBack?: () => void;
|
|
506
|
+
};
|
|
507
|
+
/**
|
|
508
|
+
* Request a password-reset email. Always shows the same neutral confirmation on
|
|
509
|
+
* success - the server returns success for unknown emails too (anti-enumeration),
|
|
510
|
+
* so the UI must not reveal whether an account exists.
|
|
511
|
+
*/
|
|
512
|
+
declare function ForgotPassword({ resetPasswordUrl, onBack }: ForgotPasswordProps): React.JSX.Element;
|
|
513
|
+
|
|
514
|
+
type ResetPasswordProps = {
|
|
515
|
+
/** The reset token; if omitted, read from the `?token=` query param on mount. */
|
|
516
|
+
token?: string;
|
|
517
|
+
/** Where to send the user after a successful reset (e.g. your sign-in page). */
|
|
518
|
+
redirectTo?: string;
|
|
519
|
+
/** Called after the password is reset. */
|
|
520
|
+
onReset?: () => void;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Set a new password from a reset link. Mount this on the page your
|
|
524
|
+
* `resetPasswordUrl` points at: the link redirects here with `?token=`, which
|
|
525
|
+
* this reads (unless a `token` prop is passed). On success it redirects to
|
|
526
|
+
* `redirectTo` (same-origin/relative only).
|
|
527
|
+
*/
|
|
528
|
+
declare function ResetPassword({ token: tokenProp, redirectTo, onReset }: ResetPasswordProps): React.JSX.Element;
|
|
529
|
+
|
|
530
|
+
type VerifyEmailProps = {
|
|
531
|
+
/** Where to send the user after a successful verification - your sign-in page. */
|
|
532
|
+
redirectTo?: string;
|
|
533
|
+
/** Called once when the page loads in the verified (no-error) state. */
|
|
534
|
+
onVerified?: () => void;
|
|
535
|
+
/** Where a resent link should land; defaults to this page's own URL. */
|
|
536
|
+
callbackURL?: string;
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Landing page for the verification link. The server confirms the address (it
|
|
540
|
+
* does NOT sign the user in - verification is login-CSRF-safe), then redirects
|
|
541
|
+
* here, appending `?error=CODE` only on failure. So this reads the outcome from
|
|
542
|
+
* the URL: success shows a confirmation and can redirect to your sign-in page;
|
|
543
|
+
* failure offers a resend. Point `redirectTo` at your sign-in route.
|
|
544
|
+
*/
|
|
545
|
+
declare function VerifyEmail({ redirectTo, onVerified, callbackURL }: VerifyEmailProps): React.JSX.Element;
|
|
546
|
+
|
|
547
|
+
type VerificationPendingProps = {
|
|
548
|
+
/** The address the verification link or code was sent to. */
|
|
549
|
+
email: string;
|
|
550
|
+
/** Where the link should land after confirming (your <VerifyEmail/> page). */
|
|
551
|
+
callbackURL?: string;
|
|
552
|
+
/** Ownership-verification ceremony selected by the AuthOwl project. */
|
|
553
|
+
method?: 'link' | 'code';
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* "Check your email" panel shown after a sign-up that requires verification. Lets
|
|
557
|
+
* the user resend the link. Rendered by <SignUp/>; also usable standalone.
|
|
558
|
+
*/
|
|
559
|
+
declare function VerificationPending({ email, callbackURL, method, }: VerificationPendingProps): React.JSX.Element;
|
|
560
|
+
|
|
561
|
+
type PasskeyManagerProps = {
|
|
562
|
+
/** Heading text; pass `null` to render without a heading. */
|
|
563
|
+
title?: string | null;
|
|
564
|
+
/** Whether project policy permits registering a new passkey. */
|
|
565
|
+
allowAdd?: boolean;
|
|
566
|
+
};
|
|
567
|
+
/**
|
|
568
|
+
* Drop-in passkey management for the signed-in user: list, register, rename, and
|
|
569
|
+
* remove passkeys. Requires an authenticated session.
|
|
570
|
+
*
|
|
571
|
+
* The stateful body is keyed on the user id: on an account switch React remounts
|
|
572
|
+
* it, so any in-flight load or mutation from the previous user resolves against
|
|
573
|
+
* an unmounted instance (a no-op) and can never surface stale errors, pending
|
|
574
|
+
* state, or another account's passkeys on the new user's UI.
|
|
575
|
+
*/
|
|
576
|
+
declare function PasskeyManager({ title, allowAdd }?: PasskeyManagerProps): React.JSX.Element;
|
|
577
|
+
|
|
578
|
+
type MFAEnrollmentProps = {
|
|
579
|
+
/** Called once the factor is verified and active. */
|
|
580
|
+
onEnrolled?: () => void;
|
|
581
|
+
/** Heading text; pass `null` when a parent section owns the heading. */
|
|
582
|
+
title?: string | null;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* TOTP enrolment for the signed-in user: confirm the password, scan the QR (or
|
|
586
|
+
* enter the secret manually) into an authenticator app, save the one-time backup
|
|
587
|
+
* codes, then verify a live code to activate. The factor is NOT active until that
|
|
588
|
+
* final verification, so an abandoned setup never half-enrols the account.
|
|
589
|
+
*/
|
|
590
|
+
declare function MFAEnrollment({ onEnrolled, title }: MFAEnrollmentProps): React.JSX.Element;
|
|
591
|
+
|
|
592
|
+
type MFAChallengeProps = {
|
|
593
|
+
/** Called once the challenge clears and a session is issued. */
|
|
594
|
+
onVerified?: () => void | Promise<void>;
|
|
595
|
+
/** Show the "trust this device for 30 days" option on the TOTP step (default true). */
|
|
596
|
+
allowTrustDevice?: boolean;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* The sign-in second-factor prompt: a user with 2FA enrolled gets no session until
|
|
600
|
+
* they clear this. Accepts a TOTP code or, as a fallback, a single-use backup code.
|
|
601
|
+
* Rendered automatically by <SignIn/> when the server withholds the session behind
|
|
602
|
+
* a 2FA challenge; also usable standalone.
|
|
603
|
+
*/
|
|
604
|
+
declare function MFAChallenge({ onVerified, allowTrustDevice }: MFAChallengeProps): React.JSX.Element;
|
|
605
|
+
|
|
606
|
+
type AuthOwlBadgeProps = {
|
|
607
|
+
/** Override the link target (defaults to the AuthOwl site). */
|
|
608
|
+
href?: string;
|
|
609
|
+
/**
|
|
610
|
+
* Render the badge even when the plan would hide it (paid/comped projects).
|
|
611
|
+
* Free projects always show it. Use this to keep the "Secured by AuthOwl"
|
|
612
|
+
* attribution visible on a paid project by choice.
|
|
613
|
+
*/
|
|
614
|
+
force?: boolean;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* "Secured by AuthOwl" attribution. Shown on free-plan projects and hidden on
|
|
618
|
+
* paid plans - the server sets `config.badge` from the workspace's entitled plan,
|
|
619
|
+
* so this renders when `badge` is true (or when `force` is set). Auto-rendered at
|
|
620
|
+
* the foot of <SignIn/> and <SignUp/>; also exported so headless consumers can
|
|
621
|
+
* place it themselves.
|
|
622
|
+
*
|
|
623
|
+
* It is a plain client element: a consumer can hide it with CSS. Removing it on
|
|
624
|
+
* the free plan is a terms-of-service matter, not a technical control - the same
|
|
625
|
+
* posture every embeddable auth widget takes.
|
|
626
|
+
*/
|
|
627
|
+
declare function AuthOwlBadge({ href, force }?: AuthOwlBadgeProps): React.JSX.Element | null;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Conditional-render helpers gated on the client session. They render nothing
|
|
631
|
+
* until the session has loaded (avoids a signed-out flash), then show/hide.
|
|
632
|
+
*
|
|
633
|
+
* IMPORTANT: these are UX affordances, NOT a security boundary. The session they
|
|
634
|
+
* read lives in the browser and can be spoofed; never gate access to secret data
|
|
635
|
+
* or privileged actions on them. Enforce real authorization on the server (verify
|
|
636
|
+
* the session with @authowl/next's `auth()` in a route handler / server
|
|
637
|
+
* component). Same posture as Clerk's `<SignedIn>`/`<Protect>`.
|
|
638
|
+
*/
|
|
639
|
+
type SignedInProps = {
|
|
640
|
+
children: React.ReactNode;
|
|
641
|
+
};
|
|
642
|
+
/** Renders its children only when a user is signed in. */
|
|
643
|
+
declare function SignedIn({ children }: SignedInProps): React.JSX.Element | null;
|
|
644
|
+
type SignedOutProps = {
|
|
645
|
+
children: React.ReactNode;
|
|
646
|
+
};
|
|
647
|
+
/** Renders its children only when no user is signed in (once loaded). */
|
|
648
|
+
declare function SignedOut({ children }: SignedOutProps): React.JSX.Element | null;
|
|
649
|
+
type ProtectProps = {
|
|
650
|
+
children: React.ReactNode;
|
|
651
|
+
/** Shown instead of the children when the user is signed out or fails a gate. */
|
|
652
|
+
fallback?: React.ReactNode;
|
|
653
|
+
/**
|
|
654
|
+
* Require the active organization membership's role to match (built-in
|
|
655
|
+
* `owner`/`admin`/`member` or a project role key). Read from the client
|
|
656
|
+
* session claim.
|
|
657
|
+
*/
|
|
658
|
+
role?: string;
|
|
659
|
+
/**
|
|
660
|
+
* Require the active organization membership to grant this permission -
|
|
661
|
+
* `org:sys_*` or a custom `org:<feature>:<action>` id. Evaluated against the
|
|
662
|
+
* LOCAL session claim (never a statement-only has-permission route).
|
|
663
|
+
*/
|
|
664
|
+
permission?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Require membership of this team within the active organization. Teams are pure
|
|
667
|
+
* grouping, so this gates on WHICH GROUP someone is in, not on authority. A
|
|
668
|
+
* session predating teams proves no team and fails the gate.
|
|
669
|
+
*/
|
|
670
|
+
teamId?: string;
|
|
671
|
+
/** Extra gate on the signed-in user (e.g. a custom flag). Signed-in is always required. */
|
|
672
|
+
condition?: (user: AuthUser) => boolean;
|
|
673
|
+
};
|
|
674
|
+
/**
|
|
675
|
+
* Renders `children` when the user is signed in AND passes every provided gate
|
|
676
|
+
* (`role`, `permission`, `condition` - all must pass), otherwise `fallback`.
|
|
677
|
+
* Renders nothing until the session has loaded.
|
|
678
|
+
*
|
|
679
|
+
* ADVISORY ONLY. `role`/`permission` here are a UX affordance read from the
|
|
680
|
+
* browser session claim, which a client can spoof - gating custom-permission UI
|
|
681
|
+
* this way hides controls, it does NOT secure them. Enforce the real boundary
|
|
682
|
+
* server-side over a VERIFIED project token (`@authowl/next`'s server `has()`),
|
|
683
|
+
* which checks the token signature before trusting any membership claim (§5).
|
|
684
|
+
*/
|
|
685
|
+
declare function Protect({ children, fallback, role, permission, teamId, condition, }: ProtectProps): React.JSX.Element | null;
|
|
686
|
+
type AuthLoadingProps = {
|
|
687
|
+
/**
|
|
688
|
+
* Shown while the session is still bootstrapping. Defaults to a centered
|
|
689
|
+
* spinner with an sr-only "Loading…" label, so the common case is a
|
|
690
|
+
* self-closing `<AuthLoading />`.
|
|
691
|
+
*/
|
|
692
|
+
children?: React.ReactNode;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Renders while the client session is still loading (`!useUser().isLoaded`),
|
|
696
|
+
* then nothing. Pair it as a SIBLING of `<SignedIn>`/`<SignedOut>` to cover the
|
|
697
|
+
* blank window after a page load or SSO/redirect landing before the session
|
|
698
|
+
* resolves. This is the Clerk-style split (`<AuthLoading>`/`<AuthLoaded>`)
|
|
699
|
+
* rather than a `loading` prop on `<SignedIn>`/`<SignedOut>`: those render as
|
|
700
|
+
* siblings, so per-component fallbacks would paint two spinners at once. One
|
|
701
|
+
* `<AuthLoading>` owns the loading window.
|
|
702
|
+
*/
|
|
703
|
+
declare function AuthLoading({ children }: AuthLoadingProps): React.JSX.Element | null;
|
|
704
|
+
type AuthLoadedProps = {
|
|
705
|
+
children: React.ReactNode;
|
|
706
|
+
};
|
|
707
|
+
/** Renders its children only once the session has finished loading. */
|
|
708
|
+
declare function AuthLoaded({ children }: AuthLoadedProps): React.JSX.Element | null;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Decorative loading spinner (`.ba-spinner`). It carries no text, so pair it
|
|
712
|
+
* with a visible label (as `<Busy>` does on action buttons) or an sr-only label
|
|
713
|
+
* (as `<AuthLoading>` does): on its own it is `aria-hidden` and invisible to
|
|
714
|
+
* assistive tech. RTL-safe and reduced-motion-aware via CSS in `styles.css`.
|
|
715
|
+
*/
|
|
716
|
+
declare function Spinner(): React.JSX.Element;
|
|
717
|
+
|
|
718
|
+
type SignOutButtonProps = {
|
|
719
|
+
/** Button label (defaults to "Sign out"). */
|
|
720
|
+
children?: React.ReactNode;
|
|
721
|
+
/** Where to navigate after sign-out (same-origin/relative only). */
|
|
722
|
+
redirectTo?: string;
|
|
723
|
+
/** Called after the session is cleared. */
|
|
724
|
+
onSignedOut?: () => void;
|
|
725
|
+
className?: string;
|
|
726
|
+
};
|
|
727
|
+
/**
|
|
728
|
+
* Standalone sign-out button. Clears the session, then notifies and redirects
|
|
729
|
+
* (same-origin/relative targets only). For a menu with avatar + sign-out, use
|
|
730
|
+
* <UserButton/> instead.
|
|
731
|
+
*/
|
|
732
|
+
declare function SignOutButton({ children, redirectTo, onSignedOut, className }: SignOutButtonProps): React.JSX.Element;
|
|
733
|
+
|
|
734
|
+
declare function UserButton(): React.JSX.Element | null;
|
|
735
|
+
|
|
736
|
+
declare const USER_PROFILE_SECTIONS: readonly ["profile", "email", "password", "social", "sessions", "passkeys", "mfa", "recovery", "danger"];
|
|
737
|
+
type UserProfileSection = (typeof USER_PROFILE_SECTIONS)[number];
|
|
738
|
+
|
|
739
|
+
type UserProfileSharedProps = {
|
|
740
|
+
/** Controlled active section. */
|
|
741
|
+
section?: UserProfileSection;
|
|
742
|
+
/** Initial section when uncontrolled. Falls back to the AuthOwl URL hash. */
|
|
743
|
+
defaultSection?: UserProfileSection;
|
|
744
|
+
onSectionChange?: (section: UserProfileSection) => void;
|
|
745
|
+
/** Called after the signed-in account is permanently deleted. */
|
|
746
|
+
onDeleted?: () => void;
|
|
747
|
+
};
|
|
748
|
+
type UserProfileProps = UserProfileSharedProps & ({
|
|
749
|
+
/** Render the account settings inline. */
|
|
750
|
+
mode?: 'page';
|
|
751
|
+
onClose?: never;
|
|
752
|
+
} | {
|
|
753
|
+
/** Render an accessible account-settings overlay. */
|
|
754
|
+
mode: 'modal';
|
|
755
|
+
/** Called by the close button, backdrop, or Escape key. */
|
|
756
|
+
onClose: () => void;
|
|
757
|
+
});
|
|
758
|
+
declare function UserProfile(props?: UserProfileProps): React.JSX.Element;
|
|
759
|
+
|
|
760
|
+
type OrganizationSwitcherProps = {
|
|
761
|
+
showPersonalWorkspace?: boolean;
|
|
762
|
+
onOrganizationChange?: (organization: Organization | null) => void;
|
|
763
|
+
};
|
|
764
|
+
declare function OrganizationSwitcher({ showPersonalWorkspace, onOrganizationChange }?: OrganizationSwitcherProps): React.JSX.Element | null;
|
|
765
|
+
|
|
766
|
+
type OrganizationListProps = {
|
|
767
|
+
onOrganizationChange?: (organization: Organization | null) => void;
|
|
768
|
+
};
|
|
769
|
+
declare function OrganizationList({ onOrganizationChange }?: OrganizationListProps): React.JSX.Element | null;
|
|
770
|
+
|
|
771
|
+
type CreateOrganizationProps = {
|
|
772
|
+
onCreated?: (organization: Organization) => void;
|
|
773
|
+
/** Hide the component heading when a surrounding dialog already supplies it. */
|
|
774
|
+
title?: string | null;
|
|
775
|
+
};
|
|
776
|
+
declare function CreateOrganization({ onCreated, title }?: CreateOrganizationProps): React.JSX.Element | null;
|
|
777
|
+
|
|
778
|
+
type OrganizationProfileSection = 'general' | 'members' | 'invitations' | 'danger';
|
|
779
|
+
|
|
780
|
+
type OrganizationProfileProps = {
|
|
781
|
+
/** Organization to manage. Omitted means the active organization from the session. */
|
|
782
|
+
organizationId?: string;
|
|
783
|
+
defaultSection?: OrganizationProfileSection;
|
|
784
|
+
onDeleted?: (organization: OrganizationDetails) => void;
|
|
785
|
+
onLeft?: (organization: OrganizationDetails) => void;
|
|
786
|
+
};
|
|
787
|
+
declare function OrganizationProfile({ organizationId, defaultSection, onDeleted, onLeft }?: OrganizationProfileProps): React.JSX.Element | null;
|
|
788
|
+
|
|
789
|
+
type GoogleOneTapRuntimeErrorCode = 'script_load_failed' | 'api_unavailable' | 'configuration_conflict' | 'duplicate_instance' | 'prompt_failed';
|
|
790
|
+
|
|
791
|
+
type GoogleOneTapSkipReason = 'disabled' | 'existing_session' | 'provider_disabled' | 'prompt_skipped';
|
|
792
|
+
type GoogleOneTapDismissReason = 'tap_outside' | 'cancel_called' | 'flow_restarted' | 'unknown';
|
|
793
|
+
type GoogleOneTapErrorCode = GoogleOneTapRuntimeErrorCode | 'public_config_unavailable' | 'missing_client_id' | 'credential_missing' | 'credential_exchange_failed';
|
|
794
|
+
type GoogleOneTapError = {
|
|
795
|
+
code: GoogleOneTapErrorCode;
|
|
796
|
+
status?: number;
|
|
797
|
+
authCode?: AuthOwlErrorCode | (string & {});
|
|
798
|
+
};
|
|
799
|
+
type GoogleOneTapProps = {
|
|
800
|
+
/** Disable prompting without unmounting the component. */
|
|
801
|
+
disabled?: boolean;
|
|
802
|
+
/** Bind Google's ID token to this browser attempt. Generate a fresh random value server-side. */
|
|
803
|
+
nonce?: string;
|
|
804
|
+
/** Let eligible returning Google users sign in automatically. Defaults to false. */
|
|
805
|
+
autoSelect?: boolean;
|
|
806
|
+
/** Let tapping outside dismiss the prompt. Defaults to true. */
|
|
807
|
+
cancelOnTapOutside?: boolean;
|
|
808
|
+
/** Wording Google uses in the prompt. */
|
|
809
|
+
context?: 'signin' | 'signup' | 'use';
|
|
810
|
+
/** Enable Google's upgraded experience on ITP browsers. Defaults to true. */
|
|
811
|
+
itpSupport?: boolean;
|
|
812
|
+
loginHint?: string;
|
|
813
|
+
hostedDomain?: string;
|
|
814
|
+
stateCookieDomain?: string;
|
|
815
|
+
/** CSP nonce applied only when AuthOwl inserts the Google Identity script. */
|
|
816
|
+
scriptNonce?: string;
|
|
817
|
+
onSignedIn?: (user: AuthUser) => void;
|
|
818
|
+
onSkipped?: (reason: GoogleOneTapSkipReason) => void;
|
|
819
|
+
onDismissed?: (reason: GoogleOneTapDismissReason) => void;
|
|
820
|
+
onError?: (error: GoogleOneTapError) => void;
|
|
821
|
+
};
|
|
822
|
+
/** Invisible, server-configured Google One Tap conversion helper. */
|
|
823
|
+
declare function GoogleOneTap({ disabled, nonce, autoSelect, cancelOnTapOutside, context, itpSupport, loginHint, hostedDomain, stateCookieDomain, scriptNonce, onSignedIn, onSkipped, onDismissed, onError, }: GoogleOneTapProps): null;
|
|
824
|
+
|
|
825
|
+
export { type Appearance, AuthLoaded, type AuthLoadedProps, AuthLoading, type AuthLoadingProps, AuthOwlBadge, type AuthOwlBadgeProps, AuthOwlProvider, type AuthOwlProviderProps, type AutofillHost, BackupCodesManager, type BackupCodesManagerProps, Bidi, type ConfigState, ConsentDocLinks, type ConsentDocLinksProps, ConsentGate, type ConsentGateProps, CreateOrganization, type CreateOrganizationProps, DEFAULT_BRAND_COLOR, EmailOtpForm, type EmailOtpFormProps, ForgotPassword, type ForgotPasswordProps, GoogleOneTap, type GoogleOneTapDismissReason, type GoogleOneTapError, type GoogleOneTapErrorCode, type GoogleOneTapProps, type GoogleOneTapSkipReason, KNOWN_METHODS, type KnownMethod, MFAChallenge, type MFAChallengeProps, MFAEnrollment, type MFAEnrollmentProps, MFARequiredGate, type MFARequiredGateProps, MagicLinkForm, type MagicLinkFormProps, OrganizationList, type OrganizationListProps, OrganizationProfile, type OrganizationProfileProps, type OrganizationProfileSection, OrganizationSwitcher, type OrganizationSwitcherProps, PasskeyButton, type PasskeyButtonProps, PasskeyManager, type PasskeyManagerProps, PhoneOTP, type PhoneOTPProps, Protect, type ProtectProps, ResetPassword, type ResetPasswordProps, SignIn, type SignInPlan, type SignInProps, SignOutButton, type SignOutButtonProps, SignUp, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, SocialButtons, type SocialButtonsProps, Spinner, type UseAccountResult, type UseAuthResult, type UseConsentResult, type UseEmailVerificationResult, type UseMFAResult, type UseOrganizationResult, type UsePasskeysResult, type UsePasswordResetResult, type UsePublicConfigResult, type UseSignInResult, type UseSignOutResult, type UseSignUpResult, type UseUserResult, type UseWaitlistResult, UserButton, UserProfile, type UserProfileProps, type UserProfileSection, VerificationPending, type VerificationPendingProps, VerifyEmail, type VerifyEmailProps, Waitlist, type WaitlistProps, emailAutocomplete, resolveSignInMethods, useAccount, useAuth, useAuthClient, useAuthOwlContext, useConsent, useEmailVerification, useLocale, useMFA, useOrganization, usePasskeys, usePasswordReset, usePublicConfig, useSession, useSignIn, useSignOut, useSignUp, useUser, useWaitlist };
|