better-auth-ui 3.2.5
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 +53 -0
- package/dist/auth-hooks-IOEvlYYv.d.cts +6966 -0
- package/dist/auth-hooks-IOEvlYYv.d.ts +6966 -0
- package/dist/auth-mutators-DdqOmQ32.d.cts +29 -0
- package/dist/auth-mutators-DdqOmQ32.d.ts +29 -0
- package/dist/auth-ui-provider-BsH3xJDw.d.ts +697 -0
- package/dist/auth-ui-provider-DhZfncd3.d.cts +697 -0
- package/dist/chunk-BDFQSFBU.js +750 -0
- package/dist/chunk-CRAHKL2C.cjs +801 -0
- package/dist/chunk-MJPOA6PK.js +801 -0
- package/dist/chunk-SV64DXGW.cjs +750 -0
- package/dist/index.cjs +12618 -0
- package/dist/index.d.cts +771 -0
- package/dist/index.d.ts +771 -0
- package/dist/index.js +12618 -0
- package/dist/instantdb.cjs +189 -0
- package/dist/instantdb.d.cts +36 -0
- package/dist/instantdb.d.ts +36 -0
- package/dist/instantdb.js +189 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/server.cjs +194 -0
- package/dist/server.d.cts +35 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +194 -0
- package/dist/style.css +1 -0
- package/dist/tanstack.cjs +153 -0
- package/dist/tanstack.d.cts +18 -0
- package/dist/tanstack.d.ts +18 -0
- package/dist/tanstack.js +153 -0
- package/dist/triplit.cjs +201 -0
- package/dist/triplit.d.cts +31 -0
- package/dist/triplit.d.ts +31 -0
- package/dist/triplit.js +201 -0
- package/dist/utils-C5R37WDe.d.cts +3 -0
- package/dist/utils-C5R37WDe.d.ts +3 -0
- package/dist/view-paths-CHSJf5dv.d.cts +645 -0
- package/dist/view-paths-CHSJf5dv.d.ts +645 -0
- package/package.json +156 -0
- package/src/components/account/account-view.tsx +220 -0
- package/src/components/auth/auth-callback.tsx +36 -0
- package/src/components/auth/auth-form.tsx +277 -0
- package/src/components/auth/auth-view.tsx +389 -0
- package/src/components/auth/email-otp-button.tsx +53 -0
- package/src/components/auth/forms/email-otp-form.tsx +288 -0
- package/src/components/auth/forms/forgot-password-form.tsx +168 -0
- package/src/components/auth/forms/magic-link-form.tsx +191 -0
- package/src/components/auth/forms/recover-account-form.tsx +138 -0
- package/src/components/auth/forms/reset-password-form.tsx +215 -0
- package/src/components/auth/forms/sign-in-form.tsx +289 -0
- package/src/components/auth/forms/sign-up-form.tsx +788 -0
- package/src/components/auth/forms/two-factor-form.tsx +372 -0
- package/src/components/auth/magic-link-button.tsx +54 -0
- package/src/components/auth/one-tap.tsx +48 -0
- package/src/components/auth/otp-input-group.tsx +65 -0
- package/src/components/auth/passkey-button.tsx +85 -0
- package/src/components/auth/provider-button.tsx +141 -0
- package/src/components/auth/sign-out.tsx +25 -0
- package/src/components/auth-loading.tsx +21 -0
- package/src/components/captcha/captcha.tsx +79 -0
- package/src/components/captcha/recaptcha-badge.tsx +61 -0
- package/src/components/captcha/recaptcha-v2.tsx +58 -0
- package/src/components/captcha/recaptcha-v3.tsx +73 -0
- package/src/components/email/email-template.tsx +216 -0
- package/src/components/form-error.tsx +27 -0
- package/src/components/organization/accept-invitation-card.tsx +362 -0
- package/src/components/organization/create-organization-dialog.tsx +395 -0
- package/src/components/organization/delete-organization-card.tsx +101 -0
- package/src/components/organization/delete-organization-dialog.tsx +209 -0
- package/src/components/organization/invitation-cell.tsx +156 -0
- package/src/components/organization/invite-member-dialog.tsx +258 -0
- package/src/components/organization/leave-organization-dialog.tsx +150 -0
- package/src/components/organization/member-cell.tsx +187 -0
- package/src/components/organization/organization-cell-view.tsx +122 -0
- package/src/components/organization/organization-cell.tsx +154 -0
- package/src/components/organization/organization-invitations-card.tsx +94 -0
- package/src/components/organization/organization-logo-card.tsx +308 -0
- package/src/components/organization/organization-logo.tsx +120 -0
- package/src/components/organization/organization-members-card.tsx +155 -0
- package/src/components/organization/organization-name-card.tsx +204 -0
- package/src/components/organization/organization-settings-cards.tsx +67 -0
- package/src/components/organization/organization-slug-card.tsx +223 -0
- package/src/components/organization/organization-switcher.tsx +512 -0
- package/src/components/organization/organization-view.tsx +228 -0
- package/src/components/organization/organizations-card.tsx +72 -0
- package/src/components/organization/personal-account-view.tsx +115 -0
- package/src/components/organization/remove-member-dialog.tsx +144 -0
- package/src/components/organization/update-member-role-dialog.tsx +213 -0
- package/src/components/organization/user-invitations-card.tsx +238 -0
- package/src/components/password-input.tsx +56 -0
- package/src/components/provider-icons.tsx +385 -0
- package/src/components/redirect-to-sign-in.tsx +16 -0
- package/src/components/redirect-to-sign-up.tsx +16 -0
- package/src/components/settings/account/account-cell.tsx +158 -0
- package/src/components/settings/account/accounts-card.tsx +75 -0
- package/src/components/settings/account/delete-account-card.tsx +65 -0
- package/src/components/settings/account/delete-account-dialog.tsx +231 -0
- package/src/components/settings/account/update-avatar-card.tsx +198 -0
- package/src/components/settings/account/update-field-card.tsx +282 -0
- package/src/components/settings/account/update-name-card.tsx +39 -0
- package/src/components/settings/account/update-username-card.tsx +42 -0
- package/src/components/settings/account-settings-cards.tsx +123 -0
- package/src/components/settings/api-key/api-key-cell.tsx +108 -0
- package/src/components/settings/api-key/api-key-delete-dialog.tsx +162 -0
- package/src/components/settings/api-key/api-key-display-dialog.tsx +110 -0
- package/src/components/settings/api-key/api-keys-card.tsx +98 -0
- package/src/components/settings/api-key/create-api-key-dialog.tsx +376 -0
- package/src/components/settings/passkey/passkey-cell.tsx +113 -0
- package/src/components/settings/passkey/passkeys-card.tsx +111 -0
- package/src/components/settings/providers/provider-cell.tsx +152 -0
- package/src/components/settings/providers/providers-card.tsx +108 -0
- package/src/components/settings/security/change-email-card.tsx +200 -0
- package/src/components/settings/security/change-password-card.tsx +326 -0
- package/src/components/settings/security/session-cell.tsx +120 -0
- package/src/components/settings/security/sessions-card.tsx +58 -0
- package/src/components/settings/security-settings-cards.tsx +111 -0
- package/src/components/settings/shared/session-freshness-dialog.tsx +97 -0
- package/src/components/settings/shared/settings-action-button.tsx +51 -0
- package/src/components/settings/shared/settings-card-footer.tsx +94 -0
- package/src/components/settings/shared/settings-card-header.tsx +67 -0
- package/src/components/settings/shared/settings-card.tsx +106 -0
- package/src/components/settings/skeletons/input-field-skeleton.tsx +18 -0
- package/src/components/settings/skeletons/settings-cell-skeleton.tsx +37 -0
- package/src/components/settings/two-factor/backup-codes-dialog.tsx +113 -0
- package/src/components/settings/two-factor/two-factor-card.tsx +63 -0
- package/src/components/settings/two-factor/two-factor-password-dialog.tsx +226 -0
- package/src/components/signed-in.tsx +20 -0
- package/src/components/signed-out.tsx +20 -0
- package/src/components/ui/alert.tsx +66 -0
- package/src/components/ui/avatar.tsx +53 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/checkbox.tsx +32 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/drawer.tsx +135 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/form.tsx +167 -0
- package/src/components/ui/input-otp.tsx +77 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/select.tsx +185 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/tabs.tsx +66 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/user-avatar.tsx +147 -0
- package/src/components/user-button.tsx +409 -0
- package/src/components/user-view.tsx +138 -0
- package/src/hooks/use-auth-data.ts +184 -0
- package/src/hooks/use-authenticate.ts +62 -0
- package/src/hooks/use-captcha.tsx +138 -0
- package/src/hooks/use-current-organization.ts +59 -0
- package/src/hooks/use-hydrated.ts +13 -0
- package/src/hooks/use-lang.ts +32 -0
- package/src/hooks/use-success-transition.ts +51 -0
- package/src/hooks/use-theme.ts +39 -0
- package/src/index.ts +65 -0
- package/src/instantdb.ts +1 -0
- package/src/lib/auth-data-cache.ts +90 -0
- package/src/lib/auth-ui-provider.tsx +658 -0
- package/src/lib/gravatar-utils.ts +58 -0
- package/src/lib/image-utils.ts +55 -0
- package/src/lib/instantdb/model-names.ts +24 -0
- package/src/lib/instantdb/use-instant-options.ts +98 -0
- package/src/lib/instantdb/use-list-accounts.ts +38 -0
- package/src/lib/instantdb/use-list-sessions.ts +53 -0
- package/src/lib/instantdb/use-session.ts +55 -0
- package/src/lib/organization-refetcher.tsx +56 -0
- package/src/lib/social-providers.ts +144 -0
- package/src/lib/tanstack/auth-ui-provider-tanstack.tsx +49 -0
- package/src/lib/tanstack/use-tanstack-options.ts +112 -0
- package/src/lib/triplit/model-names.ts +24 -0
- package/src/lib/triplit/use-conditional-query.ts +82 -0
- package/src/lib/triplit/use-list-accounts.ts +31 -0
- package/src/lib/triplit/use-list-sessions.ts +33 -0
- package/src/lib/triplit/use-session.ts +42 -0
- package/src/lib/triplit/use-triplit-hooks.ts +68 -0
- package/src/lib/triplit/use-triplit-token.ts +44 -0
- package/src/lib/utils.ts +105 -0
- package/src/lib/view-paths.ts +55 -0
- package/src/localization/admin-error-codes.ts +20 -0
- package/src/localization/anonymous-error-codes.ts +6 -0
- package/src/localization/api-key-error-codes.ts +32 -0
- package/src/localization/auth-localization.ts +740 -0
- package/src/localization/base-error-codes.ts +27 -0
- package/src/localization/captcha-error-codes.ts +17 -0
- package/src/localization/email-otp-error-codes.ts +7 -0
- package/src/localization/generic-oauth-error-codes.ts +3 -0
- package/src/localization/haveibeenpwned-error-codes.ts +4 -0
- package/src/localization/multi-session-error-codes.ts +3 -0
- package/src/localization/organization-error-codes.ts +57 -0
- package/src/localization/passkey-error-codes.ts +10 -0
- package/src/localization/phone-number-error-codes.ts +10 -0
- package/src/localization/stripe-localization.ts +12 -0
- package/src/localization/two-factor-error-codes.ts +12 -0
- package/src/localization/username-error-codes.ts +9 -0
- package/src/server.ts +4 -0
- package/src/style.css +1 -0
- package/src/tanstack.ts +1 -0
- package/src/triplit.ts +1 -0
- package/src/types/account-options.ts +35 -0
- package/src/types/additional-fields.ts +21 -0
- package/src/types/any-auth-client.ts +6 -0
- package/src/types/api-key.ts +9 -0
- package/src/types/auth-client.ts +37 -0
- package/src/types/auth-hooks.ts +61 -0
- package/src/types/auth-mutators.ts +17 -0
- package/src/types/avatar-options.ts +29 -0
- package/src/types/captcha-options.ts +32 -0
- package/src/types/captcha-provider.ts +6 -0
- package/src/types/credentials-options.ts +32 -0
- package/src/types/delete-user-options.ts +7 -0
- package/src/types/fetch-error.ts +6 -0
- package/src/types/generic-oauth-options.ts +16 -0
- package/src/types/gravatar-options.ts +21 -0
- package/src/types/image.ts +7 -0
- package/src/types/invitation.ts +10 -0
- package/src/types/link.ts +7 -0
- package/src/types/organization-options.ts +106 -0
- package/src/types/password-validation.ts +16 -0
- package/src/types/profile.ts +15 -0
- package/src/types/refetch.ts +1 -0
- package/src/types/render-toast.ts +9 -0
- package/src/types/sign-up-options.ts +7 -0
- package/src/types/social-options.ts +16 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ComponentType, ReactNode } from 'react';
|
|
4
|
+
import { f as AccountViewPaths, g as OrganizationViewPaths, h as authLocalization, c as AuthViewPaths, A as AuthLocalization } from './view-paths-CHSJf5dv.js';
|
|
5
|
+
import { b as AuthClient, a as AuthHooks, A as AnyAuthClient } from './auth-hooks-IOEvlYYv.js';
|
|
6
|
+
import { A as AuthMutators } from './auth-mutators-DdqOmQ32.js';
|
|
7
|
+
import { SocialProvider } from 'better-auth/social-providers';
|
|
8
|
+
|
|
9
|
+
type PasswordValidation = {
|
|
10
|
+
/**
|
|
11
|
+
* Maximum password length
|
|
12
|
+
*/
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Minimum password length
|
|
16
|
+
*/
|
|
17
|
+
minLength?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Password validation regex
|
|
20
|
+
*/
|
|
21
|
+
regex?: RegExp;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
interface ProviderIconProps {
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
type ProviderIcon = ComponentType<ProviderIconProps>;
|
|
28
|
+
declare const AppleIcon: ProviderIcon;
|
|
29
|
+
declare const DiscordIcon: ProviderIcon;
|
|
30
|
+
declare const DropboxIcon: ProviderIcon;
|
|
31
|
+
declare const FacebookIcon: ProviderIcon;
|
|
32
|
+
declare const GitHubIcon: ProviderIcon;
|
|
33
|
+
declare const GitLabIcon: ProviderIcon;
|
|
34
|
+
declare const GoogleIcon: ProviderIcon;
|
|
35
|
+
declare const HuggingFaceIcon: ProviderIcon;
|
|
36
|
+
declare const KickIcon: ProviderIcon;
|
|
37
|
+
declare const LinearIcon: ProviderIcon;
|
|
38
|
+
declare const LinkedInIcon: ProviderIcon;
|
|
39
|
+
declare const MicrosoftIcon: ProviderIcon;
|
|
40
|
+
declare const NotionIcon: ProviderIcon;
|
|
41
|
+
declare const RedditIcon: ProviderIcon;
|
|
42
|
+
declare const RobloxIcon: ProviderIcon;
|
|
43
|
+
declare const SlackIcon: ProviderIcon;
|
|
44
|
+
declare const SpotifyIcon: ProviderIcon;
|
|
45
|
+
declare const TikTokIcon: ProviderIcon;
|
|
46
|
+
declare const TwitchIcon: ProviderIcon;
|
|
47
|
+
declare const VKIcon: ProviderIcon;
|
|
48
|
+
declare const XIcon: ProviderIcon;
|
|
49
|
+
declare const ZoomIcon: ProviderIcon;
|
|
50
|
+
|
|
51
|
+
type FieldType = "string" | "number" | "boolean";
|
|
52
|
+
interface AdditionalField {
|
|
53
|
+
description?: ReactNode;
|
|
54
|
+
instructions?: ReactNode;
|
|
55
|
+
label: ReactNode;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
required?: boolean;
|
|
58
|
+
type: FieldType;
|
|
59
|
+
/**
|
|
60
|
+
* Render a multi-line textarea for string fields
|
|
61
|
+
*/
|
|
62
|
+
multiline?: boolean;
|
|
63
|
+
validate?: (value: string) => Promise<boolean>;
|
|
64
|
+
}
|
|
65
|
+
interface AdditionalFields {
|
|
66
|
+
[key: string]: AdditionalField;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type AccountOptions = {
|
|
70
|
+
/**
|
|
71
|
+
* Base path for account-scoped views
|
|
72
|
+
* @default "/account"
|
|
73
|
+
*/
|
|
74
|
+
basePath?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Array of fields to show in Account Settings
|
|
77
|
+
* @default ["image", "name"]
|
|
78
|
+
*/
|
|
79
|
+
fields: string[];
|
|
80
|
+
/**
|
|
81
|
+
* Customize account view paths
|
|
82
|
+
*/
|
|
83
|
+
viewPaths?: Partial<AccountViewPaths>;
|
|
84
|
+
};
|
|
85
|
+
type AccountOptionsContext = {
|
|
86
|
+
/**
|
|
87
|
+
* Base path for account-scoped views
|
|
88
|
+
* @default "/account"
|
|
89
|
+
*/
|
|
90
|
+
basePath: string;
|
|
91
|
+
/**
|
|
92
|
+
* Array of fields to show in Account Settings
|
|
93
|
+
* @default ["image", "name"]
|
|
94
|
+
*/
|
|
95
|
+
fields: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Customize account view paths
|
|
98
|
+
*/
|
|
99
|
+
viewPaths: AccountViewPaths;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type Image = ComponentType<{
|
|
103
|
+
src: string;
|
|
104
|
+
alt: string;
|
|
105
|
+
className?: string;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
type AvatarOptions = {
|
|
109
|
+
/**
|
|
110
|
+
* Upload an avatar image and return the URL string
|
|
111
|
+
* @remarks `(file: File) => Promise<string>`
|
|
112
|
+
*/
|
|
113
|
+
upload?: (file: File) => Promise<string | undefined | null>;
|
|
114
|
+
/**
|
|
115
|
+
* Delete a previously uploaded avatar image from your storage/CDN
|
|
116
|
+
* @remarks `(url: string) => Promise<void>`
|
|
117
|
+
*/
|
|
118
|
+
delete?: (url: string) => Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Avatar size for resizing
|
|
121
|
+
* @default 128 (or 256 if upload is provided)
|
|
122
|
+
*/
|
|
123
|
+
size: number;
|
|
124
|
+
/**
|
|
125
|
+
* File extension for avatar uploads
|
|
126
|
+
* @default "png"
|
|
127
|
+
*/
|
|
128
|
+
extension: string;
|
|
129
|
+
/**
|
|
130
|
+
* Custom Image component for rendering avatar images
|
|
131
|
+
* @default AvatarImage from Radix UI
|
|
132
|
+
*/
|
|
133
|
+
Image?: Image;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
type CaptchaProvider = "cloudflare-turnstile" | "google-recaptcha-v2-checkbox" | "google-recaptcha-v2-invisible" | "google-recaptcha-v3" | "hcaptcha";
|
|
137
|
+
|
|
138
|
+
type CaptchaOptions = {
|
|
139
|
+
/**
|
|
140
|
+
* Captcha site key
|
|
141
|
+
*/
|
|
142
|
+
siteKey: string;
|
|
143
|
+
/**
|
|
144
|
+
* Captcha provider type
|
|
145
|
+
*/
|
|
146
|
+
provider: CaptchaProvider;
|
|
147
|
+
/**
|
|
148
|
+
* Hide the captcha badge
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
hideBadge?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Use recaptcha.net domain instead of google.com
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
recaptchaNet?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Enable enterprise mode for Google reCAPTCHA
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
161
|
+
enterprise?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Overrides the default array of paths where captcha validation is enforced
|
|
164
|
+
* @default ["/sign-up/email", "/sign-in/email", "/forget-password"]
|
|
165
|
+
*/
|
|
166
|
+
endpoints?: string[];
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
type CredentialsOptions = {
|
|
170
|
+
/**
|
|
171
|
+
* Enable or disable the Confirm Password input
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
confirmPassword?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Enable or disable Forgot Password flow
|
|
177
|
+
* @default true
|
|
178
|
+
*/
|
|
179
|
+
forgotPassword?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Customize the password validation
|
|
182
|
+
*/
|
|
183
|
+
passwordValidation?: PasswordValidation;
|
|
184
|
+
/**
|
|
185
|
+
* Enable or disable Remember Me checkbox
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
rememberMe?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Enable or disable Username support
|
|
191
|
+
* @default false
|
|
192
|
+
*/
|
|
193
|
+
username?: boolean;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
type DeleteUserOptions = {
|
|
197
|
+
/**
|
|
198
|
+
* Enable or disable email verification for account deletion
|
|
199
|
+
* @default undefined
|
|
200
|
+
*/
|
|
201
|
+
verification?: boolean;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
declare const socialProviders: readonly [{
|
|
205
|
+
readonly provider: "apple";
|
|
206
|
+
readonly name: "Apple";
|
|
207
|
+
readonly icon: ProviderIcon;
|
|
208
|
+
}, {
|
|
209
|
+
readonly provider: "discord";
|
|
210
|
+
readonly name: "Discord";
|
|
211
|
+
readonly icon: ProviderIcon;
|
|
212
|
+
}, {
|
|
213
|
+
readonly provider: "dropbox";
|
|
214
|
+
readonly name: "Dropbox";
|
|
215
|
+
readonly icon: ProviderIcon;
|
|
216
|
+
}, {
|
|
217
|
+
readonly provider: "facebook";
|
|
218
|
+
readonly name: "Facebook";
|
|
219
|
+
readonly icon: ProviderIcon;
|
|
220
|
+
}, {
|
|
221
|
+
readonly provider: "github";
|
|
222
|
+
readonly name: "GitHub";
|
|
223
|
+
readonly icon: ProviderIcon;
|
|
224
|
+
}, {
|
|
225
|
+
readonly provider: "gitlab";
|
|
226
|
+
readonly name: "GitLab";
|
|
227
|
+
readonly icon: ProviderIcon;
|
|
228
|
+
}, {
|
|
229
|
+
readonly provider: "google";
|
|
230
|
+
readonly name: "Google";
|
|
231
|
+
readonly icon: ProviderIcon;
|
|
232
|
+
}, {
|
|
233
|
+
readonly provider: "huggingface";
|
|
234
|
+
readonly name: "Hugging Face";
|
|
235
|
+
readonly icon: ProviderIcon;
|
|
236
|
+
}, {
|
|
237
|
+
readonly provider: "kick";
|
|
238
|
+
readonly name: "Kick";
|
|
239
|
+
readonly icon: ProviderIcon;
|
|
240
|
+
}, {
|
|
241
|
+
readonly provider: "linear";
|
|
242
|
+
readonly name: "Linear";
|
|
243
|
+
readonly icon: ProviderIcon;
|
|
244
|
+
}, {
|
|
245
|
+
readonly provider: "linkedin";
|
|
246
|
+
readonly name: "LinkedIn";
|
|
247
|
+
readonly icon: ProviderIcon;
|
|
248
|
+
}, {
|
|
249
|
+
readonly provider: "microsoft";
|
|
250
|
+
readonly name: "Microsoft";
|
|
251
|
+
readonly icon: ProviderIcon;
|
|
252
|
+
}, {
|
|
253
|
+
readonly provider: "notion";
|
|
254
|
+
readonly name: "Notion";
|
|
255
|
+
readonly icon: ProviderIcon;
|
|
256
|
+
}, {
|
|
257
|
+
readonly provider: "reddit";
|
|
258
|
+
readonly name: "Reddit";
|
|
259
|
+
readonly icon: ProviderIcon;
|
|
260
|
+
}, {
|
|
261
|
+
readonly provider: "roblox";
|
|
262
|
+
readonly name: "Roblox";
|
|
263
|
+
readonly icon: ProviderIcon;
|
|
264
|
+
}, {
|
|
265
|
+
readonly provider: "slack";
|
|
266
|
+
readonly name: "Slack";
|
|
267
|
+
readonly icon: ProviderIcon;
|
|
268
|
+
}, {
|
|
269
|
+
readonly provider: "spotify";
|
|
270
|
+
readonly name: "Spotify";
|
|
271
|
+
readonly icon: ProviderIcon;
|
|
272
|
+
}, {
|
|
273
|
+
readonly provider: "tiktok";
|
|
274
|
+
readonly name: "TikTok";
|
|
275
|
+
readonly icon: ProviderIcon;
|
|
276
|
+
}, {
|
|
277
|
+
readonly provider: "twitch";
|
|
278
|
+
readonly name: "Twitch";
|
|
279
|
+
readonly icon: ProviderIcon;
|
|
280
|
+
}, {
|
|
281
|
+
readonly provider: "vk";
|
|
282
|
+
readonly name: "VK";
|
|
283
|
+
readonly icon: ProviderIcon;
|
|
284
|
+
}, {
|
|
285
|
+
readonly provider: "twitter";
|
|
286
|
+
readonly name: "X";
|
|
287
|
+
readonly icon: ProviderIcon;
|
|
288
|
+
}, {
|
|
289
|
+
readonly provider: "zoom";
|
|
290
|
+
readonly name: "Zoom";
|
|
291
|
+
readonly icon: ProviderIcon;
|
|
292
|
+
}];
|
|
293
|
+
type Provider = {
|
|
294
|
+
provider: string;
|
|
295
|
+
name: string;
|
|
296
|
+
icon?: ProviderIcon;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
type GenericOAuthOptions = {
|
|
300
|
+
/**
|
|
301
|
+
* Custom OAuth Providers
|
|
302
|
+
* @default []
|
|
303
|
+
*/
|
|
304
|
+
providers: Provider[];
|
|
305
|
+
/**
|
|
306
|
+
* Custom generic OAuth sign in function
|
|
307
|
+
*/
|
|
308
|
+
signIn?: (params: Parameters<AuthClient["signIn"]["oauth2"]>[0]) => Promise<unknown>;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
type GravatarOptions = {
|
|
312
|
+
/**
|
|
313
|
+
* Default image type or URL
|
|
314
|
+
* Options: '404', 'mp', 'identicon', 'monsterid', 'wavatar', 'retro', 'robohash', 'blank', or custom URL
|
|
315
|
+
*/
|
|
316
|
+
d?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Image size in pixels (1-2048)
|
|
319
|
+
*/
|
|
320
|
+
size?: number;
|
|
321
|
+
/**
|
|
322
|
+
* Whether to append .jpg extension to the hash
|
|
323
|
+
* @default false
|
|
324
|
+
*/
|
|
325
|
+
jpg?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Force default image even if user has Gravatar
|
|
328
|
+
* @default false
|
|
329
|
+
*/
|
|
330
|
+
forceDefault?: boolean;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
type Link = ComponentType<{
|
|
334
|
+
href: string;
|
|
335
|
+
className?: string;
|
|
336
|
+
children: ReactNode;
|
|
337
|
+
}>;
|
|
338
|
+
|
|
339
|
+
type OrganizationLogoOptions = {
|
|
340
|
+
/**
|
|
341
|
+
* Upload a logo image and return the URL string
|
|
342
|
+
* @remarks `(file: File) => Promise<string>`
|
|
343
|
+
*/
|
|
344
|
+
upload?: (file: File) => Promise<string | undefined | null>;
|
|
345
|
+
/**
|
|
346
|
+
* Delete a previously uploaded logo image from your storage/CDN
|
|
347
|
+
* @remarks `(url: string) => Promise<void>`
|
|
348
|
+
*/
|
|
349
|
+
delete?: (url: string) => Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Logo size for resizing
|
|
352
|
+
* @default 256 if upload is provided, 128 otherwise
|
|
353
|
+
*/
|
|
354
|
+
size: number;
|
|
355
|
+
/**
|
|
356
|
+
* File extension for logo uploads
|
|
357
|
+
* @default "png"
|
|
358
|
+
*/
|
|
359
|
+
extension: string;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
type OrganizationOptions = {
|
|
363
|
+
/**
|
|
364
|
+
* Logo configuration
|
|
365
|
+
* @default undefined
|
|
366
|
+
*/
|
|
367
|
+
logo?: boolean | Partial<OrganizationLogoOptions>;
|
|
368
|
+
/**
|
|
369
|
+
* Custom roles to add to the built-in roles (owner, admin, member)
|
|
370
|
+
* @default []
|
|
371
|
+
*/
|
|
372
|
+
customRoles?: Array<{
|
|
373
|
+
role: string;
|
|
374
|
+
label: string;
|
|
375
|
+
}>;
|
|
376
|
+
/**
|
|
377
|
+
* Enable or disable API key support for organizations
|
|
378
|
+
* @default false
|
|
379
|
+
*/
|
|
380
|
+
apiKey?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Base path for organization-scoped views (supports slugged or static base)
|
|
383
|
+
* When using slug paths, set this to the common prefix (e.g. "/organization")
|
|
384
|
+
*/
|
|
385
|
+
basePath?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Organization path mode
|
|
388
|
+
* - "default": use active-organization based routes
|
|
389
|
+
* - "slug": use slug-based URLs where slug becomes the first path segment
|
|
390
|
+
* e.g. "/[slug]/members" (or `${basePath}/[slug]/members` if basePath provided)
|
|
391
|
+
* @default "default"
|
|
392
|
+
*/
|
|
393
|
+
pathMode?: "default" | "slug";
|
|
394
|
+
/**
|
|
395
|
+
* The current organization slug
|
|
396
|
+
*/
|
|
397
|
+
slug?: string;
|
|
398
|
+
/**
|
|
399
|
+
* The path to redirect to when Personal Account is selected
|
|
400
|
+
*/
|
|
401
|
+
personalPath?: string;
|
|
402
|
+
/**
|
|
403
|
+
* Customize organization view paths
|
|
404
|
+
*/
|
|
405
|
+
viewPaths?: Partial<OrganizationViewPaths>;
|
|
406
|
+
};
|
|
407
|
+
type OrganizationOptionsContext = {
|
|
408
|
+
/**
|
|
409
|
+
* Logo configuration
|
|
410
|
+
* @default undefined
|
|
411
|
+
*/
|
|
412
|
+
logo?: OrganizationLogoOptions;
|
|
413
|
+
/**
|
|
414
|
+
* Custom roles to add to the built-in roles (owner, admin, member)
|
|
415
|
+
* @default []
|
|
416
|
+
*/
|
|
417
|
+
customRoles: Array<{
|
|
418
|
+
role: string;
|
|
419
|
+
label: string;
|
|
420
|
+
}>;
|
|
421
|
+
/**
|
|
422
|
+
* Enable or disable API key support for organizations
|
|
423
|
+
* @default false
|
|
424
|
+
*/
|
|
425
|
+
apiKey?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Base path for organization-scoped views
|
|
428
|
+
*/
|
|
429
|
+
basePath: string;
|
|
430
|
+
/**
|
|
431
|
+
* Organization path mode
|
|
432
|
+
* @default "default"
|
|
433
|
+
*/
|
|
434
|
+
pathMode?: "default" | "slug";
|
|
435
|
+
/**
|
|
436
|
+
* The current organization slug
|
|
437
|
+
*/
|
|
438
|
+
slug?: string;
|
|
439
|
+
/**
|
|
440
|
+
* The path to redirect to when Personal Account is selected
|
|
441
|
+
*/
|
|
442
|
+
personalPath?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Customize organization view paths
|
|
445
|
+
*/
|
|
446
|
+
viewPaths: OrganizationViewPaths;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
type ToastVariant = "default" | "success" | "error" | "info" | "warning";
|
|
450
|
+
type RenderToast = ({ variant, message }: {
|
|
451
|
+
variant?: ToastVariant;
|
|
452
|
+
message?: string;
|
|
453
|
+
}) => void;
|
|
454
|
+
|
|
455
|
+
type SignUpOptions = {
|
|
456
|
+
/**
|
|
457
|
+
* Array of fields to show in Sign Up form
|
|
458
|
+
* @default ["name"]
|
|
459
|
+
*/
|
|
460
|
+
fields?: string[];
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
type SocialOptions = {
|
|
464
|
+
/**
|
|
465
|
+
* Array of Social Providers to enable
|
|
466
|
+
* @remarks `SocialProvider[]`
|
|
467
|
+
*/
|
|
468
|
+
providers: SocialProvider[];
|
|
469
|
+
/**
|
|
470
|
+
* Custom social sign in function
|
|
471
|
+
*/
|
|
472
|
+
signIn?: (params: Parameters<AuthClient["signIn"]["social"]>[0]) => Promise<unknown>;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
type AuthUIContextType = {
|
|
476
|
+
authClient: AuthClient;
|
|
477
|
+
/**
|
|
478
|
+
* Additional fields for users
|
|
479
|
+
*/
|
|
480
|
+
additionalFields?: AdditionalFields;
|
|
481
|
+
/**
|
|
482
|
+
* API Key plugin configuration
|
|
483
|
+
*/
|
|
484
|
+
apiKey?: {
|
|
485
|
+
/**
|
|
486
|
+
* Prefix for API Keys
|
|
487
|
+
*/
|
|
488
|
+
prefix?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Metadata for API Keys
|
|
491
|
+
*/
|
|
492
|
+
metadata?: Record<string, unknown>;
|
|
493
|
+
} | boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Avatar configuration
|
|
496
|
+
* @default undefined
|
|
497
|
+
*/
|
|
498
|
+
avatar?: AvatarOptions;
|
|
499
|
+
/**
|
|
500
|
+
* Base path for the auth views
|
|
501
|
+
* @default "/auth"
|
|
502
|
+
*/
|
|
503
|
+
basePath: string;
|
|
504
|
+
/**
|
|
505
|
+
* Front end base URL for auth API callbacks
|
|
506
|
+
*/
|
|
507
|
+
baseURL?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Captcha configuration
|
|
510
|
+
*/
|
|
511
|
+
captcha?: CaptchaOptions;
|
|
512
|
+
credentials?: CredentialsOptions;
|
|
513
|
+
/**
|
|
514
|
+
* Default redirect URL after authenticating
|
|
515
|
+
* @default "/"
|
|
516
|
+
*/
|
|
517
|
+
redirectTo: string;
|
|
518
|
+
/**
|
|
519
|
+
* Enable or disable user change email support
|
|
520
|
+
* @default true
|
|
521
|
+
*/
|
|
522
|
+
changeEmail?: boolean;
|
|
523
|
+
/**
|
|
524
|
+
* User Account deletion configuration
|
|
525
|
+
* @default undefined
|
|
526
|
+
*/
|
|
527
|
+
deleteUser?: DeleteUserOptions;
|
|
528
|
+
/**
|
|
529
|
+
* Show Verify Email card for unverified emails
|
|
530
|
+
*/
|
|
531
|
+
emailVerification?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Freshness age for Session data
|
|
534
|
+
* @default 60 * 60 * 24
|
|
535
|
+
*/
|
|
536
|
+
freshAge: number;
|
|
537
|
+
/**
|
|
538
|
+
* Generic OAuth provider configuration
|
|
539
|
+
*/
|
|
540
|
+
genericOAuth?: GenericOAuthOptions;
|
|
541
|
+
/**
|
|
542
|
+
* Gravatar configuration
|
|
543
|
+
*/
|
|
544
|
+
gravatar?: boolean | GravatarOptions;
|
|
545
|
+
hooks: AuthHooks;
|
|
546
|
+
localization: typeof authLocalization;
|
|
547
|
+
/**
|
|
548
|
+
* Enable or disable Magic Link support
|
|
549
|
+
* @default false
|
|
550
|
+
*/
|
|
551
|
+
magicLink?: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Enable or disable Email OTP support
|
|
554
|
+
* @default false
|
|
555
|
+
*/
|
|
556
|
+
emailOTP?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Enable or disable Multi Session support
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
|
+
multiSession?: boolean;
|
|
562
|
+
mutators: AuthMutators;
|
|
563
|
+
/**
|
|
564
|
+
* Whether the name field should be required
|
|
565
|
+
* @default true
|
|
566
|
+
*/
|
|
567
|
+
nameRequired?: boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Enable or disable One Tap support
|
|
570
|
+
* @default false
|
|
571
|
+
*/
|
|
572
|
+
oneTap?: boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Perform some User updates optimistically
|
|
575
|
+
* @default false
|
|
576
|
+
*/
|
|
577
|
+
optimistic?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* Organization configuration
|
|
580
|
+
*/
|
|
581
|
+
organization?: OrganizationOptionsContext;
|
|
582
|
+
/**
|
|
583
|
+
* Enable or disable Passkey support
|
|
584
|
+
* @default false
|
|
585
|
+
*/
|
|
586
|
+
passkey?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Forces better-auth-tanstack to refresh the Session on the auth callback page
|
|
589
|
+
* @default false
|
|
590
|
+
*/
|
|
591
|
+
persistClient?: boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Account configuration
|
|
594
|
+
*/
|
|
595
|
+
account?: AccountOptionsContext;
|
|
596
|
+
/**
|
|
597
|
+
* Sign Up configuration
|
|
598
|
+
*/
|
|
599
|
+
signUp?: SignUpOptions;
|
|
600
|
+
/**
|
|
601
|
+
* Social provider configuration
|
|
602
|
+
*/
|
|
603
|
+
social?: SocialOptions;
|
|
604
|
+
toast: RenderToast;
|
|
605
|
+
/**
|
|
606
|
+
* Enable or disable two-factor authentication support
|
|
607
|
+
* @default undefined
|
|
608
|
+
*/
|
|
609
|
+
twoFactor?: ("otp" | "totp")[];
|
|
610
|
+
viewPaths: AuthViewPaths;
|
|
611
|
+
/**
|
|
612
|
+
* Navigate to a new URL
|
|
613
|
+
* @default window.location.href
|
|
614
|
+
*/
|
|
615
|
+
navigate: (href: string) => void;
|
|
616
|
+
/**
|
|
617
|
+
* Called whenever the Session changes
|
|
618
|
+
*/
|
|
619
|
+
onSessionChange?: () => void | Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* Replace the current URL
|
|
622
|
+
* @default navigate
|
|
623
|
+
*/
|
|
624
|
+
replace: (href: string) => void;
|
|
625
|
+
/**
|
|
626
|
+
* Custom Link component for navigation
|
|
627
|
+
* @default <a>
|
|
628
|
+
*/
|
|
629
|
+
Link: Link;
|
|
630
|
+
};
|
|
631
|
+
type AuthUIProviderProps = {
|
|
632
|
+
children: ReactNode;
|
|
633
|
+
/**
|
|
634
|
+
* Better Auth client returned from createAuthClient
|
|
635
|
+
* @default Required
|
|
636
|
+
* @remarks `AuthClient`
|
|
637
|
+
*/
|
|
638
|
+
authClient: AnyAuthClient;
|
|
639
|
+
/**
|
|
640
|
+
* Enable account view & account configuration
|
|
641
|
+
* @default { fields: ["image", "name"] }
|
|
642
|
+
*/
|
|
643
|
+
account?: boolean | Partial<AccountOptions>;
|
|
644
|
+
/**
|
|
645
|
+
* Avatar configuration
|
|
646
|
+
* @default undefined
|
|
647
|
+
*/
|
|
648
|
+
avatar?: boolean | Partial<AvatarOptions>;
|
|
649
|
+
/**
|
|
650
|
+
* User Account deletion configuration
|
|
651
|
+
* @default undefined
|
|
652
|
+
*/
|
|
653
|
+
deleteUser?: DeleteUserOptions | boolean;
|
|
654
|
+
/**
|
|
655
|
+
* ADVANCED: Custom hooks for fetching auth data
|
|
656
|
+
*/
|
|
657
|
+
hooks?: Partial<AuthHooks>;
|
|
658
|
+
/**
|
|
659
|
+
* Customize the paths for the auth views
|
|
660
|
+
* @default authViewPaths
|
|
661
|
+
* @remarks `AuthViewPaths`
|
|
662
|
+
*/
|
|
663
|
+
viewPaths?: Partial<AuthViewPaths>;
|
|
664
|
+
/**
|
|
665
|
+
* Render custom Toasts
|
|
666
|
+
* @default Sonner
|
|
667
|
+
*/
|
|
668
|
+
toast?: RenderToast;
|
|
669
|
+
/**
|
|
670
|
+
* Customize the Localization strings
|
|
671
|
+
* @default authLocalization
|
|
672
|
+
* @remarks `AuthLocalization`
|
|
673
|
+
*/
|
|
674
|
+
localization?: AuthLocalization;
|
|
675
|
+
/**
|
|
676
|
+
* ADVANCED: Custom mutators for updating auth data
|
|
677
|
+
*/
|
|
678
|
+
mutators?: Partial<AuthMutators>;
|
|
679
|
+
/**
|
|
680
|
+
* Organization plugin configuration
|
|
681
|
+
*/
|
|
682
|
+
organization?: OrganizationOptions | boolean;
|
|
683
|
+
/**
|
|
684
|
+
* Enable or disable Credentials support
|
|
685
|
+
* @default { forgotPassword: true }
|
|
686
|
+
*/
|
|
687
|
+
credentials?: boolean | CredentialsOptions;
|
|
688
|
+
/**
|
|
689
|
+
* Enable or disable Sign Up form
|
|
690
|
+
* @default { fields: ["name"] }
|
|
691
|
+
*/
|
|
692
|
+
signUp?: SignUpOptions | boolean;
|
|
693
|
+
} & Partial<Omit<AuthUIContextType, "authClient" | "viewPaths" | "localization" | "mutators" | "toast" | "hooks" | "avatar" | "account" | "deleteUser" | "credentials" | "signUp" | "organization">>;
|
|
694
|
+
declare const AuthUIContext: React.Context<AuthUIContextType>;
|
|
695
|
+
declare const AuthUIProvider: ({ children, authClient: authClientProp, account: accountProp, avatar: avatarProp, deleteUser: deleteUserProp, social: socialProp, genericOAuth: genericOAuthProp, basePath, baseURL, captcha, redirectTo, credentials: credentialsProp, changeEmail, freshAge, hooks: hooksProp, mutators: mutatorsProp, localization: localizationProp, nameRequired, organization: organizationProp, signUp: signUpProp, toast, viewPaths: viewPathsProp, navigate, replace, Link, ...props }: AuthUIProviderProps) => react_jsx_runtime.JSX.Element;
|
|
696
|
+
|
|
697
|
+
export { AppleIcon as A, DiscordIcon as D, type FieldType as F, GitHubIcon as G, HuggingFaceIcon as H, KickIcon as K, LinearIcon as L, MicrosoftIcon as M, NotionIcon as N, type PasswordValidation as P, RedditIcon as R, SlackIcon as S, TikTokIcon as T, VKIcon as V, XIcon as X, ZoomIcon as Z, type ProviderIconProps as a, type ProviderIcon as b, DropboxIcon as c, FacebookIcon as d, GitLabIcon as e, GoogleIcon as f, LinkedInIcon as g, RobloxIcon as h, SpotifyIcon as i, TwitchIcon as j, type AuthUIContextType as k, type AuthUIProviderProps as l, AuthUIContext as m, AuthUIProvider as n, type Provider as o, socialProviders as s };
|