@better-auth-ui/react 1.6.1 → 1.6.2
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/components/auth/auth-provider.d.ts +4 -3
- package/dist/components/auth/auth-provider.js +24 -40
- package/dist/components/email/email-changed.d.ts +2 -2
- package/dist/components/email/email-changed.js +154 -68
- package/dist/components/email/email-localization.js +18 -23
- package/dist/components/email/email-styles.js +52 -77
- package/dist/components/email/email-verification.d.ts +2 -2
- package/dist/components/email/email-verification.js +138 -73
- package/dist/components/email/index.d.ts +9 -9
- package/dist/components/email/index.js +9 -9
- package/dist/components/email/magic-link.d.ts +2 -2
- package/dist/components/email/magic-link.js +139 -70
- package/dist/components/email/new-device.d.ts +2 -2
- package/dist/components/email/new-device.js +221 -88
- package/dist/components/email/otp-email.d.ts +2 -2
- package/dist/components/email/otp-email.js +127 -63
- package/dist/components/email/password-changed.d.ts +2 -2
- package/dist/components/email/password-changed.js +157 -74
- package/dist/components/email/reset-password.d.ts +2 -2
- package/dist/components/email/reset-password.js +138 -66
- package/dist/components/icons/apple.d.ts +1 -1
- package/dist/components/icons/apple.js +16 -9
- package/dist/components/icons/atlassian.d.ts +1 -1
- package/dist/components/icons/atlassian.js +38 -13
- package/dist/components/icons/cognito.d.ts +1 -1
- package/dist/components/icons/cognito.js +19 -9
- package/dist/components/icons/discord.d.ts +1 -1
- package/dist/components/icons/discord.js +16 -9
- package/dist/components/icons/dropbox.d.ts +1 -1
- package/dist/components/icons/dropbox.js +16 -9
- package/dist/components/icons/facebook.d.ts +1 -1
- package/dist/components/icons/facebook.js +19 -11
- package/dist/components/icons/figma.d.ts +1 -1
- package/dist/components/icons/figma.js +34 -12
- package/dist/components/icons/github.d.ts +1 -1
- package/dist/components/icons/github.js +16 -11
- package/dist/components/icons/gitlab.d.ts +1 -1
- package/dist/components/icons/gitlab.js +30 -9
- package/dist/components/icons/google.d.ts +1 -1
- package/dist/components/icons/google.js +39 -9
- package/dist/components/icons/huggingface.d.ts +1 -1
- package/dist/components/icons/huggingface.js +38 -9
- package/dist/components/icons/index.d.ts +35 -35
- package/dist/components/icons/index.js +35 -35
- package/dist/components/icons/kakao.d.ts +1 -1
- package/dist/components/icons/kakao.js +16 -11
- package/dist/components/icons/kick.d.ts +1 -1
- package/dist/components/icons/kick.js +20 -11
- package/dist/components/icons/line.d.ts +1 -1
- package/dist/components/icons/line.js +16 -9
- package/dist/components/icons/linear.d.ts +1 -1
- package/dist/components/icons/linear.js +16 -9
- package/dist/components/icons/linkedin.d.ts +1 -1
- package/dist/components/icons/linkedin.js +33 -9
- package/dist/components/icons/microsoft.d.ts +1 -1
- package/dist/components/icons/microsoft.js +30 -9
- package/dist/components/icons/naver.d.ts +1 -1
- package/dist/components/icons/naver.js +16 -9
- package/dist/components/icons/notion.d.ts +1 -1
- package/dist/components/icons/notion.js +16 -9
- package/dist/components/icons/paybin.d.ts +1 -1
- package/dist/components/icons/paybin.js +32 -8
- package/dist/components/icons/paypal.d.ts +1 -1
- package/dist/components/icons/paypal.js +30 -9
- package/dist/components/icons/polar.d.ts +1 -1
- package/dist/components/icons/polar.js +24 -9
- package/dist/components/icons/railway.d.ts +1 -1
- package/dist/components/icons/railway.js +16 -9
- package/dist/components/icons/reddit.d.ts +1 -1
- package/dist/components/icons/reddit.js +21 -9
- package/dist/components/icons/roblox.d.ts +1 -1
- package/dist/components/icons/roblox.js +17 -12
- package/dist/components/icons/salesforce.d.ts +1 -1
- package/dist/components/icons/salesforce.js +16 -9
- package/dist/components/icons/slack.d.ts +1 -1
- package/dist/components/icons/slack.js +30 -9
- package/dist/components/icons/spotify.d.ts +1 -1
- package/dist/components/icons/spotify.js +16 -9
- package/dist/components/icons/tiktok.d.ts +1 -1
- package/dist/components/icons/tiktok.js +23 -10
- package/dist/components/icons/twitch.d.ts +1 -1
- package/dist/components/icons/twitch.js +43 -12
- package/dist/components/icons/vercel.d.ts +1 -1
- package/dist/components/icons/vercel.js +16 -9
- package/dist/components/icons/vk.d.ts +1 -1
- package/dist/components/icons/vk.js +16 -9
- package/dist/components/icons/wechat.d.ts +1 -1
- package/dist/components/icons/wechat.js +16 -9
- package/dist/components/icons/x.d.ts +1 -1
- package/dist/components/icons/x.js +16 -9
- package/dist/components/icons/zoom.d.ts +1 -1
- package/dist/components/icons/zoom.js +69 -11
- package/dist/components/settings/account/theme-preview.js +286 -7
- package/dist/core.d.ts +1 -1
- package/dist/hooks/auth/use-auth-mutation.d.ts +2 -2
- package/dist/hooks/auth/use-auth-mutation.js +12 -9
- package/dist/hooks/auth/use-auth-query.d.ts +3 -3
- package/dist/hooks/auth/use-auth-query.js +12 -9
- package/dist/hooks/auth/use-authenticate.d.ts +2 -2
- package/dist/hooks/auth/use-authenticate.js +22 -27
- package/dist/hooks/auth/use-is-username-available.d.ts +19 -0
- package/dist/hooks/auth/use-is-username-available.js +12 -0
- package/dist/hooks/auth/use-request-password-reset.d.ts +5 -6
- package/dist/hooks/auth/use-request-password-reset.js +11 -13
- package/dist/hooks/auth/use-reset-password.d.ts +8 -9
- package/dist/hooks/auth/use-reset-password.js +11 -12
- package/dist/hooks/auth/use-send-verification-email.d.ts +5 -6
- package/dist/hooks/auth/use-send-verification-email.js +11 -12
- package/dist/hooks/auth/use-session.d.ts +2 -2
- package/dist/hooks/auth/use-session.js +14 -17
- package/dist/hooks/auth/use-sign-in-email.d.ts +6 -7
- package/dist/hooks/auth/use-sign-in-email.js +17 -24
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +5 -6
- package/dist/hooks/auth/use-sign-in-magic-link.js +11 -12
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +14 -14
- package/dist/hooks/auth/use-sign-in-passkey.js +17 -24
- package/dist/hooks/auth/use-sign-in-social.d.ts +8 -9
- package/dist/hooks/auth/use-sign-in-social.js +11 -12
- package/dist/hooks/auth/use-sign-in-username.d.ts +53 -0
- package/dist/hooks/auth/use-sign-in-username.js +18 -0
- package/dist/hooks/auth/use-sign-out.d.ts +4 -5
- package/dist/hooks/auth/use-sign-out.js +17 -23
- package/dist/hooks/auth/use-sign-up-email.d.ts +166 -167
- package/dist/hooks/auth/use-sign-up-email.js +17 -24
- package/dist/hooks/auth/use-user.d.ts +58 -58
- package/dist/hooks/auth/use-user.js +10 -13
- package/dist/hooks/settings/use-account-info.d.ts +5 -5
- package/dist/hooks/settings/use-account-info.js +20 -24
- package/dist/hooks/settings/use-add-passkey.d.ts +10 -10
- package/dist/hooks/settings/use-add-passkey.js +17 -23
- package/dist/hooks/settings/use-change-email.d.ts +5 -5
- package/dist/hooks/settings/use-change-email.js +17 -22
- package/dist/hooks/settings/use-change-password.d.ts +6 -7
- package/dist/hooks/settings/use-change-password.js +11 -10
- package/dist/hooks/settings/use-delete-passkey.d.ts +5 -5
- package/dist/hooks/settings/use-delete-passkey.js +17 -23
- package/dist/hooks/settings/use-delete-user.d.ts +8 -9
- package/dist/hooks/settings/use-delete-user.js +11 -10
- package/dist/hooks/settings/use-link-social.d.ts +5 -5
- package/dist/hooks/settings/use-link-social.js +11 -9
- package/dist/hooks/settings/use-list-accounts.d.ts +4 -4
- package/dist/hooks/settings/use-list-accounts.js +20 -22
- package/dist/hooks/settings/use-list-device-sessions.d.ts +2 -2
- package/dist/hooks/settings/use-list-device-sessions.js +20 -21
- package/dist/hooks/settings/use-list-sessions.d.ts +4 -4
- package/dist/hooks/settings/use-list-sessions.js +20 -21
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +3 -3
- package/dist/hooks/settings/use-list-user-passkeys.js +20 -21
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +5 -5
- package/dist/hooks/settings/use-revoke-multi-session.js +17 -19
- package/dist/hooks/settings/use-revoke-session.d.ts +5 -5
- package/dist/hooks/settings/use-revoke-session.js +17 -20
- package/dist/hooks/settings/use-set-active-session.d.ts +5 -5
- package/dist/hooks/settings/use-set-active-session.js +20 -27
- package/dist/hooks/settings/use-unlink-account.d.ts +5 -5
- package/dist/hooks/settings/use-unlink-account.js +17 -20
- package/dist/hooks/settings/use-update-user.d.ts +2 -2
- package/dist/hooks/settings/use-update-user.js +24 -28
- package/dist/index.d.ts +40 -36
- package/dist/index.js +84 -36
- package/dist/lib/auth-client.d.ts +1254 -1254
- package/dist/lib/auth-client.js +11 -11
- package/dist/lib/auth-config.d.ts +3 -3
- package/dist/lib/auth-context.d.ts +2 -2
- package/dist/lib/auth-context.js +5 -2
- package/dist/lib/provider-icons.d.ts +2 -2
- package/dist/lib/provider-icons.js +75 -47
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +7 -4
- package/package.json +11 -11
- package/src/components/auth/auth-provider.tsx +4 -6
- package/src/hooks/auth/use-authenticate.ts +3 -1
- package/src/hooks/auth/use-is-username-available.ts +22 -0
- package/src/hooks/auth/use-request-password-reset.ts +4 -6
- package/src/hooks/auth/use-reset-password.ts +4 -6
- package/src/hooks/auth/use-send-verification-email.ts +4 -6
- package/src/hooks/auth/use-session.ts +2 -1
- package/src/hooks/auth/use-sign-in-email.ts +6 -8
- package/src/hooks/auth/use-sign-in-magic-link.ts +4 -6
- package/src/hooks/auth/use-sign-in-social.ts +4 -6
- package/src/hooks/auth/use-sign-in-username.ts +34 -0
- package/src/hooks/auth/use-sign-out.ts +6 -7
- package/src/hooks/auth/use-sign-up-email.ts +6 -8
- package/src/hooks/auth/use-user.ts +1 -2
- package/src/hooks/settings/use-account-info.ts +2 -1
- package/src/hooks/settings/use-change-email.ts +6 -6
- package/src/hooks/settings/use-change-password.ts +4 -6
- package/src/hooks/settings/use-delete-user.ts +4 -6
- package/src/hooks/settings/use-link-social.ts +4 -4
- package/src/hooks/settings/use-list-accounts.ts +3 -1
- package/src/hooks/settings/use-list-device-sessions.ts +3 -1
- package/src/hooks/settings/use-list-sessions.ts +3 -1
- package/src/hooks/settings/use-list-user-passkeys.ts +3 -1
- package/src/hooks/settings/use-revoke-multi-session.ts +6 -6
- package/src/hooks/settings/use-revoke-session.ts +4 -5
- package/src/hooks/settings/use-set-active-session.ts +9 -8
- package/src/hooks/settings/use-unlink-account.ts +4 -5
- package/src/hooks/settings/use-update-user.ts +8 -9
- package/src/index.ts +4 -0
- package/src/lib/auth-config.ts +1 -1
- package/dist/lib/auth-config.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { AnyAuthClient } from '../../lib/auth-client';
|
|
4
|
+
import { AnyAuthConfig, AuthConfig } from '../../lib/auth-config';
|
|
4
5
|
export type AuthProviderProps = PropsWithChildren<AnyAuthConfig> & {
|
|
5
6
|
authClient: AnyAuthClient;
|
|
6
7
|
navigate: (options: {
|
|
@@ -1,44 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { deepmerge, defaultAuthConfig } from "@better-auth-ui/core";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { AuthContext as e } from "../../lib/auth-context.js";
|
|
3
|
+
import { deepmerge as t, defaultAuthConfig as n } from "@better-auth-ui/core";
|
|
4
|
+
import { QueryClient as r, QueryClientContext as i, QueryClientProvider as a } from "@tanstack/react-query";
|
|
5
|
+
import { useContext as o } from "react";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/auth/auth-provider.tsx
|
|
8
|
+
var c = new r(), l = {
|
|
9
|
+
...n,
|
|
10
|
+
Link: (e) => /* @__PURE__ */ s("a", { ...e })
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
export function AuthProvider({ children, queryClient, ...config }) {
|
|
23
|
-
const contextQueryClient = useContext(QueryClientContext);
|
|
24
|
-
const resolvedQueryClient = queryClient || contextQueryClient || fallbackQueryClient;
|
|
25
|
-
const mergedConfig = deepmerge(baseAuthConfig, config);
|
|
26
|
-
mergedConfig.redirectTo =
|
|
27
|
-
(typeof window !== "undefined" &&
|
|
28
|
-
new URLSearchParams(window.location.search).get("redirectTo")?.trim()) ||
|
|
29
|
-
mergedConfig.redirectTo;
|
|
30
|
-
return (_jsx(AuthContext.Provider, { value: mergedConfig, children: _jsx(QueryClientProvider, { client: resolvedQueryClient, children: children }) }));
|
|
12
|
+
function u({ children: n, queryClient: r, ...u }) {
|
|
13
|
+
let d = o(i), f = r || d || c, p = t(l, u);
|
|
14
|
+
return p.redirectTo = typeof window < "u" && new URLSearchParams(window.location.search).get("redirectTo")?.trim() || p.redirectTo, /* @__PURE__ */ s(e.Provider, {
|
|
15
|
+
value: p,
|
|
16
|
+
children: /* @__PURE__ */ s(a, {
|
|
17
|
+
client: f,
|
|
18
|
+
children: n
|
|
19
|
+
})
|
|
20
|
+
});
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @throws If no AuthProvider is present in the component tree.
|
|
37
|
-
*/
|
|
38
|
-
export function useAuth() {
|
|
39
|
-
const context = useContext(AuthContext);
|
|
40
|
-
if (!context) {
|
|
41
|
-
throw new Error("[Better Auth UI] AuthProvider is required");
|
|
42
|
-
}
|
|
43
|
-
return context;
|
|
22
|
+
function d() {
|
|
23
|
+
let t = o(e);
|
|
24
|
+
if (!t) throw Error("[Better Auth UI] AuthProvider is required");
|
|
25
|
+
return t;
|
|
44
26
|
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { u as AuthProvider, d as useAuth };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EmailClassNames, EmailColors } from './email-styles';
|
|
3
3
|
declare const emailChangedEmailLocalization: {
|
|
4
4
|
YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: string;
|
|
5
5
|
LOGO: string;
|
|
@@ -1,70 +1,156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import t from "./email-styles.js";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { Body as a, Button as o, Container as s, Head as c, Heading as l, Hr as u, Html as d, Img as f, Link as p, Preview as m, Section as h, Tailwind as g, Text as _, pixelBasedPreset as v } from "@react-email/components";
|
|
5
|
+
//#region src/components/email/email-changed.tsx
|
|
6
|
+
var y = {
|
|
7
|
+
YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: "Your email address has been changed",
|
|
8
|
+
LOGO: "Logo",
|
|
9
|
+
EMAIL_ADDRESS_CHANGED: "Email address changed",
|
|
10
|
+
EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED: "The email address for your {appName} account has been changed.",
|
|
11
|
+
PREVIOUS_EMAIL: "Previous email:",
|
|
12
|
+
NEW_EMAIL: "New email:",
|
|
13
|
+
IF_YOU_MADE_THIS_CHANGE: "If you made this change, you can safely ignore this email.",
|
|
14
|
+
I_DIDNT_MAKE_THIS_CHANGE: "I didn't make this change",
|
|
15
|
+
EMAIL_SENT_BY: "Email sent by {appName}.",
|
|
16
|
+
IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE: "If you didn't authorize this change, please contact support immediately {supportEmail} to secure your account.",
|
|
17
|
+
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
18
|
+
}, b = ({ oldEmail: y, newEmail: x, revertURL: S, appName: C, supportEmail: w, logoURL: T, colors: E, classNames: D, darkMode: O = !0, poweredBy: k, head: A, ...j }) => {
|
|
19
|
+
let M = {
|
|
20
|
+
...b.localization,
|
|
21
|
+
...j.localization
|
|
22
|
+
}, N = M.YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED;
|
|
23
|
+
return /* @__PURE__ */ i(d, { children: [
|
|
24
|
+
/* @__PURE__ */ i(c, { children: [
|
|
25
|
+
/* @__PURE__ */ r("meta", {
|
|
26
|
+
content: "light dark",
|
|
27
|
+
name: "color-scheme"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ r("meta", {
|
|
30
|
+
content: "light dark",
|
|
31
|
+
name: "supported-color-schemes"
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ r(t, {
|
|
34
|
+
colors: E,
|
|
35
|
+
darkMode: O
|
|
36
|
+
}),
|
|
37
|
+
A
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ r(m, { children: N }),
|
|
40
|
+
/* @__PURE__ */ r(g, {
|
|
41
|
+
config: { presets: [v] },
|
|
42
|
+
children: /* @__PURE__ */ r(a, {
|
|
43
|
+
className: e("bg-background font-sans", D?.body),
|
|
44
|
+
children: /* @__PURE__ */ r(s, {
|
|
45
|
+
className: e("mx-auto my-auto max-w-xl px-2 py-10", D?.container),
|
|
46
|
+
children: /* @__PURE__ */ i(h, {
|
|
47
|
+
className: e("bg-card text-card-foreground rounded-none border border-border p-8", D?.card),
|
|
48
|
+
children: [
|
|
49
|
+
T && (typeof T == "string" ? /* @__PURE__ */ r(f, {
|
|
50
|
+
src: T,
|
|
51
|
+
width: 48,
|
|
52
|
+
height: 48,
|
|
53
|
+
alt: C || M.LOGO,
|
|
54
|
+
className: e("mx-auto mb-8", D?.logo)
|
|
55
|
+
}) : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(f, {
|
|
56
|
+
src: T.light,
|
|
57
|
+
width: 48,
|
|
58
|
+
height: 48,
|
|
59
|
+
alt: C || M.LOGO,
|
|
60
|
+
className: e("mx-auto mb-8 logo-light", D?.logo)
|
|
61
|
+
}), /* @__PURE__ */ r(f, {
|
|
62
|
+
src: T.dark,
|
|
63
|
+
width: 48,
|
|
64
|
+
height: 48,
|
|
65
|
+
alt: C || M.LOGO,
|
|
66
|
+
className: e("hidden mx-auto mb-8 logo-dark", D?.logo)
|
|
67
|
+
})] })),
|
|
68
|
+
/* @__PURE__ */ r(l, {
|
|
69
|
+
className: e("m-0 mb-5 text-2xl font-semibold", D?.title),
|
|
70
|
+
children: M.EMAIL_ADDRESS_CHANGED
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ r(_, {
|
|
73
|
+
className: e("text-sm font-normal", D?.content),
|
|
74
|
+
children: M.EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED.replace("{appName}", C || "").replace(/\s{2,}/g, " ").replace(" .", ".")
|
|
75
|
+
}),
|
|
76
|
+
(y || x) && /* @__PURE__ */ i(h, {
|
|
77
|
+
className: e("my-6 border border-border bg-muted p-4", D?.codeBlock),
|
|
78
|
+
children: [y && /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(_, {
|
|
79
|
+
className: e("m-0 mb-2 text-xs text-muted-foreground", D?.description),
|
|
80
|
+
children: M.PREVIOUS_EMAIL
|
|
81
|
+
}), /* @__PURE__ */ r(_, {
|
|
82
|
+
className: e("m-0 mb-4 text-sm font-semibold", D?.content),
|
|
83
|
+
children: y
|
|
84
|
+
})] }), x && /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(_, {
|
|
85
|
+
className: e("m-0 mb-2 text-xs text-muted-foreground", D?.description),
|
|
86
|
+
children: M.NEW_EMAIL
|
|
87
|
+
}), /* @__PURE__ */ r(_, {
|
|
88
|
+
className: e("m-0 text-sm font-semibold text-primary", D?.content),
|
|
89
|
+
children: x
|
|
90
|
+
})] })]
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ r(_, {
|
|
93
|
+
className: e("text-sm font-normal", D?.content),
|
|
94
|
+
children: M.IF_YOU_MADE_THIS_CHANGE
|
|
95
|
+
}),
|
|
96
|
+
S && /* @__PURE__ */ r(h, {
|
|
97
|
+
className: "my-6",
|
|
98
|
+
children: /* @__PURE__ */ r(o, {
|
|
99
|
+
href: S,
|
|
100
|
+
className: e("inline-block whitespace-nowrap rounded-none text-sm font-medium py-2.5 px-6 bg-primary text-primary-foreground no-underline", D?.button),
|
|
101
|
+
children: M.I_DIDNT_MAKE_THIS_CHANGE
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ r(u, { className: e("my-6 w-full border border-solid border-border", D?.separator) }),
|
|
105
|
+
C && /* @__PURE__ */ r(_, {
|
|
106
|
+
className: e("mb-3 text-xs text-muted-foreground", D?.description),
|
|
107
|
+
children: M.EMAIL_SENT_BY.replace("{appName}", C)
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ r(_, {
|
|
110
|
+
className: e("mt-3 text-xs text-muted-foreground", D?.description),
|
|
111
|
+
children: (() => {
|
|
112
|
+
let [t, a] = M.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.split("{supportEmail}");
|
|
113
|
+
return w ? /* @__PURE__ */ i(n, { children: [
|
|
114
|
+
t,
|
|
115
|
+
/* @__PURE__ */ r(p, {
|
|
116
|
+
href: `mailto:${w}`,
|
|
117
|
+
className: e("text-primary underline", D?.link),
|
|
118
|
+
children: w
|
|
119
|
+
}),
|
|
120
|
+
a
|
|
121
|
+
] }) : M.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.replace("{supportEmail}", "").replace(/\s{2,}/g, " ").replace(" .", ".");
|
|
122
|
+
})()
|
|
123
|
+
}),
|
|
124
|
+
k && /* @__PURE__ */ r(_, {
|
|
125
|
+
className: e("mt-4 mb-0 text-center text-[11px] text-muted-foreground", D?.poweredBy),
|
|
126
|
+
children: (() => {
|
|
127
|
+
let [t, a] = M.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
128
|
+
return /* @__PURE__ */ i(n, { children: [
|
|
129
|
+
t,
|
|
130
|
+
/* @__PURE__ */ r(p, {
|
|
131
|
+
href: "https://better-auth.com",
|
|
132
|
+
className: e("text-primary underline", D?.link),
|
|
133
|
+
children: "better-auth"
|
|
134
|
+
}),
|
|
135
|
+
a
|
|
136
|
+
] });
|
|
137
|
+
})()
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
] });
|
|
17
145
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* - Support for light/dark mode themes
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```tsx
|
|
30
|
-
* <EmailChangedEmail
|
|
31
|
-
* oldEmail="old@example.com"
|
|
32
|
-
* newEmail="new@example.com"
|
|
33
|
-
* revertURL="https://example.com/revert?token=abc123"
|
|
34
|
-
* appName="My App"
|
|
35
|
-
* supportEmail="support@example.com"
|
|
36
|
-
* logoURL="https://example.com/logo.png"
|
|
37
|
-
* darkMode={true}
|
|
38
|
-
* />
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export const EmailChangedEmail = ({ oldEmail, newEmail, revertURL, appName, supportEmail, logoURL, colors, classNames, darkMode = true, poweredBy, head, ...props }) => {
|
|
42
|
-
const localization = {
|
|
43
|
-
...EmailChangedEmail.localization,
|
|
44
|
-
...props.localization
|
|
45
|
-
};
|
|
46
|
-
const previewText = localization.YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED;
|
|
47
|
-
return (_jsxs(Html, { children: [_jsxs(Head, { children: [_jsx("meta", { content: "light dark", name: "color-scheme" }), _jsx("meta", { content: "light dark", name: "supported-color-schemes" }), _jsx(EmailStyles, { colors: colors, darkMode: darkMode }), head] }), _jsx(Preview, { children: previewText }), _jsx(Tailwind, { config: { presets: [pixelBasedPreset] }, children: _jsx(Body, { className: cn("bg-background font-sans", classNames?.body), children: _jsx(Container, { className: cn("mx-auto my-auto max-w-xl px-2 py-10", classNames?.container), children: _jsxs(Section, { className: cn("bg-card text-card-foreground rounded-none border border-border p-8", classNames?.card), children: [logoURL &&
|
|
48
|
-
(typeof logoURL === "string" ? (_jsx(Img, { src: logoURL, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8", classNames?.logo) })) : (_jsxs(_Fragment, { children: [_jsx(Img, { src: logoURL.light, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8 logo-light", classNames?.logo) }), _jsx(Img, { src: logoURL.dark, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("hidden mx-auto mb-8 logo-dark", classNames?.logo) })] }))), _jsx(Heading, { className: cn("m-0 mb-5 text-2xl font-semibold", classNames?.title), children: localization.EMAIL_ADDRESS_CHANGED }), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: localization.EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED.replace("{appName}", appName || "")
|
|
49
|
-
.replace(/\s{2,}/g, " ")
|
|
50
|
-
.replace(" .", ".") }), (oldEmail || newEmail) && (_jsxs(Section, { className: cn("my-6 border border-border bg-muted p-4", classNames?.codeBlock), children: [oldEmail && (_jsxs(_Fragment, { children: [_jsx(Text, { className: cn("m-0 mb-2 text-xs text-muted-foreground", classNames?.description), children: localization.PREVIOUS_EMAIL }), _jsx(Text, { className: cn("m-0 mb-4 text-sm font-semibold", classNames?.content), children: oldEmail })] })), newEmail && (_jsxs(_Fragment, { children: [_jsx(Text, { className: cn("m-0 mb-2 text-xs text-muted-foreground", classNames?.description), children: localization.NEW_EMAIL }), _jsx(Text, { className: cn("m-0 text-sm font-semibold text-primary", classNames?.content), children: newEmail })] }))] })), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: localization.IF_YOU_MADE_THIS_CHANGE }), revertURL && (_jsx(Section, { className: "my-6", children: _jsx(Button, { href: revertURL, className: cn("inline-block whitespace-nowrap rounded-none text-sm font-medium py-2.5 px-6 bg-primary text-primary-foreground no-underline", classNames?.button), children: localization.I_DIDNT_MAKE_THIS_CHANGE }) })), _jsx(Hr, { className: cn("my-6 w-full border border-solid border-border", classNames?.separator) }), appName && (_jsx(Text, { className: cn("mb-3 text-xs text-muted-foreground", classNames?.description), children: localization.EMAIL_SENT_BY.replace("{appName}", appName) })), _jsx(Text, { className: cn("mt-3 text-xs text-muted-foreground", classNames?.description), children: (() => {
|
|
51
|
-
const [beforeSupportEmail, afterSupportEmail] = localization.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.split("{supportEmail}");
|
|
52
|
-
return supportEmail ? (_jsxs(_Fragment, { children: [beforeSupportEmail, _jsx(Link, { href: `mailto:${supportEmail}`, className: cn("text-primary underline", classNames?.link), children: supportEmail }), afterSupportEmail] })) : (localization.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.replace("{supportEmail}", "")
|
|
53
|
-
.replace(/\s{2,}/g, " ")
|
|
54
|
-
.replace(" .", "."));
|
|
55
|
-
})() }), poweredBy && (_jsx(Text, { className: cn("mt-4 mb-0 text-center text-[11px] text-muted-foreground", classNames?.poweredBy), children: (() => {
|
|
56
|
-
const [beforeBetterAuth, afterBetterAuth] = localization.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
57
|
-
return (_jsxs(_Fragment, { children: [beforeBetterAuth, _jsx(Link, { href: "https://better-auth.com", className: cn("text-primary underline", classNames?.link), children: "better-auth" }), afterBetterAuth] }));
|
|
58
|
-
})() }))] }) }) }) })] }));
|
|
146
|
+
b.localization = y, b.PreviewProps = {
|
|
147
|
+
oldEmail: "old@example.com",
|
|
148
|
+
newEmail: "new@example.com",
|
|
149
|
+
supportEmail: "support@example.com",
|
|
150
|
+
revertURL: "https://better-auth-ui.com/auth/revert-email?token=example-token",
|
|
151
|
+
appName: "Better Auth",
|
|
152
|
+
poweredBy: !0,
|
|
153
|
+
darkMode: !0
|
|
59
154
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
oldEmail: "old@example.com",
|
|
63
|
-
newEmail: "new@example.com",
|
|
64
|
-
supportEmail: "support@example.com",
|
|
65
|
-
revertURL: "https://better-auth-ui.com/auth/revert-email?token=example-token",
|
|
66
|
-
appName: "Better Auth",
|
|
67
|
-
poweredBy: true,
|
|
68
|
-
darkMode: true
|
|
69
|
-
};
|
|
70
|
-
export default EmailChangedEmail;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { b as default };
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...EmailChangedEmail.localization,
|
|
18
|
-
...EmailVerificationEmail.localization,
|
|
19
|
-
...MagicLinkEmail.localization,
|
|
20
|
-
...NewDeviceEmail.localization,
|
|
21
|
-
...OtpEmail.localization,
|
|
22
|
-
...PasswordChangedEmail.localization,
|
|
23
|
-
...ResetPasswordEmail.localization
|
|
1
|
+
import e from "./email-changed.js";
|
|
2
|
+
import t from "./email-verification.js";
|
|
3
|
+
import n from "./magic-link.js";
|
|
4
|
+
import r from "./new-device.js";
|
|
5
|
+
import i from "./otp-email.js";
|
|
6
|
+
import a from "./password-changed.js";
|
|
7
|
+
import o from "./reset-password.js";
|
|
8
|
+
//#region src/components/email/email-localization.tsx
|
|
9
|
+
var s = {
|
|
10
|
+
...e.localization,
|
|
11
|
+
...t.localization,
|
|
12
|
+
...n.localization,
|
|
13
|
+
...r.localization,
|
|
14
|
+
...i.localization,
|
|
15
|
+
...a.localization,
|
|
16
|
+
...o.localization
|
|
24
17
|
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { s as emailLocalization };
|
|
@@ -1,81 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Component that injects CSS styles for email templates with support for light and dark modes.
|
|
33
|
-
*
|
|
34
|
-
* Generates inline styles that adapt to the user's color scheme preference and applies
|
|
35
|
-
* custom colors if provided. Handles logo visibility switching between light and dark modes.
|
|
36
|
-
*
|
|
37
|
-
* @param props - Style configuration options
|
|
38
|
-
* @returns A style element containing CSS for email template theming
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* <EmailStyles
|
|
43
|
-
* colors={{
|
|
44
|
-
* light: { primary: "#000000" },
|
|
45
|
-
* dark: { primary: "#FFFFFF" }
|
|
46
|
-
* }}
|
|
47
|
-
* darkMode={true}
|
|
48
|
-
* />
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export const EmailStyles = ({ colors, darkMode = true }) => {
|
|
52
|
-
return (_jsx("style", { type: "text/css", children: `
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/email/email-styles.tsx
|
|
3
|
+
var t = {
|
|
4
|
+
light: {
|
|
5
|
+
background: "#F5F5F5",
|
|
6
|
+
border: "#E5E5E5",
|
|
7
|
+
card: "#FFFFFF",
|
|
8
|
+
cardForeground: "#0A0A0A",
|
|
9
|
+
foreground: "#262626",
|
|
10
|
+
muted: "#F5F5F5",
|
|
11
|
+
mutedForeground: "#737373",
|
|
12
|
+
primary: "#171717",
|
|
13
|
+
primaryForeground: "#FAFAFA"
|
|
14
|
+
},
|
|
15
|
+
dark: {
|
|
16
|
+
background: "#0A0A0A",
|
|
17
|
+
border: "#2E2E2E",
|
|
18
|
+
card: "#171717",
|
|
19
|
+
cardForeground: "#FAFAFA",
|
|
20
|
+
foreground: "#D4D4D4",
|
|
21
|
+
muted: "#212121",
|
|
22
|
+
mutedForeground: "#A1A1A1",
|
|
23
|
+
primary: "#E5E5E5",
|
|
24
|
+
primaryForeground: "#171717"
|
|
25
|
+
}
|
|
26
|
+
}, n = ({ colors: n, darkMode: r = !0 }) => /* @__PURE__ */ e("style", {
|
|
27
|
+
type: "text/css",
|
|
28
|
+
children: `
|
|
53
29
|
.bg-background {
|
|
54
|
-
background-color: ${
|
|
30
|
+
background-color: ${n?.light?.background || t.light.background} !important;
|
|
55
31
|
}
|
|
56
32
|
.bg-card {
|
|
57
|
-
background-color: ${
|
|
33
|
+
background-color: ${n?.light?.card || t.light.card} !important;
|
|
58
34
|
}
|
|
59
35
|
.bg-primary {
|
|
60
|
-
background-color: ${
|
|
36
|
+
background-color: ${n?.light?.primary || t.light.primary} !important;
|
|
61
37
|
}
|
|
62
38
|
.bg-muted {
|
|
63
|
-
background-color: ${
|
|
39
|
+
background-color: ${n?.light?.muted || t.light.muted} !important;
|
|
64
40
|
}
|
|
65
41
|
.border-border {
|
|
66
|
-
border-color: ${
|
|
42
|
+
border-color: ${n?.light?.border || t.light.border} !important;
|
|
67
43
|
}
|
|
68
44
|
.text-card-foreground {
|
|
69
|
-
color: ${
|
|
45
|
+
color: ${n?.light?.cardForeground || t.light.cardForeground} !important;
|
|
70
46
|
}
|
|
71
47
|
.text-muted-foreground {
|
|
72
|
-
color: ${
|
|
48
|
+
color: ${n?.light?.mutedForeground || t.light.mutedForeground} !important;
|
|
73
49
|
}
|
|
74
50
|
.text-primary {
|
|
75
|
-
color: ${
|
|
51
|
+
color: ${n?.light?.primary || t.light.primary} !important;
|
|
76
52
|
}
|
|
77
53
|
.text-primary-foreground {
|
|
78
|
-
color: ${
|
|
54
|
+
color: ${n?.light?.primaryForeground || t.light.primaryForeground} !important;
|
|
79
55
|
}
|
|
80
56
|
.logo-dark {
|
|
81
57
|
display: none !important;
|
|
@@ -84,34 +60,33 @@ export const EmailStyles = ({ colors, darkMode = true }) => {
|
|
|
84
60
|
display: block !important;
|
|
85
61
|
}
|
|
86
62
|
|
|
87
|
-
${
|
|
88
|
-
? `@media (prefers-color-scheme: dark) {
|
|
63
|
+
${r ? `@media (prefers-color-scheme: dark) {
|
|
89
64
|
.bg-background {
|
|
90
|
-
background-color: ${
|
|
65
|
+
background-color: ${n?.dark?.background || t.dark.background} !important;
|
|
91
66
|
}
|
|
92
67
|
.bg-card {
|
|
93
|
-
background-color: ${
|
|
68
|
+
background-color: ${n?.dark?.card || t.dark.card} !important;
|
|
94
69
|
}
|
|
95
70
|
.bg-primary {
|
|
96
|
-
background-color: ${
|
|
71
|
+
background-color: ${n?.dark?.primary || t.dark.primary} !important;
|
|
97
72
|
}
|
|
98
73
|
.bg-muted {
|
|
99
|
-
background-color: ${
|
|
74
|
+
background-color: ${n?.dark?.muted || t.dark.muted} !important;
|
|
100
75
|
}
|
|
101
76
|
.border-border {
|
|
102
|
-
border-color: ${
|
|
77
|
+
border-color: ${n?.dark?.border || t.dark.border} !important;
|
|
103
78
|
}
|
|
104
79
|
.text-card-foreground {
|
|
105
|
-
color: ${
|
|
80
|
+
color: ${n?.dark?.cardForeground || t.dark.cardForeground} !important;
|
|
106
81
|
}
|
|
107
82
|
.text-muted-foreground {
|
|
108
|
-
color: ${
|
|
83
|
+
color: ${n?.dark?.mutedForeground || t.dark.mutedForeground} !important;
|
|
109
84
|
}
|
|
110
85
|
.text-primary {
|
|
111
|
-
color: ${
|
|
86
|
+
color: ${n?.dark?.primary || t.dark.primary} !important;
|
|
112
87
|
}
|
|
113
88
|
.text-primary-foreground {
|
|
114
|
-
color: ${
|
|
89
|
+
color: ${n?.dark?.primaryForeground || t.dark.primaryForeground} !important;
|
|
115
90
|
}
|
|
116
91
|
.logo-dark {
|
|
117
92
|
display: block !important;
|
|
@@ -122,8 +97,8 @@ export const EmailStyles = ({ colors, darkMode = true }) => {
|
|
|
122
97
|
* {
|
|
123
98
|
box-shadow: none !important;
|
|
124
99
|
}
|
|
125
|
-
}`
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export default
|
|
100
|
+
}` : ""}
|
|
101
|
+
`
|
|
102
|
+
});
|
|
103
|
+
//#endregion
|
|
104
|
+
export { n as default, t as defaultColors };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EmailClassNames, EmailColors } from './email-styles';
|
|
3
3
|
declare const emailVerificationEmailLocalization: {
|
|
4
4
|
VERIFY_YOUR_EMAIL_ADDRESS: string;
|
|
5
5
|
LOGO: string;
|