@b3dotfun/sdk 0.0.65-test.5 → 0.0.66
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 +69 -97
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +23 -10
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +45 -14
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +41 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -251
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +3 -5
- 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/OrderTokenAmount.js +2 -10
- 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/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +4 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +5 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +16 -10
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +7 -5
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +13 -9
- package/dist/cjs/anyspend/react/hooks/useCryptoPaymentMethodState.d.ts +42 -0
- package/dist/cjs/anyspend/react/hooks/useCryptoPaymentMethodState.js +51 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +0 -1
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +35 -251
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +15 -23
- 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 +5 -6
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +193 -24
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +141 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -3
- package/dist/cjs/global-account/react/components/index.d.ts +4 -5
- package/dist/cjs/global-account/react/components/index.js +9 -14
- 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/components/ui/drawer.js +1 -1
- 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/useAccountWallet.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -18
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +2 -2
- 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 +26 -31
- 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 +3 -3
- package/dist/cjs/shared/utils/ipfs.js +3 -10
- package/dist/esm/anyspend/react/components/AnySpend.js +70 -98
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +23 -10
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +45 -14
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +38 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -249
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +3 -5
- 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/OrderTokenAmount.js +2 -10
- 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/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +5 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +16 -10
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +7 -5
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +13 -9
- package/dist/esm/anyspend/react/hooks/useCryptoPaymentMethodState.d.ts +42 -0
- package/dist/esm/anyspend/react/hooks/useCryptoPaymentMethodState.js +48 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +0 -1
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +38 -254
- package/dist/esm/global-account/react/components/B3DynamicModal.js +15 -23
- 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 +5 -6
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +195 -26
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -4
- package/dist/esm/global-account/react/components/index.d.ts +4 -5
- package/dist/esm/global-account/react/components/index.js +5 -9
- 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/components/ui/drawer.js +1 -1
- 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/useAccountWallet.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -17
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +2 -2
- 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 +26 -31
- 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 +3 -3
- package/dist/esm/shared/utils/ipfs.js +3 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +11 -0
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +6 -0
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +5 -1
- package/dist/types/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +7 -5
- package/dist/types/anyspend/react/hooks/useCryptoPaymentMethodState.d.ts +42 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +0 -1
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/types/global-account/react/components/index.d.ts +4 -5
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +2 -2
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +26 -31
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/types/shared/constants/chains/supported.d.ts +3 -3
- package/package.json +1 -2
- package/src/anyspend/react/components/AnySpend.tsx +218 -256
- package/src/anyspend/react/components/AnySpendCustom.tsx +31 -16
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +56 -13
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +81 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +36 -524
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -7
- 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/OrderTokenAmount.tsx +2 -13
- 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/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +24 -12
- package/src/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.ts +20 -12
- package/src/anyspend/react/hooks/useCryptoPaymentMethodState.ts +71 -0
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +25 -115
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +128 -477
- package/src/global-account/react/components/B3DynamicModal.tsx +17 -28
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +433 -332
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +10 -6
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +589 -73
- package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +265 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +7 -11
- package/src/global-account/react/components/index.ts +5 -11
- 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/components/ui/drawer.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +0 -3
- package/src/global-account/react/hooks/useAccountWallet.tsx +0 -26
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +0 -1
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +6 -12
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +28 -35
- package/src/global-account/react/utils/profileDisplay.ts +2 -4
- package/src/shared/utils/ipfs.ts +3 -10
- package/src/styles/index.css +9 -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/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +0 -39
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +0 -37
- 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 -47
- 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 -106
- 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 -11
- 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/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +0 -39
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +0 -34
- 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 -45
- 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 -101
- 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 -11
- 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/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +0 -39
- 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 -11
- 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/IPFSMediaRenderer/IPFSMediaRenderer.tsx +0 -84
- 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 -79
- 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 -182
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +0 -41
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +0 -61
- 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
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import app from "../../../../global-account/app.js";
|
|
4
|
+
import { Button, useB3, useProfile } from "../../../../global-account/react/index.js";
|
|
5
|
+
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
6
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
7
|
+
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
8
|
+
import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
|
|
9
|
+
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
10
|
+
import { Check, Loader2, Upload, X } from "lucide-react";
|
|
11
|
+
import { useRef, useState } from "react";
|
|
12
|
+
import { toast } from "sonner";
|
|
13
|
+
import { useActiveAccount } from "thirdweb/react";
|
|
14
|
+
import { upload } from "thirdweb/storage";
|
|
15
|
+
const debug = debugB3React("ProfileEditor");
|
|
16
|
+
export function ProfileEditor({ onSuccess, className }) {
|
|
17
|
+
const [selectedFile, setSelectedFile] = useState(null);
|
|
18
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
19
|
+
const [username, setUsername] = useState("");
|
|
20
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
21
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
22
|
+
const fileInputRef = useRef(null);
|
|
23
|
+
const { user, setUser } = useB3();
|
|
24
|
+
const account = useActiveAccount();
|
|
25
|
+
const { data: profile, refetch: refreshProfile } = useProfile({
|
|
26
|
+
address: account?.address,
|
|
27
|
+
fresh: true,
|
|
28
|
+
});
|
|
29
|
+
const rawAvatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profile?.avatar;
|
|
30
|
+
const avatarUrl = validateImageUrl(rawAvatarUrl);
|
|
31
|
+
const safePreviewUrl = validateImageUrl(previewUrl);
|
|
32
|
+
const hasAvatar = !!avatarUrl;
|
|
33
|
+
const currentUsername = user?.username || "";
|
|
34
|
+
const handleFileSelect = (event) => {
|
|
35
|
+
const file = event.target.files?.[0];
|
|
36
|
+
if (file) {
|
|
37
|
+
// Validate file type
|
|
38
|
+
if (!file.type.startsWith("image/")) {
|
|
39
|
+
toast.error("Please select an image file");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Validate file size (max 5MB)
|
|
43
|
+
if (file.size > 5 * 1024 * 1024) {
|
|
44
|
+
toast.error("File size must be less than 5MB");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setSelectedFile(file);
|
|
48
|
+
// Create preview URL
|
|
49
|
+
const url = URL.createObjectURL(file);
|
|
50
|
+
setPreviewUrl(url);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const handleRemoveFile = () => {
|
|
54
|
+
setSelectedFile(null);
|
|
55
|
+
if (previewUrl) {
|
|
56
|
+
URL.revokeObjectURL(previewUrl);
|
|
57
|
+
setPreviewUrl(null);
|
|
58
|
+
}
|
|
59
|
+
if (fileInputRef.current) {
|
|
60
|
+
fileInputRef.current.value = "";
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleSave = async () => {
|
|
64
|
+
// Check if there are any changes
|
|
65
|
+
const hasAvatarChange = selectedFile !== null;
|
|
66
|
+
const hasUsernameChange = username.trim() !== "" && username !== currentUsername;
|
|
67
|
+
if (!hasAvatarChange && !hasUsernameChange) {
|
|
68
|
+
toast.error("Please make at least one change");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setIsSaving(true);
|
|
72
|
+
try {
|
|
73
|
+
let ipfsUrl;
|
|
74
|
+
// Upload avatar if selected
|
|
75
|
+
if (hasAvatarChange && selectedFile) {
|
|
76
|
+
debug("Starting upload to IPFS", selectedFile);
|
|
77
|
+
setIsUploading(true);
|
|
78
|
+
ipfsUrl = await upload({
|
|
79
|
+
client,
|
|
80
|
+
files: [selectedFile],
|
|
81
|
+
});
|
|
82
|
+
debug("Upload successful", ipfsUrl);
|
|
83
|
+
setIsUploading(false);
|
|
84
|
+
}
|
|
85
|
+
// Update user profile
|
|
86
|
+
let updatedUser = user;
|
|
87
|
+
// If both avatar and username need updating, do them sequentially
|
|
88
|
+
// Update avatar first if uploaded
|
|
89
|
+
if (ipfsUrl) {
|
|
90
|
+
// @ts-expect-error this resolved fine, look into why expect-error needed
|
|
91
|
+
updatedUser = await app.service("users").setAvatar({
|
|
92
|
+
avatar: ipfsUrl,
|
|
93
|
+
},
|
|
94
|
+
// @ts-expect-error - our typed client is expecting context even though it's set elsewhere
|
|
95
|
+
{});
|
|
96
|
+
}
|
|
97
|
+
// Update username if changed (this will use the updated user from avatar change if both were updated)
|
|
98
|
+
if (hasUsernameChange && user?._id) {
|
|
99
|
+
// @ts-expect-error this resolved fine, look into why expect-error needed
|
|
100
|
+
updatedUser = await app.service("users").registerUsername({ username: username },
|
|
101
|
+
// @ts-expect-error - our typed client is expecting context even though it's set elsewhere
|
|
102
|
+
{});
|
|
103
|
+
}
|
|
104
|
+
// Update user state
|
|
105
|
+
setUser(updatedUser);
|
|
106
|
+
// Refresh profile to get updated data
|
|
107
|
+
await refreshProfile();
|
|
108
|
+
// Show success message
|
|
109
|
+
const changes = [];
|
|
110
|
+
if (hasAvatarChange)
|
|
111
|
+
changes.push("avatar");
|
|
112
|
+
if (hasUsernameChange)
|
|
113
|
+
changes.push("username");
|
|
114
|
+
toast.success(`Successfully updated ${changes.join(" and ")}!`);
|
|
115
|
+
onSuccess?.();
|
|
116
|
+
// Clean up
|
|
117
|
+
handleRemoveFile();
|
|
118
|
+
setUsername("");
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
debug("Error updating profile:", error);
|
|
122
|
+
toast.error("Failed to update profile. Please try again.");
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
setIsUploading(false);
|
|
126
|
+
setIsSaving(false);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const handleFileInputClick = () => {
|
|
130
|
+
fileInputRef.current?.click();
|
|
131
|
+
};
|
|
132
|
+
const isLoading = isUploading || isSaving;
|
|
133
|
+
const hasChanges = selectedFile !== null || (username.trim() !== "" && username !== currentUsername);
|
|
134
|
+
return (_jsxs("div", { className: cn("flex flex-col items-center justify-center space-y-6 p-8", className), children: [_jsxs("div", { className: "space-y-2 text-center", children: [_jsx("h2", { className: "font-neue-montreal-semibold text-b3-grey text-2xl", children: "Edit Your Profile" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium", children: "Update your avatar and username" })] }), _jsxs("div", { className: "w-full max-w-md space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: "Avatar" }), _jsx("div", { className: "flex justify-center", children: safePreviewUrl || avatarUrl ? (_jsxs("div", { className: "relative", children: [_jsx("div", { className: "border-b3-primary-blue h-32 w-32 overflow-hidden rounded-full border-4", children: _jsx("img", { src: safePreviewUrl || avatarUrl || "", alt: safePreviewUrl ? "Preview" : "Current avatar", className: "h-full w-full object-cover" }) }), safePreviewUrl && (_jsx("button", { onClick: handleRemoveFile, className: "bg-b3-negative absolute -right-2 -top-2 flex h-8 w-8 items-center justify-center rounded-full text-white transition-colors hover:bg-red-600", disabled: isLoading, children: _jsx(X, { size: 16 }) }))] })) : (_jsx("div", { className: "bg-b3-primary-wash h-32 w-32 rounded-full" })) }), !selectedFile && (_jsxs(Button, { variant: "outline", onClick: handleFileInputClick, disabled: isLoading, className: "w-full", children: [_jsx(Upload, { className: "mr-2 h-4 w-4" }), hasAvatar ? "Change Avatar" : "Upload Avatar"] })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx("label", { htmlFor: "username", className: "text-b3-grey font-neue-montreal-semibold text-sm", children: "Username" }), _jsx("input", { id: "username", type: "text", value: username, onChange: e => setUsername(e.target.value), placeholder: currentUsername || "Enter username", className: "border-b3-line bg-b3-background text-b3-grey placeholder:text-b3-foreground-muted font-neue-montreal-medium focus:border-b3-primary-blue w-full rounded-lg border px-4 py-3 transition-colors focus:outline-none", disabled: isLoading }), currentUsername && (_jsxs("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-xs", children: ["Current: ", currentUsername] }))] })] }), _jsx("div", { className: "flex w-full max-w-md gap-3", children: _jsx(Button, { onClick: handleSave, disabled: isLoading || !hasChanges, className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 flex-1 text-white disabled:opacity-50", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isUploading ? "Uploading..." : "Saving..."] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "mr-2 h-4 w-4" }), "Save Changes"] })) }) }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium max-w-md text-center text-xs", children: _jsx("p", { children: "Your avatar will be uploaded to IPFS and stored securely. Make sure you have the rights to use this image." }) })] }));
|
|
135
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3, useIsMobile, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import Icon from "../../../../global-account/react/components/custom/Icon.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { cn, truncateAddress } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { Menu, MenuButton, MenuItems, Transition } from "@headlessui/react";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
8
|
import { useConnectedWallets, useSetActiveWallet, useWalletInfo } from "thirdweb/react";
|
|
9
|
-
import { useAccountWalletImage } from "../../hooks/useAccountWallet.js";
|
|
10
9
|
import { ManageAccountButton } from "../custom/ManageAccountButton.js";
|
|
11
10
|
export function SignIn(props) {
|
|
12
11
|
const { className } = props;
|
|
@@ -35,9 +34,8 @@ export function SignIn(props) {
|
|
|
35
34
|
setActiveWallet(connectedEOAWallet);
|
|
36
35
|
}
|
|
37
36
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
38
|
-
const walletImage = useAccountWalletImage();
|
|
39
37
|
// Desktop version - original dropdown menu
|
|
40
|
-
return (_jsx(StyleRoot, { children: _jsx(Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? (_jsxs(_Fragment, { children: [_jsxs(MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3
|
|
38
|
+
return (_jsx(StyleRoot, { children: _jsx(Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? (_jsxs(_Fragment, { children: [_jsxs(MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3", children: [!!wallet.meta?.icon && (_jsx("img", { src: wallet.meta.icon, alt: wallet.meta.icon, className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" })), _jsx("div", { className: "text-as-primary", children: ensName ? ensName : truncateAddress(globalAddress) })] }), _jsx(Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: _jsx(MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border lg:right-0", modal: false,
|
|
41
39
|
// TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
|
|
42
40
|
anchor: isMobile ? "top end" : undefined, children: _jsxs("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? (_jsxs("div", { className: cn("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), _jsxs("div", { className: "ml-4 grow", children: [ensName && _jsx("div", { children: ensName }), _jsx("div", { children: truncateAddress(globalAddress) }), _jsx("div", { children: walletInfo?.name })] })] }), isActiveEOAWallet && _jsx(Icon, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && (_jsxs("div", { className: cn("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
|
|
43
41
|
? "bg-b3-react-background"
|
|
@@ -13,9 +13,8 @@ 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 {
|
|
17
|
-
export {
|
|
18
|
-
export { IPFSMediaRenderer } from "./IPFSMediaRenderer/IPFSMediaRenderer";
|
|
16
|
+
export { AvatarEditor } from "./AvatarEditor/AvatarEditor";
|
|
17
|
+
export { ProfileEditor } from "./ProfileEditor/ProfileEditor";
|
|
19
18
|
export { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
20
19
|
export { RequestPermissionsButton } from "./RequestPermissions/RequestPermissionsButton";
|
|
21
20
|
export { AccountAssets } from "./AccountAssets/AccountAssets";
|
|
@@ -41,8 +40,8 @@ export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
|
41
40
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
42
41
|
export { ShinyButton } from "./ui/ShinyButton";
|
|
43
42
|
export { Skeleton } from "./ui/skeleton";
|
|
44
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive,
|
|
45
|
-
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";
|
|
46
45
|
export { TextLoop } from "./ui/text-loop";
|
|
47
46
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
48
47
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
2
1
|
// Core Components
|
|
3
2
|
export { B3DynamicModal } from "./B3DynamicModal.js";
|
|
4
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
|
|
@@ -17,12 +16,9 @@ export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep.js";
|
|
|
17
16
|
export { getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils.js";
|
|
18
17
|
// ManageAccount Components
|
|
19
18
|
export { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
20
|
-
//
|
|
21
|
-
export {
|
|
22
|
-
|
|
23
|
-
export { Send } from "./Send/Send.js";
|
|
24
|
-
// Media Components
|
|
25
|
-
export { IPFSMediaRenderer } from "./IPFSMediaRenderer/IPFSMediaRenderer.js";
|
|
19
|
+
// Profile Components
|
|
20
|
+
export { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
|
|
21
|
+
export { ProfileEditor } from "./ProfileEditor/ProfileEditor.js";
|
|
26
22
|
// RequestPermissions Components
|
|
27
23
|
export { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
|
|
28
24
|
export { RequestPermissionsButton } from "./RequestPermissions/RequestPermissionsButton.js";
|
|
@@ -55,8 +51,8 @@ export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
|
|
|
55
51
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area.js";
|
|
56
52
|
export { ShinyButton } from "./ui/ShinyButton.js";
|
|
57
53
|
export { Skeleton } from "./ui/skeleton.js";
|
|
58
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive,
|
|
59
|
-
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";
|
|
60
56
|
export { TextLoop } from "./ui/text-loop.js";
|
|
61
57
|
export { TextShimmer } from "./ui/text-shimmer.js";
|
|
62
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 }));
|
|
@@ -12,7 +12,7 @@ const DrawerOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(D
|
|
|
12
12
|
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
|
|
13
13
|
const DrawerContent = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
14
14
|
const container = typeof window !== "undefined" ? document.getElementById("b3-root") : null;
|
|
15
|
-
return (_jsxs(DrawerPortal, { container: container, children: [_jsx(DrawerOverlay, {}), _jsx(DrawerPrimitive.Content, { ref: ref, className: cn("bg-b3-react-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border py-6
|
|
15
|
+
return (_jsxs(DrawerPortal, { container: container, children: [_jsx(DrawerOverlay, {}), _jsx(DrawerPrimitive.Content, { ref: ref, className: cn("bg-b3-react-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border py-6", className), ...props, children: children })] }));
|
|
16
16
|
});
|
|
17
17
|
DrawerContent.displayName = "DrawerContent";
|
|
18
18
|
const DrawerHeader = ({ className, ...props }) => (_jsx("div", { className: cn("grid gap-1.5 p-4 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";
|
|
@@ -69,20 +69,3 @@ export function useAccountWallet() {
|
|
|
69
69
|
]);
|
|
70
70
|
return res;
|
|
71
71
|
}
|
|
72
|
-
export function useAccountWalletImage() {
|
|
73
|
-
const { account, user } = useB3();
|
|
74
|
-
const activeWallet = useActiveWallet();
|
|
75
|
-
const connectedWallets = useConnectedWallets();
|
|
76
|
-
const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
|
|
77
|
-
const connectedEOAWallet = connectedWallets.find(wallet => wallet.id !== ecosystemWalletId);
|
|
78
|
-
const isActiveSmartWallet = activeWallet?.id === connectedSmartWallet?.id;
|
|
79
|
-
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
80
|
-
// If not EOA sign in, then we need to show the smart wallet icon
|
|
81
|
-
const lastAuthProvider = useLastAuthProvider();
|
|
82
|
-
const smartWalletIcon = lastAuthProvider && !connectedEOAWallet
|
|
83
|
-
? socialIcons[lastAuthProvider]
|
|
84
|
-
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
85
|
-
const { data: profileData } = useProfile({ address: account?.address });
|
|
86
|
-
const avatarUrl = user?.avatar || profileData?.avatar;
|
|
87
|
-
return avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "";
|
|
88
|
-
}
|