@b3dotfun/sdk 0.1.69-alpha.2 → 0.1.69-alpha.21
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/constants/rpc.d.ts +1 -1
- package/dist/cjs/anyspend/constants/rpc.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
- package/dist/cjs/anyspend/utils/chain.js +8 -7
- package/dist/cjs/app.shared.js +9 -7
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/bsmnt.d.ts +0 -1
- package/dist/cjs/global-account/bsmnt.js +0 -6
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +9 -12
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +15 -6
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/cjs/global-account/react/components/Send/Send.js +5 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +20 -3
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
- package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -24
- package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
- package/dist/cjs/global-account/react/utils/index.js +0 -1
- package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
- package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
- package/dist/cjs/shared/generated/chain-networks.json +2 -2
- package/dist/cjs/shared/utils/chains.d.ts +1 -1
- package/dist/cjs/shared/utils/chains.js +2 -2
- package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
- package/dist/cjs/shared/utils/session-duration.js +69 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/cjs/wallet/react/components/ConnectWallet.js +467 -0
- package/dist/cjs/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/cjs/wallet/react/components/WalletProvider.js +20 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/cjs/wallet/react/hooks/useWalletDisconnect.js +22 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/cjs/wallet/react/hooks/useWalletState.js +63 -0
- package/dist/cjs/wallet/react/index.d.ts +5 -0
- package/dist/cjs/wallet/react/index.js +16 -0
- package/dist/cjs/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/cjs/wallet/utils/createWalletConfig.js +24 -0
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
- package/dist/esm/anyspend/constants/rpc.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -3
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
- package/dist/esm/anyspend/utils/chain.js +10 -9
- package/dist/esm/app.shared.js +9 -7
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/bsmnt.d.ts +0 -1
- package/dist/esm/global-account/bsmnt.js +0 -5
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -7
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +13 -7
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/esm/global-account/react/components/Send/Send.js +5 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +19 -2
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
- package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
- package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -23
- package/dist/esm/global-account/react/utils/index.d.ts +0 -1
- package/dist/esm/global-account/react/utils/index.js +0 -1
- package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
- package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
- package/dist/esm/shared/generated/chain-networks.json +2 -2
- package/dist/esm/shared/utils/chains.d.ts +1 -1
- package/dist/esm/shared/utils/chains.js +2 -2
- package/dist/esm/shared/utils/session-duration.d.ts +15 -0
- package/dist/esm/shared/utils/session-duration.js +64 -0
- package/dist/esm/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/esm/wallet/react/components/ConnectWallet.js +431 -0
- package/dist/esm/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/esm/wallet/react/components/WalletProvider.js +17 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/esm/wallet/react/hooks/useWalletDisconnect.js +19 -0
- package/dist/esm/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/esm/wallet/react/hooks/useWalletState.js +60 -0
- package/dist/esm/wallet/react/index.d.ts +5 -0
- package/dist/esm/wallet/react/index.js +8 -0
- package/dist/esm/wallet/utils/createWalletConfig.d.ts +21 -0
- package/dist/esm/wallet/utils/createWalletConfig.js +21 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +1 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/bsmnt.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/types/global-account/react/utils/index.d.ts +0 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +1 -1
- package/dist/types/shared/utils/chains.d.ts +1 -1
- package/dist/types/shared/utils/session-duration.d.ts +15 -0
- package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/types/wallet/react/index.d.ts +5 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
- package/package.json +15 -6
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +25 -5
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
- package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -4
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
- package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
- package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
- package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
- package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
- package/src/anyspend/utils/chain.ts +9 -9
- package/src/app.shared.ts +9 -8
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/bsmnt.ts +0 -6
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +52 -40
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
- package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +17 -10
- package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +29 -11
- package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
- package/src/global-account/react/components/Send/Send.tsx +8 -5
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +24 -4
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
- package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
- package/src/global-account/react/components/index.ts +3 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +28 -17
- package/src/global-account/react/hooks/useAuthentication.ts +24 -13
- package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
- package/src/global-account/react/hooks/useConnect.tsx +2 -2
- package/src/global-account/react/stores/useModalStore.ts +11 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +6 -25
- package/src/global-account/react/utils/index.ts +0 -1
- package/src/global-account/react/utils/profileDisplay.ts +21 -19
- package/src/shared/constants/chains/b3Chain.ts +5 -5
- package/src/shared/constants/chains/b3Viem.ts +18 -0
- package/src/shared/generated/chain-networks.json +2 -2
- package/src/shared/utils/chains.ts +3 -2
- package/src/shared/utils/session-duration.ts +64 -0
- package/src/types/torph.d.ts +4 -0
- package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
- package/src/wallet/react/components/ConnectWallet.tsx +665 -0
- package/src/wallet/react/components/WalletProvider.tsx +64 -0
- package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
- package/src/wallet/react/hooks/useWalletState.ts +93 -0
- package/src/wallet/react/index.ts +10 -0
- package/src/wallet/utils/createWalletConfig.ts +39 -0
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
- package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
- package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
- package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
- package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
- package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
- package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
- package/src/global-account/react/hooks/useRPMToken.ts +0 -17
- package/src/global-account/react/utils/updateAvatar.ts +0 -21
|
@@ -3,23 +3,22 @@ import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspen
|
|
|
3
3
|
import { RelayKitProviderWrapper, TooltipProvider } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { createWagmiConfig } from "@b3dotfun/sdk/global-account/react/utils/createWagmiConfig";
|
|
5
5
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
6
|
+
import type { AuthStrategy } from "./B3ConfigProvider";
|
|
6
7
|
import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
|
|
8
|
+
import { WalletProvider } from "@b3dotfun/sdk/wallet/react";
|
|
7
9
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
8
|
-
import { QueryClient
|
|
10
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
9
11
|
import { useEffect, useMemo } from "react";
|
|
10
|
-
import { ThirdwebProvider } from "thirdweb/react";
|
|
11
12
|
import { Account, EIP1193, Wallet } from "thirdweb/wallets";
|
|
12
|
-
import { CreateConnectorFn
|
|
13
|
+
import { CreateConnectorFn } from "wagmi";
|
|
13
14
|
import { ClientType, setClientType } from "../../../client-manager";
|
|
14
15
|
import { StyleRoot } from "../StyleRoot";
|
|
15
16
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index";
|
|
16
17
|
import AuthenticationProvider from "./AuthenticationProvider";
|
|
17
18
|
import { B3ConfigProvider } from "./B3ConfigProvider";
|
|
19
|
+
import BetterAuthProvider from "./BetterAuthProvider";
|
|
18
20
|
import { LocalSDKProvider } from "./LocalSDKProvider";
|
|
19
21
|
|
|
20
|
-
// Create queryClient instance
|
|
21
|
-
const queryClient = new QueryClient();
|
|
22
|
-
|
|
23
22
|
/**
|
|
24
23
|
* Main B3Provider component
|
|
25
24
|
*/
|
|
@@ -43,6 +42,9 @@ export function B3Provider({
|
|
|
43
42
|
overrideDefaultConnectors = false,
|
|
44
43
|
createClientReferenceId,
|
|
45
44
|
defaultPermissions,
|
|
45
|
+
disableBSMNTAuthentication = false,
|
|
46
|
+
queryClient,
|
|
47
|
+
authStrategy = "thirdweb",
|
|
46
48
|
}: {
|
|
47
49
|
theme: "light" | "dark";
|
|
48
50
|
children: React.ReactNode;
|
|
@@ -67,6 +69,11 @@ export function B3Provider({
|
|
|
67
69
|
overrideDefaultConnectors?: boolean;
|
|
68
70
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
69
71
|
defaultPermissions?: PermissionsConfig;
|
|
72
|
+
disableBSMNTAuthentication?: boolean;
|
|
73
|
+
/** Provide your own QueryClient for React Query. If omitted, WalletProvider creates one internally. */
|
|
74
|
+
queryClient?: QueryClient;
|
|
75
|
+
/** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
|
|
76
|
+
authStrategy?: AuthStrategy;
|
|
70
77
|
}) {
|
|
71
78
|
// Initialize Google Analytics on mount
|
|
72
79
|
useEffect(() => {
|
|
@@ -84,41 +91,46 @@ export function B3Provider({
|
|
|
84
91
|
);
|
|
85
92
|
|
|
86
93
|
return (
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
<WalletProvider wagmiConfig={wagmiConfig} queryClient={queryClient}>
|
|
95
|
+
<TooltipProvider>
|
|
96
|
+
<ToastProvider>
|
|
97
|
+
<LocalSDKProvider
|
|
98
|
+
onConnectCallback={onConnect}
|
|
99
|
+
onLogoutCallback={onLogout}
|
|
100
|
+
disableBSMNTAuthentication={disableBSMNTAuthentication}
|
|
101
|
+
>
|
|
102
|
+
<B3ConfigProvider
|
|
103
|
+
accountOverride={accountOverride}
|
|
104
|
+
environment={environment}
|
|
105
|
+
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
106
|
+
theme={theme}
|
|
107
|
+
clientType={clientType}
|
|
108
|
+
partnerId={partnerId}
|
|
109
|
+
stripePublishableKey={stripePublishableKey}
|
|
110
|
+
createClientReferenceId={createClientReferenceId}
|
|
111
|
+
defaultPermissions={defaultPermissions}
|
|
112
|
+
authStrategy={authStrategy}
|
|
113
|
+
>
|
|
114
|
+
<ToastContextConnector />
|
|
115
|
+
<RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
|
|
116
|
+
{children}
|
|
117
|
+
{/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
|
|
118
|
+
<StyleRoot id="b3-root" />
|
|
119
|
+
</RelayKitProviderWrapper>
|
|
120
|
+
{authStrategy === "better-auth" ? (
|
|
121
|
+
<BetterAuthProvider partnerId={partnerId} />
|
|
122
|
+
) : (
|
|
123
|
+
<AuthenticationProvider
|
|
99
124
|
partnerId={partnerId}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</RelayKitProviderWrapper>
|
|
110
|
-
<AuthenticationProvider
|
|
111
|
-
partnerId={partnerId}
|
|
112
|
-
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
113
|
-
defaultEoaProvider={defaultEoaProvider}
|
|
114
|
-
/>
|
|
115
|
-
</B3ConfigProvider>
|
|
116
|
-
</LocalSDKProvider>
|
|
117
|
-
</ToastProvider>
|
|
118
|
-
</TooltipProvider>
|
|
119
|
-
</QueryClientProvider>
|
|
120
|
-
</WagmiProvider>
|
|
121
|
-
</ThirdwebProvider>
|
|
125
|
+
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
126
|
+
defaultEoaProvider={defaultEoaProvider}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</B3ConfigProvider>
|
|
130
|
+
</LocalSDKProvider>
|
|
131
|
+
</ToastProvider>
|
|
132
|
+
</TooltipProvider>
|
|
133
|
+
</WalletProvider>
|
|
122
134
|
);
|
|
123
135
|
}
|
|
124
136
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import app from "@b3dotfun/sdk/global-account/app";
|
|
2
|
+
import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
3
|
+
import { B3_AUTH_COOKIE_NAME } from "@b3dotfun/sdk/shared/constants";
|
|
4
|
+
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
5
|
+
import Cookies from "js-cookie";
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
|
+
import { betterAuthClient } from "../../../better-auth-client";
|
|
8
|
+
import { useUserQuery } from "../../hooks/useUserQuery";
|
|
9
|
+
|
|
10
|
+
const debug = debugB3React("BetterAuthProvider");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
14
|
+
*
|
|
15
|
+
* Manages the isAuthenticating lifecycle for Better Auth:
|
|
16
|
+
* 1. On mount, try to restore an existing Feathers JWT (from a previous login)
|
|
17
|
+
* 2. If no Feathers JWT, check for a Better Auth session (e.g. after OAuth redirect)
|
|
18
|
+
* and exchange it for a Feathers JWT
|
|
19
|
+
* 3. If neither exists, set isAuthenticating: false so the login UI renders
|
|
20
|
+
*
|
|
21
|
+
* Also patches app.logout() so any code path that calls it (useAuthentication,
|
|
22
|
+
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
23
|
+
*/
|
|
24
|
+
const BetterAuthProvider = ({ partnerId }: { partnerId: string }) => {
|
|
25
|
+
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
26
|
+
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
27
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
28
|
+
const { setUser } = useUserQuery();
|
|
29
|
+
const hasAttemptedRestore = useRef(false);
|
|
30
|
+
const hasPatched = useRef(false);
|
|
31
|
+
|
|
32
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
33
|
+
// This ensures any existing logout path (useAuthentication, useAuth, SignIn
|
|
34
|
+
// dropdown, etc.) clears both the Feathers JWT and the Better Auth session.
|
|
35
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
36
|
+
// Only handles Better Auth signOut — state cleanup (isAuthenticated, isConnected,
|
|
37
|
+
// setUser, localStorage) is handled by useAuthentication/useAuth's own logout.
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (hasPatched.current) return;
|
|
40
|
+
hasPatched.current = true;
|
|
41
|
+
|
|
42
|
+
const originalLogout = app.logout.bind(app);
|
|
43
|
+
(app as any).logout = async () => {
|
|
44
|
+
debug("Patched logout: clearing Better Auth session");
|
|
45
|
+
try {
|
|
46
|
+
await betterAuthClient.signOut();
|
|
47
|
+
} catch {
|
|
48
|
+
debug("Better Auth signOut failed (non-critical)");
|
|
49
|
+
}
|
|
50
|
+
return originalLogout();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
(app as any).logout = originalLogout;
|
|
55
|
+
hasPatched.current = false;
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
// Session restore on mount
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (hasAttemptedRestore.current) return;
|
|
62
|
+
hasAttemptedRestore.current = true;
|
|
63
|
+
|
|
64
|
+
const restoreSession = async () => {
|
|
65
|
+
debug("Attempting session restore");
|
|
66
|
+
|
|
67
|
+
// 1. Try existing Feathers JWT first (fastest — no network call to Better Auth)
|
|
68
|
+
try {
|
|
69
|
+
const response = await app.reAuthenticate();
|
|
70
|
+
if (response?.user) {
|
|
71
|
+
debug("Feathers JWT restored", { userId: response.user.userId });
|
|
72
|
+
setUser(response.user);
|
|
73
|
+
setIsAuthenticated(true);
|
|
74
|
+
setIsConnected(true);
|
|
75
|
+
setIsAuthenticating(false);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
} catch {
|
|
79
|
+
debug("No existing Feathers JWT");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 2. Check for a Better Auth session (e.g. after OAuth redirect sets a cookie)
|
|
83
|
+
try {
|
|
84
|
+
const session = await betterAuthClient.getSession();
|
|
85
|
+
if (session.data?.session?.token) {
|
|
86
|
+
debug("Better Auth session found, exchanging for Feathers JWT", {
|
|
87
|
+
betterAuthUserId: session.data.user?.id,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const response = await app.authenticate({
|
|
91
|
+
strategy: "better-auth",
|
|
92
|
+
accessToken: session.data.session.token,
|
|
93
|
+
partnerId,
|
|
94
|
+
} as any);
|
|
95
|
+
|
|
96
|
+
if (response.accessToken) {
|
|
97
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, response.accessToken, {
|
|
98
|
+
secure: true,
|
|
99
|
+
sameSite: "Lax",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (response.user) {
|
|
104
|
+
setUser(response.user);
|
|
105
|
+
setIsAuthenticated(true);
|
|
106
|
+
setIsConnected(true);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
debug("OAuth session exchanged for Feathers JWT", { userId: response.user?.userId });
|
|
110
|
+
setIsAuthenticating(false);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
} catch {
|
|
114
|
+
debug("No Better Auth session to restore");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// 3. Nothing found — show login UI
|
|
118
|
+
setIsAuthenticating(false);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
restoreSession();
|
|
122
|
+
}, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId]);
|
|
123
|
+
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default BetterAuthProvider;
|
|
@@ -8,11 +8,13 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
8
8
|
export interface LocalSDKContextType {
|
|
9
9
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
10
10
|
onLogoutCallback?: () => void | Promise<void>;
|
|
11
|
+
disableBSMNTAuthentication?: boolean;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const LocalSDKContext = createContext<LocalSDKContextType>({
|
|
14
15
|
onConnectCallback: undefined,
|
|
15
16
|
onLogoutCallback: undefined,
|
|
17
|
+
disableBSMNTAuthentication: false,
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -22,16 +24,19 @@ export function LocalSDKProvider({
|
|
|
22
24
|
children,
|
|
23
25
|
onConnectCallback,
|
|
24
26
|
onLogoutCallback,
|
|
27
|
+
disableBSMNTAuthentication,
|
|
25
28
|
}: {
|
|
26
29
|
children: React.ReactNode;
|
|
27
30
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
28
31
|
onLogoutCallback?: () => void | Promise<void>;
|
|
32
|
+
disableBSMNTAuthentication?: boolean;
|
|
29
33
|
}) {
|
|
30
34
|
return (
|
|
31
35
|
<LocalSDKContext.Provider
|
|
32
36
|
value={{
|
|
33
37
|
onConnectCallback,
|
|
34
38
|
onLogoutCallback,
|
|
39
|
+
disableBSMNTAuthentication,
|
|
35
40
|
}}
|
|
36
41
|
>
|
|
37
42
|
{children}
|
|
@@ -22,6 +22,8 @@ interface IPFSMediaRendererProps {
|
|
|
22
22
|
controls?: boolean;
|
|
23
23
|
/** Style object */
|
|
24
24
|
style?: React.CSSProperties;
|
|
25
|
+
/** Callback when media fails to load */
|
|
26
|
+
onError?: () => void;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -51,6 +53,7 @@ export function IPFSMediaRenderer({
|
|
|
51
53
|
height,
|
|
52
54
|
controls,
|
|
53
55
|
style,
|
|
56
|
+
onError,
|
|
54
57
|
}: IPFSMediaRendererProps) {
|
|
55
58
|
// If no source, render fallback
|
|
56
59
|
if (!src) {
|
|
@@ -67,16 +70,20 @@ export function IPFSMediaRenderer({
|
|
|
67
70
|
// This avoids Thirdweb's default cloudflare-ipfs.com which can be unreliable
|
|
68
71
|
const resolvedSrc = src.startsWith("ipfs://") ? getIpfsUrl(src) : src;
|
|
69
72
|
|
|
73
|
+
// Wrap in a span with onErrorCapture to catch img/video load errors from
|
|
74
|
+
// MediaRenderer, which doesn't expose an onError prop itself.
|
|
70
75
|
return (
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
<span onErrorCapture={onError} className="contents">
|
|
77
|
+
<MediaRenderer
|
|
78
|
+
src={resolvedSrc}
|
|
79
|
+
client={client}
|
|
80
|
+
alt={alt}
|
|
81
|
+
className={className}
|
|
82
|
+
width={width ? width.toString() : undefined}
|
|
83
|
+
height={height ? height.toString() : undefined}
|
|
84
|
+
controls={controls}
|
|
85
|
+
style={style}
|
|
86
|
+
/>
|
|
87
|
+
</span>
|
|
81
88
|
);
|
|
82
89
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Button, toast, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
+
import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profileDisplay";
|
|
2
3
|
import { truncateAddress } from "@b3dotfun/sdk/shared/utils/truncateAddress";
|
|
3
4
|
import { Copy, Loader2, UnlinkIcon } from "lucide-react";
|
|
4
5
|
|
|
@@ -55,7 +56,7 @@ const LinkedAccountItem = ({
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
const displayImageUrl = profileData?.avatar || profile.imageUrl;
|
|
59
|
+
const displayImageUrl = validateImageUrl(profileData?.avatar) || validateImageUrl(profile.imageUrl);
|
|
59
60
|
const displayName = profileData?.name || displayTitle;
|
|
60
61
|
|
|
61
62
|
return (
|
|
@@ -5,14 +5,18 @@ import {
|
|
|
5
5
|
useSimBalance,
|
|
6
6
|
useUser,
|
|
7
7
|
} from "@b3dotfun/sdk/global-account/react";
|
|
8
|
+
import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profileDisplay";
|
|
8
9
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
9
10
|
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
11
|
+
import Avatar from "boring-avatars";
|
|
10
12
|
import { Pencil } from "lucide-react";
|
|
11
|
-
import { useMemo } from "react";
|
|
13
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
12
14
|
import { useActiveAccount } from "thirdweb/react";
|
|
13
15
|
import { useFirstEOA } from "../../hooks/useFirstEOA";
|
|
14
16
|
import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer";
|
|
15
17
|
|
|
18
|
+
const AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
|
|
19
|
+
|
|
16
20
|
const ProfileSection = () => {
|
|
17
21
|
const account = useActiveAccount();
|
|
18
22
|
const { address: eoaAddress } = useFirstEOA();
|
|
@@ -27,8 +31,9 @@ const ProfileSection = () => {
|
|
|
27
31
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
28
32
|
|
|
29
33
|
const { data: simBalance } = useSimBalance(smartWalletAddress);
|
|
34
|
+
const [imgError, setImgError] = useState(false);
|
|
35
|
+
const handleImgError = useCallback(() => setImgError(true), []);
|
|
30
36
|
|
|
31
|
-
// Calculate total balance in USD
|
|
32
37
|
const totalBalanceUsd = useMemo(() => {
|
|
33
38
|
if (!simBalance?.balances) return 0;
|
|
34
39
|
return simBalance.balances.reduce((sum, token) => sum + (token.value_usd || 0), 0);
|
|
@@ -39,27 +44,40 @@ const ProfileSection = () => {
|
|
|
39
44
|
setB3ModalContentType({
|
|
40
45
|
type: "avatarEditor",
|
|
41
46
|
onSuccess: () => {
|
|
42
|
-
// navigate back on success
|
|
43
47
|
navigateBack();
|
|
44
48
|
},
|
|
45
49
|
});
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
const avatarSrc = useMemo(
|
|
53
|
+
() => validateImageUrl(user?.avatar) || validateImageUrl(profile?.avatar),
|
|
54
|
+
[user?.avatar, profile?.avatar],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Reset error state when avatar source changes (e.g. user uploads a new avatar)
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setImgError(false);
|
|
60
|
+
}, [avatarSrc]);
|
|
50
61
|
|
|
51
|
-
// Get current username - prioritize user.username, fallback to profile data
|
|
52
62
|
const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
|
|
63
|
+
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || "user";
|
|
53
64
|
|
|
54
65
|
return (
|
|
55
66
|
<div className="flex items-center justify-between px-5 py-6">
|
|
56
67
|
<div className="global-account-profile flex items-center gap-4">
|
|
57
68
|
<div className="global-account-profile-avatar relative">
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
<div className="border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border">
|
|
70
|
+
{avatarSrc && !imgError ? (
|
|
71
|
+
<IPFSMediaRenderer
|
|
72
|
+
src={avatarSrc}
|
|
73
|
+
alt="Profile Avatar"
|
|
74
|
+
className="h-full w-full object-cover"
|
|
75
|
+
onError={handleImgError}
|
|
76
|
+
/>
|
|
77
|
+
) : (
|
|
78
|
+
<Avatar name={avatarSeed} variant="beam" size={56} colors={AVATAR_COLORS} />
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
63
81
|
|
|
64
82
|
<button
|
|
65
83
|
onClick={handleEditAvatar}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import app from "@b3dotfun/sdk/global-account/app";
|
|
2
|
+
import { useAuthentication, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
3
|
+
import {
|
|
4
|
+
getSessionDurationDays,
|
|
5
|
+
SESSION_DURATION_LABELS,
|
|
6
|
+
SESSION_DURATION_OPTIONS,
|
|
7
|
+
SessionDurationDays,
|
|
8
|
+
setSessionDurationDays,
|
|
9
|
+
} from "@b3dotfun/sdk/shared/utils/session-duration";
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import ModalHeader from "../ModalHeader/ModalHeader";
|
|
12
|
+
|
|
13
|
+
interface SessionDurationContentProps {
|
|
14
|
+
partnerId: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const DESCRIPTIONS: Record<SessionDurationDays, string> = {
|
|
18
|
+
0: "Sign out when browser closes",
|
|
19
|
+
1: "Stay signed in for 1 day",
|
|
20
|
+
7: "Stay signed in for 7 days",
|
|
21
|
+
14: "Stay signed in for 2 weeks",
|
|
22
|
+
30: "Stay signed in for 30 days",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const SessionDurationContent = ({ partnerId }: SessionDurationContentProps) => {
|
|
26
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
27
|
+
const navigateBack = useModalStore(state => state.navigateBack);
|
|
28
|
+
const [sessionDays, setSessionDays] = useState<SessionDurationDays>(() =>
|
|
29
|
+
getSessionDurationDays(user?.preferences, partnerId),
|
|
30
|
+
);
|
|
31
|
+
const [saving, setSaving] = useState(false);
|
|
32
|
+
|
|
33
|
+
const handleSelect = async (days: SessionDurationDays) => {
|
|
34
|
+
const previous = sessionDays;
|
|
35
|
+
setSessionDurationDays(days, partnerId);
|
|
36
|
+
setSessionDays(days);
|
|
37
|
+
if (user?.userId) {
|
|
38
|
+
setSaving(true);
|
|
39
|
+
try {
|
|
40
|
+
const updated = await app.service("users").patch(user.userId, {
|
|
41
|
+
preferences: {
|
|
42
|
+
...user.preferences,
|
|
43
|
+
[partnerId]: {
|
|
44
|
+
...((((user.preferences as Record<string, unknown>) ?? {})[partnerId] as Record<string, unknown>) ?? {}),
|
|
45
|
+
sessionDuration: days,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
setUser(updated);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("Failed to save session duration preference:", error);
|
|
52
|
+
// Revert optimistic update so UI stays consistent with server state
|
|
53
|
+
setSessionDays(previous);
|
|
54
|
+
setSessionDurationDays(previous, partnerId);
|
|
55
|
+
} finally {
|
|
56
|
+
setSaving(false);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="flex h-[470px] flex-col">
|
|
63
|
+
<ModalHeader showBackButton={true} showCloseButton={false} title="Stay signed in" handleBack={navigateBack} />
|
|
64
|
+
|
|
65
|
+
<div className="flex flex-col gap-2 p-5">
|
|
66
|
+
{SESSION_DURATION_OPTIONS.map(days => (
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
key={days}
|
|
70
|
+
onClick={() => handleSelect(days)}
|
|
71
|
+
disabled={saving}
|
|
72
|
+
className={`flex items-center justify-between rounded-xl border px-4 py-3 transition-colors ${
|
|
73
|
+
sessionDays === days
|
|
74
|
+
? "border-[#3f3f46] bg-[#f4f4f5] dark:border-white dark:bg-white/10"
|
|
75
|
+
: "border-[#e4e4e7] bg-transparent hover:bg-[#f4f4f5] dark:border-white/10 dark:hover:bg-white/5"
|
|
76
|
+
}`}
|
|
77
|
+
>
|
|
78
|
+
<div className="flex flex-col items-start gap-0.5">
|
|
79
|
+
<span className="font-neue-montreal-semibold text-[14px] leading-none tracking-[-0.28px] text-[#3f3f46] dark:text-white">
|
|
80
|
+
{SESSION_DURATION_LABELS[days]}
|
|
81
|
+
</span>
|
|
82
|
+
<span className="font-neue-montreal-medium text-[13px] leading-none tracking-[-0.26px] text-[#70707b] dark:text-white/50">
|
|
83
|
+
{DESCRIPTIONS[days]}
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
{sessionDays === days && (
|
|
87
|
+
<div className="flex size-5 items-center justify-center rounded-full bg-[#3f3f46] dark:bg-white">
|
|
88
|
+
<svg width="10" height="8" viewBox="0 0 10 8" fill="none">
|
|
89
|
+
<path
|
|
90
|
+
d="M1 4L3.5 6.5L9 1"
|
|
91
|
+
stroke="white"
|
|
92
|
+
strokeWidth="1.5"
|
|
93
|
+
strokeLinecap="round"
|
|
94
|
+
strokeLinejoin="round"
|
|
95
|
+
className="dark:stroke-[#3f3f46]"
|
|
96
|
+
/>
|
|
97
|
+
</svg>
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
</button>
|
|
101
|
+
))}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default SessionDurationContent;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useAuthentication, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
3
|
+
import { getSessionDurationDays, SESSION_DURATION_LABELS } from "@b3dotfun/sdk/shared/utils/session-duration";
|
|
3
4
|
import { Loader2 } from "lucide-react";
|
|
4
5
|
import { useState } from "react";
|
|
5
6
|
import { Chain } from "thirdweb";
|
|
@@ -20,46 +21,29 @@ const SettingsContent = ({
|
|
|
20
21
|
}) => {
|
|
21
22
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
22
23
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
23
|
-
const { logout } = useAuthentication(partnerId);
|
|
24
|
+
const { logout, user } = useAuthentication(partnerId);
|
|
24
25
|
const [logoutLoading, setLogoutLoading] = useState(false);
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const sessionDays = getSessionDurationDays(user?.preferences, partnerId);
|
|
27
28
|
|
|
29
|
+
const { data: profilesRaw = [] } = useProfiles({ client });
|
|
28
30
|
const profiles = profilesRaw.filter((profile: any) => !["custom_auth_endpoint"].includes(profile.type));
|
|
29
31
|
|
|
30
|
-
const handleNavigate = (
|
|
32
|
+
const handleNavigate = (
|
|
33
|
+
type: "home" | "swap" | "linkAccount" | "avatarEditor" | "notifications" | "sessionDuration",
|
|
34
|
+
) => {
|
|
31
35
|
if (type === "home") {
|
|
32
|
-
setB3ModalContentType({
|
|
33
|
-
type: "manageAccount",
|
|
34
|
-
chain,
|
|
35
|
-
partnerId,
|
|
36
|
-
onLogout,
|
|
37
|
-
activeTab: "home",
|
|
38
|
-
});
|
|
36
|
+
setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "home" });
|
|
39
37
|
} else if (type === "swap") {
|
|
40
|
-
setB3ModalContentType({
|
|
41
|
-
type: "manageAccount",
|
|
42
|
-
chain,
|
|
43
|
-
partnerId,
|
|
44
|
-
onLogout,
|
|
45
|
-
activeTab: "tokens",
|
|
46
|
-
});
|
|
38
|
+
setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "tokens" });
|
|
47
39
|
} else if (type === "linkAccount") {
|
|
48
|
-
setB3ModalContentType({
|
|
49
|
-
type: "linkAccount",
|
|
50
|
-
chain,
|
|
51
|
-
partnerId,
|
|
52
|
-
});
|
|
40
|
+
setB3ModalContentType({ type: "linkAccount", chain, partnerId });
|
|
53
41
|
} else if (type === "notifications") {
|
|
54
|
-
setB3ModalContentType({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
partnerId,
|
|
58
|
-
});
|
|
42
|
+
setB3ModalContentType({ type: "notifications", chain, partnerId });
|
|
43
|
+
} else if (type === "sessionDuration") {
|
|
44
|
+
setB3ModalContentType({ type: "sessionDuration", chain, partnerId });
|
|
59
45
|
} else {
|
|
60
|
-
setB3ModalContentType({
|
|
61
|
-
type: "avatarEditor",
|
|
62
|
-
});
|
|
46
|
+
setB3ModalContentType({ type: "avatarEditor" });
|
|
63
47
|
}
|
|
64
48
|
setB3ModalOpen(true);
|
|
65
49
|
};
|
|
@@ -111,11 +95,25 @@ const SettingsContent = ({
|
|
|
111
95
|
subtitle="Manage your notifications"
|
|
112
96
|
onClick={() => handleNavigate("notifications")}
|
|
113
97
|
/>
|
|
98
|
+
<SettingsMenuItem
|
|
99
|
+
icon={
|
|
100
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
101
|
+
<path
|
|
102
|
+
d="M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z"
|
|
103
|
+
fill="#F4F4F5"
|
|
104
|
+
/>
|
|
105
|
+
</svg>
|
|
106
|
+
}
|
|
107
|
+
title="Stay signed in"
|
|
108
|
+
subtitle={SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`}
|
|
109
|
+
onClick={() => handleNavigate("sessionDuration")}
|
|
110
|
+
/>
|
|
114
111
|
</div>
|
|
115
112
|
|
|
116
113
|
{/* Logout Section */}
|
|
117
114
|
<div className="mt-auto px-5 pb-5">
|
|
118
115
|
<button
|
|
116
|
+
type="button"
|
|
119
117
|
className="b3-modal-sign-out-button border-b3-line hover:bg-b3-line bg-b3-background dark:bg-b3-background dark:border-b3-line dark:hover:bg-b3-line/80 flex w-full items-center justify-center gap-1.5 rounded-xl border border-solid p-3 transition-colors"
|
|
120
118
|
onClick={onLogoutEnhanced}
|
|
121
119
|
disabled={logoutLoading}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ens_normalize } from "@adraffy/ens-normalize";
|
|
2
2
|
import app from "@b3dotfun/sdk/global-account/app";
|
|
3
3
|
import { toast, useAuthentication, useB3Config, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
+
import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profileDisplay";
|
|
4
5
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
5
6
|
import { Check, Loader2, Pencil, X } from "lucide-react";
|
|
6
7
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -29,8 +30,7 @@ const SettingsProfileCard = () => {
|
|
|
29
30
|
const [isSaving, setIsSaving] = useState(false);
|
|
30
31
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
const avatarSrc = user?.avatar || profile?.avatar;
|
|
33
|
+
const avatarSrc = validateImageUrl(user?.avatar) || validateImageUrl(profile?.avatar);
|
|
34
34
|
|
|
35
35
|
// Get current username - prioritize user.username, fallback to profile data
|
|
36
36
|
const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
|