@b3dotfun/sdk 0.0.88-alpha.9 → 0.0.89-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- 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 +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +52 -47
- package/src/global-account/react/stores/useModalStore.ts +4 -0
|
@@ -61,5 +61,9 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
61
61
|
* The partner ID
|
|
62
62
|
*/
|
|
63
63
|
packType: string;
|
|
64
|
+
/**
|
|
65
|
+
* Force fiat payment
|
|
66
|
+
*/
|
|
67
|
+
forceFiatPayment?: boolean;
|
|
64
68
|
}
|
|
65
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -48,7 +48,7 @@ const BUY_PACKS_FOR_ABI = {
|
|
|
48
48
|
stateMutability: "nonpayable",
|
|
49
49
|
type: "function",
|
|
50
50
|
};
|
|
51
|
-
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType, }) {
|
|
51
|
+
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
|
|
52
52
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
53
53
|
const totalAmount = (0, react_1.useMemo)(() => {
|
|
54
54
|
try {
|
|
@@ -87,5 +87,5 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
|
|
|
87
87
|
pricePerPack,
|
|
88
88
|
vendingMachineId,
|
|
89
89
|
packType,
|
|
90
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount }));
|
|
90
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment }));
|
|
91
91
|
}
|
|
@@ -146,7 +146,7 @@ function AnySpendCustom(props) {
|
|
|
146
146
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
147
147
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomInner, { ...props }) }));
|
|
148
148
|
}
|
|
149
|
-
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, }) {
|
|
149
|
+
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, }) {
|
|
150
150
|
const hasMounted = (0, react_2.useHasMounted)();
|
|
151
151
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
152
152
|
const router = (0, react_2.useRouter)();
|
|
@@ -545,7 +545,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
545
545
|
return null;
|
|
546
546
|
};
|
|
547
547
|
// Confirm order view.
|
|
548
|
-
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: [(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: () => {
|
|
548
|
+
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: () => {
|
|
549
549
|
setActiveTab("crypto");
|
|
550
550
|
// Reset payment methods when switching tabs
|
|
551
551
|
resetPaymentMethods();
|
|
@@ -555,7 +555,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
555
555
|
// Reset payment methods when switching tabs
|
|
556
556
|
resetPaymentMethods();
|
|
557
557
|
setSelectedFiatPaymentMethod(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
|
|
558
|
-
}, children: "Pay with fiat" })) : ((0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (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", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
558
|
+
}, children: "Pay with fiat" })) : ((0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (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", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) })), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
559
559
|
opacity: hasMounted ? 1 : 0,
|
|
560
560
|
y: hasMounted ? 0 : 20,
|
|
561
561
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -477,6 +477,10 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
477
477
|
vendingMachineId: string;
|
|
478
478
|
/** The pack type */
|
|
479
479
|
packType: string;
|
|
480
|
+
/** Active tab */
|
|
481
|
+
activeTab?: "crypto" | "fiat";
|
|
482
|
+
/** Force fiat payment */
|
|
483
|
+
forceFiatPayment?: boolean;
|
|
480
484
|
}
|
|
481
485
|
/**
|
|
482
486
|
* Union type of all possible modal content types
|
|
@@ -61,5 +61,9 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
61
61
|
* The partner ID
|
|
62
62
|
*/
|
|
63
63
|
packType: string;
|
|
64
|
+
/**
|
|
65
|
+
* Force fiat payment
|
|
66
|
+
*/
|
|
67
|
+
forceFiatPayment?: boolean;
|
|
64
68
|
}
|
|
65
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -45,7 +45,7 @@ const BUY_PACKS_FOR_ABI = {
|
|
|
45
45
|
stateMutability: "nonpayable",
|
|
46
46
|
type: "function",
|
|
47
47
|
};
|
|
48
|
-
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType, }) {
|
|
48
|
+
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
|
|
49
49
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
50
50
|
const totalAmount = useMemo(() => {
|
|
51
51
|
try {
|
|
@@ -84,5 +84,5 @@ export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activ
|
|
|
84
84
|
pricePerPack,
|
|
85
85
|
vendingMachineId,
|
|
86
86
|
packType,
|
|
87
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount }));
|
|
87
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment }));
|
|
88
88
|
}
|
|
@@ -107,7 +107,7 @@ export function AnySpendCustom(props) {
|
|
|
107
107
|
const fingerprintConfig = getFingerprintConfig();
|
|
108
108
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomInner, { ...props }) }));
|
|
109
109
|
}
|
|
110
|
-
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, }) {
|
|
110
|
+
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, forceFiatPayment, }) {
|
|
111
111
|
const hasMounted = useHasMounted();
|
|
112
112
|
const searchParams = useSearchParamsSSR();
|
|
113
113
|
const router = useRouter();
|
|
@@ -506,7 +506,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
506
506
|
return null;
|
|
507
507
|
};
|
|
508
508
|
// Confirm order view.
|
|
509
|
-
const confirmOrderView = (_jsxs("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), _jsxs(Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [_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: () => {
|
|
509
|
+
const confirmOrderView = (_jsxs("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), _jsxs(Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [!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: () => {
|
|
510
510
|
setActiveTab("crypto");
|
|
511
511
|
// Reset payment methods when switching tabs
|
|
512
512
|
resetPaymentMethods();
|
|
@@ -516,7 +516,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
516
516
|
// Reset payment methods when switching tabs
|
|
517
517
|
resetPaymentMethods();
|
|
518
518
|
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
519
|
-
}, children: "Pay with fiat" })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), _jsx(TooltipContent, { children: _jsx("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) }), _jsx(TabsContent, { value: "crypto", children: _jsxs("div", { className: "mt-2 flex flex-col gap-6", children: [_jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [_jsxs(motion.div, { initial: false, animate: {
|
|
519
|
+
}, children: "Pay with fiat" })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), _jsx(TooltipContent, { children: _jsx("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) })), _jsx(TabsContent, { value: "crypto", children: _jsxs("div", { className: "mt-2 flex flex-col gap-6", children: [_jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [_jsxs(motion.div, { initial: false, animate: {
|
|
520
520
|
opacity: hasMounted ? 1 : 0,
|
|
521
521
|
y: hasMounted ? 0 : 20,
|
|
522
522
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -477,6 +477,10 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
477
477
|
vendingMachineId: string;
|
|
478
478
|
/** The pack type */
|
|
479
479
|
packType: string;
|
|
480
|
+
/** Active tab */
|
|
481
|
+
activeTab?: "crypto" | "fiat";
|
|
482
|
+
/** Force fiat payment */
|
|
483
|
+
forceFiatPayment?: boolean;
|
|
480
484
|
}
|
|
481
485
|
/**
|
|
482
486
|
* Union type of all possible modal content types
|
|
@@ -61,5 +61,9 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
61
61
|
* The partner ID
|
|
62
62
|
*/
|
|
63
63
|
packType: string;
|
|
64
|
+
/**
|
|
65
|
+
* Force fiat payment
|
|
66
|
+
*/
|
|
67
|
+
forceFiatPayment?: boolean;
|
|
64
68
|
}
|
|
65
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -477,6 +477,10 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
477
477
|
vendingMachineId: string;
|
|
478
478
|
/** The pack type */
|
|
479
479
|
packType: string;
|
|
480
|
+
/** Active tab */
|
|
481
|
+
activeTab?: "crypto" | "fiat";
|
|
482
|
+
/** Force fiat payment */
|
|
483
|
+
forceFiatPayment?: boolean;
|
|
480
484
|
}
|
|
481
485
|
/**
|
|
482
486
|
* Union type of all possible modal content types
|
package/package.json
CHANGED
|
@@ -109,6 +109,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
109
109
|
* The partner ID
|
|
110
110
|
*/
|
|
111
111
|
packType: string;
|
|
112
|
+
/**
|
|
113
|
+
* Force fiat payment
|
|
114
|
+
*/
|
|
115
|
+
forceFiatPayment?: boolean;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
export function AnySpendCollectorClubPurchase({
|
|
@@ -126,6 +130,7 @@ export function AnySpendCollectorClubPurchase({
|
|
|
126
130
|
showRecipient = true,
|
|
127
131
|
vendingMachineId,
|
|
128
132
|
packType,
|
|
133
|
+
forceFiatPayment,
|
|
129
134
|
}: AnySpendCollectorClubPurchaseProps) {
|
|
130
135
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
131
136
|
const totalAmount = useMemo(() => {
|
|
@@ -193,6 +198,7 @@ export function AnySpendCollectorClubPurchase({
|
|
|
193
198
|
onSuccess={onSuccess}
|
|
194
199
|
showRecipient={showRecipient}
|
|
195
200
|
srcFiatAmount={srcFiatAmount}
|
|
201
|
+
forceFiatPayment={forceFiatPayment}
|
|
196
202
|
/>
|
|
197
203
|
);
|
|
198
204
|
}
|
|
@@ -174,6 +174,7 @@ export function AnySpendCustom(props: {
|
|
|
174
174
|
dstChainId: number;
|
|
175
175
|
dstToken: components["schemas"]["Token"];
|
|
176
176
|
dstAmount: string;
|
|
177
|
+
forceFiatPayment?: boolean;
|
|
177
178
|
contractAddress: string;
|
|
178
179
|
encodedData: string;
|
|
179
180
|
metadata: any;
|
|
@@ -217,6 +218,7 @@ function AnySpendCustomInner({
|
|
|
217
218
|
showRecipient = true,
|
|
218
219
|
onShowPointsDetail,
|
|
219
220
|
srcFiatAmount: srcFiatAmountProps,
|
|
221
|
+
forceFiatPayment,
|
|
220
222
|
}: {
|
|
221
223
|
loadOrder?: string;
|
|
222
224
|
mode?: "modal" | "page";
|
|
@@ -241,6 +243,7 @@ function AnySpendCustomInner({
|
|
|
241
243
|
showRecipient?: boolean;
|
|
242
244
|
onShowPointsDetail?: () => void;
|
|
243
245
|
srcFiatAmount?: string;
|
|
246
|
+
forceFiatPayment?: boolean;
|
|
244
247
|
}) {
|
|
245
248
|
const hasMounted = useHasMounted();
|
|
246
249
|
|
|
@@ -861,65 +864,67 @@ function AnySpendCustomInner({
|
|
|
861
864
|
onValueChange={value => setActiveTab(value as "crypto" | "fiat")}
|
|
862
865
|
className="bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5"
|
|
863
866
|
>
|
|
864
|
-
|
|
865
|
-
<div className="
|
|
866
|
-
<div
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
className={cn(
|
|
876
|
-
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100",
|
|
877
|
-
activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent",
|
|
878
|
-
)}
|
|
879
|
-
onClick={() => {
|
|
880
|
-
setActiveTab("crypto");
|
|
881
|
-
// Reset payment methods when switching tabs
|
|
882
|
-
resetPaymentMethods();
|
|
883
|
-
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
884
|
-
}}
|
|
885
|
-
>
|
|
886
|
-
Pay with crypto
|
|
887
|
-
</button>
|
|
888
|
-
{isOnrampSupported ? (
|
|
867
|
+
{!forceFiatPayment && (
|
|
868
|
+
<div className="w-full">
|
|
869
|
+
<div className="bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl">
|
|
870
|
+
<div
|
|
871
|
+
className={cn(
|
|
872
|
+
"bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100",
|
|
873
|
+
"h-full w-1/2",
|
|
874
|
+
activeTab === "fiat" ? "translate-x-full" : "translate-x-0",
|
|
875
|
+
)}
|
|
876
|
+
style={{ willChange: "transform" }}
|
|
877
|
+
/>
|
|
889
878
|
<button
|
|
890
879
|
className={cn(
|
|
891
880
|
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100",
|
|
892
|
-
activeTab === "
|
|
881
|
+
activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent",
|
|
893
882
|
)}
|
|
894
883
|
onClick={() => {
|
|
895
|
-
setActiveTab("
|
|
884
|
+
setActiveTab("crypto");
|
|
896
885
|
// Reset payment methods when switching tabs
|
|
897
886
|
resetPaymentMethods();
|
|
898
887
|
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
899
888
|
}}
|
|
900
889
|
>
|
|
901
|
-
Pay with
|
|
890
|
+
Pay with crypto
|
|
902
891
|
</button>
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
)
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
892
|
+
{isOnrampSupported ? (
|
|
893
|
+
<button
|
|
894
|
+
className={cn(
|
|
895
|
+
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100",
|
|
896
|
+
activeTab === "fiat" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent",
|
|
897
|
+
)}
|
|
898
|
+
onClick={() => {
|
|
899
|
+
setActiveTab("fiat");
|
|
900
|
+
// Reset payment methods when switching tabs
|
|
901
|
+
resetPaymentMethods();
|
|
902
|
+
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
903
|
+
}}
|
|
904
|
+
>
|
|
905
|
+
Pay with fiat
|
|
906
|
+
</button>
|
|
907
|
+
) : (
|
|
908
|
+
<Tooltip>
|
|
909
|
+
<TooltipTrigger asChild>
|
|
910
|
+
<button
|
|
911
|
+
className={cn(
|
|
912
|
+
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100",
|
|
913
|
+
"text-as-primary/50 cursor-not-allowed bg-transparent",
|
|
914
|
+
)}
|
|
915
|
+
disabled
|
|
916
|
+
>
|
|
917
|
+
Pay with fiat
|
|
918
|
+
</button>
|
|
919
|
+
</TooltipTrigger>
|
|
920
|
+
<TooltipContent>
|
|
921
|
+
<span className="text-as-primary w-[140px]">Fiat payments are not supported for this amount</span>
|
|
922
|
+
</TooltipContent>
|
|
923
|
+
</Tooltip>
|
|
924
|
+
)}
|
|
925
|
+
</div>
|
|
921
926
|
</div>
|
|
922
|
-
|
|
927
|
+
)}
|
|
923
928
|
|
|
924
929
|
{/* Warning */}
|
|
925
930
|
{/* {srcChainId === base.id || dstChainId === base.id || activeTab === "fiat" ? (
|
|
@@ -505,6 +505,10 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
505
505
|
vendingMachineId: string;
|
|
506
506
|
/** The pack type */
|
|
507
507
|
packType: string;
|
|
508
|
+
/** Active tab */
|
|
509
|
+
activeTab?: "crypto" | "fiat";
|
|
510
|
+
/** Force fiat payment */
|
|
511
|
+
forceFiatPayment?: boolean;
|
|
508
512
|
}
|
|
509
513
|
|
|
510
514
|
/**
|