@b3dotfun/sdk 0.0.88-alpha.5 → 0.0.88-alpha.7
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.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +5 -5
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +33 -5
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- 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 +2 -3
- 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/B3Provider.d.ts +2 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
- 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 +38 -35
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- 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 +8 -9
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- 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/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +3 -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.js +1 -2
- 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/useTokenBalance.js +5 -5
- 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.js +9 -35
- 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/configStore.d.ts +24 -0
- package/dist/cjs/global-account/react/stores/configStore.js +30 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +6 -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/esm/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +6 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +35 -7
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- 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 +3 -4
- 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/B3Provider.d.ts +2 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
- 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/useB3.d.ts +14 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- 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 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- 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/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -2
- package/dist/esm/global-account/react/components/index.js +1 -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.js +2 -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/useTokenBalance.js +6 -6
- 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.js +1 -27
- 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/configStore.d.ts +24 -0
- package/dist/esm/global-account/react/stores/configStore.js +27 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +6 -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/types/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +18 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +13 -0
- package/src/anyspend/react/components/AnySpendDeposit.tsx +15 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +4 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +5 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +54 -42
- package/src/anyspend/react/components/common/PanelOnramp.tsx +5 -1
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
- 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 +3 -4
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- 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/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/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +1 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +2 -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/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +1 -40
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/configStore.ts +51 -0
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +6 -0
- package/src/global-account/react/stores/userStore.ts +41 -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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferred Hook to get the user data
|
|
3
|
+
*/
|
|
4
|
+
export declare function useUser(): {
|
|
5
|
+
user: {
|
|
6
|
+
email?: string | undefined;
|
|
7
|
+
username?: string | undefined;
|
|
8
|
+
telNumber?: string | undefined;
|
|
9
|
+
ens?: string | undefined;
|
|
10
|
+
avatar?: string | undefined;
|
|
11
|
+
preferences?: {} | undefined;
|
|
12
|
+
referredBy?: string | {} | undefined;
|
|
13
|
+
sourceApp?: string | undefined;
|
|
14
|
+
referralCode?: string | undefined;
|
|
15
|
+
userGroups?: number[] | undefined;
|
|
16
|
+
isMigratedFromBSMNT?: boolean | undefined;
|
|
17
|
+
privyLinkedAccounts?: {
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
address?: string | undefined;
|
|
20
|
+
email?: string | undefined;
|
|
21
|
+
chain_type?: string | undefined;
|
|
22
|
+
lv?: number | undefined;
|
|
23
|
+
wallet_client_type?: string | undefined;
|
|
24
|
+
smart_wallet_type?: string | undefined;
|
|
25
|
+
subject?: string | undefined;
|
|
26
|
+
type: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
twProfiles?: {
|
|
29
|
+
type: string;
|
|
30
|
+
details: {
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
username?: string | undefined;
|
|
36
|
+
phone?: string | undefined;
|
|
37
|
+
fid?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
turnkeySubOrgs?: {
|
|
41
|
+
hasDelegatedUser?: boolean | undefined;
|
|
42
|
+
subOrgId: string;
|
|
43
|
+
accounts: Record<string, any>[];
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
_id: string | {};
|
|
46
|
+
userId: string;
|
|
47
|
+
smartAccountAddress: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
updatedAt: number;
|
|
50
|
+
partnerIds: {
|
|
51
|
+
privyId?: string | undefined;
|
|
52
|
+
thirdwebId?: string | undefined;
|
|
53
|
+
turnkeyId?: string | undefined;
|
|
54
|
+
turnkeyOtpId?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
} | null;
|
|
57
|
+
isConnecting: boolean;
|
|
58
|
+
isConnected: boolean;
|
|
59
|
+
isAuthenticating: boolean;
|
|
60
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
2
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
3
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
4
|
export { useProfile } from "./hooks/useProfile";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
|
+
import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
|
+
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
4
|
+
import { Account } from "thirdweb/wallets";
|
|
5
|
+
import { ClientType } from "../../client-manager";
|
|
6
|
+
interface ConfigStore {
|
|
7
|
+
accountOverride?: Account;
|
|
8
|
+
automaticallySetFirstEoa: boolean;
|
|
9
|
+
environment: "development" | "production";
|
|
10
|
+
defaultPermissions: PermissionsConfig;
|
|
11
|
+
theme: "light" | "dark";
|
|
12
|
+
clientType: ClientType;
|
|
13
|
+
partnerId: string;
|
|
14
|
+
stripePublishableKey?: string;
|
|
15
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
+
enableTurnkey: boolean;
|
|
17
|
+
setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Zustand store for B3 configuration
|
|
21
|
+
* NOT persisted - these are developer-set configuration values
|
|
22
|
+
*/
|
|
23
|
+
export declare const useB3ConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConfigStore>>;
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
|
+
export { useB3ConfigStore } from "./configStore";
|
|
2
3
|
export { useModalStore } from "./useModalStore";
|
|
3
4
|
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
4
5
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -403,6 +403,12 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
403
403
|
customUsdInputValues?: string[];
|
|
404
404
|
/** prefer eoa wallet */
|
|
405
405
|
preferEoa?: boolean;
|
|
406
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
407
|
+
returnToHomeUrl?: string;
|
|
408
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
409
|
+
customRecipientLabel?: string;
|
|
410
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
411
|
+
returnHomeLabel?: string;
|
|
406
412
|
}
|
|
407
413
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
408
414
|
/** Modal type identifier */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
2
|
+
interface UserStore {
|
|
3
|
+
user: Users | null;
|
|
4
|
+
setUser: (user: Users | undefined) => void;
|
|
5
|
+
clearUser: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Zustand store for managing user state
|
|
9
|
+
* Persists user data to localStorage
|
|
10
|
+
*/
|
|
11
|
+
export declare const useUserStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UserStore>, "persist"> & {
|
|
12
|
+
persist: {
|
|
13
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UserStore, UserStore>>) => void;
|
|
14
|
+
clearStorage: () => void;
|
|
15
|
+
rehydrate: () => Promise<void> | void;
|
|
16
|
+
hasHydrated: () => boolean;
|
|
17
|
+
onHydrate: (fn: (state: UserStore) => void) => () => void;
|
|
18
|
+
onFinishHydration: (fn: (state: UserStore) => void) => () => void;
|
|
19
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UserStore, UserStore>>;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
toast,
|
|
25
25
|
TransitionPanel,
|
|
26
26
|
useAccountWallet,
|
|
27
|
-
|
|
27
|
+
useB3Config,
|
|
28
28
|
useModalStore,
|
|
29
29
|
useProfile,
|
|
30
30
|
useRouter,
|
|
@@ -107,6 +107,12 @@ export function AnySpend(props: {
|
|
|
107
107
|
hideBottomNavigation?: boolean;
|
|
108
108
|
/** When true, disables URL parameter management for swap configuration */
|
|
109
109
|
disableUrlParamManagement?: boolean;
|
|
110
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
111
|
+
returnToHomeUrl?: string;
|
|
112
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
113
|
+
customRecipientLabel?: string;
|
|
114
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
115
|
+
returnHomeLabel?: string;
|
|
110
116
|
}) {
|
|
111
117
|
const fingerprintConfig = getFingerprintConfig();
|
|
112
118
|
|
|
@@ -132,6 +138,9 @@ function AnySpendInner({
|
|
|
132
138
|
hideHeader,
|
|
133
139
|
hideBottomNavigation = false,
|
|
134
140
|
disableUrlParamManagement = false,
|
|
141
|
+
returnToHomeUrl,
|
|
142
|
+
customRecipientLabel,
|
|
143
|
+
returnHomeLabel,
|
|
135
144
|
}: {
|
|
136
145
|
sourceChainId?: number;
|
|
137
146
|
destinationTokenAddress?: string;
|
|
@@ -147,11 +156,14 @@ function AnySpendInner({
|
|
|
147
156
|
hideHeader?: boolean;
|
|
148
157
|
hideBottomNavigation?: boolean;
|
|
149
158
|
disableUrlParamManagement?: boolean;
|
|
159
|
+
returnToHomeUrl?: string;
|
|
160
|
+
customRecipientLabel?: string;
|
|
161
|
+
returnHomeLabel?: string;
|
|
150
162
|
}) {
|
|
151
163
|
const searchParams = useSearchParamsSSR();
|
|
152
164
|
const router = useRouter();
|
|
153
165
|
|
|
154
|
-
const { partnerId } =
|
|
166
|
+
const { partnerId } = useB3Config();
|
|
155
167
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
156
168
|
|
|
157
169
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
@@ -1066,6 +1078,8 @@ function AnySpendInner({
|
|
|
1066
1078
|
// Reset payment methods when going back
|
|
1067
1079
|
resetPaymentMethods();
|
|
1068
1080
|
}}
|
|
1081
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
1082
|
+
returnHomeLabel={returnHomeLabel}
|
|
1069
1083
|
/>
|
|
1070
1084
|
)}
|
|
1071
1085
|
{/* {mode === "page" && <div className="h-12" />} */}
|
|
@@ -1157,6 +1171,7 @@ function AnySpendInner({
|
|
|
1157
1171
|
onShowPointsDetail={() => navigateToPanel(PanelView.POINTS_DETAIL, "forward")}
|
|
1158
1172
|
onShowFeeDetail={() => navigateToPanel(PanelView.FEE_DETAIL, "forward")}
|
|
1159
1173
|
customUsdInputValues={customUsdInputValues}
|
|
1174
|
+
customRecipientLabel={customRecipientLabel}
|
|
1160
1175
|
/>
|
|
1161
1176
|
</motion.div>
|
|
1162
1177
|
)}
|
|
@@ -1209,6 +1224,7 @@ function AnySpendInner({
|
|
|
1209
1224
|
isBuyMode={isBuyMode}
|
|
1210
1225
|
effectiveRecipientAddress={effectiveRecipientAddress}
|
|
1211
1226
|
recipientName={recipientName || undefined}
|
|
1227
|
+
customRecipientLabel={customRecipientLabel}
|
|
1212
1228
|
onSelectRecipient={() => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward")}
|
|
1213
1229
|
dstAmount={dstAmount}
|
|
1214
1230
|
dstToken={selectedDstToken}
|
|
@@ -66,6 +66,12 @@ export interface AnySpendCustomExactInProps {
|
|
|
66
66
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
67
67
|
isLoadingAnyspendPrice: boolean;
|
|
68
68
|
}) => React.JSX.Element;
|
|
69
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
70
|
+
returnToHomeUrl?: string;
|
|
71
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
72
|
+
customRecipientLabel?: string;
|
|
73
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
74
|
+
returnHomeLabel?: string;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
export function AnySpendCustomExactIn(props: AnySpendCustomExactInProps) {
|
|
@@ -97,6 +103,9 @@ function AnySpendCustomExactInInner({
|
|
|
97
103
|
orderType = "custom_exact_in",
|
|
98
104
|
minDestinationAmount,
|
|
99
105
|
header,
|
|
106
|
+
returnToHomeUrl,
|
|
107
|
+
customRecipientLabel,
|
|
108
|
+
returnHomeLabel,
|
|
100
109
|
}: AnySpendCustomExactInProps) {
|
|
101
110
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
102
111
|
|
|
@@ -358,6 +367,7 @@ function AnySpendCustomExactInInner({
|
|
|
358
367
|
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
359
368
|
onShowFeeDetail={() => setActivePanel(PanelView.FEE_DETAIL)}
|
|
360
369
|
customUsdInputValues={customUsdInputValues}
|
|
370
|
+
customRecipientLabel={customRecipientLabel}
|
|
361
371
|
/>
|
|
362
372
|
</motion.div>
|
|
363
373
|
)}
|
|
@@ -383,6 +393,7 @@ function AnySpendCustomExactInInner({
|
|
|
383
393
|
isBuyMode={true}
|
|
384
394
|
effectiveRecipientAddress={selectedRecipientOrDefault}
|
|
385
395
|
recipientName={recipientName || undefined}
|
|
396
|
+
customRecipientLabel={customRecipientLabel}
|
|
386
397
|
onSelectRecipient={() => setActivePanel(PanelView.RECIPIENT_SELECTION)}
|
|
387
398
|
dstAmount={dstAmount}
|
|
388
399
|
dstToken={selectedDstToken}
|
|
@@ -532,6 +543,8 @@ function AnySpendCustomExactInInner({
|
|
|
532
543
|
}}
|
|
533
544
|
disableUrlParamManagement
|
|
534
545
|
points={oat.data.points || undefined}
|
|
546
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
547
|
+
returnHomeLabel={returnHomeLabel}
|
|
535
548
|
/>
|
|
536
549
|
)}
|
|
537
550
|
</div>
|
|
@@ -106,6 +106,12 @@ export interface AnySpendDepositProps {
|
|
|
106
106
|
topChainsCount?: number;
|
|
107
107
|
/** Callback when close button is clicked */
|
|
108
108
|
onClose?: () => void;
|
|
109
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
110
|
+
returnToHomeUrl?: string;
|
|
111
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
112
|
+
customRecipientLabel?: string;
|
|
113
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
114
|
+
returnHomeLabel?: string;
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
// Default supported chains
|
|
@@ -224,6 +230,9 @@ export function AnySpendDeposit({
|
|
|
224
230
|
minPoolSize = DEFAULT_MIN_POOL_SIZE,
|
|
225
231
|
topChainsCount = 3,
|
|
226
232
|
onClose,
|
|
233
|
+
returnToHomeUrl,
|
|
234
|
+
customRecipientLabel,
|
|
235
|
+
returnHomeLabel,
|
|
227
236
|
}: AnySpendDepositProps) {
|
|
228
237
|
const { connectedEOAWallet } = useAccountWallet();
|
|
229
238
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
@@ -539,6 +548,9 @@ export function AnySpendDeposit({
|
|
|
539
548
|
hideHeader
|
|
540
549
|
hideBottomNavigation
|
|
541
550
|
disableUrlParamManagement
|
|
551
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
552
|
+
customRecipientLabel={customRecipientLabel}
|
|
553
|
+
returnHomeLabel={returnHomeLabel}
|
|
542
554
|
/>
|
|
543
555
|
) : (
|
|
544
556
|
<AnySpendCustomExactIn
|
|
@@ -561,6 +573,9 @@ export function AnySpendDeposit({
|
|
|
561
573
|
customUsdInputValues={customUsdInputValues}
|
|
562
574
|
preferEoa={preferEoa}
|
|
563
575
|
customExactInConfig={depositContractConfig}
|
|
576
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
577
|
+
customRecipientLabel={customRecipientLabel}
|
|
578
|
+
returnHomeLabel={returnHomeLabel}
|
|
564
579
|
/>
|
|
565
580
|
)}
|
|
566
581
|
</div>
|
|
@@ -25,6 +25,10 @@ export interface AnySpendDepositHypeProps {
|
|
|
25
25
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
26
26
|
customUsdInputValues?: string[];
|
|
27
27
|
preferEoa?: boolean;
|
|
28
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
29
|
+
returnToHomeUrl?: string;
|
|
30
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
31
|
+
customRecipientLabel?: string;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
export function AnySpendDepositHype({
|
|
@@ -15,6 +15,8 @@ interface CryptoReceiveSectionProps {
|
|
|
15
15
|
// Recipient data
|
|
16
16
|
effectiveRecipientAddress?: string;
|
|
17
17
|
recipientName?: string;
|
|
18
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
19
|
+
customRecipientLabel?: string;
|
|
18
20
|
onSelectRecipient: () => void;
|
|
19
21
|
// Token data
|
|
20
22
|
dstAmount: string;
|
|
@@ -41,6 +43,7 @@ export function CryptoReceiveSection({
|
|
|
41
43
|
isBuyMode = false,
|
|
42
44
|
effectiveRecipientAddress,
|
|
43
45
|
recipientName,
|
|
46
|
+
customRecipientLabel,
|
|
44
47
|
onSelectRecipient,
|
|
45
48
|
dstAmount,
|
|
46
49
|
dstToken,
|
|
@@ -78,7 +81,8 @@ export function CryptoReceiveSection({
|
|
|
78
81
|
>
|
|
79
82
|
<>
|
|
80
83
|
<span className="text-as-tertiarry flex items-center gap-1 text-sm">
|
|
81
|
-
{
|
|
84
|
+
{customRecipientLabel ||
|
|
85
|
+
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || ""))}
|
|
82
86
|
</span>
|
|
83
87
|
<ChevronRight className="h-4 w-4" />
|
|
84
88
|
</>
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
TextLoop,
|
|
22
22
|
TextShimmer,
|
|
23
23
|
useAccountWallet,
|
|
24
|
-
|
|
24
|
+
useB3Config,
|
|
25
25
|
useModalStore,
|
|
26
26
|
useProfile,
|
|
27
27
|
useUnifiedChainSwitchAndExecute,
|
|
@@ -65,6 +65,10 @@ interface OrderDetailsProps {
|
|
|
65
65
|
onBack?: () => void;
|
|
66
66
|
disableUrlParamManagement?: boolean; // When true, will not modify URL parameters
|
|
67
67
|
points?: number | undefined; // Points earned from the transaction
|
|
68
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
69
|
+
returnToHomeUrl?: string;
|
|
70
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
71
|
+
returnHomeLabel?: string;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
// Add this helper function near the top or just above the component
|
|
@@ -217,12 +221,14 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
217
221
|
onBack,
|
|
218
222
|
disableUrlParamManagement = false,
|
|
219
223
|
points,
|
|
224
|
+
returnToHomeUrl,
|
|
225
|
+
returnHomeLabel,
|
|
220
226
|
}: OrderDetailsProps) {
|
|
221
227
|
const router = useRouter();
|
|
222
228
|
const searchParams = useSearchParams();
|
|
223
229
|
|
|
224
230
|
// Get theme from B3Provider context
|
|
225
|
-
const { theme } =
|
|
231
|
+
const { theme } = useB3Config();
|
|
226
232
|
const colorMode = theme || "light";
|
|
227
233
|
|
|
228
234
|
// Read crypto payment method from URL parameters
|
|
@@ -377,6 +383,49 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
377
383
|
onBack?.();
|
|
378
384
|
}, [cleanupUrlParams, onBack]);
|
|
379
385
|
|
|
386
|
+
// Handle "Return to Home" click - redirects to custom URL if provided
|
|
387
|
+
const handleReturnToHome = useCallback(() => {
|
|
388
|
+
if (returnToHomeUrl) {
|
|
389
|
+
// Validate URL to prevent Open Redirect / XSS attacks
|
|
390
|
+
try {
|
|
391
|
+
const url = new URL(returnToHomeUrl, window.location.origin);
|
|
392
|
+
// Only allow http/https protocols
|
|
393
|
+
if (url.protocol === "http:" || url.protocol === "https:") {
|
|
394
|
+
window.location.href = url.href;
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
} catch {
|
|
398
|
+
// If URL parsing fails, check if it's a safe relative URL
|
|
399
|
+
if (returnToHomeUrl.startsWith("/") && !returnToHomeUrl.startsWith("//")) {
|
|
400
|
+
window.location.href = returnToHomeUrl;
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Fallback to handleBack if URL is not safe
|
|
405
|
+
handleBack();
|
|
406
|
+
} else {
|
|
407
|
+
handleBack();
|
|
408
|
+
}
|
|
409
|
+
}, [returnToHomeUrl, handleBack]);
|
|
410
|
+
|
|
411
|
+
// Reusable "Return to Home" / "Close" button
|
|
412
|
+
const returnHomeOrCloseButton = (
|
|
413
|
+
<button
|
|
414
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
415
|
+
onClick={returnToHomeUrl ? handleReturnToHome : mode === "page" ? handleBack : handleCloseModal}
|
|
416
|
+
>
|
|
417
|
+
{returnHomeLabel ? (
|
|
418
|
+
returnHomeLabel
|
|
419
|
+
) : mode === "page" ? (
|
|
420
|
+
<>
|
|
421
|
+
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
422
|
+
</>
|
|
423
|
+
) : (
|
|
424
|
+
"Close"
|
|
425
|
+
)}
|
|
426
|
+
</button>
|
|
427
|
+
);
|
|
428
|
+
|
|
380
429
|
useEffect(() => {
|
|
381
430
|
if (txSuccess) {
|
|
382
431
|
toast.success("Transaction successful! We are processing your order.", { duration: 10000 });
|
|
@@ -521,18 +570,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
521
570
|
</span>
|
|
522
571
|
</div>
|
|
523
572
|
)}
|
|
524
|
-
|
|
525
|
-
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
526
|
-
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
527
|
-
>
|
|
528
|
-
{mode === "page" ? (
|
|
529
|
-
<>
|
|
530
|
-
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
531
|
-
</>
|
|
532
|
-
) : (
|
|
533
|
-
"Close"
|
|
534
|
-
)}
|
|
535
|
-
</button>
|
|
573
|
+
{returnHomeOrCloseButton}
|
|
536
574
|
</>
|
|
537
575
|
);
|
|
538
576
|
}
|
|
@@ -649,20 +687,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
649
687
|
</ShinyButton>
|
|
650
688
|
)}
|
|
651
689
|
|
|
652
|
-
{order.status === "executed" &&
|
|
653
|
-
<button
|
|
654
|
-
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
655
|
-
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
656
|
-
>
|
|
657
|
-
{mode === "page" ? (
|
|
658
|
-
<>
|
|
659
|
-
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
660
|
-
</>
|
|
661
|
-
) : (
|
|
662
|
-
"Close"
|
|
663
|
-
)}
|
|
664
|
-
</button>
|
|
665
|
-
)}
|
|
690
|
+
{order.status === "executed" && returnHomeOrCloseButton}
|
|
666
691
|
</>
|
|
667
692
|
);
|
|
668
693
|
}
|
|
@@ -786,20 +811,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
786
811
|
</ShinyButton>
|
|
787
812
|
)}
|
|
788
813
|
|
|
789
|
-
{order.status === "executed" &&
|
|
790
|
-
<button
|
|
791
|
-
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
792
|
-
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
793
|
-
>
|
|
794
|
-
{mode === "page" ? (
|
|
795
|
-
<>
|
|
796
|
-
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
797
|
-
</>
|
|
798
|
-
) : (
|
|
799
|
-
"Close"
|
|
800
|
-
)}
|
|
801
|
-
</button>
|
|
802
|
-
)}
|
|
814
|
+
{order.status === "executed" && returnHomeOrCloseButton}
|
|
803
815
|
</>
|
|
804
816
|
);
|
|
805
817
|
}
|
|
@@ -33,6 +33,7 @@ export function PanelOnramp({
|
|
|
33
33
|
onShowPointsDetail,
|
|
34
34
|
onShowFeeDetail,
|
|
35
35
|
customUsdInputValues = ["5", "10", "20", "25"],
|
|
36
|
+
customRecipientLabel,
|
|
36
37
|
}: {
|
|
37
38
|
srcAmountOnRamp: string;
|
|
38
39
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
@@ -52,6 +53,8 @@ export function PanelOnramp({
|
|
|
52
53
|
onShowPointsDetail?: () => void;
|
|
53
54
|
onShowFeeDetail?: () => void;
|
|
54
55
|
customUsdInputValues?: string[];
|
|
56
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
57
|
+
customRecipientLabel?: string;
|
|
55
58
|
}) {
|
|
56
59
|
// Helper function to get fees from anyspend quote
|
|
57
60
|
const getFeeFromApi = (paymentMethod: FiatPaymentMethod): number | null => {
|
|
@@ -228,7 +231,8 @@ export function PanelOnramp({
|
|
|
228
231
|
onClick={() => setActivePanel(recipientSelectionPanelIndex)} // Recipient selection panel
|
|
229
232
|
>
|
|
230
233
|
<span className="text-sm">
|
|
231
|
-
{
|
|
234
|
+
{customRecipientLabel ||
|
|
235
|
+
(recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress))}
|
|
232
236
|
</span>
|
|
233
237
|
<ChevronRight size={16} />
|
|
234
238
|
</button>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
2
1
|
import { OrderDetailsCollapsible, useStripeClientSecret } from "@b3dotfun/sdk/anyspend/react";
|
|
3
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
|
-
import { ShinyButton,
|
|
3
|
+
import { ShinyButton, useB3Config, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
5
4
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
6
|
-
import { formatStripeAmount } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
5
|
+
import { formatStripeAmount, getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
7
6
|
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
8
7
|
import { PaymentIntentResult, StripePaymentElementOptions } from "@stripe/stripe-js";
|
|
9
8
|
import { X } from "lucide-react";
|
|
@@ -19,7 +18,7 @@ interface PaymentStripeWeb2Props {
|
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }: PaymentStripeWeb2Props) {
|
|
22
|
-
const { theme, stripePublishableKey } =
|
|
21
|
+
const { theme, stripePublishableKey } = useB3Config();
|
|
23
22
|
const fingerprintConfig = getFingerprintConfig();
|
|
24
23
|
|
|
25
24
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } =
|
|
@@ -3,7 +3,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
3
3
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
4
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
5
5
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
7
7
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
8
8
|
import { useMutation } from "@tanstack/react-query";
|
|
9
9
|
import { useMemo } from "react";
|
|
@@ -36,7 +36,7 @@ export type UseAnyspendCreateOnrampOrderProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspendCreateOnrampOrderProps = {}) {
|
|
38
38
|
// Get B3 context values
|
|
39
|
-
const { partnerId } =
|
|
39
|
+
const { partnerId } = useB3Config();
|
|
40
40
|
|
|
41
41
|
// Get validated client reference ID from B3 context
|
|
42
42
|
const createValidatedClientReferenceId = useValidatedClientReferenceId();
|
|
@@ -2,7 +2,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
4
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
7
7
|
import { useMutation } from "@tanstack/react-query";
|
|
8
8
|
import { useMemo } from "react";
|
|
@@ -36,7 +36,7 @@ export type UseAnyspendCreateOrderProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreateOrderProps = {}) {
|
|
38
38
|
// Get B3 context values
|
|
39
|
-
const { partnerId } =
|
|
39
|
+
const { partnerId } = useB3Config();
|
|
40
40
|
|
|
41
41
|
// Get validated client reference ID from B3 context
|
|
42
42
|
const createValidatedClientReferenceId = useValidatedClientReferenceId();
|
|
@@ -2,7 +2,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
4
|
import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
7
7
|
import { useMutation } from "@tanstack/react-query";
|
|
8
8
|
import { useMemo } from "react";
|
|
@@ -29,7 +29,7 @@ export type UseCreateDepositFirstOrderProps = {
|
|
|
29
29
|
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
30
30
|
*/
|
|
31
31
|
export function useCreateDepositFirstOrder({ onSuccess, onError }: UseCreateDepositFirstOrderProps = {}) {
|
|
32
|
-
const { partnerId } =
|
|
32
|
+
const { partnerId } = useB3Config();
|
|
33
33
|
|
|
34
34
|
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
35
35
|
const visitorData: VisitorData | undefined = fpData && {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Validators } from "@b3dotfun/sdk/anyspend/utils/validation";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { CreateOnrampOrderParams } from "./useAnyspendCreateOnrampOrder";
|
|
5
5
|
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
@@ -9,7 +9,7 @@ import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
|
9
9
|
* Gets the createClientReferenceId function from B3 context and validates the result
|
|
10
10
|
*/
|
|
11
11
|
export function useValidatedClientReferenceId() {
|
|
12
|
-
const { createClientReferenceId } =
|
|
12
|
+
const { createClientReferenceId } = useB3Config();
|
|
13
13
|
|
|
14
14
|
const createValidatedClientReferenceId = useCallback(
|
|
15
15
|
async (params: CreateOrderParams | CreateOnrampOrderParams) => {
|
|
@@ -14,14 +14,13 @@ import { AnySpendDepositHype } from "@b3dotfun/sdk/anyspend/react/components/Any
|
|
|
14
14
|
import { AnySpendDepositUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendDepositUpside";
|
|
15
15
|
import { AnySpendStakeUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpside";
|
|
16
16
|
import { AnySpendStakeUpsideExactIn } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpsideExactIn";
|
|
17
|
-
import { useGlobalAccount, useIsMobile, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
17
|
+
import { useB3Config, useGlobalAccount, useIsMobile, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
18
18
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
19
19
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
20
20
|
import { AnimatePresence, motion } from "framer-motion";
|
|
21
21
|
import { useEffect, useRef } from "react";
|
|
22
22
|
import { useSetActiveWallet } from "thirdweb/react";
|
|
23
23
|
import { AvatarEditor } from "./AvatarEditor/AvatarEditor";
|
|
24
|
-
import { useB3 } from "./B3Provider/useB3";
|
|
25
24
|
import { Deposit } from "./Deposit/Deposit";
|
|
26
25
|
import { LinkAccount } from "./LinkAccount/LinkAccount";
|
|
27
26
|
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount";
|
|
@@ -30,8 +29,8 @@ import NotificationsContent from "./ManageAccount/NotificationsContent";
|
|
|
30
29
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
31
30
|
import { Send } from "./Send/Send";
|
|
32
31
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
33
|
-
import { TurnkeyAuthModal } from "./TurnkeyAuthModal";
|
|
34
32
|
import { ToastContainer, useToastContext } from "./Toast/index";
|
|
33
|
+
import { TurnkeyAuthModal } from "./TurnkeyAuthModal";
|
|
35
34
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
|
|
36
35
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
|
|
37
36
|
|
|
@@ -42,7 +41,7 @@ export function B3DynamicModal() {
|
|
|
42
41
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
43
42
|
const contentType = useModalStore(state => state.contentType);
|
|
44
43
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
45
|
-
const { theme } =
|
|
44
|
+
const { theme } = useB3Config();
|
|
46
45
|
const isMobile = useIsMobile();
|
|
47
46
|
const prevIsOpenRef = useRef(isOpen);
|
|
48
47
|
const { wallet } = useGlobalAccount();
|