@b3dotfun/sdk 0.1.1-test.0 → 0.1.2-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +22 -14
- package/dist/cjs/anyspend/react/components/QRDeposit.js +31 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +25 -0
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- 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/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/cjs/anyspend/react/hooks/useWatchTransfer.js +75 -0
- package/dist/cjs/anyspend/utils/address.d.ts +5 -0
- package/dist/cjs/anyspend/utils/address.js +8 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -1
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +7 -57
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +11 -35
- 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/B3Provider/useB3.d.ts +3 -3
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -20
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +4 -2
- 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/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +163 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.js +5 -0
- package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +3 -2
- package/dist/cjs/global-account/react/components/index.js +6 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +6 -3
- 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 +1 -1
- package/dist/cjs/global-account/react/hooks/useProfile.js +4 -23
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +1 -1
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +64 -39
- package/dist/cjs/global-account/react/index.native.d.ts +0 -2
- package/dist/cjs/global-account/react/index.native.js +1 -5
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
- package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/cjs/global-account/react/stores/userStore.js +30 -0
- package/dist/cjs/global-account/react/utils/profileApi.d.ts +13 -0
- package/dist/cjs/global-account/react/utils/profileApi.js +29 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +23 -15
- package/dist/esm/anyspend/react/components/QRDeposit.js +32 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +10 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +22 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- 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/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/esm/anyspend/react/hooks/useWatchTransfer.js +72 -0
- package/dist/esm/anyspend/utils/address.d.ts +5 -0
- package/dist/esm/anyspend/utils/address.js +7 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -2
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +6 -58
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +10 -37
- 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/B3Provider/useB3.d.ts +3 -3
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -19
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -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 +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +5 -3
- 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/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +160 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.js +1 -0
- package/dist/esm/global-account/react/components/StyleRoot.js +2 -2
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +3 -2
- package/dist/esm/global-account/react/components/index.js +3 -2
- 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.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuth.js +3 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +6 -3
- 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/useProfile.js +1 -20
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +2 -2
- package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/esm/global-account/react/hooks/useUser.js +17 -0
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/esm/global-account/react/hooks/useUserQuery.js +63 -37
- package/dist/esm/global-account/react/index.native.d.ts +0 -2
- package/dist/esm/global-account/react/index.native.js +0 -2
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
- package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/esm/global-account/react/stores/userStore.js +27 -0
- package/dist/esm/global-account/react/utils/profileApi.d.ts +13 -0
- package/dist/esm/global-account/react/utils/profileApi.js +25 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/types/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/types/anyspend/utils/address.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +3 -3
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/types/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/types/global-account/react/utils/profileApi.d.ts +13 -0
- package/package.json +6 -1
- package/src/anyspend/react/components/AnySpend.tsx +3 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +60 -42
- package/src/anyspend/react/components/QRDeposit.tsx +57 -5
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +13 -3
- package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -2
- package/src/anyspend/react/components/common/TransferResultScreen.tsx +107 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- 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/anyspend/react/hooks/useWatchTransfer.ts +114 -0
- package/src/anyspend/utils/address.ts +13 -0
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +6 -2
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +26 -45
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -103
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -12
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -34
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -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 +2 -2
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +7 -3
- 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/SingleUserSearchSelector/README.md +266 -0
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +330 -0
- package/src/global-account/react/components/SingleUserSearchSelector/index.ts +2 -0
- package/src/global-account/react/components/StyleRoot.tsx +2 -2
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +8 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +3 -3
- package/src/global-account/react/hooks/useAuthentication.ts +7 -3
- 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/useProfile.ts +1 -32
- package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +2 -2
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +64 -51
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/useModalStore.ts +70 -1
- package/src/global-account/react/stores/userStore.ts +41 -0
- package/src/global-account/react/utils/profileApi.ts +38 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/src/global-account/react/components/B3Provider/types.ts +0 -50
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication,
|
|
2
|
+
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3Config, useIsMobile, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import Icon from "../../../../global-account/react/components/custom/Icon.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { cn, truncateAddress } from "../../../../shared/utils/index.js";
|
|
@@ -9,7 +9,7 @@ import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdwe
|
|
|
9
9
|
import { ManageAccountButton } from "../custom/ManageAccountButton.js";
|
|
10
10
|
export function SignIn(props) {
|
|
11
11
|
const { className } = props;
|
|
12
|
-
const { automaticallySetFirstEoa, partnerId } =
|
|
12
|
+
const { automaticallySetFirstEoa, partnerId } = useB3Config();
|
|
13
13
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = useAccountWallet();
|
|
14
14
|
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
15
15
|
const isMobile = useIsMobile();
|
|
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "../../../../global-account/react";
|
|
|
3
3
|
* Component that manages the authentication flow for Sign In With B3
|
|
4
4
|
* Handles different login providers, authentication steps, and session key management
|
|
5
5
|
*/
|
|
6
|
-
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, onTurnkeyConnect, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3Config, useGetAllTWSigners, useModalStore, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { useActiveAccount } from "thirdweb/react";
|
|
@@ -13,8 +13,8 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
13
13
|
* Component that manages the authentication flow for Sign In With B3
|
|
14
14
|
* Handles different login providers, authentication steps, and session key management
|
|
15
15
|
*/
|
|
16
|
-
export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
17
|
-
const { automaticallySetFirstEoa, enableTurnkey } =
|
|
16
|
+
export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, onTurnkeyConnect, }) {
|
|
17
|
+
const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
|
|
18
18
|
const { user, refetchUser, logout } = useAuthentication(partnerId);
|
|
19
19
|
// FIXME Logout before login to ensure a clean state
|
|
20
20
|
const hasLoggedOutRef = useRef(false);
|
|
@@ -345,6 +345,8 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
345
345
|
setJustCompletedLogin(true);
|
|
346
346
|
// Call the login success callback
|
|
347
347
|
onLoginSuccess?.({});
|
|
348
|
+
// Call the onTurnkeyConnect callback
|
|
349
|
+
onTurnkeyConnect?.(authenticatedUser);
|
|
348
350
|
}, onClose: () => {
|
|
349
351
|
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
350
352
|
setTurnkeyAuthCompleted(true);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3Config, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
const debug = debugB3React("SignInWithB3Privy");
|
|
6
6
|
export function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
7
|
-
const { partnerId } =
|
|
7
|
+
const { partnerId } = useB3Config();
|
|
8
8
|
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
9
9
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
10
10
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAuthentication,
|
|
2
|
+
import { useAuthentication, useB3Config, useQueryB3 } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { ecosystemWalletId } from "../../../../../shared/constants/index.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { ConnectEmbed, darkTheme, lightTheme } from "thirdweb/react";
|
|
@@ -15,7 +15,7 @@ export function LoginStepContainer({ children, partnerId }) {
|
|
|
15
15
|
return (_jsxs("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
16
16
|
}
|
|
17
17
|
export function LoginStep({ onSuccess, chain }) {
|
|
18
|
-
const { partnerId, theme } =
|
|
18
|
+
const { partnerId, theme } = useB3Config();
|
|
19
19
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
20
20
|
partnerId: partnerId,
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore,
|
|
2
|
+
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { useState } from "react";
|
|
@@ -7,7 +7,7 @@ import { useConnect as useConnectTW } from "thirdweb/react";
|
|
|
7
7
|
import { createWallet } from "thirdweb/wallets";
|
|
8
8
|
const debug = debugB3React("LoginStepCustom");
|
|
9
9
|
export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [isLoading, setIsLoading] = useState(false);
|
|
12
12
|
const [showAllWallets, setShowAllWallets] = useState(false);
|
|
13
13
|
const { connect } = useConnect(partnerId, chain);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CombinedProfile } from "../../hooks/useProfile";
|
|
2
|
+
/**
|
|
3
|
+
* Profile type filter options for SingleUserSearchSelector
|
|
4
|
+
* - b3-ens: B3 ENS profiles
|
|
5
|
+
* - thirdweb-${string}: Thirdweb profiles (e.g., thirdweb-email, thirdweb-wallet)
|
|
6
|
+
* - ens-data: ENS data profiles
|
|
7
|
+
* - global-account: Global account profiles
|
|
8
|
+
*/
|
|
9
|
+
export type ProfileTypeFilter = "b3-ens" | `thirdweb-${string}` | "ens-data" | "global-account";
|
|
10
|
+
export interface SingleUserSearchSelectorProps {
|
|
11
|
+
/**
|
|
12
|
+
* Callback function when a user is selected
|
|
13
|
+
* Returns the complete profile data including all profile types
|
|
14
|
+
*/
|
|
15
|
+
onSelectUser: (profile: CombinedProfile) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Optional: Filter results to only show profiles that include specific types
|
|
18
|
+
* If provided, only profiles containing at least one of these types will be shown
|
|
19
|
+
*/
|
|
20
|
+
profileTypeFilter?: ProfileTypeFilter[];
|
|
21
|
+
/**
|
|
22
|
+
* Optional: Custom placeholder text for the search input
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional: Custom class name for the container
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional: Show clear button when there's input
|
|
31
|
+
*/
|
|
32
|
+
showClearButton?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Optional: Show profile type badges in the result
|
|
35
|
+
*/
|
|
36
|
+
showBadges?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Optional: Minimum characters before triggering search
|
|
39
|
+
*/
|
|
40
|
+
minSearchLength?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* SingleUserSearchSelector Component
|
|
44
|
+
*
|
|
45
|
+
* A specialized component for searching and selecting a single user profile.
|
|
46
|
+
* This component is designed specifically for single-user selection scenarios,
|
|
47
|
+
* not for multi-user or general profile browsing.
|
|
48
|
+
*
|
|
49
|
+
* Features:
|
|
50
|
+
* - Search by address or name
|
|
51
|
+
* - Filter results by profile type (b3-ens, thirdweb-*, ens-data, global-account)
|
|
52
|
+
* - Shows a single result in a dropdown
|
|
53
|
+
* - Callback with complete profile data on selection
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <SingleUserSearchSelector
|
|
58
|
+
* onSelectUser={(profile) => console.log('Selected:', profile)}
|
|
59
|
+
* profileTypeFilter={['b3-ens', 'global-account']}
|
|
60
|
+
* placeholder="Search by address or name..."
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function SingleUserSearchSelector({ onSelectUser, profileTypeFilter, placeholder, className, showClearButton, showBadges, minSearchLength, }: SingleUserSearchSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../../shared/utils/index.js";
|
|
4
|
+
import { Search, X } from "lucide-react";
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { fetchProfile as fetchProfileApi } from "../../utils/profileApi.js";
|
|
7
|
+
import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer.js";
|
|
8
|
+
import { Input } from "../ui/input.js";
|
|
9
|
+
/**
|
|
10
|
+
* SingleUserSearchSelector Component
|
|
11
|
+
*
|
|
12
|
+
* A specialized component for searching and selecting a single user profile.
|
|
13
|
+
* This component is designed specifically for single-user selection scenarios,
|
|
14
|
+
* not for multi-user or general profile browsing.
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* - Search by address or name
|
|
18
|
+
* - Filter results by profile type (b3-ens, thirdweb-*, ens-data, global-account)
|
|
19
|
+
* - Shows a single result in a dropdown
|
|
20
|
+
* - Callback with complete profile data on selection
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <SingleUserSearchSelector
|
|
25
|
+
* onSelectUser={(profile) => console.log('Selected:', profile)}
|
|
26
|
+
* profileTypeFilter={['b3-ens', 'global-account']}
|
|
27
|
+
* placeholder="Search by address or name..."
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function SingleUserSearchSelector({ onSelectUser, profileTypeFilter, placeholder = "Search by address, name, or ID...", className, showClearButton = true, showBadges = false, minSearchLength = 3, }) {
|
|
32
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
33
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
34
|
+
const [searchResult, setSearchResult] = useState(null);
|
|
35
|
+
const [error, setError] = useState(null);
|
|
36
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
37
|
+
const dropdownRef = useRef(null);
|
|
38
|
+
const inputRef = useRef(null);
|
|
39
|
+
const searchTimeoutRef = useRef(undefined);
|
|
40
|
+
// Fetch profile from API using shared utility
|
|
41
|
+
const fetchProfile = useCallback(async (query) => {
|
|
42
|
+
if (!query || query.length < minSearchLength) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
// Determine if query is an address (starts with 0x) or a name
|
|
47
|
+
const params = query.startsWith("0x") ? { address: query } : { name: query };
|
|
48
|
+
const profile = await fetchProfileApi(params);
|
|
49
|
+
return profile;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// Return null for 404s (user not found)
|
|
53
|
+
if (err instanceof Error && err.message.includes("404")) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
console.error("Error fetching profile:", err);
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
}, [minSearchLength]);
|
|
60
|
+
// Filter profile by type
|
|
61
|
+
const filterProfileByType = useCallback((profile) => {
|
|
62
|
+
if (!profileTypeFilter || profileTypeFilter.length === 0) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
// Check if any of the profile's types match the filter
|
|
66
|
+
return profile.profiles.some(p => {
|
|
67
|
+
return profileTypeFilter.some(filter => {
|
|
68
|
+
// Handle thirdweb-* wildcard matching
|
|
69
|
+
if (filter.startsWith("thirdweb-")) {
|
|
70
|
+
return p.type.startsWith("thirdweb-");
|
|
71
|
+
}
|
|
72
|
+
return p.type === filter;
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}, [profileTypeFilter]);
|
|
76
|
+
// Handle search with debouncing
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (searchTimeoutRef.current) {
|
|
79
|
+
clearTimeout(searchTimeoutRef.current);
|
|
80
|
+
}
|
|
81
|
+
if (!searchQuery || searchQuery.length < minSearchLength) {
|
|
82
|
+
setSearchResult(null);
|
|
83
|
+
setShowDropdown(false);
|
|
84
|
+
setError(null);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
setIsSearching(true);
|
|
88
|
+
setError(null);
|
|
89
|
+
searchTimeoutRef.current = setTimeout(async () => {
|
|
90
|
+
try {
|
|
91
|
+
const result = await fetchProfile(searchQuery);
|
|
92
|
+
if (result) {
|
|
93
|
+
// Apply profile type filter
|
|
94
|
+
if (filterProfileByType(result)) {
|
|
95
|
+
setSearchResult(result);
|
|
96
|
+
setShowDropdown(true);
|
|
97
|
+
setError(null); // Clear any previous errors
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setSearchResult(null);
|
|
101
|
+
setShowDropdown(false);
|
|
102
|
+
setError("No matching profile types found");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
setSearchResult(null);
|
|
107
|
+
setShowDropdown(false);
|
|
108
|
+
setError("No user found");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
setError(err instanceof Error ? err.message : "Failed to search");
|
|
113
|
+
setSearchResult(null);
|
|
114
|
+
setShowDropdown(false);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
setIsSearching(false);
|
|
118
|
+
}
|
|
119
|
+
}, 500); // 500ms debounce
|
|
120
|
+
return () => {
|
|
121
|
+
if (searchTimeoutRef.current) {
|
|
122
|
+
clearTimeout(searchTimeoutRef.current);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, [searchQuery, fetchProfile, filterProfileByType, minSearchLength]);
|
|
126
|
+
// Handle click outside to close dropdown
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const handleClickOutside = (event) => {
|
|
129
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
130
|
+
setShowDropdown(false);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
134
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
135
|
+
}, []);
|
|
136
|
+
// Handle user selection
|
|
137
|
+
const handleSelectUser = useCallback((profile) => {
|
|
138
|
+
onSelectUser(profile);
|
|
139
|
+
setShowDropdown(false);
|
|
140
|
+
setSearchQuery("");
|
|
141
|
+
setSearchResult(null);
|
|
142
|
+
}, [onSelectUser]);
|
|
143
|
+
// Handle clear search
|
|
144
|
+
const handleClear = useCallback(() => {
|
|
145
|
+
setSearchQuery("");
|
|
146
|
+
setSearchResult(null);
|
|
147
|
+
setShowDropdown(false);
|
|
148
|
+
setError(null);
|
|
149
|
+
inputRef.current?.focus();
|
|
150
|
+
}, []);
|
|
151
|
+
// Get display name for profile
|
|
152
|
+
const getDisplayName = (profile) => {
|
|
153
|
+
return profile.displayName || profile.name || profile.address || "Unknown";
|
|
154
|
+
};
|
|
155
|
+
// Get profile type badges
|
|
156
|
+
const getProfileTypeBadges = (profiles) => {
|
|
157
|
+
return profiles.map(p => p.type);
|
|
158
|
+
};
|
|
159
|
+
return (_jsxs("div", { className: cn("single-user-search-selector b3-root relative w-full", className), ref: dropdownRef, children: [_jsxs("div", { className: "single-user-search-input-wrapper relative flex items-center", children: [_jsx(Search, { className: "single-user-search-icon pointer-events-none absolute text-gray-400", style: { left: "12px", width: "16px", height: "16px" } }), _jsx(Input, { ref: inputRef, type: "text", value: searchQuery, onChange: e => setSearchQuery(e.target.value), placeholder: placeholder, className: cn("single-user-search-input w-full border-gray-300 focus:border-blue-500 focus:ring-blue-500"), style: { paddingLeft: "44px", paddingRight: "44px" } }), showClearButton && searchQuery && (_jsx("button", { onClick: handleClear, className: "single-user-search-clear-button absolute text-gray-400 transition-colors hover:text-gray-600", style: { right: "12px" }, type: "button", children: _jsx(X, { style: { width: "16px", height: "16px" } }) }))] }), isSearching && _jsx("div", { className: "single-user-search-loading mt-2 text-sm text-gray-500", children: "Searching..." }), error && !isSearching && _jsx("div", { className: "single-user-search-error mt-2 text-sm text-red-500", children: error }), showDropdown && searchResult && !isSearching && (_jsx("div", { className: "single-user-search-dropdown absolute z-50 mt-2 w-full rounded-lg border border-gray-200 bg-white shadow-lg", children: _jsx("button", { onClick: () => handleSelectUser(searchResult), className: "single-user-search-result-button w-full px-4 py-3 text-left transition-colors hover:bg-gray-50", type: "button", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "single-user-search-result-avatar h-11 w-11 shrink-0", children: _jsx(IPFSMediaRenderer, { src: searchResult.avatar, alt: getDisplayName(searchResult), className: "h-full w-full rounded-full object-cover" }) }), _jsxs("div", { className: "single-user-search-result-info min-w-0 flex-1 pt-0.5", children: [_jsx("div", { className: "single-user-search-result-name text-base font-semibold text-gray-900", children: getDisplayName(searchResult) }), searchResult.address && (_jsxs("div", { className: "single-user-search-result-address mt-1 font-mono text-xs text-gray-500", children: [searchResult.address.slice(0, 6), "...", searchResult.address.slice(-4)] })), searchResult.bio && (_jsx("div", { className: "single-user-search-result-bio mt-1.5 line-clamp-2 text-sm text-gray-600", children: searchResult.bio })), showBadges && (_jsx("div", { className: "single-user-search-result-badges mt-2 flex flex-wrap gap-1.5", children: getProfileTypeBadges(searchResult.profiles).map((type, index) => (_jsx("span", { className: "single-user-search-result-badge inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800", children: type }, `${type}-${index}`))) }))] })] }) }) }))] }));
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SingleUserSearchSelector } from "./SingleUserSearchSelector.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "./B3Provider/useB3Config.js";
|
|
3
3
|
export function StyleRoot({ children, id }) {
|
|
4
|
-
const { theme } =
|
|
4
|
+
const { theme } = useB3Config();
|
|
5
5
|
return (_jsx("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const WalletImage: ({ fallback }: {
|
|
2
2
|
fallback?: React.ReactNode;
|
|
3
|
-
}) => string | number | bigint | true |
|
|
3
|
+
}) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
export default WalletImage;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, StyleRoot,
|
|
2
|
+
import { Button, StyleRoot, useModalStore, useUser } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { cn } from "../../../../shared/utils/index.js";
|
|
4
4
|
export function ManageAccountButton(props) {
|
|
5
|
-
const { partnerId } = useB3();
|
|
6
5
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
7
|
-
const { isConnected } =
|
|
6
|
+
const { isConnected } = useUser();
|
|
8
7
|
const handleClickManageAccount = () => {
|
|
9
8
|
setB3ModalContentType({
|
|
10
9
|
...props,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
|
-
export { B3Provider
|
|
2
|
+
export { B3Provider } from "./B3Provider/B3Provider";
|
|
3
3
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
|
-
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
4
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
6
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -25,6 +24,8 @@ export { AccountAssets } from "./AccountAssets/AccountAssets";
|
|
|
25
24
|
export { MintButton } from "./MintButton/MintButton";
|
|
26
25
|
export { SendETHButton } from "./SendETHButton/SendETHButton";
|
|
27
26
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
|
|
27
|
+
export { SingleUserSearchSelector } from "./SingleUserSearchSelector/SingleUserSearchSelector";
|
|
28
|
+
export type { ProfileTypeFilter, SingleUserSearchSelectorProps, } from "./SingleUserSearchSelector/SingleUserSearchSelector";
|
|
28
29
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
29
30
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
30
31
|
export { CopyToClipboard } from "./custom/CopyToClipboard";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
2
2
|
// Core Components
|
|
3
3
|
export { B3DynamicModal } from "./B3DynamicModal.js";
|
|
4
|
-
export { B3Provider
|
|
4
|
+
export { B3Provider } from "./B3Provider/B3Provider.js";
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
6
|
-
export { B3Context } from "./B3Provider/types.js";
|
|
7
6
|
export { useB3 } from "./B3Provider/useB3.js";
|
|
8
7
|
export { useB3Account } from "./B3Provider/useB3Account.js";
|
|
9
8
|
export { useB3Config } from "./B3Provider/useB3Config.js";
|
|
@@ -38,6 +37,8 @@ export { MintButton } from "./MintButton/MintButton.js";
|
|
|
38
37
|
export { SendETHButton } from "./SendETHButton/SendETHButton.js";
|
|
39
38
|
// SendERC20Button Components
|
|
40
39
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button.js";
|
|
40
|
+
// SingleUserSearchSelector Components
|
|
41
|
+
export { SingleUserSearchSelector } from "./SingleUserSearchSelector/SingleUserSearchSelector.js";
|
|
41
42
|
// Custom Components
|
|
42
43
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button.js";
|
|
43
44
|
export { ClientOnly } from "./custom/ClientOnly.js";
|
|
@@ -44,3 +44,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
44
44
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
45
45
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
46
46
|
export { useURLParams } from "./useURLParams";
|
|
47
|
+
export { useUser } from "./useUser";
|
|
@@ -44,3 +44,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress.js";
|
|
|
44
44
|
export { useTurnkeyAuth } from "./useTurnkeyAuth.js";
|
|
45
45
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
|
|
46
46
|
export { useURLParams } from "./useURLParams.js";
|
|
47
|
+
export { useUser } from "./useUser.js";
|
|
@@ -70,7 +70,7 @@ export declare function useAuth(): {
|
|
|
70
70
|
turnkeyId?: string | undefined;
|
|
71
71
|
turnkeyOtpId?: string | undefined;
|
|
72
72
|
};
|
|
73
|
-
} |
|
|
73
|
+
} | undefined;
|
|
74
74
|
refetchUser: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
75
|
-
setUser: (
|
|
75
|
+
setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
|
|
76
76
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import app from "../../../global-account/app.js";
|
|
2
2
|
import { authenticateWithB3JWT } from "../../../global-account/bsmnt.js";
|
|
3
|
-
import { useAuthStore,
|
|
3
|
+
import { useAuthStore, useB3Config } from "../../../global-account/react/index.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../shared/constants/index.js";
|
|
5
5
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
6
6
|
import { client } from "../../../shared/utils/thirdweb.js";
|
|
@@ -38,7 +38,7 @@ export function useAuth() {
|
|
|
38
38
|
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
|
|
39
39
|
const useAutoConnectLoadingPrevious = useRef(false);
|
|
40
40
|
const referralCode = useSearchParam("referralCode");
|
|
41
|
-
const { partnerId } =
|
|
41
|
+
const { partnerId } = useB3Config();
|
|
42
42
|
const wagmiConfig = createWagmiConfig({ partnerId });
|
|
43
43
|
const { connect } = useConnect();
|
|
44
44
|
const activeWagmiAccount = useAccount();
|
|
@@ -288,7 +288,7 @@ export function useAuth() {
|
|
|
288
288
|
debug("@@logout:loggedOut");
|
|
289
289
|
setIsAuthenticated(false);
|
|
290
290
|
setIsConnected(false);
|
|
291
|
-
setUser(
|
|
291
|
+
setUser();
|
|
292
292
|
callback?.();
|
|
293
293
|
}, [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected]);
|
|
294
294
|
const { isLoading: useAutoConnectLoading } = useAutoConnect({
|
|
@@ -62,7 +62,7 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
62
62
|
turnkeyId?: string | undefined;
|
|
63
63
|
turnkeyOtpId?: string | undefined;
|
|
64
64
|
};
|
|
65
|
-
} |
|
|
65
|
+
} | undefined;
|
|
66
66
|
refetchUser: (wallet?: Wallet) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
67
|
-
setUser: (
|
|
67
|
+
setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
|
|
68
68
|
};
|
|
@@ -16,7 +16,7 @@ import { useTWAuth } from "./useTWAuth.js";
|
|
|
16
16
|
import { useUserQuery } from "./useUserQuery.js";
|
|
17
17
|
const debug = debugB3React("useAuthentication");
|
|
18
18
|
export function useAuthentication(partnerId) {
|
|
19
|
-
const { onConnectCallback } = useContext(LocalSDKContext);
|
|
19
|
+
const { onConnectCallback, onLogoutCallback } = useContext(LocalSDKContext);
|
|
20
20
|
const { disconnect } = useDisconnect();
|
|
21
21
|
const wallets = useConnectedWallets();
|
|
22
22
|
const activeWallet = useActiveWallet();
|
|
@@ -148,9 +148,12 @@ export function useAuthentication(partnerId) {
|
|
|
148
148
|
debug("@@logout:loggedOut");
|
|
149
149
|
setIsAuthenticated(false);
|
|
150
150
|
setIsConnected(false);
|
|
151
|
-
setUser(
|
|
151
|
+
setUser();
|
|
152
152
|
callback?.();
|
|
153
|
-
|
|
153
|
+
if (onLogoutCallback) {
|
|
154
|
+
await onLogoutCallback();
|
|
155
|
+
}
|
|
156
|
+
}, [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected, onLogoutCallback]);
|
|
154
157
|
const onConnect = useCallback(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
155
158
|
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
156
159
|
try {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "../../../global-account/react/index.js";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { authenticateBoth, authenticateWithClient, getClient, getClientByType, setClientType, } from "../../client-manager.js";
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the current FeathersJS client and client management utilities
|
|
6
6
|
*/
|
|
7
7
|
export function useClient() {
|
|
8
|
-
const { clientType } =
|
|
8
|
+
const { clientType } = useB3Config();
|
|
9
9
|
const getCurrentClient = useCallback(() => {
|
|
10
10
|
return getClient();
|
|
11
11
|
}, []);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config, useConnect } from "../../../global-account/react/index.js";
|
|
2
2
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
3
3
|
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
@@ -8,7 +8,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
|
|
|
8
8
|
* Currently, this is for the basement-privy strategy
|
|
9
9
|
*/
|
|
10
10
|
export function useHandleConnectWithPrivy(chain, onSuccess) {
|
|
11
|
-
const { partnerId } =
|
|
11
|
+
const { partnerId } = useB3Config();
|
|
12
12
|
if (!chain) {
|
|
13
13
|
throw new Error("Chain is required");
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "../../../global-account/react/index.js";
|
|
2
2
|
import { getAuthToken } from "../../../shared/utils/auth-token.js";
|
|
3
3
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -27,7 +27,7 @@ const debug = debugB3React("useNotifications");
|
|
|
27
27
|
*/
|
|
28
28
|
export function useNotifications() {
|
|
29
29
|
const { user } = useUserQuery();
|
|
30
|
-
const { partnerId } =
|
|
30
|
+
const { partnerId } = useB3Config();
|
|
31
31
|
const [userData, setUserData] = useState(null);
|
|
32
32
|
const [loading, setLoading] = useState(true);
|
|
33
33
|
const [error, setError] = useState(null);
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
|
|
3
|
-
async function fetchProfile({ address, name, b3GlobalId, fresh = false, }) {
|
|
4
|
-
if (!address && !name && !b3GlobalId) {
|
|
5
|
-
throw new Error("Either address or name or b3GlobalId must be provided");
|
|
6
|
-
}
|
|
7
|
-
const params = new URLSearchParams();
|
|
8
|
-
if (address)
|
|
9
|
-
params.append("address", address);
|
|
10
|
-
if (name)
|
|
11
|
-
params.append("name", name);
|
|
12
|
-
if (b3GlobalId)
|
|
13
|
-
params.append("b3GlobalId", b3GlobalId);
|
|
14
|
-
if (fresh)
|
|
15
|
-
params.append("fresh", "true");
|
|
16
|
-
const response = await fetch(`${PROFILES_API_URL}?${params.toString()}`);
|
|
17
|
-
if (!response.ok) {
|
|
18
|
-
throw new Error(`Failed to fetch profile: ${response.statusText}`);
|
|
19
|
-
}
|
|
20
|
-
return response.json();
|
|
21
|
-
}
|
|
2
|
+
import { fetchProfile, PROFILES_API_URL } from "../utils/profileApi.js";
|
|
22
3
|
async function setProfilePreference({ key, preferredType, signature, signer, timestamp, }) {
|
|
23
4
|
const response = await fetch(`${PROFILES_API_URL}/preference`, {
|
|
24
5
|
method: "POST",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isNativeToken } from "../../../anyspend/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useAccountWallet, useAuthStore } from "../../../global-account/react/index.js";
|
|
4
4
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
5
5
|
import { getERC20Balances, getNativeTokenBalance } from "../../../shared/utils/thirdweb-insights.js";
|
|
6
6
|
import { useQuery } from "@tanstack/react-query";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
8
|
export function useTokenBalance({ token, address }) {
|
|
9
|
-
const
|
|
9
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
10
10
|
const account = useAccountWallet();
|
|
11
11
|
const effectiveAddress = address || account?.address;
|
|
12
12
|
const { data: tokenBalance, isLoading, isFetching, refetch, } = useQuery({
|
|
@@ -38,7 +38,7 @@ export function useTokenBalance({ token, address }) {
|
|
|
38
38
|
}
|
|
39
39
|
return { formatted: "0", raw: null };
|
|
40
40
|
},
|
|
41
|
-
enabled:
|
|
41
|
+
enabled: isAuthenticated && !!effectiveAddress,
|
|
42
42
|
staleTime: 30000,
|
|
43
43
|
gcTime: 5 * 60 * 1000,
|
|
44
44
|
retry: 2,
|
|
@@ -46,12 +46,12 @@ export function useTokenBalance({ token, address }) {
|
|
|
46
46
|
});
|
|
47
47
|
// Force a refetch when the wallet or token changes
|
|
48
48
|
useEffect(() => {
|
|
49
|
-
if (
|
|
49
|
+
if (isAuthenticated && effectiveAddress) {
|
|
50
50
|
refetch();
|
|
51
51
|
}
|
|
52
|
-
}, [
|
|
52
|
+
}, [isAuthenticated, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
53
53
|
// Determine if we're actually loading
|
|
54
|
-
const isActuallyLoading = !
|
|
54
|
+
const isActuallyLoading = !isAuthenticated || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
55
55
|
return {
|
|
56
56
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
57
57
|
formattedBalance: tokenBalance?.formatted || "0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
import app from "../../app.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useB3Config } from "../components/index.js";
|
|
5
5
|
import { useAuthStore } from "../stores/index.js";
|
|
6
6
|
import { useAuth } from "./useAuth.js";
|
|
7
7
|
const debug = debugB3React("useTurnkeyAuth");
|
|
@@ -18,7 +18,7 @@ export function useTurnkeyAuth() {
|
|
|
18
18
|
const [error, setError] = useState(null);
|
|
19
19
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
20
20
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
21
|
-
const { partnerId } =
|
|
21
|
+
const { partnerId } = useB3Config();
|
|
22
22
|
const { authenticate } = useAuth();
|
|
23
23
|
/**
|
|
24
24
|
* Step 1: Initiate login with email
|