@better-auth-ui/core 1.6.27 → 1.6.29
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/{create-auth-plugin-CSJlOwwp.js → create-auth-plugin-DvOQZp9O.js} +3 -0
- package/dist/index.js +1 -1
- package/dist/lib/localization.d.ts +4 -0
- package/dist/lib/view-paths.d.ts +5 -0
- package/dist/plugins/last-login-method/last-login-method-localization.d.ts +7 -0
- package/dist/plugins/last-login-method/last-login-method-plugin.d.ts +24 -0
- package/dist/plugins/magic-link/magic-link-localization.d.ts +2 -0
- package/dist/plugins/magic-link/magic-link-plugin.d.ts +11 -1
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +60 -50
- package/package.json +1 -1
- package/src/lib/localization.ts +6 -0
- package/src/lib/view-paths.ts +6 -0
- package/src/plugins/last-login-method/last-login-method-localization.ts +9 -0
- package/src/plugins/last-login-method/last-login-method-plugin.ts +29 -0
- package/src/plugins/magic-link/magic-link-localization.ts +3 -1
- package/src/plugins/magic-link/magic-link-plugin.ts +13 -2
- package/src/plugins.ts +2 -0
|
@@ -11,6 +11,7 @@ var e = {
|
|
|
11
11
|
confirmPassword: "Confirm password",
|
|
12
12
|
confirmPasswordPlaceholder: "Confirm your password",
|
|
13
13
|
checkYourEmail: "Check your email for a verification link",
|
|
14
|
+
checkYourEmailTitle: "Check your email",
|
|
14
15
|
continueWith: "Continue with {{provider}}",
|
|
15
16
|
email: "Email",
|
|
16
17
|
emailPlaceholder: "m@example.com",
|
|
@@ -38,6 +39,7 @@ var e = {
|
|
|
38
39
|
rememberYourPassword: "Remember your password?",
|
|
39
40
|
resend: "Resend",
|
|
40
41
|
resendIn: "Resend in {{seconds}}s",
|
|
42
|
+
resetLinkSentTo: "We sent a password reset link to {{email}}",
|
|
41
43
|
resetPassword: "Reset Password",
|
|
42
44
|
sendResetLink: "Send reset link",
|
|
43
45
|
showPassword: "Show password",
|
|
@@ -144,6 +146,7 @@ var s = {
|
|
|
144
146
|
signUp: "sign-up",
|
|
145
147
|
forgotPassword: "forgot-password",
|
|
146
148
|
resetPassword: "reset-password",
|
|
149
|
+
resetLinkSent: "reset-link-sent",
|
|
147
150
|
signOut: "sign-out",
|
|
148
151
|
verifyEmail: "verify-email"
|
|
149
152
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./create-auth-plugin-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./create-auth-plugin-DvOQZp9O.js";
|
|
2
2
|
//#region src/config/additional-fields-config.ts
|
|
3
3
|
function l(e, t) {
|
|
4
4
|
if (e.type === "boolean") return t === "on" || t === "true";
|
|
@@ -12,6 +12,8 @@ export declare const localization: {
|
|
|
12
12
|
confirmPasswordPlaceholder: string;
|
|
13
13
|
/** @remarks `"Check your email for a verification link"` */
|
|
14
14
|
checkYourEmail: string;
|
|
15
|
+
/** @remarks `"Check your email"` */
|
|
16
|
+
checkYourEmailTitle: string;
|
|
15
17
|
/** @remarks `"Continue with {{provider}}"` */
|
|
16
18
|
continueWith: string;
|
|
17
19
|
/** @remarks `"Email"` */
|
|
@@ -66,6 +68,8 @@ export declare const localization: {
|
|
|
66
68
|
resend: string;
|
|
67
69
|
/** @remarks `"Resend in {{seconds}}s"` */
|
|
68
70
|
resendIn: string;
|
|
71
|
+
/** @remarks `"We sent a password reset link to {{email}}"` */
|
|
72
|
+
resetLinkSentTo: string;
|
|
69
73
|
/** @remarks `"Reset Password"` */
|
|
70
74
|
resetPassword: string;
|
|
71
75
|
/** @remarks `"Send reset link"` */
|
package/dist/lib/view-paths.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface AuthViewPaths {
|
|
|
22
22
|
* @default "reset-password"
|
|
23
23
|
*/
|
|
24
24
|
resetPassword: string;
|
|
25
|
+
/**
|
|
26
|
+
* Path segment for the reset-link-sent confirmation view
|
|
27
|
+
* @default "reset-link-sent"
|
|
28
|
+
*/
|
|
29
|
+
resetLinkSent: string;
|
|
25
30
|
/**
|
|
26
31
|
* Path segment for the sign-out view
|
|
27
32
|
* @default "sign-out"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LastLoginMethodLocalization } from './last-login-method-localization';
|
|
2
|
+
export type LastLoginMethodPluginOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Override the plugin's default localization strings.
|
|
5
|
+
* @remarks `LastLoginMethodLocalization`
|
|
6
|
+
*/
|
|
7
|
+
localization?: Partial<LastLoginMethodLocalization>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Enables last-login-method indicators in supported authentication views.
|
|
11
|
+
*
|
|
12
|
+
* Pair this UI plugin with Better Auth's `lastLoginMethod()` server plugin
|
|
13
|
+
* and `lastLoginMethodClient()` client plugin.
|
|
14
|
+
*/
|
|
15
|
+
export declare const lastLoginMethodPlugin: ((options?: LastLoginMethodPluginOptions | undefined) => {
|
|
16
|
+
localization: {
|
|
17
|
+
lastUsed: string;
|
|
18
|
+
lastUsedShort: string;
|
|
19
|
+
};
|
|
20
|
+
} & {
|
|
21
|
+
id: "lastLoginMethod";
|
|
22
|
+
}) & {
|
|
23
|
+
id: "lastLoginMethod";
|
|
24
|
+
};
|
|
@@ -5,5 +5,7 @@ export declare const magicLinkLocalization: {
|
|
|
5
5
|
sendMagicLink: string;
|
|
6
6
|
/** @remarks `"Check your email for the magic link"` */
|
|
7
7
|
magicLinkSent: string;
|
|
8
|
+
/** @remarks `"We sent a magic link to {{email}}"` */
|
|
9
|
+
magicLinkSentTo: string;
|
|
8
10
|
};
|
|
9
11
|
export type MagicLinkLocalization = typeof magicLinkLocalization;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { MagicLinkLocalization } from './magic-link-localization';
|
|
2
2
|
declare module "../../lib/view-paths" {
|
|
3
|
-
/** Widens `AuthViewPaths`
|
|
3
|
+
/** Widens `AuthViewPaths` with the magic-link paths when this plugin is imported. */
|
|
4
4
|
interface AuthViewPaths {
|
|
5
5
|
/** @default "magic-link" */
|
|
6
6
|
magicLink?: string;
|
|
7
|
+
/** @default "magic-link-sent" */
|
|
8
|
+
magicLinkSent?: string;
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
export type MagicLinkPluginOptions = {
|
|
@@ -18,16 +20,24 @@ export type MagicLinkPluginOptions = {
|
|
|
18
20
|
* @default "magic-link"
|
|
19
21
|
*/
|
|
20
22
|
path?: string;
|
|
23
|
+
/**
|
|
24
|
+
* URL segment for the magic-link-sent confirmation view.
|
|
25
|
+
* @remarks `string`
|
|
26
|
+
* @default "magic-link-sent"
|
|
27
|
+
*/
|
|
28
|
+
sentPath?: string;
|
|
21
29
|
};
|
|
22
30
|
export declare const magicLinkPlugin: ((options?: MagicLinkPluginOptions | undefined) => {
|
|
23
31
|
localization: {
|
|
24
32
|
magicLink: string;
|
|
25
33
|
sendMagicLink: string;
|
|
26
34
|
magicLinkSent: string;
|
|
35
|
+
magicLinkSentTo: string;
|
|
27
36
|
};
|
|
28
37
|
viewPaths: {
|
|
29
38
|
auth: {
|
|
30
39
|
magicLink: string;
|
|
40
|
+
magicLinkSent: string;
|
|
31
41
|
};
|
|
32
42
|
};
|
|
33
43
|
} & {
|
package/dist/plugins.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './plugins/api-key/api-key-query-keys';
|
|
|
5
5
|
export * from './plugins/delete-user/delete-user-localization';
|
|
6
6
|
export * from './plugins/delete-user/delete-user-mutation-keys';
|
|
7
7
|
export * from './plugins/delete-user/delete-user-plugin';
|
|
8
|
+
export * from './plugins/last-login-method/last-login-method-localization';
|
|
9
|
+
export * from './plugins/last-login-method/last-login-method-plugin';
|
|
8
10
|
export * from './plugins/magic-link/magic-link-localization';
|
|
9
11
|
export * from './plugins/magic-link/magic-link-mutation-keys';
|
|
10
12
|
export * from './plugins/magic-link/magic-link-plugin';
|
package/dist/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./create-auth-plugin-
|
|
1
|
+
import { n as e, r as t, t as n } from "./create-auth-plugin-DvOQZp9O.js";
|
|
2
2
|
//#region src/plugins/api-key/api-key-localization.ts
|
|
3
3
|
var r = {
|
|
4
4
|
apiKey: "API key",
|
|
@@ -46,25 +46,35 @@ var r = {
|
|
|
46
46
|
},
|
|
47
47
|
sendDeleteAccountVerification: e.sendDeleteAccountVerification ?? !1
|
|
48
48
|
})), u = {
|
|
49
|
+
lastUsed: "Last used",
|
|
50
|
+
lastUsedShort: "Last"
|
|
51
|
+
}, d = n("lastLoginMethod", (e = {}) => ({ localization: {
|
|
52
|
+
...u,
|
|
53
|
+
...e.localization
|
|
54
|
+
} })), f = {
|
|
49
55
|
magicLink: "Magic Link",
|
|
50
56
|
sendMagicLink: "Send Magic Link",
|
|
51
|
-
magicLinkSent: "Check your email for the magic link"
|
|
52
|
-
|
|
57
|
+
magicLinkSent: "Check your email for the magic link",
|
|
58
|
+
magicLinkSentTo: "We sent a magic link to {{email}}"
|
|
59
|
+
}, p = { signIn: [
|
|
53
60
|
"auth",
|
|
54
61
|
"signIn",
|
|
55
62
|
"magicLink"
|
|
56
|
-
] },
|
|
63
|
+
] }, m = n("magicLink", (e = {}) => ({
|
|
57
64
|
localization: {
|
|
58
|
-
...
|
|
65
|
+
...f,
|
|
59
66
|
...e.localization
|
|
60
67
|
},
|
|
61
|
-
viewPaths: { auth: {
|
|
62
|
-
|
|
68
|
+
viewPaths: { auth: {
|
|
69
|
+
magicLink: e.path ?? "magic-link",
|
|
70
|
+
magicLinkSent: e.sentPath ?? "magic-link-sent"
|
|
71
|
+
} }
|
|
72
|
+
})), h = {
|
|
63
73
|
switchAccount: "Switch Account",
|
|
64
74
|
addAccount: "Add Account",
|
|
65
75
|
manageAccounts: "Manage accounts",
|
|
66
76
|
manageAccountsDescription: "Manage your accounts for secure access."
|
|
67
|
-
},
|
|
77
|
+
}, g = {
|
|
68
78
|
all: ["auth", "multiSession"],
|
|
69
79
|
revoke: [
|
|
70
80
|
"auth",
|
|
@@ -76,14 +86,14 @@ var r = {
|
|
|
76
86
|
"multiSession",
|
|
77
87
|
"setActive"
|
|
78
88
|
]
|
|
79
|
-
},
|
|
80
|
-
...
|
|
89
|
+
}, _ = n("multiSession", (e = {}) => ({ localization: {
|
|
90
|
+
...h,
|
|
81
91
|
...e.localization
|
|
82
|
-
} })),
|
|
92
|
+
} })), v = {
|
|
83
93
|
all: (t) => [...e.user(t), "multiSession"],
|
|
84
|
-
lists: (e) => [...
|
|
85
|
-
list: (e, t) => [...
|
|
86
|
-
},
|
|
94
|
+
lists: (e) => [...v.all(e), "list"],
|
|
95
|
+
list: (e, t) => [...v.lists(e), t ?? null]
|
|
96
|
+
}, y = {
|
|
87
97
|
accept: "Accept",
|
|
88
98
|
accepted: "Accepted",
|
|
89
99
|
actions: "Actions",
|
|
@@ -140,7 +150,7 @@ var r = {
|
|
|
140
150
|
status: "Status",
|
|
141
151
|
uploadLogo: "Upload logo",
|
|
142
152
|
userInvitationsEmptyDescription: "Invitations to join an organization will show up here."
|
|
143
|
-
},
|
|
153
|
+
}, b = {
|
|
144
154
|
all: ["auth", "organization"],
|
|
145
155
|
create: [
|
|
146
156
|
"auth",
|
|
@@ -202,9 +212,9 @@ var r = {
|
|
|
202
212
|
"organization",
|
|
203
213
|
"checkSlug"
|
|
204
214
|
]
|
|
205
|
-
},
|
|
215
|
+
}, x = n("organization", (e = {}) => {
|
|
206
216
|
let n = {
|
|
207
|
-
...
|
|
217
|
+
...y,
|
|
208
218
|
...e.localization
|
|
209
219
|
};
|
|
210
220
|
return {
|
|
@@ -232,38 +242,38 @@ var r = {
|
|
|
232
242
|
}
|
|
233
243
|
}
|
|
234
244
|
};
|
|
235
|
-
}),
|
|
245
|
+
}), S = {
|
|
236
246
|
all: (t) => [...e.user(t), "organization"],
|
|
237
|
-
lists: (e) => [...
|
|
238
|
-
list: (e, t) => [...
|
|
239
|
-
fullDetails: (e) => [...
|
|
240
|
-
fullDetail: (e, t) => [...
|
|
241
|
-
activeOrganizations: (e) => [...
|
|
242
|
-
activeOrganization: (e, t) => [...
|
|
247
|
+
lists: (e) => [...S.all(e), "list"],
|
|
248
|
+
list: (e, t) => [...S.lists(e), t ?? null],
|
|
249
|
+
fullDetails: (e) => [...S.all(e), "fullDetails"],
|
|
250
|
+
fullDetail: (e, t) => [...S.fullDetails(e), t ?? null],
|
|
251
|
+
activeOrganizations: (e) => [...S.all(e), "active"],
|
|
252
|
+
activeOrganization: (e, t) => [...S.activeOrganizations(e), t ?? null],
|
|
243
253
|
members: {
|
|
244
|
-
all: (e) => [...
|
|
245
|
-
lists: (e) => [...
|
|
246
|
-
list: (e, t) => [...
|
|
254
|
+
all: (e) => [...S.all(e), "members"],
|
|
255
|
+
lists: (e) => [...S.members.all(e), "list"],
|
|
256
|
+
list: (e, t) => [...S.members.lists(e), t ?? null]
|
|
247
257
|
},
|
|
248
258
|
invitations: {
|
|
249
|
-
all: (e) => [...
|
|
250
|
-
lists: (e) => [...
|
|
251
|
-
list: (e, t) => [...
|
|
259
|
+
all: (e) => [...S.all(e), "invitations"],
|
|
260
|
+
lists: (e) => [...S.invitations.all(e), "list"],
|
|
261
|
+
list: (e, t) => [...S.invitations.lists(e), t ?? null]
|
|
252
262
|
},
|
|
253
263
|
userInvitations: {
|
|
254
|
-
all: (e) => [...
|
|
255
|
-
lists: (e) => [...
|
|
256
|
-
list: (e, t) => [...
|
|
264
|
+
all: (e) => [...S.all(e), "userInvitations"],
|
|
265
|
+
lists: (e) => [...S.userInvitations.all(e), "list"],
|
|
266
|
+
list: (e, t) => [...S.userInvitations.lists(e), t ?? null]
|
|
257
267
|
},
|
|
258
268
|
permissions: {
|
|
259
|
-
all: (e) => [...
|
|
269
|
+
all: (e) => [...S.all(e), "permissions"],
|
|
260
270
|
has: (e, t) => [
|
|
261
|
-
...
|
|
271
|
+
...S.permissions.all(e),
|
|
262
272
|
"has",
|
|
263
273
|
t ?? null
|
|
264
274
|
]
|
|
265
275
|
}
|
|
266
|
-
},
|
|
276
|
+
}, C = {
|
|
267
277
|
passkey: "Passkey",
|
|
268
278
|
addPasskey: "Add passkey",
|
|
269
279
|
deletePasskey: "Delete passkey {{name}}",
|
|
@@ -273,7 +283,7 @@ var r = {
|
|
|
273
283
|
passkeysDescription: "Create a passkey to securely access your account.",
|
|
274
284
|
noPasskeys: "No passkeys",
|
|
275
285
|
name: "Name"
|
|
276
|
-
},
|
|
286
|
+
}, w = {
|
|
277
287
|
signIn: [
|
|
278
288
|
"auth",
|
|
279
289
|
"signIn",
|
|
@@ -289,22 +299,22 @@ var r = {
|
|
|
289
299
|
"passkey",
|
|
290
300
|
"deletePasskey"
|
|
291
301
|
]
|
|
292
|
-
},
|
|
293
|
-
...
|
|
302
|
+
}, T = n("passkey", (e = {}) => ({ localization: {
|
|
303
|
+
...C,
|
|
294
304
|
...e.localization
|
|
295
|
-
} })),
|
|
305
|
+
} })), E = {
|
|
296
306
|
all: (t) => [...e.user(t), "passkey"],
|
|
297
|
-
lists: (e) => [...
|
|
298
|
-
list: (e, t) => [...
|
|
299
|
-
},
|
|
307
|
+
lists: (e) => [...E.all(e), "list"],
|
|
308
|
+
list: (e, t) => [...E.lists(e), t ?? null]
|
|
309
|
+
}, D = {
|
|
300
310
|
appearance: "Appearance",
|
|
301
311
|
theme: "Theme",
|
|
302
312
|
system: "System",
|
|
303
313
|
light: "Light",
|
|
304
314
|
dark: "Dark"
|
|
305
|
-
},
|
|
315
|
+
}, O = n("theme", (e) => ({
|
|
306
316
|
localization: {
|
|
307
|
-
...
|
|
317
|
+
...D,
|
|
308
318
|
...e.localization
|
|
309
319
|
},
|
|
310
320
|
theme: e.theme ?? "system",
|
|
@@ -314,7 +324,7 @@ var r = {
|
|
|
314
324
|
"light",
|
|
315
325
|
"dark"
|
|
316
326
|
]
|
|
317
|
-
})),
|
|
327
|
+
})), k = {
|
|
318
328
|
username: "Username",
|
|
319
329
|
usernamePlaceholder: "Username",
|
|
320
330
|
usernameOrEmailPlaceholder: "Username or email",
|
|
@@ -322,16 +332,16 @@ var r = {
|
|
|
322
332
|
usernameTaken: "Username is already taken. Please try another.",
|
|
323
333
|
displayUsername: "Display Username",
|
|
324
334
|
displayUsernamePlaceholder: "Display Username"
|
|
325
|
-
},
|
|
335
|
+
}, A = {
|
|
326
336
|
signIn: [
|
|
327
337
|
"auth",
|
|
328
338
|
"signIn",
|
|
329
339
|
"username"
|
|
330
340
|
],
|
|
331
341
|
isUsernameAvailable: ["auth", "isUsernameAvailable"]
|
|
332
|
-
},
|
|
342
|
+
}, j = n("username", (e = {}) => {
|
|
333
343
|
let t = e.minUsernameLength ?? 3, n = e.maxUsernameLength ?? 30, r = {
|
|
334
|
-
...
|
|
344
|
+
...k,
|
|
335
345
|
...e.localization
|
|
336
346
|
};
|
|
337
347
|
return {
|
|
@@ -359,4 +369,4 @@ var r = {
|
|
|
359
369
|
};
|
|
360
370
|
});
|
|
361
371
|
//#endregion
|
|
362
|
-
export { r as apiKeyLocalization, i as apiKeyMutationKeys, a as apiKeyPlugin, o as apiKeyQueryKeys, s as deleteUserLocalization, c as deleteUserMutationKeys, l as deleteUserPlugin, u as
|
|
372
|
+
export { r as apiKeyLocalization, i as apiKeyMutationKeys, a as apiKeyPlugin, o as apiKeyQueryKeys, s as deleteUserLocalization, c as deleteUserMutationKeys, l as deleteUserPlugin, u as lastLoginMethodLocalization, d as lastLoginMethodPlugin, f as magicLinkLocalization, p as magicLinkMutationKeys, m as magicLinkPlugin, h as multiSessionLocalization, g as multiSessionMutationKeys, _ as multiSessionPlugin, v as multiSessionQueryKeys, y as organizationLocalization, b as organizationMutationKeys, x as organizationPlugin, S as organizationQueryKeys, C as passkeyLocalization, w as passkeyMutationKeys, T as passkeyPlugin, E as passkeyQueryKeys, D as themeLocalization, O as themePlugin, k as usernameLocalization, A as usernameMutationKeys, j as usernamePlugin };
|
package/package.json
CHANGED
package/src/lib/localization.ts
CHANGED
|
@@ -18,6 +18,9 @@ export const localization = {
|
|
|
18
18
|
/** @remarks `"Check your email for a verification link"` */
|
|
19
19
|
checkYourEmail: "Check your email for a verification link",
|
|
20
20
|
|
|
21
|
+
/** @remarks `"Check your email"` */
|
|
22
|
+
checkYourEmailTitle: "Check your email",
|
|
23
|
+
|
|
21
24
|
/** @remarks `"Continue with {{provider}}"` */
|
|
22
25
|
continueWith: "Continue with {{provider}}",
|
|
23
26
|
|
|
@@ -99,6 +102,9 @@ export const localization = {
|
|
|
99
102
|
/** @remarks `"Resend in {{seconds}}s"` */
|
|
100
103
|
resendIn: "Resend in {{seconds}}s",
|
|
101
104
|
|
|
105
|
+
/** @remarks `"We sent a password reset link to {{email}}"` */
|
|
106
|
+
resetLinkSentTo: "We sent a password reset link to {{email}}",
|
|
107
|
+
|
|
102
108
|
/** @remarks `"Reset Password"` */
|
|
103
109
|
resetPassword: "Reset Password",
|
|
104
110
|
|
package/src/lib/view-paths.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface AuthViewPaths {
|
|
|
22
22
|
* @default "reset-password"
|
|
23
23
|
*/
|
|
24
24
|
resetPassword: string
|
|
25
|
+
/**
|
|
26
|
+
* Path segment for the reset-link-sent confirmation view
|
|
27
|
+
* @default "reset-link-sent"
|
|
28
|
+
*/
|
|
29
|
+
resetLinkSent: string
|
|
25
30
|
/**
|
|
26
31
|
* Path segment for the sign-out view
|
|
27
32
|
* @default "sign-out"
|
|
@@ -66,6 +71,7 @@ export const viewPaths: ViewPaths = {
|
|
|
66
71
|
signUp: "sign-up",
|
|
67
72
|
forgotPassword: "forgot-password",
|
|
68
73
|
resetPassword: "reset-password",
|
|
74
|
+
resetLinkSent: "reset-link-sent",
|
|
69
75
|
signOut: "sign-out",
|
|
70
76
|
verifyEmail: "verify-email"
|
|
71
77
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createAuthPlugin } from "../../lib/create-auth-plugin"
|
|
2
|
+
import {
|
|
3
|
+
type LastLoginMethodLocalization,
|
|
4
|
+
lastLoginMethodLocalization
|
|
5
|
+
} from "./last-login-method-localization"
|
|
6
|
+
|
|
7
|
+
export type LastLoginMethodPluginOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Override the plugin's default localization strings.
|
|
10
|
+
* @remarks `LastLoginMethodLocalization`
|
|
11
|
+
*/
|
|
12
|
+
localization?: Partial<LastLoginMethodLocalization>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Enables last-login-method indicators in supported authentication views.
|
|
17
|
+
*
|
|
18
|
+
* Pair this UI plugin with Better Auth's `lastLoginMethod()` server plugin
|
|
19
|
+
* and `lastLoginMethodClient()` client plugin.
|
|
20
|
+
*/
|
|
21
|
+
export const lastLoginMethodPlugin = createAuthPlugin(
|
|
22
|
+
"lastLoginMethod",
|
|
23
|
+
(options: LastLoginMethodPluginOptions = {}) => ({
|
|
24
|
+
localization: {
|
|
25
|
+
...lastLoginMethodLocalization,
|
|
26
|
+
...options.localization
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
)
|
|
@@ -4,7 +4,9 @@ export const magicLinkLocalization = {
|
|
|
4
4
|
/** @remarks `"Send Magic Link"` */
|
|
5
5
|
sendMagicLink: "Send Magic Link",
|
|
6
6
|
/** @remarks `"Check your email for the magic link"` */
|
|
7
|
-
magicLinkSent: "Check your email for the magic link"
|
|
7
|
+
magicLinkSent: "Check your email for the magic link",
|
|
8
|
+
/** @remarks `"We sent a magic link to {{email}}"` */
|
|
9
|
+
magicLinkSentTo: "We sent a magic link to {{email}}"
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export type MagicLinkLocalization = typeof magicLinkLocalization
|
|
@@ -8,10 +8,12 @@ import {
|
|
|
8
8
|
} from "./magic-link-localization"
|
|
9
9
|
|
|
10
10
|
declare module "../../lib/view-paths" {
|
|
11
|
-
/** Widens `AuthViewPaths`
|
|
11
|
+
/** Widens `AuthViewPaths` with the magic-link paths when this plugin is imported. */
|
|
12
12
|
interface AuthViewPaths {
|
|
13
13
|
/** @default "magic-link" */
|
|
14
14
|
magicLink?: string
|
|
15
|
+
/** @default "magic-link-sent" */
|
|
16
|
+
magicLinkSent?: string
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -27,6 +29,12 @@ export type MagicLinkPluginOptions = {
|
|
|
27
29
|
* @default "magic-link"
|
|
28
30
|
*/
|
|
29
31
|
path?: string
|
|
32
|
+
/**
|
|
33
|
+
* URL segment for the magic-link-sent confirmation view.
|
|
34
|
+
* @remarks `string`
|
|
35
|
+
* @default "magic-link-sent"
|
|
36
|
+
*/
|
|
37
|
+
sentPath?: string
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
export const magicLinkPlugin = createAuthPlugin(
|
|
@@ -34,7 +42,10 @@ export const magicLinkPlugin = createAuthPlugin(
|
|
|
34
42
|
(options: MagicLinkPluginOptions = {}) => ({
|
|
35
43
|
localization: { ...magicLinkLocalization, ...options.localization },
|
|
36
44
|
viewPaths: {
|
|
37
|
-
auth: {
|
|
45
|
+
auth: {
|
|
46
|
+
magicLink: options.path ?? "magic-link",
|
|
47
|
+
magicLinkSent: options.sentPath ?? "magic-link-sent"
|
|
48
|
+
}
|
|
38
49
|
}
|
|
39
50
|
})
|
|
40
51
|
)
|
package/src/plugins.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from "./plugins/api-key/api-key-query-keys"
|
|
|
5
5
|
export * from "./plugins/delete-user/delete-user-localization"
|
|
6
6
|
export * from "./plugins/delete-user/delete-user-mutation-keys"
|
|
7
7
|
export * from "./plugins/delete-user/delete-user-plugin"
|
|
8
|
+
export * from "./plugins/last-login-method/last-login-method-localization"
|
|
9
|
+
export * from "./plugins/last-login-method/last-login-method-plugin"
|
|
8
10
|
export * from "./plugins/magic-link/magic-link-localization"
|
|
9
11
|
export * from "./plugins/magic-link/magic-link-mutation-keys"
|
|
10
12
|
export * from "./plugins/magic-link/magic-link-plugin"
|