@better-auth-ui/core 1.6.22 → 1.6.24
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-BHcy7UTO.js → create-auth-plugin-BA7PI8QW.js} +7 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -8
- package/dist/lib/email-provider-links.d.ts +18 -0
- package/dist/lib/localization.d.ts +10 -2
- package/dist/lib/view-paths.d.ts +5 -0
- package/dist/plugins.js +1 -1
- package/package.json +3 -1
- package/src/index.ts +1 -0
- package/src/lib/email-provider-links.ts +60 -0
- package/src/lib/localization.ts +14 -2
- package/src/lib/view-paths.ts +7 -1
|
@@ -7,8 +7,10 @@ var e = {
|
|
|
7
7
|
auth: {
|
|
8
8
|
account: "Account",
|
|
9
9
|
alreadyHaveAnAccount: "Already have an account?",
|
|
10
|
+
alreadyVerifiedYourEmail: "Already verified your email?",
|
|
10
11
|
confirmPassword: "Confirm password",
|
|
11
12
|
confirmPasswordPlaceholder: "Confirm your password",
|
|
13
|
+
checkYourEmail: "Check your email for a verification link",
|
|
12
14
|
continueWith: "Continue with {{provider}}",
|
|
13
15
|
email: "Email",
|
|
14
16
|
emailPlaceholder: "Enter your email",
|
|
@@ -23,6 +25,7 @@ var e = {
|
|
|
23
25
|
needToCreateAnAccount: "Need to create an account?",
|
|
24
26
|
newPassword: "New password",
|
|
25
27
|
newPasswordPlaceholder: "Enter your new password",
|
|
28
|
+
openEmailProvider: "Open {{provider}}",
|
|
26
29
|
or: "OR",
|
|
27
30
|
password: "Password",
|
|
28
31
|
passwordPlaceholder: "Enter your password",
|
|
@@ -34,6 +37,7 @@ var e = {
|
|
|
34
37
|
tooShort: "Must be at least {{min}} characters",
|
|
35
38
|
rememberYourPassword: "Remember your password?",
|
|
36
39
|
resend: "Resend",
|
|
40
|
+
resendIn: "Resend in {{seconds}}s",
|
|
37
41
|
resetPassword: "Reset Password",
|
|
38
42
|
sendResetLink: "Send reset link",
|
|
39
43
|
showPassword: "Show password",
|
|
@@ -41,7 +45,7 @@ var e = {
|
|
|
41
45
|
signOut: "Sign Out",
|
|
42
46
|
signUp: "Sign Up",
|
|
43
47
|
verificationEmailSent: "Verification email sent!",
|
|
44
|
-
|
|
48
|
+
verifyEmail: "Verify Email"
|
|
45
49
|
},
|
|
46
50
|
settings: {
|
|
47
51
|
account: "Account",
|
|
@@ -140,7 +144,8 @@ var s = {
|
|
|
140
144
|
signUp: "sign-up",
|
|
141
145
|
forgotPassword: "forgot-password",
|
|
142
146
|
resetPassword: "reset-password",
|
|
143
|
-
signOut: "sign-out"
|
|
147
|
+
signOut: "sign-out",
|
|
148
|
+
verifyEmail: "verify-email"
|
|
144
149
|
},
|
|
145
150
|
settings: {
|
|
146
151
|
account: "account",
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './lib/auth-query-keys';
|
|
|
5
5
|
export * from './lib/base-paths';
|
|
6
6
|
export * from './lib/create-auth-plugin';
|
|
7
7
|
export * from './lib/deep-partial';
|
|
8
|
+
export * from './lib/email-provider-links';
|
|
8
9
|
export * from './lib/localization';
|
|
9
10
|
export * from './lib/provider-names';
|
|
10
11
|
export * from './lib/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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-BA7PI8QW.js";
|
|
2
|
+
import l from "@mikkelscheike/email-provider-links/providers/emailproviders.json";
|
|
2
3
|
//#region src/config/additional-fields-config.ts
|
|
3
|
-
function
|
|
4
|
+
function u(e, t) {
|
|
4
5
|
if (e.type === "boolean") return t === "on" || t === "true";
|
|
5
6
|
if (t != null) {
|
|
6
7
|
if (t === "") return null;
|
|
@@ -15,7 +16,7 @@ function l(e, t) {
|
|
|
15
16
|
return t;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function d(e) {
|
|
19
20
|
if (e.inputType) return e.inputType;
|
|
20
21
|
switch (e.type) {
|
|
21
22
|
case "number": return "number";
|
|
@@ -26,7 +27,7 @@ function u(e) {
|
|
|
26
27
|
}
|
|
27
28
|
//#endregion
|
|
28
29
|
//#region src/lib/auth-mutation-keys.ts
|
|
29
|
-
var
|
|
30
|
+
var f = {
|
|
30
31
|
all: ["auth"],
|
|
31
32
|
signIn: {
|
|
32
33
|
all: ["auth", "signIn"],
|
|
@@ -59,7 +60,26 @@ var d = {
|
|
|
59
60
|
revokeSession: ["auth", "revokeSession"],
|
|
60
61
|
unlinkAccount: ["auth", "unlinkAccount"],
|
|
61
62
|
updateUser: ["auth", "updateUser"]
|
|
62
|
-
},
|
|
63
|
+
}, p;
|
|
64
|
+
function m() {
|
|
65
|
+
if (p) return p;
|
|
66
|
+
p = /* @__PURE__ */ new Map();
|
|
67
|
+
let { providers: e } = l;
|
|
68
|
+
for (let t of e) if (t.loginUrl) for (let e of t.domains ?? []) p.set(e.toLowerCase(), {
|
|
69
|
+
companyProvider: t.companyProvider,
|
|
70
|
+
loginUrl: t.loginUrl
|
|
71
|
+
});
|
|
72
|
+
return p;
|
|
73
|
+
}
|
|
74
|
+
function h(e) {
|
|
75
|
+
let t = e.lastIndexOf("@");
|
|
76
|
+
if (t === -1) return null;
|
|
77
|
+
let n = e.slice(t + 1).trim().toLowerCase();
|
|
78
|
+
return n ? m().get(n) ?? null : null;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/lib/provider-names.ts
|
|
82
|
+
var g = {
|
|
63
83
|
apple: "Apple",
|
|
64
84
|
atlassian: "Atlassian",
|
|
65
85
|
cognito: "Cognito",
|
|
@@ -96,8 +116,8 @@ var d = {
|
|
|
96
116
|
wechat: "WeChat",
|
|
97
117
|
zoom: "Zoom"
|
|
98
118
|
};
|
|
99
|
-
function
|
|
100
|
-
return
|
|
119
|
+
function _(e) {
|
|
120
|
+
return g[e] || e.charAt(0).toUpperCase() + e.slice(1);
|
|
101
121
|
}
|
|
102
122
|
//#endregion
|
|
103
|
-
export {
|
|
123
|
+
export { f as authMutationKeys, i as authQueryKeys, r as basePaths, c as createAuthPlugin, e as deepmerge, o as defaultAuthConfig, a as fileToBase64, h as getEmailProviderLink, _ as getProviderName, t as localization, u as parseAdditionalFieldValue, g as providerNames, s as resizeAvatar, d as resolveInputType, n as viewPaths };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type EmailProviderLink = {
|
|
2
|
+
/** Human-readable provider name, e.g. `"Gmail"` or `"GMX"`. */
|
|
3
|
+
companyProvider: string;
|
|
4
|
+
/** Direct URL to the provider's webmail login, e.g. `"https://mail.google.com/mail/"`. */
|
|
5
|
+
loginUrl: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the webmail login link for an email address from its domain.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the synchronous domain lookup of `@mikkelscheike/email-provider-links`
|
|
11
|
+
* but reads its bundled provider dataset directly so it stays browser-safe — the
|
|
12
|
+
* package's runtime depends on Node built-ins (`fs`/`dns`) and cannot be bundled
|
|
13
|
+
* for the client. Covers 130+ providers including niche ones like `gmx.de`.
|
|
14
|
+
*
|
|
15
|
+
* @param email - Full email address, e.g. `"jane@gmx.de"`.
|
|
16
|
+
* @returns The matching provider link, or `null` for unknown/custom domains.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getEmailProviderLink(email: string): EmailProviderLink | null;
|
|
@@ -4,10 +4,14 @@ export declare const localization: {
|
|
|
4
4
|
account: string;
|
|
5
5
|
/** @remarks `"Already have an account?"` */
|
|
6
6
|
alreadyHaveAnAccount: string;
|
|
7
|
+
/** @remarks `"Already verified your email?"` */
|
|
8
|
+
alreadyVerifiedYourEmail: string;
|
|
7
9
|
/** @remarks `"Confirm password"` */
|
|
8
10
|
confirmPassword: string;
|
|
9
11
|
/** @remarks `"Confirm your password"` */
|
|
10
12
|
confirmPasswordPlaceholder: string;
|
|
13
|
+
/** @remarks `"Check your email for a verification link"` */
|
|
14
|
+
checkYourEmail: string;
|
|
11
15
|
/** @remarks `"Continue with {{provider}}"` */
|
|
12
16
|
continueWith: string;
|
|
13
17
|
/** @remarks `"Email"` */
|
|
@@ -36,6 +40,8 @@ export declare const localization: {
|
|
|
36
40
|
newPassword: string;
|
|
37
41
|
/** @remarks `"Enter your new password"` */
|
|
38
42
|
newPasswordPlaceholder: string;
|
|
43
|
+
/** @remarks `"Open {{provider}}"` */
|
|
44
|
+
openEmailProvider: string;
|
|
39
45
|
/** @remarks `"OR"` */
|
|
40
46
|
or: string;
|
|
41
47
|
/** @remarks `"Password"` */
|
|
@@ -58,6 +64,8 @@ export declare const localization: {
|
|
|
58
64
|
rememberYourPassword: string;
|
|
59
65
|
/** @remarks `"Resend"` */
|
|
60
66
|
resend: string;
|
|
67
|
+
/** @remarks `"Resend in {{seconds}}s"` */
|
|
68
|
+
resendIn: string;
|
|
61
69
|
/** @remarks `"Reset Password"` */
|
|
62
70
|
resetPassword: string;
|
|
63
71
|
/** @remarks `"Send reset link"` */
|
|
@@ -72,8 +80,8 @@ export declare const localization: {
|
|
|
72
80
|
signUp: string;
|
|
73
81
|
/** @remarks `"Verification email sent!"` */
|
|
74
82
|
verificationEmailSent: string;
|
|
75
|
-
/** @remarks `"Verify
|
|
76
|
-
|
|
83
|
+
/** @remarks `"Verify Email"` */
|
|
84
|
+
verifyEmail: string;
|
|
77
85
|
};
|
|
78
86
|
settings: {
|
|
79
87
|
/** @remarks `"Account"` */
|
package/dist/lib/view-paths.d.ts
CHANGED
package/dist/plugins.js
CHANGED
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.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vite build",
|
|
@@ -25,10 +25,12 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@mikkelscheike/email-provider-links": "^5.1.8",
|
|
28
29
|
"better-auth": "^1.6.19",
|
|
29
30
|
"vitest": "^4.1.9"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
33
|
+
"@mikkelscheike/email-provider-links": ">=5.1.8",
|
|
32
34
|
"better-auth": ">=1.6.19"
|
|
33
35
|
},
|
|
34
36
|
"repository": {
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./lib/auth-query-keys"
|
|
|
5
5
|
export * from "./lib/base-paths"
|
|
6
6
|
export * from "./lib/create-auth-plugin"
|
|
7
7
|
export * from "./lib/deep-partial"
|
|
8
|
+
export * from "./lib/email-provider-links"
|
|
8
9
|
export * from "./lib/localization"
|
|
9
10
|
export * from "./lib/provider-names"
|
|
10
11
|
export * from "./lib/utils"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import emailProviderData from "@mikkelscheike/email-provider-links/providers/emailproviders.json"
|
|
2
|
+
|
|
3
|
+
type RawEmailProvider = {
|
|
4
|
+
companyProvider: string
|
|
5
|
+
loginUrl?: string | null
|
|
6
|
+
domains?: string[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type EmailProviderLink = {
|
|
10
|
+
/** Human-readable provider name, e.g. `"Gmail"` or `"GMX"`. */
|
|
11
|
+
companyProvider: string
|
|
12
|
+
/** Direct URL to the provider's webmail login, e.g. `"https://mail.google.com/mail/"`. */
|
|
13
|
+
loginUrl: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let domainMap: Map<string, EmailProviderLink> | undefined
|
|
17
|
+
|
|
18
|
+
function getDomainMap(): Map<string, EmailProviderLink> {
|
|
19
|
+
if (domainMap) return domainMap
|
|
20
|
+
|
|
21
|
+
domainMap = new Map()
|
|
22
|
+
|
|
23
|
+
const { providers } = emailProviderData as { providers: RawEmailProvider[] }
|
|
24
|
+
for (const provider of providers) {
|
|
25
|
+
if (!provider.loginUrl) continue
|
|
26
|
+
|
|
27
|
+
for (const domain of provider.domains ?? []) {
|
|
28
|
+
domainMap.set(domain.toLowerCase(), {
|
|
29
|
+
companyProvider: provider.companyProvider,
|
|
30
|
+
loginUrl: provider.loginUrl
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return domainMap
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the webmail login link for an email address from its domain.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors the synchronous domain lookup of `@mikkelscheike/email-provider-links`
|
|
42
|
+
* but reads its bundled provider dataset directly so it stays browser-safe — the
|
|
43
|
+
* package's runtime depends on Node built-ins (`fs`/`dns`) and cannot be bundled
|
|
44
|
+
* for the client. Covers 130+ providers including niche ones like `gmx.de`.
|
|
45
|
+
*
|
|
46
|
+
* @param email - Full email address, e.g. `"jane@gmx.de"`.
|
|
47
|
+
* @returns The matching provider link, or `null` for unknown/custom domains.
|
|
48
|
+
*/
|
|
49
|
+
export function getEmailProviderLink(email: string): EmailProviderLink | null {
|
|
50
|
+
const atIndex = email.lastIndexOf("@")
|
|
51
|
+
if (atIndex === -1) return null
|
|
52
|
+
|
|
53
|
+
const domain = email
|
|
54
|
+
.slice(atIndex + 1)
|
|
55
|
+
.trim()
|
|
56
|
+
.toLowerCase()
|
|
57
|
+
if (!domain) return null
|
|
58
|
+
|
|
59
|
+
return getDomainMap().get(domain) ?? null
|
|
60
|
+
}
|
package/src/lib/localization.ts
CHANGED
|
@@ -6,12 +6,18 @@ export const localization = {
|
|
|
6
6
|
/** @remarks `"Already have an account?"` */
|
|
7
7
|
alreadyHaveAnAccount: "Already have an account?",
|
|
8
8
|
|
|
9
|
+
/** @remarks `"Already verified your email?"` */
|
|
10
|
+
alreadyVerifiedYourEmail: "Already verified your email?",
|
|
11
|
+
|
|
9
12
|
/** @remarks `"Confirm password"` */
|
|
10
13
|
confirmPassword: "Confirm password",
|
|
11
14
|
|
|
12
15
|
/** @remarks `"Confirm your password"` */
|
|
13
16
|
confirmPasswordPlaceholder: "Confirm your password",
|
|
14
17
|
|
|
18
|
+
/** @remarks `"Check your email for a verification link"` */
|
|
19
|
+
checkYourEmail: "Check your email for a verification link",
|
|
20
|
+
|
|
15
21
|
/** @remarks `"Continue with {{provider}}"` */
|
|
16
22
|
continueWith: "Continue with {{provider}}",
|
|
17
23
|
|
|
@@ -54,6 +60,9 @@ export const localization = {
|
|
|
54
60
|
/** @remarks `"Enter your new password"` */
|
|
55
61
|
newPasswordPlaceholder: "Enter your new password",
|
|
56
62
|
|
|
63
|
+
/** @remarks `"Open {{provider}}"` */
|
|
64
|
+
openEmailProvider: "Open {{provider}}",
|
|
65
|
+
|
|
57
66
|
/** @remarks `"OR"` */
|
|
58
67
|
or: "OR",
|
|
59
68
|
|
|
@@ -87,6 +96,9 @@ export const localization = {
|
|
|
87
96
|
/** @remarks `"Resend"` */
|
|
88
97
|
resend: "Resend",
|
|
89
98
|
|
|
99
|
+
/** @remarks `"Resend in {{seconds}}s"` */
|
|
100
|
+
resendIn: "Resend in {{seconds}}s",
|
|
101
|
+
|
|
90
102
|
/** @remarks `"Reset Password"` */
|
|
91
103
|
resetPassword: "Reset Password",
|
|
92
104
|
|
|
@@ -108,8 +120,8 @@ export const localization = {
|
|
|
108
120
|
/** @remarks `"Verification email sent!"` */
|
|
109
121
|
verificationEmailSent: "Verification email sent!",
|
|
110
122
|
|
|
111
|
-
/** @remarks `"Verify
|
|
112
|
-
|
|
123
|
+
/** @remarks `"Verify Email"` */
|
|
124
|
+
verifyEmail: "Verify Email"
|
|
113
125
|
},
|
|
114
126
|
settings: {
|
|
115
127
|
/** @remarks `"Account"` */
|
package/src/lib/view-paths.ts
CHANGED
|
@@ -27,6 +27,11 @@ export interface AuthViewPaths {
|
|
|
27
27
|
* @default "sign-out"
|
|
28
28
|
*/
|
|
29
29
|
signOut: string
|
|
30
|
+
/**
|
|
31
|
+
* Path segment for the verify email view
|
|
32
|
+
* @default "verify-email"
|
|
33
|
+
*/
|
|
34
|
+
verifyEmail: string
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
@@ -61,7 +66,8 @@ export const viewPaths: ViewPaths = {
|
|
|
61
66
|
signUp: "sign-up",
|
|
62
67
|
forgotPassword: "forgot-password",
|
|
63
68
|
resetPassword: "reset-password",
|
|
64
|
-
signOut: "sign-out"
|
|
69
|
+
signOut: "sign-out",
|
|
70
|
+
verifyEmail: "verify-email"
|
|
65
71
|
},
|
|
66
72
|
settings: {
|
|
67
73
|
account: "account",
|