@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.
Files changed (97) hide show
  1. package/dist/base-paths.d.ts +21 -0
  2. package/dist/base-paths.js +5 -0
  3. package/dist/config/appearance-config.d.ts +23 -0
  4. package/dist/config/appearance-config.js +1 -0
  5. package/dist/config/auth-config.d.ts +87 -0
  6. package/dist/config/auth-config.js +35 -0
  7. package/dist/config/avatar-config.d.ts +35 -0
  8. package/dist/config/avatar-config.js +1 -0
  9. package/dist/config/delete-user-config.d.ts +14 -0
  10. package/dist/config/delete-user-config.js +1 -0
  11. package/dist/config/email-and-password-config.d.ts +37 -0
  12. package/dist/config/email-and-password-config.js +1 -0
  13. package/dist/config/index.d.ts +5 -0
  14. package/dist/config/index.js +5 -0
  15. package/dist/config/settings-config.d.ts +17 -0
  16. package/dist/config/settings-config.js +1 -0
  17. package/dist/config/toast-config.d.ts +58 -0
  18. package/dist/config/toast-config.js +16 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.js +6 -0
  21. package/dist/lib/auth-callback-options.d.ts +8 -0
  22. package/dist/lib/auth-callback-options.js +1 -0
  23. package/dist/lib/auth-config.d.ts +198 -0
  24. package/dist/lib/auth-config.js +36 -0
  25. package/dist/lib/auth-error.d.ts +9 -0
  26. package/dist/lib/auth-error.js +1 -0
  27. package/dist/lib/auth-hook-options.d.ts +8 -0
  28. package/dist/lib/auth-hook-options.js +1 -0
  29. package/dist/lib/auth-toast.d.ts +24 -0
  30. package/dist/lib/auth-toast.js +10 -0
  31. package/dist/lib/base-paths.d.ts +21 -0
  32. package/dist/lib/base-paths.js +5 -0
  33. package/dist/lib/config/appearance-config.d.ts +23 -0
  34. package/dist/lib/config/appearance-config.js +1 -0
  35. package/dist/lib/config/auth-config.d.ts +70 -0
  36. package/dist/lib/config/auth-config.js +36 -0
  37. package/dist/lib/config/avatar-config.d.ts +35 -0
  38. package/dist/lib/config/avatar-config.js +1 -0
  39. package/dist/lib/config/email-and-password-config.d.ts +37 -0
  40. package/dist/lib/config/email-and-password-config.js +1 -0
  41. package/dist/lib/config/index.d.ts +6 -0
  42. package/dist/lib/config/index.js +6 -0
  43. package/dist/lib/config/settings-config.d.ts +22 -0
  44. package/dist/lib/config/settings-config.js +1 -0
  45. package/dist/lib/config/toast-config.d.ts +24 -0
  46. package/dist/lib/config/toast-config.js +10 -0
  47. package/dist/lib/localization.d.ts +175 -0
  48. package/dist/lib/localization.js +172 -0
  49. package/dist/lib/provider-names.d.ts +12 -0
  50. package/dist/lib/provider-names.js +50 -0
  51. package/dist/lib/toast-config.d.ts +24 -0
  52. package/dist/lib/toast-config.js +10 -0
  53. package/dist/lib/utils.d.ts +32 -0
  54. package/dist/lib/utils.js +116 -0
  55. package/dist/lib/view-paths.d.ts +68 -0
  56. package/dist/lib/view-paths.js +14 -0
  57. package/dist/localization/index.d.ts +35 -0
  58. package/dist/localization/index.js +34 -0
  59. package/dist/localization/localization.d.ts +35 -0
  60. package/dist/localization/localization.js +34 -0
  61. package/dist/localization.d.ts +159 -0
  62. package/dist/localization.js +156 -0
  63. package/dist/provider-names.d.ts +12 -0
  64. package/dist/provider-names.js +50 -0
  65. package/dist/src/index.d.ts +7 -0
  66. package/dist/src/index.js +7 -0
  67. package/dist/src/lib/auth-config.d.ts +148 -0
  68. package/dist/src/lib/auth-config.js +28 -0
  69. package/dist/src/lib/auth-toast.d.ts +24 -0
  70. package/dist/src/lib/auth-toast.js +10 -0
  71. package/dist/src/lib/base-paths.d.ts +9 -0
  72. package/dist/src/lib/base-paths.js +9 -0
  73. package/dist/src/lib/localization.d.ts +145 -0
  74. package/dist/src/lib/localization.js +142 -0
  75. package/dist/src/lib/provider-names.d.ts +12 -0
  76. package/dist/src/lib/provider-names.js +49 -0
  77. package/dist/src/lib/utils.d.ts +1 -0
  78. package/dist/src/lib/utils.js +30 -0
  79. package/dist/src/lib/view-paths.d.ts +30 -0
  80. package/dist/src/lib/view-paths.js +17 -0
  81. package/dist/utils.d.ts +3 -0
  82. package/dist/utils.js +80 -0
  83. package/dist/view-paths.d.ts +30 -0
  84. package/dist/view-paths.js +17 -0
  85. package/package.json +32 -0
  86. package/src/config/appearance-config.ts +24 -0
  87. package/src/config/auth-config.ts +117 -0
  88. package/src/config/avatar-config.ts +39 -0
  89. package/src/config/delete-user-config.ts +14 -0
  90. package/src/config/email-and-password-config.ts +37 -0
  91. package/src/config/index.ts +5 -0
  92. package/src/index.ts +6 -0
  93. package/src/lib/base-paths.ts +26 -0
  94. package/src/lib/localization.ts +259 -0
  95. package/src/lib/provider-names.ts +55 -0
  96. package/src/lib/utils.ts +151 -0
  97. package/src/lib/view-paths.ts +86 -0
