@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.2
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/index.d.ts +0 -2
- package/dist/cjs/anyspend/constants/index.js +1 -3
- package/dist/cjs/anyspend/index.d.ts +0 -2
- package/dist/cjs/anyspend/index.js +0 -3
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +1 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -1
- package/dist/cjs/global-account/react/components/index.js +6 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
- package/dist/cjs/global-account/react/hooks/index.js +1 -5
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +22 -50
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
- package/dist/cjs/global-account/react/index.native.d.ts +2 -0
- package/dist/cjs/global-account/react/index.native.js +5 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -2
- package/dist/esm/anyspend/constants/index.js +0 -2
- package/dist/esm/anyspend/index.d.ts +0 -2
- package/dist/esm/anyspend/index.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +3 -5
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -1
- package/dist/esm/global-account/react/components/index.js +2 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
- package/dist/esm/global-account/react/hooks/index.js +0 -2
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +22 -50
- package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
- package/dist/esm/global-account/react/index.native.d.ts +2 -0
- package/dist/esm/global-account/react/index.native.js +2 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -2
- package/dist/types/anyspend/index.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/types/global-account/react/components/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/types/global-account/react/index.native.d.ts +2 -0
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -3
- package/src/anyspend/index.ts +0 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -28
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
- package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
- package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
- package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
- package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/hooks/index.ts +0 -1
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/B3Provider/types.ts +50 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
- package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
- package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +100 -168
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +4 -7
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -2
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
- package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +23 -54
- package/src/global-account/react/hooks/useUserQuery.ts +40 -1
- package/src/global-account/react/index.native.ts +2 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -10
- package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
- package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
- package/dist/cjs/anyspend/services/gas.d.ts +0 -21
- package/dist/cjs/anyspend/services/gas.js +0 -65
- package/dist/cjs/anyspend/types/gas.d.ts +0 -61
- package/dist/cjs/anyspend/types/gas.js +0 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/cjs/global-account/react/hooks/useAuth.js +0 -337
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/cjs/global-account/react/stores/userStore.js +0 -30
- package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
- package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
- package/dist/esm/anyspend/services/gas.d.ts +0 -21
- package/dist/esm/anyspend/services/gas.js +0 -59
- package/dist/esm/anyspend/types/gas.d.ts +0 -61
- package/dist/esm/anyspend/types/gas.js +0 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/esm/global-account/react/hooks/useAuth.js +0 -331
- package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/esm/global-account/react/hooks/useUser.js +0 -17
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/esm/global-account/react/stores/userStore.js +0 -27
- package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/types/anyspend/services/gas.d.ts +0 -21
- package/dist/types/anyspend/types/gas.d.ts +0 -61
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
- package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
- package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
- package/src/anyspend/services/gas.test.ts +0 -31
- package/src/anyspend/services/gas.ts +0 -73
- package/src/anyspend/types/gas.ts +0 -66
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
- package/src/global-account/react/hooks/useAuth.ts +0 -379
- package/src/global-account/react/hooks/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.B3Context = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* Context for B3 provider
|
|
7
|
+
*/
|
|
8
|
+
exports.B3Context = (0, react_1.createContext)({
|
|
9
|
+
account: undefined,
|
|
10
|
+
automaticallySetFirstEoa: false,
|
|
11
|
+
//user: undefined,
|
|
12
|
+
//setWallet: () => {},
|
|
13
|
+
wallet: undefined,
|
|
14
|
+
//setUser: () => {},
|
|
15
|
+
//refetchUser: async () => {},
|
|
16
|
+
initialized: false,
|
|
17
|
+
ready: false,
|
|
18
|
+
environment: "development",
|
|
19
|
+
theme: "light",
|
|
20
|
+
clientType: "rest",
|
|
21
|
+
partnerId: "",
|
|
22
|
+
createClientReferenceId: undefined,
|
|
23
|
+
enableTurnkey: false,
|
|
24
|
+
});
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
2
|
+
* Hook to access the B3 context
|
|
3
|
+
* @throws Error if used outside a B3Provider
|
|
4
|
+
* @deprecated Use useB3Config or useB3Account instead
|
|
4
5
|
*/
|
|
5
|
-
export declare function useB3():
|
|
6
|
-
automaticallySetFirstEoa: boolean;
|
|
7
|
-
environment: "development" | "production";
|
|
8
|
-
theme: "light" | "dark";
|
|
9
|
-
clientType: import("../../../client-manager").ClientType;
|
|
10
|
-
partnerId: string;
|
|
11
|
-
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
12
|
-
enableTurnkey: boolean;
|
|
13
|
-
stripePublishableKey: string | undefined;
|
|
14
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
15
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
16
|
-
};
|
|
6
|
+
export declare function useB3(): import("./types").B3ContextType;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3 = useB3;
|
|
4
|
-
const
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const types_1 = require("./types");
|
|
5
6
|
/**
|
|
6
|
-
* Hook to access the B3
|
|
7
|
-
* @
|
|
7
|
+
* Hook to access the B3 context
|
|
8
|
+
* @throws Error if used outside a B3Provider
|
|
9
|
+
* @deprecated Use useB3Config or useB3Account instead
|
|
8
10
|
*/
|
|
9
11
|
function useB3() {
|
|
10
|
-
|
|
12
|
+
const context = (0, react_1.useContext)(types_1.B3Context);
|
|
13
|
+
if (!context.initialized) {
|
|
14
|
+
throw new Error("useB3 must be used within a B3Provider");
|
|
15
|
+
}
|
|
16
|
+
// Return a stable reference
|
|
17
|
+
return (0, react_1.useMemo)(() => context, [context]);
|
|
11
18
|
}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Account = void 0;
|
|
4
4
|
const react_1 = require("thirdweb/react");
|
|
5
|
-
const useAuthStore_1 = require("../../stores/useAuthStore");
|
|
6
5
|
// Wrapper around useActiveAccount
|
|
7
6
|
const useB3Account = () => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
11
|
-
return effectiveAccount;
|
|
7
|
+
const account = (0, react_1.useActiveAccount)();
|
|
8
|
+
return account;
|
|
12
9
|
};
|
|
13
10
|
exports.useB3Account = useB3Account;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access B3 configuration
|
|
3
|
-
* Returns all config values from the Zustand store
|
|
4
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
-
*/
|
|
6
1
|
export declare const useB3Config: () => {
|
|
7
2
|
automaticallySetFirstEoa: boolean;
|
|
8
|
-
environment: "development" | "production";
|
|
3
|
+
environment: "development" | "production" | undefined;
|
|
9
4
|
theme: "light" | "dark";
|
|
10
5
|
clientType: import("../../../client-manager").ClientType;
|
|
11
6
|
partnerId: string;
|
|
12
7
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
13
|
-
enableTurnkey: boolean;
|
|
14
|
-
stripePublishableKey: string | undefined;
|
|
15
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
8
|
+
enableTurnkey: boolean | undefined;
|
|
17
9
|
};
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Config = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
* Hook to access B3 configuration
|
|
7
|
-
* Returns all config values from the Zustand store
|
|
8
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
9
|
-
*/
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const types_1 = require("./types");
|
|
10
6
|
const useB3Config = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const context = (0, react_1.useContext)(types_1.B3Context);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("useB3 must be used within a B3Provider");
|
|
10
|
+
}
|
|
11
|
+
const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
|
|
12
|
+
// Return a stable reference
|
|
13
|
+
return (0, react_1.useMemo)(() => ({
|
|
14
|
+
automaticallySetFirstEoa,
|
|
15
|
+
environment,
|
|
16
|
+
theme,
|
|
17
|
+
clientType,
|
|
18
|
+
partnerId,
|
|
19
|
+
createClientReferenceId,
|
|
20
|
+
enableTurnkey,
|
|
21
|
+
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
23
22
|
};
|
|
24
23
|
exports.useB3Config = useB3Config;
|
|
@@ -17,7 +17,8 @@ const ProfileSection = () => {
|
|
|
17
17
|
address: eoaAddress || account?.address,
|
|
18
18
|
fresh: true,
|
|
19
19
|
});
|
|
20
|
-
const {
|
|
20
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
21
|
+
const { user } = (0, react_1.useAuthentication)(partnerId);
|
|
21
22
|
const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
|
|
22
23
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
23
24
|
const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DiscordChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("../../../../../global-account/react");
|
|
6
5
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
7
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
8
7
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
+
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("DiscordChannel");
|
|
12
12
|
const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [discordId, setDiscordId] = (0,
|
|
15
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
16
|
-
const [showInput, setShowInput] = (0,
|
|
13
|
+
const { partnerId } = (0, useB3_1.useB3)();
|
|
14
|
+
const [discordId, setDiscordId] = (0, react_1.useState)("");
|
|
15
|
+
const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
|
|
16
|
+
const [showInput, setShowInput] = (0, react_1.useState)(false);
|
|
17
17
|
// Detect if we're disconnecting
|
|
18
18
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
19
19
|
const handleConnect = async () => {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("../../../../../global-account/react");
|
|
6
5
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
7
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
8
7
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
+
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("EmailChannel");
|
|
@@ -14,11 +14,11 @@ const validateEmail = (email) => {
|
|
|
14
14
|
return emailRegex.test(email);
|
|
15
15
|
};
|
|
16
16
|
const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
17
|
-
const { partnerId } = (0,
|
|
18
|
-
const [email, setEmail] = (0,
|
|
19
|
-
const [emailError, setEmailError] = (0,
|
|
20
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
21
|
-
const [showInput, setShowInput] = (0,
|
|
17
|
+
const { partnerId } = (0, useB3_1.useB3)();
|
|
18
|
+
const [email, setEmail] = (0, react_1.useState)("");
|
|
19
|
+
const [emailError, setEmailError] = (0, react_1.useState)(null);
|
|
20
|
+
const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
|
|
21
|
+
const [showInput, setShowInput] = (0, react_1.useState)(false);
|
|
22
22
|
// Detect if we're disconnecting by comparing real vs optimistic state
|
|
23
23
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
24
24
|
const handleConnect = async () => {
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PhoneChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("../../../../../global-account/react");
|
|
6
5
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
7
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
8
7
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
+
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("PhoneChannel");
|
|
12
12
|
const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [phoneNumber, setPhoneNumber] = (0,
|
|
15
|
-
const [isConnectingSMS, setIsConnectingSMS] = (0,
|
|
16
|
-
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0,
|
|
17
|
-
const [showInput, setShowInput] = (0,
|
|
13
|
+
const { partnerId } = (0, useB3_1.useB3)();
|
|
14
|
+
const [phoneNumber, setPhoneNumber] = (0, react_1.useState)("");
|
|
15
|
+
const [isConnectingSMS, setIsConnectingSMS] = (0, react_1.useState)(false);
|
|
16
|
+
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0, react_1.useState)(false);
|
|
17
|
+
const [showInput, setShowInput] = (0, react_1.useState)(false);
|
|
18
18
|
// Detect if we're disconnecting
|
|
19
19
|
const isDisconnecting = (isSMSConnected && !isOptimisticallySMSConnected) || (isWhatsAppConnected && !isOptimisticallyWhatsAppConnected);
|
|
20
20
|
const handleConnectSMS = async () => {
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TelegramChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("../../../../../global-account/react");
|
|
6
5
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
7
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
8
7
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
+
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("TelegramChannel");
|
|
12
12
|
const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
15
|
-
const [status, setStatus] = (0,
|
|
13
|
+
const { partnerId } = (0, useB3_1.useB3)();
|
|
14
|
+
const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
|
|
15
|
+
const [status, setStatus] = (0, react_1.useState)("idle");
|
|
16
16
|
// Detect if we're disconnecting
|
|
17
17
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
18
18
|
const handleConnect = async () => {
|
|
@@ -6,22 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RequestPermissions = RequestPermissions;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("../../../../global-account/react");
|
|
9
|
+
const react_2 = require("../../../../global-account/react");
|
|
9
10
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
10
11
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
11
12
|
const lucide_react_1 = require("lucide-react");
|
|
12
|
-
const
|
|
13
|
+
const react_3 = require("react");
|
|
13
14
|
const react_timeago_1 = __importDefault(require("react-timeago"));
|
|
14
|
-
const
|
|
15
|
+
const react_4 = require("thirdweb/react");
|
|
15
16
|
const debug = (0, debug_1.debugB3React)("RequestPermissions");
|
|
16
17
|
/**
|
|
17
18
|
* Component for requesting permissions to access user accounts and contracts
|
|
18
19
|
* Allows users to approve session keys with specific permission settings
|
|
19
20
|
*/
|
|
20
21
|
function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
21
|
-
const [isApproving, setIsApproving] = (0,
|
|
22
|
-
const account = (0,
|
|
23
|
-
const { defaultPermissions } = (0, react_1.
|
|
24
|
-
const DEFAULT_PERMISSIONS = (0,
|
|
22
|
+
const [isApproving, setIsApproving] = (0, react_3.useState)(false);
|
|
23
|
+
const account = (0, react_4.useActiveAccount)();
|
|
24
|
+
const { defaultPermissions } = (0, react_1.useB3)();
|
|
25
|
+
const DEFAULT_PERMISSIONS = (0, react_3.useMemo)(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
25
26
|
const { refetch: refetchSigners } = (0, react_1.useGetAllTWSigners)({
|
|
26
27
|
chain,
|
|
27
28
|
accountAddress: account?.address,
|
|
@@ -40,7 +41,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
|
|
|
40
41
|
},
|
|
41
42
|
chain,
|
|
42
43
|
});
|
|
43
|
-
const handleApprove = (0,
|
|
44
|
+
const handleApprove = (0, react_3.useCallback)(async () => {
|
|
44
45
|
debug("@@handleApprove");
|
|
45
46
|
try {
|
|
46
47
|
setIsApproving(true);
|
|
@@ -70,7 +71,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
|
|
|
70
71
|
timeStyle: "short",
|
|
71
72
|
}).format(date);
|
|
72
73
|
};
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(react_2.PermissionItem, { title: "Make transactions on your behalf", description: (0, jsx_runtime_1.jsxs)("span", { children: ["Up to", " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-primary font-medium", children: [DEFAULT_PERMISSIONS.nativeTokenLimitPerTransaction, " ETH"] }), " ", "per transaction"] }), icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsx)(react_2.PermissionItem, { title: "View your account", description: "See your wallet address and balance", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Approved Contracts" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: DEFAULT_PERMISSIONS.approvedTargets.map((target) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background text-b3-react-muted-foreground rounded-md border px-3 py-2 font-mono text-sm", children: (0, formatAddress_1.formatAddress)(target) }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-muted-foreground text-sm", children: "\u2022 Game Contract" })] }, target))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Permission" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-react-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { children: `Valid for ` }), (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: DEFAULT_PERMISSIONS.endDate, live: false, formatter: (value, unit) => {
|
|
74
75
|
if (unit === "year") {
|
|
75
76
|
return "1 year";
|
|
76
77
|
}
|
|
@@ -15,7 +15,7 @@ const react_4 = require("thirdweb/react");
|
|
|
15
15
|
const ManageAccountButton_1 = require("../custom/ManageAccountButton");
|
|
16
16
|
function SignIn(props) {
|
|
17
17
|
const { className } = props;
|
|
18
|
-
const { automaticallySetFirstEoa, partnerId } = (0, react_1.
|
|
18
|
+
const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
|
|
19
19
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
|
|
20
20
|
const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
|
|
21
21
|
const isMobile = (0, react_1.useIsMobile)();
|
|
@@ -6,7 +6,6 @@ const react_1 = require("../../../../global-account/react");
|
|
|
6
6
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
7
7
|
const react_2 = require("react");
|
|
8
8
|
const react_3 = require("thirdweb/react");
|
|
9
|
-
const TurnkeyAuthModal_1 = require("../TurnkeyAuthModal");
|
|
10
9
|
const SignInWithB3Privy_1 = require("./SignInWithB3Privy");
|
|
11
10
|
const LoginStep_1 = require("./steps/LoginStep");
|
|
12
11
|
const LoginStepCustom_1 = require("./steps/LoginStepCustom");
|
|
@@ -25,9 +24,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
25
24
|
const account = (0, react_3.useActiveAccount)();
|
|
26
25
|
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
27
26
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
28
|
-
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
29
27
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
30
|
-
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
31
28
|
const setJustCompletedLogin = (0, react_1.useAuthStore)(state => state.setJustCompletedLogin);
|
|
32
29
|
const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
|
|
33
30
|
const [refetchError, setRefetchError] = (0, react_2.useState)(null);
|
|
@@ -60,9 +57,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
60
57
|
refetchSigners();
|
|
61
58
|
setRefetchQueued(false);
|
|
62
59
|
}, backoffDelay);
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
-
}, [refetchCount, refetchSigners, onError, refetchQueued]);
|
|
60
|
+
}, [refetchCount, refetchSigners, onError, setRefetchQueued, refetchQueued]);
|
|
66
61
|
// Extract the completion flow logic to be reused
|
|
67
62
|
const handlePostTurnkeyFlow = (0, react_2.useCallback)(() => {
|
|
68
63
|
debug("Running post-Turnkey flow logic");
|
|
@@ -131,10 +126,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
131
126
|
debug("Refetching user after Turnkey success...");
|
|
132
127
|
await refetchUser();
|
|
133
128
|
debug("User refetched successfully");
|
|
134
|
-
// Set authentication and connection state so UI updates properly
|
|
135
|
-
setIsAuthenticated(true);
|
|
136
|
-
setIsConnected(true);
|
|
137
|
-
setJustCompletedLogin(true);
|
|
138
129
|
// After user data is refreshed, close Turnkey modal and go back to sign-in flow
|
|
139
130
|
debug("Switching back to signInWithB3 modal");
|
|
140
131
|
setB3ModalContentType({
|
|
@@ -153,6 +144,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
153
144
|
// The useEffect will re-run with updated user data to complete the sign-in process
|
|
154
145
|
}, [
|
|
155
146
|
refetchUser,
|
|
147
|
+
setB3ModalContentType,
|
|
156
148
|
strategies,
|
|
157
149
|
onLoginSuccess,
|
|
158
150
|
onSessionKeySuccess,
|
|
@@ -163,10 +155,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
163
155
|
closeAfterLogin,
|
|
164
156
|
source,
|
|
165
157
|
signersEnabled,
|
|
166
|
-
setB3ModalContentType,
|
|
167
|
-
setIsAuthenticated,
|
|
168
|
-
setIsConnected,
|
|
169
|
-
setJustCompletedLogin,
|
|
170
158
|
]);
|
|
171
159
|
// Handle post-login flow after signers are loaded
|
|
172
160
|
(0, react_2.useEffect)(() => {
|
|
@@ -184,20 +172,15 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
184
172
|
if (closeAfterLogin) {
|
|
185
173
|
setJustCompletedLogin(true);
|
|
186
174
|
}
|
|
187
|
-
// Check if we should show Turnkey login form
|
|
188
|
-
//
|
|
189
|
-
// - enableTurnkey={true} is set on B3Provider
|
|
190
|
-
// - NEXT_PUBLIC_TURNKEY_PRIMARY is NOT set to true (otherwise Turnkey shows as primary)
|
|
191
|
-
// - User just logged in AND hasn't completed Turnkey auth in this session
|
|
175
|
+
// Check if we should show Turnkey login form
|
|
176
|
+
// Show if enableTurnkey is true AND user just logged in AND hasn't completed Turnkey auth in this session
|
|
192
177
|
// For new users (!turnkeyId): Show email form
|
|
193
178
|
// For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
|
|
194
179
|
// Also check that we're not already showing the Turnkey modal
|
|
195
180
|
const hasTurnkeyId = user?.partnerIds?.turnkeyId;
|
|
196
181
|
const hasTurnkeyEmail = !!user?.email;
|
|
197
182
|
const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
|
|
198
|
-
const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
|
|
199
183
|
const shouldShowTurnkeyModal = enableTurnkey &&
|
|
200
|
-
!isTurnkeyPrimary &&
|
|
201
184
|
user &&
|
|
202
185
|
!turnkeyAuthCompleted &&
|
|
203
186
|
!isTurnkeyModalCurrentlyOpen &&
|
|
@@ -224,9 +207,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
224
207
|
// Normal flow continues after Turnkey auth is complete (or if not needed)
|
|
225
208
|
handlePostTurnkeyFlow();
|
|
226
209
|
}
|
|
227
|
-
},
|
|
228
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
229
|
-
[
|
|
210
|
+
}, [
|
|
230
211
|
signers,
|
|
231
212
|
isFetchingSigners,
|
|
232
213
|
partnerId,
|
|
@@ -242,10 +223,11 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
242
223
|
isAuthenticating,
|
|
243
224
|
isAuthenticated,
|
|
244
225
|
isOpen,
|
|
226
|
+
setJustCompletedLogin,
|
|
245
227
|
user,
|
|
246
228
|
enableTurnkey,
|
|
247
229
|
turnkeyAuthCompleted,
|
|
248
|
-
|
|
230
|
+
handleTurnkeySuccess,
|
|
249
231
|
contentType,
|
|
250
232
|
handlePostTurnkeyFlow,
|
|
251
233
|
]);
|
|
@@ -262,9 +244,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
262
244
|
if (closeAfterLogin && sessionKeyAdded) {
|
|
263
245
|
setB3ModalOpen(false);
|
|
264
246
|
}
|
|
265
|
-
|
|
266
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
267
|
-
}, [closeAfterLogin, sessionKeyAdded]);
|
|
247
|
+
}, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
|
|
268
248
|
const onSessionKeySuccessEnhanced = (0, react_2.useCallback)(() => {
|
|
269
249
|
onSessionKeySuccess?.();
|
|
270
250
|
setB3ModalContentType({
|
|
@@ -310,57 +290,21 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
310
290
|
if (refetchError) {
|
|
311
291
|
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
|
|
312
292
|
}
|
|
293
|
+
else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
294
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
|
295
|
+
}
|
|
313
296
|
else if (step === "login") {
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
debug("Showing Turnkey as primary authentication option", {
|
|
322
|
-
isTurnkeyPrimary,
|
|
323
|
-
turnkeyAuthCompleted,
|
|
324
|
-
isAuthenticated,
|
|
325
|
-
});
|
|
326
|
-
// Show Turnkey authentication as primary option
|
|
327
|
-
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)(TurnkeyAuthModal_1.TurnkeyAuthModal, { onSuccess: async (authenticatedUser) => {
|
|
328
|
-
debug("Turnkey authentication successful in primary flow", { authenticatedUser });
|
|
329
|
-
setTurnkeyAuthCompleted(true);
|
|
330
|
-
// After Turnkey auth, refetch user to get the full user object
|
|
331
|
-
await refetchUser();
|
|
332
|
-
// User is now authenticated via Turnkey
|
|
333
|
-
// Set both isAuthenticated and isConnected to true so UI updates properly
|
|
334
|
-
// Wallet connection is optional and can happen later for signing transactions
|
|
335
|
-
setIsAuthenticated(true);
|
|
336
|
-
setIsConnected(true);
|
|
337
|
-
setJustCompletedLogin(true);
|
|
338
|
-
// Call the login success callback
|
|
339
|
-
onLoginSuccess?.({});
|
|
340
|
-
}, onClose: () => {
|
|
341
|
-
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
342
|
-
setTurnkeyAuthCompleted(true);
|
|
343
|
-
}, initialEmail: "", skipToOtp: false }) }));
|
|
297
|
+
// Custom strategy
|
|
298
|
+
if (strategies?.[0] === "privy") {
|
|
299
|
+
content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
|
|
300
|
+
}
|
|
301
|
+
else if (strategies) {
|
|
302
|
+
// Strategies are explicitly provided
|
|
303
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
|
|
344
304
|
}
|
|
345
305
|
else {
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
// Custom strategy
|
|
352
|
-
if (strategies?.[0] === "privy") {
|
|
353
|
-
content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
|
|
354
|
-
}
|
|
355
|
-
else if (strategies) {
|
|
356
|
-
// Strategies are explicitly provided
|
|
357
|
-
content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
// Default to handle all strategies we support
|
|
361
|
-
content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
|
|
362
|
-
}
|
|
363
|
-
}
|
|
306
|
+
// Default to handle all strategies we support
|
|
307
|
+
content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
|
|
364
308
|
}
|
|
365
309
|
}
|
|
366
310
|
return content;
|
|
@@ -7,7 +7,7 @@ const debug_1 = require("../../../../shared/utils/debug");
|
|
|
7
7
|
const react_2 = require("react");
|
|
8
8
|
const debug = (0, debug_1.debugB3React)("SignInWithB3Privy");
|
|
9
9
|
function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
10
|
-
const { partnerId } = (0, react_1.
|
|
10
|
+
const { partnerId } = (0, react_1.useB3)();
|
|
11
11
|
const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(chain, onSuccess);
|
|
12
12
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
13
13
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
@@ -19,7 +19,7 @@ function LoginStepContainer({ children, partnerId }) {
|
|
|
19
19
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
20
20
|
}
|
|
21
21
|
function LoginStep({ onSuccess, chain }) {
|
|
22
|
-
const { partnerId, theme } = (0, react_1.
|
|
22
|
+
const { partnerId, theme } = (0, react_1.useB3)();
|
|
23
23
|
const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
|
|
24
24
|
partnerId: partnerId,
|
|
25
25
|
});
|
|
@@ -10,7 +10,7 @@ const react_3 = require("thirdweb/react");
|
|
|
10
10
|
const wallets_1 = require("thirdweb/wallets");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("LoginStepCustom");
|
|
12
12
|
function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
13
|
-
const { partnerId } = (0, react_1.
|
|
13
|
+
const { partnerId } = (0, react_1.useB3)();
|
|
14
14
|
const [isLoading, setIsLoading] = (0, react_2.useState)(false);
|
|
15
15
|
const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
|
|
16
16
|
const { connect } = (0, react_1.useConnect)(partnerId, chain);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StyleRoot = StyleRoot;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const useB3_1 = require("./B3Provider/useB3");
|
|
6
6
|
function StyleRoot({ children, id }) {
|
|
7
|
-
const { theme } = (0,
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme":
|
|
7
|
+
const { theme: b3Theme } = (0, useB3_1.useB3)();
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme": b3Theme, children: children }));
|
|
9
9
|
}
|
|
@@ -80,7 +80,5 @@ function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipToOtp = f
|
|
|
80
80
|
console.error("Failed to resend OTP:", err);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
const walletBrand = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend Wallet";
|
|
85
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "font-neue-montreal p-8", children: [step === "email" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: ["Setup your ", walletBrand] }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [(0, jsx_runtime_1.jsxs)("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Please provide an email address to secure", (0, jsx_runtime_1.jsx)("br", {}), "your wallet."] })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("input", { type: "email", placeholder: "email", value: email, onChange: e => setEmail(e.target.value), required: true, disabled: isLoading, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500" }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: isLoading || !email, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: (0, jsx_runtime_1.jsxs)("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows.", (0, jsx_runtime_1.jsx)("br", {}), "Please provide 2FA code sent to your email."] }) }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "Enter code", value: otpCode, onChange: e => setOtpCode(e.target.value.toUpperCase()), required: true, disabled: isLoading, autoFocus: true, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center font-mono text-lg uppercase tracking-wider text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500", maxLength: 20 }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: isLoading || !otpCode, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleResendOtp, disabled: isLoading, className: "text-sm text-blue-600 hover:text-blue-700 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 dark:text-blue-400 dark:hover:text-blue-300", children: "Resend code" })] })] })] })), step === "success" && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "font-neue-montreal p-8", children: [step === "email" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "Setup your AnySpend Wallet" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [(0, jsx_runtime_1.jsxs)("p", { children: ["AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Please provide an email address to secure", (0, jsx_runtime_1.jsx)("br", {}), "your wallet."] })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("input", { type: "email", placeholder: "email", value: email, onChange: e => setEmail(e.target.value), required: true, disabled: isLoading, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500" }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: isLoading || !email, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: (0, jsx_runtime_1.jsxs)("p", { children: ["AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows.", (0, jsx_runtime_1.jsx)("br", {}), "Please provide 2FA code sent to your email."] }) }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "Enter code", value: otpCode, onChange: e => setOtpCode(e.target.value.toUpperCase()), required: true, disabled: isLoading, autoFocus: true, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center font-mono text-lg uppercase tracking-wider text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500", maxLength: 20 }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: isLoading || !otpCode, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleResendOtp, disabled: isLoading, className: "text-sm text-blue-600 hover:text-blue-700 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 dark:text-blue-400 dark:hover:text-blue-300", children: "Resend code" })] })] })] })), step === "success" && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
|
|
86
84
|
}
|
|
@@ -5,8 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("../../../../global-account/react");
|
|
6
6
|
const utils_1 = require("../../../../shared/utils");
|
|
7
7
|
function ManageAccountButton(props) {
|
|
8
|
+
const { partnerId } = (0, react_1.useB3)();
|
|
8
9
|
const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
|
|
9
|
-
const { isConnected } = (0, react_1.
|
|
10
|
+
const { isConnected } = (0, react_1.useAuthentication)(partnerId);
|
|
10
11
|
const handleClickManageAccount = () => {
|
|
11
12
|
setB3ModalContentType({
|
|
12
13
|
...props,
|