@better-auth-ui/core 1.6.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/dist/base-paths.d.ts +21 -0
- package/dist/base-paths.js +5 -0
- package/dist/config/appearance-config.d.ts +23 -0
- package/dist/config/appearance-config.js +1 -0
- package/dist/config/auth-config.d.ts +87 -0
- package/dist/config/auth-config.js +35 -0
- package/dist/config/avatar-config.d.ts +35 -0
- package/dist/config/avatar-config.js +1 -0
- package/dist/config/delete-user-config.d.ts +14 -0
- package/dist/config/delete-user-config.js +1 -0
- package/dist/config/email-and-password-config.d.ts +37 -0
- package/dist/config/email-and-password-config.js +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +5 -0
- package/dist/config/settings-config.d.ts +17 -0
- package/dist/config/settings-config.js +1 -0
- package/dist/config/toast-config.d.ts +58 -0
- package/dist/config/toast-config.js +16 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/lib/auth-callback-options.d.ts +8 -0
- package/dist/lib/auth-callback-options.js +1 -0
- package/dist/lib/auth-config.d.ts +198 -0
- package/dist/lib/auth-config.js +36 -0
- package/dist/lib/auth-error.d.ts +9 -0
- package/dist/lib/auth-error.js +1 -0
- package/dist/lib/auth-hook-options.d.ts +8 -0
- package/dist/lib/auth-hook-options.js +1 -0
- package/dist/lib/auth-toast.d.ts +24 -0
- package/dist/lib/auth-toast.js +10 -0
- package/dist/lib/base-paths.d.ts +21 -0
- package/dist/lib/base-paths.js +5 -0
- package/dist/lib/config/appearance-config.d.ts +23 -0
- package/dist/lib/config/appearance-config.js +1 -0
- package/dist/lib/config/auth-config.d.ts +70 -0
- package/dist/lib/config/auth-config.js +36 -0
- package/dist/lib/config/avatar-config.d.ts +35 -0
- package/dist/lib/config/avatar-config.js +1 -0
- package/dist/lib/config/email-and-password-config.d.ts +37 -0
- package/dist/lib/config/email-and-password-config.js +1 -0
- package/dist/lib/config/index.d.ts +6 -0
- package/dist/lib/config/index.js +6 -0
- package/dist/lib/config/settings-config.d.ts +22 -0
- package/dist/lib/config/settings-config.js +1 -0
- package/dist/lib/config/toast-config.d.ts +24 -0
- package/dist/lib/config/toast-config.js +10 -0
- package/dist/lib/localization.d.ts +175 -0
- package/dist/lib/localization.js +172 -0
- package/dist/lib/provider-names.d.ts +12 -0
- package/dist/lib/provider-names.js +50 -0
- package/dist/lib/toast-config.d.ts +24 -0
- package/dist/lib/toast-config.js +10 -0
- package/dist/lib/utils.d.ts +32 -0
- package/dist/lib/utils.js +116 -0
- package/dist/lib/view-paths.d.ts +68 -0
- package/dist/lib/view-paths.js +14 -0
- package/dist/localization/index.d.ts +35 -0
- package/dist/localization/index.js +34 -0
- package/dist/localization/localization.d.ts +35 -0
- package/dist/localization/localization.js +34 -0
- package/dist/localization.d.ts +159 -0
- package/dist/localization.js +156 -0
- package/dist/provider-names.d.ts +12 -0
- package/dist/provider-names.js +50 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +7 -0
- package/dist/src/lib/auth-config.d.ts +148 -0
- package/dist/src/lib/auth-config.js +28 -0
- package/dist/src/lib/auth-toast.d.ts +24 -0
- package/dist/src/lib/auth-toast.js +10 -0
- package/dist/src/lib/base-paths.d.ts +9 -0
- package/dist/src/lib/base-paths.js +9 -0
- package/dist/src/lib/localization.d.ts +145 -0
- package/dist/src/lib/localization.js +142 -0
- package/dist/src/lib/provider-names.d.ts +12 -0
- package/dist/src/lib/provider-names.js +49 -0
- package/dist/src/lib/utils.d.ts +1 -0
- package/dist/src/lib/utils.js +30 -0
- package/dist/src/lib/view-paths.d.ts +30 -0
- package/dist/src/lib/view-paths.js +17 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +80 -0
- package/dist/view-paths.d.ts +30 -0
- package/dist/view-paths.js +17 -0
- package/package.json +32 -0
- package/src/config/appearance-config.ts +24 -0
- package/src/config/auth-config.ts +117 -0
- package/src/config/avatar-config.ts +39 -0
- package/src/config/delete-user-config.ts +14 -0
- package/src/config/email-and-password-config.ts +37 -0
- package/src/config/index.ts +5 -0
- package/src/index.ts +6 -0
- package/src/lib/base-paths.ts +26 -0
- package/src/lib/localization.ts +259 -0
- package/src/lib/provider-names.ts +55 -0
- package/src/lib/utils.ts +151 -0
- package/src/lib/view-paths.ts +86 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { SocialProvider } from "better-auth/social-providers"
|
|
2
|
+
|
|
3
|
+
import { type BasePaths, basePaths } from "../lib/base-paths"
|
|
4
|
+
import { type Localization, localization } from "../lib/localization"
|
|
5
|
+
import { resizeAvatar } from "../lib/utils"
|
|
6
|
+
import { type ViewPaths, viewPaths } from "../lib/view-paths"
|
|
7
|
+
import type { AppearanceConfig } from "./appearance-config"
|
|
8
|
+
import type { AvatarConfig } from "./avatar-config"
|
|
9
|
+
import type { DeleteUserConfig } from "./delete-user-config"
|
|
10
|
+
import type { EmailAndPasswordConfig } from "./email-and-password-config"
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Core authentication configuration interface.
|
|
14
|
+
*
|
|
15
|
+
* Defines the base structure for authentication settings including paths,
|
|
16
|
+
* providers, navigation functions, and feature flags.
|
|
17
|
+
*/
|
|
18
|
+
export interface AuthConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Appearance/theme configuration
|
|
21
|
+
* @remarks `AppearanceConfig`
|
|
22
|
+
* @default { themes: ["system", "light", "dark"] }
|
|
23
|
+
*/
|
|
24
|
+
appearance: AppearanceConfig
|
|
25
|
+
/**
|
|
26
|
+
* Avatar upload, optimization, and deletion configuration.
|
|
27
|
+
* @remarks `AvatarConfig`
|
|
28
|
+
* @default { enabled: true, resize: resizeAvatar, size: 256, extension: "png" }
|
|
29
|
+
*/
|
|
30
|
+
avatar: AvatarConfig
|
|
31
|
+
/**
|
|
32
|
+
* Base paths for different application sections
|
|
33
|
+
* @remarks `BasePaths`
|
|
34
|
+
*/
|
|
35
|
+
basePaths: BasePaths
|
|
36
|
+
/**
|
|
37
|
+
* Base URL for API endpoints (optional)
|
|
38
|
+
* @default ""
|
|
39
|
+
*/
|
|
40
|
+
baseURL: string
|
|
41
|
+
/**
|
|
42
|
+
* Allow users to delete their account
|
|
43
|
+
* @remarks `DeleteUserConfig`
|
|
44
|
+
*/
|
|
45
|
+
deleteUser?: DeleteUserConfig
|
|
46
|
+
/**
|
|
47
|
+
* Email and password authentication configuration
|
|
48
|
+
* @remarks `EmailAndPasswordConfig`
|
|
49
|
+
*/
|
|
50
|
+
emailAndPassword: EmailAndPasswordConfig
|
|
51
|
+
/**
|
|
52
|
+
* Localization strings for UI components
|
|
53
|
+
* @remarks `Localization`
|
|
54
|
+
*/
|
|
55
|
+
localization: Localization
|
|
56
|
+
/** Whether magic link (passwordless) authentication is enabled */
|
|
57
|
+
magicLink?: boolean
|
|
58
|
+
/** Whether multi-session support is enabled */
|
|
59
|
+
multiSession?: boolean
|
|
60
|
+
/**
|
|
61
|
+
* Default redirect path after successful authentication
|
|
62
|
+
* @default "/"
|
|
63
|
+
*/
|
|
64
|
+
redirectTo: string
|
|
65
|
+
/**
|
|
66
|
+
* List of enabled social authentication providers
|
|
67
|
+
* @remarks `SocialProvider[]`
|
|
68
|
+
*/
|
|
69
|
+
socialProviders?: SocialProvider[]
|
|
70
|
+
/**
|
|
71
|
+
* View path mappings for different authentication views
|
|
72
|
+
* @remarks `ViewPaths`
|
|
73
|
+
*/
|
|
74
|
+
viewPaths: ViewPaths
|
|
75
|
+
/**
|
|
76
|
+
* Function to navigate to a new path
|
|
77
|
+
* @param options - Navigation options with href and optional replace flag
|
|
78
|
+
* @default window.location.href = href (or window.location.replace if replace: true)
|
|
79
|
+
* @example
|
|
80
|
+
* // TanStack Router
|
|
81
|
+
* navigate={navigate}
|
|
82
|
+
* // Next.js
|
|
83
|
+
* navigate={({href, replace}) => replace ? router.replace(href) : router.push(href)}
|
|
84
|
+
*/
|
|
85
|
+
navigate: (options: { to: string; replace?: boolean }) => void
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const defaultAuthConfig: AuthConfig = {
|
|
89
|
+
appearance: {
|
|
90
|
+
themes: ["system", "light", "dark"]
|
|
91
|
+
},
|
|
92
|
+
avatar: {
|
|
93
|
+
enabled: true,
|
|
94
|
+
resize: resizeAvatar,
|
|
95
|
+
size: 256,
|
|
96
|
+
extension: "png"
|
|
97
|
+
},
|
|
98
|
+
basePaths,
|
|
99
|
+
baseURL: "",
|
|
100
|
+
emailAndPassword: {
|
|
101
|
+
enabled: true,
|
|
102
|
+
forgotPassword: true,
|
|
103
|
+
rememberMe: false,
|
|
104
|
+
minPasswordLength: 8,
|
|
105
|
+
maxPasswordLength: 128
|
|
106
|
+
},
|
|
107
|
+
redirectTo: "/",
|
|
108
|
+
viewPaths,
|
|
109
|
+
localization,
|
|
110
|
+
navigate: ({ to, replace }) => {
|
|
111
|
+
if (replace) {
|
|
112
|
+
window.location.replace(to)
|
|
113
|
+
} else {
|
|
114
|
+
window.location.href = to
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for avatar handling.
|
|
3
|
+
*/
|
|
4
|
+
export type AvatarConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* Delete the current avatar (e.g. remove from storage).
|
|
7
|
+
* Gets called after the user's avatar is updated to null.
|
|
8
|
+
*/
|
|
9
|
+
delete?: (url: string) => Promise<void>
|
|
10
|
+
/**
|
|
11
|
+
* Whether avatar changing is enabled.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
enabled: boolean
|
|
15
|
+
/**
|
|
16
|
+
* Output image format.
|
|
17
|
+
* @default "png"
|
|
18
|
+
*/
|
|
19
|
+
extension: "png" | "jpg" | "webp" | "inherit"
|
|
20
|
+
/**
|
|
21
|
+
* Resize an image file before upload. Overrides the default resize behavior.
|
|
22
|
+
* @default Resizes to `size` pixels, square-cropped, output as `extension`.
|
|
23
|
+
*/
|
|
24
|
+
resize: (
|
|
25
|
+
file: File,
|
|
26
|
+
size?: number,
|
|
27
|
+
extension?: "png" | "jpg" | "webp" | "inherit"
|
|
28
|
+
) => Promise<File>
|
|
29
|
+
/**
|
|
30
|
+
* Max dimension in pixels for the optimized avatar.
|
|
31
|
+
* @default 256
|
|
32
|
+
*/
|
|
33
|
+
size: number
|
|
34
|
+
/**
|
|
35
|
+
* Upload a file and return the URL where it was stored.
|
|
36
|
+
* When undefined, the image is base64-encoded and saved directly to `user.image`.
|
|
37
|
+
*/
|
|
38
|
+
upload?: (file: File) => Promise<string>
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for account deletion in the UI (mirrors server `user.deleteUser` flags).
|
|
3
|
+
*/
|
|
4
|
+
export interface DeleteUserConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the delete user feature is enabled.
|
|
7
|
+
*/
|
|
8
|
+
enabled?: boolean
|
|
9
|
+
/**
|
|
10
|
+
* When `true`, matches server `sendDeleteAccountVerification`: deletion starts by sending a
|
|
11
|
+
* verification email instead of deleting immediately in this request.
|
|
12
|
+
*/
|
|
13
|
+
sendDeleteAccountVerification?: boolean
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for email and password authentication.
|
|
3
|
+
*/
|
|
4
|
+
export type EmailAndPasswordConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether email/password authentication is enabled
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
enabled: boolean
|
|
10
|
+
/**
|
|
11
|
+
* Whether to show a confirm password field on sign-up forms
|
|
12
|
+
*/
|
|
13
|
+
confirmPassword?: boolean
|
|
14
|
+
/**
|
|
15
|
+
* Whether users can reset forgotten passwords
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
forgotPassword: boolean
|
|
19
|
+
/**
|
|
20
|
+
* Maximum password length
|
|
21
|
+
* @default 128
|
|
22
|
+
*/
|
|
23
|
+
maxPasswordLength: number
|
|
24
|
+
/**
|
|
25
|
+
* Minimum password length
|
|
26
|
+
* @default 8
|
|
27
|
+
*/
|
|
28
|
+
minPasswordLength: number
|
|
29
|
+
/**
|
|
30
|
+
* Maximum password length
|
|
31
|
+
* @default 128
|
|
32
|
+
*/
|
|
33
|
+
/** Whether to show a "Remember me" checkbox on sign-in forms */
|
|
34
|
+
rememberMe?: boolean
|
|
35
|
+
/** Whether email verification is required before account activation */
|
|
36
|
+
requireEmailVerification?: boolean
|
|
37
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base path configuration for authentication, settings, and organization routes.
|
|
3
|
+
*/
|
|
4
|
+
export type BasePaths = {
|
|
5
|
+
/**
|
|
6
|
+
* Base path for authentication routes
|
|
7
|
+
* @default "/auth"
|
|
8
|
+
*/
|
|
9
|
+
auth: string
|
|
10
|
+
/**
|
|
11
|
+
* Base path for settings routes
|
|
12
|
+
* @default "/settings"
|
|
13
|
+
*/
|
|
14
|
+
settings: string
|
|
15
|
+
/**
|
|
16
|
+
* Base path for organization management routes
|
|
17
|
+
* @default "/organization"
|
|
18
|
+
*/
|
|
19
|
+
organization: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const basePaths: BasePaths = {
|
|
23
|
+
auth: "/auth",
|
|
24
|
+
settings: "/settings",
|
|
25
|
+
organization: "/organization"
|
|
26
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
export const localization = {
|
|
2
|
+
auth: {
|
|
3
|
+
/** @remarks `"Account"` */
|
|
4
|
+
account: "Account",
|
|
5
|
+
|
|
6
|
+
/** @remarks `"Add Account"` */
|
|
7
|
+
addAccount: "Add Account",
|
|
8
|
+
|
|
9
|
+
/** @remarks `"Already have an account?"` */
|
|
10
|
+
alreadyHaveAnAccount: "Already have an account?",
|
|
11
|
+
|
|
12
|
+
/** @remarks `"Confirm password"` */
|
|
13
|
+
confirmPassword: "Confirm password",
|
|
14
|
+
|
|
15
|
+
/** @remarks `"Confirm your password"` */
|
|
16
|
+
confirmPasswordPlaceholder: "Confirm your password",
|
|
17
|
+
|
|
18
|
+
/** @remarks `"Continue with {{provider}}"` */
|
|
19
|
+
continueWith: "Continue with {{provider}}",
|
|
20
|
+
|
|
21
|
+
/** @remarks `"Email"` */
|
|
22
|
+
email: "Email",
|
|
23
|
+
|
|
24
|
+
/** @remarks `"Enter your email"` */
|
|
25
|
+
emailPlaceholder: "Enter your email",
|
|
26
|
+
|
|
27
|
+
/** @remarks `"Forgot Password"` */
|
|
28
|
+
forgotPassword: "Forgot Password",
|
|
29
|
+
|
|
30
|
+
/** @remarks `"Forgot password?"` */
|
|
31
|
+
forgotPasswordLink: "Forgot password?",
|
|
32
|
+
|
|
33
|
+
/** @remarks `"Hide password"` */
|
|
34
|
+
hidePassword: "Hide password",
|
|
35
|
+
|
|
36
|
+
/** @remarks `"Invalid reset password token"` */
|
|
37
|
+
invalidResetPasswordToken: "Invalid reset password token",
|
|
38
|
+
|
|
39
|
+
/** @remarks `"Magic Link"` */
|
|
40
|
+
magicLink: "Magic Link",
|
|
41
|
+
|
|
42
|
+
/** @remarks `"Magic link sent to your email"` */
|
|
43
|
+
magicLinkSent: "Magic link sent to your email",
|
|
44
|
+
|
|
45
|
+
/** @remarks `"Name"` */
|
|
46
|
+
name: "Name",
|
|
47
|
+
|
|
48
|
+
/** @remarks `"Enter your name"` */
|
|
49
|
+
namePlaceholder: "Enter your name",
|
|
50
|
+
|
|
51
|
+
/** @remarks `"Need to create an account?"` */
|
|
52
|
+
needToCreateAnAccount: "Need to create an account?",
|
|
53
|
+
|
|
54
|
+
/** @remarks `"New password"` */
|
|
55
|
+
newPassword: "New password",
|
|
56
|
+
|
|
57
|
+
/** @remarks `"Enter your new password"` */
|
|
58
|
+
newPasswordPlaceholder: "Enter your new password",
|
|
59
|
+
|
|
60
|
+
/** @remarks `"OR"` */
|
|
61
|
+
or: "OR",
|
|
62
|
+
|
|
63
|
+
/** @remarks `"Password"` */
|
|
64
|
+
password: "Password",
|
|
65
|
+
|
|
66
|
+
/** @remarks `"Enter your password"` */
|
|
67
|
+
passwordPlaceholder: "Enter your password",
|
|
68
|
+
|
|
69
|
+
/** @remarks `"Password reset email sent"` */
|
|
70
|
+
passwordResetEmailSent: "Password reset email sent",
|
|
71
|
+
|
|
72
|
+
/** @remarks `"Password reset successfully"` */
|
|
73
|
+
passwordResetSuccess: "Password reset successfully",
|
|
74
|
+
|
|
75
|
+
/** @remarks `"Passwords do not match"` */
|
|
76
|
+
passwordsDoNotMatch: "Passwords do not match",
|
|
77
|
+
|
|
78
|
+
/** @remarks `"Remember me"` */
|
|
79
|
+
rememberMe: "Remember me",
|
|
80
|
+
|
|
81
|
+
/** @remarks `"Remember your password?"` */
|
|
82
|
+
rememberYourPassword: "Remember your password?",
|
|
83
|
+
|
|
84
|
+
/** @remarks `"Resend"` */
|
|
85
|
+
resend: "Resend",
|
|
86
|
+
|
|
87
|
+
/** @remarks `"Reset Password"` */
|
|
88
|
+
resetPassword: "Reset Password",
|
|
89
|
+
|
|
90
|
+
/** @remarks `"Send Magic Link"` */
|
|
91
|
+
sendMagicLink: "Send Magic Link",
|
|
92
|
+
|
|
93
|
+
/** @remarks `"Send reset link"` */
|
|
94
|
+
sendResetLink: "Send reset link",
|
|
95
|
+
|
|
96
|
+
/** @remarks `"Show password"` */
|
|
97
|
+
showPassword: "Show password",
|
|
98
|
+
|
|
99
|
+
/** @remarks `"Sign In"` */
|
|
100
|
+
signIn: "Sign In",
|
|
101
|
+
|
|
102
|
+
/** @remarks `"Sign Out"` */
|
|
103
|
+
signOut: "Sign Out",
|
|
104
|
+
|
|
105
|
+
/** @remarks `"Sign Up"` */
|
|
106
|
+
signUp: "Sign Up",
|
|
107
|
+
|
|
108
|
+
/** @remarks `"Switch Account"` */
|
|
109
|
+
switchAccount: "Switch Account",
|
|
110
|
+
|
|
111
|
+
/** @remarks `"Verification email sent!"` */
|
|
112
|
+
verificationEmailSent: "Verification email sent!",
|
|
113
|
+
|
|
114
|
+
/** @remarks `"Verify your email"` */
|
|
115
|
+
verifyYourEmail: "Verify your email"
|
|
116
|
+
},
|
|
117
|
+
settings: {
|
|
118
|
+
/** @remarks `"Account"` */
|
|
119
|
+
account: "Account",
|
|
120
|
+
|
|
121
|
+
/** @remarks `"Account unlinked"` */
|
|
122
|
+
accountUnlinked: "Account unlinked",
|
|
123
|
+
|
|
124
|
+
/** @remarks `"Active"` */
|
|
125
|
+
active: "Active",
|
|
126
|
+
|
|
127
|
+
/** @remarks `"Active sessions"` */
|
|
128
|
+
activeSessions: "Active sessions",
|
|
129
|
+
|
|
130
|
+
/** @remarks `"Avatar"` */
|
|
131
|
+
avatar: "Avatar",
|
|
132
|
+
|
|
133
|
+
/** @remarks `"Current session"` */
|
|
134
|
+
currentSession: "Current session",
|
|
135
|
+
|
|
136
|
+
/** @remarks `"Avatar changed successfully"` */
|
|
137
|
+
avatarChangedSuccess: "Avatar changed successfully",
|
|
138
|
+
|
|
139
|
+
/** @remarks `"Avatar deleted successfully"` */
|
|
140
|
+
avatarDeletedSuccess: "Avatar deleted successfully",
|
|
141
|
+
|
|
142
|
+
/** @remarks `"Change avatar"` */
|
|
143
|
+
changeAvatar: "Change avatar",
|
|
144
|
+
|
|
145
|
+
/** @remarks `"Delete avatar"` */
|
|
146
|
+
deleteAvatar: "Delete avatar",
|
|
147
|
+
|
|
148
|
+
/** @remarks `"Link"` */
|
|
149
|
+
link: "Link",
|
|
150
|
+
|
|
151
|
+
/** @remarks `"Linked accounts"` */
|
|
152
|
+
linkedAccounts: "Linked accounts",
|
|
153
|
+
|
|
154
|
+
/** @remarks `"Link your {{provider}} account"` */
|
|
155
|
+
linkProvider: "Link your {{provider}} account",
|
|
156
|
+
|
|
157
|
+
/** @remarks `"Appearance"` */
|
|
158
|
+
appearance: "Appearance",
|
|
159
|
+
|
|
160
|
+
/** @remarks `"Cancel"` */
|
|
161
|
+
cancel: "Cancel",
|
|
162
|
+
|
|
163
|
+
/** @remarks `"Change email"` */
|
|
164
|
+
changeEmail: "Change email",
|
|
165
|
+
|
|
166
|
+
/** @remarks `"Check your email to confirm the change"` */
|
|
167
|
+
changeEmailSuccess: "Check your email to confirm the change",
|
|
168
|
+
|
|
169
|
+
/** @remarks `"Change password"` */
|
|
170
|
+
changePassword: "Change password",
|
|
171
|
+
|
|
172
|
+
/** @remarks `"Password changed successfully"` */
|
|
173
|
+
changePasswordSuccess: "Password changed successfully",
|
|
174
|
+
|
|
175
|
+
/** @remarks `"Current password"` */
|
|
176
|
+
currentPassword: "Current password",
|
|
177
|
+
|
|
178
|
+
/** @remarks `"Enter your current password"` */
|
|
179
|
+
currentPasswordPlaceholder: "Enter your current password",
|
|
180
|
+
|
|
181
|
+
/** @remarks `"Dark"` */
|
|
182
|
+
dark: "Dark",
|
|
183
|
+
|
|
184
|
+
/** @remarks `"Danger zone"` */
|
|
185
|
+
dangerZone: "Danger zone",
|
|
186
|
+
|
|
187
|
+
/** @remarks `"Delete user"` */
|
|
188
|
+
deleteUser: "Delete user",
|
|
189
|
+
|
|
190
|
+
/** @remarks `"Permanently remove your account and all associated data. This cannot be undone."` */
|
|
191
|
+
deleteUserDescription:
|
|
192
|
+
"Permanently remove your account and all associated data. This cannot be undone.",
|
|
193
|
+
|
|
194
|
+
/** @remarks `"Check your email to confirm account deletion."` */
|
|
195
|
+
deleteUserVerificationSent: "Check your email to confirm account deletion.",
|
|
196
|
+
|
|
197
|
+
/** @remarks `"Your account has been deleted."` */
|
|
198
|
+
deleteUserSuccess: "Your account has been deleted.",
|
|
199
|
+
|
|
200
|
+
/** @remarks `"Light"` */
|
|
201
|
+
light: "Light",
|
|
202
|
+
|
|
203
|
+
/** @remarks `"Manage accounts"` */
|
|
204
|
+
manageAccounts: "Manage accounts",
|
|
205
|
+
|
|
206
|
+
/** @remarks `"Profile"` */
|
|
207
|
+
profile: "Profile",
|
|
208
|
+
|
|
209
|
+
/** @remarks `"Profile updated successfully"` */
|
|
210
|
+
profileUpdatedSuccess: "Profile updated successfully",
|
|
211
|
+
|
|
212
|
+
/** @remarks `"Revoke"` */
|
|
213
|
+
revoke: "Revoke",
|
|
214
|
+
|
|
215
|
+
/** @remarks `"Revoke session"` */
|
|
216
|
+
revokeSession: "Revoke session",
|
|
217
|
+
|
|
218
|
+
/** @remarks `"Session revoked successfully"` */
|
|
219
|
+
revokeSessionSuccess: "Session revoked successfully",
|
|
220
|
+
|
|
221
|
+
/** @remarks `"Save changes"` */
|
|
222
|
+
saveChanges: "Save changes",
|
|
223
|
+
|
|
224
|
+
/** @remarks `"Set password"` */
|
|
225
|
+
setPassword: "Set password",
|
|
226
|
+
|
|
227
|
+
/** @remarks `"You don't have a password yet. Request a reset link to set one up."` */
|
|
228
|
+
setPasswordDescription:
|
|
229
|
+
"You don't have a password yet. Request a reset link to set one up.",
|
|
230
|
+
|
|
231
|
+
/** @remarks `"Security"` */
|
|
232
|
+
security: "Security",
|
|
233
|
+
|
|
234
|
+
/** @remarks `"Settings"` */
|
|
235
|
+
settings: "Settings",
|
|
236
|
+
|
|
237
|
+
/** @remarks `"System"` */
|
|
238
|
+
system: "System",
|
|
239
|
+
|
|
240
|
+
/** @remarks `"Theme"` */
|
|
241
|
+
theme: "Theme",
|
|
242
|
+
|
|
243
|
+
/** @remarks `"Unlink {{provider}}"` */
|
|
244
|
+
unlinkProvider: "Unlink {{provider}}",
|
|
245
|
+
|
|
246
|
+
/** @remarks `"Update email"` */
|
|
247
|
+
updateEmail: "Update email",
|
|
248
|
+
|
|
249
|
+
/** @remarks `"Update password"` */
|
|
250
|
+
updatePassword: "Update password",
|
|
251
|
+
|
|
252
|
+
/** @remarks `"Upload avatar"` */
|
|
253
|
+
uploadAvatar: "Upload avatar"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type Localization = typeof localization
|
|
258
|
+
export type AuthLocalization = Localization["auth"]
|
|
259
|
+
export type SettingsLocalization = Localization["settings"]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { SocialProvider } from "better-auth/social-providers"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mapping of social authentication provider identifiers to their human-readable display names.
|
|
5
|
+
*/
|
|
6
|
+
export const providerNames: Record<SocialProvider, string> = {
|
|
7
|
+
apple: "Apple",
|
|
8
|
+
atlassian: "Atlassian",
|
|
9
|
+
cognito: "Cognito",
|
|
10
|
+
discord: "Discord",
|
|
11
|
+
dropbox: "Dropbox",
|
|
12
|
+
facebook: "Facebook",
|
|
13
|
+
figma: "Figma",
|
|
14
|
+
github: "GitHub",
|
|
15
|
+
gitlab: "GitLab",
|
|
16
|
+
google: "Google",
|
|
17
|
+
huggingface: "Hugging Face",
|
|
18
|
+
kakao: "Kakao",
|
|
19
|
+
kick: "Kick",
|
|
20
|
+
line: "LINE",
|
|
21
|
+
linear: "Linear",
|
|
22
|
+
linkedin: "LinkedIn",
|
|
23
|
+
microsoft: "Microsoft",
|
|
24
|
+
naver: "Naver",
|
|
25
|
+
notion: "Notion",
|
|
26
|
+
paybin: "Paybin",
|
|
27
|
+
paypal: "PayPal",
|
|
28
|
+
polar: "Polar",
|
|
29
|
+
railway: "Railway",
|
|
30
|
+
reddit: "Reddit",
|
|
31
|
+
roblox: "Roblox",
|
|
32
|
+
salesforce: "Salesforce",
|
|
33
|
+
slack: "Slack",
|
|
34
|
+
spotify: "Spotify",
|
|
35
|
+
tiktok: "TikTok",
|
|
36
|
+
twitch: "Twitch",
|
|
37
|
+
twitter: "X",
|
|
38
|
+
vercel: "Vercel",
|
|
39
|
+
vk: "VK",
|
|
40
|
+
wechat: "WeChat",
|
|
41
|
+
zoom: "Zoom"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get the human-readable display name for an authentication provider.
|
|
46
|
+
*
|
|
47
|
+
* @param provider - The provider identifier (e.g., "github", "google").
|
|
48
|
+
* @returns The mapped display name for `provider` if available, otherwise `provider` with its first character capitalized.
|
|
49
|
+
*/
|
|
50
|
+
export function getProviderName(provider: string) {
|
|
51
|
+
return (
|
|
52
|
+
providerNames[provider as SocialProvider] ||
|
|
53
|
+
provider.charAt(0).toUpperCase() + provider.slice(1)
|
|
54
|
+
)
|
|
55
|
+
}
|