@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
|
@@ -1,31 +1,200 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import app from "../../../../global-account/app.js";
|
|
3
|
+
import { Button, TabsContentPrimitive, TabsListPrimitive, TabsPrimitive, TabTriggerPrimitive, useAccountAssets, useAuthentication, useB3, useGetAllTWSigners, useModalStore, useQueryB3, useRemoveSessionKey, } from "../../../../global-account/react/index.js";
|
|
4
|
+
import { SignOutIcon } from "../../../../global-account/react/components/icons/SignOutIcon.js";
|
|
5
|
+
import { formatNumber } from "../../../../shared/utils/formatNumber.js";
|
|
6
|
+
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
7
|
+
import { truncateAddress } from "../../../../shared/utils/truncateAddress.js";
|
|
8
|
+
import { BarChart3, Coins, Copy, Image, LinkIcon, Loader2, Pencil, Settings, UnlinkIcon } from "lucide-react";
|
|
9
|
+
import { useRef, useState } from "react";
|
|
10
|
+
import { toast } from "sonner";
|
|
11
|
+
import { useActiveAccount, useProfiles, useUnlinkProfile } from "thirdweb/react";
|
|
12
|
+
import { formatUnits } from "viem";
|
|
13
|
+
import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
|
|
14
|
+
import { AccountAssets } from "../AccountAssets/AccountAssets.js";
|
|
15
|
+
import { ContentTokens } from "./ContentTokens.js";
|
|
16
|
+
// Helper function to check if a string is a wallet address and format it
|
|
17
|
+
const formatProfileTitle = (title) => {
|
|
18
|
+
// Check if title looks like an Ethereum address (0x followed by 40 hex characters)
|
|
19
|
+
const isEthereumAddress = /^0x[a-fA-F0-9]{40}$/.test(title);
|
|
20
|
+
if (isEthereumAddress) {
|
|
21
|
+
return {
|
|
22
|
+
displayTitle: truncateAddress(title),
|
|
23
|
+
isAddress: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
displayTitle: title,
|
|
28
|
+
isAddress: false,
|
|
29
|
+
};
|
|
14
30
|
};
|
|
31
|
+
import { BalanceContent } from "./BalanceContent.js";
|
|
15
32
|
export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
const [revokingSignerId, setRevokingSignerId] = useState(null);
|
|
34
|
+
const account = useActiveAccount();
|
|
35
|
+
const { data: nfts, isLoading } = useAccountAssets(account?.address);
|
|
36
|
+
const { data: signers, refetch: refetchSigners } = useGetAllTWSigners({
|
|
37
|
+
chain,
|
|
38
|
+
accountAddress: account?.address,
|
|
39
|
+
});
|
|
40
|
+
const { setB3ModalOpen, contentType } = useModalStore();
|
|
41
|
+
const { activeTab = "overview", setActiveTab } = contentType;
|
|
42
|
+
const { logout } = useAuthentication(partnerId);
|
|
43
|
+
const [logoutLoading, setLogoutLoading] = useState(false);
|
|
44
|
+
const { removeSessionKey } = useRemoveSessionKey({
|
|
45
|
+
chain,
|
|
46
|
+
onSuccess: tx => {
|
|
47
|
+
console.log("@@removeSessionKey:tx", tx);
|
|
48
|
+
setRevokingSignerId(null);
|
|
49
|
+
},
|
|
50
|
+
onError: error => {
|
|
51
|
+
console.error("Error revoking access:", error);
|
|
52
|
+
setRevokingSignerId(null);
|
|
53
|
+
},
|
|
54
|
+
refetchSigners: () => refetchSigners(),
|
|
55
|
+
});
|
|
56
|
+
const handleRevoke = async (signer) => {
|
|
57
|
+
setRevokingSignerId(signer.id);
|
|
58
|
+
await removeSessionKey(signer);
|
|
59
|
+
};
|
|
60
|
+
const onLogoutEnhanced = async () => {
|
|
61
|
+
setLogoutLoading(true);
|
|
62
|
+
await logout();
|
|
63
|
+
onLogout?.();
|
|
64
|
+
setB3ModalOpen(false);
|
|
65
|
+
setLogoutLoading(false);
|
|
66
|
+
};
|
|
67
|
+
const AppsContent = () => (_jsxs("div", { className: "space-y-4", children: [signers?.map((signer) => (_jsx("div", { className: "rounded-xl border border-gray-200 p-4 dark:border-gray-800", children: _jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800", children: _jsx("span", { className: "text-xs font-medium text-gray-600 dark:text-gray-400", children: "App" }) }), _jsxs("div", { children: [_jsx("h3", { className: "font-medium text-gray-900 dark:text-white", children: signer.partner.name }), _jsxs("div", { className: "mt-2 space-y-1", children: [_jsxs("p", { className: "text-xs text-gray-500", children: ["Added ", new Date(signer.createdAt).toLocaleDateString()] }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Expires ", new Date(Number(signer.endTimestamp) * 1000).toLocaleDateString()] }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Max spend: ", formatNumber(Number(formatUnits(signer.nativeTokenLimitPerTransaction, 18))), " ETH"] })] })] })] }), _jsx(Button, { variant: "outline", size: "sm", className: "border-red-200 text-red-500 hover:border-red-300 hover:text-red-600", onClick: () => handleRevoke(signer), disabled: revokingSignerId === signer.id, children: revokingSignerId === signer.id ? "Revoking..." : "Revoke" })] }) }, signer.id))), !signers?.length && _jsx("div", { className: "py-12 text-center text-gray-500", children: "No connected apps" })] }));
|
|
68
|
+
const SettingsContent = () => {
|
|
69
|
+
const [unlinkingAccountId, setUnlinkingAccountId] = useState(null);
|
|
70
|
+
const { data: profilesRaw = [], isLoading: isLoadingProfiles } = useProfiles({ client });
|
|
71
|
+
const { mutate: unlinkProfile, isPending: isUnlinking } = useUnlinkProfile();
|
|
72
|
+
const { setB3ModalOpen, setB3ModalContentType, isLinking, contentType } = useModalStore();
|
|
73
|
+
const { user, setUser } = useB3();
|
|
74
|
+
const [isUpdatingCode, setIsUpdatingCode] = useState(false);
|
|
75
|
+
const [newReferralCode, setNewReferralCode] = useState("");
|
|
76
|
+
const [isEditingCode, setIsEditingCode] = useState(false);
|
|
77
|
+
const referallCodeRef = useRef(null);
|
|
78
|
+
const { data: referrals, isLoading: isLoadingReferrals } = useQueryB3("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
|
|
79
|
+
const showReferralInfo = contentType?.showReferralInfo ?? false;
|
|
80
|
+
const mutationOptions = {
|
|
81
|
+
onError: (error) => {
|
|
82
|
+
console.error("Error Unlinking account:", error);
|
|
83
|
+
toast.error(error.message);
|
|
84
|
+
},
|
|
85
|
+
onSuccess: async (data) => {
|
|
86
|
+
console.log("Raw Link Account Data:", data);
|
|
87
|
+
try {
|
|
88
|
+
console.log("Sync user data...");
|
|
89
|
+
await app.service("users").syncTwProfiles({});
|
|
26
90
|
}
|
|
27
|
-
|
|
28
|
-
|
|
91
|
+
catch (refreshError) {
|
|
92
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
29
93
|
}
|
|
30
|
-
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
// Fetch referred users
|
|
97
|
+
const currentReferralCode = user?.referralCode || user?.userId || "";
|
|
98
|
+
const handleCopyCode = async () => {
|
|
99
|
+
try {
|
|
100
|
+
await navigator.clipboard.writeText(currentReferralCode);
|
|
101
|
+
toast.success("Referral code copied to clipboard!");
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
toast.error("Failed to copy referral code");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleUpdateReferralCode = async () => {
|
|
108
|
+
if (!newReferralCode)
|
|
109
|
+
return;
|
|
110
|
+
setIsUpdatingCode(true);
|
|
111
|
+
try {
|
|
112
|
+
// @ts-expect-error - setReferralCode is not typed for some reason
|
|
113
|
+
const newUser = await app.service("users").setReferralCode({
|
|
114
|
+
userId: user?.userId,
|
|
115
|
+
referralCode: newReferralCode,
|
|
116
|
+
});
|
|
117
|
+
setUser(newUser);
|
|
118
|
+
toast.success("Referral code updated successfully!");
|
|
119
|
+
setIsEditingCode(false);
|
|
120
|
+
setNewReferralCode("");
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
toast.error("Failed to update referral code");
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
setIsUpdatingCode(false);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const profiles = profilesRaw
|
|
130
|
+
.filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
|
|
131
|
+
.map((profile) => ({
|
|
132
|
+
...getProfileDisplayInfo(profile),
|
|
133
|
+
originalProfile: profile,
|
|
134
|
+
}));
|
|
135
|
+
const handleUnlink = async (profile) => {
|
|
136
|
+
setUnlinkingAccountId(profile.title);
|
|
137
|
+
try {
|
|
138
|
+
unlinkProfile({ client, profileToUnlink: profile.originalProfile }, mutationOptions);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error("Error unlinking account:", error);
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
setUnlinkingAccountId(null);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const handleOpenLinkModal = () => {
|
|
148
|
+
setB3ModalOpen(true);
|
|
149
|
+
setB3ModalContentType({
|
|
150
|
+
type: "linkAccount",
|
|
151
|
+
showBackButton: true,
|
|
152
|
+
partnerId,
|
|
153
|
+
chain,
|
|
154
|
+
onSuccess: async () => {
|
|
155
|
+
// Let the LinkAccount component handle modal closing
|
|
156
|
+
},
|
|
157
|
+
onError: () => {
|
|
158
|
+
// Let the LinkAccount component handle errors
|
|
159
|
+
},
|
|
160
|
+
onClose: () => {
|
|
161
|
+
// Let the LinkAccount component handle closing
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
console.log("@@profiles", profiles);
|
|
166
|
+
return (_jsxs("div", { className: "linked-accounts-settings space-y-8", children: [_jsxs("div", { className: "linked-accounts-section space-y-4", children: [_jsxs("div", { className: "linked-accounts-header flex items-center justify-between", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), _jsxs(Button, { className: "linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? (_jsx(Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : (_jsx(LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), _jsx("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? (_jsx("div", { className: "linked-accounts-loading flex justify-center py-8", children: _jsx(Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? (_jsx("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => (_jsxs("div", { className: "linked-account-item bg-b3-line group flex items-center justify-between rounded-xl p-4", children: [_jsxs("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? (_jsx("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : (_jsx("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { className: "linked-account-details", children: [_jsxs("div", { className: "linked-account-title-row flex items-center gap-2", children: [(() => {
|
|
167
|
+
const { displayTitle, isAddress } = formatProfileTitle(profile.title);
|
|
168
|
+
const handleCopyAddress = async (e) => {
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
try {
|
|
171
|
+
await navigator.clipboard.writeText(profile.title);
|
|
172
|
+
toast.success("Address copied to clipboard!");
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
toast.error("Failed to copy address");
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
return (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
|
|
179
|
+
? "font-mono text-sm" // Use monospace font for addresses
|
|
180
|
+
: "break-words" // Use break-words for emails/names (better than break-all)
|
|
181
|
+
}`, title: isAddress ? profile.title : undefined, children: displayTitle }), isAddress && (_jsx("button", { onClick: handleCopyAddress, className: "linked-account-copy-button ml-1 rounded p-1 opacity-0 transition-opacity hover:bg-gray-100 group-hover:opacity-100", title: "Copy full address", children: _jsx(Copy, { size: 12, className: "text-gray-500 hover:text-gray-700" }) }))] }));
|
|
182
|
+
})(), _jsx("span", { className: "linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), _jsx("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), _jsx(Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? (_jsx(Loader2, { className: "linked-account-unlink-loading animate-spin" })) : (_jsx(UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : (_jsx("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
|
|
183
|
+
/* Referral Section */
|
|
184
|
+
_jsxs("div", { className: "referrals-section space-y-4", children: [_jsx("h3", { className: "referrals-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), _jsxs("div", { className: "referral-code-container bg-b3-line rounded-xl p-4", children: [isEditingCode && (_jsxs("div", { className: "referral-code-header-editing", children: [_jsx("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsxs("div", { className: "referral-code-content flex items-center justify-between", children: [!isEditingCode && (_jsxs("div", { className: "referral-code-header", children: [_jsx("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsx("div", { className: "referral-code-actions flex items-center gap-2", children: isEditingCode ? (_jsxs("div", { className: "referral-code-edit-form flex items-center gap-2", children: [_jsx("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), _jsx(Button, { size: "sm", className: "referral-code-save-button", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? (_jsx(Loader2, { className: "referral-code-save-loading h-4 w-4 animate-spin" })) : ("Save") }), _jsx(Button, { size: "sm", variant: "ghost", className: "referral-code-cancel-button", onClick: () => {
|
|
185
|
+
setIsEditingCode(false);
|
|
186
|
+
setNewReferralCode("");
|
|
187
|
+
}, children: "Cancel" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "referral-code-display rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), _jsx(Button, { size: "icon", variant: "ghost", className: "referral-code-copy-button", onClick: handleCopyCode, children: _jsx(Copy, { className: "referral-code-copy-icon h-4 w-4" }) }), _jsx(Button, { size: "icon", variant: "ghost", className: "referral-code-edit-button", onClick: () => {
|
|
188
|
+
setIsEditingCode(true);
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
referallCodeRef.current?.focus();
|
|
191
|
+
}, 100);
|
|
192
|
+
}, 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" }))] })] })), _jsxs("div", { className: "account-preferences-section space-y-4", children: [_jsx("h3", { className: "account-preferences-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), _jsx("div", { className: "account-preferences-container bg-b3-line rounded-xl p-4", children: _jsxs("div", { className: "account-preference-item flex items-center justify-between", children: [_jsxs("div", { className: "account-preference-info", children: [_jsx("div", { className: "account-preference-title text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), _jsx("div", { className: "account-preference-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), _jsx("div", { className: "account-preference-toggle theme-toggle-placeholder bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), _jsxs("button", { className: "logout-button logout-section border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "logout-text font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "logout-icon-container absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "logout-loading animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "logout-icon text-b3-grey" })) })] })] }));
|
|
193
|
+
};
|
|
194
|
+
return (_jsx("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: _jsx("div", { className: "flex-1", children: _jsxs(TabsPrimitive, { defaultValue: activeTab, onValueChange: value => {
|
|
195
|
+
const tab = value;
|
|
196
|
+
if (["overview", "tokens", "nfts", "apps", "settings"].includes(tab)) {
|
|
197
|
+
setActiveTab?.(tab);
|
|
198
|
+
}
|
|
199
|
+
}, children: [_jsx("div", { className: "px-4", children: _jsxs(TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [_jsxs(TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), _jsxs(TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), _jsxs(TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), _jsxs(TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), _jsx(TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: _jsx(BalanceContent, { onLogout: onLogout, showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: _jsx(ContentTokens, { activeTab: activeTab }) }), _jsx(TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: _jsx("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? (_jsx(AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : (_jsx("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), _jsx(TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: _jsx(AppsContent, {}) }), _jsx(TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: _jsx(SettingsContent, {}) })] }) }) }));
|
|
31
200
|
}
|
|
@@ -13,8 +13,6 @@ export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
|
13
13
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
14
14
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
15
15
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
16
|
-
export { Deposit } from "./Deposit/Deposit";
|
|
17
|
-
export { Send } from "./Send/Send";
|
|
18
16
|
export { AvatarEditor } from "./AvatarEditor/AvatarEditor";
|
|
19
17
|
export { ProfileEditor } from "./ProfileEditor/ProfileEditor";
|
|
20
18
|
export { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
@@ -42,8 +40,8 @@ export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
|
42
40
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
43
41
|
export { ShinyButton } from "./ui/ShinyButton";
|
|
44
42
|
export { Skeleton } from "./ui/skeleton";
|
|
45
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive,
|
|
46
|
-
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper
|
|
43
|
+
export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
|
|
44
|
+
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
|
|
47
45
|
export { TextLoop } from "./ui/text-loop";
|
|
48
46
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
49
47
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
|
@@ -16,11 +16,6 @@ export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep.js";
|
|
|
16
16
|
export { getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils.js";
|
|
17
17
|
// ManageAccount Components
|
|
18
18
|
export { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
19
|
-
// Deposit Components
|
|
20
|
-
export { Deposit } from "./Deposit/Deposit.js";
|
|
21
|
-
// Send Components
|
|
22
|
-
export { Send } from "./Send/Send.js";
|
|
23
|
-
// B3 Global Branding Wrapper
|
|
24
19
|
// Profile Components
|
|
25
20
|
export { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
|
|
26
21
|
export { ProfileEditor } from "./ProfileEditor/ProfileEditor.js";
|
|
@@ -56,8 +51,8 @@ export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
|
|
|
56
51
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area.js";
|
|
57
52
|
export { ShinyButton } from "./ui/ShinyButton.js";
|
|
58
53
|
export { Skeleton } from "./ui/skeleton.js";
|
|
59
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive,
|
|
60
|
-
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper
|
|
54
|
+
export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs.js";
|
|
55
|
+
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem.js";
|
|
61
56
|
export { TextLoop } from "./ui/text-loop.js";
|
|
62
57
|
export { TextShimmer } from "./ui/text-shimmer.js";
|
|
63
58
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
@@ -3,10 +3,10 @@ import { cn } from "../../../../shared/utils/index.js";
|
|
|
3
3
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
4
|
export const Tabs = ({ defaultValue, onValueChange, children, }) => (_jsx(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: onValueChange, children: children }));
|
|
5
5
|
export function TabsList({ className, ...props }) {
|
|
6
|
-
return _jsx(TabsPrimitive.List, { className: cn("", className), ...props });
|
|
6
|
+
return (_jsx(TabsPrimitive.List, { className: cn("border-b3-react-border bg-b3-react-background inline-flex h-12 w-full items-center justify-center rounded-lg border", className), ...props }));
|
|
7
7
|
}
|
|
8
8
|
export function TabTrigger({ className, ...props }) {
|
|
9
|
-
return (_jsx(TabsPrimitive.Trigger, { className: cn("
|
|
9
|
+
return (_jsx(TabsPrimitive.Trigger, { className: cn("inline-flex h-full items-center justify-center whitespace-nowrap px-3 text-sm font-medium transition-all", "focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50", "data-[state=active]:bg-b3-react-subtle data-[state=active]:text-b3-react-primary data-[state=active]:font-bold", "border-b3-react-border hover:text-b3-react-foreground data-[state=inactive]:border-b3-react-border data-[state=inactive]:text-b3-react-muted-foreground", "flex-1 border-r", className), ...props }));
|
|
10
10
|
}
|
|
11
11
|
export function TabsContent({ className, ...props }) {
|
|
12
12
|
return (_jsx(TabsPrimitive.Content, { className: cn("ring-offset-b3-react-background focus-visible:ring-b3-react-ring mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", className), ...props }));
|
|
@@ -10,9 +10,9 @@ const DialogPortal = DialogPrimitive.Portal;
|
|
|
10
10
|
const DialogClose = DialogPrimitive.Close;
|
|
11
11
|
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/80 backdrop-blur-[20px]", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:backdrop-blur-none data-[state=open]:backdrop-blur-[20px]", "transition-all duration-300", className), ...props })));
|
|
12
12
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
13
|
-
const DialogContent = React.forwardRef(({ className, children, hideCloseButton =
|
|
13
|
+
const DialogContent = React.forwardRef(({ className, children, hideCloseButton = false, closeBtnClassName, ...props }, ref) => {
|
|
14
14
|
const container = typeof window !== "undefined" ? document.getElementById("b3-root") : null;
|
|
15
|
-
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border shadow-lg !outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", "[perspective:1200px] [transform-style:preserve-3d] sm:rounded-xl", "transition-all ease-out", className), ...props, children: [
|
|
15
|
+
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn("bg-b3-react-background fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border p-6 shadow-lg !outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", "[perspective:1200px] [transform-style:preserve-3d] sm:rounded-xl", "transition-all ease-out", className), ...props, children: [children, !hideCloseButton && (_jsxs(DialogPrimitive.Close, { className: cn("modal-close-button data-[state=open]:bg-b3-react-background data-[state=open]:text-b3-react-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-400", closeBtnClassName), children: [_jsx(X, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
16
16
|
});
|
|
17
17
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
18
18
|
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
|
|
@@ -23,7 +23,7 @@ export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
|
23
23
|
export { useMediaQuery } from "./useMediaQuery";
|
|
24
24
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance";
|
|
25
25
|
export { useOneBalance } from "./useOneBalance";
|
|
26
|
-
export { useProfile, useProfilePreference,
|
|
26
|
+
export { useProfile, useProfilePreference, type CombinedProfile, type PreferenceRequestBody, type Profile, } from "./useProfile";
|
|
27
27
|
export { useQueryB3 } from "./useQueryB3";
|
|
28
28
|
export { useQueryBSMNT } from "./useQueryBSMNT";
|
|
29
29
|
export { useRemoveSessionKey } from "./useRemoveSessionKey";
|
|
@@ -23,7 +23,7 @@ export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
|
23
23
|
export { useMediaQuery } from "./useMediaQuery.js";
|
|
24
24
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance.js";
|
|
25
25
|
export { useOneBalance } from "./useOneBalance.js";
|
|
26
|
-
export { useProfile, useProfilePreference,
|
|
26
|
+
export { useProfile, useProfilePreference, } from "./useProfile.js";
|
|
27
27
|
export { useQueryB3 } from "./useQueryB3.js";
|
|
28
28
|
export { useQueryBSMNT } from "./useQueryBSMNT.js";
|
|
29
29
|
export { useRemoveSessionKey } from "./useRemoveSessionKey.js";
|
|
@@ -74,7 +74,6 @@ export function useB3BalanceFromAddresses(addresses, options) {
|
|
|
74
74
|
enabled: (options?.enabled ?? true) && normalizedAddresses.length > 0,
|
|
75
75
|
refetchInterval: options?.refetchInterval ?? 30000, // Default 30s refresh
|
|
76
76
|
staleTime: 10000, // Consider data stale after 10s
|
|
77
|
-
structuralSharing: false, // Disable structural sharing because data contains BigInt values
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
export default useB3BalanceFromAddresses;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
2
|
export { useModalStore } from "./useModalStore";
|
|
3
|
-
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
4
3
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -77,9 +77,9 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
77
77
|
/** Partner ID */
|
|
78
78
|
partnerId: string;
|
|
79
79
|
/** Active Tab */
|
|
80
|
-
activeTab?: "
|
|
80
|
+
activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
|
|
81
81
|
/** Function to set the active tab */
|
|
82
|
-
setActiveTab?: (tab: "
|
|
82
|
+
setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
|
|
83
83
|
/** Whether to show the referral information */
|
|
84
84
|
showReferralInfo?: boolean;
|
|
85
85
|
/** Whether to show the swap button */
|
|
@@ -325,15 +325,6 @@ export interface LinkAccountModalProps extends BaseModalProps {
|
|
|
325
325
|
partnerId: string;
|
|
326
326
|
chain: Chain;
|
|
327
327
|
}
|
|
328
|
-
export interface LinkNewAccountModalProps extends BaseModalProps {
|
|
329
|
-
type: "linkNewAccount";
|
|
330
|
-
showBackButton?: boolean;
|
|
331
|
-
onSuccess?: () => void;
|
|
332
|
-
onError?: (error: Error) => void;
|
|
333
|
-
onClose?: () => void;
|
|
334
|
-
partnerId: string;
|
|
335
|
-
chain: Chain;
|
|
336
|
-
}
|
|
337
328
|
export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
338
329
|
/** Modal type identifier */
|
|
339
330
|
type: "anySpendDepositHype";
|
|
@@ -366,32 +357,10 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
366
357
|
/** Callback function called when profile is successfully updated */
|
|
367
358
|
onSuccess?: () => void;
|
|
368
359
|
}
|
|
369
|
-
/**
|
|
370
|
-
* Props for the Deposit modal
|
|
371
|
-
* Allows users to deposit tokens into their global account
|
|
372
|
-
*/
|
|
373
|
-
export interface DepositModalProps extends BaseModalProps {
|
|
374
|
-
/** Modal type identifier */
|
|
375
|
-
type: "deposit";
|
|
376
|
-
/** Callback function called when deposit is successful */
|
|
377
|
-
onSuccess?: () => void;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Props for the Send modal
|
|
381
|
-
* Allows users to send tokens from their global account to another address
|
|
382
|
-
*/
|
|
383
|
-
export interface SendModalProps extends BaseModalProps {
|
|
384
|
-
/** Modal type identifier */
|
|
385
|
-
type: "send";
|
|
386
|
-
/** Pre-filled recipient address (optional) */
|
|
387
|
-
recipientAddress?: string;
|
|
388
|
-
/** Callback function called when send is successful */
|
|
389
|
-
onSuccess?: (txHash?: string) => void;
|
|
390
|
-
}
|
|
391
360
|
/**
|
|
392
361
|
* Union type of all possible modal content types
|
|
393
362
|
*/
|
|
394
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps |
|
|
363
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
395
364
|
/**
|
|
396
365
|
* State interface for the modal store
|
|
397
366
|
*/
|
|
@@ -13,8 +13,6 @@ export interface ExtendedProfileDetails {
|
|
|
13
13
|
name?: string;
|
|
14
14
|
username?: string;
|
|
15
15
|
profileImageUrl?: string;
|
|
16
|
-
picture?: string;
|
|
17
|
-
pfpUrl?: string;
|
|
18
16
|
}
|
|
19
17
|
export interface ExtendedProfile extends Omit<Profile, "details"> {
|
|
20
18
|
details: ExtendedProfileDetails;
|
|
@@ -78,7 +78,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
78
78
|
displayInfo = {
|
|
79
79
|
title: details.name || details.username || "Unknown",
|
|
80
80
|
subtitle: details.username ? `@${details.username}` : "Farcaster Account",
|
|
81
|
-
imageUrl: validateImageUrl(details.
|
|
81
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
82
82
|
initial: "F",
|
|
83
83
|
type,
|
|
84
84
|
};
|
|
@@ -87,7 +87,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
87
87
|
displayInfo = {
|
|
88
88
|
title: details.name || details.email || "Unknown",
|
|
89
89
|
subtitle: details.email || "Google Account",
|
|
90
|
-
imageUrl: validateImageUrl(details.
|
|
90
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
91
91
|
initial: "G",
|
|
92
92
|
type,
|
|
93
93
|
};
|
|
@@ -53,10 +53,10 @@ export declare function getCoingeckoChainInfo(chainId: number): {
|
|
|
53
53
|
name: string;
|
|
54
54
|
native_coin_id: string;
|
|
55
55
|
};
|
|
56
|
-
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
56
|
+
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
|
|
57
57
|
rpc: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
59
|
+
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
|
|
60
60
|
rpc: string;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const b3Mainnet: import("viem").Chain;
|