@b3dotfun/sdk 0.1.69-alpha.8 → 0.1.69-test.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/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/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
- 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 +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- 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 +3 -0
- 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 -9
- 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/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/utils/signInUtils.js +5 -1
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- 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 +24 -11
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +21 -8
- 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/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 -13
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -7
- 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/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
- 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 +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- 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 +3 -0
- 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 +2 -5
- 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/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/utils/signInUtils.js +5 -1
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- 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 +24 -11
- package/dist/esm/global-account/react/hooks/useAuthentication.js +21 -8
- 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/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 -13
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -7
- 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/common/CryptoPaymentMethod.d.ts +8 -0
- 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/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/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 -13
- 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 +14 -6
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +15 -1
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +3 -3
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
- 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 +2 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- 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 +3 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +14 -20
- 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/steps/LoginStepBetterAuth.tsx +308 -0
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +5 -1
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
- 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 +24 -11
- package/src/global-account/react/hooks/useAuthentication.ts +21 -8
- package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
- package/src/global-account/react/stores/useModalStore.ts +11 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +6 -7
- 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/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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createAuthClient } from "better-auth/client";
|
|
2
|
+
import { B3_API_URL } from "../app.shared.js";
|
|
3
|
+
export function createB3BetterAuthClient(baseURL = B3_API_URL) {
|
|
4
|
+
return createAuthClient({
|
|
5
|
+
baseURL,
|
|
6
|
+
basePath: "/auth",
|
|
7
|
+
fetchOptions: {
|
|
8
|
+
credentials: "include",
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
// Default singleton for standard usage
|
|
13
|
+
export const betterAuthClient = createB3BetterAuthClient();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare const app: import("@b3dotfun/basement-api").ClientApplication;
|
|
2
2
|
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<import("@feathersjs/authentication").AuthenticationResult | null>;
|
|
3
3
|
export declare const resetSocket: () => void;
|
|
4
|
-
export declare function extractAvatarIdFromUrl(url: string): string | null;
|
|
5
4
|
export declare const authenticateWithB3JWT: (fullToken: string, params?: Record<string, any>) => Promise<import("@feathersjs/authentication").AuthenticationResult | null>;
|
|
6
5
|
export default app;
|
|
@@ -60,11 +60,6 @@ export const resetSocket = () => {
|
|
|
60
60
|
socket.connect();
|
|
61
61
|
// reset the socket connection
|
|
62
62
|
};
|
|
63
|
-
export function extractAvatarIdFromUrl(url) {
|
|
64
|
-
const regex = /https:\/\/models\.readyplayer\.me\/([a-f0-9]{24})\.[a-zA-Z0-9]+/;
|
|
65
|
-
const match = url.match(regex);
|
|
66
|
-
return match ? match[1] : null;
|
|
67
|
-
}
|
|
68
63
|
export const authenticateWithB3JWT = async (fullToken, params) => {
|
|
69
64
|
// Do not authenticate if there is no token
|
|
70
65
|
if (!fullToken) {
|
|
@@ -17,6 +17,7 @@ import { LinkAccount } from "./LinkAccount/LinkAccount.js";
|
|
|
17
17
|
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount.js";
|
|
18
18
|
import { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
19
19
|
import NotificationsContent from "./ManageAccount/NotificationsContent.js";
|
|
20
|
+
import SessionDurationContent from "./ManageAccount/SessionDurationContent.js";
|
|
20
21
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
|
|
21
22
|
import { Send } from "./Send/Send.js";
|
|
22
23
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
|
|
@@ -140,6 +141,8 @@ export function B3DynamicModal() {
|
|
|
140
141
|
return _jsx(Send, { ...contentType });
|
|
141
142
|
case "notifications":
|
|
142
143
|
return _jsx(NotificationsContent, { ...contentType });
|
|
144
|
+
case "sessionDuration":
|
|
145
|
+
return _jsx(SessionDurationContent, { partnerId: contentType.partnerId });
|
|
143
146
|
// Add other modal types here
|
|
144
147
|
default:
|
|
145
148
|
return null;
|
|
@@ -3,6 +3,7 @@ import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendC
|
|
|
3
3
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
4
4
|
import { Account } from "thirdweb/wallets";
|
|
5
5
|
import { ClientType } from "../../../client-manager";
|
|
6
|
+
export type AuthStrategy = "thirdweb" | "better-auth";
|
|
6
7
|
export interface B3ConfigContextType {
|
|
7
8
|
accountOverride?: Account;
|
|
8
9
|
automaticallySetFirstEoa: boolean;
|
|
@@ -13,8 +14,9 @@ export interface B3ConfigContextType {
|
|
|
13
14
|
partnerId: string;
|
|
14
15
|
stripePublishableKey?: string;
|
|
15
16
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
17
|
+
authStrategy: AuthStrategy;
|
|
16
18
|
}
|
|
17
|
-
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, }: {
|
|
19
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, authStrategy, }: {
|
|
18
20
|
children: React.ReactNode;
|
|
19
21
|
accountOverride?: Account;
|
|
20
22
|
environment?: "development" | "production";
|
|
@@ -25,5 +27,6 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
25
27
|
partnerId: string;
|
|
26
28
|
stripePublishableKey?: string;
|
|
27
29
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
30
|
+
authStrategy?: AuthStrategy;
|
|
28
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
29
32
|
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -10,7 +10,7 @@ const DEFAULT_PERMISSIONS = {
|
|
|
10
10
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
11
11
|
};
|
|
12
12
|
const B3ConfigContext = createContext(null);
|
|
13
|
-
export function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, }) {
|
|
13
|
+
export function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, authStrategy = "thirdweb", }) {
|
|
14
14
|
return (_jsx(B3ConfigContext.Provider, { value: {
|
|
15
15
|
accountOverride,
|
|
16
16
|
environment,
|
|
@@ -21,6 +21,7 @@ export function B3ConfigProvider({ children, accountOverride, environment = "dev
|
|
|
21
21
|
partnerId,
|
|
22
22
|
stripePublishableKey,
|
|
23
23
|
createClientReferenceId,
|
|
24
|
+
authStrategy,
|
|
24
25
|
}, children: children }));
|
|
25
26
|
}
|
|
26
27
|
export function useB3Config() {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
2
|
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
3
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
4
|
+
import type { AuthStrategy } from "./B3ConfigProvider";
|
|
4
5
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
6
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { Account, EIP1193, Wallet } from "thirdweb/wallets";
|
|
6
8
|
import { CreateConnectorFn } from "wagmi";
|
|
7
9
|
import { ClientType } from "../../../client-manager";
|
|
8
10
|
/**
|
|
9
11
|
* Main B3Provider component
|
|
10
12
|
*/
|
|
11
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
|
|
13
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy, }: {
|
|
12
14
|
theme: "light" | "dark";
|
|
13
15
|
children: React.ReactNode;
|
|
14
16
|
accountOverride?: Account;
|
|
@@ -32,4 +34,9 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
32
34
|
overrideDefaultConnectors?: boolean;
|
|
33
35
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
34
36
|
defaultPermissions?: PermissionsConfig;
|
|
37
|
+
disableBSMNTAuthentication?: boolean;
|
|
38
|
+
/** Provide your own QueryClient for React Query. If omitted, WalletProvider creates one internally. */
|
|
39
|
+
queryClient?: QueryClient;
|
|
40
|
+
/** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
|
|
41
|
+
authStrategy?: AuthStrategy;
|
|
35
42
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,25 +2,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { RelayKitProviderWrapper, TooltipProvider } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
4
4
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
5
|
+
import { WalletProvider } from "../../../../wallet/react/index.js";
|
|
5
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
6
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
7
7
|
import { useEffect, useMemo } from "react";
|
|
8
|
-
import { ThirdwebProvider } from "thirdweb/react";
|
|
9
|
-
import { WagmiProvider } from "wagmi";
|
|
10
8
|
import { setClientType } from "../../../client-manager.js";
|
|
11
9
|
import { StyleRoot } from "../StyleRoot.js";
|
|
12
10
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
13
11
|
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
14
12
|
import { B3ConfigProvider } from "./B3ConfigProvider.js";
|
|
13
|
+
import BetterAuthProvider from "./BetterAuthProvider.js";
|
|
15
14
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
16
|
-
// Create queryClient instance
|
|
17
|
-
const queryClient = new QueryClient();
|
|
18
15
|
/**
|
|
19
16
|
* Main B3Provider component
|
|
20
17
|
*/
|
|
21
18
|
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey,
|
|
22
19
|
// deprecated since v0.0.87
|
|
23
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, }) {
|
|
20
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb", }) {
|
|
24
21
|
// Initialize Google Analytics on mount
|
|
25
22
|
useEffect(() => {
|
|
26
23
|
loadGA4Script();
|
|
@@ -30,7 +27,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
30
27
|
setClientType(clientType);
|
|
31
28
|
}, [clientType]);
|
|
32
29
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
33
|
-
return (_jsx(
|
|
30
|
+
return (_jsx(WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, authStrategy: authStrategy, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), authStrategy === "better-auth" ? (_jsx(BetterAuthProvider, { partnerId: partnerId })) : (_jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider }))] }) }) }) }) }));
|
|
34
31
|
}
|
|
35
32
|
/**
|
|
36
33
|
* Component to connect the toast context to the global toast API
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { WalletProvider } from "../../../../wallet/react/index.js";
|
|
3
3
|
import { ThirdwebProvider } from "thirdweb/react";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
-
import { WagmiProvider } from "wagmi";
|
|
6
5
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
7
6
|
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
8
7
|
import { B3ConfigProvider } from "./B3ConfigProvider.js";
|
|
9
8
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
10
|
-
// Create queryClient instance
|
|
11
|
-
const queryClient = new QueryClient();
|
|
12
9
|
/**
|
|
13
10
|
* Main B3Provider component
|
|
14
11
|
*/
|
|
@@ -20,5 +17,5 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
20
17
|
*/
|
|
21
18
|
export function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
22
19
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls }), [partnerId, rpcUrls]);
|
|
23
|
-
return (_jsx(
|
|
20
|
+
return (_jsx(WalletProvider, { wagmiConfig: wagmiConfig, children: _jsx(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: children }) }));
|
|
24
21
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
3
|
+
*
|
|
4
|
+
* Manages the isAuthenticating lifecycle for Better Auth:
|
|
5
|
+
* 1. On mount, try to restore an existing Feathers JWT (from a previous login)
|
|
6
|
+
* 2. If no Feathers JWT, check for a Better Auth session (e.g. after OAuth redirect)
|
|
7
|
+
* and exchange it for a Feathers JWT
|
|
8
|
+
* 3. If neither exists, set isAuthenticating: false so the login UI renders
|
|
9
|
+
*
|
|
10
|
+
* Also patches app.logout() so any code path that calls it (useAuthentication,
|
|
11
|
+
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
12
|
+
*/
|
|
13
|
+
declare const BetterAuthProvider: ({ partnerId }: {
|
|
14
|
+
partnerId: string;
|
|
15
|
+
}) => null;
|
|
16
|
+
export default BetterAuthProvider;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import app from "../../../../global-account/app.js";
|
|
2
|
+
import { useAuthStore } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { B3_AUTH_COOKIE_NAME } from "../../../../shared/constants/index.js";
|
|
4
|
+
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
5
|
+
import Cookies from "js-cookie";
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
|
+
import { betterAuthClient } from "../../../better-auth-client.js";
|
|
8
|
+
import { useUserQuery } from "../../hooks/useUserQuery.js";
|
|
9
|
+
const debug = debugB3React("BetterAuthProvider");
|
|
10
|
+
/**
|
|
11
|
+
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
12
|
+
*
|
|
13
|
+
* Manages the isAuthenticating lifecycle for Better Auth:
|
|
14
|
+
* 1. On mount, try to restore an existing Feathers JWT (from a previous login)
|
|
15
|
+
* 2. If no Feathers JWT, check for a Better Auth session (e.g. after OAuth redirect)
|
|
16
|
+
* and exchange it for a Feathers JWT
|
|
17
|
+
* 3. If neither exists, set isAuthenticating: false so the login UI renders
|
|
18
|
+
*
|
|
19
|
+
* Also patches app.logout() so any code path that calls it (useAuthentication,
|
|
20
|
+
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
21
|
+
*/
|
|
22
|
+
const BetterAuthProvider = ({ partnerId }) => {
|
|
23
|
+
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
24
|
+
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
25
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
26
|
+
const { setUser } = useUserQuery();
|
|
27
|
+
const hasAttemptedRestore = useRef(false);
|
|
28
|
+
const hasPatched = useRef(false);
|
|
29
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
30
|
+
// This ensures any existing logout path (useAuthentication, useAuth, SignIn
|
|
31
|
+
// dropdown, etc.) clears both the Feathers JWT and the Better Auth session.
|
|
32
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
33
|
+
// Only handles Better Auth signOut — state cleanup (isAuthenticated, isConnected,
|
|
34
|
+
// setUser, localStorage) is handled by useAuthentication/useAuth's own logout.
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (hasPatched.current)
|
|
37
|
+
return;
|
|
38
|
+
hasPatched.current = true;
|
|
39
|
+
const originalLogout = app.logout.bind(app);
|
|
40
|
+
app.logout = async () => {
|
|
41
|
+
debug("Patched logout: clearing Better Auth session");
|
|
42
|
+
try {
|
|
43
|
+
await betterAuthClient.signOut();
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
debug("Better Auth signOut failed (non-critical)");
|
|
47
|
+
}
|
|
48
|
+
return originalLogout();
|
|
49
|
+
};
|
|
50
|
+
return () => {
|
|
51
|
+
app.logout = originalLogout;
|
|
52
|
+
hasPatched.current = false;
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
// Session restore on mount
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (hasAttemptedRestore.current)
|
|
58
|
+
return;
|
|
59
|
+
hasAttemptedRestore.current = true;
|
|
60
|
+
const restoreSession = async () => {
|
|
61
|
+
debug("Attempting session restore");
|
|
62
|
+
// 1. Try existing Feathers JWT first (fastest — no network call to Better Auth)
|
|
63
|
+
try {
|
|
64
|
+
const response = await app.reAuthenticate();
|
|
65
|
+
if (response?.user) {
|
|
66
|
+
debug("Feathers JWT restored", { userId: response.user.userId });
|
|
67
|
+
setUser(response.user);
|
|
68
|
+
setIsAuthenticated(true);
|
|
69
|
+
setIsConnected(true);
|
|
70
|
+
setIsAuthenticating(false);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
debug("No existing Feathers JWT");
|
|
76
|
+
}
|
|
77
|
+
// 2. Check for a Better Auth session (e.g. after OAuth redirect sets a cookie)
|
|
78
|
+
try {
|
|
79
|
+
const session = await betterAuthClient.getSession();
|
|
80
|
+
if (session.data?.session?.token) {
|
|
81
|
+
debug("Better Auth session found, exchanging for Feathers JWT", {
|
|
82
|
+
betterAuthUserId: session.data.user?.id,
|
|
83
|
+
});
|
|
84
|
+
const response = await app.authenticate({
|
|
85
|
+
strategy: "better-auth",
|
|
86
|
+
accessToken: session.data.session.token,
|
|
87
|
+
partnerId,
|
|
88
|
+
});
|
|
89
|
+
if (response.accessToken) {
|
|
90
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, response.accessToken, {
|
|
91
|
+
secure: true,
|
|
92
|
+
sameSite: "Lax",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (response.user) {
|
|
96
|
+
setUser(response.user);
|
|
97
|
+
setIsAuthenticated(true);
|
|
98
|
+
setIsConnected(true);
|
|
99
|
+
}
|
|
100
|
+
debug("OAuth session exchanged for Feathers JWT", { userId: response.user?.userId });
|
|
101
|
+
setIsAuthenticating(false);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
debug("No Better Auth session to restore");
|
|
107
|
+
}
|
|
108
|
+
// 3. Nothing found — show login UI
|
|
109
|
+
setIsAuthenticating(false);
|
|
110
|
+
};
|
|
111
|
+
restoreSession();
|
|
112
|
+
}, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId]);
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
115
|
+
export default BetterAuthProvider;
|
|
@@ -6,13 +6,15 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
6
6
|
export interface LocalSDKContextType {
|
|
7
7
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
8
8
|
onLogoutCallback?: () => void | Promise<void>;
|
|
9
|
+
disableBSMNTAuthentication?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare const LocalSDKContext: import("react").Context<LocalSDKContextType>;
|
|
11
12
|
/**
|
|
12
13
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
13
14
|
*/
|
|
14
|
-
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }: {
|
|
15
|
+
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, disableBSMNTAuthentication, }: {
|
|
15
16
|
children: React.ReactNode;
|
|
16
17
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
17
18
|
onLogoutCallback?: () => void | Promise<void>;
|
|
19
|
+
disableBSMNTAuthentication?: boolean;
|
|
18
20
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,13 +3,15 @@ import { createContext } from "react";
|
|
|
3
3
|
export const LocalSDKContext = createContext({
|
|
4
4
|
onConnectCallback: undefined,
|
|
5
5
|
onLogoutCallback: undefined,
|
|
6
|
+
disableBSMNTAuthentication: false,
|
|
6
7
|
});
|
|
7
8
|
/**
|
|
8
9
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
9
10
|
*/
|
|
10
|
-
export function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }) {
|
|
11
|
+
export function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, disableBSMNTAuthentication, }) {
|
|
11
12
|
return (_jsx(LocalSDKContext.Provider, { value: {
|
|
12
13
|
onConnectCallback,
|
|
13
14
|
onLogoutCallback,
|
|
15
|
+
disableBSMNTAuthentication,
|
|
14
16
|
}, children: children }));
|
|
15
17
|
}
|
|
@@ -16,6 +16,8 @@ interface IPFSMediaRendererProps {
|
|
|
16
16
|
controls?: boolean;
|
|
17
17
|
/** Style object */
|
|
18
18
|
style?: React.CSSProperties;
|
|
19
|
+
/** Callback when media fails to load */
|
|
20
|
+
onError?: () => void;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* IPFSMediaRenderer - A wrapper around Thirdweb's MediaRenderer that configures
|
|
@@ -35,5 +37,5 @@ interface IPFSMediaRendererProps {
|
|
|
35
37
|
* />
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
|
-
export declare function IPFSMediaRenderer({ src, alt, className, client, width, height, controls, style, }: IPFSMediaRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function IPFSMediaRenderer({ src, alt, className, client, width, height, controls, style, onError, }: IPFSMediaRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
39
41
|
export {};
|
|
@@ -21,7 +21,7 @@ import { MediaRenderer } from "thirdweb/react";
|
|
|
21
21
|
* />
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export function IPFSMediaRenderer({ src, alt = "Media", className, client = defaultClient, width, height, controls, style, }) {
|
|
24
|
+
export function IPFSMediaRenderer({ src, alt = "Media", className, client = defaultClient, width, height, controls, style, onError, }) {
|
|
25
25
|
// If no source, render fallback
|
|
26
26
|
if (!src) {
|
|
27
27
|
return (_jsx("div", { className: className, style: style, "aria-label": alt, children: _jsx("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center rounded-full", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: alt.charAt(0).toUpperCase() }) }) }));
|
|
@@ -29,5 +29,7 @@ export function IPFSMediaRenderer({ src, alt = "Media", className, client = defa
|
|
|
29
29
|
// Convert IPFS URLs to HTTP gateway URLs using our preferred gateway
|
|
30
30
|
// This avoids Thirdweb's default cloudflare-ipfs.com which can be unreliable
|
|
31
31
|
const resolvedSrc = src.startsWith("ipfs://") ? getIpfsUrl(src) : src;
|
|
32
|
-
|
|
32
|
+
// Wrap in a span with onErrorCapture to catch img/video load errors from
|
|
33
|
+
// MediaRenderer, which doesn't expose an onError prop itself.
|
|
34
|
+
return (_jsx("span", { onErrorCapture: onError, className: "contents", children: _jsx(MediaRenderer, { src: resolvedSrc, client: client, alt: alt, className: className, width: width ? width.toString() : undefined, height: height ? height.toString() : undefined, controls: controls, style: style }) }));
|
|
33
35
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, toast, useProfile } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
3
4
|
import { truncateAddress } from "../../../../shared/utils/truncateAddress.js";
|
|
4
5
|
import { Copy, Loader2, UnlinkIcon } from "lucide-react";
|
|
5
6
|
// Helper function to check if a string is a wallet address and format it
|
|
@@ -30,7 +31,7 @@ const LinkedAccountItem = ({ profile, profileToUnlink, unlinkingAccountId, isUnl
|
|
|
30
31
|
toast.error("Failed to copy address");
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
const displayImageUrl = profileData?.avatar || profile.imageUrl;
|
|
34
|
+
const displayImageUrl = validateImageUrl(profileData?.avatar) || validateImageUrl(profile.imageUrl);
|
|
34
35
|
const displayName = profileData?.name || displayTitle;
|
|
35
36
|
return (_jsxs("div", { className: "linked-account-item hover:bg-b3-line group flex cursor-pointer items-center justify-between rounded-xl p-4 transition-colors", children: [_jsxs("div", { className: "linked-account-info flex items-center gap-3", children: [displayImageUrl ? (_jsx("img", { src: displayImageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : (_jsx("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { className: "linked-account-details", children: [_jsxs("div", { className: "linked-account-title-row flex items-center gap-2", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
|
|
36
37
|
? "font-mono text-sm" // Use monospace font for addresses
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAccountWallet, useModalStore, useProfile, useSimBalance, useUser, } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
3
4
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
5
|
import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
6
|
+
import Avatar from "boring-avatars";
|
|
5
7
|
import { Pencil } from "lucide-react";
|
|
6
|
-
import { useMemo } from "react";
|
|
8
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
9
|
import { useActiveAccount } from "thirdweb/react";
|
|
8
10
|
import { useFirstEOA } from "../../hooks/useFirstEOA.js";
|
|
9
11
|
import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer.js";
|
|
12
|
+
const AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
|
|
10
13
|
const ProfileSection = () => {
|
|
11
14
|
const account = useActiveAccount();
|
|
12
15
|
const { address: eoaAddress } = useFirstEOA();
|
|
@@ -20,7 +23,8 @@ const ProfileSection = () => {
|
|
|
20
23
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
21
24
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
22
25
|
const { data: simBalance } = useSimBalance(smartWalletAddress);
|
|
23
|
-
|
|
26
|
+
const [imgError, setImgError] = useState(false);
|
|
27
|
+
const handleImgError = useCallback(() => setImgError(true), []);
|
|
24
28
|
const totalBalanceUsd = useMemo(() => {
|
|
25
29
|
if (!simBalance?.balances)
|
|
26
30
|
return 0;
|
|
@@ -31,15 +35,17 @@ const ProfileSection = () => {
|
|
|
31
35
|
setB3ModalContentType({
|
|
32
36
|
type: "avatarEditor",
|
|
33
37
|
onSuccess: () => {
|
|
34
|
-
// navigate back on success
|
|
35
38
|
navigateBack();
|
|
36
39
|
},
|
|
37
40
|
});
|
|
38
41
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const avatarSrc = useMemo(() => validateImageUrl(user?.avatar) || validateImageUrl(profile?.avatar), [user?.avatar, profile?.avatar]);
|
|
43
|
+
// Reset error state when avatar source changes (e.g. user uploads a new avatar)
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setImgError(false);
|
|
46
|
+
}, [avatarSrc]);
|
|
42
47
|
const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
|
|
43
|
-
|
|
48
|
+
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || "user";
|
|
49
|
+
return (_jsx("div", { className: "flex items-center justify-between px-5 py-6", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [_jsx("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? (_jsx(IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : (_jsx(Avatar, { name: avatarSeed, variant: "beam", size: 56, colors: AVATAR_COLORS })) }), _jsx("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: _jsx(Pencil, { size: 10, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info flex flex-col gap-1", children: [_jsxs("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [_jsx("div", { className: "text-b3-foreground-muted", children: " $" }), _jsx("div", { className: "text-[30px]", children: formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 }) })] }), _jsx("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername })] })] }) }));
|
|
44
50
|
};
|
|
45
51
|
export default ProfileSection;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import app from "../../../../global-account/app.js";
|
|
3
|
+
import { useAuthentication, useModalStore } from "../../../../global-account/react/index.js";
|
|
4
|
+
import { getSessionDurationDays, SESSION_DURATION_LABELS, SESSION_DURATION_OPTIONS, setSessionDurationDays, } from "../../../../shared/utils/session-duration.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import ModalHeader from "../ModalHeader/ModalHeader.js";
|
|
7
|
+
const DESCRIPTIONS = {
|
|
8
|
+
0: "Sign out when browser closes",
|
|
9
|
+
1: "Stay signed in for 1 day",
|
|
10
|
+
7: "Stay signed in for 7 days",
|
|
11
|
+
14: "Stay signed in for 2 weeks",
|
|
12
|
+
30: "Stay signed in for 30 days",
|
|
13
|
+
};
|
|
14
|
+
const SessionDurationContent = ({ partnerId }) => {
|
|
15
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
16
|
+
const navigateBack = useModalStore(state => state.navigateBack);
|
|
17
|
+
const [sessionDays, setSessionDays] = useState(() => getSessionDurationDays(user?.preferences, partnerId));
|
|
18
|
+
const [saving, setSaving] = useState(false);
|
|
19
|
+
const handleSelect = async (days) => {
|
|
20
|
+
const previous = sessionDays;
|
|
21
|
+
setSessionDurationDays(days, partnerId);
|
|
22
|
+
setSessionDays(days);
|
|
23
|
+
if (user?.userId) {
|
|
24
|
+
setSaving(true);
|
|
25
|
+
try {
|
|
26
|
+
const updated = await app.service("users").patch(user.userId, {
|
|
27
|
+
preferences: {
|
|
28
|
+
...user.preferences,
|
|
29
|
+
[partnerId]: {
|
|
30
|
+
...((user.preferences ?? {})[partnerId] ?? {}),
|
|
31
|
+
sessionDuration: days,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
setUser(updated);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error("Failed to save session duration preference:", error);
|
|
39
|
+
// Revert optimistic update so UI stays consistent with server state
|
|
40
|
+
setSessionDays(previous);
|
|
41
|
+
setSessionDurationDays(previous, partnerId);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setSaving(false);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs("div", { className: "flex h-[470px] flex-col", children: [_jsx(ModalHeader, { showBackButton: true, showCloseButton: false, title: "Stay signed in", handleBack: navigateBack }), _jsx("div", { className: "flex flex-col gap-2 p-5", children: SESSION_DURATION_OPTIONS.map(days => (_jsxs("button", { type: "button", onClick: () => handleSelect(days), disabled: saving, className: `flex items-center justify-between rounded-xl border px-4 py-3 transition-colors ${sessionDays === days
|
|
49
|
+
? "border-[#3f3f46] bg-[#f4f4f5] dark:border-white dark:bg-white/10"
|
|
50
|
+
: "border-[#e4e4e7] bg-transparent hover:bg-[#f4f4f5] dark:border-white/10 dark:hover:bg-white/5"}`, children: [_jsxs("div", { className: "flex flex-col items-start gap-0.5", children: [_jsx("span", { className: "font-neue-montreal-semibold text-[14px] leading-none tracking-[-0.28px] text-[#3f3f46] dark:text-white", children: SESSION_DURATION_LABELS[days] }), _jsx("span", { className: "font-neue-montreal-medium text-[13px] leading-none tracking-[-0.26px] text-[#70707b] dark:text-white/50", children: DESCRIPTIONS[days] })] }), sessionDays === days && (_jsx("div", { className: "flex size-5 items-center justify-center rounded-full bg-[#3f3f46] dark:bg-white", children: _jsx("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: _jsx("path", { d: "M1 4L3.5 6.5L9 1", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: "dark:stroke-[#3f3f46]" }) }) }))] }, days))) })] }));
|
|
51
|
+
};
|
|
52
|
+
export default SessionDurationContent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAuthentication, useModalStore } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
4
|
+
import { getSessionDurationDays, SESSION_DURATION_LABELS } from "../../../../shared/utils/session-duration.js";
|
|
4
5
|
import { Loader2 } from "lucide-react";
|
|
5
6
|
import { useState } from "react";
|
|
6
7
|
import { useProfiles } from "thirdweb/react";
|
|
@@ -11,47 +12,29 @@ import SettingsProfileCard from "./SettingsProfileCard.js";
|
|
|
11
12
|
const SettingsContent = ({ partnerId, onLogout, chain, }) => {
|
|
12
13
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
13
14
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
14
|
-
const { logout } = useAuthentication(partnerId);
|
|
15
|
+
const { logout, user } = useAuthentication(partnerId);
|
|
15
16
|
const [logoutLoading, setLogoutLoading] = useState(false);
|
|
17
|
+
const sessionDays = getSessionDurationDays(user?.preferences, partnerId);
|
|
16
18
|
const { data: profilesRaw = [] } = useProfiles({ client });
|
|
17
19
|
const profiles = profilesRaw.filter((profile) => !["custom_auth_endpoint"].includes(profile.type));
|
|
18
20
|
const handleNavigate = (type) => {
|
|
19
21
|
if (type === "home") {
|
|
20
|
-
setB3ModalContentType({
|
|
21
|
-
type: "manageAccount",
|
|
22
|
-
chain,
|
|
23
|
-
partnerId,
|
|
24
|
-
onLogout,
|
|
25
|
-
activeTab: "home",
|
|
26
|
-
});
|
|
22
|
+
setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "home" });
|
|
27
23
|
}
|
|
28
24
|
else if (type === "swap") {
|
|
29
|
-
setB3ModalContentType({
|
|
30
|
-
type: "manageAccount",
|
|
31
|
-
chain,
|
|
32
|
-
partnerId,
|
|
33
|
-
onLogout,
|
|
34
|
-
activeTab: "tokens",
|
|
35
|
-
});
|
|
25
|
+
setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "tokens" });
|
|
36
26
|
}
|
|
37
27
|
else if (type === "linkAccount") {
|
|
38
|
-
setB3ModalContentType({
|
|
39
|
-
type: "linkAccount",
|
|
40
|
-
chain,
|
|
41
|
-
partnerId,
|
|
42
|
-
});
|
|
28
|
+
setB3ModalContentType({ type: "linkAccount", chain, partnerId });
|
|
43
29
|
}
|
|
44
30
|
else if (type === "notifications") {
|
|
45
|
-
setB3ModalContentType({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
31
|
+
setB3ModalContentType({ type: "notifications", chain, partnerId });
|
|
32
|
+
}
|
|
33
|
+
else if (type === "sessionDuration") {
|
|
34
|
+
setB3ModalContentType({ type: "sessionDuration", chain, partnerId });
|
|
50
35
|
}
|
|
51
36
|
else {
|
|
52
|
-
setB3ModalContentType({
|
|
53
|
-
type: "avatarEditor",
|
|
54
|
-
});
|
|
37
|
+
setB3ModalContentType({ type: "avatarEditor" });
|
|
55
38
|
}
|
|
56
39
|
setB3ModalOpen(true);
|
|
57
40
|
};
|
|
@@ -62,7 +45,7 @@ const SettingsContent = ({ partnerId, onLogout, chain, }) => {
|
|
|
62
45
|
setB3ModalOpen(false);
|
|
63
46
|
setLogoutLoading(false);
|
|
64
47
|
};
|
|
65
|
-
return (_jsxs("div", { className: "flex h-[470px] flex-col", children: [_jsx(ModalHeader, { showBackButton: false, showCloseButton: false, title: "Settings" }), _jsx("div", { className: "p-5", children: _jsx("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: _jsx(SettingsProfileCard, {}) }) }), _jsxs("div", { className: "space-y-3 px-5", children: [_jsx(SettingsMenuItem, { icon: _jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { 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", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") }), _jsx(SettingsMenuItem, { icon: _jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { 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", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") })] }), _jsx("div", { className: "mt-auto px-5 pb-5", children: _jsxs("button", { 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", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
|
|
48
|
+
return (_jsxs("div", { className: "flex h-[470px] flex-col", children: [_jsx(ModalHeader, { showBackButton: false, showCloseButton: false, title: "Settings" }), _jsx("div", { className: "p-5", children: _jsx("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: _jsx(SettingsProfileCard, {}) }) }), _jsxs("div", { className: "space-y-3 px-5", children: [_jsx(SettingsMenuItem, { icon: _jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { 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", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") }), _jsx(SettingsMenuItem, { icon: _jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { 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", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") }), _jsx(SettingsMenuItem, { icon: _jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { 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", fill: "#F4F4F5" }) }), title: "Stay signed in", subtitle: SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`, onClick: () => handleNavigate("sessionDuration") })] }), _jsx("div", { className: "mt-auto px-5 pb-5", children: _jsxs("button", { type: "button", 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", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
|
|
66
49
|
boxShadow: "inset 0px 0px 0px 1px rgba(10,13,18,0.18), inset 0px -2px 0px 0px rgba(10,13,18,0.05)",
|
|
67
50
|
}, children: [logoutLoading ? (_jsx(Loader2, { className: "text-b3-grey animate-spin", size: 20 })) : (_jsx(SignOutIcon, { size: 20, className: "text-b3-grey", color: "currentColor" })), _jsx("p", { className: "text-b3-grey dark:text-b3-foreground-muted font-neue-montreal-semibold text-base", children: "Sign out" })] }) })] }));
|
|
68
51
|
};
|