@b3dotfun/sdk 0.1.69-alpha.23 → 0.1.69-alpha.25
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/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +4 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +37 -4
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +5 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +14 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +2 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -0
- package/dist/cjs/global-account/react/components/index.js +5 -3
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +5 -4
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -1
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +5 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +38 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +6 -4
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +4 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +16 -6
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +2 -2
- package/dist/esm/global-account/react/components/index.d.ts +1 -0
- package/dist/esm/global-account/react/components/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +5 -4
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/types/global-account/react/components/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +3 -1
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +18 -14
- package/src/global-account/react/components/ManageAccount/Header.tsx +74 -4
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +25 -19
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +14 -7
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +18 -14
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +29 -20
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +7 -1
- package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +43 -14
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +8 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +4 -2
- package/src/global-account/react/components/index.ts +5 -0
- package/src/global-account/react/hooks/useBetterAuth.ts +5 -4
- package/src/global-account/react/stores/useModalStore.ts +2 -0
- package/src/shared/constants/index.ts +2 -0
|
@@ -47,6 +47,8 @@ function AvatarEditor({ onSetAvatar, className }) {
|
|
|
47
47
|
const { user, setUser } = (0, react_1.useAuthentication)(partnerId);
|
|
48
48
|
const setB3ModalContentType = (0, stores_1.useModalStore)(state => state.setB3ModalContentType);
|
|
49
49
|
const contentType = (0, stores_1.useModalStore)(state => state.contentType);
|
|
50
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
51
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
50
52
|
const account = (0, react_3.useActiveAccount)();
|
|
51
53
|
const { data: profile, refetch: refreshProfile } = (0, react_1.useProfile)({
|
|
52
54
|
address: account?.address,
|
|
@@ -124,7 +126,7 @@ function AvatarEditor({ onSetAvatar, className }) {
|
|
|
124
126
|
setCroppedAreaPixels(null);
|
|
125
127
|
};
|
|
126
128
|
const handleSaveChanges = async () => {
|
|
127
|
-
if (!account?.address) {
|
|
129
|
+
if (!isBetterAuth && !account?.address) {
|
|
128
130
|
react_1.toast.error("No account connected");
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
@@ -13,11 +13,13 @@ const SettingsIcon = () => {
|
|
|
13
13
|
};
|
|
14
14
|
const BottomNavigation = () => {
|
|
15
15
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
16
|
-
|
|
16
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
17
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-modal-bottom-navigation sticky bottom-0 left-0 w-full rounded-b-xl border-t border-gray-200 bg-[#FAFAFA]", children: (0, jsx_runtime_1.jsxs)(react_1.TabsListPrimitive, { className: "flex h-[68px] w-full items-center justify-center gap-4 border-none bg-transparent", children: [(0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "home", className: "data-[state=active]:border-b3-primary-blue group flex flex-initial flex-col items-center gap-1 border-r-0 border-t-0 px-6 pb-2 pt-2.5 text-[#a0a0ab] data-[state=active]:border-t-4 data-[state=active]:text-[#18181B] dark:data-[state=active]:text-white", children: [(0, jsx_runtime_1.jsx)(HomeIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: "Home" })] }), !isBetterAuth && ((0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "swap", className: "data-[state=active]:border-b3-primary-blue group flex flex-initial flex-col items-center gap-1 border-r-0 border-t-0 px-6 pb-2 pt-2.5 text-[#a0a0ab] data-[state=active]:border-t-4 data-[state=active]:text-[#18181B] dark:data-[state=active]:text-white", onClick: () => {
|
|
17
19
|
setB3ModalContentType({
|
|
18
20
|
type: "anySpend",
|
|
19
21
|
showBackButton: true,
|
|
20
22
|
});
|
|
21
|
-
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: "Swap" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:border-b3-primary-blue group flex flex-initial flex-col items-center gap-1 border-r-0 border-t-0 px-6 pb-2 pt-2.5 text-[#a0a0ab] data-[state=active]:border-t-4 data-[state=active]:text-[#18181B] dark:data-[state=active]:text-white", children: [(0, jsx_runtime_1.jsx)(SettingsIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: "Settings" })] })] }) }));
|
|
23
|
+
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: "Swap" })] })), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:border-b3-primary-blue group flex flex-initial flex-col items-center gap-1 border-r-0 border-t-0 px-6 pb-2 pt-2.5 text-[#a0a0ab] data-[state=active]:border-t-4 data-[state=active]:text-[#18181B] dark:data-[state=active]:text-white", children: [(0, jsx_runtime_1.jsx)(SettingsIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: "Settings" })] })] }) }));
|
|
22
24
|
};
|
|
23
25
|
exports.default = BottomNavigation;
|
|
@@ -39,8 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.Header = Header;
|
|
40
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
41
|
const react_1 = require("../../../../global-account/react");
|
|
42
|
+
const constants_1 = require("../../../../shared/constants");
|
|
42
43
|
const AccordionPrimitive = __importStar(require("@radix-ui/react-accordion"));
|
|
43
44
|
const framer_motion_1 = require("framer-motion");
|
|
45
|
+
const boring_avatars_1 = __importDefault(require("boring-avatars"));
|
|
44
46
|
const lucide_react_1 = require("lucide-react");
|
|
45
47
|
const react_2 = require("react");
|
|
46
48
|
const react_3 = require("thirdweb/react");
|
|
@@ -78,7 +80,34 @@ function WalletItem({ wallet, isActive, onClick }) {
|
|
|
78
80
|
: "Wallet";
|
|
79
81
|
return ((0, jsx_runtime_1.jsxs)("div", { className: `b3-modal-wallet-item ${isActive ? "b3-modal-wallet-item-active dark:bg-b3-line bg-[#F4F4F5]" : "hover:bg-b3-line/50"} box-border flex cursor-pointer items-center gap-2 rounded-xl px-3 py-2 transition-colors`, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "relative size-10 shrink-0 text-clip rounded-full", children: isGlobalAccount ? ((0, jsx_runtime_1.jsx)("div", { className: "flex size-full items-center justify-center p-1", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "size-full object-contain" }) })) : walletImage ? ((0, jsx_runtime_1.jsx)("img", { src: walletImage, alt: walletName, className: "size-full object-contain p-1" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex size-full items-center justify-center", children: (0, jsx_runtime_1.jsx)(WalletIcon_1.WalletIcon, {}) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-b3-grey font-neue-montreal-semibold truncate text-sm", children: walletName }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: centerTruncate(address, 4) })] }), isActive && ((0, jsx_runtime_1.jsx)("div", { className: "shrink-0", children: (0, jsx_runtime_1.jsx)(CheckIcon, {}) }))] }));
|
|
80
82
|
}
|
|
83
|
+
function BetterAuthHeader({ onLogout }) {
|
|
84
|
+
const contentType = (0, react_1.useModalStore)(state => state.contentType);
|
|
85
|
+
const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
|
|
86
|
+
const partnerId = contentType?.partnerId;
|
|
87
|
+
const { logout, user } = (0, react_1.useAuthentication)(partnerId);
|
|
88
|
+
const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
|
|
89
|
+
const displayName = user?.username || user?.email || "Account";
|
|
90
|
+
const onLogoutEnhanced = async () => {
|
|
91
|
+
setLogoutLoading(true);
|
|
92
|
+
try {
|
|
93
|
+
await logout();
|
|
94
|
+
onLogout?.();
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
setB3ModalOpen(false);
|
|
98
|
+
setLogoutLoading(false);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-background border-b3-line flex items-center justify-between border-b px-5 py-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "size-10 shrink-0 overflow-hidden rounded-full", children: (0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: displayName, variant: "beam", size: 40, colors: constants_1.AVATAR_COLORS }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-0.5", children: [user?.username && ((0, jsx_runtime_1.jsx)("p", { className: "text-b3-grey font-neue-montreal-semibold text-left text-sm", children: user.username })), user?.email && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: user.email }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: user.email })] }))] })] }), (0, jsx_runtime_1.jsxs)("button", { className: "border-b3-line hover:bg-b3-line flex items-center justify-center gap-1.5 rounded-xl border border-solid px-3 py-2 transition-colors", onClick: onLogoutEnhanced, disabled: logoutLoading, children: [logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.default, { size: 16, className: "text-b3-grey" })), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: "Sign out" })] })] }));
|
|
102
|
+
}
|
|
81
103
|
function Header({ onLogout }) {
|
|
104
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
105
|
+
if (authStrategy === "better-auth") {
|
|
106
|
+
return (0, jsx_runtime_1.jsx)(BetterAuthHeader, { onLogout: onLogout });
|
|
107
|
+
}
|
|
108
|
+
return (0, jsx_runtime_1.jsx)(WalletHeader, { onLogout: onLogout });
|
|
109
|
+
}
|
|
110
|
+
function WalletHeader({ onLogout }) {
|
|
82
111
|
const activeWallet = (0, react_3.useActiveWallet)();
|
|
83
112
|
const connectedWallets = (0, react_3.useConnectedWallets)();
|
|
84
113
|
const setActiveWallet = (0, react_3.useSetActiveWallet)();
|
|
@@ -95,10 +124,14 @@ function Header({ onLogout }) {
|
|
|
95
124
|
const isActiveGlobalAccount = activeWallet?.id.includes("ecosystem");
|
|
96
125
|
const onLogoutEnhanced = async () => {
|
|
97
126
|
setLogoutLoading(true);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
try {
|
|
128
|
+
await logout();
|
|
129
|
+
onLogout?.();
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
setB3ModalOpen(false);
|
|
133
|
+
setLogoutLoading(false);
|
|
134
|
+
}
|
|
102
135
|
};
|
|
103
136
|
const handleWalletSwitch = (wallet) => {
|
|
104
137
|
setActiveWallet(wallet);
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HomeContent = HomeContent;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("../../../../global-account/react");
|
|
8
9
|
const Tabs_1 = require("../ui/Tabs");
|
|
9
10
|
const Header_1 = require("./Header");
|
|
10
11
|
const HomeActions_1 = __importDefault(require("./HomeActions"));
|
|
@@ -12,5 +13,7 @@ const NFTContent_1 = __importDefault(require("./NFTContent"));
|
|
|
12
13
|
const ProfileSection_1 = __importDefault(require("./ProfileSection"));
|
|
13
14
|
const TokenContent_1 = __importDefault(require("./TokenContent"));
|
|
14
15
|
function HomeContent({ showDeposit = false, showSwap = true }) {
|
|
15
|
-
|
|
16
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
17
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)(Header_1.Header, {}), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)(ProfileSection_1.default, {}), !isBetterAuth && (0, jsx_runtime_1.jsx)(HomeActions_1.default, { showDeposit: showDeposit, showSwap: showSwap }), !isBetterAuth && ((0, jsx_runtime_1.jsx)("div", { className: "b3-modal-balance-content space-y-2 p-5", children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { defaultValue: "balance", children: [(0, jsx_runtime_1.jsxs)(Tabs_1.TabsList, { className: "b3-modal-balance-tabs-list", children: [(0, jsx_runtime_1.jsx)(Tabs_1.TabTrigger, { value: "balance", className: "font-neue-montreal-semibold p-0 pr-3", children: "Balance" }), (0, jsx_runtime_1.jsx)(Tabs_1.TabTrigger, { value: "nfts", className: "font-neue-montreal-semibold p-0 pr-3", children: "NFTs" })] }), (0, jsx_runtime_1.jsx)(Tabs_1.TabsContent, { value: "balance", className: "px-0 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(TokenContent_1.default, {}) }), (0, jsx_runtime_1.jsx)(Tabs_1.TabsContent, { value: "nfts", className: "px-0 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(NFTContent_1.default, {}) })] }) }))] })] }));
|
|
16
19
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("../../../../global-account/react");
|
|
8
8
|
const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
|
|
9
|
+
const constants_1 = require("../../../../shared/constants");
|
|
9
10
|
const utils_1 = require("../../../../shared/utils");
|
|
10
11
|
const number_1 = require("../../../../shared/utils/number");
|
|
11
12
|
const boring_avatars_1 = __importDefault(require("boring-avatars"));
|
|
@@ -14,8 +15,9 @@ const react_2 = require("react");
|
|
|
14
15
|
const react_3 = require("thirdweb/react");
|
|
15
16
|
const useFirstEOA_1 = require("../../hooks/useFirstEOA");
|
|
16
17
|
const IPFSMediaRenderer_1 = require("../IPFSMediaRenderer/IPFSMediaRenderer");
|
|
17
|
-
const AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
|
|
18
18
|
const ProfileSection = () => {
|
|
19
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
20
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
19
21
|
const account = (0, react_3.useActiveAccount)();
|
|
20
22
|
const { address: eoaAddress } = (0, useFirstEOA_1.useFirstEOA)();
|
|
21
23
|
const { address: smartWalletAddress } = (0, react_1.useAccountWallet)();
|
|
@@ -50,7 +52,7 @@ const ProfileSection = () => {
|
|
|
50
52
|
setImgError(false);
|
|
51
53
|
}, [avatarSrc]);
|
|
52
54
|
const currentUsername = user?.username || profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "");
|
|
53
|
-
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || "user";
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between px-5 py-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? ((0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : ((0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: avatarSeed, variant: "beam", size: 56, colors: AVATAR_COLORS })) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 10, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info flex flex-col gap-1", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted", children: " $" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[30px]", children: (0, number_1.formatDisplayNumber)(totalBalanceUsd, { fractionDigits: 2 }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername })] })] }) }));
|
|
55
|
+
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || user?.email || "user";
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between px-5 py-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? ((0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : ((0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: avatarSeed, variant: "beam", size: 56, colors: constants_1.AVATAR_COLORS })) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 10, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info flex flex-col gap-1", children: [!isBetterAuth && ((0, jsx_runtime_1.jsxs)("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted", children: " $" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[30px]", children: (0, number_1.formatDisplayNumber)(totalBalanceUsd, { fractionDigits: 2 }) })] })), (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername }), isBetterAuth && user?.email && ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: user.email }))] })] }) }));
|
|
55
57
|
};
|
|
56
58
|
exports.default = ProfileSection;
|
|
@@ -15,6 +15,8 @@ const ModalHeader_1 = __importDefault(require("../ModalHeader/ModalHeader"));
|
|
|
15
15
|
const SettingsMenuItem_1 = __importDefault(require("./SettingsMenuItem"));
|
|
16
16
|
const SettingsProfileCard_1 = __importDefault(require("./SettingsProfileCard"));
|
|
17
17
|
const SettingsContent = ({ partnerId, onLogout, chain, }) => {
|
|
18
|
+
const { authStrategy } = (0, react_1.useB3Config)();
|
|
19
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
18
20
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
19
21
|
const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
|
|
20
22
|
const { logout, user } = (0, react_1.useAuthentication)(partnerId);
|
|
@@ -50,7 +52,7 @@ const SettingsContent = ({ partnerId, onLogout, chain, }) => {
|
|
|
50
52
|
setB3ModalOpen(false);
|
|
51
53
|
setLogoutLoading(false);
|
|
52
54
|
};
|
|
53
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: false, showCloseButton: false, title: "Settings" }), (0, jsx_runtime_1.jsx)("div", { className: "p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: (0, jsx_runtime_1.jsx)(SettingsProfileCard_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 px-5", children: [(0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Stay signed in", subtitle: session_duration_1.SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`, onClick: () => handleNavigate("sessionDuration") })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-auto px-5 pb-5", children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "b3-modal-sign-out-button border-b3-line hover:bg-b3-line bg-b3-background dark:bg-b3-background dark:border-b3-line dark:hover:bg-b3-line/80 flex w-full items-center justify-center gap-1.5 rounded-xl border border-solid p-3 transition-colors", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: false, showCloseButton: false, title: "Settings" }), (0, jsx_runtime_1.jsx)("div", { className: "p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: (0, jsx_runtime_1.jsx)(SettingsProfileCard_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 px-5", children: [!isBetterAuth && ((0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") })), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Stay signed in", subtitle: session_duration_1.SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`, onClick: () => handleNavigate("sessionDuration") })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-auto px-5 pb-5", children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "b3-modal-sign-out-button border-b3-line hover:bg-b3-line bg-b3-background dark:bg-b3-background dark:border-b3-line dark:hover:bg-b3-line/80 flex w-full items-center justify-center gap-1.5 rounded-xl border border-solid p-3 transition-colors", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
|
|
54
56
|
boxShadow: "inset 0px 0px 0px 1px rgba(10,13,18,0.18), inset 0px -2px 0px 0px rgba(10,13,18,0.05)",
|
|
55
57
|
}, children: [logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin", size: 20 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.default, { size: 20, className: "text-b3-grey", color: "currentColor" })), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-grey dark:text-b3-foreground-muted font-neue-montreal-semibold text-base", children: "Sign out" })] }) })] }));
|
|
56
58
|
};
|
|
@@ -21,7 +21,8 @@ const SettingsProfileCard = () => {
|
|
|
21
21
|
address: eoaAddress || account?.address,
|
|
22
22
|
fresh: true,
|
|
23
23
|
});
|
|
24
|
-
const { partnerId } = (0, react_1.useB3Config)();
|
|
24
|
+
const { partnerId, authStrategy } = (0, react_1.useB3Config)();
|
|
25
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
25
26
|
const { user, setUser } = (0, react_1.useAuthentication)(partnerId);
|
|
26
27
|
const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
|
|
27
28
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
@@ -71,19 +72,29 @@ const SettingsProfileCard = () => {
|
|
|
71
72
|
}
|
|
72
73
|
setIsSaving(true);
|
|
73
74
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
let updatedUser;
|
|
76
|
+
if (isBetterAuth) {
|
|
77
|
+
// Better Auth: register username without wallet signing (DB-only, no ENS)
|
|
78
|
+
// Skip ens_normalize — it rejects underscores/mixed-case that are valid non-ENS usernames
|
|
79
|
+
const sanitizedUsername = editedUsername.trim().toLowerCase();
|
|
80
|
+
// Type assertion needed: b3-mono now accepts message/hash as optional for Better Auth users
|
|
81
|
+
updatedUser = (await app_1.default
|
|
82
|
+
.service("users")
|
|
83
|
+
.registerUsername({ username: sanitizedUsername }, {}));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// Thirdweb: register username with wallet signature + on-chain ENS
|
|
87
|
+
const sanitizedUsername = (0, ens_normalize_1.ens_normalize)(editedUsername.trim());
|
|
88
|
+
const b3Username = `${sanitizedUsername}.b3.fun`;
|
|
89
|
+
const usernameSignMessage = `Register "${b3Username}"`;
|
|
90
|
+
const usernameSignature = await account?.signMessage({ message: usernameSignMessage });
|
|
91
|
+
if (!usernameSignature) {
|
|
92
|
+
throw new Error("Failed to sign username registration message");
|
|
93
|
+
}
|
|
94
|
+
updatedUser = (await app_1.default
|
|
95
|
+
.service("users")
|
|
96
|
+
.registerUsername({ username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature }, {}));
|
|
80
97
|
}
|
|
81
|
-
console.log("@@usernameSignature", usernameSignature);
|
|
82
|
-
// Register username with ENS
|
|
83
|
-
// Note: Type assertion needed until @b3dotfun/b3-api package is updated with RegisterUsername type
|
|
84
|
-
const updatedUser = (await app_1.default
|
|
85
|
-
.service("users")
|
|
86
|
-
.registerUsername({ username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature }, {}));
|
|
87
98
|
// Update user state - registerUsername returns an array with single user
|
|
88
99
|
setUser(Array.isArray(updatedUser) ? updatedUser[0] : updatedUser);
|
|
89
100
|
// Refresh profile to get updated data
|
|
@@ -112,6 +123,6 @@ const SettingsProfileCard = () => {
|
|
|
112
123
|
/* Edit mode - inline input */
|
|
113
124
|
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "text", value: editedUsername, onChange: e => setEditedUsername(e.target.value), onKeyDown: handleKeyDown, disabled: isSaving, className: "border-b3-line bg-b3-background text-b3-grey placeholder:text-b3-foreground-muted font-neue-montreal-medium focus:border-b3-primary-blue text-md w-full rounded-md border px-2 py-1 leading-none transition-colors focus:outline-none disabled:opacity-50", placeholder: "Enter username" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleSaveUsername, disabled: isSaving, className: "text-b3-primary-blue hover:text-b3-primary-blue/80 flex items-center justify-center rounded-md p-1 transition-colors disabled:opacity-50", "aria-label": "Save username", children: isSaving ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { size: 18, className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 18, strokeWidth: 2.5 }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCancelEdit, disabled: isSaving, className: "text-b3-foreground-muted hover:text-b3-grey flex items-center justify-center rounded-md p-1 transition-colors disabled:opacity-50", "aria-label": "Cancel editing", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 18, strokeWidth: 2.5 }) })] })] })) : (
|
|
114
125
|
/* Display mode */
|
|
115
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: (0, jsx_runtime_1.jsx)("p", { className: "b3-modal-username font-neue-montreal-semibold text-lg leading-none text-[#0B57C2]", children: currentUsername }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleEditUsername, className: "flex items-center justify-center gap-1 text-left transition-opacity hover:opacity-80", children: (0, jsx_runtime_1.jsx)("p", { className: "font-inter text-sm font-semibold leading-5 text-[#51525C] dark:text-white", children: "Edit Username" }) })] })) })] }));
|
|
126
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: (0, jsx_runtime_1.jsx)("p", { className: "b3-modal-username font-neue-montreal-semibold text-lg leading-none text-[#0B57C2]", children: currentUsername || user?.email }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleEditUsername, className: "flex items-center justify-center gap-1 text-left transition-opacity hover:opacity-80", children: (0, jsx_runtime_1.jsx)("p", { className: "font-inter text-sm font-semibold leading-5 text-[#51525C] dark:text-white", children: "Edit Username" }) })] })) })] }));
|
|
116
127
|
};
|
|
117
128
|
exports.default = SettingsProfileCard;
|
|
@@ -10,6 +10,11 @@ export interface BetterAuthSignInProps {
|
|
|
10
10
|
showEmail?: boolean;
|
|
11
11
|
/** URL to redirect to after password reset link is clicked. Token is appended as ?token=... */
|
|
12
12
|
passwordResetRedirectTo?: string;
|
|
13
|
+
/**
|
|
14
|
+
* URL Better Auth redirects to after server-side email verification. Render
|
|
15
|
+
* `BetterAuthVerifyEmail` at this route so the user gets a confirmation page.
|
|
16
|
+
*/
|
|
17
|
+
verifyEmailRedirectTo?: string;
|
|
13
18
|
/** Called after successful authentication */
|
|
14
19
|
onSuccess?: () => void;
|
|
15
20
|
/** Called on authentication error */
|
|
@@ -31,4 +36,4 @@ export interface BetterAuthSignInProps {
|
|
|
31
36
|
* />
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
export declare function BetterAuthSignIn({ title, subtitle, socialProviders, showEmail, passwordResetRedirectTo, onSuccess, onError, className, }: BetterAuthSignInProps): import("react/jsx-runtime").JSX.Element | null;
|
|
39
|
+
export declare function BetterAuthSignIn({ title, subtitle, socialProviders, showEmail, passwordResetRedirectTo, verifyEmailRedirectTo, onSuccess, onError, className, }: BetterAuthSignInProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -31,7 +31,7 @@ const DEFAULT_SOCIAL_PROVIDERS = [
|
|
|
31
31
|
* />
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access your account", socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id), showEmail = true, passwordResetRedirectTo, onSuccess, onError, className, }) {
|
|
34
|
+
function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access your account", socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id), showEmail = true, passwordResetRedirectTo, verifyEmailRedirectTo, onSuccess, onError, className, }) {
|
|
35
35
|
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = (0, useBetterAuth_1.useBetterAuth)();
|
|
36
36
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
37
37
|
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
@@ -101,7 +101,7 @@ function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access
|
|
|
101
101
|
setIsLoading(true);
|
|
102
102
|
setError(null);
|
|
103
103
|
if (mode === "sign-up") {
|
|
104
|
-
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
104
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
107
|
await signInWithEmail(normalizedEmail, password);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type BetterAuthVerifyEmailState = "success" | "expired" | "invalid" | "already-verified" | "error";
|
|
2
|
+
export interface BetterAuthVerifyEmailProps {
|
|
3
|
+
/**
|
|
4
|
+
* Error code from the callback URL's `?error=` query param. Pass `null` /
|
|
5
|
+
* `undefined` when the user landed here cleanly (successful verification).
|
|
6
|
+
* Better Auth appends this param when server-side verification fails.
|
|
7
|
+
*/
|
|
8
|
+
errorCode?: string | null;
|
|
9
|
+
/** Called when the user clicks the "Go to sign in" button. */
|
|
10
|
+
onGoToSignIn?: () => void;
|
|
11
|
+
/** Fallback href used when `onGoToSignIn` is not provided. Defaults to "/login". */
|
|
12
|
+
signInHref?: string;
|
|
13
|
+
/** Optional override for the success headline. */
|
|
14
|
+
successTitle?: string;
|
|
15
|
+
/** Optional override for the success body text. */
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
/** Optional class name for the root container. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
22
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
23
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
24
|
+
*
|
|
25
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
26
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
31
|
+
* <BetterAuthVerifyEmail
|
|
32
|
+
* errorCode={error}
|
|
33
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref, successTitle, successMessage, className, }: BetterAuthVerifyEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BetterAuthVerifyEmail = BetterAuthVerifyEmail;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../global-account/react");
|
|
6
|
+
const debug_1 = require("../../../../shared/utils/debug");
|
|
7
|
+
const debug = (0, debug_1.debugB3React)("BetterAuthVerifyEmail");
|
|
8
|
+
function classifyError(code) {
|
|
9
|
+
if (!code)
|
|
10
|
+
return "success";
|
|
11
|
+
const normalized = code.toLowerCase();
|
|
12
|
+
// Exact matches for Better Auth's documented verification error codes.
|
|
13
|
+
if (normalized === "expired_token")
|
|
14
|
+
return "expired";
|
|
15
|
+
if (normalized === "invalid_token")
|
|
16
|
+
return "invalid";
|
|
17
|
+
if (normalized === "already_verified" || normalized === "email_already_verified")
|
|
18
|
+
return "already-verified";
|
|
19
|
+
// Loose fallbacks for close variants. Order matters — check "already" before
|
|
20
|
+
// "verified" so `email_already_verified` maps to already-verified, not invalid.
|
|
21
|
+
if (normalized.includes("expired"))
|
|
22
|
+
return "expired";
|
|
23
|
+
if (normalized.includes("already"))
|
|
24
|
+
return "already-verified";
|
|
25
|
+
if (normalized.includes("invalid"))
|
|
26
|
+
return "invalid";
|
|
27
|
+
return "error";
|
|
28
|
+
}
|
|
29
|
+
const COPY = {
|
|
30
|
+
success: {
|
|
31
|
+
title: "Email verified",
|
|
32
|
+
message: "Your email is confirmed. You can now sign in to your account.",
|
|
33
|
+
},
|
|
34
|
+
expired: {
|
|
35
|
+
title: "Link expired",
|
|
36
|
+
message: "This verification link has expired. Request a new one from the sign-in page.",
|
|
37
|
+
},
|
|
38
|
+
invalid: {
|
|
39
|
+
title: "Invalid link",
|
|
40
|
+
message: "This verification link is invalid or has already been used. Try signing in or request a new link.",
|
|
41
|
+
},
|
|
42
|
+
"already-verified": {
|
|
43
|
+
title: "Already verified",
|
|
44
|
+
message: "Your email was already confirmed. You can sign in now.",
|
|
45
|
+
},
|
|
46
|
+
error: {
|
|
47
|
+
title: "Verification failed",
|
|
48
|
+
message: "We couldn't verify your email. Request a new link from the sign-in page.",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
53
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
54
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
55
|
+
*
|
|
56
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
57
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
58
|
+
*
|
|
59
|
+
* Usage:
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
62
|
+
* <BetterAuthVerifyEmail
|
|
63
|
+
* errorCode={error}
|
|
64
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref = "/login", successTitle, successMessage, className, }) {
|
|
69
|
+
const state = classifyError(errorCode);
|
|
70
|
+
const isSuccess = state === "success" || state === "already-verified";
|
|
71
|
+
const copy = COPY[state];
|
|
72
|
+
const title = isSuccess && successTitle ? successTitle : copy.title;
|
|
73
|
+
const message = isSuccess && successMessage ? successMessage : copy.message;
|
|
74
|
+
debug("Rendering verify-email state", { state, errorCode });
|
|
75
|
+
const handleClick = () => {
|
|
76
|
+
if (onGoToSignIn) {
|
|
77
|
+
onGoToSignIn();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof window !== "undefined") {
|
|
81
|
+
window.location.href = signInHref;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `w-full max-w-[400px] px-6 ${className || ""}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: `mx-auto flex h-12 w-12 items-center justify-center rounded-full ${isSuccess ? "bg-green-100" : "bg-red-100"}`, children: isSuccess ? ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-red-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-[28px] font-semibold tracking-tight text-gray-900 dark:text-gray-100", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "mt-3 text-[15px] text-gray-500 dark:text-gray-400", children: message })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleClick, className: "h-11 w-full bg-gray-900 text-[15px] font-medium text-white hover:bg-gray-800 dark:bg-white dark:text-gray-900 dark:hover:bg-gray-100", children: isSuccess ? "Go to sign in" : "Back to sign in" })] }) }));
|
|
85
|
+
}
|
|
@@ -10,12 +10,15 @@ const Icon_1 = __importDefault(require("../../../../global-account/react/compone
|
|
|
10
10
|
const constants_1 = require("../../../../shared/constants");
|
|
11
11
|
const utils_1 = require("../../../../shared/utils");
|
|
12
12
|
const react_2 = require("@headlessui/react");
|
|
13
|
+
const boring_avatars_1 = __importDefault(require("boring-avatars"));
|
|
13
14
|
const react_3 = require("react");
|
|
14
15
|
const react_4 = require("thirdweb/react");
|
|
16
|
+
const useUser_1 = require("../../hooks/useUser");
|
|
15
17
|
const ManageAccountButton_1 = require("../custom/ManageAccountButton");
|
|
16
18
|
function SignIn(props) {
|
|
17
19
|
const { className } = props;
|
|
18
|
-
const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3Config)();
|
|
20
|
+
const { automaticallySetFirstEoa, partnerId, authStrategy } = (0, react_1.useB3Config)();
|
|
21
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
19
22
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
|
|
20
23
|
const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
|
|
21
24
|
const isMobile = (0, react_1.useIsMobile)();
|
|
@@ -25,6 +28,10 @@ function SignIn(props) {
|
|
|
25
28
|
};
|
|
26
29
|
const connectedWallets = (0, react_4.useConnectedWallets)();
|
|
27
30
|
const setActiveWallet = (0, react_4.useSetActiveWallet)();
|
|
31
|
+
// Better Auth state
|
|
32
|
+
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
33
|
+
const { user } = (0, useUser_1.useUser)();
|
|
34
|
+
const userDisplayName = user?.username || user?.email || "Account";
|
|
28
35
|
const handleSetActiveAccount = (selectedWalletId) => {
|
|
29
36
|
if (!selectedWalletId ||
|
|
30
37
|
!connectedWallets ||
|
|
@@ -40,12 +47,15 @@ function SignIn(props) {
|
|
|
40
47
|
setActiveWallet(connectedEOAWallet);
|
|
41
48
|
}
|
|
42
49
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
50
|
+
const isLoggedIn = isBetterAuth ? isAuthenticated : !!globalAddress;
|
|
43
51
|
// Desktop version - original dropdown menu
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children:
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: isLoggedIn ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3 focus:outline-none", children: [isBetterAuth ? ((0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: userDisplayName, variant: "beam", size: 24, colors: constants_1.AVATAR_COLORS })) : (!!walletImage && ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: walletImage, alt: "Wallet Image", className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" }))), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: isBetterAuth ? userDisplayName : ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress ?? "") })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border focus:outline-none lg:right-0", modal: false,
|
|
45
53
|
// TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
|
|
46
|
-
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [
|
|
54
|
+
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [isBetterAuth ? (
|
|
55
|
+
/* Better Auth: show user info instead of wallet switching */
|
|
56
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 rounded-xl p-3", children: [(0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: userDisplayName, variant: "beam", size: 48, colors: constants_1.AVATAR_COLORS }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-0.5", children: [user?.username && (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary font-semibold", children: user.username }), user?.email && (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-secondary text-sm", children: user.email })] })] })) : connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: walletImage, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress ?? "") })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
|
|
47
57
|
? "bg-b3-react-background"
|
|
48
|
-
: "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
58
|
+
: "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress ?? "") }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: isBetterAuth ? "Sign out" : "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
49
59
|
console.log("User authenticated with Global Account!", globalAccount);
|
|
50
60
|
}, ...props })) }) }));
|
|
51
61
|
}
|
|
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "../../../../global-account/react";
|
|
|
3
3
|
* Component that manages the authentication flow for Sign In With B3
|
|
4
4
|
* Handles different login providers, authentication steps, and session key management
|
|
5
5
|
*/
|
|
6
|
-
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, verifyEmailRedirectTo, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
16
16
|
* Component that manages the authentication flow for Sign In With B3
|
|
17
17
|
* Handles different login providers, authentication steps, and session key management
|
|
18
18
|
*/
|
|
19
|
-
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
19
|
+
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, verifyEmailRedirectTo, }) {
|
|
20
20
|
const { automaticallySetFirstEoa, authStrategy } = (0, react_1.useB3Config)();
|
|
21
21
|
// skipAutoConnect: this component intentionally logs out on mount to show a fresh login screen.
|
|
22
22
|
// AuthenticationProvider is the sole owner of useAutoConnect to avoid competing auth cycles.
|
|
@@ -247,7 +247,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
247
247
|
// Better Auth manages its own loading/verification states internally.
|
|
248
248
|
// Don't gate on isAuthenticating — it would unmount the component
|
|
249
249
|
// and lose verification state when setIsAuthenticating(false) fires.
|
|
250
|
-
content = (0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError });
|
|
250
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError, verifyEmailRedirectTo: verifyEmailRedirectTo }));
|
|
251
251
|
}
|
|
252
252
|
else if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
|
|
253
253
|
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface LoginStepBetterAuthProps {
|
|
2
2
|
onSuccess?: () => void;
|
|
3
3
|
onError?: (error: Error) => Promise<void>;
|
|
4
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
5
|
+
verifyEmailRedirectTo?: string;
|
|
4
6
|
}
|
|
5
|
-
export declare function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -17,7 +17,7 @@ const SOCIAL_PROVIDERS = [
|
|
|
17
17
|
{ id: "microsoft", label: "Microsoft" },
|
|
18
18
|
{ id: "slack", label: "Slack" },
|
|
19
19
|
];
|
|
20
|
-
function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
20
|
+
function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }) {
|
|
21
21
|
const { partnerId } = (0, react_1.useB3Config)();
|
|
22
22
|
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = (0, useBetterAuth_1.useBetterAuth)();
|
|
23
23
|
const [mode, setMode] = (0, react_2.useState)("sign-in");
|
|
@@ -48,7 +48,7 @@ function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
|
48
48
|
setError(null);
|
|
49
49
|
if (mode === "sign-up") {
|
|
50
50
|
debug("Signing up", { email: normalizedEmail, name: name.trim() });
|
|
51
|
-
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
51
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
debug("Signing in", { email: normalizedEmail });
|
|
@@ -8,6 +8,7 @@ export { useB3Config } from "./B3Provider/useB3Config";
|
|
|
8
8
|
export { StyleRoot } from "./StyleRoot";
|
|
9
9
|
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
10
10
|
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
11
|
+
export { BetterAuthVerifyEmail, type BetterAuthVerifyEmailProps, type BetterAuthVerifyEmailState, } from "./SignInWithB3/BetterAuthVerifyEmail";
|
|
11
12
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
12
13
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
13
14
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = void 0;
|
|
6
|
+
exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.BetterAuthVerifyEmail = exports.BetterAuthSignIn = exports.BetterAuthResetPassword = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = exports.TransitionPanel = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
@@ -27,6 +27,8 @@ var BetterAuthResetPassword_1 = require("./SignInWithB3/BetterAuthResetPassword"
|
|
|
27
27
|
Object.defineProperty(exports, "BetterAuthResetPassword", { enumerable: true, get: function () { return BetterAuthResetPassword_1.BetterAuthResetPassword; } });
|
|
28
28
|
var BetterAuthSignIn_1 = require("./SignInWithB3/BetterAuthSignIn");
|
|
29
29
|
Object.defineProperty(exports, "BetterAuthSignIn", { enumerable: true, get: function () { return BetterAuthSignIn_1.BetterAuthSignIn; } });
|
|
30
|
+
var BetterAuthVerifyEmail_1 = require("./SignInWithB3/BetterAuthVerifyEmail");
|
|
31
|
+
Object.defineProperty(exports, "BetterAuthVerifyEmail", { enumerable: true, get: function () { return BetterAuthVerifyEmail_1.BetterAuthVerifyEmail; } });
|
|
30
32
|
var AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
31
33
|
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
32
34
|
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
@@ -13,7 +13,7 @@ export declare class EmailVerificationRequiredError extends Error {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function useBetterAuth(): {
|
|
15
15
|
signInWithEmail: (email: string, password: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
-
signUpWithEmail: (email: string, password: string, name: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
+
signUpWithEmail: (email: string, password: string, name: string, verifyCallbackURL?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
17
17
|
signInWithSocial: (provider: BetterAuthSocialProvider) => Promise<void>;
|
|
18
18
|
requestPasswordReset: (email: string, redirectTo?: string) => Promise<{
|
|
19
19
|
data: {
|