@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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.betterAuthClient = void 0;
|
|
4
|
+
exports.createB3BetterAuthClient = createB3BetterAuthClient;
|
|
5
|
+
const client_1 = require("better-auth/client");
|
|
6
|
+
const app_shared_1 = require("../app.shared");
|
|
7
|
+
function createB3BetterAuthClient(baseURL = app_shared_1.B3_API_URL) {
|
|
8
|
+
return (0, client_1.createAuthClient)({
|
|
9
|
+
baseURL,
|
|
10
|
+
basePath: "/auth",
|
|
11
|
+
fetchOptions: {
|
|
12
|
+
credentials: "include",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
// Default singleton for standard usage
|
|
17
|
+
exports.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;
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.authenticateWithB3JWT = exports.resetSocket = exports.authenticate = void 0;
|
|
7
|
-
exports.extractAvatarIdFromUrl = extractAvatarIdFromUrl;
|
|
8
7
|
const basement_api_1 = require("@b3dotfun/basement-api");
|
|
9
8
|
const debug_1 = require("../shared/utils/debug");
|
|
10
9
|
const authentication_client_1 = require("@feathersjs/authentication-client");
|
|
@@ -69,11 +68,6 @@ const resetSocket = () => {
|
|
|
69
68
|
// reset the socket connection
|
|
70
69
|
};
|
|
71
70
|
exports.resetSocket = resetSocket;
|
|
72
|
-
function extractAvatarIdFromUrl(url) {
|
|
73
|
-
const regex = /https:\/\/models\.readyplayer\.me\/([a-f0-9]{24})\.[a-zA-Z0-9]+/;
|
|
74
|
-
const match = url.match(regex);
|
|
75
|
-
return match ? match[1] : null;
|
|
76
|
-
}
|
|
77
71
|
const authenticateWithB3JWT = async (fullToken, params) => {
|
|
78
72
|
// Do not authenticate if there is no token
|
|
79
73
|
if (!fullToken) {
|
|
@@ -23,6 +23,7 @@ const LinkAccount_1 = require("./LinkAccount/LinkAccount");
|
|
|
23
23
|
const LinkNewAccount_1 = require("./LinkAccount/LinkNewAccount");
|
|
24
24
|
const ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
25
25
|
const NotificationsContent_1 = __importDefault(require("./ManageAccount/NotificationsContent"));
|
|
26
|
+
const SessionDurationContent_1 = __importDefault(require("./ManageAccount/SessionDurationContent"));
|
|
26
27
|
const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
27
28
|
const Send_1 = require("./Send/Send");
|
|
28
29
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
@@ -146,6 +147,8 @@ function B3DynamicModal() {
|
|
|
146
147
|
return (0, jsx_runtime_1.jsx)(Send_1.Send, { ...contentType });
|
|
147
148
|
case "notifications":
|
|
148
149
|
return (0, jsx_runtime_1.jsx)(NotificationsContent_1.default, { ...contentType });
|
|
150
|
+
case "sessionDuration":
|
|
151
|
+
return (0, jsx_runtime_1.jsx)(SessionDurationContent_1.default, { partnerId: contentType.partnerId });
|
|
149
152
|
// Add other modal types here
|
|
150
153
|
default:
|
|
151
154
|
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;
|
|
@@ -14,7 +14,7 @@ const DEFAULT_PERMISSIONS = {
|
|
|
14
14
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
15
15
|
};
|
|
16
16
|
const B3ConfigContext = (0, react_1.createContext)(null);
|
|
17
|
-
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, }) {
|
|
17
|
+
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, authStrategy = "thirdweb", }) {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(B3ConfigContext.Provider, { value: {
|
|
19
19
|
accountOverride,
|
|
20
20
|
environment,
|
|
@@ -25,6 +25,7 @@ function B3ConfigProvider({ children, accountOverride, environment = "developmen
|
|
|
25
25
|
partnerId,
|
|
26
26
|
stripePublishableKey,
|
|
27
27
|
createClientReferenceId,
|
|
28
|
+
authStrategy,
|
|
28
29
|
}, children: children }));
|
|
29
30
|
}
|
|
30
31
|
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;
|
|
@@ -8,42 +8,39 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("../../../../global-account/react");
|
|
9
9
|
const createWagmiConfig_1 = require("../../../../global-account/react/utils/createWagmiConfig");
|
|
10
10
|
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
11
|
+
const react_2 = require("../../../../wallet/react");
|
|
11
12
|
require("@relayprotocol/relay-kit-ui/styles.css");
|
|
12
|
-
const
|
|
13
|
-
const react_2 = require("react");
|
|
14
|
-
const react_3 = require("thirdweb/react");
|
|
15
|
-
const wagmi_1 = require("wagmi");
|
|
13
|
+
const react_3 = require("react");
|
|
16
14
|
const client_manager_1 = require("../../../client-manager");
|
|
17
15
|
const StyleRoot_1 = require("../StyleRoot");
|
|
18
16
|
const index_1 = require("../Toast/index");
|
|
19
17
|
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
20
18
|
const B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
19
|
+
const BetterAuthProvider_1 = __importDefault(require("./BetterAuthProvider"));
|
|
21
20
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
22
|
-
// Create queryClient instance
|
|
23
|
-
const queryClient = new react_query_1.QueryClient();
|
|
24
21
|
/**
|
|
25
22
|
* Main B3Provider component
|
|
26
23
|
*/
|
|
27
24
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey,
|
|
28
25
|
// deprecated since v0.0.87
|
|
29
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, }) {
|
|
26
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb", }) {
|
|
30
27
|
// Initialize Google Analytics on mount
|
|
31
|
-
(0,
|
|
28
|
+
(0, react_3.useEffect)(() => {
|
|
32
29
|
(0, analytics_1.loadGA4Script)();
|
|
33
30
|
}, []);
|
|
34
31
|
// Set the client type when provider mounts
|
|
35
|
-
(0,
|
|
32
|
+
(0, react_3.useEffect)(() => {
|
|
36
33
|
(0, client_manager_1.setClientType)(clientType);
|
|
37
34
|
}, [clientType]);
|
|
38
|
-
const wagmiConfig = (0,
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
35
|
+
const wagmiConfig = (0, react_3.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_2.WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, authStrategy: authStrategy, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), authStrategy === "better-auth" ? ((0, jsx_runtime_1.jsx)(BetterAuthProvider_1.default, { partnerId: partnerId })) : ((0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider }))] }) }) }) }) }));
|
|
40
37
|
}
|
|
41
38
|
/**
|
|
42
39
|
* Component to connect the toast context to the global toast API
|
|
43
40
|
*/
|
|
44
41
|
function ToastContextConnector() {
|
|
45
42
|
const toastContext = (0, index_1.useToastContext)();
|
|
46
|
-
(0,
|
|
43
|
+
(0, react_3.useEffect)(() => {
|
|
47
44
|
(0, index_1.setToastContext)({
|
|
48
45
|
addToast: toastContext.addToast,
|
|
49
46
|
removeToast: toastContext.removeToast,
|
|
@@ -6,26 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.B3Provider = B3Provider;
|
|
7
7
|
exports.InnerProvider = InnerProvider;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const wagmi_1 = require("wagmi");
|
|
9
|
+
const react_1 = require("../../../../wallet/react");
|
|
10
|
+
const react_2 = require("thirdweb/react");
|
|
11
|
+
const react_3 = require("react");
|
|
13
12
|
const createWagmiConfig_1 = require("../../utils/createWagmiConfig");
|
|
14
13
|
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
15
14
|
const B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
16
15
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
17
|
-
// Create queryClient instance
|
|
18
|
-
const queryClient = new react_query_1.QueryClient();
|
|
19
16
|
/**
|
|
20
17
|
* Main B3Provider component
|
|
21
18
|
*/
|
|
22
19
|
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls: _rpcUrls, onConnect, defaultPermissions, }) {
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }) }));
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
26
23
|
* Inner provider component for native
|
|
27
24
|
*/
|
|
28
25
|
function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
29
|
-
const wagmiConfig = (0,
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
26
|
+
const wagmiConfig = (0, react_3.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls }), [partnerId, rpcUrls]);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(react_1.WalletProvider, { wagmiConfig: wagmiConfig, children: (0, jsx_runtime_1.jsx)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: children }) }));
|
|
31
28
|
}
|
|
@@ -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,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const app_1 = __importDefault(require("../../../../global-account/app"));
|
|
7
|
+
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const constants_1 = require("../../../../shared/constants");
|
|
9
|
+
const debug_1 = require("../../../../shared/utils/debug");
|
|
10
|
+
const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
11
|
+
const react_2 = require("react");
|
|
12
|
+
const better_auth_client_1 = require("../../../better-auth-client");
|
|
13
|
+
const useUserQuery_1 = require("../../hooks/useUserQuery");
|
|
14
|
+
const debug = (0, debug_1.debugB3React)("BetterAuthProvider");
|
|
15
|
+
/**
|
|
16
|
+
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
17
|
+
*
|
|
18
|
+
* Manages the isAuthenticating lifecycle for Better Auth:
|
|
19
|
+
* 1. On mount, try to restore an existing Feathers JWT (from a previous login)
|
|
20
|
+
* 2. If no Feathers JWT, check for a Better Auth session (e.g. after OAuth redirect)
|
|
21
|
+
* and exchange it for a Feathers JWT
|
|
22
|
+
* 3. If neither exists, set isAuthenticating: false so the login UI renders
|
|
23
|
+
*
|
|
24
|
+
* Also patches app.logout() so any code path that calls it (useAuthentication,
|
|
25
|
+
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
26
|
+
*/
|
|
27
|
+
const BetterAuthProvider = ({ partnerId }) => {
|
|
28
|
+
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
29
|
+
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
30
|
+
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
31
|
+
const { setUser } = (0, useUserQuery_1.useUserQuery)();
|
|
32
|
+
const hasAttemptedRestore = (0, react_2.useRef)(false);
|
|
33
|
+
const hasPatched = (0, react_2.useRef)(false);
|
|
34
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
35
|
+
// This ensures any existing logout path (useAuthentication, useAuth, SignIn
|
|
36
|
+
// dropdown, etc.) clears both the Feathers JWT and the Better Auth session.
|
|
37
|
+
// Patch app.logout() to also clear the Better Auth session.
|
|
38
|
+
// Only handles Better Auth signOut — state cleanup (isAuthenticated, isConnected,
|
|
39
|
+
// setUser, localStorage) is handled by useAuthentication/useAuth's own logout.
|
|
40
|
+
(0, react_2.useEffect)(() => {
|
|
41
|
+
if (hasPatched.current)
|
|
42
|
+
return;
|
|
43
|
+
hasPatched.current = true;
|
|
44
|
+
const originalLogout = app_1.default.logout.bind(app_1.default);
|
|
45
|
+
app_1.default.logout = async () => {
|
|
46
|
+
debug("Patched logout: clearing Better Auth session");
|
|
47
|
+
try {
|
|
48
|
+
await better_auth_client_1.betterAuthClient.signOut();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
debug("Better Auth signOut failed (non-critical)");
|
|
52
|
+
}
|
|
53
|
+
return originalLogout();
|
|
54
|
+
};
|
|
55
|
+
return () => {
|
|
56
|
+
app_1.default.logout = originalLogout;
|
|
57
|
+
hasPatched.current = false;
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
// Session restore on mount
|
|
61
|
+
(0, react_2.useEffect)(() => {
|
|
62
|
+
if (hasAttemptedRestore.current)
|
|
63
|
+
return;
|
|
64
|
+
hasAttemptedRestore.current = true;
|
|
65
|
+
const restoreSession = async () => {
|
|
66
|
+
debug("Attempting session restore");
|
|
67
|
+
// 1. Try existing Feathers JWT first (fastest — no network call to Better Auth)
|
|
68
|
+
try {
|
|
69
|
+
const response = await app_1.default.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
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
debug("No existing Feathers JWT");
|
|
81
|
+
}
|
|
82
|
+
// 2. Check for a Better Auth session (e.g. after OAuth redirect sets a cookie)
|
|
83
|
+
try {
|
|
84
|
+
const session = await better_auth_client_1.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
|
+
const response = await app_1.default.authenticate({
|
|
90
|
+
strategy: "better-auth",
|
|
91
|
+
accessToken: session.data.session.token,
|
|
92
|
+
partnerId,
|
|
93
|
+
});
|
|
94
|
+
if (response.accessToken) {
|
|
95
|
+
js_cookie_1.default.set(constants_1.B3_AUTH_COOKIE_NAME, response.accessToken, {
|
|
96
|
+
secure: true,
|
|
97
|
+
sameSite: "Lax",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (response.user) {
|
|
101
|
+
setUser(response.user);
|
|
102
|
+
setIsAuthenticated(true);
|
|
103
|
+
setIsConnected(true);
|
|
104
|
+
}
|
|
105
|
+
debug("OAuth session exchanged for Feathers JWT", { userId: response.user?.userId });
|
|
106
|
+
setIsAuthenticating(false);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
debug("No Better Auth session to restore");
|
|
112
|
+
}
|
|
113
|
+
// 3. Nothing found — show login UI
|
|
114
|
+
setIsAuthenticating(false);
|
|
115
|
+
};
|
|
116
|
+
restoreSession();
|
|
117
|
+
}, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId]);
|
|
118
|
+
return null;
|
|
119
|
+
};
|
|
120
|
+
exports.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;
|
|
@@ -7,13 +7,15 @@ const react_1 = require("react");
|
|
|
7
7
|
exports.LocalSDKContext = (0, react_1.createContext)({
|
|
8
8
|
onConnectCallback: undefined,
|
|
9
9
|
onLogoutCallback: undefined,
|
|
10
|
+
disableBSMNTAuthentication: false,
|
|
10
11
|
});
|
|
11
12
|
/**
|
|
12
13
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
13
14
|
*/
|
|
14
|
-
function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }) {
|
|
15
|
+
function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, disableBSMNTAuthentication, }) {
|
|
15
16
|
return ((0, jsx_runtime_1.jsx)(exports.LocalSDKContext.Provider, { value: {
|
|
16
17
|
onConnectCallback,
|
|
17
18
|
onLogoutCallback,
|
|
19
|
+
disableBSMNTAuthentication,
|
|
18
20
|
}, children: children }));
|
|
19
21
|
}
|
|
@@ -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 {};
|
|
@@ -24,7 +24,7 @@ const react_1 = require("thirdweb/react");
|
|
|
24
24
|
* />
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
function IPFSMediaRenderer({ src, alt = "Media", className, client = thirdweb_1.client, width, height, controls, style, }) {
|
|
27
|
+
function IPFSMediaRenderer({ src, alt = "Media", className, client = thirdweb_1.client, width, height, controls, style, onError, }) {
|
|
28
28
|
// If no source, render fallback
|
|
29
29
|
if (!src) {
|
|
30
30
|
return ((0, jsx_runtime_1.jsx)("div", { className: className, style: style, "aria-label": alt, children: (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: alt.charAt(0).toUpperCase() }) }) }));
|
|
@@ -32,5 +32,7 @@ function IPFSMediaRenderer({ src, alt = "Media", className, client = thirdweb_1.
|
|
|
32
32
|
// Convert IPFS URLs to HTTP gateway URLs using our preferred gateway
|
|
33
33
|
// This avoids Thirdweb's default cloudflare-ipfs.com which can be unreliable
|
|
34
34
|
const resolvedSrc = src.startsWith("ipfs://") ? (0, ipfs_1.getIpfsUrl)(src) : src;
|
|
35
|
-
|
|
35
|
+
// Wrap in a span with onErrorCapture to catch img/video load errors from
|
|
36
|
+
// MediaRenderer, which doesn't expose an onError prop itself.
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("span", { onErrorCapture: onError, className: "contents", children: (0, jsx_runtime_1.jsx)(react_1.MediaRenderer, { src: resolvedSrc, client: client, alt: alt, className: className, width: width ? width.toString() : undefined, height: height ? height.toString() : undefined, controls: controls, style: style }) }));
|
|
36
38
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const react_1 = require("../../../../global-account/react");
|
|
5
|
+
const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
|
|
5
6
|
const truncateAddress_1 = require("../../../../shared/utils/truncateAddress");
|
|
6
7
|
const lucide_react_1 = require("lucide-react");
|
|
7
8
|
// Helper function to check if a string is a wallet address and format it
|
|
@@ -32,7 +33,7 @@ const LinkedAccountItem = ({ profile, profileToUnlink, unlinkingAccountId, isUnl
|
|
|
32
33
|
react_1.toast.error("Failed to copy address");
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
const displayImageUrl = profileData?.avatar || profile.imageUrl;
|
|
36
|
+
const displayImageUrl = (0, profileDisplay_1.validateImageUrl)(profileData?.avatar) || (0, profileDisplay_1.validateImageUrl)(profile.imageUrl);
|
|
36
37
|
const displayName = profileData?.name || displayTitle;
|
|
37
38
|
return ((0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [displayImageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: displayImageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
|
|
38
39
|
? "font-mono text-sm" // Use monospace font for addresses
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
7
|
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
|
|
5
9
|
const utils_1 = require("../../../../shared/utils");
|
|
6
10
|
const number_1 = require("../../../../shared/utils/number");
|
|
11
|
+
const boring_avatars_1 = __importDefault(require("boring-avatars"));
|
|
7
12
|
const lucide_react_1 = require("lucide-react");
|
|
8
13
|
const react_2 = require("react");
|
|
9
14
|
const react_3 = require("thirdweb/react");
|
|
10
15
|
const useFirstEOA_1 = require("../../hooks/useFirstEOA");
|
|
11
16
|
const IPFSMediaRenderer_1 = require("../IPFSMediaRenderer/IPFSMediaRenderer");
|
|
17
|
+
const AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
|
|
12
18
|
const ProfileSection = () => {
|
|
13
19
|
const account = (0, react_3.useActiveAccount)();
|
|
14
20
|
const { address: eoaAddress } = (0, useFirstEOA_1.useFirstEOA)();
|
|
@@ -22,7 +28,8 @@ const ProfileSection = () => {
|
|
|
22
28
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
23
29
|
const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
|
|
24
30
|
const { data: simBalance } = (0, react_1.useSimBalance)(smartWalletAddress);
|
|
25
|
-
|
|
31
|
+
const [imgError, setImgError] = (0, react_2.useState)(false);
|
|
32
|
+
const handleImgError = (0, react_2.useCallback)(() => setImgError(true), []);
|
|
26
33
|
const totalBalanceUsd = (0, react_2.useMemo)(() => {
|
|
27
34
|
if (!simBalance?.balances)
|
|
28
35
|
return 0;
|
|
@@ -33,15 +40,17 @@ const ProfileSection = () => {
|
|
|
33
40
|
setB3ModalContentType({
|
|
34
41
|
type: "avatarEditor",
|
|
35
42
|
onSuccess: () => {
|
|
36
|
-
// navigate back on success
|
|
37
43
|
navigateBack();
|
|
38
44
|
},
|
|
39
45
|
});
|
|
40
46
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
const avatarSrc = (0, react_2.useMemo)(() => (0, profileDisplay_1.validateImageUrl)(user?.avatar) || (0, profileDisplay_1.validateImageUrl)(profile?.avatar), [user?.avatar, profile?.avatar]);
|
|
48
|
+
// Reset error state when avatar source changes (e.g. user uploads a new avatar)
|
|
49
|
+
(0, react_2.useEffect)(() => {
|
|
50
|
+
setImgError(false);
|
|
51
|
+
}, [avatarSrc]);
|
|
44
52
|
const currentUsername = user?.username || profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "");
|
|
45
|
-
|
|
53
|
+
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || "user";
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between px-5 py-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? ((0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : ((0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: avatarSeed, variant: "beam", size: 56, colors: AVATAR_COLORS })) }), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 10, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info flex flex-col gap-1", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted", children: " $" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[30px]", children: (0, number_1.formatDisplayNumber)(totalBalanceUsd, { fractionDigits: 2 }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername })] })] }) }));
|
|
46
55
|
};
|
|
47
56
|
exports.default = ProfileSection;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const app_1 = __importDefault(require("../../../../global-account/app"));
|
|
8
|
+
const react_1 = require("../../../../global-account/react");
|
|
9
|
+
const session_duration_1 = require("../../../../shared/utils/session-duration");
|
|
10
|
+
const react_2 = require("react");
|
|
11
|
+
const ModalHeader_1 = __importDefault(require("../ModalHeader/ModalHeader"));
|
|
12
|
+
const DESCRIPTIONS = {
|
|
13
|
+
0: "Sign out when browser closes",
|
|
14
|
+
1: "Stay signed in for 1 day",
|
|
15
|
+
7: "Stay signed in for 7 days",
|
|
16
|
+
14: "Stay signed in for 2 weeks",
|
|
17
|
+
30: "Stay signed in for 30 days",
|
|
18
|
+
};
|
|
19
|
+
const SessionDurationContent = ({ partnerId }) => {
|
|
20
|
+
const { user, setUser } = (0, react_1.useAuthentication)(partnerId);
|
|
21
|
+
const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
|
|
22
|
+
const [sessionDays, setSessionDays] = (0, react_2.useState)(() => (0, session_duration_1.getSessionDurationDays)(user?.preferences, partnerId));
|
|
23
|
+
const [saving, setSaving] = (0, react_2.useState)(false);
|
|
24
|
+
const handleSelect = async (days) => {
|
|
25
|
+
const previous = sessionDays;
|
|
26
|
+
(0, session_duration_1.setSessionDurationDays)(days, partnerId);
|
|
27
|
+
setSessionDays(days);
|
|
28
|
+
if (user?.userId) {
|
|
29
|
+
setSaving(true);
|
|
30
|
+
try {
|
|
31
|
+
const updated = await app_1.default.service("users").patch(user.userId, {
|
|
32
|
+
preferences: {
|
|
33
|
+
...user.preferences,
|
|
34
|
+
[partnerId]: {
|
|
35
|
+
...((user.preferences ?? {})[partnerId] ?? {}),
|
|
36
|
+
sessionDuration: days,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
setUser(updated);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error("Failed to save session duration preference:", error);
|
|
44
|
+
// Revert optimistic update so UI stays consistent with server state
|
|
45
|
+
setSessionDays(previous);
|
|
46
|
+
(0, session_duration_1.setSessionDurationDays)(previous, partnerId);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
setSaving(false);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: true, showCloseButton: false, title: "Stay signed in", handleBack: navigateBack }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-2 p-5", children: session_duration_1.SESSION_DURATION_OPTIONS.map(days => ((0, jsx_runtime_1.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
|
|
54
|
+
? "border-[#3f3f46] bg-[#f4f4f5] dark:border-white dark:bg-white/10"
|
|
55
|
+
: "border-[#e4e4e7] bg-transparent hover:bg-[#f4f4f5] dark:border-white/10 dark:hover:bg-white/5"}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-[14px] leading-none tracking-[-0.28px] text-[#3f3f46] dark:text-white", children: session_duration_1.SESSION_DURATION_LABELS[days] }), (0, jsx_runtime_1.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 && ((0, jsx_runtime_1.jsx)("div", { className: "flex size-5 items-center justify-center rounded-full bg-[#3f3f46] dark:bg-white", children: (0, jsx_runtime_1.jsx)("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M1 4L3.5 6.5L9 1", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: "dark:stroke-[#3f3f46]" }) }) }))] }, days))) })] }));
|
|
56
|
+
};
|
|
57
|
+
exports.default = SessionDurationContent;
|