@better-auth-ui/core 1.6.0 → 1.6.1
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/config/auth-config.d.ts +4 -2
- package/dist/lib/localization.d.ts +12 -0
- package/dist/lib/localization.js +12 -0
- package/package.json +6 -1
- package/src/config/auth-config.ts +4 -2
- package/src/lib/localization.ts +18 -0
- package/dist/base-paths.d.ts +0 -21
- package/dist/base-paths.js +0 -5
- package/dist/config/settings-config.d.ts +0 -17
- package/dist/config/settings-config.js +0 -1
- package/dist/config/toast-config.d.ts +0 -58
- package/dist/config/toast-config.js +0 -16
- package/dist/lib/auth-callback-options.d.ts +0 -8
- package/dist/lib/auth-callback-options.js +0 -1
- package/dist/lib/auth-config.d.ts +0 -198
- package/dist/lib/auth-config.js +0 -36
- package/dist/lib/auth-error.d.ts +0 -9
- package/dist/lib/auth-error.js +0 -1
- package/dist/lib/auth-hook-options.d.ts +0 -8
- package/dist/lib/auth-hook-options.js +0 -1
- package/dist/lib/auth-toast.d.ts +0 -24
- package/dist/lib/auth-toast.js +0 -10
- package/dist/lib/config/appearance-config.d.ts +0 -23
- package/dist/lib/config/appearance-config.js +0 -1
- package/dist/lib/config/auth-config.d.ts +0 -70
- package/dist/lib/config/auth-config.js +0 -36
- package/dist/lib/config/avatar-config.d.ts +0 -35
- package/dist/lib/config/avatar-config.js +0 -1
- package/dist/lib/config/email-and-password-config.d.ts +0 -37
- package/dist/lib/config/email-and-password-config.js +0 -1
- package/dist/lib/config/index.d.ts +0 -6
- package/dist/lib/config/index.js +0 -6
- package/dist/lib/config/settings-config.d.ts +0 -22
- package/dist/lib/config/settings-config.js +0 -1
- package/dist/lib/config/toast-config.d.ts +0 -24
- package/dist/lib/config/toast-config.js +0 -10
- package/dist/lib/toast-config.d.ts +0 -24
- package/dist/lib/toast-config.js +0 -10
- package/dist/localization/index.d.ts +0 -35
- package/dist/localization/index.js +0 -34
- package/dist/localization/localization.d.ts +0 -35
- package/dist/localization/localization.js +0 -34
- package/dist/localization.d.ts +0 -159
- package/dist/localization.js +0 -156
- package/dist/provider-names.d.ts +0 -12
- package/dist/provider-names.js +0 -50
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -7
- package/dist/src/lib/auth-config.d.ts +0 -148
- package/dist/src/lib/auth-config.js +0 -28
- package/dist/src/lib/auth-toast.d.ts +0 -24
- package/dist/src/lib/auth-toast.js +0 -10
- package/dist/src/lib/base-paths.d.ts +0 -9
- package/dist/src/lib/base-paths.js +0 -9
- package/dist/src/lib/localization.d.ts +0 -145
- package/dist/src/lib/localization.js +0 -142
- package/dist/src/lib/provider-names.d.ts +0 -12
- package/dist/src/lib/provider-names.js +0 -49
- package/dist/src/lib/utils.d.ts +0 -1
- package/dist/src/lib/utils.js +0 -30
- package/dist/src/lib/view-paths.d.ts +0 -30
- package/dist/src/lib/view-paths.js +0 -17
- package/dist/utils.d.ts +0 -3
- package/dist/utils.js +0 -80
- package/dist/view-paths.d.ts +0 -30
- package/dist/view-paths.js +0 -17
|
@@ -50,10 +50,12 @@ export interface AuthConfig {
|
|
|
50
50
|
* @remarks `Localization`
|
|
51
51
|
*/
|
|
52
52
|
localization: Localization;
|
|
53
|
-
/** Whether
|
|
53
|
+
/** Whether Magic Link plugin is enabled */
|
|
54
54
|
magicLink?: boolean;
|
|
55
|
-
/** Whether
|
|
55
|
+
/** Whether Multi Session plugin is enabled */
|
|
56
56
|
multiSession?: boolean;
|
|
57
|
+
/** Whether Passkey plugin is enabled */
|
|
58
|
+
passkey?: boolean;
|
|
57
59
|
/**
|
|
58
60
|
* Default redirect path after successful authentication
|
|
59
61
|
* @default "/"
|
|
@@ -40,6 +40,8 @@ export declare const localization: {
|
|
|
40
40
|
newPasswordPlaceholder: string;
|
|
41
41
|
/** @remarks `"OR"` */
|
|
42
42
|
or: string;
|
|
43
|
+
/** @remarks `"Passkey"` */
|
|
44
|
+
passkey: string;
|
|
43
45
|
/** @remarks `"Password"` */
|
|
44
46
|
password: string;
|
|
45
47
|
/** @remarks `"Enter your password"` */
|
|
@@ -136,6 +138,16 @@ export declare const localization: {
|
|
|
136
138
|
light: string;
|
|
137
139
|
/** @remarks `"Manage accounts"` */
|
|
138
140
|
manageAccounts: string;
|
|
141
|
+
/** @remarks `"Add passkey"` */
|
|
142
|
+
addPasskey: string;
|
|
143
|
+
/** @remarks `"Delete"` */
|
|
144
|
+
delete: string;
|
|
145
|
+
/** @remarks `"Passkeys"` */
|
|
146
|
+
passkeys: string;
|
|
147
|
+
/** @remarks `"Manage your passkeys for secure access."` */
|
|
148
|
+
passkeysDescription: string;
|
|
149
|
+
/** @remarks `"Securely access your account without a password."` */
|
|
150
|
+
passkeysInstructions: string;
|
|
139
151
|
/** @remarks `"Profile"` */
|
|
140
152
|
profile: string;
|
|
141
153
|
/** @remarks `"Profile updated successfully"` */
|
package/dist/lib/localization.js
CHANGED
|
@@ -40,6 +40,8 @@ export const localization = {
|
|
|
40
40
|
newPasswordPlaceholder: "Enter your new password",
|
|
41
41
|
/** @remarks `"OR"` */
|
|
42
42
|
or: "OR",
|
|
43
|
+
/** @remarks `"Passkey"` */
|
|
44
|
+
passkey: "Passkey",
|
|
43
45
|
/** @remarks `"Password"` */
|
|
44
46
|
password: "Password",
|
|
45
47
|
/** @remarks `"Enter your password"` */
|
|
@@ -136,6 +138,16 @@ export const localization = {
|
|
|
136
138
|
light: "Light",
|
|
137
139
|
/** @remarks `"Manage accounts"` */
|
|
138
140
|
manageAccounts: "Manage accounts",
|
|
141
|
+
/** @remarks `"Add passkey"` */
|
|
142
|
+
addPasskey: "Add passkey",
|
|
143
|
+
/** @remarks `"Delete"` */
|
|
144
|
+
delete: "Delete",
|
|
145
|
+
/** @remarks `"Passkeys"` */
|
|
146
|
+
passkeys: "Passkeys",
|
|
147
|
+
/** @remarks `"Manage your passkeys for secure access."` */
|
|
148
|
+
passkeysDescription: "Manage your passkeys for secure access.",
|
|
149
|
+
/** @remarks `"Securely access your account without a password."` */
|
|
150
|
+
passkeysInstructions: "Securely access your account without a password.",
|
|
139
151
|
/** @remarks `"Profile"` */
|
|
140
152
|
profile: "Profile",
|
|
141
153
|
/** @remarks `"Profile updated successfully"` */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth-ui/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"better-auth": ">=1.6.4"
|
|
28
28
|
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/better-auth-ui/better-auth-ui",
|
|
32
|
+
"directory": "packages/core"
|
|
33
|
+
},
|
|
29
34
|
"publishConfig": {
|
|
30
35
|
"access": "public"
|
|
31
36
|
}
|
|
@@ -53,10 +53,12 @@ export interface AuthConfig {
|
|
|
53
53
|
* @remarks `Localization`
|
|
54
54
|
*/
|
|
55
55
|
localization: Localization
|
|
56
|
-
/** Whether
|
|
56
|
+
/** Whether Magic Link plugin is enabled */
|
|
57
57
|
magicLink?: boolean
|
|
58
|
-
/** Whether
|
|
58
|
+
/** Whether Multi Session plugin is enabled */
|
|
59
59
|
multiSession?: boolean
|
|
60
|
+
/** Whether Passkey plugin is enabled */
|
|
61
|
+
passkey?: boolean
|
|
60
62
|
/**
|
|
61
63
|
* Default redirect path after successful authentication
|
|
62
64
|
* @default "/"
|
package/src/lib/localization.ts
CHANGED
|
@@ -60,6 +60,9 @@ export const localization = {
|
|
|
60
60
|
/** @remarks `"OR"` */
|
|
61
61
|
or: "OR",
|
|
62
62
|
|
|
63
|
+
/** @remarks `"Passkey"` */
|
|
64
|
+
passkey: "Passkey",
|
|
65
|
+
|
|
63
66
|
/** @remarks `"Password"` */
|
|
64
67
|
password: "Password",
|
|
65
68
|
|
|
@@ -203,6 +206,21 @@ export const localization = {
|
|
|
203
206
|
/** @remarks `"Manage accounts"` */
|
|
204
207
|
manageAccounts: "Manage accounts",
|
|
205
208
|
|
|
209
|
+
/** @remarks `"Add passkey"` */
|
|
210
|
+
addPasskey: "Add passkey",
|
|
211
|
+
|
|
212
|
+
/** @remarks `"Delete"` */
|
|
213
|
+
delete: "Delete",
|
|
214
|
+
|
|
215
|
+
/** @remarks `"Passkeys"` */
|
|
216
|
+
passkeys: "Passkeys",
|
|
217
|
+
|
|
218
|
+
/** @remarks `"Manage your passkeys for secure access."` */
|
|
219
|
+
passkeysDescription: "Manage your passkeys for secure access.",
|
|
220
|
+
|
|
221
|
+
/** @remarks `"Securely access your account without a password."` */
|
|
222
|
+
passkeysInstructions: "Securely access your account without a password.",
|
|
223
|
+
|
|
206
224
|
/** @remarks `"Profile"` */
|
|
207
225
|
profile: "Profile",
|
|
208
226
|
|
package/dist/base-paths.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
export declare const basePaths: BasePaths;
|
package/dist/base-paths.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AppearanceConfig } from "./appearance-config";
|
|
2
|
-
import type { AvatarConfig } from "./avatar-config";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration options for user settings.
|
|
5
|
-
*/
|
|
6
|
-
export type SettingsConfig = {
|
|
7
|
-
/**
|
|
8
|
-
* Appearance/theme configuration
|
|
9
|
-
* @default { themes: ["system", "light", "dark"] }
|
|
10
|
-
*/
|
|
11
|
-
appearance: AppearanceConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Avatar upload, optimization, and deletion configuration.
|
|
14
|
-
* @default { enabled: true, optimize: optimizeAvatar, size: 256 }
|
|
15
|
-
*/
|
|
16
|
-
avatar: AvatarConfig;
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function signature for rendering a toast notification.
|
|
3
|
-
*
|
|
4
|
-
* @param message - The message to display in the toast.
|
|
5
|
-
* @param options - Optional configuration for the toast.
|
|
6
|
-
* @param options.action - Action button displayed within the toast.
|
|
7
|
-
* @param options.action.label - Label text for the action button.
|
|
8
|
-
* @param options.action.onClick - Callback invoked when the action button is clicked.
|
|
9
|
-
* @param options.actionProps - Alternative action props (used by some toast libraries).
|
|
10
|
-
* @param options.actionProps.children - Label text for the action button.
|
|
11
|
-
* @param options.actionProps.onClick - Callback invoked when the action button is clicked.
|
|
12
|
-
* @returns A toast identifier (type varies by toast library), or void.
|
|
13
|
-
*/
|
|
14
|
-
export type RenderToast = (message?: string, options?: {
|
|
15
|
-
action?: {
|
|
16
|
-
label: string;
|
|
17
|
-
onClick: () => Promise<void> | void;
|
|
18
|
-
};
|
|
19
|
-
actionProps?: {
|
|
20
|
-
children: string;
|
|
21
|
-
onClick: () => Promise<void> | void;
|
|
22
|
-
};
|
|
23
|
-
}) => string | number | unknown;
|
|
24
|
-
/**
|
|
25
|
-
* Function signature for dismissing a toast notification by its ID.
|
|
26
|
-
*
|
|
27
|
-
* @param id - The identifier of the toast to dismiss (returned by {@link RenderToast}).
|
|
28
|
-
* @returns A toast identifier, or void.
|
|
29
|
-
*/
|
|
30
|
-
export type DismissToast = (id?: number | string | unknown | any) => string | number | unknown;
|
|
31
|
-
/**
|
|
32
|
-
* Fallback toast implementation using native browser dialogs.
|
|
33
|
-
*
|
|
34
|
-
* Uses `confirm()` for toasts with an action (invokes the action on confirm)
|
|
35
|
-
* and `alert()` for plain messages.
|
|
36
|
-
*/
|
|
37
|
-
export declare const defaultToast: RenderToast;
|
|
38
|
-
/**
|
|
39
|
-
* Configuration for toast notifications used throughout the UI.
|
|
40
|
-
*
|
|
41
|
-
* Provide your own toast library functions (e.g. sonner, react-hot-toast)
|
|
42
|
-
* to customize how notifications are displayed.
|
|
43
|
-
*/
|
|
44
|
-
export type ToastConfig = {
|
|
45
|
-
/** Display an error toast notification. */
|
|
46
|
-
error: RenderToast;
|
|
47
|
-
/** Display a danger toast notification (e.g. destructive actions). */
|
|
48
|
-
danger?: RenderToast;
|
|
49
|
-
/** Display a success toast notification. */
|
|
50
|
-
success: RenderToast;
|
|
51
|
-
/** Display an informational toast notification. */
|
|
52
|
-
info: RenderToast;
|
|
53
|
-
/**
|
|
54
|
-
* Dismiss a toast notification by its ID.
|
|
55
|
-
* When provided, allows programmatic dismissal of active toasts.
|
|
56
|
-
*/
|
|
57
|
-
dismiss?: DismissToast;
|
|
58
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fallback toast implementation using native browser dialogs.
|
|
3
|
-
*
|
|
4
|
-
* Uses `confirm()` for toasts with an action (invokes the action on confirm)
|
|
5
|
-
* and `alert()` for plain messages.
|
|
6
|
-
*/
|
|
7
|
-
export const defaultToast = (message, options) => {
|
|
8
|
-
if (options?.action) {
|
|
9
|
-
if (confirm(message)) {
|
|
10
|
-
options.action.onClick();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
alert(message);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,198 +0,0 @@
|
|
|
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
|
-
* Configuration options for avatar handling.
|
|
44
|
-
*/
|
|
45
|
-
export type AvatarConfig = {
|
|
46
|
-
/**
|
|
47
|
-
* Delete the current avatar (e.g. remove from storage).
|
|
48
|
-
* When undefined, avatar deletion is disabled.
|
|
49
|
-
*/
|
|
50
|
-
delete?: (url: string) => Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Whether avatar changing is enabled.
|
|
53
|
-
* @default true
|
|
54
|
-
*/
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Output image format.
|
|
58
|
-
* @default "png"
|
|
59
|
-
*/
|
|
60
|
-
extension?: "png" | "jpg" | "webp" | "inherit";
|
|
61
|
-
/**
|
|
62
|
-
* Resize an image file before upload.
|
|
63
|
-
* @default Resizes to max size, square-cropped, output as configured extension.
|
|
64
|
-
*/
|
|
65
|
-
resize?: (file: File, size?: number, extension?: "png" | "jpg" | "webp" | "inherit") => Promise<File>;
|
|
66
|
-
/**
|
|
67
|
-
* Max dimension in pixels for the optimized avatar.
|
|
68
|
-
* @default 256
|
|
69
|
-
*/
|
|
70
|
-
size?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Upload a file and return the URL where it was stored.
|
|
73
|
-
* When undefined, the image is base64-encoded and saved directly to `user.image`.
|
|
74
|
-
*/
|
|
75
|
-
upload?: (file: File) => Promise<string>;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Available theme options for the application.
|
|
79
|
-
*/
|
|
80
|
-
export type Theme = "system" | "light" | "dark";
|
|
81
|
-
/**
|
|
82
|
-
* Configuration options for appearance/theme settings.
|
|
83
|
-
*/
|
|
84
|
-
export type AppearanceConfig = {
|
|
85
|
-
/**
|
|
86
|
-
* Function to set the application theme
|
|
87
|
-
* @param theme - The theme value to set
|
|
88
|
-
*/
|
|
89
|
-
setTheme?: (theme: string) => void;
|
|
90
|
-
/**
|
|
91
|
-
* Current theme value
|
|
92
|
-
*/
|
|
93
|
-
theme?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Available theme options to display in the theme switcher
|
|
96
|
-
* @default ["system", "light", "dark"]
|
|
97
|
-
*/
|
|
98
|
-
themes?: Theme[];
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Configuration options for user settings.
|
|
102
|
-
*/
|
|
103
|
-
export type SettingsConfig = {
|
|
104
|
-
/**
|
|
105
|
-
* Appearance/theme configuration
|
|
106
|
-
* @default { themes: ["system", "light", "dark"] }
|
|
107
|
-
*/
|
|
108
|
-
appearance: AppearanceConfig;
|
|
109
|
-
/**
|
|
110
|
-
* Avatar upload, optimization, and deletion configuration.
|
|
111
|
-
* @default { enabled: true, optimize: optimizeAvatar, size: 256 }
|
|
112
|
-
*/
|
|
113
|
-
avatar: AvatarConfig;
|
|
114
|
-
/**
|
|
115
|
-
* Whether the settings section is enabled
|
|
116
|
-
* @default true
|
|
117
|
-
*/
|
|
118
|
-
enabled?: boolean;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Core authentication configuration interface.
|
|
122
|
-
*
|
|
123
|
-
* Defines the base structure for authentication settings including paths,
|
|
124
|
-
* providers, navigation functions, and feature flags.
|
|
125
|
-
*/
|
|
126
|
-
export interface AuthConfig {
|
|
127
|
-
/** Base paths for different application sections */
|
|
128
|
-
basePaths: {
|
|
129
|
-
/**
|
|
130
|
-
* Base path for authentication routes
|
|
131
|
-
* @default "/auth"
|
|
132
|
-
*/
|
|
133
|
-
auth: string;
|
|
134
|
-
/**
|
|
135
|
-
* Base path for settings routes
|
|
136
|
-
* @default "/settings"
|
|
137
|
-
*/
|
|
138
|
-
settings: string;
|
|
139
|
-
/**
|
|
140
|
-
* Base path for organization management routes
|
|
141
|
-
* @default "/organization"
|
|
142
|
-
*/
|
|
143
|
-
organization: string;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Base URL for API endpoints (optional)
|
|
147
|
-
* @default ""
|
|
148
|
-
*/
|
|
149
|
-
baseURL: string;
|
|
150
|
-
/**
|
|
151
|
-
* Email and password authentication configuration
|
|
152
|
-
* @default { enabled: true, forgotPassword: true, minPasswordLength: 8, maxPasswordLength: 128 }
|
|
153
|
-
*/
|
|
154
|
-
emailAndPassword: EmailAndPasswordConfig;
|
|
155
|
-
/** Localization strings for UI components. */
|
|
156
|
-
localization: Localization;
|
|
157
|
-
/** Whether magic link (passwordless) authentication is enabled */
|
|
158
|
-
magicLink?: boolean;
|
|
159
|
-
/** Whether multi-session support is enabled */
|
|
160
|
-
multiSession?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Default redirect path after successful authentication
|
|
163
|
-
* @default "/"
|
|
164
|
-
*/
|
|
165
|
-
redirectTo: string;
|
|
166
|
-
/**
|
|
167
|
-
* Settings section configuration
|
|
168
|
-
* @default { enabled: true }
|
|
169
|
-
*/
|
|
170
|
-
settings: SettingsConfig;
|
|
171
|
-
/**
|
|
172
|
-
* List of enabled social authentication providers
|
|
173
|
-
* @remarks `SocialProvider[]`
|
|
174
|
-
*/
|
|
175
|
-
socialProviders?: SocialProvider[];
|
|
176
|
-
/** View path mappings for different authentication views */
|
|
177
|
-
viewPaths: ViewPaths;
|
|
178
|
-
/**
|
|
179
|
-
* Toast notification configuration for user feedback.
|
|
180
|
-
* @remarks `Toast`
|
|
181
|
-
*/
|
|
182
|
-
toast: Toast;
|
|
183
|
-
/**
|
|
184
|
-
* Function to navigate to a new path
|
|
185
|
-
* @param options - Navigation options with href and optional replace flag
|
|
186
|
-
* @default window.location.href = href (or window.location.replace if replace: true)
|
|
187
|
-
* @example
|
|
188
|
-
* // TanStack Router
|
|
189
|
-
* navigate={navigate}
|
|
190
|
-
* // Next.js
|
|
191
|
-
* navigate={({href, replace}) => replace ? router.replace(href) : router.push(href)}
|
|
192
|
-
*/
|
|
193
|
-
navigate: (options: {
|
|
194
|
-
to: string;
|
|
195
|
-
replace?: boolean;
|
|
196
|
-
}) => void;
|
|
197
|
-
}
|
|
198
|
-
export declare const defaultConfig: AuthConfig;
|
package/dist/lib/auth-config.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { defaultToast } from "./auth-toast";
|
|
2
|
-
import { basePaths } from "./base-paths";
|
|
3
|
-
import { localization } from "./localization";
|
|
4
|
-
import { resizeAvatar } from "./utils";
|
|
5
|
-
import { viewPaths } from "./view-paths";
|
|
6
|
-
export const defaultConfig = {
|
|
7
|
-
basePaths,
|
|
8
|
-
baseURL: "",
|
|
9
|
-
emailAndPassword: {
|
|
10
|
-
enabled: true,
|
|
11
|
-
forgotPassword: true,
|
|
12
|
-
rememberMe: false,
|
|
13
|
-
minPasswordLength: 8,
|
|
14
|
-
maxPasswordLength: 128
|
|
15
|
-
},
|
|
16
|
-
redirectTo: "/",
|
|
17
|
-
settings: {
|
|
18
|
-
appearance: {
|
|
19
|
-
themes: ["system", "light", "dark"]
|
|
20
|
-
},
|
|
21
|
-
avatar: {
|
|
22
|
-
enabled: true,
|
|
23
|
-
resize: resizeAvatar,
|
|
24
|
-
size: 256
|
|
25
|
-
},
|
|
26
|
-
enabled: true
|
|
27
|
-
},
|
|
28
|
-
viewPaths,
|
|
29
|
-
localization,
|
|
30
|
-
navigate: () => { },
|
|
31
|
-
toast: {
|
|
32
|
-
error: defaultToast,
|
|
33
|
-
success: defaultToast,
|
|
34
|
-
info: defaultToast
|
|
35
|
-
}
|
|
36
|
-
};
|
package/dist/lib/auth-error.d.ts
DELETED
package/dist/lib/auth-error.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/auth-toast.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/lib/auth-toast.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Available theme options for the application.
|
|
3
|
-
*/
|
|
4
|
-
export type Theme = "system" | "light" | "dark";
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for appearance/theme settings.
|
|
7
|
-
*/
|
|
8
|
-
export type AppearanceConfig = {
|
|
9
|
-
/**
|
|
10
|
-
* Function to set the application theme
|
|
11
|
-
* @param theme - The theme value to set
|
|
12
|
-
*/
|
|
13
|
-
setTheme?: (theme: string) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Current theme value
|
|
16
|
-
*/
|
|
17
|
-
theme?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Available theme options to display in the theme switcher
|
|
20
|
-
* @default ["system", "light", "dark"]
|
|
21
|
-
*/
|
|
22
|
-
themes?: Theme[];
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { SocialProvider } from "better-auth/social-providers";
|
|
2
|
-
import { type ToastConfig } from "./toast-config";
|
|
3
|
-
import { type BasePaths } from "../base-paths";
|
|
4
|
-
import { type Localization } from "../localization";
|
|
5
|
-
import { type ViewPaths } from "../view-paths";
|
|
6
|
-
import type { EmailAndPasswordConfig } from "./email-and-password-config";
|
|
7
|
-
import type { SettingsConfig } from "./settings-config";
|
|
8
|
-
/**
|
|
9
|
-
* Core authentication configuration interface.
|
|
10
|
-
*
|
|
11
|
-
* Defines the base structure for authentication settings including paths,
|
|
12
|
-
* providers, navigation functions, and feature flags.
|
|
13
|
-
*/
|
|
14
|
-
export interface AuthConfig {
|
|
15
|
-
/** Base paths for different application sections */
|
|
16
|
-
basePaths: BasePaths;
|
|
17
|
-
/**
|
|
18
|
-
* Base URL for API endpoints (optional)
|
|
19
|
-
* @default ""
|
|
20
|
-
*/
|
|
21
|
-
baseURL: string;
|
|
22
|
-
/**
|
|
23
|
-
* Email and password authentication configuration
|
|
24
|
-
* @default { enabled: true, forgotPassword: true, minPasswordLength: 8, maxPasswordLength: 128 }
|
|
25
|
-
*/
|
|
26
|
-
emailAndPassword: EmailAndPasswordConfig;
|
|
27
|
-
/** Localization strings for UI components. */
|
|
28
|
-
localization: Localization;
|
|
29
|
-
/** Whether magic link (passwordless) authentication is enabled */
|
|
30
|
-
magicLink?: boolean;
|
|
31
|
-
/** Whether multi-session support is enabled */
|
|
32
|
-
multiSession?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Default redirect path after successful authentication
|
|
35
|
-
* @default "/"
|
|
36
|
-
*/
|
|
37
|
-
redirectTo: string;
|
|
38
|
-
/**
|
|
39
|
-
* Settings section configuration
|
|
40
|
-
* @default { enabled: true }
|
|
41
|
-
*/
|
|
42
|
-
settings: SettingsConfig;
|
|
43
|
-
/**
|
|
44
|
-
* List of enabled social authentication providers
|
|
45
|
-
* @remarks `SocialProvider[]`
|
|
46
|
-
*/
|
|
47
|
-
socialProviders?: SocialProvider[];
|
|
48
|
-
/** View path mappings for different authentication views */
|
|
49
|
-
viewPaths: ViewPaths;
|
|
50
|
-
/**
|
|
51
|
-
* Toast notification configuration for user feedback.
|
|
52
|
-
* @remarks `ToastConfig`
|
|
53
|
-
*/
|
|
54
|
-
toast: ToastConfig;
|
|
55
|
-
/**
|
|
56
|
-
* Function to navigate to a new path
|
|
57
|
-
* @param options - Navigation options with href and optional replace flag
|
|
58
|
-
* @default window.location.href = href (or window.location.replace if replace: true)
|
|
59
|
-
* @example
|
|
60
|
-
* // TanStack Router
|
|
61
|
-
* navigate={navigate}
|
|
62
|
-
* // Next.js
|
|
63
|
-
* navigate={({href, replace}) => replace ? router.replace(href) : router.push(href)}
|
|
64
|
-
*/
|
|
65
|
-
navigate: (options: {
|
|
66
|
-
to: string;
|
|
67
|
-
replace?: boolean;
|
|
68
|
-
}) => void;
|
|
69
|
-
}
|
|
70
|
-
export declare const defaultConfig: AuthConfig;
|