@b3dotfun/sdk 0.0.65-test.1 → 0.0.65
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/anyspend/react/components/AnySpend.js +33 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +3 -7
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +33 -139
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +6 -25
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +279 -113
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +193 -24
- package/dist/cjs/global-account/react/components/index.d.ts +2 -4
- package/dist/cjs/global-account/react/components/index.js +4 -11
- package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/cjs/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +2 -2
- package/dist/cjs/shared/utils/ipfs.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +34 -74
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +5 -6
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +34 -140
- package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -25
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +280 -113
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +195 -26
- package/dist/esm/global-account/react/components/index.d.ts +2 -4
- package/dist/esm/global-account/react/components/index.js +2 -7
- package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -1
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/esm/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +2 -2
- package/dist/esm/shared/utils/ipfs.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/types/global-account/react/components/index.d.ts +2 -4
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/types/shared/constants/chains/supported.d.ts +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +167 -225
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -1
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
- package/src/anyspend/react/components/common/OrderHistory.tsx +13 -8
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +25 -115
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +126 -303
- package/src/global-account/react/components/B3DynamicModal.tsx +6 -28
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +433 -332
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +3 -2
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +589 -73
- package/src/global-account/react/components/index.ts +2 -9
- package/src/global-account/react/components/ui/Tabs.tsx +13 -5
- package/src/global-account/react/components/ui/dialog.tsx +14 -32
- package/src/global-account/react/hooks/index.ts +0 -3
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +0 -1
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +2 -39
- package/src/global-account/react/utils/profileDisplay.ts +2 -4
- package/src/shared/utils/ipfs.ts +1 -1
- package/src/styles/index.css +1 -6
- package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/cjs/global-account/react/components/Deposit/Deposit.js +0 -65
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -331
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.js +0 -34
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +0 -23
- package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +0 -120
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +0 -43
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +0 -16
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +0 -15
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +0 -44
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +0 -50
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -8
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -38
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +0 -22
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +0 -12
- package/dist/cjs/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/cjs/global-account/react/components/Send/Send.js +0 -187
- package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/BellIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +0 -7
- package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/CopyIcon.js +0 -7
- package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/LinkIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/LockIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/WalletIcon.js +0 -7
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +0 -36
- package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/esm/global-account/react/components/Deposit/Deposit.js +0 -59
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -325
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.js +0 -32
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +0 -21
- package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +0 -81
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +0 -41
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +0 -10
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +0 -13
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +0 -42
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +0 -45
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -36
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +0 -20
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +0 -10
- package/dist/esm/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/esm/global-account/react/components/Send/Send.js +0 -181
- package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/BellIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +0 -4
- package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/CopyIcon.js +0 -4
- package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/LinkIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/LockIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/WalletIcon.js +0 -4
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +0 -33
- package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/types/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/types/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/types/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/src/global-account/react/components/Deposit/Deposit.tsx +0 -211
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +0 -490
- package/src/global-account/react/components/ManageAccount/AppsContent.tsx +0 -79
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +0 -83
- package/src/global-account/react/components/ManageAccount/Header.tsx +0 -230
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +0 -118
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +0 -42
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +0 -24
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +0 -74
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +0 -87
- package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +0 -31
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +0 -74
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +0 -41
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +0 -50
- package/src/global-account/react/components/Send/Send.tsx +0 -585
- package/src/global-account/react/components/icons/BellIcon.tsx +0 -15
- package/src/global-account/react/components/icons/ChevronDownIcon.tsx +0 -17
- package/src/global-account/react/components/icons/CopyIcon.tsx +0 -22
- package/src/global-account/react/components/icons/LinkIcon.tsx +0 -15
- package/src/global-account/react/components/icons/LockIcon.tsx +0 -15
- package/src/global-account/react/components/icons/WalletIcon.tsx +0 -21
- package/src/global-account/react/stores/useRecentAddressesStore.ts +0 -55
|
@@ -10,22 +10,16 @@ import { useEffect, useRef } from "react";
|
|
|
10
10
|
import { useSetActiveWallet } from "thirdweb/react";
|
|
11
11
|
import { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
|
|
12
12
|
import { useB3 } from "./B3Provider/useB3.js";
|
|
13
|
-
import { Deposit } from "./Deposit/Deposit.js";
|
|
14
13
|
import { LinkAccount } from "./LinkAccount/LinkAccount.js";
|
|
15
|
-
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount.js";
|
|
16
|
-
import { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
17
14
|
import { ProfileEditor } from "./ProfileEditor/ProfileEditor.js";
|
|
15
|
+
import { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
18
16
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
|
|
19
|
-
import { Send } from "./Send/Send.js";
|
|
20
17
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
|
|
21
18
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
|
|
22
19
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
|
|
23
20
|
const debug = debugB3React("B3DynamicModal");
|
|
24
21
|
export function B3DynamicModal() {
|
|
25
|
-
const isOpen = useModalStore(
|
|
26
|
-
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
27
|
-
const contentType = useModalStore(state => state.contentType);
|
|
28
|
-
const navigateBack = useModalStore(state => state.navigateBack);
|
|
22
|
+
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = useModalStore();
|
|
29
23
|
const { theme } = useB3();
|
|
30
24
|
const isMobile = useIsMobile();
|
|
31
25
|
const prevIsOpenRef = useRef(isOpen);
|
|
@@ -56,10 +50,7 @@ export function B3DynamicModal() {
|
|
|
56
50
|
"anySpendSignatureMint",
|
|
57
51
|
"anySpendBondKit",
|
|
58
52
|
"linkAccount",
|
|
59
|
-
"linkNewAccount",
|
|
60
53
|
"avatarEditor",
|
|
61
|
-
"deposit",
|
|
62
|
-
"send",
|
|
63
54
|
"profileEditor",
|
|
64
55
|
];
|
|
65
56
|
const freestyleTypes = [
|
|
@@ -76,7 +67,7 @@ export function B3DynamicModal() {
|
|
|
76
67
|
];
|
|
77
68
|
// Check if current content type is in freestyle types
|
|
78
69
|
const isFreestyleType = freestyleTypes.includes(contentType?.type);
|
|
79
|
-
const hideCloseButton =
|
|
70
|
+
const hideCloseButton = isFreestyleType;
|
|
80
71
|
// Build content class using cn utility
|
|
81
72
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
82
73
|
const contentClass = cn("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6");
|
|
@@ -102,7 +93,7 @@ export function B3DynamicModal() {
|
|
|
102
93
|
case "anySpendFundTournament":
|
|
103
94
|
return _jsx(AnySpendTournament, { ...contentType, mode: "modal", action: "fund" });
|
|
104
95
|
case "anySpendOrderHistory":
|
|
105
|
-
return _jsx(OrderHistory, {
|
|
96
|
+
return _jsx(OrderHistory, { onBack: () => { }, mode: "modal" });
|
|
106
97
|
case "anySpendStakeB3":
|
|
107
98
|
return _jsx(AnySpendStakeB3, { ...contentType, mode: "modal" });
|
|
108
99
|
case "anySpendStakeB3ExactIn":
|
|
@@ -119,16 +110,10 @@ export function B3DynamicModal() {
|
|
|
119
110
|
return _jsx(AnySpendBondKit, { ...contentType });
|
|
120
111
|
case "linkAccount":
|
|
121
112
|
return _jsx(LinkAccount, { ...contentType });
|
|
122
|
-
case "linkNewAccount":
|
|
123
|
-
return _jsx(LinkNewAccount, { ...contentType });
|
|
124
113
|
case "anySpendDepositHype":
|
|
125
114
|
return _jsx(AnySpendDepositHype, { ...contentType, mode: "modal" });
|
|
126
115
|
case "avatarEditor":
|
|
127
116
|
return _jsx(AvatarEditor, { onSetAvatar: contentType.onSuccess });
|
|
128
|
-
case "deposit":
|
|
129
|
-
return _jsx(Deposit, {});
|
|
130
|
-
case "send":
|
|
131
|
-
return _jsx(Send, { ...contentType });
|
|
132
117
|
case "profileEditor":
|
|
133
118
|
return _jsx(ProfileEditor, { onSuccess: contentType.onSuccess });
|
|
134
119
|
// Add other modal types here
|
|
@@ -140,13 +125,9 @@ export function B3DynamicModal() {
|
|
|
140
125
|
const ModalContent = isMobile ? DrawerContent : DialogContent;
|
|
141
126
|
const ModalTitle = isMobile ? DrawerTitle : DialogTitle;
|
|
142
127
|
const ModalDescription = isMobile ? DrawerDescription : DialogDescription;
|
|
143
|
-
return (_jsxs(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: [_jsxs(ModalContent, { className: cn(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800",
|
|
144
|
-
contentType?.type === "deposit" ||
|
|
145
|
-
contentType?.type === "send" ||
|
|
146
|
-
contentType?.type === "avatarEditor") &&
|
|
147
|
-
"p-0", "mx-auto w-full max-w-md sm:max-w-lg", // TODO CHECK THIS
|
|
128
|
+
return (_jsxs(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: [_jsxs(ModalContent, { className: cn(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800",
|
|
148
129
|
// Remove default width classes for avatar editor and profile editor
|
|
149
130
|
contentType?.type === "avatarEditor" || contentType?.type === "profileEditor"
|
|
150
131
|
? "!w-[90vw] !max-w-none" // Use !important to override default styles
|
|
151
|
-
: "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [
|
|
132
|
+
: "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [history.length > 0 && contentType?.showBackButton && (_jsxs("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }), (contentType?.type === "avatarEditor" || contentType?.type === "profileEditor") && (_jsx("button", { onClick: () => setB3ModalOpen(false), className: "fixed right-5 top-5 z-[100] cursor-pointer text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
|
|
152
133
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
chain: Chain;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { LinkAccountModalProps } from "../../stores/useModalStore";
|
|
2
|
+
export declare function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, partnerId, className, }: LinkAccountModalProps & {
|
|
3
|
+
className?: string;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,48 +1,109 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import app from "../../../../global-account/app.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
4
|
+
import { thirdwebB3Mainnet } from "../../../../shared/constants/chains/b3Chain.js";
|
|
4
5
|
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useRef, useState } from "react";
|
|
6
|
+
import { Loader2, Mail, Phone, WalletIcon } from "lucide-react";
|
|
7
|
+
import { useCallback, useEffect, useState } from "react";
|
|
8
8
|
import { toast } from "sonner";
|
|
9
|
-
import {
|
|
9
|
+
import { useLinkProfile, useProfiles } from "thirdweb/react";
|
|
10
|
+
import { createWallet, preAuthenticate } from "thirdweb/wallets";
|
|
11
|
+
import { WalletRow } from "../../index.js";
|
|
12
|
+
import { useModalStore } from "../../stores/useModalStore.js";
|
|
10
13
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
import { useB3 } from "../B3Provider/useB3.js";
|
|
15
|
+
import { AppleIcon } from "../icons/AppleIcon.js";
|
|
16
|
+
import { DiscordIcon } from "../icons/DiscordIcon.js";
|
|
17
|
+
import { FarcasterIcon } from "../icons/FarcasterIcon.js";
|
|
18
|
+
import { GoogleIcon } from "../icons/GoogleIcon.js";
|
|
19
|
+
import { XIcon } from "../icons/XIcon.js";
|
|
20
|
+
import { Button } from "../ui/button.js";
|
|
21
|
+
const AUTH_METHODS = [
|
|
22
|
+
{ id: "email", label: "Email", enabled: true, icon: _jsx(Mail, { className: "text-b3-primary-blue size-6" }) },
|
|
23
|
+
{ id: "phone", label: "Phone", enabled: true, icon: _jsx(Phone, { className: "text-b3-primary-blue size-6" }) },
|
|
24
|
+
{ id: "google", label: "Google", enabled: true, icon: _jsx(GoogleIcon, { className: "size-6" }) },
|
|
25
|
+
{ id: "x", label: "X (Twitter)", enabled: true, icon: _jsx(XIcon, { className: "size-6" }) },
|
|
26
|
+
{ id: "discord", label: "Discord", enabled: true, icon: _jsx(DiscordIcon, { className: "size-6" }) },
|
|
27
|
+
{ id: "apple", label: "Apple", enabled: true, icon: _jsx(AppleIcon, { className: "size-6" }) },
|
|
28
|
+
{
|
|
29
|
+
id: "farcaster",
|
|
30
|
+
label: "Farcaster",
|
|
31
|
+
enabled: true,
|
|
32
|
+
icon: _jsx(FarcasterIcon, { className: "size-6" }),
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const WALLET_METHODS = [
|
|
36
|
+
{
|
|
37
|
+
id: "wallet",
|
|
38
|
+
label: "Wallet",
|
|
39
|
+
enabled: true,
|
|
40
|
+
icon: _jsx(WalletIcon, { className: "size-6" }),
|
|
41
|
+
walletType: "com.coinbase.wallet",
|
|
42
|
+
},
|
|
43
|
+
{ id: "wallet", label: "Wallet", enabled: true, icon: _jsx(WalletIcon, { className: "size-6" }), walletType: "io.metamask" },
|
|
44
|
+
{
|
|
45
|
+
id: "wallet",
|
|
46
|
+
label: "Wallet",
|
|
47
|
+
enabled: true,
|
|
48
|
+
icon: _jsx(WalletIcon, { className: "size-6" }),
|
|
49
|
+
walletType: "me.rainbow",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "wallet",
|
|
53
|
+
label: "Wallet",
|
|
54
|
+
enabled: true,
|
|
55
|
+
icon: _jsx(WalletIcon, { className: "size-6" }),
|
|
56
|
+
walletType: "app.phantom",
|
|
57
|
+
},
|
|
58
|
+
{ id: "wallet", label: "Wallet", enabled: true, icon: _jsx(WalletIcon, { className: "size-6" }), walletType: "io.rabby" },
|
|
59
|
+
{
|
|
60
|
+
id: "wallet",
|
|
61
|
+
label: "Wallet",
|
|
62
|
+
enabled: true,
|
|
63
|
+
icon: _jsx(WalletIcon, { className: "size-6" }),
|
|
64
|
+
walletType: "walletConnect",
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
export function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, partnerId, className, }) {
|
|
68
|
+
const { isLinking, linkingMethod, setLinkingState, navigateBack, setB3ModalContentType } = useModalStore();
|
|
69
|
+
const [selectedMethod, setSelectedMethod] = useState(null);
|
|
70
|
+
const [email, setEmail] = useState("");
|
|
71
|
+
const [phone, setPhone] = useState("");
|
|
72
|
+
const [otp, setOtp] = useState("");
|
|
73
|
+
const [otpSent, setOtpSent] = useState(false);
|
|
74
|
+
const [error, setError] = useState(null);
|
|
75
|
+
const { data: profilesRaw = [] } = useProfiles({ client });
|
|
76
|
+
// Get connected auth methods
|
|
77
|
+
const connectedAuthMethods = profilesRaw
|
|
78
|
+
.filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
|
|
79
|
+
.map((profile) => profile.type);
|
|
80
|
+
// Filter available auth methods
|
|
81
|
+
const availableAuthMethods = AUTH_METHODS.filter(method => !connectedAuthMethods.includes(method.id) && method.enabled);
|
|
82
|
+
const profiles = profilesRaw
|
|
83
|
+
.filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
|
|
84
|
+
.map((profile) => ({
|
|
85
|
+
...getProfileDisplayInfo(profile),
|
|
86
|
+
originalProfile: profile,
|
|
87
|
+
}));
|
|
88
|
+
const { account } = useB3();
|
|
89
|
+
const { mutate: linkProfile } = useLinkProfile();
|
|
90
|
+
const onSuccess = useCallback(async () => {
|
|
91
|
+
await onSuccessCallback?.();
|
|
92
|
+
}, [onSuccessCallback]);
|
|
93
|
+
// Reset linking state when component unmounts
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
return () => {
|
|
96
|
+
if (isLinking) {
|
|
97
|
+
setLinkingState(false);
|
|
98
|
+
}
|
|
19
99
|
};
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
displayTitle: title,
|
|
23
|
-
isAddress: false,
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
import ModalHeader from "../ModalHeader/ModalHeader.js";
|
|
27
|
-
export const LinkAccount = ({ partnerId, onLogout, chain, }) => {
|
|
28
|
-
const [unlinkingAccountId, setUnlinkingAccountId] = useState(null);
|
|
29
|
-
const { data: profilesRaw = [], isLoading: isLoadingProfiles } = useProfiles({ client });
|
|
30
|
-
const { mutate: unlinkProfile, isPending: isUnlinking } = useUnlinkProfile();
|
|
31
|
-
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
32
|
-
const isLinking = useModalStore(state => state.isLinking);
|
|
33
|
-
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
34
|
-
const contentType = useModalStore(state => state.contentType);
|
|
35
|
-
const { user, setUser } = useB3();
|
|
36
|
-
const [isUpdatingCode, setIsUpdatingCode] = useState(false);
|
|
37
|
-
const [newReferralCode, setNewReferralCode] = useState("");
|
|
38
|
-
const [isEditingCode, setIsEditingCode] = useState(false);
|
|
39
|
-
const referallCodeRef = useRef(null);
|
|
40
|
-
const { data: referrals, isLoading: isLoadingReferrals } = useQueryB3("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
|
|
41
|
-
const showReferralInfo = contentType?.showReferralInfo ?? false;
|
|
100
|
+
}, [isLinking, setLinkingState]);
|
|
42
101
|
const mutationOptions = {
|
|
43
102
|
onError: (error) => {
|
|
44
|
-
console.error("Error
|
|
103
|
+
console.error("Error linking account:", error);
|
|
45
104
|
toast.error(error.message);
|
|
105
|
+
setLinkingState(false);
|
|
106
|
+
onError?.(error);
|
|
46
107
|
},
|
|
47
108
|
onSuccess: async (data) => {
|
|
48
109
|
console.log("Raw Link Account Data:", data);
|
|
@@ -55,99 +116,205 @@ export const LinkAccount = ({ partnerId, onLogout, chain, }) => {
|
|
|
55
116
|
}
|
|
56
117
|
},
|
|
57
118
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
119
|
+
const validateInput = () => {
|
|
120
|
+
if (selectedMethod === "email") {
|
|
121
|
+
if (!email) {
|
|
122
|
+
setError("Please enter your email address");
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
126
|
+
setError("Please enter a valid email address");
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (selectedMethod === "phone") {
|
|
131
|
+
if (!phone) {
|
|
132
|
+
setError("Please enter your phone number");
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (!/^\+?[\d\s-]{10,}$/.test(phone)) {
|
|
136
|
+
setError("Please enter a valid phone number");
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
setError(null);
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
const handleSendOTP = async () => {
|
|
144
|
+
if (!validateInput())
|
|
145
|
+
return;
|
|
61
146
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
147
|
+
setLinkingState(true, selectedMethod);
|
|
148
|
+
setError(null);
|
|
149
|
+
if (selectedMethod === "email") {
|
|
150
|
+
await preAuthenticate({
|
|
151
|
+
client,
|
|
152
|
+
strategy: "email",
|
|
153
|
+
email,
|
|
154
|
+
ecosystem: {
|
|
155
|
+
id: ecosystemWalletId,
|
|
156
|
+
partnerId: partnerId,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else if (selectedMethod === "phone") {
|
|
161
|
+
await preAuthenticate({
|
|
162
|
+
client,
|
|
163
|
+
strategy: "phone",
|
|
164
|
+
phoneNumber: phone,
|
|
165
|
+
ecosystem: {
|
|
166
|
+
id: ecosystemWalletId,
|
|
167
|
+
partnerId: partnerId,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
setOtpSent(true);
|
|
64
172
|
}
|
|
65
173
|
catch (error) {
|
|
66
|
-
|
|
174
|
+
console.error("Error sending OTP:", error);
|
|
175
|
+
setError(error instanceof Error ? error.message : "Failed to send OTP");
|
|
176
|
+
onError?.(error);
|
|
177
|
+
setLinkingState(false);
|
|
67
178
|
}
|
|
68
179
|
};
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
180
|
+
const handleLinkAccount = async () => {
|
|
181
|
+
if (!otp) {
|
|
182
|
+
console.error("No OTP entered");
|
|
183
|
+
setError("Please enter the verification code");
|
|
71
184
|
return;
|
|
72
|
-
|
|
185
|
+
}
|
|
73
186
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
187
|
+
setOtpSent(false);
|
|
188
|
+
setLinkingState(true, selectedMethod);
|
|
189
|
+
setError(null);
|
|
190
|
+
if (selectedMethod === "email") {
|
|
191
|
+
await linkProfile({
|
|
192
|
+
client,
|
|
193
|
+
strategy: "email",
|
|
194
|
+
email,
|
|
195
|
+
verificationCode: otp,
|
|
196
|
+
}, mutationOptions);
|
|
197
|
+
}
|
|
198
|
+
else if (selectedMethod === "phone") {
|
|
199
|
+
await linkProfile({
|
|
200
|
+
client,
|
|
201
|
+
strategy: "phone",
|
|
202
|
+
phoneNumber: phone,
|
|
203
|
+
verificationCode: otp,
|
|
204
|
+
}, mutationOptions);
|
|
205
|
+
}
|
|
83
206
|
}
|
|
84
207
|
catch (error) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
setIsUpdatingCode(false);
|
|
208
|
+
console.error("Error linking account:", error);
|
|
209
|
+
setError(error instanceof Error ? error.message : "Failed to link account");
|
|
210
|
+
onError?.(error);
|
|
89
211
|
}
|
|
90
212
|
};
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
.
|
|
94
|
-
...getProfileDisplayInfo(profile),
|
|
95
|
-
originalProfile: profile,
|
|
96
|
-
}));
|
|
97
|
-
const handleUnlink = async (profile) => {
|
|
98
|
-
setUnlinkingAccountId(profile.title);
|
|
213
|
+
const handleLinkWallet = async (walletType) => {
|
|
214
|
+
setLinkingState(true, "wallet");
|
|
215
|
+
console.log("selectedMethod", walletType);
|
|
99
216
|
try {
|
|
100
|
-
|
|
217
|
+
if (!walletType) {
|
|
218
|
+
throw new Error("Wallet type not found");
|
|
219
|
+
}
|
|
220
|
+
await linkProfile({
|
|
221
|
+
client,
|
|
222
|
+
strategy: "wallet",
|
|
223
|
+
wallet: createWallet(walletType),
|
|
224
|
+
chain: thirdwebB3Mainnet,
|
|
225
|
+
}, mutationOptions);
|
|
101
226
|
}
|
|
102
227
|
catch (error) {
|
|
103
|
-
console.error("Error
|
|
228
|
+
console.error("Error linking account:", error);
|
|
229
|
+
setError(error instanceof Error ? error.message : "Failed to link account");
|
|
230
|
+
onError?.(error);
|
|
104
231
|
}
|
|
105
|
-
|
|
106
|
-
|
|
232
|
+
};
|
|
233
|
+
const handleSocialLink = async (strategy) => {
|
|
234
|
+
try {
|
|
235
|
+
console.log("handleSocialLink", strategy);
|
|
236
|
+
setLinkingState(true, strategy);
|
|
237
|
+
setError(null);
|
|
238
|
+
const result = await linkProfile({
|
|
239
|
+
client,
|
|
240
|
+
strategy,
|
|
241
|
+
}, mutationOptions);
|
|
242
|
+
console.log("result", result);
|
|
243
|
+
// Don't close the modal yet, wait for auth to complete
|
|
244
|
+
onSuccess?.();
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.error("Error linking with social:", error);
|
|
248
|
+
setError(error instanceof Error ? error.message : "Failed to link social account");
|
|
249
|
+
onError?.(error);
|
|
250
|
+
setLinkingState(false);
|
|
107
251
|
}
|
|
108
252
|
};
|
|
109
|
-
|
|
110
|
-
|
|
253
|
+
// Add effect to handle social auth completion
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
if (isLinking && linkingMethod && !selectedMethod) {
|
|
256
|
+
// This means we're in a social auth flow
|
|
257
|
+
const checkAuthStatus = async () => {
|
|
258
|
+
try {
|
|
259
|
+
// Wait a bit to ensure auth is complete
|
|
260
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
261
|
+
onClose?.();
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
console.error("Error checking auth status:", error);
|
|
265
|
+
setLinkingState(false);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
checkAuthStatus();
|
|
269
|
+
}
|
|
270
|
+
}, [isLinking, linkingMethod, selectedMethod, onClose, setLinkingState]);
|
|
271
|
+
const handleBack = useCallback(() => {
|
|
272
|
+
if (isLinking)
|
|
273
|
+
return;
|
|
274
|
+
setSelectedMethod(null);
|
|
275
|
+
setEmail("");
|
|
276
|
+
setPhone("");
|
|
277
|
+
setOtp("");
|
|
278
|
+
setOtpSent(false);
|
|
279
|
+
setError(null);
|
|
280
|
+
setLinkingState(false);
|
|
281
|
+
}, [isLinking, setSelectedMethod, setEmail, setPhone, setOtp, setOtpSent, setError, setLinkingState]);
|
|
282
|
+
const handleFinishedLinking = useCallback((success) => {
|
|
283
|
+
if (success) {
|
|
284
|
+
onSuccess?.();
|
|
285
|
+
onClose?.();
|
|
286
|
+
}
|
|
287
|
+
setLinkingState(false);
|
|
288
|
+
navigateBack();
|
|
111
289
|
setB3ModalContentType({
|
|
112
|
-
type: "
|
|
113
|
-
|
|
290
|
+
type: "manageAccount",
|
|
291
|
+
activeTab: "settings",
|
|
292
|
+
setActiveTab: () => { },
|
|
114
293
|
chain,
|
|
115
|
-
|
|
116
|
-
// Let the LinkAccount component handle modal closing
|
|
117
|
-
},
|
|
118
|
-
onError: () => {
|
|
119
|
-
// Let the LinkAccount component handle errors
|
|
120
|
-
},
|
|
121
|
-
onClose: () => {
|
|
122
|
-
// Let the LinkAccount component handle closing
|
|
123
|
-
},
|
|
294
|
+
partnerId,
|
|
124
295
|
});
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
referallCodeRef.current?.focus();
|
|
151
|
-
}, 100);
|
|
152
|
-
}, children: _jsx(Pencil, { className: "referral-code-edit-icon h-4 w-4" }) })] })) })] })] }), _jsxs("div", { className: "referred-users-container bg-b3-line rounded-xl p-4", children: [_jsx("div", { className: "referred-users-title text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? (_jsx("div", { className: "referred-users-loading flex justify-center py-4", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? (_jsx("div", { className: "referred-users-list space-y-3", children: referrals.data.map((referral) => (_jsxs("div", { className: "referred-user-item flex items-center justify-between rounded-lg bg-white p-3", children: [_jsx("div", { className: "referred-user-id text-sm font-medium", children: referral.referreeId }), _jsx("div", { className: "referred-user-date text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : (_jsx("div", { className: "referred-users-empty py-4 text-center text-gray-500", children: "No referred users yet" }))] })] }))] }));
|
|
153
|
-
};
|
|
296
|
+
}, [chain, navigateBack, partnerId, setB3ModalContentType, setLinkingState, onSuccess, onClose]);
|
|
297
|
+
useEffect(() => {
|
|
298
|
+
if (isLinking) {
|
|
299
|
+
handleFinishedLinking(true);
|
|
300
|
+
}
|
|
301
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
302
|
+
}, [profiles.length]);
|
|
303
|
+
if (!account) {
|
|
304
|
+
return _jsx("div", { className: "text-b3-foreground-muted py-8 text-center", children: "Please connect your account first" });
|
|
305
|
+
}
|
|
306
|
+
return (_jsxs("div", { className: `b3-link-account space-y-6 p-6 ${className || ""}`, "data-testid": "link-account", children: [_jsxs("div", { className: "b3-link-account-header flex items-center justify-between", children: [_jsx("h2", { className: "b3-link-account-title text-b3-grey font-neue-montreal-semibold text-2xl", children: "Link New Account" }), selectedMethod && (_jsx(Button, { variant: "ghost", className: "text-b3-grey hover:text-b3-grey/80", onClick: handleBack, children: "Backs" }))] }), !selectedMethod ? (_jsxs("div", { className: "b3-link-account-methods grid gap-3", children: [availableAuthMethods.map(method => (_jsx(Button, { variant: "outline", className: "b3-link-account-method-button border-b3-line hover:border-b3-primary-blue/30 hover:bg-b3-primary-blue/5 text-b3-grey font-neue-montreal-medium h-14 justify-start bg-transparent px-6 text-base transition-all duration-200", "data-method": method.id, onClick: () => {
|
|
307
|
+
if (method.id === "email" || method.id === "phone") {
|
|
308
|
+
setSelectedMethod(method.id);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
handleSocialLink(method.id);
|
|
312
|
+
}
|
|
313
|
+
}, disabled: linkingMethod === method.id, children: isLinking && linkingMethod === method.id ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin" })) : (_jsxs("div", { className: "b3-link-account-method-content flex items-center gap-4", children: [_jsx("div", { className: "b3-link-account-method-icon flex items-center justify-center rounded-full", children: method.icon }), _jsx("span", { className: "b3-link-account-method-label font-medium", children: method.label })] })) }, method.id))), WALLET_METHODS.map(method => {
|
|
314
|
+
if (!method.walletType) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
return (_jsx(WalletRow, { walletId: method.walletType, onClick: () => handleLinkWallet(method.walletType), isLoading: isLinking }, method.walletType));
|
|
318
|
+
}), availableAuthMethods.length === 0 && (_jsx("div", { className: "text-b3-foreground-muted py-8 text-center", children: "All available authentication methods have been connected" }))] })) : (_jsxs("div", { className: "b3-link-account-form space-y-4", children: [selectedMethod === "email" && (_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "text-b3-grey font-neue-montreal-medium text-sm", children: "Email Address" }), _jsx("input", { type: "email", placeholder: "Enter your email", className: "bg-b3-line text-b3-grey font-neue-montreal-medium focus:ring-b3-primary-blue/20 w-full rounded-xl p-4 focus:outline-none focus:ring-2", value: email, onChange: e => setEmail(e.target.value), disabled: otpSent || (isLinking && linkingMethod === "email") })] })), selectedMethod === "phone" && (_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "text-b3-grey font-neue-montreal-medium text-sm", children: "Phone Number" }), _jsx("input", { type: "tel", placeholder: "Enter your phone number", className: "bg-b3-line text-b3-grey font-neue-montreal-medium focus:ring-b3-primary-blue/20 w-full rounded-xl p-4 focus:outline-none focus:ring-2", value: phone, onChange: e => setPhone(e.target.value), disabled: otpSent || (isLinking && linkingMethod === "phone") }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Include country code (e.g., +1 for US)" })] })), error && _jsx("div", { className: "text-b3-negative font-neue-montreal-medium py-2 text-sm", children: error }), (selectedMethod === "email" || selectedMethod === "phone") &&
|
|
319
|
+
(otpSent ? (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "text-b3-grey font-neue-montreal-medium text-sm", children: "Verification Code" }), _jsx("input", { type: "text", placeholder: "Enter verification code", className: "bg-b3-line text-b3-grey font-neue-montreal-medium focus:ring-b3-primary-blue/20 w-full rounded-xl p-4 focus:outline-none focus:ring-2", value: otp, onChange: e => setOtp(e.target.value) })] }), _jsx(Button, { className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold h-12 w-full text-white", onClick: handleLinkAccount, children: "Link Account" })] })) : (_jsx(Button, { className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold h-12 w-full text-white", onClick: handleSendOTP, disabled: (!email && !phone) || (isLinking && linkingMethod === selectedMethod), children: isLinking && linkingMethod === selectedMethod ? (_jsx(Loader2, { className: "animate-spin" })) : ("Send Verification Code") })))] }))] }));
|
|
320
|
+
}
|
|
@@ -17,7 +17,6 @@ function centerTruncate(str, length = 4) {
|
|
|
17
17
|
return str;
|
|
18
18
|
return `${str.slice(0, length)}...${str.slice(-length)}`;
|
|
19
19
|
}
|
|
20
|
-
// Deprecated
|
|
21
20
|
export function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
|
|
22
21
|
const account = useActiveAccount();
|
|
23
22
|
const globalAccount = useGlobalAccount();
|
|
@@ -36,7 +35,8 @@ export function BalanceContent({ onLogout, showDeposit = true, showSwap = true }
|
|
|
36
35
|
const handleEditProfile = () => {
|
|
37
36
|
setB3ModalOpen(true);
|
|
38
37
|
setB3ModalContentType({
|
|
39
|
-
type: "
|
|
38
|
+
type: "profileEditor",
|
|
39
|
+
showBackButton: true,
|
|
40
40
|
onSuccess: () => {
|
|
41
41
|
// navigate back on success
|
|
42
42
|
navigateBack();
|