@@ -0,0 +1,159 @@
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 `"Avatar"` */
90
+ avatar: string;
91
+ /** @remarks `"Current Session"` */
92
+ currentSession: string;
93
+ /** @remarks `"Avatar changed successfully"` */
94
+ avatarChangedSuccess: string;
95
+ /** @remarks `"Avatar deleted successfully"` */
96
+ avatarDeletedSuccess: string;
97
+ /** @remarks `"Change avatar"` */
98
+ changeAvatar: string;
99
+ /** @remarks `"Delete avatar"` */
100
+ deleteAvatar: string;
101
+ /** @remarks `"Link"` */
102
+ link: string;
103
+ /** @remarks `"Linked accounts"` */
104
+ linkedAccounts: string;
105
+ /** @remarks `"Link your {{provider}} account"` */
106
+ linkProvider: string;
107
+ /** @remarks `"Appearance"` */
108
+ appearance: string;
109
+ /** @remarks `"Change email"` */
110
+ changeEmail: string;
111
+ /** @remarks `"Check your email to confirm the change"` */
112
+ changeEmailSuccess: string;
113
+ /** @remarks `"Change password"` */
114
+ changePassword: string;
115
+ /** @remarks `"Password changed successfully"` */
116
+ changePasswordSuccess: string;
117
+ /** @remarks `"Current Password"` */
118
+ currentPassword: string;
119
+ /** @remarks `"Enter your current password"` */
120
+ currentPasswordPlaceholder: string;
121
+ /** @remarks `"Dark"` */
122
+ dark: string;
123
+ /** @remarks `"Light"` */
124
+ light: string;
125
+ /** @remarks `"Manage accounts"` */
126
+ manageAccounts: string;
127
+ /** @remarks `"Profile"` */
128
+ profile: string;
129
+ /** @remarks `"Profile updated successfully"` */
130
+ profileUpdatedSuccess: string;
131
+ /** @remarks `"Revoke"` */
132
+ revoke: string;
133
+ /** @remarks `"Revoke Session"` */
134
+ revokeSession: string;
135
+ /** @remarks `"Session revoked successfully"` */
136
+ revokeSessionSuccess: string;
137
+ /** @remarks `"Save changes"` */
138
+ saveChanges: string;
139
+ /** @remarks `"Security"` */
140
+ security: string;
141
+ /** @remarks `"Settings"` */
142
+ settings: string;
143
+ /** @remarks `"System"` */
144
+ system: string;
145
+ /** @remarks `"Theme"` */
146
+ theme: string;
147
+ /** @remarks `"Unlink {{provider}}"` */
148
+ unlinkProvider: string;
149
+ /** @remarks `"Update email"` */
150
+ updateEmail: string;
151
+ /** @remarks `"Update password"` */
152
+ updatePassword: string;
153
+ /** @remarks `"Upload avatar"` */
154
+ uploadAvatar: string;
155
+ };
156
+ };
157
+ export type Localization = typeof localization;
158
+ export type AuthLocalization = Localization["auth"];
159
+ export type SettingsLocalization = Localization["settings"];
@@ -0,0 +1,156 @@
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 `"Avatar"` */
90
+ avatar: "Avatar",
91
+ /** @remarks `"Current Session"` */
92
+ currentSession: "Current Session",
93
+ /** @remarks `"Avatar changed successfully"` */
94
+ avatarChangedSuccess: "Avatar changed successfully",
95
+ /** @remarks `"Avatar deleted successfully"` */
96
+ avatarDeletedSuccess: "Avatar deleted successfully",
97
+ /** @remarks `"Change avatar"` */
98
+ changeAvatar: "Change avatar",
99
+ /** @remarks `"Delete avatar"` */
100
+ deleteAvatar: "Delete avatar",
101
+ /** @remarks `"Link"` */
102
+ link: "Link",
103
+ /** @remarks `"Linked accounts"` */
104
+ linkedAccounts: "Linked accounts",
105
+ /** @remarks `"Link your {{provider}} account"` */
106
+ linkProvider: "Link your {{provider}} account",
107
+ /** @remarks `"Appearance"` */
108
+ appearance: "Appearance",
109
+ /** @remarks `"Change email"` */
110
+ changeEmail: "Change email",
111
+ /** @remarks `"Check your email to confirm the change"` */
112
+ changeEmailSuccess: "Check your email to confirm the change",
113
+ /** @remarks `"Change password"` */
114
+ changePassword: "Change password",
115
+ /** @remarks `"Password changed successfully"` */
116
+ changePasswordSuccess: "Password changed successfully",
117
+ /** @remarks `"Current Password"` */
118
+ currentPassword: "Current Password",
119
+ /** @remarks `"Enter your current password"` */
120
+ currentPasswordPlaceholder: "Enter your current password",
121
+ /** @remarks `"Dark"` */
122
+ dark: "Dark",
123
+ /** @remarks `"Light"` */
124
+ light: "Light",
125
+ /** @remarks `"Manage accounts"` */
126
+ manageAccounts: "Manage accounts",
127
+ /** @remarks `"Profile"` */
128
+ profile: "Profile",
129
+ /** @remarks `"Profile updated successfully"` */
130
+ profileUpdatedSuccess: "Profile updated successfully",
131
+ /** @remarks `"Revoke"` */
132
+ revoke: "Revoke",
133
+ /** @remarks `"Revoke Session"` */
134
+ revokeSession: "Revoke Session",
135
+ /** @remarks `"Session revoked successfully"` */
136
+ revokeSessionSuccess: "Session revoked successfully",
137
+ /** @remarks `"Save changes"` */
138
+ saveChanges: "Save changes",
139
+ /** @remarks `"Security"` */
140
+ security: "Security",
141
+ /** @remarks `"Settings"` */
142
+ settings: "Settings",
143
+ /** @remarks `"System"` */
144
+ system: "System",
145
+ /** @remarks `"Theme"` */
146
+ theme: "Theme",
147
+ /** @remarks `"Unlink {{provider}}"` */
148
+ unlinkProvider: "Unlink {{provider}}",
149
+ /** @remarks `"Update email"` */
150
+ updateEmail: "Update email",
151
+ /** @remarks `"Update password"` */
152
+ updatePassword: "Update password",
153
+ /** @remarks `"Upload avatar"` */
154
+ uploadAvatar: "Upload avatar"
155
+ }
156
+ };
@@ -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,50 @@
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
+ wechat: "WeChat",
39
+ zoom: "Zoom"
40
+ };
41
+ /**
42
+ * Get the human-readable display name for an authentication provider.
43
+ *
44
+ * @param provider - The provider identifier (e.g., "github", "google").
45
+ * @returns The mapped display name for `provider` if available, otherwise `provider` with its first character capitalized.
46
+ */
47
+ export function getProviderName(provider) {
48
+ return (providerNames[provider] ||
49
+ provider.charAt(0).toUpperCase() + provider.slice(1));
50
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./lib/auth-config";
2
+ export * from "./lib/auth-toast";
3
+ export * from "./lib/base-paths";
4
+ export * from "./lib/localization";
5
+ export * from "./lib/provider-names";
6
+ export * from "./lib/utils";
7
+ export * from "./lib/view-paths";
@@ -0,0 +1,7 @@
1
+ export * from "./lib/auth-config";
2
+ export * from "./lib/auth-toast";
3
+ export * from "./lib/base-paths";
4
+ export * from "./lib/localization";
5
+ export * from "./lib/provider-names";
6
+ export * from "./lib/utils";
7
+ export * from "./lib/view-paths";
@@ -0,0 +1,148 @@
1
+ import type { SocialProvider } from "better-auth/social-providers";
2
+ import { type Toast } from "./auth-toast";
3
+ import { type Localization } from "./localization";
4
+ import { type ViewPaths } from "./view-paths";
5
+ /**
6
+ * Configuration options for email and password authentication.
7
+ */
8
+ export type EmailAndPasswordConfig = {
9
+ /**
10
+ * Whether email/password authentication is enabled
11
+ * @default true
12
+ */
13
+ enabled: boolean;
14
+ /**
15
+ * Whether to show a confirm password field on sign-up forms
16
+ */
17
+ confirmPassword?: boolean;
18
+ /**
19
+ * Whether users can reset forgotten passwords
20
+ * @default true
21
+ */
22
+ forgotPassword: boolean;
23
+ /**
24
+ * Maximum password length
25
+ * @default 128
26
+ */
27
+ maxPasswordLength?: number;
28
+ /**
29
+ * Minimum password length
30
+ * @default 8
31
+ */
32
+ minPasswordLength?: number;
33
+ /**
34
+ * Maximum password length
35
+ * @default 128
36
+ */
37
+ /** Whether to show a "Remember me" checkbox on sign-in forms */
38
+ rememberMe?: boolean;
39
+ /** Whether email verification is required before account activation */
40
+ requireEmailVerification?: boolean;
41
+ };
42
+ /**
43
+ * Available theme options for the application.
44
+ */
45
+ export type Theme = "system" | "light" | "dark";
46
+ /**
47
+ * Configuration options for user settings.
48
+ */
49
+ export type SettingsConfig = {
50
+ /**
51
+ * Whether the settings section is enabled
52
+ * @default true
53
+ */
54
+ enabled?: boolean;
55
+ /**
56
+ * Function to set the application theme
57
+ * @param theme - The theme value to set
58
+ */
59
+ setTheme?: (theme: string) => void;
60
+ /**
61
+ * Current theme value
62
+ */
63
+ theme?: string;
64
+ /**
65
+ * Available theme options to display in the theme switcher
66
+ * @default ["system", "light", "dark"]
67
+ */
68
+ themes?: Theme[];
69
+ };
70
+ /**
71
+ * Core authentication configuration interface.
72
+ *
73
+ * Defines the base structure for authentication settings including paths,
74
+ * providers, navigation functions, and feature flags.
75
+ */
76
+ export interface AuthConfig {
77
+ /** Base paths for different application sections */
78
+ basePaths: {
79
+ /**
80
+ * Base path for authentication routes
81
+ * @default "/auth"
82
+ */
83
+ auth: string;
84
+ /**
85
+ * Base path for settings routes
86
+ * @default "/settings"
87
+ */
88
+ settings: string;
89
+ /**
90
+ * Base path for organization management routes
91
+ * @default "/organization"
92
+ */
93
+ organization: string;
94
+ };
95
+ /**
96
+ * Base URL for API endpoints (optional)
97
+ * @default ""
98
+ */
99
+ baseURL: string;
100
+ /**
101
+ * Email and password authentication configuration
102
+ * @default { enabled: true, forgotPassword: true, minPasswordLength: 8, maxPasswordLength: 128 }
103
+ */
104
+ emailAndPassword?: EmailAndPasswordConfig;
105
+ /** Localization strings for UI components. */
106
+ localization: Localization;
107
+ /** Whether magic link (passwordless) authentication is enabled */
108
+ magicLink?: boolean;
109
+ /** Whether multi-session support is enabled */
110
+ multiSession?: boolean;
111
+ /**
112
+ * Default redirect path after successful authentication
113
+ * @default "/"
114
+ */
115
+ redirectTo: string;
116
+ /**
117
+ * Settings section configuration
118
+ * @default { enabled: true }
119
+ */
120
+ settings: SettingsConfig;
121
+ /**
122
+ * List of enabled social authentication providers
123
+ * @remarks `SocialProvider[]`
124
+ */
125
+ socialProviders?: SocialProvider[];
126
+ /** View path mappings for different authentication views */
127
+ viewPaths: ViewPaths;
128
+ /**
129
+ * Toast notification configuration for user feedback.
130
+ * @remarks `Toast`
131
+ */
132
+ toast: Toast;
133
+ /**
134
+ * Function to navigate to a new path
135
+ * @param options - Navigation options with href and optional replace flag
136
+ * @default window.location.href = href (or window.location.replace if replace: true)
137
+ * @example
138
+ * // TanStack Router
139
+ * navigate={navigate}
140
+ * // Next.js
141
+ * navigate={({href, replace}) => replace ? router.replace(href) : router.push(href)}
142
+ */
143
+ navigate: (options: {
144
+ to: string;
145
+ replace?: boolean;
146
+ }) => void;
147
+ }
148
+ export declare const defaultConfig: AuthConfig;
@@ -0,0 +1,28 @@
1
+ import { defaultToast } from "./auth-toast";
2
+ import { basePaths } from "./base-paths";
3
+ import { localization } from "./localization";
4
+ import { viewPaths } from "./view-paths";
5
+ export const defaultConfig = {
6
+ basePaths,
7
+ baseURL: "",
8
+ emailAndPassword: {
9
+ enabled: true,
10
+ forgotPassword: true,
11
+ rememberMe: false,
12
+ minPasswordLength: 8,
13
+ maxPasswordLength: 128
14
+ },
15
+ redirectTo: "/",
16
+ settings: {
17
+ enabled: true,
18
+ themes: ["system", "light", "dark"]
19
+ },
20
+ viewPaths,
21
+ localization,
22
+ navigate: () => { },
23
+ toast: {
24
+ error: defaultToast,
25
+ success: defaultToast,
26
+ info: defaultToast
27
+ }
28
+ };
@@ -0,0 +1,24 @@
1
+ export type RenderToast = (message?: string, options?: {
2
+ action?: {
3
+ label: string;
4
+ onClick: () => Promise<void> | void;
5
+ };
6
+ actionProps?: {
7
+ children: string;
8
+ onClick: () => Promise<void> | void;
9
+ };
10
+ }) => string | number | unknown;
11
+ export type DismissToast = (id?: number | string | unknown | any) => string | number | unknown;
12
+ export declare const defaultToast: RenderToast;
13
+ export type Toast = {
14
+ /** Display an error toast notification */
15
+ error: RenderToast;
16
+ /** Display a danger toast notification */
17
+ danger?: RenderToast;
18
+ /** Display a success toast notification */
19
+ success: RenderToast;
20
+ /** Display an info toast notification */
21
+ info: RenderToast;
22
+ /** Optional function to dismiss a toast notification by its ID */
23
+ dismiss?: DismissToast;
24
+ };
@@ -0,0 +1,10 @@
1
+ export const defaultToast = (message, options) => {
2
+ if (options?.action) {
3
+ if (confirm(message)) {
4
+ options.action.onClick();
5
+ }
6
+ }
7
+ else {
8
+ alert(message);
9
+ }
10
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Defines the base paths for authentication, settings, and organization
3
+ * features. These paths are used throughout the application for routing and navigation.
4
+ */
5
+ export declare const basePaths: {
6
+ auth: string;
7
+ settings: string;
8
+ organization: string;
9
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Defines the base paths for authentication, settings, and organization
3
+ * features. These paths are used throughout the application for routing and navigation.
4
+ */
5
+ export const basePaths = {
6
+ auth: "/auth",
7
+ settings: "/settings",
8
+ organization: "/organization"
9
+ };