@b3dotfun/sdk 0.1.2 → 0.1.5
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 +7 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +66 -15
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +185 -50
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/cjs/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/cjs/anyspend/react/components/types/classes.js +6 -0
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +119 -15
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.js +46 -0
- package/dist/cjs/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +12 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +17 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -152
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +14 -31
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +68 -17
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +189 -54
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/esm/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/esm/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/esm/anyspend/react/components/types/classes.js +5 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +119 -16
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.js +43 -0
- package/dist/esm/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/esm/anyspend/utils/format.js +12 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +16 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -153
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -2
- 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.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.js +14 -31
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/types/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +8 -19
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +164 -36
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +11 -6
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +278 -69
- package/src/anyspend/react/components/AnySpendDeposit.tsx +176 -52
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/QRDeposit.tsx +91 -35
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +31 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -4
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +43 -23
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +53 -32
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +26 -13
- package/src/anyspend/react/components/common/OrderDetails.tsx +20 -9
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +12 -7
- package/src/anyspend/react/components/common/OrderHistory.tsx +2 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -1
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +118 -40
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +28 -14
- package/src/anyspend/react/components/common/RecipientSelection.tsx +20 -5
- package/src/anyspend/react/components/common/TabSection.tsx +21 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +12 -4
- package/src/anyspend/react/components/common/WarningText.tsx +10 -10
- package/src/anyspend/react/components/index.ts +16 -0
- package/src/anyspend/react/components/types/classes.ts +476 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +141 -17
- package/src/anyspend/react/hooks/useDirectTransfer.ts +67 -0
- package/src/anyspend/react/hooks/useRecipientAddressState.ts +1 -1
- package/src/anyspend/utils/format.ts +13 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -5
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -4
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -11
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +33 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +27 -184
- package/src/global-account/react/components/index.ts +0 -3
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +14 -31
- package/src/global-account/react/hooks/useTWAuth.tsx +3 -5
- package/src/global-account/react/stores/useModalStore.ts +7 -20
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +0 -86
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +0 -142
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +0 -83
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +0 -136
- package/dist/types/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/types/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +0 -243
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +0 -171
|
@@ -5,6 +5,7 @@ import { motion } from "motion/react";
|
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { components } from "../../../types/api";
|
|
7
7
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
8
|
+
import type { CryptoPaySectionClasses } from "../types/classes";
|
|
8
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
9
10
|
import { CryptoPaymentMethodDisplay } from "./CryptoPaymentMethodDisplay";
|
|
10
11
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
@@ -29,6 +30,8 @@ interface CryptoPaySectionProps {
|
|
|
29
30
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
30
31
|
// Fee detail callback
|
|
31
32
|
onShowFeeDetail?: () => void;
|
|
33
|
+
// Custom classes for styling
|
|
34
|
+
classes?: CryptoPaySectionClasses;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export function CryptoPaySection({
|
|
@@ -45,6 +48,7 @@ export function CryptoPaySection({
|
|
|
45
48
|
anyspendQuote,
|
|
46
49
|
onTokenSelect,
|
|
47
50
|
onShowFeeDetail,
|
|
51
|
+
classes,
|
|
48
52
|
}: CryptoPaySectionProps) {
|
|
49
53
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
50
54
|
|
|
@@ -87,10 +91,13 @@ export function CryptoPaySection({
|
|
|
87
91
|
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
88
92
|
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
89
93
|
transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
|
|
90
|
-
className=
|
|
94
|
+
className={
|
|
95
|
+
classes?.container ||
|
|
96
|
+
"pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6"
|
|
97
|
+
}
|
|
91
98
|
>
|
|
92
99
|
<div className="flex items-center justify-between">
|
|
93
|
-
<div className="text-as-primary/50 flex h-7 items-center gap-1.5 text-sm">
|
|
100
|
+
<div className={classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm"}>
|
|
94
101
|
Pay
|
|
95
102
|
{!isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (
|
|
96
103
|
<button onClick={onShowFeeDetail} className="text-as-primary/40 hover:text-as-primary/60 transition-colors">
|
|
@@ -99,7 +106,10 @@ export function CryptoPaySection({
|
|
|
99
106
|
)}
|
|
100
107
|
</div>
|
|
101
108
|
<button
|
|
102
|
-
className=
|
|
109
|
+
className={
|
|
110
|
+
classes?.paymentMethodButton ||
|
|
111
|
+
"text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none"
|
|
112
|
+
}
|
|
103
113
|
onClick={onSelectCryptoPaymentMethod}
|
|
104
114
|
>
|
|
105
115
|
<CryptoPaymentMethodDisplay
|
|
@@ -109,22 +119,24 @@ export function CryptoPaySection({
|
|
|
109
119
|
/>
|
|
110
120
|
</button>
|
|
111
121
|
</div>
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
<div className={classes?.inputContainer}>
|
|
123
|
+
<OrderTokenAmount
|
|
124
|
+
address={walletAddress}
|
|
125
|
+
walletAddress={walletAddress}
|
|
126
|
+
context="from"
|
|
127
|
+
inputValue={srcAmount}
|
|
128
|
+
onChangeInput={value => {
|
|
129
|
+
setIsSrcInputDirty(true);
|
|
130
|
+
setSrcAmount(value);
|
|
131
|
+
}}
|
|
132
|
+
chainId={selectedSrcChainId}
|
|
133
|
+
setChainId={setSelectedSrcChainId}
|
|
134
|
+
token={selectedSrcToken}
|
|
135
|
+
setToken={setSelectedSrcToken}
|
|
136
|
+
onTokenSelect={onTokenSelect}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
<div className={classes?.balanceRow || "flex items-center justify-between"}>
|
|
128
140
|
<div className="text-as-primary/50 flex h-5 items-center text-sm">
|
|
129
141
|
{formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
130
142
|
style: "currency",
|
|
@@ -8,6 +8,7 @@ import { ChevronLeft, ChevronRightCircle, Wallet, X, ZapIcon } from "lucide-reac
|
|
|
8
8
|
import { useConnectModal, useDisconnect, useWalletInfo } from "thirdweb/react";
|
|
9
9
|
import { createWallet } from "thirdweb/wallets";
|
|
10
10
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
11
|
+
import type { CryptoPaymentMethodClasses } from "../types/classes";
|
|
11
12
|
|
|
12
13
|
export enum CryptoPaymentMethodType {
|
|
13
14
|
NONE = "none",
|
|
@@ -29,6 +30,7 @@ interface CryptoPaymentMethodProps {
|
|
|
29
30
|
isCreatingOrder: boolean;
|
|
30
31
|
onBack: () => void;
|
|
31
32
|
onSelectPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
33
|
+
classes?: CryptoPaymentMethodClasses;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export function CryptoPaymentMethod({
|
|
@@ -37,6 +39,7 @@ export function CryptoPaymentMethod({
|
|
|
37
39
|
isCreatingOrder,
|
|
38
40
|
onBack,
|
|
39
41
|
onSelectPaymentMethod,
|
|
42
|
+
classes,
|
|
40
43
|
}: CryptoPaymentMethodProps) {
|
|
41
44
|
const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
|
|
42
45
|
const { disconnect } = useDisconnect();
|
|
@@ -96,16 +99,23 @@ export function CryptoPaymentMethod({
|
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
return (
|
|
99
|
-
<div
|
|
102
|
+
<div
|
|
103
|
+
className={
|
|
104
|
+
classes?.container || "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5 pt-5 sm:px-0 sm:pt-5"
|
|
105
|
+
}
|
|
106
|
+
>
|
|
100
107
|
<div className={cn("relative flex flex-col gap-10")}>
|
|
101
108
|
{/* Header */}
|
|
102
109
|
<button
|
|
103
110
|
onClick={onBack}
|
|
104
|
-
className=
|
|
111
|
+
className={
|
|
112
|
+
classes?.backButton ||
|
|
113
|
+
"text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors"
|
|
114
|
+
}
|
|
105
115
|
>
|
|
106
116
|
<ChevronLeft className="h-6 w-6" />
|
|
107
117
|
</button>
|
|
108
|
-
<div className="flex items-center justify-around gap-4">
|
|
118
|
+
<div className={classes?.header || "flex items-center justify-around gap-4"}>
|
|
109
119
|
<div className="flex-1 text-center">
|
|
110
120
|
<h2 className="text-as-primary text-lg font-semibold">Select a payment method</h2>
|
|
111
121
|
</div>
|
|
@@ -155,7 +165,7 @@ export function CryptoPaymentMethod({
|
|
|
155
165
|
)}
|
|
156
166
|
|
|
157
167
|
{/* Payment Methods */}
|
|
158
|
-
<div className="crypto-payment-methods flex flex-col gap-4">
|
|
168
|
+
<div className={classes?.optionsList || "crypto-payment-methods flex flex-col gap-4"}>
|
|
159
169
|
{/* Installed Wallets Section */}
|
|
160
170
|
{(shouldShowConnectedEOA || globalAddress) && (
|
|
161
171
|
<div className="installed-wallets">
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
3
|
-
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
3
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
5
4
|
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
6
5
|
import { ChevronRight, Info } from "lucide-react";
|
|
7
6
|
import { motion } from "motion/react";
|
|
8
7
|
import { components } from "../../../types/api";
|
|
8
|
+
import type { CryptoReceiveSectionClasses } from "../types/classes";
|
|
9
9
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
10
10
|
import { PointsBadge } from "./PointsBadge";
|
|
11
11
|
|
|
@@ -36,6 +36,8 @@ interface CryptoReceiveSectionProps {
|
|
|
36
36
|
onShowPointsDetail?: () => void;
|
|
37
37
|
// Fee detail navigation
|
|
38
38
|
onShowFeeDetail?: () => void;
|
|
39
|
+
// Custom classes for styling
|
|
40
|
+
classes?: CryptoReceiveSectionClasses;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export function CryptoReceiveSection({
|
|
@@ -57,16 +59,20 @@ export function CryptoReceiveSection({
|
|
|
57
59
|
dstTokenLogoURI,
|
|
58
60
|
onShowPointsDetail,
|
|
59
61
|
onShowFeeDetail,
|
|
62
|
+
classes,
|
|
60
63
|
}: CryptoReceiveSectionProps) {
|
|
61
64
|
return (
|
|
62
65
|
<motion.div
|
|
63
66
|
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
64
67
|
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
65
68
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
66
|
-
className=
|
|
69
|
+
className={
|
|
70
|
+
classes?.container ||
|
|
71
|
+
"receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6"
|
|
72
|
+
}
|
|
67
73
|
>
|
|
68
74
|
<div className="flex w-full items-center justify-between">
|
|
69
|
-
<div className="text-as-primary/50 flex h-7 items-center gap-1.5 text-sm">
|
|
75
|
+
<div className={classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm"}>
|
|
70
76
|
{isDepositMode ? "Deposit" : "Receive"}
|
|
71
77
|
{isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (
|
|
72
78
|
<button onClick={onShowFeeDetail} className="text-as-primary/40 hover:text-as-primary/60 transition-colors">
|
|
@@ -76,11 +82,11 @@ export function CryptoReceiveSection({
|
|
|
76
82
|
</div>
|
|
77
83
|
{effectiveRecipientAddress ? (
|
|
78
84
|
<button
|
|
79
|
-
className={
|
|
85
|
+
className={classes?.recipientButton || "text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"}
|
|
80
86
|
onClick={onSelectRecipient}
|
|
81
87
|
>
|
|
82
88
|
<>
|
|
83
|
-
<span className="text-as-tertiarry flex items-center gap-1 text-sm">
|
|
89
|
+
<span className={classes?.recipientValue || "text-as-tertiarry flex items-center gap-1 text-sm"}>
|
|
84
90
|
{customRecipientLabel ||
|
|
85
91
|
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || ""))}
|
|
86
92
|
</span>
|
|
@@ -88,50 +94,64 @@ export function CryptoReceiveSection({
|
|
|
88
94
|
</>
|
|
89
95
|
</button>
|
|
90
96
|
) : (
|
|
91
|
-
<button
|
|
97
|
+
<button
|
|
98
|
+
className={classes?.recipientButton || "text-as-primary/70 flex items-center gap-1 rounded-lg"}
|
|
99
|
+
onClick={onSelectRecipient}
|
|
100
|
+
>
|
|
92
101
|
<div className="text-sm font-medium">Select recipient</div>
|
|
93
102
|
</button>
|
|
94
103
|
)}
|
|
95
104
|
</div>
|
|
96
105
|
{isBuyMode || isDepositMode ? (
|
|
97
106
|
// Fixed destination token display for buy mode and deposit mode
|
|
98
|
-
<div className="flex items-center justify-between">
|
|
99
|
-
<div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
|
|
100
|
-
<div
|
|
107
|
+
<div className={classes?.inputContainer || "flex items-center justify-between"}>
|
|
108
|
+
<div className={classes?.input || "text-as-primary text-2xl font-bold"}>{dstAmount || "0"}</div>
|
|
109
|
+
<div
|
|
110
|
+
className={
|
|
111
|
+
classes?.tokenSelector ||
|
|
112
|
+
"bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3"
|
|
113
|
+
}
|
|
114
|
+
>
|
|
101
115
|
{(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
|
|
102
116
|
<div className="relative">
|
|
103
117
|
<img
|
|
104
118
|
src={dstTokenLogoURI || dstToken.metadata?.logoURI}
|
|
105
119
|
alt={dstTokenSymbol || dstToken.symbol}
|
|
106
|
-
className="h-8 w-8 rounded-full"
|
|
120
|
+
className={classes?.tokenIcon || "h-8 w-8 rounded-full"}
|
|
107
121
|
/>
|
|
108
122
|
{/* Chain logo overlay */}
|
|
109
123
|
{ALL_CHAINS[dstToken.chainId]?.logoUrl && (
|
|
110
124
|
<img
|
|
111
125
|
src={ALL_CHAINS[dstToken.chainId].logoUrl}
|
|
112
126
|
alt="Chain"
|
|
113
|
-
className=
|
|
127
|
+
className={
|
|
128
|
+
classes?.chainBadge || "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white"
|
|
129
|
+
}
|
|
114
130
|
/>
|
|
115
131
|
)}
|
|
116
132
|
</div>
|
|
117
133
|
)}
|
|
118
|
-
<span className="text-as-brand text-lg font-bold"
|
|
134
|
+
<span className={classes?.tokenSymbol || "text-as-brand text-lg font-bold"}>
|
|
135
|
+
{dstTokenSymbol || dstToken.symbol}
|
|
136
|
+
</span>
|
|
119
137
|
</div>
|
|
120
138
|
</div>
|
|
121
139
|
) : (
|
|
122
140
|
// Token selection for regular swap mode
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
<div className={classes?.inputContainer}>
|
|
142
|
+
<OrderTokenAmount
|
|
143
|
+
address={effectiveRecipientAddress}
|
|
144
|
+
context="to"
|
|
145
|
+
inputValue={dstAmount}
|
|
146
|
+
onChangeInput={onChangeDstAmount || (() => {})}
|
|
147
|
+
chainId={selectedDstChainId || dstToken.chainId}
|
|
148
|
+
setChainId={setSelectedDstChainId || (() => {})}
|
|
149
|
+
token={dstToken}
|
|
150
|
+
setToken={setSelectedDstToken || (() => {})}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
133
153
|
)}
|
|
134
|
-
<div className="text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm">
|
|
154
|
+
<div className={classes?.feeRow || "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm"}>
|
|
135
155
|
<div className="flex items-center gap-2">
|
|
136
156
|
{formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, {
|
|
137
157
|
style: "currency",
|
|
@@ -3,11 +3,13 @@ import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
|
3
3
|
import { ChevronDown } from "lucide-react";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { components } from "../../../types/api";
|
|
6
|
+
import type { FeeDetailPanelClasses } from "../types/classes";
|
|
6
7
|
|
|
7
8
|
interface FeeDetailPanelProps {
|
|
8
9
|
fee: components["schemas"]["Fee"];
|
|
9
10
|
transactionAmountUsd?: number;
|
|
10
11
|
onBack: () => void;
|
|
12
|
+
classes?: FeeDetailPanelClasses;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
// Fee tier definitions
|
|
@@ -32,7 +34,7 @@ const WHALE_DISCOUNT_TIERS = [
|
|
|
32
34
|
{ minAny: 1000000, discountPercent: 100, label: "Tier 3: 1M+ $ANY" },
|
|
33
35
|
];
|
|
34
36
|
|
|
35
|
-
export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailPanelProps) {
|
|
37
|
+
export function FeeDetailPanel({ fee, transactionAmountUsd, onBack, classes }: FeeDetailPanelProps) {
|
|
36
38
|
// Detect if this is a fiat onramp order (Stripe) vs regular crypto swap
|
|
37
39
|
// stripeweb2_fee = Stripe/fiat onramp (uses FIAT_FEE_TIERS)
|
|
38
40
|
// standard_fee = Regular crypto swap (uses CRYPTO_FEE_TIERS)
|
|
@@ -83,15 +85,17 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
83
85
|
const [showAllDiscountTiers, setShowAllDiscountTiers] = useState(false);
|
|
84
86
|
|
|
85
87
|
return (
|
|
86
|
-
<div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-3 px-5">
|
|
88
|
+
<div className={classes?.container || "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3 px-5"}>
|
|
87
89
|
<div className="flex w-full flex-col gap-3">
|
|
88
90
|
<div className="text-center">
|
|
89
|
-
<h3 className="text-as-primary text-lg font-bold">Fee Breakdown</h3>
|
|
91
|
+
<h3 className={classes?.title || "text-as-primary text-lg font-bold"}>Fee Breakdown</h3>
|
|
90
92
|
</div>
|
|
91
93
|
|
|
92
94
|
{/* Base Fee Schedule Section */}
|
|
93
|
-
<div
|
|
94
|
-
|
|
95
|
+
<div
|
|
96
|
+
className={classes?.tierCard || "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4"}
|
|
97
|
+
>
|
|
98
|
+
<h4 className={classes?.tierCardTitle || "text-as-primary mb-3 text-sm font-semibold"}>
|
|
95
99
|
{isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule"}
|
|
96
100
|
</h4>
|
|
97
101
|
<div className="space-y-1.5">
|
|
@@ -109,12 +113,15 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
109
113
|
<div
|
|
110
114
|
key={idx}
|
|
111
115
|
className={cn(
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
isCurrentTier
|
|
117
|
+
? classes?.tierRowActive ||
|
|
118
|
+
"bg-as-brand/10 text-as-brand flex items-center justify-between rounded-lg px-3 py-2.5 text-sm font-semibold transition-colors"
|
|
119
|
+
: classes?.tierRow ||
|
|
120
|
+
"text-as-primary/60 flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors",
|
|
114
121
|
)}
|
|
115
122
|
>
|
|
116
|
-
<span>{tier.label}</span>
|
|
117
|
-
<span>Credit Card Fee + {tier.fee}</span>
|
|
123
|
+
<span className={classes?.tierLabel}>{tier.label}</span>
|
|
124
|
+
<span className={classes?.tierValue}>Credit Card Fee + {tier.fee}</span>
|
|
118
125
|
</div>
|
|
119
126
|
);
|
|
120
127
|
})
|
|
@@ -131,12 +138,15 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
131
138
|
<div
|
|
132
139
|
key={idx}
|
|
133
140
|
className={cn(
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
isCurrentTier
|
|
142
|
+
? classes?.tierRowActive ||
|
|
143
|
+
"bg-as-brand/10 text-as-brand flex items-center justify-between rounded-lg px-3 py-2.5 text-sm font-semibold transition-colors"
|
|
144
|
+
: classes?.tierRow ||
|
|
145
|
+
"text-as-primary/60 flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors",
|
|
136
146
|
)}
|
|
137
147
|
>
|
|
138
|
-
<span>{tier.label}</span>
|
|
139
|
-
<span>{bpsToPercent(tier.bps)}%</span>
|
|
148
|
+
<span className={classes?.tierLabel}>{tier.label}</span>
|
|
149
|
+
<span className={classes?.tierValue}>{bpsToPercent(tier.bps)}%</span>
|
|
140
150
|
</div>
|
|
141
151
|
);
|
|
142
152
|
})}
|
|
@@ -154,7 +164,10 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
154
164
|
return (
|
|
155
165
|
<button
|
|
156
166
|
onClick={() => setShowAllFeeTiers(!showAllFeeTiers)}
|
|
157
|
-
className=
|
|
167
|
+
className={
|
|
168
|
+
classes?.expandButton ||
|
|
169
|
+
"text-as-primary/60 hover:text-as-primary mt-2 flex w-full items-center justify-center gap-1 text-xs transition-colors"
|
|
170
|
+
}
|
|
158
171
|
>
|
|
159
172
|
<span>{showAllFeeTiers ? "Show less" : "Show higher tiers"}</span>
|
|
160
173
|
<ChevronDown className={cn("h-3.5 w-3.5 transition-transform", showAllFeeTiers && "rotate-180")} />
|
|
@@ -237,11 +250,17 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
237
250
|
|
|
238
251
|
{/* Transaction Summary */}
|
|
239
252
|
{transactionAmountUsd && (
|
|
240
|
-
<div
|
|
253
|
+
<div
|
|
254
|
+
className={
|
|
255
|
+
classes?.summaryCard || "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4"
|
|
256
|
+
}
|
|
257
|
+
>
|
|
241
258
|
<div className="space-y-2 text-sm">
|
|
242
|
-
<div className="flex items-center justify-between">
|
|
243
|
-
<span className="text-as-secondary">Transaction</span>
|
|
244
|
-
<span className="text-as-primary font-semibold"
|
|
259
|
+
<div className={classes?.summaryRow || "flex items-center justify-between"}>
|
|
260
|
+
<span className={classes?.summaryLabel || "text-as-secondary"}>Transaction</span>
|
|
261
|
+
<span className={classes?.summaryValue || "text-as-primary font-semibold"}>
|
|
262
|
+
${transactionAmountUsd.toFixed(2)}
|
|
263
|
+
</span>
|
|
245
264
|
</div>
|
|
246
265
|
|
|
247
266
|
{isStripeFee && (
|
|
@@ -267,10 +286,10 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
267
286
|
)}
|
|
268
287
|
</span>
|
|
269
288
|
</div>
|
|
270
|
-
<div className="border-as-border-secondary border-t pt-2">
|
|
271
|
-
<div className="flex items-center justify-between">
|
|
272
|
-
<span className="text-as-primary font-semibold">Total Fee</span>
|
|
273
|
-
<span className="text-as-brand font-semibold">
|
|
289
|
+
<div className={classes?.summaryDivider || "border-as-border-secondary border-t pt-2"}>
|
|
290
|
+
<div className={classes?.totalRow || "flex items-center justify-between"}>
|
|
291
|
+
<span className={classes?.totalLabel || "text-as-primary font-semibold"}>Total Fee</span>
|
|
292
|
+
<span className={classes?.totalValue || "text-as-brand font-semibold"}>
|
|
274
293
|
${((transactionAmountUsd * (fee.finalFeeBps || 0)) / 10000 + (fee.finalFeeUsd || 0)).toFixed(2)}
|
|
275
294
|
</span>
|
|
276
295
|
</div>
|
|
@@ -280,15 +299,17 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
280
299
|
|
|
281
300
|
{!isStripeFee && currentCryptoTier && (
|
|
282
301
|
<>
|
|
283
|
-
<div className="flex items-center justify-between">
|
|
284
|
-
<span className="text-as-secondary"
|
|
285
|
-
|
|
302
|
+
<div className={classes?.summaryRow || "flex items-center justify-between"}>
|
|
303
|
+
<span className={classes?.summaryLabel || "text-as-secondary"}>
|
|
304
|
+
Base Fee ({bpsToPercent(currentCryptoTier.bps)}%)
|
|
305
|
+
</span>
|
|
306
|
+
<span className={classes?.summaryValue || "text-as-primary font-medium"}>
|
|
286
307
|
${((transactionAmountUsd * currentCryptoTier.bps) / 10000).toFixed(2)}
|
|
287
308
|
</span>
|
|
288
309
|
</div>
|
|
289
310
|
|
|
290
311
|
{hasWhaleDiscount && currentWhaleTier && (
|
|
291
|
-
<div className="flex items-center justify-between">
|
|
312
|
+
<div className={classes?.summaryRow || "flex items-center justify-between"}>
|
|
292
313
|
<span className="text-green-600">Discount ({currentWhaleTier.discountPercent}% off)</span>
|
|
293
314
|
<span className="font-medium text-green-600">
|
|
294
315
|
-$
|
|
@@ -298,7 +319,7 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
298
319
|
)}
|
|
299
320
|
|
|
300
321
|
{hasPartnerDiscount && (
|
|
301
|
-
<div className="flex items-center justify-between">
|
|
322
|
+
<div className={classes?.summaryRow || "flex items-center justify-between"}>
|
|
302
323
|
<span className="text-green-600">Partner Discount ({partnerDiscountPercent}% off)</span>
|
|
303
324
|
<span className="font-medium text-green-600">
|
|
304
325
|
-${((transactionAmountUsd * baseFee * partnerDiscountPercent) / 100 / 10000).toFixed(2)}
|
|
@@ -306,10 +327,10 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
306
327
|
</div>
|
|
307
328
|
)}
|
|
308
329
|
|
|
309
|
-
<div className="border-as-border-secondary border-t pt-2">
|
|
310
|
-
<div className="flex items-center justify-between">
|
|
311
|
-
<span className="text-as-primary font-semibold">Total Fee</span>
|
|
312
|
-
<span className="text-as-brand font-semibold">
|
|
330
|
+
<div className={classes?.summaryDivider || "border-as-border-secondary border-t pt-2"}>
|
|
331
|
+
<div className={classes?.totalRow || "flex items-center justify-between"}>
|
|
332
|
+
<span className={classes?.totalLabel || "text-as-primary font-semibold"}>Total Fee</span>
|
|
333
|
+
<span className={classes?.totalValue || "text-as-brand font-semibold"}>
|
|
313
334
|
${((transactionAmountUsd * fee.finalFeeBps) / 10000).toFixed(2)}
|
|
314
335
|
</span>
|
|
315
336
|
</div>
|
|
@@ -323,7 +344,7 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailP
|
|
|
323
344
|
<ShinyButton
|
|
324
345
|
accentColor={"hsl(var(--as-brand))"}
|
|
325
346
|
onClick={onBack}
|
|
326
|
-
className={cn("as-main-button !bg-as-brand relative w-full")}
|
|
347
|
+
className={classes?.backButton || cn("as-main-button !bg-as-brand relative w-full")}
|
|
327
348
|
textClassName={cn("text-white")}
|
|
328
349
|
>
|
|
329
350
|
Back to {isStripeFee ? "Payment" : "Swap"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useGeoOnrampOptions } from "@b3dotfun/sdk/anyspend/react";
|
|
4
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
5
5
|
import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
|
|
6
|
+
import type { FiatPaymentMethodClasses } from "../types/classes";
|
|
6
7
|
|
|
7
8
|
export enum FiatPaymentMethod {
|
|
8
9
|
NONE = "none",
|
|
@@ -25,6 +26,7 @@ interface FiatPaymentMethodProps {
|
|
|
25
26
|
onBack: () => void;
|
|
26
27
|
onSelectPaymentMethod: (method: FiatPaymentMethod) => void;
|
|
27
28
|
srcAmountOnRamp: string;
|
|
29
|
+
classes?: FiatPaymentMethodClasses;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export function FiatPaymentMethodComponent({
|
|
@@ -33,6 +35,7 @@ export function FiatPaymentMethodComponent({
|
|
|
33
35
|
onBack,
|
|
34
36
|
onSelectPaymentMethod,
|
|
35
37
|
srcAmountOnRamp,
|
|
38
|
+
classes,
|
|
36
39
|
}: FiatPaymentMethodProps) {
|
|
37
40
|
// Load geo-based onramp options like in PanelOnramp
|
|
38
41
|
const {
|
|
@@ -107,12 +110,15 @@ export function FiatPaymentMethodComponent({
|
|
|
107
110
|
// Show loading state while checking geo availability
|
|
108
111
|
if (isLoadingGeoOnramp) {
|
|
109
112
|
return (
|
|
110
|
-
<div className="fiat-payment-method mx-auto w-[460px] max-w-full p-5">
|
|
113
|
+
<div className={classes?.container || "fiat-payment-method mx-auto w-[460px] max-w-full p-5"}>
|
|
111
114
|
<div className="flex flex-col gap-6">
|
|
112
|
-
<div className="flex items-center gap-4">
|
|
115
|
+
<div className={classes?.header || "flex items-center gap-4"}>
|
|
113
116
|
<button
|
|
114
117
|
onClick={onBack}
|
|
115
|
-
className=
|
|
118
|
+
className={
|
|
119
|
+
classes?.backButton ||
|
|
120
|
+
"text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors"
|
|
121
|
+
}
|
|
116
122
|
>
|
|
117
123
|
<ChevronLeft className="h-6 w-6" />
|
|
118
124
|
</button>
|
|
@@ -130,13 +136,16 @@ export function FiatPaymentMethodComponent({
|
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
return (
|
|
133
|
-
<div className="fiat-payment-method mx-auto w-[460px] max-w-full p-5">
|
|
139
|
+
<div className={classes?.container || "fiat-payment-method mx-auto w-[460px] max-w-full p-5"}>
|
|
134
140
|
<div className="flex flex-col gap-6">
|
|
135
141
|
{/* Header */}
|
|
136
|
-
<div className="flex items-center gap-4">
|
|
142
|
+
<div className={classes?.header || "flex items-center gap-4"}>
|
|
137
143
|
<button
|
|
138
144
|
onClick={onBack}
|
|
139
|
-
className=
|
|
145
|
+
className={
|
|
146
|
+
classes?.backButton ||
|
|
147
|
+
"text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors"
|
|
148
|
+
}
|
|
140
149
|
>
|
|
141
150
|
<ChevronLeft className="h-6 w-6" />
|
|
142
151
|
</button>
|
|
@@ -146,7 +155,7 @@ export function FiatPaymentMethodComponent({
|
|
|
146
155
|
</div>
|
|
147
156
|
|
|
148
157
|
{/* Payment Methods */}
|
|
149
|
-
<div className="flex flex-col gap-3">
|
|
158
|
+
<div className={classes?.optionsList || "flex flex-col gap-3"}>
|
|
150
159
|
{availablePaymentMethods.length === 0 ? (
|
|
151
160
|
<div className="fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center">
|
|
152
161
|
<p className="text-as-secondary text-sm">
|
|
@@ -161,12 +170,16 @@ export function FiatPaymentMethodComponent({
|
|
|
161
170
|
setSelectedPaymentMethod(method.id);
|
|
162
171
|
onSelectPaymentMethod(method.id);
|
|
163
172
|
}}
|
|
164
|
-
className={
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
className={
|
|
174
|
+
(selectedPaymentMethod === method.id && classes?.optionItemActive) ||
|
|
175
|
+
classes?.optionItem ||
|
|
176
|
+
cn(
|
|
177
|
+
"fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200",
|
|
178
|
+
selectedPaymentMethod === method.id
|
|
179
|
+
? "border-as-brand bg-as-brand/10"
|
|
180
|
+
: "hover:border-as-brand/50 hover:bg-as-brand/5",
|
|
181
|
+
)
|
|
182
|
+
}
|
|
170
183
|
>
|
|
171
184
|
{/* Icon - matching PanelOnramp style */}
|
|
172
185
|
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-blue-600 text-2xl text-white">
|
|
@@ -43,6 +43,7 @@ import { encodeFunctionData, erc20Abi } from "viem";
|
|
|
43
43
|
import { b3 } from "viem/chains";
|
|
44
44
|
import { useWaitForTransactionReceipt, useWalletClient } from "wagmi";
|
|
45
45
|
import { usePhantomTransfer } from "../../hooks/usePhantomTransfer";
|
|
46
|
+
import type { OrderDetailsClasses } from "../types/classes";
|
|
46
47
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./Accordion";
|
|
47
48
|
import ConnectWalletPayment from "./ConnectWalletPayment";
|
|
48
49
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
@@ -69,6 +70,8 @@ interface OrderDetailsProps {
|
|
|
69
70
|
returnToHomeUrl?: string;
|
|
70
71
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
71
72
|
returnHomeLabel?: string;
|
|
73
|
+
/** Custom class names for styling specific elements */
|
|
74
|
+
classes?: OrderDetailsClasses;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
// Add this helper function near the top or just above the component
|
|
@@ -223,6 +226,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
223
226
|
points,
|
|
224
227
|
returnToHomeUrl,
|
|
225
228
|
returnHomeLabel,
|
|
229
|
+
classes,
|
|
226
230
|
}: OrderDetailsProps) {
|
|
227
231
|
const router = useRouter();
|
|
228
232
|
const searchParams = useSearchParams();
|
|
@@ -411,7 +415,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
411
415
|
// Reusable "Return to Home" / "Close" button
|
|
412
416
|
const returnHomeOrCloseButton = (
|
|
413
417
|
<button
|
|
414
|
-
className=
|
|
418
|
+
className={
|
|
419
|
+
classes?.returnButton ||
|
|
420
|
+
"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"
|
|
421
|
+
}
|
|
415
422
|
onClick={returnToHomeUrl ? handleReturnToHome : mode === "page" ? handleBack : handleCloseModal}
|
|
416
423
|
>
|
|
417
424
|
{returnHomeLabel ? (
|
|
@@ -491,13 +498,11 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
491
498
|
}
|
|
492
499
|
|
|
493
500
|
const expectedDstAmount =
|
|
494
|
-
order.type === "mint_nft" ||
|
|
495
|
-
order.type === "join_tournament" ||
|
|
496
|
-
order.type === "fund_tournament" ||
|
|
497
|
-
order.type === "custom" ||
|
|
498
|
-
order.type === "deposit_first"
|
|
501
|
+
order.type === "mint_nft" || order.type === "join_tournament" || order.type === "fund_tournament"
|
|
499
502
|
? "0"
|
|
500
|
-
: order.
|
|
503
|
+
: order.type === "custom" || order.type === "deposit_first"
|
|
504
|
+
? order.payload.amount?.toString() || "0"
|
|
505
|
+
: order.payload.expectedDstAmount.toString();
|
|
501
506
|
const formattedExpectedDstAmount = formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
502
507
|
|
|
503
508
|
const actualDstAmount = order.settlement?.actualDstAmount;
|
|
@@ -918,7 +923,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
918
923
|
|
|
919
924
|
{/* <DelayedSupportMessage /> */}
|
|
920
925
|
<button
|
|
921
|
-
className=
|
|
926
|
+
className={
|
|
927
|
+
classes?.backButton ||
|
|
928
|
+
"text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline"
|
|
929
|
+
}
|
|
922
930
|
onClick={handleBack}
|
|
923
931
|
>
|
|
924
932
|
<RefreshCcw className="ml-2 h-4 w-4" /> Cancel and start over
|
|
@@ -1125,7 +1133,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1125
1133
|
)}
|
|
1126
1134
|
|
|
1127
1135
|
<button
|
|
1128
|
-
className=
|
|
1136
|
+
className={
|
|
1137
|
+
classes?.backButton ||
|
|
1138
|
+
"text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline"
|
|
1139
|
+
}
|
|
1129
1140
|
onClick={handleBack}
|
|
1130
1141
|
>
|
|
1131
1142
|
<RefreshCcw className="ml-2 h-4 w-4" /> Cancel and start over
|