@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,145 @@
|
|
|
1
|
+
export declare const localization: {
|
|
2
|
+
auth: {
|
|
3
|
+
/** @remarks `"Account"` */
|
|
4
|
+
account: string;
|
|
5
|
+
/** @remarks `"Add Account"` */
|
|
6
|
+
addAccount: string;
|
|
7
|
+
/** @remarks `"Already have an account?"` */
|
|
8
|
+
alreadyHaveAnAccount: string;
|
|
9
|
+
/** @remarks `"Confirm Password"` */
|
|
10
|
+
confirmPassword: string;
|
|
11
|
+
/** @remarks `"Confirm your password"` */
|
|
12
|
+
confirmPasswordPlaceholder: string;
|
|
13
|
+
/** @remarks `"Continue with {{provider}}"` */
|
|
14
|
+
continueWith: string;
|
|
15
|
+
/** @remarks `"Email"` */
|
|
16
|
+
email: string;
|
|
17
|
+
/** @remarks `"Enter your email"` */
|
|
18
|
+
emailPlaceholder: string;
|
|
19
|
+
/** @remarks `"Forgot Password"` */
|
|
20
|
+
forgotPassword: string;
|
|
21
|
+
/** @remarks `"Forgot password?"` */
|
|
22
|
+
forgotPasswordLink: string;
|
|
23
|
+
/** @remarks `"Hide password"` */
|
|
24
|
+
hidePassword: string;
|
|
25
|
+
/** @remarks `"Invalid reset password token"` */
|
|
26
|
+
invalidResetPasswordToken: string;
|
|
27
|
+
/** @remarks `"Magic Link"` */
|
|
28
|
+
magicLink: string;
|
|
29
|
+
/** @remarks `"Magic link sent to your email"` */
|
|
30
|
+
magicLinkSent: string;
|
|
31
|
+
/** @remarks `"Name"` */
|
|
32
|
+
name: string;
|
|
33
|
+
/** @remarks `"Enter your name"` */
|
|
34
|
+
namePlaceholder: string;
|
|
35
|
+
/** @remarks `"Need to create an account?"` */
|
|
36
|
+
needToCreateAnAccount: string;
|
|
37
|
+
/** @remarks `"New Password"` */
|
|
38
|
+
newPassword: string;
|
|
39
|
+
/** @remarks `"Enter your new password"` */
|
|
40
|
+
newPasswordPlaceholder: string;
|
|
41
|
+
/** @remarks `"OR"` */
|
|
42
|
+
or: string;
|
|
43
|
+
/** @remarks `"Password"` */
|
|
44
|
+
password: string;
|
|
45
|
+
/** @remarks `"Enter your password"` */
|
|
46
|
+
passwordPlaceholder: string;
|
|
47
|
+
/** @remarks `"Password reset email sent"` */
|
|
48
|
+
passwordResetEmailSent: string;
|
|
49
|
+
/** @remarks `"Password reset successfully"` */
|
|
50
|
+
passwordResetSuccess: string;
|
|
51
|
+
/** @remarks `"Passwords do not match"` */
|
|
52
|
+
passwordsDoNotMatch: string;
|
|
53
|
+
/** @remarks `"Remember me"` */
|
|
54
|
+
rememberMe: string;
|
|
55
|
+
/** @remarks `"Remember your password?"` */
|
|
56
|
+
rememberYourPassword: string;
|
|
57
|
+
/** @remarks `"Resend"` */
|
|
58
|
+
resend: string;
|
|
59
|
+
/** @remarks `"Reset Password"` */
|
|
60
|
+
resetPassword: string;
|
|
61
|
+
/** @remarks `"Send Magic Link"` */
|
|
62
|
+
sendMagicLink: string;
|
|
63
|
+
/** @remarks `"Send Reset Link"` */
|
|
64
|
+
sendResetLink: string;
|
|
65
|
+
/** @remarks `"Show password"` */
|
|
66
|
+
showPassword: string;
|
|
67
|
+
/** @remarks `"Sign In"` */
|
|
68
|
+
signIn: string;
|
|
69
|
+
/** @remarks `"Sign Out"` */
|
|
70
|
+
signOut: string;
|
|
71
|
+
/** @remarks `"Sign Up"` */
|
|
72
|
+
signUp: string;
|
|
73
|
+
/** @remarks `"Switch Account"` */
|
|
74
|
+
switchAccount: string;
|
|
75
|
+
/** @remarks `"Verification email sent!"` */
|
|
76
|
+
verificationEmailSent: string;
|
|
77
|
+
/** @remarks `"Verify your email"` */
|
|
78
|
+
verifyYourEmail: string;
|
|
79
|
+
};
|
|
80
|
+
settings: {
|
|
81
|
+
/** @remarks `"Account"` */
|
|
82
|
+
account: string;
|
|
83
|
+
/** @remarks `"Account unlinked"` */
|
|
84
|
+
accountUnlinked: string;
|
|
85
|
+
/** @remarks `"Active"` */
|
|
86
|
+
active: string;
|
|
87
|
+
/** @remarks `"Active Sessions"` */
|
|
88
|
+
activeSessions: string;
|
|
89
|
+
/** @remarks `"Current Session"` */
|
|
90
|
+
currentSession: string;
|
|
91
|
+
/** @remarks `"Link"` */
|
|
92
|
+
link: string;
|
|
93
|
+
/** @remarks `"Linked Accounts"` */
|
|
94
|
+
linkedAccounts: string;
|
|
95
|
+
/** @remarks `"Link {{provider}}"` */
|
|
96
|
+
linkProvider: string;
|
|
97
|
+
/** @remarks `"Appearance"` */
|
|
98
|
+
appearance: string;
|
|
99
|
+
/** @remarks `"Change Email"` */
|
|
100
|
+
changeEmail: string;
|
|
101
|
+
/** @remarks `"Check your email to confirm the change"` */
|
|
102
|
+
changeEmailSuccess: string;
|
|
103
|
+
/** @remarks `"Change Password"` */
|
|
104
|
+
changePassword: string;
|
|
105
|
+
/** @remarks `"Password changed successfully"` */
|
|
106
|
+
changePasswordSuccess: string;
|
|
107
|
+
/** @remarks `"Current Password"` */
|
|
108
|
+
currentPassword: string;
|
|
109
|
+
/** @remarks `"Enter your current password"` */
|
|
110
|
+
currentPasswordPlaceholder: string;
|
|
111
|
+
/** @remarks `"Dark"` */
|
|
112
|
+
dark: string;
|
|
113
|
+
/** @remarks `"Light"` */
|
|
114
|
+
light: string;
|
|
115
|
+
/** @remarks `"Manage Accounts"` */
|
|
116
|
+
manageAccounts: string;
|
|
117
|
+
/** @remarks `"Profile"` */
|
|
118
|
+
profile: string;
|
|
119
|
+
/** @remarks `"Profile updated successfully"` */
|
|
120
|
+
profileUpdatedSuccess: string;
|
|
121
|
+
/** @remarks `"Revoke Session"` */
|
|
122
|
+
revokeSession: string;
|
|
123
|
+
/** @remarks `"Session revoked successfully"` */
|
|
124
|
+
revokeSessionSuccess: string;
|
|
125
|
+
/** @remarks `"Save changes"` */
|
|
126
|
+
saveChanges: string;
|
|
127
|
+
/** @remarks `"Security"` */
|
|
128
|
+
security: string;
|
|
129
|
+
/** @remarks `"Settings"` */
|
|
130
|
+
settings: string;
|
|
131
|
+
/** @remarks `"System"` */
|
|
132
|
+
system: string;
|
|
133
|
+
/** @remarks `"Theme"` */
|
|
134
|
+
theme: string;
|
|
135
|
+
/** @remarks `"Unlink {{provider}}"` */
|
|
136
|
+
unlinkProvider: string;
|
|
137
|
+
/** @remarks `"Update Email"` */
|
|
138
|
+
updateEmail: string;
|
|
139
|
+
/** @remarks `"Update Password"` */
|
|
140
|
+
updatePassword: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export type Localization = typeof localization;
|
|
144
|
+
export type AuthLocalization = Localization["auth"];
|
|
145
|
+
export type SettingsLocalization = Localization["settings"];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const localization = {
|
|
2
|
+
auth: {
|
|
3
|
+
/** @remarks `"Account"` */
|
|
4
|
+
account: "Account",
|
|
5
|
+
/** @remarks `"Add Account"` */
|
|
6
|
+
addAccount: "Add Account",
|
|
7
|
+
/** @remarks `"Already have an account?"` */
|
|
8
|
+
alreadyHaveAnAccount: "Already have an account?",
|
|
9
|
+
/** @remarks `"Confirm Password"` */
|
|
10
|
+
confirmPassword: "Confirm Password",
|
|
11
|
+
/** @remarks `"Confirm your password"` */
|
|
12
|
+
confirmPasswordPlaceholder: "Confirm your password",
|
|
13
|
+
/** @remarks `"Continue with {{provider}}"` */
|
|
14
|
+
continueWith: "Continue with {{provider}}",
|
|
15
|
+
/** @remarks `"Email"` */
|
|
16
|
+
email: "Email",
|
|
17
|
+
/** @remarks `"Enter your email"` */
|
|
18
|
+
emailPlaceholder: "Enter your email",
|
|
19
|
+
/** @remarks `"Forgot Password"` */
|
|
20
|
+
forgotPassword: "Forgot Password",
|
|
21
|
+
/** @remarks `"Forgot password?"` */
|
|
22
|
+
forgotPasswordLink: "Forgot password?",
|
|
23
|
+
/** @remarks `"Hide password"` */
|
|
24
|
+
hidePassword: "Hide password",
|
|
25
|
+
/** @remarks `"Invalid reset password token"` */
|
|
26
|
+
invalidResetPasswordToken: "Invalid reset password token",
|
|
27
|
+
/** @remarks `"Magic Link"` */
|
|
28
|
+
magicLink: "Magic Link",
|
|
29
|
+
/** @remarks `"Magic link sent to your email"` */
|
|
30
|
+
magicLinkSent: "Magic link sent to your email",
|
|
31
|
+
/** @remarks `"Name"` */
|
|
32
|
+
name: "Name",
|
|
33
|
+
/** @remarks `"Enter your name"` */
|
|
34
|
+
namePlaceholder: "Enter your name",
|
|
35
|
+
/** @remarks `"Need to create an account?"` */
|
|
36
|
+
needToCreateAnAccount: "Need to create an account?",
|
|
37
|
+
/** @remarks `"New Password"` */
|
|
38
|
+
newPassword: "New Password",
|
|
39
|
+
/** @remarks `"Enter your new password"` */
|
|
40
|
+
newPasswordPlaceholder: "Enter your new password",
|
|
41
|
+
/** @remarks `"OR"` */
|
|
42
|
+
or: "OR",
|
|
43
|
+
/** @remarks `"Password"` */
|
|
44
|
+
password: "Password",
|
|
45
|
+
/** @remarks `"Enter your password"` */
|
|
46
|
+
passwordPlaceholder: "Enter your password",
|
|
47
|
+
/** @remarks `"Password reset email sent"` */
|
|
48
|
+
passwordResetEmailSent: "Password reset email sent",
|
|
49
|
+
/** @remarks `"Password reset successfully"` */
|
|
50
|
+
passwordResetSuccess: "Password reset successfully",
|
|
51
|
+
/** @remarks `"Passwords do not match"` */
|
|
52
|
+
passwordsDoNotMatch: "Passwords do not match",
|
|
53
|
+
/** @remarks `"Remember me"` */
|
|
54
|
+
rememberMe: "Remember me",
|
|
55
|
+
/** @remarks `"Remember your password?"` */
|
|
56
|
+
rememberYourPassword: "Remember your password?",
|
|
57
|
+
/** @remarks `"Resend"` */
|
|
58
|
+
resend: "Resend",
|
|
59
|
+
/** @remarks `"Reset Password"` */
|
|
60
|
+
resetPassword: "Reset Password",
|
|
61
|
+
/** @remarks `"Send Magic Link"` */
|
|
62
|
+
sendMagicLink: "Send Magic Link",
|
|
63
|
+
/** @remarks `"Send Reset Link"` */
|
|
64
|
+
sendResetLink: "Send Reset Link",
|
|
65
|
+
/** @remarks `"Show password"` */
|
|
66
|
+
showPassword: "Show password",
|
|
67
|
+
/** @remarks `"Sign In"` */
|
|
68
|
+
signIn: "Sign In",
|
|
69
|
+
/** @remarks `"Sign Out"` */
|
|
70
|
+
signOut: "Sign Out",
|
|
71
|
+
/** @remarks `"Sign Up"` */
|
|
72
|
+
signUp: "Sign Up",
|
|
73
|
+
/** @remarks `"Switch Account"` */
|
|
74
|
+
switchAccount: "Switch Account",
|
|
75
|
+
/** @remarks `"Verification email sent!"` */
|
|
76
|
+
verificationEmailSent: "Verification email sent!",
|
|
77
|
+
/** @remarks `"Verify your email"` */
|
|
78
|
+
verifyYourEmail: "Verify your email"
|
|
79
|
+
},
|
|
80
|
+
settings: {
|
|
81
|
+
/** @remarks `"Account"` */
|
|
82
|
+
account: "Account",
|
|
83
|
+
/** @remarks `"Account unlinked"` */
|
|
84
|
+
accountUnlinked: "Account unlinked",
|
|
85
|
+
/** @remarks `"Active"` */
|
|
86
|
+
active: "Active",
|
|
87
|
+
/** @remarks `"Active Sessions"` */
|
|
88
|
+
activeSessions: "Active Sessions",
|
|
89
|
+
/** @remarks `"Current Session"` */
|
|
90
|
+
currentSession: "Current Session",
|
|
91
|
+
/** @remarks `"Link"` */
|
|
92
|
+
link: "Link",
|
|
93
|
+
/** @remarks `"Linked Accounts"` */
|
|
94
|
+
linkedAccounts: "Linked Accounts",
|
|
95
|
+
/** @remarks `"Link {{provider}}"` */
|
|
96
|
+
linkProvider: "Link {{provider}}",
|
|
97
|
+
/** @remarks `"Appearance"` */
|
|
98
|
+
appearance: "Appearance",
|
|
99
|
+
/** @remarks `"Change Email"` */
|
|
100
|
+
changeEmail: "Change Email",
|
|
101
|
+
/** @remarks `"Check your email to confirm the change"` */
|
|
102
|
+
changeEmailSuccess: "Check your email to confirm the change",
|
|
103
|
+
/** @remarks `"Change Password"` */
|
|
104
|
+
changePassword: "Change Password",
|
|
105
|
+
/** @remarks `"Password changed successfully"` */
|
|
106
|
+
changePasswordSuccess: "Password changed successfully",
|
|
107
|
+
/** @remarks `"Current Password"` */
|
|
108
|
+
currentPassword: "Current Password",
|
|
109
|
+
/** @remarks `"Enter your current password"` */
|
|
110
|
+
currentPasswordPlaceholder: "Enter your current password",
|
|
111
|
+
/** @remarks `"Dark"` */
|
|
112
|
+
dark: "Dark",
|
|
113
|
+
/** @remarks `"Light"` */
|
|
114
|
+
light: "Light",
|
|
115
|
+
/** @remarks `"Manage Accounts"` */
|
|
116
|
+
manageAccounts: "Manage Accounts",
|
|
117
|
+
/** @remarks `"Profile"` */
|
|
118
|
+
profile: "Profile",
|
|
119
|
+
/** @remarks `"Profile updated successfully"` */
|
|
120
|
+
profileUpdatedSuccess: "Profile updated successfully",
|
|
121
|
+
/** @remarks `"Revoke Session"` */
|
|
122
|
+
revokeSession: "Revoke Session",
|
|
123
|
+
/** @remarks `"Session revoked successfully"` */
|
|
124
|
+
revokeSessionSuccess: "Session revoked successfully",
|
|
125
|
+
/** @remarks `"Save changes"` */
|
|
126
|
+
saveChanges: "Save changes",
|
|
127
|
+
/** @remarks `"Security"` */
|
|
128
|
+
security: "Security",
|
|
129
|
+
/** @remarks `"Settings"` */
|
|
130
|
+
settings: "Settings",
|
|
131
|
+
/** @remarks `"System"` */
|
|
132
|
+
system: "System",
|
|
133
|
+
/** @remarks `"Theme"` */
|
|
134
|
+
theme: "Theme",
|
|
135
|
+
/** @remarks `"Unlink {{provider}}"` */
|
|
136
|
+
unlinkProvider: "Unlink {{provider}}",
|
|
137
|
+
/** @remarks `"Update Email"` */
|
|
138
|
+
updateEmail: "Update Email",
|
|
139
|
+
/** @remarks `"Update Password"` */
|
|
140
|
+
updatePassword: "Update Password"
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SocialProvider } from "better-auth/social-providers";
|
|
2
|
+
/**
|
|
3
|
+
* Mapping of social authentication provider identifiers to their human-readable display names.
|
|
4
|
+
*/
|
|
5
|
+
export declare const providerNames: Record<SocialProvider, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Get the human-readable display name for an authentication provider.
|
|
8
|
+
*
|
|
9
|
+
* @param provider - The provider identifier (e.g., "github", "google").
|
|
10
|
+
* @returns The mapped display name for `provider` if available, otherwise `provider` with its first character capitalized.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getProviderName(provider: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping of social authentication provider identifiers to their human-readable display names.
|
|
3
|
+
*/
|
|
4
|
+
export const providerNames = {
|
|
5
|
+
apple: "Apple",
|
|
6
|
+
atlassian: "Atlassian",
|
|
7
|
+
cognito: "Cognito",
|
|
8
|
+
discord: "Discord",
|
|
9
|
+
dropbox: "Dropbox",
|
|
10
|
+
facebook: "Facebook",
|
|
11
|
+
figma: "Figma",
|
|
12
|
+
github: "GitHub",
|
|
13
|
+
gitlab: "GitLab",
|
|
14
|
+
google: "Google",
|
|
15
|
+
huggingface: "Hugging Face",
|
|
16
|
+
kakao: "Kakao",
|
|
17
|
+
kick: "Kick",
|
|
18
|
+
line: "LINE",
|
|
19
|
+
linear: "Linear",
|
|
20
|
+
linkedin: "LinkedIn",
|
|
21
|
+
microsoft: "Microsoft",
|
|
22
|
+
naver: "Naver",
|
|
23
|
+
notion: "Notion",
|
|
24
|
+
paybin: "Paybin",
|
|
25
|
+
paypal: "PayPal",
|
|
26
|
+
polar: "Polar",
|
|
27
|
+
railway: "Railway",
|
|
28
|
+
reddit: "Reddit",
|
|
29
|
+
roblox: "Roblox",
|
|
30
|
+
salesforce: "Salesforce",
|
|
31
|
+
slack: "Slack",
|
|
32
|
+
spotify: "Spotify",
|
|
33
|
+
tiktok: "TikTok",
|
|
34
|
+
twitch: "Twitch",
|
|
35
|
+
twitter: "X",
|
|
36
|
+
vercel: "Vercel",
|
|
37
|
+
vk: "VK",
|
|
38
|
+
zoom: "Zoom"
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get the human-readable display name for an authentication provider.
|
|
42
|
+
*
|
|
43
|
+
* @param provider - The provider identifier (e.g., "github", "google").
|
|
44
|
+
* @returns The mapped display name for `provider` if available, otherwise `provider` with its first character capitalized.
|
|
45
|
+
*/
|
|
46
|
+
export function getProviderName(provider) {
|
|
47
|
+
return (providerNames[provider] ||
|
|
48
|
+
provider.charAt(0).toUpperCase() + provider.slice(1));
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepmerge<T>(target: T, source: Partial<T>): T;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function isObject(item) {
|
|
2
|
+
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
3
|
+
}
|
|
4
|
+
function isPlainObject(item) {
|
|
5
|
+
if (!isObject(item))
|
|
6
|
+
return false;
|
|
7
|
+
// Handle special object types that should not be merged
|
|
8
|
+
if (item instanceof Date)
|
|
9
|
+
return false;
|
|
10
|
+
if (item instanceof RegExp)
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
export function deepmerge(target, source) {
|
|
15
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
|
16
|
+
const result = { ...target };
|
|
17
|
+
for (const [key, value] of Object.entries(source)) {
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
continue; // skip undefineds
|
|
20
|
+
if (key in target) {
|
|
21
|
+
result[key] = deepmerge(target[key], value);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
result[key] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
return source;
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All view path segments.
|
|
3
|
+
*/
|
|
4
|
+
export declare const viewPaths: {
|
|
5
|
+
auth: {
|
|
6
|
+
signIn: string;
|
|
7
|
+
signUp: string;
|
|
8
|
+
magicLink: string;
|
|
9
|
+
forgotPassword: string;
|
|
10
|
+
resetPassword: string;
|
|
11
|
+
signOut: string;
|
|
12
|
+
};
|
|
13
|
+
settings: {
|
|
14
|
+
account: string;
|
|
15
|
+
security: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Provides type information for the nested view path structure used throughout
|
|
20
|
+
* the application for routing and navigation.
|
|
21
|
+
*/
|
|
22
|
+
export type ViewPaths = typeof viewPaths;
|
|
23
|
+
/**
|
|
24
|
+
* Valid auth view key.
|
|
25
|
+
*/
|
|
26
|
+
export type AuthView = keyof ViewPaths["auth"];
|
|
27
|
+
/**
|
|
28
|
+
* Valid settings view key.
|
|
29
|
+
*/
|
|
30
|
+
export type SettingsView = keyof ViewPaths["settings"];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All view path segments.
|
|
3
|
+
*/
|
|
4
|
+
export const viewPaths = {
|
|
5
|
+
auth: {
|
|
6
|
+
signIn: "sign-in",
|
|
7
|
+
signUp: "sign-up",
|
|
8
|
+
magicLink: "magic-link",
|
|
9
|
+
forgotPassword: "forgot-password",
|
|
10
|
+
resetPassword: "reset-password",
|
|
11
|
+
signOut: "sign-out"
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
account: "account",
|
|
15
|
+
security: "security"
|
|
16
|
+
}
|
|
17
|
+
};
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
function isObject(item) {
|
|
2
|
+
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
3
|
+
}
|
|
4
|
+
function isPlainObject(item) {
|
|
5
|
+
if (!isObject(item))
|
|
6
|
+
return false;
|
|
7
|
+
// Handle special object types that should not be merged
|
|
8
|
+
if (item instanceof Date)
|
|
9
|
+
return false;
|
|
10
|
+
if (item instanceof RegExp)
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
export function resizeAvatar(file, size = 256, extension = "png") {
|
|
15
|
+
const MAX_SIZE = size;
|
|
16
|
+
const resolvedExtension = extension === "inherit" ? file.name.split(".").pop() : extension;
|
|
17
|
+
const mimeType = extension === "inherit"
|
|
18
|
+
? file.type
|
|
19
|
+
: `image/${extension === "jpg" ? "jpeg" : extension}`;
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const img = new Image();
|
|
22
|
+
const url = URL.createObjectURL(file);
|
|
23
|
+
img.onload = () => {
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
const { naturalWidth: w, naturalHeight: h } = img;
|
|
26
|
+
const side = Math.min(w, h);
|
|
27
|
+
const cropX = (w - side) / 2;
|
|
28
|
+
const cropY = (h - side) / 2;
|
|
29
|
+
const outSize = Math.min(side, MAX_SIZE);
|
|
30
|
+
const canvas = document.createElement("canvas");
|
|
31
|
+
canvas.width = outSize;
|
|
32
|
+
canvas.height = outSize;
|
|
33
|
+
const ctx = canvas.getContext("2d");
|
|
34
|
+
if (!ctx) {
|
|
35
|
+
reject(new Error("Could not get canvas context"));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
ctx.drawImage(img, cropX, cropY, side, side, 0, 0, outSize, outSize);
|
|
39
|
+
canvas.toBlob((blob) => {
|
|
40
|
+
if (!blob) {
|
|
41
|
+
reject(new Error("Could not create blob from canvas"));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
resolve(new File([blob], file.name.replace(/\.[^.]+$/, `.${resolvedExtension}`), {
|
|
45
|
+
type: mimeType
|
|
46
|
+
}));
|
|
47
|
+
}, mimeType, 1);
|
|
48
|
+
};
|
|
49
|
+
img.onerror = () => {
|
|
50
|
+
URL.revokeObjectURL(url);
|
|
51
|
+
reject(new Error("Failed to load image"));
|
|
52
|
+
};
|
|
53
|
+
img.src = url;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function fileToBase64(file) {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const reader = new FileReader();
|
|
59
|
+
reader.onload = () => resolve(reader.result);
|
|
60
|
+
reader.onerror = () => reject(new Error("Failed to read file"));
|
|
61
|
+
reader.readAsDataURL(file);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export function deepmerge(target, source) {
|
|
65
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
|
66
|
+
const result = { ...target };
|
|
67
|
+
for (const [key, value] of Object.entries(source)) {
|
|
68
|
+
if (value === undefined)
|
|
69
|
+
continue; // skip undefineds
|
|
70
|
+
if (key in target) {
|
|
71
|
+
result[key] = deepmerge(target[key], value);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
result[key] = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
return source;
|
|
80
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All view path segments.
|
|
3
|
+
*/
|
|
4
|
+
export declare const viewPaths: {
|
|
5
|
+
auth: {
|
|
6
|
+
signIn: string;
|
|
7
|
+
signUp: string;
|
|
8
|
+
magicLink: string;
|
|
9
|
+
forgotPassword: string;
|
|
10
|
+
resetPassword: string;
|
|
11
|
+
signOut: string;
|
|
12
|
+
};
|
|
13
|
+
settings: {
|
|
14
|
+
account: string;
|
|
15
|
+
security: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Provides type information for the nested view path structure used throughout
|
|
20
|
+
* the application for routing and navigation.
|
|
21
|
+
*/
|
|
22
|
+
export type ViewPaths = typeof viewPaths;
|
|
23
|
+
/**
|
|
24
|
+
* Valid auth view key.
|
|
25
|
+
*/
|
|
26
|
+
export type AuthView = keyof ViewPaths["auth"];
|
|
27
|
+
/**
|
|
28
|
+
* Valid settings view key.
|
|
29
|
+
*/
|
|
30
|
+
export type SettingsView = keyof ViewPaths["settings"];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All view path segments.
|
|
3
|
+
*/
|
|
4
|
+
export const viewPaths = {
|
|
5
|
+
auth: {
|
|
6
|
+
signIn: "sign-in",
|
|
7
|
+
signUp: "sign-up",
|
|
8
|
+
magicLink: "magic-link",
|
|
9
|
+
forgotPassword: "forgot-password",
|
|
10
|
+
resetPassword: "reset-password",
|
|
11
|
+
signOut: "sign-out"
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
account: "account",
|
|
15
|
+
security: "security"
|
|
16
|
+
}
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@better-auth-ui/core",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc",
|
|
7
|
+
"dev": "tsc --watch",
|
|
8
|
+
"test": "vitest"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"better-auth": "^1.6.4",
|
|
24
|
+
"vitest": "^4.1.4"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"better-auth": ">=1.6.4"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available theme options for the application.
|
|
3
|
+
*/
|
|
4
|
+
export type Theme = "system" | "light" | "dark"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for appearance/theme settings.
|
|
8
|
+
*/
|
|
9
|
+
export type AppearanceConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Function to set the application theme
|
|
12
|
+
* @param theme - The theme value to set
|
|
13
|
+
*/
|
|
14
|
+
setTheme?: (theme: string) => void
|
|
15
|
+
/**
|
|
16
|
+
* Current theme value
|
|
17
|
+
*/
|
|
18
|
+
theme?: string
|
|
19
|
+
/**
|
|
20
|
+
* Available theme options to display in the theme switcher
|
|
21
|
+
* @default ["system", "light", "dark"]
|
|
22
|
+
*/
|
|
23
|
+
themes: Theme[]
|
|
24
|
+
}
|