@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,308 @@
|
|
|
1
|
+
import { Button, Input, LoginStepContainer, useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
+
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import {
|
|
5
|
+
EmailVerificationRequiredError,
|
|
6
|
+
type BetterAuthSocialProvider,
|
|
7
|
+
useBetterAuth,
|
|
8
|
+
} from "../../../hooks/useBetterAuth";
|
|
9
|
+
import { AuthButton } from "../components/AuthButton";
|
|
10
|
+
|
|
11
|
+
const debug = debugB3React("LoginStepBetterAuth");
|
|
12
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
13
|
+
|
|
14
|
+
const SOCIAL_PROVIDERS: { id: BetterAuthSocialProvider; label: string }[] = [
|
|
15
|
+
{ id: "google", label: "Google" },
|
|
16
|
+
{ id: "github", label: "GitHub" },
|
|
17
|
+
{ id: "discord", label: "Discord" },
|
|
18
|
+
{ id: "microsoft", label: "Microsoft" },
|
|
19
|
+
{ id: "slack", label: "Slack" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
interface LoginStepBetterAuthProps {
|
|
23
|
+
onSuccess?: () => void;
|
|
24
|
+
onError?: (error: Error) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthProps) {
|
|
28
|
+
const { partnerId } = useB3Config();
|
|
29
|
+
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
|
|
30
|
+
|
|
31
|
+
const [mode, setMode] = useState<"sign-in" | "sign-up" | "forgot-password">("sign-in");
|
|
32
|
+
const [showEmailForm, setShowEmailForm] = useState(false);
|
|
33
|
+
const [email, setEmail] = useState("");
|
|
34
|
+
const [password, setPassword] = useState("");
|
|
35
|
+
const [name, setName] = useState("");
|
|
36
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
37
|
+
const [error, setError] = useState<string | null>(null);
|
|
38
|
+
const [resetEmailSent, setResetEmailSent] = useState(false);
|
|
39
|
+
const [verificationSent, setVerificationSent] = useState(false);
|
|
40
|
+
|
|
41
|
+
const handleEmailSubmit = async () => {
|
|
42
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
43
|
+
|
|
44
|
+
if (!EMAIL_REGEX.test(normalizedEmail)) {
|
|
45
|
+
setError("Please enter a valid email address");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!password) {
|
|
50
|
+
setError("Please enter a password");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (mode === "sign-up" && !name.trim()) {
|
|
55
|
+
setError("Please enter your name");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
setIsLoading(true);
|
|
61
|
+
setError(null);
|
|
62
|
+
|
|
63
|
+
if (mode === "sign-up") {
|
|
64
|
+
debug("Signing up", { email: normalizedEmail, name: name.trim() });
|
|
65
|
+
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
66
|
+
} else {
|
|
67
|
+
debug("Signing in", { email: normalizedEmail });
|
|
68
|
+
await signInWithEmail(normalizedEmail, password);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
debug("Auth successful");
|
|
72
|
+
onSuccess?.();
|
|
73
|
+
} catch (err) {
|
|
74
|
+
if (err instanceof EmailVerificationRequiredError) {
|
|
75
|
+
setVerificationSent(true);
|
|
76
|
+
setError(null);
|
|
77
|
+
} else {
|
|
78
|
+
const message = err instanceof Error ? err.message : "Authentication failed";
|
|
79
|
+
setError(message);
|
|
80
|
+
await onError?.(err as Error);
|
|
81
|
+
}
|
|
82
|
+
debug("Auth failed", err);
|
|
83
|
+
} finally {
|
|
84
|
+
setPassword("");
|
|
85
|
+
setIsLoading(false);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleForgotPassword = async () => {
|
|
90
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
91
|
+
|
|
92
|
+
if (!EMAIL_REGEX.test(normalizedEmail)) {
|
|
93
|
+
setError("Please enter a valid email address");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
setIsLoading(true);
|
|
99
|
+
setError(null);
|
|
100
|
+
await requestPasswordReset(normalizedEmail);
|
|
101
|
+
setResetEmailSent(true);
|
|
102
|
+
} catch (err) {
|
|
103
|
+
const message = err instanceof Error ? err.message : "Failed to send reset email";
|
|
104
|
+
setError(message);
|
|
105
|
+
} finally {
|
|
106
|
+
setIsLoading(false);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleSocialSignIn = async (provider: BetterAuthSocialProvider) => {
|
|
111
|
+
try {
|
|
112
|
+
setIsLoading(true);
|
|
113
|
+
setError(null);
|
|
114
|
+
await signInWithSocial(provider);
|
|
115
|
+
} catch (err) {
|
|
116
|
+
const message = err instanceof Error ? err.message : `${provider} sign in failed`;
|
|
117
|
+
setError(message);
|
|
118
|
+
await onError?.(err as Error);
|
|
119
|
+
setIsLoading(false);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
if (verificationSent) {
|
|
124
|
+
return (
|
|
125
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
126
|
+
<div className="mb-6 w-full space-y-4 px-3 text-center">
|
|
127
|
+
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
|
|
128
|
+
<svg className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
129
|
+
<path
|
|
130
|
+
strokeLinecap="round"
|
|
131
|
+
strokeLinejoin="round"
|
|
132
|
+
strokeWidth={2}
|
|
133
|
+
d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
134
|
+
/>
|
|
135
|
+
</svg>
|
|
136
|
+
</div>
|
|
137
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-100">Check your email</p>
|
|
138
|
+
<p className="text-xs text-gray-500 dark:text-gray-400">
|
|
139
|
+
We sent a verification link to <span className="font-medium text-gray-700 dark:text-gray-200">{email}</span>
|
|
140
|
+
. Verify your account, then come back and sign in.
|
|
141
|
+
</p>
|
|
142
|
+
<button
|
|
143
|
+
onClick={() => {
|
|
144
|
+
setVerificationSent(false);
|
|
145
|
+
setMode("sign-in");
|
|
146
|
+
setShowEmailForm(true);
|
|
147
|
+
setPassword("");
|
|
148
|
+
}}
|
|
149
|
+
className="text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"
|
|
150
|
+
>
|
|
151
|
+
Back to sign in
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
</LoginStepContainer>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
160
|
+
{mode === "forgot-password" ? (
|
|
161
|
+
<div className="mb-6 w-full space-y-3 px-3">
|
|
162
|
+
<p className="text-center text-sm font-medium text-gray-900 dark:text-gray-100">Reset password</p>
|
|
163
|
+
<p className="text-center text-xs text-gray-500">Enter your email and we'll send you a reset link</p>
|
|
164
|
+
|
|
165
|
+
{resetEmailSent ? (
|
|
166
|
+
<div className="space-y-3 py-4 text-center">
|
|
167
|
+
<p className="text-sm text-green-600">Check your email for a reset link.</p>
|
|
168
|
+
</div>
|
|
169
|
+
) : (
|
|
170
|
+
<>
|
|
171
|
+
<Input
|
|
172
|
+
type="email"
|
|
173
|
+
placeholder="you@example.com"
|
|
174
|
+
value={email}
|
|
175
|
+
onChange={event => setEmail(event.target.value)}
|
|
176
|
+
disabled={isLoading}
|
|
177
|
+
onKeyDown={event => {
|
|
178
|
+
if (event.key === "Enter") handleForgotPassword();
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
{error && <p className="text-sm text-red-500">{error}</p>}
|
|
183
|
+
|
|
184
|
+
<Button onClick={handleForgotPassword} disabled={isLoading} className="w-full">
|
|
185
|
+
{isLoading ? "Sending..." : "Send reset link"}
|
|
186
|
+
</Button>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
|
|
190
|
+
<button
|
|
191
|
+
onClick={() => {
|
|
192
|
+
setMode("sign-in");
|
|
193
|
+
setShowEmailForm(true);
|
|
194
|
+
setError(null);
|
|
195
|
+
setResetEmailSent(false);
|
|
196
|
+
}}
|
|
197
|
+
className="w-full text-center text-sm text-gray-500 hover:text-gray-700"
|
|
198
|
+
>
|
|
199
|
+
Back to sign in
|
|
200
|
+
</button>
|
|
201
|
+
</div>
|
|
202
|
+
) : showEmailForm ? (
|
|
203
|
+
<div className="mb-6 w-full space-y-3 px-3">
|
|
204
|
+
<p className="text-center text-sm font-medium text-gray-900 dark:text-gray-100">
|
|
205
|
+
{mode === "sign-in" ? "Sign in with email" : "Create an account"}
|
|
206
|
+
</p>
|
|
207
|
+
|
|
208
|
+
{mode === "sign-up" && (
|
|
209
|
+
<Input
|
|
210
|
+
type="text"
|
|
211
|
+
placeholder="Your name"
|
|
212
|
+
value={name}
|
|
213
|
+
onChange={event => setName(event.target.value)}
|
|
214
|
+
disabled={isLoading}
|
|
215
|
+
/>
|
|
216
|
+
)}
|
|
217
|
+
|
|
218
|
+
<Input
|
|
219
|
+
type="email"
|
|
220
|
+
placeholder="you@example.com"
|
|
221
|
+
value={email}
|
|
222
|
+
onChange={event => setEmail(event.target.value)}
|
|
223
|
+
disabled={isLoading}
|
|
224
|
+
/>
|
|
225
|
+
|
|
226
|
+
<Input
|
|
227
|
+
type="password"
|
|
228
|
+
placeholder="Password"
|
|
229
|
+
value={password}
|
|
230
|
+
onChange={event => setPassword(event.target.value)}
|
|
231
|
+
disabled={isLoading}
|
|
232
|
+
onKeyDown={event => {
|
|
233
|
+
if (event.key === "Enter") handleEmailSubmit();
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
{error && <p className="text-sm text-red-500">{error}</p>}
|
|
238
|
+
|
|
239
|
+
<Button onClick={handleEmailSubmit} disabled={isLoading} className="w-full">
|
|
240
|
+
{isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up"}
|
|
241
|
+
</Button>
|
|
242
|
+
|
|
243
|
+
{mode === "sign-in" && (
|
|
244
|
+
<button
|
|
245
|
+
onClick={() => {
|
|
246
|
+
setMode("forgot-password");
|
|
247
|
+
setError(null);
|
|
248
|
+
}}
|
|
249
|
+
disabled={isLoading}
|
|
250
|
+
className="w-full text-center text-xs text-gray-500 hover:text-gray-700"
|
|
251
|
+
>
|
|
252
|
+
Forgot password?
|
|
253
|
+
</button>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
<button
|
|
257
|
+
onClick={() => {
|
|
258
|
+
setMode(mode === "sign-in" ? "sign-up" : "sign-in");
|
|
259
|
+
setError(null);
|
|
260
|
+
}}
|
|
261
|
+
disabled={isLoading}
|
|
262
|
+
className="w-full text-center text-sm text-gray-500 hover:text-gray-700"
|
|
263
|
+
>
|
|
264
|
+
{mode === "sign-in" ? "Don't have an account? Sign up" : "Already have an account? Sign in"}
|
|
265
|
+
</button>
|
|
266
|
+
|
|
267
|
+
<Button
|
|
268
|
+
variant="outline"
|
|
269
|
+
onClick={() => {
|
|
270
|
+
setShowEmailForm(false);
|
|
271
|
+
setError(null);
|
|
272
|
+
}}
|
|
273
|
+
disabled={isLoading}
|
|
274
|
+
className="w-full"
|
|
275
|
+
>
|
|
276
|
+
Back
|
|
277
|
+
</Button>
|
|
278
|
+
</div>
|
|
279
|
+
) : (
|
|
280
|
+
<div className="mb-6 w-full space-y-4 px-3">
|
|
281
|
+
{/* Social providers */}
|
|
282
|
+
<div className="grid w-full grid-cols-3 gap-4">
|
|
283
|
+
{SOCIAL_PROVIDERS.map(provider => (
|
|
284
|
+
<AuthButton
|
|
285
|
+
key={provider.id}
|
|
286
|
+
strategy={provider.id}
|
|
287
|
+
onClick={() => handleSocialSignIn(provider.id)}
|
|
288
|
+
isLoading={isLoading}
|
|
289
|
+
/>
|
|
290
|
+
))}
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
{/* Divider */}
|
|
294
|
+
<div className="flex items-center gap-3">
|
|
295
|
+
<div className="h-px flex-1 bg-gray-200" />
|
|
296
|
+
<span className="text-xs text-gray-400">or</span>
|
|
297
|
+
<div className="h-px flex-1 bg-gray-200" />
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
{/* Email option */}
|
|
301
|
+
<AuthButton strategy="email" onClick={() => setShowEmailForm(true)} isLoading={isLoading} />
|
|
302
|
+
|
|
303
|
+
{error && <p className="text-center text-sm text-red-500">{error}</p>}
|
|
304
|
+
</div>
|
|
305
|
+
)}
|
|
306
|
+
</LoginStepContainer>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
@@ -65,11 +65,13 @@ export function getConnectOptionsFromStrategy(strategy: AllowedStrategy): {
|
|
|
65
65
|
|
|
66
66
|
export const strategyIcons: Record<string, string> = {
|
|
67
67
|
google: "https://cdn.b3.fun/google.svg",
|
|
68
|
+
github: "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/github/github-original.svg",
|
|
68
69
|
x: "https://cdn.b3.fun/x.svg?1",
|
|
69
70
|
discord: "https://cdn.b3.fun/discord.svg",
|
|
70
71
|
apple: "https://cdn.b3.fun/apple.svg",
|
|
71
72
|
guest: "https://cdn.b3.fun/incognito.svg",
|
|
72
|
-
|
|
73
|
+
microsoft: "https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg",
|
|
74
|
+
slack: "https://upload.wikimedia.org/wikipedia/commons/d/d5/Slack_icon_2019.svg",
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
export const strategyLabels: Record<string, string> = {
|
|
@@ -80,6 +82,8 @@ export const strategyLabels: Record<string, string> = {
|
|
|
80
82
|
guest: "Guest",
|
|
81
83
|
github: "GitHub",
|
|
82
84
|
email: "Email",
|
|
85
|
+
microsoft: "Microsoft",
|
|
86
|
+
slack: "Slack",
|
|
83
87
|
};
|
|
84
88
|
// Test it
|
|
85
89
|
// console.log(getConnectOptionsFromStrategy("io.metamask"));
|
package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { Search, X } from "lucide-react";
|
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
6
|
import type { CombinedProfile, Profile } from "../../hooks/useProfile";
|
|
7
7
|
import { fetchProfile as fetchProfileApi } from "../../utils/profileApi";
|
|
8
|
+
import { validateImageUrl } from "../../utils/profileDisplay";
|
|
8
9
|
import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer";
|
|
9
10
|
import { Input } from "../ui/input";
|
|
10
11
|
|
|
@@ -283,7 +284,7 @@ export function SingleUserSearchSelector({
|
|
|
283
284
|
{/* Avatar */}
|
|
284
285
|
<div className="single-user-search-result-avatar h-11 w-11 shrink-0">
|
|
285
286
|
<IPFSMediaRenderer
|
|
286
|
-
src={searchResult.avatar}
|
|
287
|
+
src={validateImageUrl(searchResult.avatar) ?? undefined}
|
|
287
288
|
alt={getDisplayName(searchResult)}
|
|
288
289
|
className="h-full w-full rounded-full object-cover"
|
|
289
290
|
/>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Core Components
|
|
3
3
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
4
4
|
export { B3Provider } from "./B3Provider/B3Provider";
|
|
5
|
+
export type { AuthStrategy } from "./B3Provider/B3ConfigProvider";
|
|
5
6
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
6
7
|
export { useB3 } from "./B3Provider/useB3";
|
|
7
8
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
@@ -9,6 +10,8 @@ export { useB3Config } from "./B3Provider/useB3Config";
|
|
|
9
10
|
export { StyleRoot } from "./StyleRoot";
|
|
10
11
|
|
|
11
12
|
// SignInWithB3 Components
|
|
13
|
+
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
14
|
+
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
12
15
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
13
16
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
14
17
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
@@ -5,6 +5,7 @@ export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
|
5
5
|
export { useAnalytics } from "./useAnalytics";
|
|
6
6
|
export { useAuth } from "./useAuth";
|
|
7
7
|
export { useAuthentication } from "./useAuthentication";
|
|
8
|
+
export { useBetterAuth, EmailVerificationRequiredError } from "./useBetterAuth";
|
|
8
9
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
9
10
|
export { useB3EnsName } from "./useB3EnsName";
|
|
10
11
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
@@ -30,7 +30,7 @@ const debug = debugB3React("useAuth");
|
|
|
30
30
|
* This hook provides 1:1 feature parity with useAuthentication.ts
|
|
31
31
|
*/
|
|
32
32
|
export function useAuth() {
|
|
33
|
-
const { onConnectCallback } = useContext(LocalSDKContext);
|
|
33
|
+
const { onConnectCallback, disableBSMNTAuthentication } = useContext(LocalSDKContext);
|
|
34
34
|
const { disconnect } = useDisconnect();
|
|
35
35
|
const wallets = useConnectedWallets();
|
|
36
36
|
const activeWallet = useActiveWallet();
|
|
@@ -76,8 +76,10 @@ export function useAuth() {
|
|
|
76
76
|
|
|
77
77
|
// Authenticate with BSMNT
|
|
78
78
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
if (!disableBSMNTAuthentication) {
|
|
80
|
+
const b3Jwt = await authenticateWithB3JWT(response.accessToken);
|
|
81
|
+
debug("BSMNT re-authentication successful", b3Jwt);
|
|
82
|
+
}
|
|
81
83
|
} catch (bsmntError) {
|
|
82
84
|
// BSMNT authentication failure shouldn't block the main auth flow
|
|
83
85
|
debug("BSMNT re-authentication failed (non-critical)", bsmntError);
|
|
@@ -88,7 +90,7 @@ export function useAuth() {
|
|
|
88
90
|
debug("Re-authentication failed", err);
|
|
89
91
|
throw err;
|
|
90
92
|
}
|
|
91
|
-
}, [setUser]);
|
|
93
|
+
}, [setUser, disableBSMNTAuthentication]);
|
|
92
94
|
|
|
93
95
|
const syncWagmi = useCallback(async () => {
|
|
94
96
|
function syncWagmiFunc() {
|
|
@@ -157,9 +159,11 @@ export function useAuth() {
|
|
|
157
159
|
setIsAuthenticating(false);
|
|
158
160
|
debug("Re-authenticated successfully", { userAuth });
|
|
159
161
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
if (!disableBSMNTAuthentication) {
|
|
163
|
+
// Authenticate on BSMNT with B3 JWT
|
|
164
|
+
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
165
|
+
debug("@@b3Jwt", b3Jwt);
|
|
166
|
+
}
|
|
163
167
|
|
|
164
168
|
return userAuth;
|
|
165
169
|
} catch (error) {
|
|
@@ -169,7 +173,14 @@ export function useAuth() {
|
|
|
169
173
|
setIsAuthenticating(false);
|
|
170
174
|
throw new Error("Authentication required. Please authenticate.");
|
|
171
175
|
}
|
|
172
|
-
}, [
|
|
176
|
+
}, [
|
|
177
|
+
reAuthenticate,
|
|
178
|
+
setIsAuthenticated,
|
|
179
|
+
setIsAuthenticating,
|
|
180
|
+
setUser,
|
|
181
|
+
setHasStartedConnecting,
|
|
182
|
+
disableBSMNTAuthentication,
|
|
183
|
+
]);
|
|
173
184
|
|
|
174
185
|
/**
|
|
175
186
|
* Authenticate with B3
|
|
@@ -206,8 +217,10 @@ export function useAuth() {
|
|
|
206
217
|
|
|
207
218
|
// Step 3: Authenticate with BSMNT for basement integration
|
|
208
219
|
try {
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
if (!disableBSMNTAuthentication) {
|
|
221
|
+
const b3Jwt = await authenticateWithB3JWT(response.accessToken);
|
|
222
|
+
debug("BSMNT authentication successful", b3Jwt);
|
|
223
|
+
}
|
|
211
224
|
} catch (bsmntError) {
|
|
212
225
|
// BSMNT authentication failure shouldn't block the main auth flow
|
|
213
226
|
debug("BSMNT authentication failed (non-critical)", bsmntError);
|
|
@@ -219,7 +232,7 @@ export function useAuth() {
|
|
|
219
232
|
throw err;
|
|
220
233
|
}
|
|
221
234
|
},
|
|
222
|
-
[referralCode, setUser],
|
|
235
|
+
[referralCode, setUser, disableBSMNTAuthentication],
|
|
223
236
|
);
|
|
224
237
|
|
|
225
238
|
/**
|
|
@@ -25,7 +25,7 @@ import { useUserQuery } from "./useUserQuery";
|
|
|
25
25
|
const debug = debugB3React("useAuthentication");
|
|
26
26
|
|
|
27
27
|
export function useAuthentication(partnerId: string, { skipAutoConnect = false }: { skipAutoConnect?: boolean } = {}) {
|
|
28
|
-
const { onConnectCallback, onLogoutCallback } = useContext(LocalSDKContext);
|
|
28
|
+
const { onConnectCallback, onLogoutCallback, disableBSMNTAuthentication } = useContext(LocalSDKContext);
|
|
29
29
|
const { disconnect } = useDisconnect();
|
|
30
30
|
const wallets = useConnectedWallets();
|
|
31
31
|
// Keep refs so logout() always disconnects current wallets, not stale closure values.
|
|
@@ -140,9 +140,11 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
|
|
|
140
140
|
setIsAuthenticating(false);
|
|
141
141
|
debug("Re-authenticated successfully", { userAuth });
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
if (!disableBSMNTAuthentication) {
|
|
144
|
+
// Authenticate on BSMNT with B3 JWT
|
|
145
|
+
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
146
|
+
debug("@@b3Jwt", b3Jwt);
|
|
147
|
+
}
|
|
146
148
|
|
|
147
149
|
return userAuth;
|
|
148
150
|
} catch (error) {
|
|
@@ -154,14 +156,25 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
|
|
|
154
156
|
setIsAuthenticating(false);
|
|
155
157
|
debug("Fresh authentication successful", { userAuth });
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
if (!disableBSMNTAuthentication) {
|
|
160
|
+
// Authenticate on BSMNT with B3 JWT
|
|
161
|
+
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
162
|
+
debug("@@b3Jwt", b3Jwt);
|
|
163
|
+
}
|
|
160
164
|
|
|
161
165
|
return userAuth;
|
|
162
166
|
}
|
|
163
167
|
},
|
|
164
|
-
[
|
|
168
|
+
[
|
|
169
|
+
activeWallet,
|
|
170
|
+
partnerId,
|
|
171
|
+
authenticate,
|
|
172
|
+
setIsAuthenticated,
|
|
173
|
+
setIsAuthenticating,
|
|
174
|
+
setUser,
|
|
175
|
+
setHasStartedConnecting,
|
|
176
|
+
disableBSMNTAuthentication,
|
|
177
|
+
],
|
|
165
178
|
);
|
|
166
179
|
|
|
167
180
|
const logout = useCallback(
|