@b3dotfun/sdk 0.0.73 → 0.0.74-alpha.0
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 +75 -50
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +9 -10
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -41
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +17 -9
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +7 -8
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +7 -8
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +18 -14
- 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/InsufficientDepositPayment.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +35 -35
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +7 -3
- package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +8 -9
- 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/common/TransferCryptoDetails.js +2 -3
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +12 -12
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -5
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +17 -17
- package/dist/cjs/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/cjs/anyspend/react/utils/toast.js +9 -0
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +2 -3
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +275 -39
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +40 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +19 -3
- package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/cjs/global-account/react/components/Deposit/Deposit.js +61 -0
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +34 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +104 -283
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +320 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +44 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +23 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +120 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +43 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +16 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +16 -194
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +15 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.js +13 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.js +152 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +47 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +60 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +8 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +116 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +44 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +48 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +68 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +79 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +79 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/index.js +11 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +12 -0
- package/dist/cjs/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/cjs/global-account/react/components/Send/Send.js +195 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +5 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
- package/dist/cjs/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/cjs/global-account/react/components/Toast/ToastComponents.js +54 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +59 -0
- package/dist/cjs/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/cjs/global-account/react/components/Toast/index.js +12 -0
- package/dist/cjs/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/cjs/global-account/react/components/Toast/toastApi.js +93 -0
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.js +13 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.js +7 -0
- package/dist/cjs/global-account/react/components/index.d.ts +10 -4
- package/dist/cjs/global-account/react/components/index.js +29 -9
- 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 +3 -2
- package/dist/cjs/global-account/react/hooks/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +18 -0
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +11 -11
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/cjs/global-account/react/hooks/useNotifications.js +189 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +3 -3
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +17 -17
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +36 -0
- package/dist/cjs/global-account/react/utils/index.d.ts +4 -0
- package/dist/cjs/global-account/react/utils/index.js +20 -0
- package/dist/cjs/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/cjs/global-account/react/utils/notificationsAPI.js +257 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.js +8 -4
- package/dist/cjs/global-account/react/utils/toast.d.ts +6 -0
- package/dist/cjs/global-account/react/utils/toast.js +9 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +3 -2
- package/dist/cjs/shared/constants/chains/supported.js +4 -0
- package/dist/cjs/shared/utils/ipfs.js +10 -3
- package/dist/esm/anyspend/react/components/AnySpend.js +67 -42
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +10 -10
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -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/InsufficientDepositPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +6 -5
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -3
- 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/common/TransferCryptoDetails.js +1 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -2
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +1 -1
- package/dist/esm/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/esm/anyspend/react/utils/toast.js +5 -0
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +1 -2
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +276 -40
- package/dist/esm/global-account/react/components/B3DynamicModal.js +37 -13
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -3
- package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/esm/global-account/react/components/Deposit/Deposit.js +55 -0
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +31 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +103 -283
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +314 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +42 -0
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +21 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
- package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +81 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +41 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +10 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +18 -196
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +13 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.js +9 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.js +147 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +45 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +55 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +111 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +42 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +44 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +64 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +75 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +75 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/index.js +4 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +10 -0
- package/dist/esm/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/esm/global-account/react/components/Send/Send.js +189 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +7 -6
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
- package/dist/esm/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/esm/global-account/react/components/Toast/ToastComponents.js +50 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +55 -0
- package/dist/esm/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/esm/global-account/react/components/Toast/index.js +3 -0
- package/dist/esm/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/esm/global-account/react/components/Toast/toastApi.js +89 -0
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.js +11 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.js +4 -0
- package/dist/esm/global-account/react/components/index.d.ts +10 -4
- package/dist/esm/global-account/react/components/index.js +14 -5
- 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 +3 -2
- package/dist/esm/global-account/react/hooks/index.js +3 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +17 -0
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
- package/dist/esm/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/esm/global-account/react/hooks/useNotifications.js +186 -0
- package/dist/esm/global-account/react/hooks/useSimBalance.js +3 -3
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +33 -0
- package/dist/esm/global-account/react/utils/index.d.ts +4 -0
- package/dist/esm/global-account/react/utils/index.js +4 -0
- package/dist/esm/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/esm/global-account/react/utils/notificationsAPI.js +254 -0
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/esm/global-account/react/utils/profileDisplay.js +8 -4
- package/dist/esm/global-account/react/utils/toast.d.ts +6 -0
- package/dist/esm/global-account/react/utils/toast.js +5 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +3 -2
- package/dist/esm/shared/constants/chains/supported.js +3 -0
- package/dist/esm/shared/utils/ipfs.js +10 -3
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/types/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/types/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/types/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/types/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/types/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/types/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/index.d.ts +10 -4
- package/dist/types/global-account/react/hooks/index.d.ts +3 -2
- package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/types/global-account/react/utils/index.d.ts +4 -0
- package/dist/types/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/types/global-account/react/utils/toast.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +3 -2
- package/package.json +2 -1
- package/src/anyspend/react/components/AnySpend.tsx +213 -173
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +80 -77
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +20 -4
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -1
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -22
- 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/InsufficientDepositPayment.tsx +1 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -2
- package/src/anyspend/react/components/common/OrderHistory.tsx +8 -13
- package/src/anyspend/react/components/common/OrderHistoryItem.tsx +69 -25
- package/src/anyspend/react/components/common/PanelOnramp.tsx +6 -4
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +3 -3
- 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/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +3 -3
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +2 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +2 -1
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +3 -2
- package/src/anyspend/react/hooks/usePhantomTransfer.ts +1 -1
- package/src/anyspend/react/utils/toast.ts +6 -0
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +115 -25
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +2 -2
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +491 -130
- package/src/global-account/react/components/B3DynamicModal.tsx +76 -17
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +40 -20
- package/src/global-account/react/components/Deposit/Deposit.tsx +208 -0
- package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +84 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +269 -434
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +480 -0
- package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +135 -0
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +83 -0
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/Header.tsx +230 -0
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +118 -0
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +42 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +74 -597
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +24 -0
- package/src/global-account/react/components/ManageAccount/NotificationChannel.tsx +94 -0
- package/src/global-account/react/components/ManageAccount/NotificationsContent.tsx +268 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +79 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +106 -0
- package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +31 -0
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +197 -0
- package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +20 -5
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +66 -0
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +119 -0
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +168 -0
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +227 -0
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +150 -0
- package/src/global-account/react/components/ManageAccount/channels/index.ts +4 -0
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +61 -0
- package/src/global-account/react/components/Send/Send.tsx +621 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +13 -12
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -1
- package/src/global-account/react/components/Toast/README.md +350 -0
- package/src/global-account/react/components/Toast/ToastComponents.tsx +159 -0
- package/src/global-account/react/components/Toast/ToastContext.tsx +86 -0
- package/src/global-account/react/components/Toast/index.ts +4 -0
- package/src/global-account/react/components/Toast/toastApi.ts +98 -0
- package/src/global-account/react/components/WalletImage/WalletImage.tsx +12 -0
- package/src/global-account/react/components/icons/BellIcon.tsx +15 -0
- package/src/global-account/react/components/icons/ChevronDownIcon.tsx +17 -0
- package/src/global-account/react/components/icons/CopyIcon.tsx +22 -0
- package/src/global-account/react/components/icons/LinkIcon.tsx +15 -0
- package/src/global-account/react/components/icons/LockIcon.tsx +15 -0
- package/src/global-account/react/components/icons/WalletIcon.tsx +21 -0
- package/src/global-account/react/components/index.ts +19 -5
- package/src/global-account/react/components/ui/Tabs.tsx +5 -13
- package/src/global-account/react/components/ui/dialog.tsx +23 -14
- package/src/global-account/react/components/ui/drawer.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +5 -1
- package/src/global-account/react/hooks/useAccountWallet.tsx +26 -0
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +1 -0
- package/src/global-account/react/hooks/useChainSwitchWithAction.ts +3 -2
- package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
- package/src/global-account/react/hooks/useNotifications.ts +229 -0
- package/src/global-account/react/hooks/useSimBalance.ts +3 -3
- package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +2 -0
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -2
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +53 -6
- package/src/global-account/react/stores/useRecentAddressesStore.ts +54 -0
- package/src/global-account/react/utils/index.ts +4 -0
- package/src/global-account/react/utils/notificationsAPI.ts +305 -0
- package/src/global-account/react/utils/profileDisplay.ts +12 -4
- package/src/global-account/react/utils/toast.ts +6 -0
- package/src/shared/constants/chains/supported.ts +4 -0
- package/src/shared/utils/ipfs.ts +10 -3
- package/src/styles/index.css +12 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +0 -107
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -151
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +0 -104
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -145
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +0 -258
- package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +0 -279
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notificationsAPI = void 0;
|
|
4
|
+
const debug_1 = require("../../../shared/utils/debug");
|
|
5
|
+
const debug = (0, debug_1.debugB3React)("notificationsAPI");
|
|
6
|
+
const API_URL = "https://notifications.b3.fun";
|
|
7
|
+
exports.notificationsAPI = {
|
|
8
|
+
/**
|
|
9
|
+
* Register user (requires JWT)
|
|
10
|
+
*/
|
|
11
|
+
async registerUser(jwtToken) {
|
|
12
|
+
const res = await fetch(`${API_URL}/users`, {
|
|
13
|
+
method: "POST",
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
throw new Error(`Failed to register user: ${res.statusText}`);
|
|
21
|
+
}
|
|
22
|
+
return res.json();
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Get user data (requires JWT)
|
|
26
|
+
*/
|
|
27
|
+
async getUser(userId, jwtToken) {
|
|
28
|
+
const res = await fetch(`${API_URL}/users/${userId}`, {
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
throw new Error(`Failed to get user: ${res.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
return res.json();
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Connect email (requires JWT)
|
|
40
|
+
*/
|
|
41
|
+
async connectEmail(userId, email, jwtToken) {
|
|
42
|
+
const res = await fetch(`${API_URL}/users/${userId}/channels`, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
channelType: "email",
|
|
50
|
+
channelIdentifier: email,
|
|
51
|
+
enabled: true,
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
if (!res.ok) {
|
|
55
|
+
throw new Error(`Failed to connect email: ${res.statusText}`);
|
|
56
|
+
}
|
|
57
|
+
return res.json();
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Connect SMS (requires JWT)
|
|
61
|
+
*/
|
|
62
|
+
async connectSMS(userId, phoneNumber, jwtToken) {
|
|
63
|
+
const res = await fetch(`${API_URL}/users/${userId}/channels`, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: {
|
|
66
|
+
"Content-Type": "application/json",
|
|
67
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
channelType: "sms",
|
|
71
|
+
channelIdentifier: phoneNumber,
|
|
72
|
+
enabled: true,
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
if (!res.ok) {
|
|
76
|
+
throw new Error(`Failed to connect SMS: ${res.statusText}`);
|
|
77
|
+
}
|
|
78
|
+
return res.json();
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Connect WhatsApp (requires JWT)
|
|
82
|
+
*/
|
|
83
|
+
async connectWhatsApp(userId, phoneNumber, jwtToken) {
|
|
84
|
+
const res = await fetch(`${API_URL}/users/${userId}/channels`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: {
|
|
87
|
+
"Content-Type": "application/json",
|
|
88
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
89
|
+
},
|
|
90
|
+
body: JSON.stringify({
|
|
91
|
+
channelType: "whatsapp",
|
|
92
|
+
channelIdentifier: phoneNumber,
|
|
93
|
+
enabled: true,
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
96
|
+
if (!res.ok) {
|
|
97
|
+
throw new Error(`Failed to connect WhatsApp: ${res.statusText}`);
|
|
98
|
+
}
|
|
99
|
+
return res.json();
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Connect Discord (requires JWT)
|
|
103
|
+
*/
|
|
104
|
+
async connectDiscord(userId, discordUserId, jwtToken) {
|
|
105
|
+
const res = await fetch(`${API_URL}/users/${userId}/channels`, {
|
|
106
|
+
method: "POST",
|
|
107
|
+
headers: {
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify({
|
|
112
|
+
channelType: "discord",
|
|
113
|
+
channelIdentifier: discordUserId,
|
|
114
|
+
enabled: true,
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
if (!res.ok) {
|
|
118
|
+
throw new Error(`Failed to connect Discord: ${res.statusText}`);
|
|
119
|
+
}
|
|
120
|
+
return res.json();
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* Disconnect a channel (requires JWT)
|
|
124
|
+
* Looks up the channel ID by type and deletes it
|
|
125
|
+
*/
|
|
126
|
+
async disconnectChannel(userId, channelType, jwtToken) {
|
|
127
|
+
// First, get user data to find the channel ID
|
|
128
|
+
const userData = await this.getUser(userId, jwtToken);
|
|
129
|
+
const channel = userData.channels.find((c) => c.channel_type === channelType);
|
|
130
|
+
if (!channel) {
|
|
131
|
+
throw new Error(`Channel ${channelType} not found`);
|
|
132
|
+
}
|
|
133
|
+
// Delete using the channel ID
|
|
134
|
+
const res = await fetch(`${API_URL}/users/${userId}/channels/${channel.id}`, {
|
|
135
|
+
method: "DELETE",
|
|
136
|
+
headers: {
|
|
137
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
if (!res.ok) {
|
|
141
|
+
throw new Error(`Failed to disconnect channel: ${res.statusText}`);
|
|
142
|
+
}
|
|
143
|
+
return res.json();
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Get Telegram deep link (requires JWT)
|
|
147
|
+
*/
|
|
148
|
+
async getTelegramLink(jwtToken) {
|
|
149
|
+
const res = await fetch(`${API_URL}/telegram/request-link`, {
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: {
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
if (!res.ok) {
|
|
157
|
+
throw new Error(`Failed to get Telegram link: ${res.statusText}`);
|
|
158
|
+
}
|
|
159
|
+
return res.json();
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Check Telegram status (requires JWT)
|
|
163
|
+
*/
|
|
164
|
+
async checkTelegramStatus(userId, jwtToken) {
|
|
165
|
+
const res = await fetch(`${API_URL}/telegram/status/${userId}`, {
|
|
166
|
+
headers: {
|
|
167
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
if (!res.ok) {
|
|
171
|
+
throw new Error(`Failed to check Telegram status: ${res.statusText}`);
|
|
172
|
+
}
|
|
173
|
+
return res.json();
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Save notification preferences (requires JWT)
|
|
177
|
+
*/
|
|
178
|
+
async savePreferences(userId, appId, settings, jwtToken) {
|
|
179
|
+
const res = await fetch(`${API_URL}/users/${userId}/apps/${appId}/settings`, {
|
|
180
|
+
method: "POST",
|
|
181
|
+
headers: {
|
|
182
|
+
"Content-Type": "application/json",
|
|
183
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
184
|
+
},
|
|
185
|
+
body: JSON.stringify({
|
|
186
|
+
...settings,
|
|
187
|
+
enabled: true,
|
|
188
|
+
}),
|
|
189
|
+
});
|
|
190
|
+
if (!res.ok) {
|
|
191
|
+
throw new Error(`Failed to save preferences: ${res.statusText}`);
|
|
192
|
+
}
|
|
193
|
+
return res.json();
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Ensure notification settings exist for a user/app/type combination
|
|
197
|
+
* Creates default settings if they don't exist
|
|
198
|
+
*/
|
|
199
|
+
async ensureNotificationSettings(userId, appId, notificationType, jwtToken) {
|
|
200
|
+
// Get user's connected channels
|
|
201
|
+
const userData = await this.getUser(userId, jwtToken);
|
|
202
|
+
const enabledChannels = userData.channels
|
|
203
|
+
.filter((c) => c.enabled === 1)
|
|
204
|
+
.map((c) => c.channel_type);
|
|
205
|
+
if (enabledChannels.length === 0) {
|
|
206
|
+
throw new Error("No channels connected");
|
|
207
|
+
}
|
|
208
|
+
// Create settings with all enabled channels
|
|
209
|
+
const res = await fetch(`${API_URL}/users/${userId}/apps/${appId}/settings`, {
|
|
210
|
+
method: "POST",
|
|
211
|
+
headers: {
|
|
212
|
+
"Content-Type": "application/json",
|
|
213
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
214
|
+
},
|
|
215
|
+
body: JSON.stringify({
|
|
216
|
+
notificationType,
|
|
217
|
+
channels: enabledChannels,
|
|
218
|
+
enabled: true,
|
|
219
|
+
}),
|
|
220
|
+
});
|
|
221
|
+
if (!res.ok) {
|
|
222
|
+
throw new Error(`Failed to create notification settings: ${res.statusText}`);
|
|
223
|
+
}
|
|
224
|
+
return res.json();
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Send a test notification (requires JWT)
|
|
228
|
+
* Automatically creates settings if they don't exist
|
|
229
|
+
*/
|
|
230
|
+
async sendTestNotification(userId, appId, jwtToken) {
|
|
231
|
+
// Ensure settings exist for test notifications
|
|
232
|
+
try {
|
|
233
|
+
await this.ensureNotificationSettings(userId, appId, "general", jwtToken);
|
|
234
|
+
}
|
|
235
|
+
catch (err) {
|
|
236
|
+
debug("Failed to ensure settings, trying to send anyway:", err);
|
|
237
|
+
}
|
|
238
|
+
const res = await fetch(`${API_URL}/send`, {
|
|
239
|
+
method: "POST",
|
|
240
|
+
headers: {
|
|
241
|
+
"Content-Type": "application/json",
|
|
242
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
243
|
+
},
|
|
244
|
+
body: JSON.stringify({
|
|
245
|
+
userId,
|
|
246
|
+
appId,
|
|
247
|
+
notificationType: "general",
|
|
248
|
+
title: "Test Notification",
|
|
249
|
+
message: "This is a test notification from B3. If you received this, your notifications are working correctly! 🎉",
|
|
250
|
+
}),
|
|
251
|
+
});
|
|
252
|
+
if (!res.ok) {
|
|
253
|
+
throw new Error(`Failed to send test notification: ${res.statusText}`);
|
|
254
|
+
}
|
|
255
|
+
return res.json();
|
|
256
|
+
},
|
|
257
|
+
};
|
|
@@ -6,6 +6,7 @@ import { type Profile } from "thirdweb/wallets";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function validateImageUrl(url: string | null | undefined): string | null;
|
|
8
8
|
export interface ExtendedProfileDetails {
|
|
9
|
+
fid?: string;
|
|
9
10
|
id?: string;
|
|
10
11
|
email?: string;
|
|
11
12
|
phone?: string;
|
|
@@ -13,6 +14,8 @@ export interface ExtendedProfileDetails {
|
|
|
13
14
|
name?: string;
|
|
14
15
|
username?: string;
|
|
15
16
|
profileImageUrl?: string;
|
|
17
|
+
picture?: string;
|
|
18
|
+
pfpUrl?: string;
|
|
16
19
|
}
|
|
17
20
|
export interface ExtendedProfile extends Omit<Profile, "details"> {
|
|
18
21
|
details: ExtendedProfileDetails;
|
|
@@ -58,7 +58,11 @@ function validateImageUrl(url) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function getProfileDisplayInfo(profile) {
|
|
61
|
-
const { type, details } = profile;
|
|
61
|
+
const { type: originalType, details } = profile;
|
|
62
|
+
let type = originalType;
|
|
63
|
+
if (originalType === "siwe") {
|
|
64
|
+
type = "EOA";
|
|
65
|
+
}
|
|
62
66
|
// Default display info
|
|
63
67
|
let displayInfo = {
|
|
64
68
|
title: details.email || details.phone || details.address || "Unknown",
|
|
@@ -80,9 +84,9 @@ function getProfileDisplayInfo(profile) {
|
|
|
80
84
|
break;
|
|
81
85
|
case "farcaster":
|
|
82
86
|
displayInfo = {
|
|
83
|
-
title: details.name || details.username || "Unknown",
|
|
87
|
+
title: details.name || details.username || "FID:" + details?.fid || "Unknown",
|
|
84
88
|
subtitle: details.username ? `@${details.username}` : "Farcaster Account",
|
|
85
|
-
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
89
|
+
imageUrl: validateImageUrl(details.pfpUrl || details.profileImageUrl),
|
|
86
90
|
initial: "F",
|
|
87
91
|
type,
|
|
88
92
|
};
|
|
@@ -91,7 +95,7 @@ function getProfileDisplayInfo(profile) {
|
|
|
91
95
|
displayInfo = {
|
|
92
96
|
title: details.name || details.email || "Unknown",
|
|
93
97
|
subtitle: details.email || "Google Account",
|
|
94
|
-
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
98
|
+
imageUrl: validateImageUrl(details.picture || details.profileImageUrl),
|
|
95
99
|
initial: "G",
|
|
96
100
|
type,
|
|
97
101
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toast = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Re-export toast utilities for easy import
|
|
6
|
+
* This allows components to import toast from a central location
|
|
7
|
+
*/
|
|
8
|
+
var toastApi_1 = require("../components/Toast/toastApi");
|
|
9
|
+
Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return toastApi_1.toast; } });
|
|
@@ -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/
|
|
56
|
+
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
57
57
|
rpc: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/
|
|
59
|
+
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
60
60
|
rpc: string;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const b3Mainnet: import("viem").Chain;
|
|
@@ -66,3 +66,4 @@ export declare const baseMainnet: import("viem").Chain;
|
|
|
66
66
|
* Get a Thirdweb chain by chain ID from supportedChainsTW
|
|
67
67
|
*/
|
|
68
68
|
export declare function getThirdwebChain(chainId: number): ThirdwebChain;
|
|
69
|
+
export declare function getChainLogo(chainId: number): string;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.baseMainnet = exports.b3Testnet = exports.b3Mainnet = exports.b3TestnetThirdWeb = exports.b3MainnetThirdWeb = exports.coingeckoChains = exports.supportedChainNetworks = exports.supportedChainsTW = exports.supportedChains = void 0;
|
|
7
7
|
exports.getCoingeckoChainInfo = getCoingeckoChainInfo;
|
|
8
8
|
exports.getThirdwebChain = getThirdwebChain;
|
|
9
|
+
exports.getChainLogo = getChainLogo;
|
|
9
10
|
const chain_transformers_1 = require("../../../shared/utils/chain-transformers");
|
|
10
11
|
const invariant_1 = __importDefault(require("invariant"));
|
|
11
12
|
// Import the JSON directly
|
|
@@ -63,3 +64,6 @@ function getThirdwebChain(chainId) {
|
|
|
63
64
|
}
|
|
64
65
|
return chain;
|
|
65
66
|
}
|
|
67
|
+
function getChainLogo(chainId) {
|
|
68
|
+
return getThirdwebChain(chainId)?.icon?.url || "";
|
|
69
|
+
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIpfsUrl = getIpfsUrl;
|
|
4
|
+
/**
|
|
5
|
+
* List of IPFS gateways to use for converting ipfs:// URLs to HTTP URLs
|
|
6
|
+
* These gateways must match the allowed list in profileDisplay.ts validateImageUrl()
|
|
7
|
+
*/
|
|
4
8
|
const IPFS_GATEWAYS = [
|
|
5
|
-
"https://ipfs.
|
|
6
|
-
"https://
|
|
7
|
-
//
|
|
9
|
+
"https://cloudflare-ipfs.com/ipfs", // Primary gateway - fast and reliable
|
|
10
|
+
"https://ipfs.io/ipfs", // Fallback gateway
|
|
11
|
+
"https://gateway.pinata.cloud/ipfs", // Additional option
|
|
12
|
+
"https://dweb.link/ipfs", // Additional option
|
|
13
|
+
"https://nftstorage.link/ipfs", // Additional option
|
|
14
|
+
"https://w3s.link/ipfs", // Additional option
|
|
8
15
|
];
|
|
9
16
|
/**
|
|
10
17
|
* Converts an IPFS URL to a gateway URL
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
|
-
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
5
|
+
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
|
+
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
7
|
+
import { useAccountWalletImage } from "../../../global-account/react/hooks/useAccountWallet.js";
|
|
8
|
+
import { getThirdwebChain } from "../../../shared/constants/chains/supported.js";
|
|
6
9
|
import { cn } from "../../../shared/utils/cn.js";
|
|
7
10
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
8
11
|
import invariant from "invariant";
|
|
9
12
|
import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
|
|
10
13
|
import { motion } from "motion/react";
|
|
11
14
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
import { toast } from "sonner";
|
|
13
15
|
import { parseUnits } from "viem";
|
|
14
16
|
import { base, mainnet } from "viem/chains";
|
|
15
17
|
import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod.js";
|
|
@@ -30,6 +32,7 @@ import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
|
|
|
30
32
|
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
31
33
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
32
34
|
import { TabSection } from "./common/TabSection.js";
|
|
35
|
+
const baseChain = getThirdwebChain(8453);
|
|
33
36
|
export var PanelView;
|
|
34
37
|
(function (PanelView) {
|
|
35
38
|
PanelView[PanelView["MAIN"] = 0] = "MAIN";
|
|
@@ -51,6 +54,8 @@ export function AnySpend(props) {
|
|
|
51
54
|
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
|
|
52
55
|
const searchParams = useSearchParamsSSR();
|
|
53
56
|
const router = useRouter();
|
|
57
|
+
const { partnerId } = useB3();
|
|
58
|
+
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
54
59
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
55
60
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
56
61
|
// Add refs to track URL state
|
|
@@ -307,6 +312,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
307
312
|
// [selectedDstChainId, newRecipientAddress, resolvedAddress]
|
|
308
313
|
// );
|
|
309
314
|
const { address: globalAddress, wallet: globalWallet, connectedEOAWallet } = useAccountWallet();
|
|
315
|
+
const globalWalletImage = useAccountWalletImage();
|
|
310
316
|
// Auto-set active wallet from wagmi
|
|
311
317
|
useAutoSetActiveWalletFromWagmi();
|
|
312
318
|
// Get wallet address based on selected payment method
|
|
@@ -611,6 +617,10 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
611
617
|
const onClickHistory = () => {
|
|
612
618
|
setOrderId(undefined);
|
|
613
619
|
navigateToPanel(PanelView.HISTORY, "forward");
|
|
620
|
+
setB3ModalContentType({
|
|
621
|
+
type: "anySpendOrderHistory",
|
|
622
|
+
showBackButton: false,
|
|
623
|
+
});
|
|
614
624
|
// Remove orderId and paymentMethod from URL when going back to history
|
|
615
625
|
const params = new URLSearchParams(searchParams.toString());
|
|
616
626
|
params.delete("orderId");
|
|
@@ -772,7 +782,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
772
782
|
};
|
|
773
783
|
}, [activePanel, navigateBack]);
|
|
774
784
|
const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
|
|
775
|
-
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: method => {
|
|
785
|
+
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full p-5", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: method => {
|
|
776
786
|
// When user explicitly changes payment method, set it as selected
|
|
777
787
|
setSelectedCryptoPaymentMethod(method);
|
|
778
788
|
}, points: oat.data.points || undefined, onBack: () => {
|
|
@@ -781,43 +791,58 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
781
791
|
// Reset payment methods when going back
|
|
782
792
|
resetPaymentMethods();
|
|
783
793
|
} })) }) }));
|
|
784
|
-
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
794
|
+
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
795
|
+
setActiveTab(tab);
|
|
796
|
+
// Reset payment methods when switching tabs
|
|
797
|
+
resetPaymentMethods();
|
|
798
|
+
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
799
|
+
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
800
|
+
// Map panel index to navigation with direction
|
|
801
|
+
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
802
|
+
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
803
|
+
navigateToPanel(panelIndex, "forward");
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
setActivePanel(panelIndex);
|
|
807
|
+
}
|
|
808
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
|
|
809
|
+
if (activeTab === "fiat" || isBuyMode) {
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
// Swap chain selections
|
|
813
|
+
const tempSrcChainId = selectedSrcChainId;
|
|
814
|
+
const tempDstChainId = selectedDstChainId;
|
|
815
|
+
setSelectedSrcChainId(tempDstChainId);
|
|
816
|
+
setSelectedDstChainId(tempSrcChainId);
|
|
817
|
+
// Swap token selections
|
|
818
|
+
const tempSrcToken = selectedSrcToken;
|
|
819
|
+
const tempDstToken = selectedDstToken;
|
|
820
|
+
setSelectedSrcToken(tempDstToken);
|
|
821
|
+
setSelectedDstToken(tempSrcToken);
|
|
822
|
+
// Swap amounts
|
|
823
|
+
const tempSrcAmount = srcAmount;
|
|
824
|
+
const tempDstAmount = dstAmount;
|
|
825
|
+
setSrcAmount(tempDstAmount);
|
|
826
|
+
setDstAmount(tempSrcAmount);
|
|
827
|
+
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
828
|
+
setIsSrcInputDirty(false);
|
|
829
|
+
setDstAmount(value);
|
|
830
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || effectiveRecipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
831
|
+
if (value === "settings" || value === "home") {
|
|
832
|
+
setB3ModalContentType({
|
|
833
|
+
type: "manageAccount",
|
|
834
|
+
activeTab: value,
|
|
835
|
+
setActiveTab: () => { },
|
|
836
|
+
chain: baseChain,
|
|
837
|
+
partnerId,
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
else if (value === "swap") {
|
|
841
|
+
setB3ModalContentType({
|
|
842
|
+
type: "anySpend",
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
}, children: _jsx(BottomNavigation, {}) }) })] }));
|
|
821
846
|
const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: effectiveRecipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
|
|
822
847
|
setOrderId(orderId);
|
|
823
848
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
@@ -832,13 +857,13 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
832
857
|
params.set("paymentMethod", selectedCryptoPaymentMethod);
|
|
833
858
|
}
|
|
834
859
|
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
835
|
-
}, onBack: navigateBack, recipientEnsName: globalWallet?.ensName, recipientImageUrl:
|
|
860
|
+
}, onBack: navigateBack, recipientEnsName: globalWallet?.ensName, recipientImageUrl: globalWalletImage }));
|
|
836
861
|
const recipientSelectionView = (_jsx(RecipientSelection, { initialValue: effectiveRecipientAddress || "", onBack: navigateBack, onConfirm: address => {
|
|
837
862
|
// User manually selected a recipient
|
|
838
863
|
setSelectedRecipientAddress(address);
|
|
839
864
|
navigateBack();
|
|
840
865
|
} }));
|
|
841
|
-
const cryptoPaymentMethodView = (_jsx(CryptoPaymentMethod, {
|
|
866
|
+
const cryptoPaymentMethodView = (_jsx(CryptoPaymentMethod, { selectedPaymentMethod: effectiveCryptoPaymentMethod, setSelectedPaymentMethod: method => {
|
|
842
867
|
// When user explicitly selects a payment method, save it
|
|
843
868
|
setSelectedCryptoPaymentMethod(method);
|
|
844
869
|
}, isCreatingOrder: isCreatingOrder, onBack: navigateBack, onSelectPaymentMethod: (method) => {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { B3_TOKEN } from "../../../anyspend/index.js";
|
|
3
|
-
import { Button, GlareCardRounded, Input, StyleRoot, TextLoop, useHasMounted, useModalStore, useTokenBalance, useUnifiedChainSwitchAndExecute, } from "../../../global-account/react/index.js";
|
|
3
|
+
import { Button, GlareCardRounded, Input, StyleRoot, TextLoop, toast, useHasMounted, useModalStore, useTokenBalance, useUnifiedChainSwitchAndExecute, } from "../../../global-account/react/index.js";
|
|
4
4
|
import { PUBLIC_BASE_RPC_URL } from "../../../shared/constants/index.js";
|
|
5
5
|
import { baseMainnet } from "../../../shared/constants/chains/supported.js";
|
|
6
6
|
import invariant from "invariant";
|
|
7
7
|
import { ArrowRight, Loader2 } from "lucide-react";
|
|
8
8
|
import { motion } from "motion/react";
|
|
9
9
|
import { useCallback, useEffect, useState } from "react";
|
|
10
|
-
import { toast } from "sonner";
|
|
11
10
|
import { createPublicClient, encodeFunctionData, erc20Abi, formatUnits, http } from "viem";
|
|
12
11
|
import { useAccount, useWaitForTransactionReceipt } from "wagmi";
|
|
13
12
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|