@b3dotfun/sdk 0.1.69-alpha.22 → 0.1.69-alpha.23
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 +2 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +24 -12
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
- package/src/anyspend/react/components/AnySpendNFT.tsx +4 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
- package/src/global-account/react/stores/useModalStore.ts +2 -0
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -67,7 +67,7 @@ function AnySpend(props) {
|
|
|
67
67
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
68
68
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }) }));
|
|
69
69
|
}
|
|
70
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, }) {
|
|
70
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
|
|
71
71
|
const { slots, content } = (0, AnySpendCustomizationContext_1.useAnySpendCustomization)();
|
|
72
72
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
73
73
|
const router = (0, react_2.useRouter)();
|
|
@@ -91,6 +91,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
91
91
|
// Track previous panel for proper back navigation
|
|
92
92
|
const previousPanel = (0, react_4.useRef)(PanelView.MAIN);
|
|
93
93
|
const [activeTab, setActiveTab] = (0, react_4.useState)(() => {
|
|
94
|
+
if (!showFiatOption)
|
|
95
|
+
return "crypto";
|
|
94
96
|
if (typeof window !== "undefined") {
|
|
95
97
|
const stored = sessionStorage.getItem("anyspend_active_tab");
|
|
96
98
|
if (stored === "crypto" || stored === "fiat")
|
|
@@ -99,8 +101,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
99
101
|
return defaultActiveTab;
|
|
100
102
|
});
|
|
101
103
|
(0, react_4.useEffect)(() => {
|
|
104
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
105
|
+
setActiveTab("crypto");
|
|
106
|
+
}, [showFiatOption, activeTab]);
|
|
107
|
+
(0, react_4.useEffect)(() => {
|
|
108
|
+
if (!showFiatOption)
|
|
109
|
+
return;
|
|
102
110
|
sessionStorage.setItem("anyspend_active_tab", activeTab);
|
|
103
|
-
}, [activeTab]);
|
|
111
|
+
}, [activeTab, showFiatOption]);
|
|
104
112
|
const [orderId, setOrderId] = (0, react_4.useState)(loadOrder);
|
|
105
113
|
const [directTransferTxHash, setDirectTransferTxHash] = (0, react_4.useState)();
|
|
106
114
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(orderId);
|
|
@@ -979,12 +987,12 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
979
987
|
// Reset payment methods when going back
|
|
980
988
|
resetPaymentMethods();
|
|
981
989
|
}, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
|
|
982
|
-
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
990
|
+
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), showFiatOption && ((0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
983
991
|
setActiveTab(tab);
|
|
984
992
|
// Reset payment methods when switching tabs
|
|
985
993
|
resetPaymentMethods();
|
|
986
994
|
setSelectedFiatPaymentMethod(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
|
|
987
|
-
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : ((0, jsx_runtime_1.jsx)(react_3.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: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
995
|
+
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod })), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : ((0, jsx_runtime_1.jsx)(react_3.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: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
988
996
|
// Map panel index to navigation with direction
|
|
989
997
|
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
990
998
|
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
@@ -70,6 +70,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
70
70
|
* Force fiat payment
|
|
71
71
|
*/
|
|
72
72
|
forceFiatPayment?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show the "Pay with fiat" tab. Defaults to true.
|
|
75
|
+
*/
|
|
76
|
+
showFiatOption?: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Optional discount code to apply to the purchase.
|
|
75
79
|
* When provided, validates on-chain and adjusts the price accordingly.
|
|
@@ -79,4 +83,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
79
83
|
content?: AnySpendContent;
|
|
80
84
|
theme?: AnySpendTheme;
|
|
81
85
|
}
|
|
82
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, showFiatOption, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -44,7 +44,7 @@ const basePublicClient = (0, viem_1.createPublicClient)({
|
|
|
44
44
|
chain: chains_1.base,
|
|
45
45
|
transport: (0, viem_1.http)(constants_2.PUBLIC_BASE_RPC_URL),
|
|
46
46
|
});
|
|
47
|
-
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }) {
|
|
47
|
+
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, showFiatOption = true, discountCode, slots, content, theme, }) {
|
|
48
48
|
const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
|
|
49
49
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
50
50
|
const totalAmount = (0, react_1.useMemo)(() => {
|
|
@@ -218,5 +218,5 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
|
|
|
218
218
|
...(discountCode && discountInfo.isValid
|
|
219
219
|
? { discountCode, discountAmount: discountInfo.discountAmount.toString() }
|
|
220
220
|
: {}),
|
|
221
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, slots: slots, content: content, theme: theme }));
|
|
221
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, showFiatOption: showFiatOption, slots: slots, content: content, theme: theme }));
|
|
222
222
|
}
|
|
@@ -13,6 +13,8 @@ export declare function AnySpendCustom(props: {
|
|
|
13
13
|
dstToken: components["schemas"]["Token"];
|
|
14
14
|
dstAmount: string;
|
|
15
15
|
forceFiatPayment?: boolean;
|
|
16
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
17
|
+
showFiatOption?: boolean;
|
|
16
18
|
contractAddress: string;
|
|
17
19
|
encodedData: string;
|
|
18
20
|
metadata: any;
|
|
@@ -115,12 +115,16 @@ function AnySpendCustom(props) {
|
|
|
115
115
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
116
116
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendCustomInner, { ...props }) }) }));
|
|
117
117
|
}
|
|
118
|
-
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, forceFiatPayment, senderAddress, }) {
|
|
118
|
+
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, forceFiatPayment, showFiatOption = true, senderAddress, }) {
|
|
119
119
|
const hasMounted = (0, react_2.useHasMounted)();
|
|
120
120
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
121
121
|
const router = (0, react_2.useRouter)();
|
|
122
122
|
const [activePanel, setActivePanel] = (0, react_5.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
123
|
-
const [activeTab, setActiveTab] = (0, react_5.useState)(forceFiatPayment ? "fiat" : activeTabProps);
|
|
123
|
+
const [activeTab, setActiveTab] = (0, react_5.useState)(!showFiatOption ? "crypto" : forceFiatPayment ? "fiat" : activeTabProps);
|
|
124
|
+
(0, react_5.useEffect)(() => {
|
|
125
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
126
|
+
setActiveTab("crypto");
|
|
127
|
+
}, [showFiatOption, activeTab]);
|
|
124
128
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
125
129
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
126
130
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = (0, useCryptoPaymentMethodState_1.useCryptoPaymentMethodState)();
|
|
@@ -501,7 +505,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
501
505
|
return null;
|
|
502
506
|
};
|
|
503
507
|
// Confirm order view.
|
|
504
|
-
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [!forceFiatPayment && ((0, jsx_runtime_1.jsx)("div", { className: "w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.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" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.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: () => {
|
|
508
|
+
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [!forceFiatPayment && showFiatOption && ((0, jsx_runtime_1.jsx)("div", { className: "w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.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" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.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: () => {
|
|
505
509
|
setActiveTab("crypto");
|
|
506
510
|
// Reset payment methods when switching tabs
|
|
507
511
|
resetPaymentMethods();
|
|
@@ -73,6 +73,8 @@ export interface AnySpendDepositProps {
|
|
|
73
73
|
depositContractConfig?: DepositContractConfig;
|
|
74
74
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
75
75
|
showChainSelection?: boolean;
|
|
76
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
77
|
+
showFiatOption?: boolean;
|
|
76
78
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
77
79
|
supportedChains?: ChainConfig[];
|
|
78
80
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
@@ -148,4 +150,4 @@ export interface AnySpendDepositProps {
|
|
|
148
150
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
149
151
|
* />
|
|
150
152
|
*/
|
|
151
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
153
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -97,7 +97,7 @@ function ChainIcon({ chainId, className }) {
|
|
|
97
97
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
98
98
|
* />
|
|
99
99
|
*/
|
|
100
|
-
function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
100
|
+
function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption = true, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
101
101
|
// Extract deposit-specific classes for convenience
|
|
102
102
|
const depositClasses = classes?.deposit;
|
|
103
103
|
const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
|
|
@@ -199,9 +199,9 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
|
|
|
199
199
|
"anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
200
200
|
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.divider || "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: depositClasses?.dividerText || "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: depositClasses?.qrButton ||
|
|
201
201
|
"anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
202
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
202
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), showFiatOption && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
203
203
|
"anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
204
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
204
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }))] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
205
205
|
}
|
|
206
206
|
// QR Deposit view
|
|
207
207
|
if (step === "qr-deposit") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
@@ -12,4 +12,6 @@ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftCont
|
|
|
12
12
|
slots?: AnySpendSlots;
|
|
13
13
|
content?: AnySpendContent;
|
|
14
14
|
theme?: AnySpendTheme;
|
|
15
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
16
|
+
showFiatOption?: boolean;
|
|
15
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,7 +29,7 @@ const CONTRACT_URI_ABI = [
|
|
|
29
29
|
type: "function",
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
|
-
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }) {
|
|
32
|
+
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
33
33
|
const [imageUrlWithFallback, setFallbackImageUrl] = (0, react_3.useState)(nftContract.imageUrl);
|
|
34
34
|
const hasFetchedRef = (0, react_3.useRef)(false);
|
|
35
35
|
// Fetch contract metadata when imageUrl is empty
|
|
@@ -83,7 +83,7 @@ function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract,
|
|
|
83
83
|
const header = (0, react_3.useCallback)(({ anyspendPrice, isLoadingAnyspendPrice, }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative size-[200px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCard, { className: "overflow-hidden", children: [imageUrlWithFallback && ((0, jsx_runtime_1.jsx)("img", { src: imageUrlWithFallback, alt: nftContract.name, className: "size-full object-cover" })), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), (0, jsx_runtime_1.jsx)(DropdownMenu, { nftContract: nftContract })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 -mb-5 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(react_2.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
|
|
84
84
|
"opacity-0": isLoadingAnyspendPrice,
|
|
85
85
|
}), children: (0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[36px] w-full" })) })] })] })] })), [imageUrlWithFallback, nftContract]);
|
|
86
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", showFiatOption: showFiatOption, recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
87
87
|
type: "mint_nft",
|
|
88
88
|
nftContract: nftContract,
|
|
89
89
|
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
beneficiaryAddress: string;
|
|
@@ -14,4 +14,6 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
|
|
|
14
14
|
slots?: AnySpendSlots;
|
|
15
15
|
content?: AnySpendContent;
|
|
16
16
|
theme?: AnySpendTheme;
|
|
17
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
18
|
+
showFiatOption?: boolean;
|
|
17
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,7 +20,7 @@ function generateEncodedDataForStaking(amount, beneficiary) {
|
|
|
20
20
|
args: [beneficiary, BigInt(amount)],
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }) {
|
|
23
|
+
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
24
24
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? (0, number_1.formatTokenAmount)(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
|
|
25
25
|
// Only generate encoded data if we have a valid beneficiary address
|
|
26
26
|
// This is used for the AnySpendCustom swap & stake flow
|
|
@@ -30,5 +30,5 @@ function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, st
|
|
|
30
30
|
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
32
32
|
action: `stake ${token.symbol}`,
|
|
33
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
33
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, showFiatOption: showFiatOption, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
34
34
|
}
|
|
@@ -609,6 +609,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
609
609
|
actionLabel?: string;
|
|
610
610
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
611
611
|
showChainSelection?: boolean;
|
|
612
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
613
|
+
showFiatOption?: boolean;
|
|
612
614
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
613
615
|
minPoolSize?: number;
|
|
614
616
|
/** Custom title for chain selection step */
|
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -60,7 +60,7 @@ export function AnySpend(props) {
|
|
|
60
60
|
const fingerprintConfig = getFingerprintConfig();
|
|
61
61
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: _jsx(AnySpendInner, { ...props }) }) }));
|
|
62
62
|
}
|
|
63
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, }) {
|
|
63
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
|
|
64
64
|
const { slots, content } = useAnySpendCustomization();
|
|
65
65
|
const searchParams = useSearchParamsSSR();
|
|
66
66
|
const router = useRouter();
|
|
@@ -84,6 +84,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
84
84
|
// Track previous panel for proper back navigation
|
|
85
85
|
const previousPanel = useRef(PanelView.MAIN);
|
|
86
86
|
const [activeTab, setActiveTab] = useState(() => {
|
|
87
|
+
if (!showFiatOption)
|
|
88
|
+
return "crypto";
|
|
87
89
|
if (typeof window !== "undefined") {
|
|
88
90
|
const stored = sessionStorage.getItem("anyspend_active_tab");
|
|
89
91
|
if (stored === "crypto" || stored === "fiat")
|
|
@@ -92,8 +94,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
92
94
|
return defaultActiveTab;
|
|
93
95
|
});
|
|
94
96
|
useEffect(() => {
|
|
97
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
98
|
+
setActiveTab("crypto");
|
|
99
|
+
}, [showFiatOption, activeTab]);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!showFiatOption)
|
|
102
|
+
return;
|
|
95
103
|
sessionStorage.setItem("anyspend_active_tab", activeTab);
|
|
96
|
-
}, [activeTab]);
|
|
104
|
+
}, [activeTab, showFiatOption]);
|
|
97
105
|
const [orderId, setOrderId] = useState(loadOrder);
|
|
98
106
|
const [directTransferTxHash, setDirectTransferTxHash] = useState();
|
|
99
107
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(orderId);
|
|
@@ -972,12 +980,12 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
972
980
|
// Reset payment methods when going back
|
|
973
981
|
resetPaymentMethods();
|
|
974
982
|
}, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
|
|
975
|
-
const mainView = (_jsxs("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] 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: classes?.header || "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: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
983
|
+
const mainView = (_jsxs("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] 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: classes?.header || "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: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), showFiatOption && (_jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
976
984
|
setActiveTab(tab);
|
|
977
985
|
// Reset payment methods when switching tabs
|
|
978
986
|
resetPaymentMethods();
|
|
979
987
|
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
980
|
-
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_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: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
988
|
+
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod })), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_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: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
981
989
|
// Map panel index to navigation with direction
|
|
982
990
|
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
983
991
|
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
@@ -70,6 +70,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
70
70
|
* Force fiat payment
|
|
71
71
|
*/
|
|
72
72
|
forceFiatPayment?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show the "Pay with fiat" tab. Defaults to true.
|
|
75
|
+
*/
|
|
76
|
+
showFiatOption?: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Optional discount code to apply to the purchase.
|
|
75
79
|
* When provided, validates on-chain and adjusts the price accordingly.
|
|
@@ -79,4 +83,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
79
83
|
content?: AnySpendContent;
|
|
80
84
|
theme?: AnySpendTheme;
|
|
81
85
|
}
|
|
82
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, showFiatOption, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -41,7 +41,7 @@ const basePublicClient = createPublicClient({
|
|
|
41
41
|
chain: base,
|
|
42
42
|
transport: http(PUBLIC_BASE_RPC_URL),
|
|
43
43
|
});
|
|
44
|
-
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }) {
|
|
44
|
+
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, showFiatOption = true, discountCode, slots, content, theme, }) {
|
|
45
45
|
const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
|
|
46
46
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
47
47
|
const totalAmount = useMemo(() => {
|
|
@@ -215,5 +215,5 @@ export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activ
|
|
|
215
215
|
...(discountCode && discountInfo.isValid
|
|
216
216
|
? { discountCode, discountAmount: discountInfo.discountAmount.toString() }
|
|
217
217
|
: {}),
|
|
218
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, slots: slots, content: content, theme: theme }));
|
|
218
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, showFiatOption: showFiatOption, slots: slots, content: content, theme: theme }));
|
|
219
219
|
}
|
|
@@ -13,6 +13,8 @@ export declare function AnySpendCustom(props: {
|
|
|
13
13
|
dstToken: components["schemas"]["Token"];
|
|
14
14
|
dstAmount: string;
|
|
15
15
|
forceFiatPayment?: boolean;
|
|
16
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
17
|
+
showFiatOption?: boolean;
|
|
16
18
|
contractAddress: string;
|
|
17
19
|
encodedData: string;
|
|
18
20
|
metadata: any;
|
|
@@ -109,12 +109,16 @@ export function AnySpendCustom(props) {
|
|
|
109
109
|
const fingerprintConfig = getFingerprintConfig();
|
|
110
110
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: _jsx(AnySpendCustomInner, { ...props }) }) }));
|
|
111
111
|
}
|
|
112
|
-
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, forceFiatPayment, senderAddress, }) {
|
|
112
|
+
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, forceFiatPayment, showFiatOption = true, senderAddress, }) {
|
|
113
113
|
const hasMounted = useHasMounted();
|
|
114
114
|
const searchParams = useSearchParamsSSR();
|
|
115
115
|
const router = useRouter();
|
|
116
116
|
const [activePanel, setActivePanel] = useState(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
117
|
-
const [activeTab, setActiveTab] = useState(forceFiatPayment ? "fiat" : activeTabProps);
|
|
117
|
+
const [activeTab, setActiveTab] = useState(!showFiatOption ? "crypto" : forceFiatPayment ? "fiat" : activeTabProps);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
120
|
+
setActiveTab("crypto");
|
|
121
|
+
}, [showFiatOption, activeTab]);
|
|
118
122
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
119
123
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
120
124
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = useCryptoPaymentMethodState();
|
|
@@ -495,7 +499,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
495
499
|
return null;
|
|
496
500
|
};
|
|
497
501
|
// Confirm order view.
|
|
498
|
-
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: [!forceFiatPayment && (_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: () => {
|
|
502
|
+
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: [!forceFiatPayment && showFiatOption && (_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: () => {
|
|
499
503
|
setActiveTab("crypto");
|
|
500
504
|
// Reset payment methods when switching tabs
|
|
501
505
|
resetPaymentMethods();
|
|
@@ -73,6 +73,8 @@ export interface AnySpendDepositProps {
|
|
|
73
73
|
depositContractConfig?: DepositContractConfig;
|
|
74
74
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
75
75
|
showChainSelection?: boolean;
|
|
76
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
77
|
+
showFiatOption?: boolean;
|
|
76
78
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
77
79
|
supportedChains?: ChainConfig[];
|
|
78
80
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
@@ -148,4 +150,4 @@ export interface AnySpendDepositProps {
|
|
|
148
150
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
149
151
|
* />
|
|
150
152
|
*/
|
|
151
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
153
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -94,7 +94,7 @@ function ChainIcon({ chainId, className }) {
|
|
|
94
94
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
95
95
|
* />
|
|
96
96
|
*/
|
|
97
|
-
export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
97
|
+
export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption = true, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
98
98
|
// Extract deposit-specific classes for convenience
|
|
99
99
|
const depositClasses = classes?.deposit;
|
|
100
100
|
const { connectedEOAWallet } = useAccountWallet();
|
|
@@ -196,9 +196,9 @@ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, p
|
|
|
196
196
|
"anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsx("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content", children: _jsxs("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [_jsx("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), _jsx("p", { className: depositClasses?.optionDescription ||
|
|
197
197
|
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), _jsx(ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("div", { className: depositClasses?.divider || "anyspend-deposit-divider flex items-center gap-3", children: [_jsx("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" }), _jsx("span", { className: depositClasses?.dividerText || "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), _jsx("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" })] }), _jsxs("button", { onClick: handleSelectQrDeposit, className: depositClasses?.qrButton ||
|
|
198
198
|
"anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsxs("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(QrCodeIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [_jsx("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), _jsx("p", { className: depositClasses?.optionDescription ||
|
|
199
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), _jsx(ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
199
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), _jsx(ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), showFiatOption && (_jsxs("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
200
200
|
"anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [_jsxs("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(CreditCardIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [_jsx("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), _jsx("p", { className: depositClasses?.optionDescription ||
|
|
201
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), _jsx(ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), _jsx(ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
201
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), _jsx(ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }))] }), _jsx(ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
202
202
|
}
|
|
203
203
|
// QR Deposit view
|
|
204
204
|
if (step === "qr-deposit") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
@@ -12,4 +12,6 @@ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftCont
|
|
|
12
12
|
slots?: AnySpendSlots;
|
|
13
13
|
content?: AnySpendContent;
|
|
14
14
|
theme?: AnySpendTheme;
|
|
15
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
16
|
+
showFiatOption?: boolean;
|
|
15
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,7 +26,7 @@ const CONTRACT_URI_ABI = [
|
|
|
26
26
|
type: "function",
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
|
-
export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }) {
|
|
29
|
+
export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
30
30
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState(nftContract.imageUrl);
|
|
31
31
|
const hasFetchedRef = useRef(false);
|
|
32
32
|
// Fetch contract metadata when imageUrl is empty
|
|
@@ -80,7 +80,7 @@ export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftCo
|
|
|
80
80
|
const header = useCallback(({ anyspendPrice, isLoadingAnyspendPrice, }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative size-[200px]", children: [_jsx("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), _jsxs(GlareCard, { className: "overflow-hidden", children: [imageUrlWithFallback && (_jsx("img", { src: imageUrlWithFallback, alt: nftContract.name, className: "size-full object-cover" })), _jsx("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), _jsx(DropdownMenu, { nftContract: nftContract })] }), _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 -mb-5 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[100px] w-full" }), _jsxs("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [_jsx("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), _jsx("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? (_jsx(AnimatePresence, { mode: "wait", children: _jsx("div", { className: cn("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
|
|
81
81
|
"opacity-0": isLoadingAnyspendPrice,
|
|
82
82
|
}), children: formatDisplayNumber(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : (_jsx("div", { className: "h-[36px] w-full" })) })] })] })] })), [imageUrlWithFallback, nftContract]);
|
|
83
|
-
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
83
|
+
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", showFiatOption: showFiatOption, recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
84
84
|
type: "mint_nft",
|
|
85
85
|
nftContract: nftContract,
|
|
86
86
|
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
beneficiaryAddress: string;
|
|
@@ -14,4 +14,6 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
|
|
|
14
14
|
slots?: AnySpendSlots;
|
|
15
15
|
content?: AnySpendContent;
|
|
16
16
|
theme?: AnySpendTheme;
|
|
17
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
18
|
+
showFiatOption?: boolean;
|
|
17
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ function generateEncodedDataForStaking(amount, beneficiary) {
|
|
|
14
14
|
args: [beneficiary, BigInt(amount)],
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }) {
|
|
17
|
+
export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
18
18
|
const header = () => (_jsx(_Fragment, { children: _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[60px] w-full" }), _jsx("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: _jsxs("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? formatTokenAmount(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
|
|
19
19
|
// Only generate encoded data if we have a valid beneficiary address
|
|
20
20
|
// This is used for the AnySpendCustom swap & stake flow
|
|
@@ -24,5 +24,5 @@ export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddr
|
|
|
24
24
|
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
|
|
25
25
|
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
26
26
|
action: `stake ${token.symbol}`,
|
|
27
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
27
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, showFiatOption: showFiatOption, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
28
28
|
}
|
|
@@ -609,6 +609,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
609
609
|
actionLabel?: string;
|
|
610
610
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
611
611
|
showChainSelection?: boolean;
|
|
612
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
613
|
+
showFiatOption?: boolean;
|
|
612
614
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
613
615
|
minPoolSize?: number;
|
|
614
616
|
/** Custom title for chain selection step */
|
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -70,6 +70,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
70
70
|
* Force fiat payment
|
|
71
71
|
*/
|
|
72
72
|
forceFiatPayment?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show the "Pay with fiat" tab. Defaults to true.
|
|
75
|
+
*/
|
|
76
|
+
showFiatOption?: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Optional discount code to apply to the purchase.
|
|
75
79
|
* When provided, validates on-chain and adjusts the price accordingly.
|
|
@@ -79,4 +83,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
79
83
|
content?: AnySpendContent;
|
|
80
84
|
theme?: AnySpendTheme;
|
|
81
85
|
}
|
|
82
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, showFiatOption, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,6 +13,8 @@ export declare function AnySpendCustom(props: {
|
|
|
13
13
|
dstToken: components["schemas"]["Token"];
|
|
14
14
|
dstAmount: string;
|
|
15
15
|
forceFiatPayment?: boolean;
|
|
16
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
17
|
+
showFiatOption?: boolean;
|
|
16
18
|
contractAddress: string;
|
|
17
19
|
encodedData: string;
|
|
18
20
|
metadata: any;
|
|
@@ -73,6 +73,8 @@ export interface AnySpendDepositProps {
|
|
|
73
73
|
depositContractConfig?: DepositContractConfig;
|
|
74
74
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
75
75
|
showChainSelection?: boolean;
|
|
76
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
77
|
+
showFiatOption?: boolean;
|
|
76
78
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
77
79
|
supportedChains?: ChainConfig[];
|
|
78
80
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
@@ -148,4 +150,4 @@ export interface AnySpendDepositProps {
|
|
|
148
150
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
149
151
|
* />
|
|
150
152
|
*/
|
|
151
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
153
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
@@ -12,4 +12,6 @@ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftCont
|
|
|
12
12
|
slots?: AnySpendSlots;
|
|
13
13
|
content?: AnySpendContent;
|
|
14
14
|
theme?: AnySpendTheme;
|
|
15
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
16
|
+
showFiatOption?: boolean;
|
|
15
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
beneficiaryAddress: string;
|
|
@@ -14,4 +14,6 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
|
|
|
14
14
|
slots?: AnySpendSlots;
|
|
15
15
|
content?: AnySpendContent;
|
|
16
16
|
theme?: AnySpendTheme;
|
|
17
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
18
|
+
showFiatOption?: boolean;
|
|
17
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -609,6 +609,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
609
609
|
actionLabel?: string;
|
|
610
610
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
611
611
|
showChainSelection?: boolean;
|
|
612
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
613
|
+
showFiatOption?: boolean;
|
|
612
614
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
613
615
|
minPoolSize?: number;
|
|
614
616
|
/** Custom title for chain selection step */
|
package/package.json
CHANGED
|
@@ -148,6 +148,8 @@ export function AnySpend(props: {
|
|
|
148
148
|
theme?: AnySpendTheme;
|
|
149
149
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
150
150
|
kycEnabled?: boolean;
|
|
151
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
152
|
+
showFiatOption?: boolean;
|
|
151
153
|
}) {
|
|
152
154
|
const fingerprintConfig = getFingerprintConfig();
|
|
153
155
|
|
|
@@ -184,6 +186,7 @@ function AnySpendInner({
|
|
|
184
186
|
callbackMetadata,
|
|
185
187
|
senderAddress,
|
|
186
188
|
kycEnabled = false,
|
|
189
|
+
showFiatOption = true,
|
|
187
190
|
}: {
|
|
188
191
|
sourceChainId?: number;
|
|
189
192
|
destinationTokenAddress?: string;
|
|
@@ -211,6 +214,7 @@ function AnySpendInner({
|
|
|
211
214
|
content?: AnySpendContent;
|
|
212
215
|
theme?: AnySpendTheme;
|
|
213
216
|
kycEnabled?: boolean;
|
|
217
|
+
showFiatOption?: boolean;
|
|
214
218
|
}) {
|
|
215
219
|
const { slots, content } = useAnySpendCustomization();
|
|
216
220
|
const searchParams = useSearchParamsSSR();
|
|
@@ -253,6 +257,7 @@ function AnySpendInner({
|
|
|
253
257
|
const previousPanel = useRef<PanelView>(PanelView.MAIN);
|
|
254
258
|
|
|
255
259
|
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(() => {
|
|
260
|
+
if (!showFiatOption) return "crypto";
|
|
256
261
|
if (typeof window !== "undefined") {
|
|
257
262
|
const stored = sessionStorage.getItem("anyspend_active_tab") as "crypto" | "fiat" | null;
|
|
258
263
|
if (stored === "crypto" || stored === "fiat") return stored;
|
|
@@ -261,8 +266,13 @@ function AnySpendInner({
|
|
|
261
266
|
});
|
|
262
267
|
|
|
263
268
|
useEffect(() => {
|
|
269
|
+
if (!showFiatOption && activeTab === "fiat") setActiveTab("crypto");
|
|
270
|
+
}, [showFiatOption, activeTab]);
|
|
271
|
+
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
if (!showFiatOption) return;
|
|
264
274
|
sessionStorage.setItem("anyspend_active_tab", activeTab);
|
|
265
|
-
}, [activeTab]);
|
|
275
|
+
}, [activeTab, showFiatOption]);
|
|
266
276
|
|
|
267
277
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
268
278
|
const [directTransferTxHash, setDirectTransferTxHash] = useState<string | undefined>();
|
|
@@ -1312,17 +1322,19 @@ function AnySpendInner({
|
|
|
1312
1322
|
)}
|
|
1313
1323
|
|
|
1314
1324
|
{/* Tab section */}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
setActiveTab
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1325
|
+
{showFiatOption && (
|
|
1326
|
+
<TabSection
|
|
1327
|
+
activeTab={activeTab}
|
|
1328
|
+
setActiveTab={tab => {
|
|
1329
|
+
setActiveTab(tab);
|
|
1330
|
+
// Reset payment methods when switching tabs
|
|
1331
|
+
resetPaymentMethods();
|
|
1332
|
+
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
1333
|
+
}}
|
|
1334
|
+
setSelectedCryptoPaymentMethod={setSelectedCryptoPaymentMethod}
|
|
1335
|
+
setSelectedFiatPaymentMethod={setSelectedFiatPaymentMethod}
|
|
1336
|
+
/>
|
|
1337
|
+
)}
|
|
1326
1338
|
|
|
1327
1339
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|
|
1328
1340
|
{/* Send section */}
|
|
@@ -119,6 +119,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
119
119
|
* Force fiat payment
|
|
120
120
|
*/
|
|
121
121
|
forceFiatPayment?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to show the "Pay with fiat" tab. Defaults to true.
|
|
124
|
+
*/
|
|
125
|
+
showFiatOption?: boolean;
|
|
122
126
|
/**
|
|
123
127
|
* Optional discount code to apply to the purchase.
|
|
124
128
|
* When provided, validates on-chain and adjusts the price accordingly.
|
|
@@ -146,6 +150,7 @@ export function AnySpendCollectorClubPurchase({
|
|
|
146
150
|
vendingMachineId,
|
|
147
151
|
packType,
|
|
148
152
|
forceFiatPayment,
|
|
153
|
+
showFiatOption = true,
|
|
149
154
|
discountCode,
|
|
150
155
|
slots,
|
|
151
156
|
content,
|
|
@@ -398,6 +403,7 @@ export function AnySpendCollectorClubPurchase({
|
|
|
398
403
|
showRecipient={showRecipient}
|
|
399
404
|
srcFiatAmount={srcFiatAmount}
|
|
400
405
|
forceFiatPayment={forceFiatPayment}
|
|
406
|
+
showFiatOption={showFiatOption}
|
|
401
407
|
slots={slots}
|
|
402
408
|
content={content}
|
|
403
409
|
theme={theme}
|
|
@@ -178,6 +178,8 @@ export function AnySpendCustom(props: {
|
|
|
178
178
|
dstToken: components["schemas"]["Token"];
|
|
179
179
|
dstAmount: string;
|
|
180
180
|
forceFiatPayment?: boolean;
|
|
181
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
182
|
+
showFiatOption?: boolean;
|
|
181
183
|
contractAddress: string;
|
|
182
184
|
encodedData: string;
|
|
183
185
|
metadata: any;
|
|
@@ -232,6 +234,7 @@ function AnySpendCustomInner({
|
|
|
232
234
|
onShowPointsDetail,
|
|
233
235
|
srcFiatAmount: srcFiatAmountProps,
|
|
234
236
|
forceFiatPayment,
|
|
237
|
+
showFiatOption = true,
|
|
235
238
|
senderAddress,
|
|
236
239
|
}: {
|
|
237
240
|
loadOrder?: string;
|
|
@@ -258,6 +261,7 @@ function AnySpendCustomInner({
|
|
|
258
261
|
onShowPointsDetail?: () => void;
|
|
259
262
|
srcFiatAmount?: string;
|
|
260
263
|
forceFiatPayment?: boolean;
|
|
264
|
+
showFiatOption?: boolean;
|
|
261
265
|
senderAddress?: string;
|
|
262
266
|
slots?: AnySpendSlots;
|
|
263
267
|
content?: AnySpendContent;
|
|
@@ -271,7 +275,13 @@ function AnySpendCustomInner({
|
|
|
271
275
|
const [activePanel, setActivePanel] = useState<PanelView>(
|
|
272
276
|
loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER,
|
|
273
277
|
);
|
|
274
|
-
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(
|
|
278
|
+
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(
|
|
279
|
+
!showFiatOption ? "crypto" : forceFiatPayment ? "fiat" : activeTabProps,
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
useEffect(() => {
|
|
283
|
+
if (!showFiatOption && activeTab === "fiat") setActiveTab("crypto");
|
|
284
|
+
}, [showFiatOption, activeTab]);
|
|
275
285
|
|
|
276
286
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
277
287
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
@@ -867,7 +877,7 @@ function AnySpendCustomInner({
|
|
|
867
877
|
onValueChange={value => setActiveTab(value as "crypto" | "fiat")}
|
|
868
878
|
className="bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5"
|
|
869
879
|
>
|
|
870
|
-
{!forceFiatPayment && (
|
|
880
|
+
{!forceFiatPayment && showFiatOption && (
|
|
871
881
|
<div className="w-full">
|
|
872
882
|
<div className="bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl">
|
|
873
883
|
<div
|
|
@@ -95,6 +95,8 @@ export interface AnySpendDepositProps {
|
|
|
95
95
|
depositContractConfig?: DepositContractConfig;
|
|
96
96
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
97
97
|
showChainSelection?: boolean;
|
|
98
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
99
|
+
showFiatOption?: boolean;
|
|
98
100
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
99
101
|
supportedChains?: ChainConfig[];
|
|
100
102
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
@@ -248,6 +250,7 @@ export function AnySpendDeposit({
|
|
|
248
250
|
orderType,
|
|
249
251
|
depositContractConfig,
|
|
250
252
|
showChainSelection,
|
|
253
|
+
showFiatOption = true,
|
|
251
254
|
supportedChains = DEFAULT_SUPPORTED_CHAINS,
|
|
252
255
|
minPoolSize = DEFAULT_MIN_POOL_SIZE,
|
|
253
256
|
topChainsCount = 3,
|
|
@@ -585,39 +588,43 @@ export function AnySpendDeposit({
|
|
|
585
588
|
</button>
|
|
586
589
|
|
|
587
590
|
{/* Fund with Fiat */}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
<div
|
|
596
|
-
className={depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3"}
|
|
591
|
+
{showFiatOption && (
|
|
592
|
+
<button
|
|
593
|
+
onClick={handleSelectFiat}
|
|
594
|
+
className={
|
|
595
|
+
depositClasses?.fiatButton ||
|
|
596
|
+
"anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all"
|
|
597
|
+
}
|
|
597
598
|
>
|
|
598
|
-
<
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
599
|
+
<div
|
|
600
|
+
className={depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3"}
|
|
601
|
+
>
|
|
602
|
+
<CreditCardIcon className={depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10"} />
|
|
603
|
+
<div className={depositClasses?.optionInfo || "anyspend-deposit-option-info"}>
|
|
604
|
+
<span
|
|
605
|
+
className={
|
|
606
|
+
depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium"
|
|
607
|
+
}
|
|
608
|
+
>
|
|
609
|
+
Fund with Fiat
|
|
610
|
+
</span>
|
|
611
|
+
<p
|
|
612
|
+
className={
|
|
613
|
+
depositClasses?.optionDescription ||
|
|
614
|
+
"anyspend-deposit-option-description text-as-secondary text-xs"
|
|
615
|
+
}
|
|
616
|
+
>
|
|
617
|
+
Pay with card or bank transfer
|
|
618
|
+
</p>
|
|
619
|
+
</div>
|
|
615
620
|
</div>
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
+
<ChevronRight
|
|
622
|
+
className={
|
|
623
|
+
depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5"
|
|
624
|
+
}
|
|
625
|
+
/>
|
|
626
|
+
</button>
|
|
627
|
+
)}
|
|
621
628
|
</div>
|
|
622
629
|
|
|
623
630
|
{/* Chain-specific warning */}
|
|
@@ -42,6 +42,7 @@ export function AnySpendNFT({
|
|
|
42
42
|
slots,
|
|
43
43
|
content,
|
|
44
44
|
theme,
|
|
45
|
+
showFiatOption = true,
|
|
45
46
|
}: {
|
|
46
47
|
loadOrder?: string;
|
|
47
48
|
mode?: "modal" | "page";
|
|
@@ -54,6 +55,8 @@ export function AnySpendNFT({
|
|
|
54
55
|
slots?: AnySpendSlots;
|
|
55
56
|
content?: AnySpendContent;
|
|
56
57
|
theme?: AnySpendTheme;
|
|
58
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
59
|
+
showFiatOption?: boolean;
|
|
57
60
|
}) {
|
|
58
61
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
|
|
59
62
|
const hasFetchedRef = useRef(false);
|
|
@@ -164,6 +167,7 @@ export function AnySpendNFT({
|
|
|
164
167
|
loadOrder={loadOrder}
|
|
165
168
|
mode={mode}
|
|
166
169
|
activeTab="fiat"
|
|
170
|
+
showFiatOption={showFiatOption}
|
|
167
171
|
recipientAddress={recipientAddress}
|
|
168
172
|
orderType={"mint_nft"}
|
|
169
173
|
dstChainId={nftContract.chainId}
|
|
@@ -30,6 +30,7 @@ export function AnySpendStakeUpside({
|
|
|
30
30
|
slots,
|
|
31
31
|
content,
|
|
32
32
|
theme,
|
|
33
|
+
showFiatOption = true,
|
|
33
34
|
}: {
|
|
34
35
|
loadOrder?: string;
|
|
35
36
|
mode?: "modal" | "page";
|
|
@@ -44,6 +45,8 @@ export function AnySpendStakeUpside({
|
|
|
44
45
|
slots?: AnySpendSlots;
|
|
45
46
|
content?: AnySpendContent;
|
|
46
47
|
theme?: AnySpendTheme;
|
|
48
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
49
|
+
showFiatOption?: boolean;
|
|
47
50
|
}) {
|
|
48
51
|
const header = () => (
|
|
49
52
|
<>
|
|
@@ -90,6 +93,7 @@ export function AnySpendStakeUpside({
|
|
|
90
93
|
onSuccess={onSuccess}
|
|
91
94
|
showRecipient={true}
|
|
92
95
|
activeTab={activeTab}
|
|
96
|
+
showFiatOption={showFiatOption}
|
|
93
97
|
senderAddress={senderAddress}
|
|
94
98
|
slots={slots}
|
|
95
99
|
content={content}
|
|
@@ -635,6 +635,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
635
635
|
actionLabel?: string;
|
|
636
636
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
637
637
|
showChainSelection?: boolean;
|
|
638
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
639
|
+
showFiatOption?: boolean;
|
|
638
640
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
639
641
|
minPoolSize?: number;
|
|
640
642
|
/** Custom title for chain selection step */
|