@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,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNotifications = useNotifications;
|
|
4
|
+
const auth_token_1 = require("../../../shared/utils/auth-token");
|
|
5
|
+
const debug_1 = require("../../../shared/utils/debug");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const components_1 = require("../components");
|
|
8
|
+
const notificationsAPI_1 = require("../utils/notificationsAPI");
|
|
9
|
+
const useUserQuery_1 = require("./useUserQuery");
|
|
10
|
+
const debug = (0, debug_1.debugB3React)("useNotifications");
|
|
11
|
+
/**
|
|
12
|
+
* Hook for managing user notification settings and channels
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const {
|
|
17
|
+
* userData,
|
|
18
|
+
* loading,
|
|
19
|
+
* isEmailConnected,
|
|
20
|
+
* connectEmail,
|
|
21
|
+
* sendTestNotification
|
|
22
|
+
* } = useNotifications();
|
|
23
|
+
*
|
|
24
|
+
* // Connect email
|
|
25
|
+
* await connectEmail('user@example.com');
|
|
26
|
+
*
|
|
27
|
+
* // Send test
|
|
28
|
+
* await sendTestNotification();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function useNotifications() {
|
|
32
|
+
const { user } = (0, useUserQuery_1.useUserQuery)();
|
|
33
|
+
const { partnerId } = (0, components_1.useB3)();
|
|
34
|
+
const [userData, setUserData] = (0, react_1.useState)(null);
|
|
35
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
36
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
37
|
+
const [telegramStatus, setTelegramStatus] = (0, react_1.useState)("idle");
|
|
38
|
+
const userId = user?.userId;
|
|
39
|
+
const jwtToken = (0, auth_token_1.getAuthToken)();
|
|
40
|
+
const loadUserData = (0, react_1.useCallback)(async () => {
|
|
41
|
+
if (!userId || !jwtToken) {
|
|
42
|
+
setLoading(false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
setLoading(true);
|
|
47
|
+
const data = await notificationsAPI_1.notificationsAPI.getUser(userId, jwtToken);
|
|
48
|
+
setUserData(data);
|
|
49
|
+
setError(null);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
debug("Error loading user data:", err);
|
|
53
|
+
// Try to register the user if they don't exist
|
|
54
|
+
try {
|
|
55
|
+
await notificationsAPI_1.notificationsAPI.registerUser(jwtToken);
|
|
56
|
+
const data = await notificationsAPI_1.notificationsAPI.getUser(userId, jwtToken);
|
|
57
|
+
setUserData(data);
|
|
58
|
+
setError(null);
|
|
59
|
+
}
|
|
60
|
+
catch (registerErr) {
|
|
61
|
+
debug("Error registering user:", registerErr);
|
|
62
|
+
setError("Failed to load notification settings");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
}
|
|
68
|
+
}, [userId, jwtToken]);
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
loadUserData();
|
|
71
|
+
}, [loadUserData]);
|
|
72
|
+
const createDefaultNotificationSettings = (0, react_1.useCallback)(async () => {
|
|
73
|
+
if (!userId || !jwtToken)
|
|
74
|
+
return;
|
|
75
|
+
try {
|
|
76
|
+
// Create settings for test notifications only
|
|
77
|
+
await notificationsAPI_1.notificationsAPI.ensureNotificationSettings(userId, partnerId, "general", jwtToken);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
debug("Error creating default notification settings:", err);
|
|
81
|
+
}
|
|
82
|
+
}, [userId, jwtToken, partnerId]);
|
|
83
|
+
const connectEmail = (0, react_1.useCallback)(async (email) => {
|
|
84
|
+
if (!userId || !jwtToken) {
|
|
85
|
+
throw new Error("User not authenticated");
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
await notificationsAPI_1.notificationsAPI.connectEmail(userId, email, jwtToken);
|
|
89
|
+
await createDefaultNotificationSettings();
|
|
90
|
+
await loadUserData();
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
debug("Error connecting email:", err);
|
|
94
|
+
throw new Error("Failed to connect email");
|
|
95
|
+
}
|
|
96
|
+
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
97
|
+
const connectTelegram = (0, react_1.useCallback)(async () => {
|
|
98
|
+
if (!userId || !jwtToken) {
|
|
99
|
+
throw new Error("User not authenticated");
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const { deepLink } = await notificationsAPI_1.notificationsAPI.getTelegramLink(jwtToken);
|
|
103
|
+
window.open(deepLink, "_blank");
|
|
104
|
+
setTelegramStatus("pending");
|
|
105
|
+
// Poll for connection using nested timeouts to avoid overlapping requests
|
|
106
|
+
const startTime = Date.now();
|
|
107
|
+
const maxDuration = 120000; // 2 minutes
|
|
108
|
+
let timeoutId = null;
|
|
109
|
+
const pollStatus = async () => {
|
|
110
|
+
try {
|
|
111
|
+
const { connected } = await notificationsAPI_1.notificationsAPI.checkTelegramStatus(userId, jwtToken);
|
|
112
|
+
if (connected) {
|
|
113
|
+
if (timeoutId)
|
|
114
|
+
clearTimeout(timeoutId);
|
|
115
|
+
setTelegramStatus("connected");
|
|
116
|
+
await createDefaultNotificationSettings();
|
|
117
|
+
await loadUserData();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
debug("Error checking Telegram status:", err);
|
|
123
|
+
}
|
|
124
|
+
// Check if we've exceeded max duration
|
|
125
|
+
if (Date.now() - startTime < maxDuration) {
|
|
126
|
+
// Schedule next check after previous one completes
|
|
127
|
+
timeoutId = setTimeout(pollStatus, 2000);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
setTelegramStatus("idle");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
// Start polling
|
|
134
|
+
timeoutId = setTimeout(pollStatus, 2000);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
debug("Error connecting Telegram:", err);
|
|
138
|
+
throw new Error("Failed to connect Telegram");
|
|
139
|
+
}
|
|
140
|
+
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
141
|
+
const disconnectChannel = (0, react_1.useCallback)(async (channelType) => {
|
|
142
|
+
if (!userId || !jwtToken) {
|
|
143
|
+
throw new Error("User not authenticated");
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
await notificationsAPI_1.notificationsAPI.disconnectChannel(userId, channelType, jwtToken);
|
|
147
|
+
await loadUserData();
|
|
148
|
+
if (channelType === "telegram") {
|
|
149
|
+
setTelegramStatus("idle");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
debug("Error disconnecting channel:", err);
|
|
154
|
+
throw new Error(`Failed to disconnect ${channelType}`);
|
|
155
|
+
}
|
|
156
|
+
}, [userId, jwtToken, loadUserData]);
|
|
157
|
+
const sendTestNotification = (0, react_1.useCallback)(async () => {
|
|
158
|
+
if (!userId || !jwtToken) {
|
|
159
|
+
throw new Error("User not authenticated");
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
// The API method now handles ensuring settings exist
|
|
163
|
+
await notificationsAPI_1.notificationsAPI.sendTestNotification(userId, partnerId, jwtToken);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
debug("Error sending test notification:", err);
|
|
167
|
+
throw new Error("Failed to send test notification");
|
|
168
|
+
}
|
|
169
|
+
}, [userId, jwtToken, partnerId]);
|
|
170
|
+
const emailChannel = userData?.channels?.find(c => c.channel_type === "email");
|
|
171
|
+
const telegramChannel = userData?.channels?.find(c => c.channel_type === "telegram");
|
|
172
|
+
const isEmailConnected = emailChannel?.enabled === 1;
|
|
173
|
+
const isTelegramConnected = telegramChannel?.enabled === 1;
|
|
174
|
+
const hasAnyChannelConnected = isEmailConnected || isTelegramConnected;
|
|
175
|
+
return {
|
|
176
|
+
userData,
|
|
177
|
+
loading,
|
|
178
|
+
error,
|
|
179
|
+
isEmailConnected,
|
|
180
|
+
isTelegramConnected,
|
|
181
|
+
hasAnyChannelConnected,
|
|
182
|
+
connectEmail,
|
|
183
|
+
connectTelegram,
|
|
184
|
+
disconnectChannel,
|
|
185
|
+
sendTestNotification,
|
|
186
|
+
refresh: loadUserData,
|
|
187
|
+
telegramStatus,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
@@ -6,9 +6,9 @@ async function fetchSimBalance(address, chainIdsParam) {
|
|
|
6
6
|
if (!address)
|
|
7
7
|
throw new Error("Address is required");
|
|
8
8
|
const chainIds = chainIdsParam.length === 0 ? "mainnet" : chainIdsParam.join(",");
|
|
9
|
-
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=${chainIds}`;
|
|
10
|
-
if (process.env.
|
|
11
|
-
url += `&localkey=${process.env.
|
|
9
|
+
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=${chainIds}&exclude_spam_tokens=true`;
|
|
10
|
+
if (process.env.NEXT_PUBLIC_SIMDUNE_LOCAL_KEY) {
|
|
11
|
+
url += `&localkey=${process.env.NEXT_PUBLIC_SIMDUNE_LOCAL_KEY}`;
|
|
12
12
|
}
|
|
13
13
|
const response = await fetch(url);
|
|
14
14
|
if (!response.ok) {
|
|
@@ -7,6 +7,7 @@ export interface TokenBalanceResult {
|
|
|
7
7
|
rawBalance: bigint | null;
|
|
8
8
|
formattedBalance: string;
|
|
9
9
|
isLoading: boolean;
|
|
10
|
+
refetch: () => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function useTokenBalanceDirect({ token, address }: UseTokenBalanceProps): TokenBalanceResult;
|
|
12
13
|
export {};
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useUnifiedChainSwitchAndExecute = useUnifiedChainSwitchAndExecute;
|
|
7
7
|
const anyspend_1 = require("../../../anyspend");
|
|
8
8
|
const app_1 = __importDefault(require("../../../global-account/app"));
|
|
9
|
+
const react_1 = require("../../../global-account/react");
|
|
9
10
|
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
10
11
|
const thirdweb_1 = require("../../../shared/utils/thirdweb");
|
|
11
12
|
const invariant_1 = __importDefault(require("invariant"));
|
|
12
|
-
const
|
|
13
|
-
const sonner_1 = require("sonner");
|
|
13
|
+
const react_2 = require("react");
|
|
14
14
|
const thirdweb_2 = require("thirdweb");
|
|
15
15
|
const viem_1 = require("viem");
|
|
16
16
|
const wagmi_1 = require("wagmi");
|
|
@@ -23,19 +23,19 @@ const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
|
23
23
|
(0, invariant_1.default)(partnerId, "Partner ID is required");
|
|
24
24
|
function useUnifiedChainSwitchAndExecute() {
|
|
25
25
|
const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
|
|
26
|
-
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0,
|
|
26
|
+
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_2.useState)(false);
|
|
27
27
|
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
|
|
28
28
|
const { account: aaAccount } = (0, components_1.useB3)();
|
|
29
29
|
// Handle EOA wallet chain switch and execute transaction
|
|
30
|
-
const handleEOASwitchChainAndSendTransaction = (0,
|
|
30
|
+
const handleEOASwitchChainAndSendTransaction = (0, react_2.useCallback)(async (targetChainId, params) => {
|
|
31
31
|
if (!connectedEOAWallet) {
|
|
32
|
-
|
|
32
|
+
react_1.toast.error("Please connect your wallet");
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
// Get target chain configuration once
|
|
36
36
|
const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
|
|
37
37
|
if (!targetChain) {
|
|
38
|
-
|
|
38
|
+
react_1.toast.error(`Chain ${targetChainId} is not supported`);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const currentChainId = connectedEOAWallet?.getChain()?.id;
|
|
@@ -58,7 +58,7 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
58
58
|
data: params.data,
|
|
59
59
|
value: params.value,
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
react_1.toast.success(`Transaction sent: ${result.transactionHash.slice(0, 10)}...`);
|
|
62
62
|
return result.transactionHash;
|
|
63
63
|
};
|
|
64
64
|
try {
|
|
@@ -66,7 +66,7 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
66
66
|
if (onCorrectChain) {
|
|
67
67
|
return await executeTransaction();
|
|
68
68
|
}
|
|
69
|
-
const switchingToastId =
|
|
69
|
+
const switchingToastId = react_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
|
|
70
70
|
const blockExplorerUrl = targetChain.blockExplorers?.default.url;
|
|
71
71
|
(0, invariant_1.default)(blockExplorerUrl, "Block explorer URL is required");
|
|
72
72
|
const nativeCurrency = (0, anyspend_1.getNativeToken)(targetChainId);
|
|
@@ -83,18 +83,18 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
|
-
|
|
86
|
+
react_1.toast.dismiss(switchingToastId);
|
|
87
87
|
return await executeTransaction();
|
|
88
88
|
}
|
|
89
89
|
catch (e) {
|
|
90
90
|
if (e?.code === -32603 || e?.message?.includes("f is not a function")) {
|
|
91
91
|
// This is a workaround for a bug in the wallet provider.
|
|
92
|
-
|
|
92
|
+
react_1.toast.success(`Switched to ${(0, anyspend_1.getChainName)(targetChainId)}. Executing…`);
|
|
93
93
|
return await handleEOASwitchChainAndSendTransaction(targetChainId, params);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
96
|
console.error(e);
|
|
97
|
-
|
|
97
|
+
react_1.toast.error(e?.message ?? "Unexpected error");
|
|
98
98
|
return undefined;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -103,9 +103,9 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
103
103
|
}
|
|
104
104
|
}, [connectedEOAWallet, switchChainAsync]);
|
|
105
105
|
// Handle AA wallet transaction (no chain switch needed for AA)
|
|
106
|
-
const handleAASendTransaction = (0,
|
|
106
|
+
const handleAASendTransaction = (0, react_2.useCallback)(async (targetChainId, params) => {
|
|
107
107
|
if (!aaAccount) {
|
|
108
|
-
|
|
108
|
+
react_1.toast.error("Smart wallet not connected");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
try {
|
|
@@ -131,7 +131,7 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
131
131
|
catch (err) {
|
|
132
132
|
console.error("Create global-accounts-intents error", err);
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
react_1.toast.info("Sending transaction…");
|
|
135
135
|
const start = performance.now();
|
|
136
136
|
const sendTxResponse = await (0, thirdweb_2.sendTransaction)({
|
|
137
137
|
account: aaAccount,
|
|
@@ -139,12 +139,12 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
139
139
|
});
|
|
140
140
|
const end = performance.now();
|
|
141
141
|
console.log("Time taken to send transaction", end - start);
|
|
142
|
-
|
|
142
|
+
react_1.toast.success("Transaction sent successfully");
|
|
143
143
|
return sendTxResponse.transactionHash;
|
|
144
144
|
}
|
|
145
145
|
catch (err) {
|
|
146
146
|
console.error("Send transaction error", err);
|
|
147
|
-
|
|
147
|
+
react_1.toast.error(err?.message ?? "Transaction failed");
|
|
148
148
|
return undefined;
|
|
149
149
|
}
|
|
150
150
|
finally {
|
|
@@ -152,7 +152,7 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
152
152
|
}
|
|
153
153
|
}, [aaAccount]);
|
|
154
154
|
// Unified switch chain and execute function
|
|
155
|
-
const switchChainAndExecute = (0,
|
|
155
|
+
const switchChainAndExecute = (0, react_2.useCallback)(async (targetChainId, params) => {
|
|
156
156
|
// Check which wallet type is active
|
|
157
157
|
if (isActiveSmartWallet) {
|
|
158
158
|
return handleAASendTransaction(targetChainId, params);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
2
|
export { useModalStore } from "./useModalStore";
|
|
3
|
+
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
3
4
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useModalStore = exports.useAuthStore = void 0;
|
|
3
|
+
exports.useRecentAddressesStore = exports.useModalStore = exports.useAuthStore = void 0;
|
|
4
4
|
var useAuthStore_1 = require("./useAuthStore");
|
|
5
5
|
Object.defineProperty(exports, "useAuthStore", { enumerable: true, get: function () { return useAuthStore_1.useAuthStore; } });
|
|
6
6
|
var useModalStore_1 = require("./useModalStore");
|
|
7
7
|
Object.defineProperty(exports, "useModalStore", { enumerable: true, get: function () { return useModalStore_1.useModalStore; } });
|
|
8
|
+
var useRecentAddressesStore_1 = require("./useRecentAddressesStore");
|
|
9
|
+
Object.defineProperty(exports, "useRecentAddressesStore", { enumerable: true, get: function () { return useRecentAddressesStore_1.useRecentAddressesStore; } });
|
|
@@ -77,9 +77,9 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
77
77
|
/** Partner ID */
|
|
78
78
|
partnerId: string;
|
|
79
79
|
/** Active Tab */
|
|
80
|
-
activeTab?: "
|
|
80
|
+
activeTab?: "home" | "tokens" | "nfts" | "apps" | "settings" | "swap";
|
|
81
81
|
/** Function to set the active tab */
|
|
82
|
-
setActiveTab?: (tab: "
|
|
82
|
+
setActiveTab?: (tab: "home" | "tokens" | "nfts" | "apps" | "settings" | "swap") => void;
|
|
83
83
|
/** Whether to show the referral information */
|
|
84
84
|
showReferralInfo?: boolean;
|
|
85
85
|
/** Whether to show the swap button */
|
|
@@ -349,6 +349,15 @@ export interface LinkAccountModalProps extends BaseModalProps {
|
|
|
349
349
|
partnerId: string;
|
|
350
350
|
chain: Chain;
|
|
351
351
|
}
|
|
352
|
+
export interface LinkNewAccountModalProps extends BaseModalProps {
|
|
353
|
+
type: "linkNewAccount";
|
|
354
|
+
showBackButton?: boolean;
|
|
355
|
+
onSuccess?: () => void;
|
|
356
|
+
onError?: (error: Error) => void;
|
|
357
|
+
onClose?: () => void;
|
|
358
|
+
partnerId: string;
|
|
359
|
+
chain: Chain;
|
|
360
|
+
}
|
|
352
361
|
export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
353
362
|
/** Modal type identifier */
|
|
354
363
|
type: "anySpendDepositHype";
|
|
@@ -364,6 +373,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
364
373
|
mainFooter?: React.ReactNode;
|
|
365
374
|
/** Callback function called when the deposit is successful */
|
|
366
375
|
onSuccess?: (amount?: string) => void;
|
|
376
|
+
/** Callback function trigger open custom modal */
|
|
377
|
+
onOpenCustomModal?: () => void;
|
|
367
378
|
/** Custom USD input values for quick amount buttons in fiat onramp */
|
|
368
379
|
customUsdInputValues?: string[];
|
|
369
380
|
/** prefer eoa wallet */
|
|
@@ -375,10 +386,40 @@ export interface AvatarEditorModalProps extends BaseModalProps {
|
|
|
375
386
|
/** Callback function called when avatar is successfully set */
|
|
376
387
|
onSuccess?: () => void;
|
|
377
388
|
}
|
|
378
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Props for the Deposit modal
|
|
391
|
+
* Allows users to deposit tokens into their global account
|
|
392
|
+
*/
|
|
393
|
+
export interface DepositModalProps extends BaseModalProps {
|
|
394
|
+
/** Modal type identifier */
|
|
395
|
+
type: "deposit";
|
|
396
|
+
/** Callback function called when deposit is successful */
|
|
397
|
+
onSuccess?: () => void;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Props for the Send modal
|
|
401
|
+
* Allows users to send tokens from their global account to another address
|
|
402
|
+
*/
|
|
403
|
+
export interface SendModalProps extends BaseModalProps {
|
|
404
|
+
/** Modal type identifier */
|
|
405
|
+
type: "send";
|
|
406
|
+
/** Pre-filled recipient address (optional) */
|
|
407
|
+
recipientAddress?: string;
|
|
408
|
+
/** Callback function called when send is successful */
|
|
409
|
+
onSuccess?: (txHash?: string) => void;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Props for the Notifications modal
|
|
413
|
+
* Allows users to manage notification settings and channels
|
|
414
|
+
*/
|
|
415
|
+
export interface NotificationsModalProps extends BaseModalProps {
|
|
379
416
|
/** Modal type identifier */
|
|
380
|
-
type: "
|
|
381
|
-
/**
|
|
417
|
+
type: "notifications";
|
|
418
|
+
/** Partner ID */
|
|
419
|
+
partnerId: string;
|
|
420
|
+
/** Blockchain chain information */
|
|
421
|
+
chain: Chain;
|
|
422
|
+
/** Callback function called when settings are successfully saved */
|
|
382
423
|
onSuccess?: () => void;
|
|
383
424
|
}
|
|
384
425
|
/**
|
|
@@ -410,7 +451,7 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
410
451
|
/**
|
|
411
452
|
* Union type of all possible modal content types
|
|
412
453
|
*/
|
|
413
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps |
|
|
454
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | LinkNewAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | DepositModalProps | SendModalProps | NotificationsModalProps | AnySpendCollectorClubPurchaseProps;
|
|
414
455
|
/**
|
|
415
456
|
* State interface for the modal store
|
|
416
457
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface RecentAddress {
|
|
2
|
+
address: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
}
|
|
5
|
+
interface RecentAddressesStore {
|
|
6
|
+
recentAddresses: RecentAddress[];
|
|
7
|
+
addRecentAddress: (address: string) => void;
|
|
8
|
+
clearRecentAddresses: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Store for managing recently used addresses in the Send flow
|
|
12
|
+
* Persists to localStorage and keeps the last 6 unique addresses
|
|
13
|
+
*/
|
|
14
|
+
export declare const useRecentAddressesStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<RecentAddressesStore>, "persist"> & {
|
|
15
|
+
persist: {
|
|
16
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<RecentAddressesStore, RecentAddressesStore>>) => void;
|
|
17
|
+
clearStorage: () => void;
|
|
18
|
+
rehydrate: () => Promise<void> | void;
|
|
19
|
+
hasHydrated: () => boolean;
|
|
20
|
+
onHydrate: (fn: (state: RecentAddressesStore) => void) => () => void;
|
|
21
|
+
onFinishHydration: (fn: (state: RecentAddressesStore) => void) => () => void;
|
|
22
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<RecentAddressesStore, RecentAddressesStore>>;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRecentAddressesStore = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const middleware_1 = require("zustand/middleware");
|
|
6
|
+
/**
|
|
7
|
+
* Store for managing recently used addresses in the Send flow
|
|
8
|
+
* Persists to localStorage and keeps the last 6 unique addresses
|
|
9
|
+
*/
|
|
10
|
+
exports.useRecentAddressesStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
|
|
11
|
+
recentAddresses: [],
|
|
12
|
+
/**
|
|
13
|
+
* Add a new address to the recent addresses list
|
|
14
|
+
* Deduplicates and maintains a maximum of 6 addresses
|
|
15
|
+
*/
|
|
16
|
+
addRecentAddress: (address) => {
|
|
17
|
+
set(state => {
|
|
18
|
+
// Remove any existing entry with the same address
|
|
19
|
+
const filtered = state.recentAddresses.filter(item => item.address.toLowerCase() !== address.toLowerCase());
|
|
20
|
+
// Add the new address at the beginning
|
|
21
|
+
const updated = [{ address, timestamp: Date.now() }, ...filtered];
|
|
22
|
+
// Keep only the last 6 addresses
|
|
23
|
+
return {
|
|
24
|
+
recentAddresses: updated.slice(0, 6),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Clear all recent addresses
|
|
30
|
+
*/
|
|
31
|
+
clearRecentAddresses: () => {
|
|
32
|
+
set({ recentAddresses: [] });
|
|
33
|
+
},
|
|
34
|
+
}), {
|
|
35
|
+
name: "b3-recent-addresses-storage",
|
|
36
|
+
}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./notificationsAPI"), exports);
|
|
18
|
+
__exportStar(require("./profileDisplay"), exports);
|
|
19
|
+
__exportStar(require("./toast"), exports);
|
|
20
|
+
__exportStar(require("./updateAvatar"), exports);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface NotificationChannel {
|
|
2
|
+
id: number;
|
|
3
|
+
channel_type: "email" | "telegram" | "discord" | "sms" | "whatsapp" | "in_app";
|
|
4
|
+
enabled: number;
|
|
5
|
+
channel_identifier: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UserData {
|
|
8
|
+
user: {
|
|
9
|
+
id: number;
|
|
10
|
+
user_id: string;
|
|
11
|
+
};
|
|
12
|
+
channels: NotificationChannel[];
|
|
13
|
+
appSettings: Array<{
|
|
14
|
+
app_id: string;
|
|
15
|
+
notification_type: string;
|
|
16
|
+
enabled: number;
|
|
17
|
+
channels: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface NotificationSettings {
|
|
21
|
+
notificationType: string;
|
|
22
|
+
channels: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const notificationsAPI: {
|
|
25
|
+
/**
|
|
26
|
+
* Register user (requires JWT)
|
|
27
|
+
*/
|
|
28
|
+
registerUser(jwtToken: string): Promise<UserData>;
|
|
29
|
+
/**
|
|
30
|
+
* Get user data (requires JWT)
|
|
31
|
+
*/
|
|
32
|
+
getUser(userId: string, jwtToken: string): Promise<UserData>;
|
|
33
|
+
/**
|
|
34
|
+
* Connect email (requires JWT)
|
|
35
|
+
*/
|
|
36
|
+
connectEmail(userId: string, email: string, jwtToken: string): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Connect SMS (requires JWT)
|
|
39
|
+
*/
|
|
40
|
+
connectSMS(userId: string, phoneNumber: string, jwtToken: string): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Connect WhatsApp (requires JWT)
|
|
43
|
+
*/
|
|
44
|
+
connectWhatsApp(userId: string, phoneNumber: string, jwtToken: string): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Connect Discord (requires JWT)
|
|
47
|
+
*/
|
|
48
|
+
connectDiscord(userId: string, discordUserId: string, jwtToken: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Disconnect a channel (requires JWT)
|
|
51
|
+
* Looks up the channel ID by type and deletes it
|
|
52
|
+
*/
|
|
53
|
+
disconnectChannel(userId: string, channelType: string, jwtToken: string): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Get Telegram deep link (requires JWT)
|
|
56
|
+
*/
|
|
57
|
+
getTelegramLink(jwtToken: string): Promise<{
|
|
58
|
+
deepLink: string;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Check Telegram status (requires JWT)
|
|
62
|
+
*/
|
|
63
|
+
checkTelegramStatus(userId: string, jwtToken: string): Promise<{
|
|
64
|
+
connected: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Save notification preferences (requires JWT)
|
|
68
|
+
*/
|
|
69
|
+
savePreferences(userId: string, appId: string, settings: NotificationSettings, jwtToken: string): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Ensure notification settings exist for a user/app/type combination
|
|
72
|
+
* Creates default settings if they don't exist
|
|
73
|
+
*/
|
|
74
|
+
ensureNotificationSettings(userId: string, appId: string, notificationType: string, jwtToken: string): Promise<any>;
|
|
75
|
+
/**
|
|
76
|
+
* Send a test notification (requires JWT)
|
|
77
|
+
* Automatically creates settings if they don't exist
|
|
78
|
+
*/
|
|
79
|
+
sendTestNotification(userId: string, appId: string, jwtToken: string): Promise<any>;
|
|
80
|
+
};
|