@b3dotfun/sdk 0.1.69 → 0.1.70
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/AnySpend.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +12 -6
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +15 -7
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
- package/dist/cjs/anyspend/utils/chain.js +8 -7
- package/dist/cjs/app.shared.js +9 -7
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/bsmnt.d.ts +0 -1
- package/dist/cjs/global-account/bsmnt.js +0 -6
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
- 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 +11 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +10 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +4 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +36 -4
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +17 -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 +14 -29
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +27 -16
- 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 +68 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +39 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +173 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +14 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +14 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.js +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +141 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +20 -3
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.js +27 -0
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +5 -0
- package/dist/cjs/global-account/react/components/index.js +12 -3
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +6 -3
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +31 -3
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +158 -0
- package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +42 -1
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -24
- package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
- package/dist/cjs/global-account/react/utils/index.js +0 -1
- package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
- package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -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/AnySpend.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +13 -7
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +5 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +15 -6
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +16 -8
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -3
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
- package/dist/esm/anyspend/utils/chain.js +10 -9
- package/dist/esm/app.shared.js +9 -7
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/bsmnt.d.ts +0 -1
- package/dist/esm/global-account/bsmnt.js +0 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
- 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 +11 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +5 -8
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +5 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +37 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +7 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +16 -8
- 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 +16 -31
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +27 -16
- 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 +65 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +39 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +170 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +15 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +14 -5
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.js +7 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +19 -2
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
- package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.js +21 -0
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +5 -0
- package/dist/esm/global-account/react/components/index.js +5 -0
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
- package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +6 -3
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +33 -5
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +150 -0
- package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +42 -1
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -23
- package/dist/esm/global-account/react/utils/index.d.ts +0 -1
- package/dist/esm/global-account/react/utils/index.js +0 -1
- package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
- package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- 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/AnySpend.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/bsmnt.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -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 +11 -2
- 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 +39 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +8 -0
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
- package/dist/types/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +5 -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/useAutoSelectWallet.d.ts +6 -3
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
- package/dist/types/global-account/react/stores/useModalStore.d.ts +42 -1
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -31
- package/dist/types/global-account/react/utils/index.d.ts +0 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +1 -1
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/dist/types/shared/utils/chains.d.ts +1 -1
- package/dist/types/shared/utils/session-duration.d.ts +15 -0
- package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
- package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
- package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
- package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
- package/dist/types/wallet/react/index.d.ts +5 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
- package/package.json +15 -6
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpend.tsx +24 -12
- package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +3 -0
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +29 -14
- package/src/anyspend/react/components/AnySpendDeposit.tsx +51 -34
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +3 -0
- package/src/anyspend/react/components/AnySpendNFT.tsx +6 -2
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +5 -2
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +5 -2
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/AnySpendWorkflowTrigger.tsx +4 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +3 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +29 -5
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
- package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +99 -83
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
- package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
- package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
- package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
- package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
- package/src/anyspend/utils/chain.ts +9 -9
- package/src/app.shared.ts +9 -8
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/bsmnt.ts +0 -6
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +3 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +4 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +56 -37
- 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/BottomNavigation.tsx +18 -14
- package/src/global-account/react/components/ManageAccount/Header.tsx +71 -4
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +25 -19
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +13 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +40 -15
- package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +35 -54
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +31 -22
- package/src/global-account/react/components/Send/Send.tsx +8 -5
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +145 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +446 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +42 -13
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +20 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
- package/src/global-account/react/components/SignInWithB3/components/PasswordInput.tsx +62 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +315 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +24 -4
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
- package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
- package/src/global-account/react/components/UserAvatar/UserAvatar.tsx +45 -0
- package/src/global-account/react/components/index.ts +11 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +28 -17
- package/src/global-account/react/hooks/useAuthentication.ts +24 -13
- package/src/global-account/react/hooks/useAutoSelectWallet.ts +40 -6
- package/src/global-account/react/hooks/useBetterAuth.ts +192 -0
- package/src/global-account/react/hooks/useConnect.tsx +2 -2
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -1
- package/src/global-account/react/stores/useModalStore.ts +43 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +6 -25
- package/src/global-account/react/utils/index.ts +0 -1
- package/src/global-account/react/utils/profileDisplay.ts +21 -19
- package/src/shared/constants/chains/b3Chain.ts +5 -5
- package/src/shared/constants/chains/b3Viem.ts +18 -0
- package/src/shared/constants/index.ts +2 -0
- package/src/shared/generated/chain-networks.json +2 -2
- package/src/shared/utils/chains.ts +3 -2
- package/src/shared/utils/session-duration.ts +64 -0
- package/src/types/torph.d.ts +4 -0
- package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
- package/src/wallet/react/components/ConnectWallet.tsx +665 -0
- package/src/wallet/react/components/WalletProvider.tsx +64 -0
- package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
- package/src/wallet/react/hooks/useWalletState.ts +93 -0
- package/src/wallet/react/index.ts +10 -0
- package/src/wallet/utils/createWalletConfig.ts +39 -0
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
- package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
- package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
- package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
- package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
- package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
- package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
- package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
- package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
- package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
- package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
- package/src/global-account/react/hooks/useRPMToken.ts +0 -17
- package/src/global-account/react/utils/updateAvatar.ts +0 -21
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
SignInWithB3ModalProps,
|
|
5
5
|
StyleRoot,
|
|
6
6
|
useAccountWallet,
|
|
7
|
+
useAuthStore,
|
|
7
8
|
useAuthentication,
|
|
8
9
|
useB3Config,
|
|
9
10
|
useIsMobile,
|
|
@@ -14,6 +15,8 @@ import { cn, truncateAddress } from "@b3dotfun/sdk/shared/utils";
|
|
|
14
15
|
import { Menu, MenuButton, MenuItems, Transition } from "@headlessui/react";
|
|
15
16
|
import { ReactNode, useEffect } from "react";
|
|
16
17
|
import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdweb/react";
|
|
18
|
+
import { useUser } from "../../hooks/useUser";
|
|
19
|
+
import { UserAvatar } from "../UserAvatar/UserAvatar";
|
|
17
20
|
import { ManageAccountButton } from "../custom/ManageAccountButton";
|
|
18
21
|
|
|
19
22
|
type SignInProps = {
|
|
@@ -30,7 +33,9 @@ type SignInWithB3Props = Omit<SignInWithB3ModalProps, "type" | "showBackButton">
|
|
|
30
33
|
|
|
31
34
|
export function SignIn(props: SignInWithB3Props) {
|
|
32
35
|
const { className } = props;
|
|
33
|
-
const { automaticallySetFirstEoa, partnerId } = useB3Config();
|
|
36
|
+
const { automaticallySetFirstEoa, partnerId, authStrategy } = useB3Config();
|
|
37
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
38
|
+
|
|
34
39
|
const {
|
|
35
40
|
address: globalAddress,
|
|
36
41
|
ensName,
|
|
@@ -53,6 +58,11 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
53
58
|
|
|
54
59
|
const setActiveWallet = useSetActiveWallet();
|
|
55
60
|
|
|
61
|
+
// Better Auth state
|
|
62
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
63
|
+
const { user } = useUser();
|
|
64
|
+
const userDisplayName = user?.username || user?.email || "Account";
|
|
65
|
+
|
|
56
66
|
const handleSetActiveAccount = (selectedWalletId: string | undefined) => {
|
|
57
67
|
if (
|
|
58
68
|
!selectedWalletId ||
|
|
@@ -72,21 +82,29 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
72
82
|
}
|
|
73
83
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
74
84
|
|
|
85
|
+
const isLoggedIn = isBetterAuth ? isAuthenticated : !!globalAddress;
|
|
86
|
+
|
|
75
87
|
// Desktop version - original dropdown menu
|
|
76
88
|
return (
|
|
77
89
|
<StyleRoot>
|
|
78
90
|
<Menu className={`relative flex items-center ${className || ""}`} as="div">
|
|
79
|
-
{
|
|
91
|
+
{isLoggedIn ? (
|
|
80
92
|
<>
|
|
81
93
|
<MenuButton className="bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3 focus:outline-none">
|
|
82
|
-
{
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
{isBetterAuth ? (
|
|
95
|
+
<UserAvatar avatarUrl={user?.avatar} name={userDisplayName} size={24} />
|
|
96
|
+
) : (
|
|
97
|
+
!!walletImage && (
|
|
98
|
+
<IPFSMediaRenderer
|
|
99
|
+
src={walletImage}
|
|
100
|
+
alt="Wallet Image"
|
|
101
|
+
className="bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100"
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
88
104
|
)}
|
|
89
|
-
<div className="text-as-primary">
|
|
105
|
+
<div className="text-as-primary">
|
|
106
|
+
{isBetterAuth ? userDisplayName : ensName ? ensName : truncateAddress(globalAddress ?? "")}
|
|
107
|
+
</div>
|
|
90
108
|
</MenuButton>
|
|
91
109
|
<Transition
|
|
92
110
|
enter="duration-200 ease-out"
|
|
@@ -103,7 +121,16 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
103
121
|
anchor={isMobile ? "top end" : undefined}
|
|
104
122
|
>
|
|
105
123
|
<div className="bg-b3-react-background">
|
|
106
|
-
{
|
|
124
|
+
{isBetterAuth ? (
|
|
125
|
+
/* Better Auth: show user info instead of wallet switching */
|
|
126
|
+
<div className="flex items-center gap-3 rounded-xl p-3">
|
|
127
|
+
<UserAvatar avatarUrl={user?.avatar} name={userDisplayName} size={48} />
|
|
128
|
+
<div className="flex flex-col gap-0.5">
|
|
129
|
+
{user?.username && <div className="text-b3-react-primary font-semibold">{user.username}</div>}
|
|
130
|
+
{user?.email && <div className="text-b3-react-secondary text-sm">{user.email}</div>}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
) : connectedEOAWallet ? (
|
|
107
134
|
<div
|
|
108
135
|
className={cn(
|
|
109
136
|
"border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3",
|
|
@@ -118,7 +145,7 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
118
145
|
/>
|
|
119
146
|
<div className="ml-4 grow">
|
|
120
147
|
{ensName && <div>{ensName}</div>}
|
|
121
|
-
<div>{truncateAddress(globalAddress)}</div>
|
|
148
|
+
<div>{truncateAddress(globalAddress ?? "")}</div>
|
|
122
149
|
{/* <div>{walletInfo?.name}</div> */}
|
|
123
150
|
</div>
|
|
124
151
|
</div>
|
|
@@ -143,7 +170,7 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
143
170
|
/>
|
|
144
171
|
<div className="grow pl-4">
|
|
145
172
|
{ensName && <div>{ensName}</div>}
|
|
146
|
-
<div>{truncateAddress(globalAddress)}</div>
|
|
173
|
+
<div>{truncateAddress(globalAddress ?? "")}</div>
|
|
147
174
|
<div>Smart wallet</div>
|
|
148
175
|
</div>
|
|
149
176
|
</div>
|
|
@@ -159,7 +186,9 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
159
186
|
<button className="mb-2 w-full space-y-1" onClick={onDisconnect}>
|
|
160
187
|
<div className="hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors">
|
|
161
188
|
<Icon className="fill-b3-react-primary mr-4 shrink-0 transition-colors" name="logout" />
|
|
162
|
-
<div className="text-b3-react-primary mr-auto transition-colors">
|
|
189
|
+
<div className="text-b3-react-primary mr-auto transition-colors">
|
|
190
|
+
{isBetterAuth ? "Sign out" : "Disconnect"}
|
|
191
|
+
</div>
|
|
163
192
|
</div>
|
|
164
193
|
</button>
|
|
165
194
|
</div>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useGetAllTWSigners,
|
|
8
8
|
useModalStore,
|
|
9
9
|
} from "@b3dotfun/sdk/global-account/react";
|
|
10
|
+
import { LoginStepBetterAuth } from "./steps/LoginStepBetterAuth";
|
|
10
11
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
11
12
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
13
|
import { useActiveAccount } from "thirdweb/react";
|
|
@@ -33,8 +34,9 @@ export function SignInWithB3Flow({
|
|
|
33
34
|
closeAfterLogin = false,
|
|
34
35
|
source = "signInWithB3Button",
|
|
35
36
|
signersEnabled = false,
|
|
37
|
+
verifyEmailRedirectTo,
|
|
36
38
|
}: SignInWithB3ModalProps) {
|
|
37
|
-
const { automaticallySetFirstEoa } = useB3Config();
|
|
39
|
+
const { automaticallySetFirstEoa, authStrategy } = useB3Config();
|
|
38
40
|
// skipAutoConnect: this component intentionally logs out on mount to show a fresh login screen.
|
|
39
41
|
// AuthenticationProvider is the sole owner of useAutoConnect to avoid competing auth cycles.
|
|
40
42
|
const { user, logout } = useAuthentication(partnerId, { skipAutoConnect: true });
|
|
@@ -42,10 +44,13 @@ export function SignInWithB3Flow({
|
|
|
42
44
|
// Tracks whether the pre-login logout has finished.
|
|
43
45
|
// We must not render ConnectEmbed until logout (wallet disconnect) completes,
|
|
44
46
|
// otherwise the wallet state disrupts ConnectEmbed causing a blank modal.
|
|
45
|
-
const [readyToShowLogin, setReadyToShowLogin] = useState(
|
|
47
|
+
const [readyToShowLogin, setReadyToShowLogin] = useState(
|
|
48
|
+
source === "requestPermissions" || authStrategy === "better-auth",
|
|
49
|
+
);
|
|
46
50
|
const hasLoggedOutRef = useRef(false);
|
|
47
51
|
useEffect(() => {
|
|
48
52
|
if (hasLoggedOutRef.current) return;
|
|
53
|
+
if (authStrategy === "better-auth") return;
|
|
49
54
|
if (source !== "requestPermissions") {
|
|
50
55
|
debug("Logging out before login");
|
|
51
56
|
hasLoggedOutRef.current = true;
|
|
@@ -53,7 +58,7 @@ export function SignInWithB3Flow({
|
|
|
53
58
|
setReadyToShowLogin(true);
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
|
-
}, [source, logout]);
|
|
61
|
+
}, [source, logout, authStrategy]);
|
|
57
62
|
|
|
58
63
|
const [step, setStep] = useState<"login" | "permissions" | null>(source === "requestPermissions" ? null : "login");
|
|
59
64
|
const [sessionKeyAdded, setSessionKeyAdded] = useState(source === "requestPermissions" ? true : false);
|
|
@@ -284,7 +289,18 @@ export function SignInWithB3Flow({
|
|
|
284
289
|
} else if (step === "login") {
|
|
285
290
|
// Show loading spinner while: authenticating, waiting for pre-login logout to finish,
|
|
286
291
|
// or fetching signers.
|
|
287
|
-
if (
|
|
292
|
+
if (authStrategy === "better-auth") {
|
|
293
|
+
// Better Auth manages its own loading/verification states internally.
|
|
294
|
+
// Don't gate on isAuthenticating — it would unmount the component
|
|
295
|
+
// and lose verification state when setIsAuthenticating(false) fires.
|
|
296
|
+
content = (
|
|
297
|
+
<LoginStepBetterAuth
|
|
298
|
+
onSuccess={() => handleLoginSuccess({} as Account)}
|
|
299
|
+
onError={onError}
|
|
300
|
+
verifyEmailRedirectTo={verifyEmailRedirectTo}
|
|
301
|
+
/>
|
|
302
|
+
);
|
|
303
|
+
} else if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
|
|
288
304
|
content = (
|
|
289
305
|
<LoginStepContainer partnerId={partnerId}>
|
|
290
306
|
<div className="my-8 flex min-h-[350px] items-center justify-center">
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Button } from "../../custom/Button";
|
|
2
|
-
import {
|
|
2
|
+
import { Github, Mail } from "lucide-react";
|
|
3
|
+
import { strategyIcons, strategyLabels } from "../utils/signInUtils";
|
|
4
|
+
|
|
5
|
+
const fallbackIcons = {
|
|
6
|
+
github: Github,
|
|
7
|
+
email: Mail,
|
|
8
|
+
} as const;
|
|
3
9
|
|
|
4
10
|
export function AuthButton({
|
|
5
11
|
strategy,
|
|
@@ -10,14 +16,27 @@ export function AuthButton({
|
|
|
10
16
|
onClick: () => void;
|
|
11
17
|
isLoading: boolean;
|
|
12
18
|
}) {
|
|
19
|
+
const strategyIcon = strategyIcons[strategy];
|
|
20
|
+
const strategyLabel = strategyLabels[strategy] || strategy;
|
|
21
|
+
const FallbackIcon = fallbackIcons[strategy as keyof typeof fallbackIcons];
|
|
22
|
+
const buttonLabel = `Sign in with ${strategyLabel}`;
|
|
23
|
+
|
|
13
24
|
return (
|
|
14
25
|
<Button
|
|
15
26
|
key={strategy}
|
|
16
27
|
onClick={onClick}
|
|
17
28
|
disabled={isLoading}
|
|
29
|
+
aria-label={buttonLabel}
|
|
30
|
+
title={buttonLabel}
|
|
18
31
|
className="flex w-full items-center justify-center bg-gray-100 px-2 py-3 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700"
|
|
19
32
|
>
|
|
20
|
-
|
|
33
|
+
{strategyIcon ? (
|
|
34
|
+
<img src={strategyIcon} alt={`${strategyLabel} icon`} className="h-9 w-9" />
|
|
35
|
+
) : FallbackIcon ? (
|
|
36
|
+
<FallbackIcon className="h-9 w-9 text-gray-900 dark:text-gray-100" />
|
|
37
|
+
) : (
|
|
38
|
+
<span className="text-sm font-semibold text-gray-900 dark:text-gray-100">{strategyLabel.charAt(0)}</span>
|
|
39
|
+
)}
|
|
21
40
|
</Button>
|
|
22
41
|
);
|
|
23
42
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Input } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
interface PasswordInputProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function PasswordInput({
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
disabled,
|
|
17
|
+
placeholder = "Password",
|
|
18
|
+
onKeyDown,
|
|
19
|
+
className,
|
|
20
|
+
}: PasswordInputProps) {
|
|
21
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="relative">
|
|
25
|
+
<Input
|
|
26
|
+
type={showPassword ? "text" : "password"}
|
|
27
|
+
placeholder={placeholder}
|
|
28
|
+
value={value}
|
|
29
|
+
onChange={onChange}
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
onKeyDown={onKeyDown}
|
|
32
|
+
className={className}
|
|
33
|
+
/>
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
onClick={() => setShowPassword(!showPassword)}
|
|
37
|
+
aria-label={showPassword ? "Hide password" : "Show password"}
|
|
38
|
+
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300"
|
|
39
|
+
tabIndex={-1}
|
|
40
|
+
>
|
|
41
|
+
{showPassword ? (
|
|
42
|
+
<svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.5}>
|
|
43
|
+
<path
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
d="M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
|
|
47
|
+
/>
|
|
48
|
+
</svg>
|
|
49
|
+
) : (
|
|
50
|
+
<svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.5}>
|
|
51
|
+
<path
|
|
52
|
+
strokeLinecap="round"
|
|
53
|
+
strokeLinejoin="round"
|
|
54
|
+
d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
|
|
55
|
+
/>
|
|
56
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
|
57
|
+
</svg>
|
|
58
|
+
)}
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
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
|
+
import { PasswordInput } from "../components/PasswordInput";
|
|
11
|
+
|
|
12
|
+
const debug = debugB3React("LoginStepBetterAuth");
|
|
13
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
14
|
+
|
|
15
|
+
const SOCIAL_PROVIDERS: { id: BetterAuthSocialProvider; label: string }[] = [
|
|
16
|
+
{ id: "google", label: "Google" },
|
|
17
|
+
{ id: "github", label: "GitHub" },
|
|
18
|
+
{ id: "discord", label: "Discord" },
|
|
19
|
+
{ id: "microsoft", label: "Microsoft" },
|
|
20
|
+
{ id: "slack", label: "Slack" },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
interface LoginStepBetterAuthProps {
|
|
24
|
+
onSuccess?: () => void;
|
|
25
|
+
onError?: (error: Error) => Promise<void>;
|
|
26
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
27
|
+
verifyEmailRedirectTo?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }: LoginStepBetterAuthProps) {
|
|
31
|
+
const { partnerId } = useB3Config();
|
|
32
|
+
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
|
|
33
|
+
|
|
34
|
+
const [mode, setMode] = useState<"sign-in" | "sign-up" | "forgot-password">("sign-in");
|
|
35
|
+
const [showEmailForm, setShowEmailForm] = useState(false);
|
|
36
|
+
const [email, setEmail] = useState("");
|
|
37
|
+
const [password, setPassword] = useState("");
|
|
38
|
+
const [name, setName] = useState("");
|
|
39
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
40
|
+
const [error, setError] = useState<string | null>(null);
|
|
41
|
+
const [resetEmailSent, setResetEmailSent] = useState(false);
|
|
42
|
+
const [verificationSent, setVerificationSent] = useState(false);
|
|
43
|
+
|
|
44
|
+
const handleEmailSubmit = async () => {
|
|
45
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
46
|
+
|
|
47
|
+
if (!EMAIL_REGEX.test(normalizedEmail)) {
|
|
48
|
+
setError("Please enter a valid email address");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!password) {
|
|
53
|
+
setError("Please enter a password");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (mode === "sign-up" && !name.trim()) {
|
|
58
|
+
setError("Please enter your name");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
setIsLoading(true);
|
|
64
|
+
setError(null);
|
|
65
|
+
|
|
66
|
+
if (mode === "sign-up") {
|
|
67
|
+
debug("Signing up", { email: normalizedEmail, name: name.trim() });
|
|
68
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
69
|
+
} else {
|
|
70
|
+
debug("Signing in", { email: normalizedEmail });
|
|
71
|
+
await signInWithEmail(normalizedEmail, password);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
debug("Auth successful");
|
|
75
|
+
onSuccess?.();
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (err instanceof EmailVerificationRequiredError) {
|
|
78
|
+
setVerificationSent(true);
|
|
79
|
+
setError(null);
|
|
80
|
+
} else {
|
|
81
|
+
const message = err instanceof Error ? err.message : "Authentication failed";
|
|
82
|
+
setError(message);
|
|
83
|
+
await onError?.(err as Error);
|
|
84
|
+
}
|
|
85
|
+
debug("Auth failed", err);
|
|
86
|
+
} finally {
|
|
87
|
+
setPassword("");
|
|
88
|
+
setIsLoading(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleForgotPassword = async () => {
|
|
93
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
94
|
+
|
|
95
|
+
if (!EMAIL_REGEX.test(normalizedEmail)) {
|
|
96
|
+
setError("Please enter a valid email address");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
setIsLoading(true);
|
|
102
|
+
setError(null);
|
|
103
|
+
await requestPasswordReset(normalizedEmail);
|
|
104
|
+
setResetEmailSent(true);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
const message = err instanceof Error ? err.message : "Failed to send reset email";
|
|
107
|
+
setError(message);
|
|
108
|
+
} finally {
|
|
109
|
+
setIsLoading(false);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const handleSocialSignIn = async (provider: BetterAuthSocialProvider) => {
|
|
114
|
+
try {
|
|
115
|
+
setIsLoading(true);
|
|
116
|
+
setError(null);
|
|
117
|
+
await signInWithSocial(provider);
|
|
118
|
+
} catch (err) {
|
|
119
|
+
const message = err instanceof Error ? err.message : `${provider} sign in failed`;
|
|
120
|
+
setError(message);
|
|
121
|
+
await onError?.(err as Error);
|
|
122
|
+
setIsLoading(false);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
if (verificationSent) {
|
|
127
|
+
return (
|
|
128
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
129
|
+
<div className="mb-6 w-full space-y-4 px-3 text-center">
|
|
130
|
+
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
|
|
131
|
+
<svg className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
132
|
+
<path
|
|
133
|
+
strokeLinecap="round"
|
|
134
|
+
strokeLinejoin="round"
|
|
135
|
+
strokeWidth={2}
|
|
136
|
+
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"
|
|
137
|
+
/>
|
|
138
|
+
</svg>
|
|
139
|
+
</div>
|
|
140
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-100">Check your email</p>
|
|
141
|
+
<p className="text-xs text-gray-500 dark:text-gray-400">
|
|
142
|
+
We sent a verification link to <span className="font-medium text-gray-700 dark:text-gray-200">{email}</span>
|
|
143
|
+
. Verify your account, then come back and sign in.
|
|
144
|
+
</p>
|
|
145
|
+
<button
|
|
146
|
+
onClick={() => {
|
|
147
|
+
setVerificationSent(false);
|
|
148
|
+
setMode("sign-in");
|
|
149
|
+
setShowEmailForm(true);
|
|
150
|
+
setPassword("");
|
|
151
|
+
}}
|
|
152
|
+
className="text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"
|
|
153
|
+
>
|
|
154
|
+
Back to sign in
|
|
155
|
+
</button>
|
|
156
|
+
</div>
|
|
157
|
+
</LoginStepContainer>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
163
|
+
{mode === "forgot-password" ? (
|
|
164
|
+
<div className="mb-6 w-full space-y-3 px-3">
|
|
165
|
+
<p className="text-center text-sm font-medium text-gray-900 dark:text-gray-100">Reset password</p>
|
|
166
|
+
<p className="text-center text-xs text-gray-500">
|
|
167
|
+
{resetEmailSent
|
|
168
|
+
? "We've sent a password reset link to your email"
|
|
169
|
+
: "Enter your email and we'll send you a reset link"}
|
|
170
|
+
</p>
|
|
171
|
+
|
|
172
|
+
{resetEmailSent ? (
|
|
173
|
+
<div className="space-y-3 py-4 text-center">
|
|
174
|
+
<p className="text-sm text-green-600">Check your email for a reset link.</p>
|
|
175
|
+
</div>
|
|
176
|
+
) : (
|
|
177
|
+
<>
|
|
178
|
+
<Input
|
|
179
|
+
type="email"
|
|
180
|
+
placeholder="you@example.com"
|
|
181
|
+
value={email}
|
|
182
|
+
onChange={event => setEmail(event.target.value)}
|
|
183
|
+
disabled={isLoading}
|
|
184
|
+
onKeyDown={event => {
|
|
185
|
+
if (event.key === "Enter") handleForgotPassword();
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
|
|
189
|
+
{error && <p className="text-sm text-red-500">{error}</p>}
|
|
190
|
+
|
|
191
|
+
<Button onClick={handleForgotPassword} disabled={isLoading} className="w-full">
|
|
192
|
+
{isLoading ? "Sending..." : "Send reset link"}
|
|
193
|
+
</Button>
|
|
194
|
+
</>
|
|
195
|
+
)}
|
|
196
|
+
|
|
197
|
+
<button
|
|
198
|
+
onClick={() => {
|
|
199
|
+
setMode("sign-in");
|
|
200
|
+
setShowEmailForm(true);
|
|
201
|
+
setError(null);
|
|
202
|
+
setResetEmailSent(false);
|
|
203
|
+
}}
|
|
204
|
+
className="w-full text-center text-sm text-gray-500 hover:text-gray-700"
|
|
205
|
+
>
|
|
206
|
+
Back to sign in
|
|
207
|
+
</button>
|
|
208
|
+
</div>
|
|
209
|
+
) : showEmailForm ? (
|
|
210
|
+
<div className="mb-6 w-full space-y-3 px-3">
|
|
211
|
+
<p className="text-center text-sm font-medium text-gray-900 dark:text-gray-100">
|
|
212
|
+
{mode === "sign-in" ? "Sign in with email" : "Create an account"}
|
|
213
|
+
</p>
|
|
214
|
+
|
|
215
|
+
{mode === "sign-up" && (
|
|
216
|
+
<Input
|
|
217
|
+
type="text"
|
|
218
|
+
placeholder="Your name"
|
|
219
|
+
value={name}
|
|
220
|
+
onChange={event => setName(event.target.value)}
|
|
221
|
+
disabled={isLoading}
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
<Input
|
|
226
|
+
type="email"
|
|
227
|
+
placeholder="you@example.com"
|
|
228
|
+
value={email}
|
|
229
|
+
onChange={event => setEmail(event.target.value)}
|
|
230
|
+
disabled={isLoading}
|
|
231
|
+
/>
|
|
232
|
+
|
|
233
|
+
<PasswordInput
|
|
234
|
+
key={mode}
|
|
235
|
+
value={password}
|
|
236
|
+
onChange={event => setPassword(event.target.value)}
|
|
237
|
+
disabled={isLoading}
|
|
238
|
+
onKeyDown={event => {
|
|
239
|
+
if (event.key === "Enter") handleEmailSubmit();
|
|
240
|
+
}}
|
|
241
|
+
className="pr-11"
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
{error && <p className="text-sm text-red-500">{error}</p>}
|
|
245
|
+
|
|
246
|
+
<Button onClick={handleEmailSubmit} disabled={isLoading} className="w-full">
|
|
247
|
+
{isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up"}
|
|
248
|
+
</Button>
|
|
249
|
+
|
|
250
|
+
{mode === "sign-in" && (
|
|
251
|
+
<button
|
|
252
|
+
onClick={() => {
|
|
253
|
+
setMode("forgot-password");
|
|
254
|
+
setError(null);
|
|
255
|
+
}}
|
|
256
|
+
disabled={isLoading}
|
|
257
|
+
className="w-full text-center text-xs text-gray-500 hover:text-gray-700"
|
|
258
|
+
>
|
|
259
|
+
Forgot password?
|
|
260
|
+
</button>
|
|
261
|
+
)}
|
|
262
|
+
|
|
263
|
+
<button
|
|
264
|
+
onClick={() => {
|
|
265
|
+
setMode(mode === "sign-in" ? "sign-up" : "sign-in");
|
|
266
|
+
setError(null);
|
|
267
|
+
}}
|
|
268
|
+
disabled={isLoading}
|
|
269
|
+
className="w-full text-center text-sm text-gray-500 hover:text-gray-700"
|
|
270
|
+
>
|
|
271
|
+
{mode === "sign-in" ? "Don't have an account? Sign up" : "Already have an account? Sign in"}
|
|
272
|
+
</button>
|
|
273
|
+
|
|
274
|
+
<Button
|
|
275
|
+
variant="outline"
|
|
276
|
+
onClick={() => {
|
|
277
|
+
setShowEmailForm(false);
|
|
278
|
+
setError(null);
|
|
279
|
+
}}
|
|
280
|
+
disabled={isLoading}
|
|
281
|
+
className="w-full"
|
|
282
|
+
>
|
|
283
|
+
Back
|
|
284
|
+
</Button>
|
|
285
|
+
</div>
|
|
286
|
+
) : (
|
|
287
|
+
<div className="mb-6 w-full space-y-4 px-3">
|
|
288
|
+
{/* Social providers */}
|
|
289
|
+
<div className="grid w-full grid-cols-3 gap-4">
|
|
290
|
+
{SOCIAL_PROVIDERS.map(provider => (
|
|
291
|
+
<AuthButton
|
|
292
|
+
key={provider.id}
|
|
293
|
+
strategy={provider.id}
|
|
294
|
+
onClick={() => handleSocialSignIn(provider.id)}
|
|
295
|
+
isLoading={isLoading}
|
|
296
|
+
/>
|
|
297
|
+
))}
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
{/* Divider */}
|
|
301
|
+
<div className="flex items-center gap-3">
|
|
302
|
+
<div className="h-px flex-1 bg-gray-200" />
|
|
303
|
+
<span className="text-xs text-gray-400">or</span>
|
|
304
|
+
<div className="h-px flex-1 bg-gray-200" />
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
{/* Email option */}
|
|
308
|
+
<AuthButton strategy="email" onClick={() => setShowEmailForm(true)} isLoading={isLoading} />
|
|
309
|
+
|
|
310
|
+
{error && <p className="text-center text-sm text-red-500">{error}</p>}
|
|
311
|
+
</div>
|
|
312
|
+
)}
|
|
313
|
+
</LoginStepContainer>
|
|
314
|
+
);
|
|
315
|
+
}
|