@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +0 -2
- package/dist/cjs/anyspend/constants/index.js +1 -3
- package/dist/cjs/anyspend/index.d.ts +0 -2
- package/dist/cjs/anyspend/index.js +0 -3
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +15 -11
- 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 +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -1
- package/dist/cjs/global-account/react/components/index.js +6 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -1
- 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/useTokenBalancesByChain.js +2 -4
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
- package/dist/cjs/global-account/react/index.native.d.ts +2 -0
- package/dist/cjs/global-account/react/index.native.js +5 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -2
- package/dist/esm/anyspend/constants/index.js +0 -2
- package/dist/esm/anyspend/index.d.ts +0 -2
- package/dist/esm/anyspend/index.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +16 -12
- 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 +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -1
- package/dist/esm/global-account/react/components/index.js +2 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +3 -2
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
- package/dist/esm/global-account/react/index.native.d.ts +2 -0
- package/dist/esm/global-account/react/index.native.js +2 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -2
- package/dist/types/anyspend/index.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/types/global-account/react/components/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/index.native.d.ts +2 -0
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -3
- package/src/anyspend/index.ts +0 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -28
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
- package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
- package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
- package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
- package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/hooks/index.ts +0 -1
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
- package/src/global-account/react/components/B3Provider/types.ts +50 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
- package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
- package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +14 -11
- 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 +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +3 -2
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- package/src/global-account/react/hooks/useUserQuery.ts +40 -1
- package/src/global-account/react/index.native.ts +2 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -10
- package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
- package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
- package/dist/cjs/anyspend/services/gas.d.ts +0 -21
- package/dist/cjs/anyspend/services/gas.js +0 -65
- package/dist/cjs/anyspend/types/gas.d.ts +0 -61
- package/dist/cjs/anyspend/types/gas.js +0 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/cjs/global-account/react/stores/userStore.js +0 -30
- package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
- package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
- package/dist/esm/anyspend/services/gas.d.ts +0 -21
- package/dist/esm/anyspend/services/gas.js +0 -59
- package/dist/esm/anyspend/types/gas.d.ts +0 -61
- package/dist/esm/anyspend/types/gas.js +0 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
- package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/esm/global-account/react/hooks/useUser.js +0 -17
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/esm/global-account/react/stores/userStore.js +0 -27
- package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/types/anyspend/services/gas.d.ts +0 -21
- package/dist/types/anyspend/types/gas.d.ts +0 -61
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
- package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
- package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
- package/src/anyspend/services/gas.test.ts +0 -31
- package/src/anyspend/services/gas.ts +0 -73
- package/src/anyspend/types/gas.ts +0 -66
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
- package/src/global-account/react/hooks/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useNotifications = useNotifications;
|
|
4
|
-
const react_1 = require("../../../global-account/react");
|
|
5
4
|
const auth_token_1 = require("../../../shared/utils/auth-token");
|
|
6
5
|
const debug_1 = require("../../../shared/utils/debug");
|
|
7
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const components_1 = require("../components");
|
|
8
8
|
const notificationsAPI_1 = require("../utils/notificationsAPI");
|
|
9
9
|
const useUserQuery_1 = require("./useUserQuery");
|
|
10
10
|
const debug = (0, debug_1.debugB3React)("useNotifications");
|
|
@@ -30,14 +30,14 @@ const debug = (0, debug_1.debugB3React)("useNotifications");
|
|
|
30
30
|
*/
|
|
31
31
|
function useNotifications() {
|
|
32
32
|
const { user } = (0, useUserQuery_1.useUserQuery)();
|
|
33
|
-
const { partnerId } = (0,
|
|
34
|
-
const [userData, setUserData] = (0,
|
|
35
|
-
const [loading, setLoading] = (0,
|
|
36
|
-
const [error, setError] = (0,
|
|
37
|
-
const [telegramStatus, setTelegramStatus] = (0,
|
|
33
|
+
const { partnerId } = (0, components_1.useB3)();
|
|
34
|
+
const [userData, setUserData] = (0, react_1.useState)(null);
|
|
35
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
36
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
37
|
+
const [telegramStatus, setTelegramStatus] = (0, react_1.useState)("idle");
|
|
38
38
|
const userId = user?.userId;
|
|
39
39
|
const jwtToken = (0, auth_token_1.getAuthToken)();
|
|
40
|
-
const loadUserData = (0,
|
|
40
|
+
const loadUserData = (0, react_1.useCallback)(async () => {
|
|
41
41
|
if (!userId || !jwtToken) {
|
|
42
42
|
setLoading(false);
|
|
43
43
|
return;
|
|
@@ -66,10 +66,10 @@ function useNotifications() {
|
|
|
66
66
|
setLoading(false);
|
|
67
67
|
}
|
|
68
68
|
}, [userId, jwtToken]);
|
|
69
|
-
(0,
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
70
|
loadUserData();
|
|
71
71
|
}, [loadUserData]);
|
|
72
|
-
const createDefaultNotificationSettings = (0,
|
|
72
|
+
const createDefaultNotificationSettings = (0, react_1.useCallback)(async () => {
|
|
73
73
|
if (!userId || !jwtToken)
|
|
74
74
|
return;
|
|
75
75
|
try {
|
|
@@ -80,7 +80,7 @@ function useNotifications() {
|
|
|
80
80
|
debug("Error creating default notification settings:", err);
|
|
81
81
|
}
|
|
82
82
|
}, [userId, jwtToken, partnerId]);
|
|
83
|
-
const connectEmail = (0,
|
|
83
|
+
const connectEmail = (0, react_1.useCallback)(async (email) => {
|
|
84
84
|
if (!userId || !jwtToken) {
|
|
85
85
|
throw new Error("User not authenticated");
|
|
86
86
|
}
|
|
@@ -94,7 +94,7 @@ function useNotifications() {
|
|
|
94
94
|
throw new Error("Failed to connect email");
|
|
95
95
|
}
|
|
96
96
|
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
97
|
-
const connectTelegram = (0,
|
|
97
|
+
const connectTelegram = (0, react_1.useCallback)(async () => {
|
|
98
98
|
if (!userId || !jwtToken) {
|
|
99
99
|
throw new Error("User not authenticated");
|
|
100
100
|
}
|
|
@@ -138,7 +138,7 @@ function useNotifications() {
|
|
|
138
138
|
throw new Error("Failed to connect Telegram");
|
|
139
139
|
}
|
|
140
140
|
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
141
|
-
const disconnectChannel = (0,
|
|
141
|
+
const disconnectChannel = (0, react_1.useCallback)(async (channelType) => {
|
|
142
142
|
if (!userId || !jwtToken) {
|
|
143
143
|
throw new Error("User not authenticated");
|
|
144
144
|
}
|
|
@@ -154,7 +154,7 @@ function useNotifications() {
|
|
|
154
154
|
throw new Error(`Failed to disconnect ${channelType}`);
|
|
155
155
|
}
|
|
156
156
|
}, [userId, jwtToken, loadUserData]);
|
|
157
|
-
const sendTestNotification = (0,
|
|
157
|
+
const sendTestNotification = (0, react_1.useCallback)(async () => {
|
|
158
158
|
if (!userId || !jwtToken) {
|
|
159
159
|
throw new Error("User not authenticated");
|
|
160
160
|
}
|
|
@@ -9,7 +9,7 @@ const thirdweb_insights_1 = require("../../../shared/utils/thirdweb-insights");
|
|
|
9
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
10
|
const react_2 = require("react");
|
|
11
11
|
function useTokenBalance({ token, address }) {
|
|
12
|
-
const
|
|
12
|
+
const { ready } = (0, react_1.useB3)();
|
|
13
13
|
const account = (0, react_1.useAccountWallet)();
|
|
14
14
|
const effectiveAddress = address || account?.address;
|
|
15
15
|
const { data: tokenBalance, isLoading, isFetching, refetch, } = (0, react_query_1.useQuery)({
|
|
@@ -41,7 +41,7 @@ function useTokenBalance({ token, address }) {
|
|
|
41
41
|
}
|
|
42
42
|
return { formatted: "0", raw: null };
|
|
43
43
|
},
|
|
44
|
-
enabled:
|
|
44
|
+
enabled: ready && !!effectiveAddress,
|
|
45
45
|
staleTime: 30000,
|
|
46
46
|
gcTime: 5 * 60 * 1000,
|
|
47
47
|
retry: 2,
|
|
@@ -49,12 +49,12 @@ function useTokenBalance({ token, address }) {
|
|
|
49
49
|
});
|
|
50
50
|
// Force a refetch when the wallet or token changes
|
|
51
51
|
(0, react_2.useEffect)(() => {
|
|
52
|
-
if (
|
|
52
|
+
if (ready && effectiveAddress) {
|
|
53
53
|
refetch();
|
|
54
54
|
}
|
|
55
|
-
}, [
|
|
55
|
+
}, [ready, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
56
56
|
// Determine if we're actually loading
|
|
57
|
-
const isActuallyLoading = !
|
|
57
|
+
const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
58
58
|
return {
|
|
59
59
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
60
60
|
formattedBalance: tokenBalance?.formatted || "0",
|
|
@@ -10,8 +10,8 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
10
10
|
const b3Chain_1 = require("../../../shared/constants/chains/b3Chain");
|
|
11
11
|
const chains_1 = require("../../../shared/utils/chains");
|
|
12
12
|
const thirdweb_1 = require("../../../shared/utils/thirdweb");
|
|
13
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
14
13
|
const wallets_1 = require("thirdweb/wallets");
|
|
14
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
15
15
|
function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
16
16
|
// Normalize chains to array
|
|
17
17
|
const chainIds = Array.isArray(chainsIds) ? chainsIds : [chainsIds];
|
|
@@ -52,9 +52,7 @@ function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
|
52
52
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
53
53
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
54
54
|
retry: 2, // Limit retries on failure
|
|
55
|
-
|
|
56
|
-
// This ensures we only get new references when data actually changes
|
|
57
|
-
structuralSharing: true,
|
|
55
|
+
structuralSharing: false,
|
|
58
56
|
});
|
|
59
57
|
return {
|
|
60
58
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUserQuery = useUserQuery;
|
|
4
|
+
const debug_1 = require("../../../shared/utils/debug");
|
|
4
5
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
+
const zustand_1 = require("zustand");
|
|
7
|
+
const middleware_1 = require("zustand/middleware");
|
|
8
|
+
const debug = (0, debug_1.debugB3React)("useUserQuery");
|
|
6
9
|
const USER_QUERY_KEY = ["b3-user"];
|
|
10
|
+
/**
|
|
11
|
+
* Zustand store for managing user state
|
|
12
|
+
* Persists user data to localStorage
|
|
13
|
+
*/
|
|
14
|
+
const useUserStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
|
|
15
|
+
user: null,
|
|
16
|
+
setUser: (newUser) => {
|
|
17
|
+
const userToSave = newUser ?? null;
|
|
18
|
+
set({ user: userToSave });
|
|
19
|
+
debug("User updated", userToSave);
|
|
20
|
+
},
|
|
21
|
+
clearUser: () => {
|
|
22
|
+
set({ user: null });
|
|
23
|
+
debug("User cleared");
|
|
24
|
+
},
|
|
25
|
+
}), {
|
|
26
|
+
name: "b3-user",
|
|
27
|
+
onRehydrateStorage: () => (_, error) => {
|
|
28
|
+
if (error) {
|
|
29
|
+
console.warn("Failed to rehydrate user store:", error);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
7
33
|
/**
|
|
8
34
|
* NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
|
|
9
35
|
*
|
|
@@ -11,9 +37,9 @@ const USER_QUERY_KEY = ["b3-user"];
|
|
|
11
37
|
* This allows for invalidation and refetching of user data
|
|
12
38
|
*/
|
|
13
39
|
function useUserQuery() {
|
|
14
|
-
const user =
|
|
15
|
-
const setUserStore =
|
|
16
|
-
const clearUserStore =
|
|
40
|
+
const user = useUserStore(state => state.user);
|
|
41
|
+
const setUserStore = useUserStore(state => state.setUser);
|
|
42
|
+
const clearUserStore = useUserStore(state => state.clearUser);
|
|
17
43
|
// Listen for storage events from other tabs/windows
|
|
18
44
|
(0, react_1.useEffect)(() => {
|
|
19
45
|
const handleStorageChange = (e) => {
|
|
@@ -25,14 +51,14 @@ function useUserQuery() {
|
|
|
25
51
|
const parsed = JSON.parse(stored);
|
|
26
52
|
// Zustand persist format: { state: { user: ... }, version: ... }
|
|
27
53
|
const userData = parsed?.state?.user ?? parsed?.user ?? null;
|
|
28
|
-
|
|
54
|
+
useUserStore.setState({ user: userData });
|
|
29
55
|
}
|
|
30
56
|
catch (error) {
|
|
31
57
|
console.warn("Failed to parse user from storage event:", error);
|
|
32
58
|
}
|
|
33
59
|
}
|
|
34
60
|
else {
|
|
35
|
-
|
|
61
|
+
useUserStore.setState({ user: null });
|
|
36
62
|
}
|
|
37
63
|
}
|
|
38
64
|
};
|
|
@@ -55,16 +81,16 @@ function useUserQuery() {
|
|
|
55
81
|
const parsed = JSON.parse(stored);
|
|
56
82
|
// Zustand persist format: { state: { user: ... }, version: ... }
|
|
57
83
|
const userData = parsed?.state?.user ?? parsed?.user ?? null;
|
|
58
|
-
|
|
84
|
+
useUserStore.setState({ user: userData });
|
|
59
85
|
return userData ?? undefined;
|
|
60
86
|
}
|
|
61
87
|
catch (error) {
|
|
62
88
|
console.warn("Failed to refetch user from localStorage:", error);
|
|
63
89
|
// Fallback to current store state
|
|
64
|
-
return
|
|
90
|
+
return useUserStore.getState().user ?? undefined;
|
|
65
91
|
}
|
|
66
92
|
}
|
|
67
|
-
|
|
93
|
+
useUserStore.setState({ user: null });
|
|
68
94
|
return undefined;
|
|
69
95
|
};
|
|
70
96
|
// Helper function to clear user
|
|
@@ -1,4 +1,6 @@
|
|
|
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";
|
|
2
4
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
3
5
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
4
6
|
export { useProfile } from "./hooks/useProfile";
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
// export * from "./hooks";
|
|
4
4
|
// export * from "./stores";
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useAuthStore = exports.useSiwe = exports.useProfile = exports.useAuthentication = exports.useAccountWallet = exports.B3Provider = void 0;
|
|
6
|
+
exports.useAuthStore = exports.useSiwe = exports.useProfile = exports.useAuthentication = exports.useAccountWallet = exports.useB3 = exports.B3Context = exports.B3Provider = void 0;
|
|
7
7
|
// We only export the components and hooks that are needed for the native app
|
|
8
8
|
var B3Provider_native_1 = require("./components/B3Provider/B3Provider.native");
|
|
9
9
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_native_1.B3Provider; } });
|
|
10
|
+
var types_1 = require("./components/B3Provider/types");
|
|
11
|
+
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
12
|
+
var useB3_1 = require("./components/B3Provider/useB3");
|
|
13
|
+
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
10
14
|
var useAccountWallet_1 = require("./hooks/useAccountWallet");
|
|
11
15
|
Object.defineProperty(exports, "useAccountWallet", { enumerable: true, get: function () { return useAccountWallet_1.useAccountWallet; } });
|
|
12
16
|
var useAuthentication_1 = require("./hooks/useAuthentication");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
|
-
export { useB3ConfigStore } from "./configStore";
|
|
3
2
|
export { useModalStore } from "./useModalStore";
|
|
4
3
|
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
5
4
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRecentAddressesStore = exports.useModalStore = exports.
|
|
3
|
+
exports.useRecentAddressesStore = exports.useModalStore = exports.useAuthStore = void 0;
|
|
4
4
|
var useAuthStore_1 = require("./useAuthStore");
|
|
5
5
|
Object.defineProperty(exports, "useAuthStore", { enumerable: true, get: function () { return useAuthStore_1.useAuthStore; } });
|
|
6
|
-
var configStore_1 = require("./configStore");
|
|
7
|
-
Object.defineProperty(exports, "useB3ConfigStore", { enumerable: true, get: function () { return configStore_1.useB3ConfigStore; } });
|
|
8
6
|
var useModalStore_1 = require("./useModalStore");
|
|
9
7
|
Object.defineProperty(exports, "useModalStore", { enumerable: true, get: function () { return useModalStore_1.useModalStore; } });
|
|
10
8
|
var useRecentAddressesStore_1 = require("./useRecentAddressesStore");
|
|
@@ -403,12 +403,6 @@ 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;
|
|
412
406
|
}
|
|
413
407
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
414
408
|
/** Modal type identifier */
|
|
@@ -477,10 +471,6 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
477
471
|
vendingMachineId: string;
|
|
478
472
|
/** The pack type */
|
|
479
473
|
packType: string;
|
|
480
|
-
/** Active tab */
|
|
481
|
-
activeTab?: "crypto" | "fiat";
|
|
482
|
-
/** Force fiat payment */
|
|
483
|
-
forceFiatPayment?: boolean;
|
|
484
474
|
}
|
|
485
475
|
/**
|
|
486
476
|
* Union type of all possible modal content types
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { components } from "../types/api";
|
|
2
2
|
export declare const ANYSPEND_MAINNET_BASE_URL: string;
|
|
3
3
|
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
|
-
export declare const GAS_ORACLE_BASE_URL: string;
|
|
5
|
-
export declare const RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6
4
|
export declare const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
7
5
|
export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
8
6
|
export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { base } from "viem/chains";
|
|
2
2
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
3
3
|
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
|
-
export const GAS_ORACLE_BASE_URL = process.env.NEXT_PUBLIC_GAS_ORACLE_URL || "https://gas-oracle.sean-430.workers.dev";
|
|
5
|
-
export const RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6
4
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
7
5
|
export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
8
6
|
export const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./types/api";
|
|
2
|
-
export * from "./types/gas";
|
|
3
2
|
export * from "./utils/address";
|
|
4
3
|
export * from "./utils/chain";
|
|
5
4
|
export * from "./utils/format";
|
|
@@ -9,6 +8,5 @@ export * from "./utils/string";
|
|
|
9
8
|
export * from "./utils/token";
|
|
10
9
|
export * from "./utils/validation";
|
|
11
10
|
export * from "./constants";
|
|
12
|
-
export * from "./services/gas";
|
|
13
11
|
export * from "./abis/abiUsdcBase";
|
|
14
12
|
export * from "./abis/erc20Staking";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Types
|
|
2
2
|
export * from "./types/api.js";
|
|
3
|
-
export * from "./types/gas.js";
|
|
4
3
|
// Utils
|
|
5
4
|
export * from "./utils/address.js";
|
|
6
5
|
export * from "./utils/chain.js";
|
|
@@ -12,8 +11,6 @@ export * from "./utils/token.js";
|
|
|
12
11
|
export * from "./utils/validation.js";
|
|
13
12
|
// Constants
|
|
14
13
|
export * from "./constants/index.js";
|
|
15
|
-
// Services
|
|
16
|
-
export * from "./services/gas.js";
|
|
17
14
|
// Abis
|
|
18
15
|
export * from "./abis/abiUsdcBase.js";
|
|
19
16
|
export * from "./abis/erc20Staking.js";
|
|
@@ -39,10 +39,4 @@ export declare function AnySpend(props: {
|
|
|
39
39
|
hideBottomNavigation?: boolean;
|
|
40
40
|
/** When true, disables URL parameter management for swap configuration */
|
|
41
41
|
disableUrlParamManagement?: boolean;
|
|
42
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
43
|
-
returnToHomeUrl?: string;
|
|
44
|
-
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
45
|
-
customRecipientLabel?: string;
|
|
46
|
-
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
47
|
-
returnHomeLabel?: string;
|
|
48
42
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
|
|
4
|
-
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote,
|
|
5
|
-
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet,
|
|
4
|
+
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
|
+
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
7
7
|
import { useAccountWalletImage } from "../../../global-account/react/hooks/useAccountWallet.js";
|
|
8
8
|
import { getThirdwebChain } from "../../../shared/constants/chains/supported.js";
|
|
@@ -24,7 +24,6 @@ import { CryptoPaySection } from "./common/CryptoPaySection.js";
|
|
|
24
24
|
import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
|
|
25
25
|
import { FeeDetailPanel } from "./common/FeeDetailPanel.js";
|
|
26
26
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
|
|
27
|
-
import { GasIndicator } from "./common/GasIndicator.js";
|
|
28
27
|
import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails.js";
|
|
29
28
|
import { OrderHistory } from "./common/OrderHistory.js";
|
|
30
29
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
@@ -51,10 +50,10 @@ export function AnySpend(props) {
|
|
|
51
50
|
const fingerprintConfig = getFingerprintConfig();
|
|
52
51
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
|
|
53
52
|
}
|
|
54
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false,
|
|
53
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, }) {
|
|
55
54
|
const searchParams = useSearchParamsSSR();
|
|
56
55
|
const router = useRouter();
|
|
57
|
-
const { partnerId } =
|
|
56
|
+
const { partnerId } = useB3();
|
|
58
57
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
59
58
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
60
59
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
@@ -366,8 +365,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
366
365
|
});
|
|
367
366
|
// Get geo-based onramp options for fiat payments
|
|
368
367
|
const { geoData, coinbaseAvailablePaymentMethods, stripeOnrampSupport, stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
369
|
-
// Get gas price for source chain (where the user pays from)
|
|
370
|
-
const { gasPrice: gasPriceData, isLoading: isLoadingGas } = useGasPrice(selectedSrcChainId);
|
|
371
368
|
// Helper function to map payment method to onramp vendor
|
|
372
369
|
const getOnrampVendor = (paymentMethod) => {
|
|
373
370
|
switch (paymentMethod) {
|
|
@@ -821,7 +818,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
821
818
|
navigateBack();
|
|
822
819
|
// Reset payment methods when going back
|
|
823
820
|
resetPaymentMethods();
|
|
824
|
-
}
|
|
821
|
+
} })) }) }));
|
|
825
822
|
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
826
823
|
setActiveTab(tab);
|
|
827
824
|
// Reset payment methods when switching tabs
|
|
@@ -836,7 +833,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
836
833
|
else {
|
|
837
834
|
setActivePanel(panelIndex);
|
|
838
835
|
}
|
|
839
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues
|
|
836
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), activeTab === "crypto" && (_jsx("div", { className: "z-10 -my-6 flex justify-center", children: _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "cursor-default", selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
840
837
|
if (isBuyMode) {
|
|
841
838
|
return;
|
|
842
839
|
}
|
|
@@ -853,10 +850,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
853
850
|
// Swap amounts
|
|
854
851
|
setSrcAmount(dstAmount);
|
|
855
852
|
setDstAmount(srcAmount);
|
|
856
|
-
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) })), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined,
|
|
853
|
+
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) })), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
857
854
|
setIsSrcInputDirty(false);
|
|
858
855
|
setDstAmount(value);
|
|
859
|
-
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }),
|
|
856
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || effectiveRecipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
860
857
|
if (value === "settings" || value === "home") {
|
|
861
858
|
setB3ModalContentType({
|
|
862
859
|
type: "manageAccount",
|
|
@@ -61,9 +61,5 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
61
61
|
* The partner ID
|
|
62
62
|
*/
|
|
63
63
|
packType: string;
|
|
64
|
-
/**
|
|
65
|
-
* Force fiat payment
|
|
66
|
-
*/
|
|
67
|
-
forceFiatPayment?: boolean;
|
|
68
64
|
}
|
|
69
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType,
|
|
65
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -45,7 +45,7 @@ const BUY_PACKS_FOR_ABI = {
|
|
|
45
45
|
stateMutability: "nonpayable",
|
|
46
46
|
type: "function",
|
|
47
47
|
};
|
|
48
|
-
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType,
|
|
48
|
+
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType, }) {
|
|
49
49
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
50
50
|
const totalAmount = useMemo(() => {
|
|
51
51
|
try {
|
|
@@ -84,5 +84,5 @@ export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activ
|
|
|
84
84
|
pricePerPack,
|
|
85
85
|
vendingMachineId,
|
|
86
86
|
packType,
|
|
87
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount
|
|
87
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount }));
|
|
88
88
|
}
|
|
@@ -107,7 +107,7 @@ export function AnySpendCustom(props) {
|
|
|
107
107
|
const fingerprintConfig = getFingerprintConfig();
|
|
108
108
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomInner, { ...props }) }));
|
|
109
109
|
}
|
|
110
|
-
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps,
|
|
110
|
+
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, }) {
|
|
111
111
|
const hasMounted = useHasMounted();
|
|
112
112
|
const searchParams = useSearchParamsSSR();
|
|
113
113
|
const router = useRouter();
|
|
@@ -506,7 +506,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
506
506
|
return null;
|
|
507
507
|
};
|
|
508
508
|
// Confirm order view.
|
|
509
|
-
const confirmOrderView = (_jsxs("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), _jsxs(Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [
|
|
509
|
+
const confirmOrderView = (_jsxs("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), _jsxs(Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [_jsx("div", { className: "w-full", children: _jsxs("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [_jsx("div", { className: cn("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
|
|
510
510
|
setActiveTab("crypto");
|
|
511
511
|
// Reset payment methods when switching tabs
|
|
512
512
|
resetPaymentMethods();
|
|
@@ -516,7 +516,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
516
516
|
// Reset payment methods when switching tabs
|
|
517
517
|
resetPaymentMethods();
|
|
518
518
|
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
519
|
-
}, children: "Pay with fiat" })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), _jsx(TooltipContent, { children: _jsx("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) })
|
|
519
|
+
}, children: "Pay with fiat" })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), _jsx(TooltipContent, { children: _jsx("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) }), _jsx(TabsContent, { value: "crypto", children: _jsxs("div", { className: "mt-2 flex flex-col gap-6", children: [_jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [_jsxs(motion.div, { initial: false, animate: {
|
|
520
520
|
opacity: hasMounted ? 1 : 0,
|
|
521
521
|
y: hasMounted ? 0 : 20,
|
|
522
522
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -32,12 +32,6 @@ export interface AnySpendCustomExactInProps {
|
|
|
32
32
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
33
33
|
isLoadingAnyspendPrice: boolean;
|
|
34
34
|
}) => React.JSX.Element;
|
|
35
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
36
|
-
returnToHomeUrl?: string;
|
|
37
|
-
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
38
|
-
customRecipientLabel?: string;
|
|
39
|
-
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
40
|
-
returnHomeLabel?: string;
|
|
41
35
|
}
|
|
42
36
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
43
37
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useGasPrice } from "../../../anyspend/react/index.js";
|
|
3
2
|
import { normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
4
3
|
import { Button, ShinyButton, StyleRoot, toast, TransitionPanel, useAccountWallet, } from "../../../global-account/react/index.js";
|
|
5
4
|
import { cn } from "../../../shared/utils/cn.js";
|
|
@@ -17,7 +16,6 @@ import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPay
|
|
|
17
16
|
import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
|
|
18
17
|
import { FeeDetailPanel } from "./common/FeeDetailPanel.js";
|
|
19
18
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
|
|
20
|
-
import { GasIndicator } from "./common/GasIndicator.js";
|
|
21
19
|
import { OrderDetails } from "./common/OrderDetails.js";
|
|
22
20
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
23
21
|
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
@@ -27,7 +25,7 @@ export function AnySpendCustomExactIn(props) {
|
|
|
27
25
|
const fingerprintConfig = getFingerprintConfig();
|
|
28
26
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomExactInInner, { ...props }) }));
|
|
29
27
|
}
|
|
30
|
-
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header,
|
|
28
|
+
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
|
|
31
29
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
32
30
|
const DESTINATION_TOKEN_DETAILS = {
|
|
33
31
|
SYMBOL: destinationToken.symbol ?? "TOKEN",
|
|
@@ -48,8 +46,6 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
48
46
|
});
|
|
49
47
|
const { connectedEOAWallet } = useAccountWallet();
|
|
50
48
|
const setActiveWallet = useSetActiveWallet();
|
|
51
|
-
// Get gas price for source chain (where the user pays from)
|
|
52
|
-
const { gasPrice: gasPriceData, isLoading: isLoadingGas } = useGasPrice(selectedSrcChainId);
|
|
53
49
|
const appliedPreferEoa = useRef(false);
|
|
54
50
|
useEffect(() => {
|
|
55
51
|
if (preferEoa && !appliedPreferEoa.current) {
|
|
@@ -179,10 +175,10 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
179
175
|
}
|
|
180
176
|
};
|
|
181
177
|
const headerContent = header ? (header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote })) : (_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsxs("div", { children: [_jsx("h1", { className: "text-as-primary text-xl font-bold", children: actionLabel }), _jsx("p", { className: "text-as-secondary text-sm", children: "Pay from any token to execute a custom exact-in transaction." })] }) }));
|
|
182
|
-
const mainView = (_jsxs("div", { className: "anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues
|
|
178
|
+
const mainView = (_jsxs("div", { className: "anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, effectiveRecipientAddress: selectedRecipientOrDefault, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: DESTINATION_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
183
179
|
setIsSrcInputDirty(false);
|
|
184
180
|
setSrcAmount(value);
|
|
185
|
-
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL) }))] }) }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }) }),
|
|
181
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL) }))] }) }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }) }), mainFooter ? mainFooter : null] }));
|
|
186
182
|
const handleCryptoOrder = async () => {
|
|
187
183
|
try {
|
|
188
184
|
invariant(anyspendQuote, "Relay price is not found");
|
|
@@ -262,7 +258,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
262
258
|
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethodType.NONE : effectiveCryptoPaymentMethod, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
263
259
|
setOrderId(undefined);
|
|
264
260
|
setActivePanel(PanelView.MAIN);
|
|
265
|
-
}, disableUrlParamManagement: true, points: oat.data.points || undefined
|
|
261
|
+
}, disableUrlParamManagement: true, points: oat.data.points || undefined })) }) }));
|
|
266
262
|
const loadingView = (_jsx("div", { className: "mx-auto flex w-full flex-col items-center gap-4 p-5", children: _jsx("div", { className: "text-as-primary", children: "Loading order details..." }) }));
|
|
267
263
|
const recipientSelectionView = (_jsx(RecipientSelection, { initialValue: selectedRecipientOrDefault || "", onBack: () => setActivePanel(PanelView.MAIN), onConfirm: address => {
|
|
268
264
|
setSelectedRecipientAddress(address);
|