@b3dotfun/sdk 0.0.23-alpha.2 → 0.0.23-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +3 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +2 -2
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +3 -6
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +2 -2
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
- package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useStripeSupport.js +0 -1
- package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +3 -5
- package/src/anyspend/react/components/AnySpendCustom.tsx +5 -3
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +1 -2
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +0 -6
- package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +2 -4
- package/src/anyspend/react/hooks/useStripeSupport.ts +0 -1
|
@@ -301,7 +301,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
301
301
|
setRecipientAddress(recipientAddressFromProps || globalAddress);
|
|
302
302
|
}, [recipientAddressFromProps, globalAddress]);
|
|
303
303
|
// Get geo-based onramp options for fiat payments
|
|
304
|
-
const { geoData, coinbaseAvailablePaymentMethods,
|
|
304
|
+
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(isMainnet, srcAmountOnRamp);
|
|
305
305
|
// Helper function to map payment method to onramp vendor
|
|
306
306
|
const getOnrampVendor = (paymentMethod) => {
|
|
307
307
|
switch (paymentMethod) {
|
|
@@ -309,10 +309,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
309
309
|
return "coinbase";
|
|
310
310
|
case FiatPaymentMethod_1.FiatPaymentMethod.STRIPE:
|
|
311
311
|
// Determine if it's stripe onramp or stripe-web2 based on support
|
|
312
|
-
if (
|
|
313
|
-
return "stripe";
|
|
314
|
-
}
|
|
315
|
-
else if (stripeWeb2Support?.isSupport) {
|
|
312
|
+
if (stripeWeb2Support?.isSupport) {
|
|
316
313
|
return "stripe-web2";
|
|
317
314
|
}
|
|
318
315
|
return undefined;
|
|
@@ -692,7 +689,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
692
689
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || ""; // Use first available payment method ID
|
|
693
690
|
}
|
|
694
691
|
else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
|
|
695
|
-
if (!
|
|
692
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
696
693
|
sonner_1.toast.error("Stripe not available");
|
|
697
694
|
return;
|
|
698
695
|
}
|
|
@@ -224,7 +224,7 @@ function AnySpendCustomInner({ isMainnet = true, loadOrder, mode = "modal", reci
|
|
|
224
224
|
const formattedSrcAmount = srcAmount ? (0, number_1.formatTokenAmount)(srcAmount, srcToken.decimals, 6, false) : null;
|
|
225
225
|
const srcFiatAmount = (0, react_4.useMemo)(() => (activeTab === "fiat" && srcAmount ? (0, number_1.formatUnits)(srcAmount.toString(), constants_1.USDC_BASE.decimals) : "0"), [activeTab, srcAmount]);
|
|
226
226
|
// Get geo data and onramp options (after quote is available)
|
|
227
|
-
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods,
|
|
227
|
+
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(isMainnet, srcFiatAmount);
|
|
228
228
|
(0, react_4.useEffect)(() => {
|
|
229
229
|
if (oat?.data?.order.status === "executed") {
|
|
230
230
|
console.log("Calling onSuccess");
|
|
@@ -384,7 +384,7 @@ function AnySpendCustomInner({ isMainnet = true, loadOrder, mode = "modal", reci
|
|
|
384
384
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || "";
|
|
385
385
|
}
|
|
386
386
|
else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
|
|
387
|
-
if (!
|
|
387
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
388
388
|
sonner_1.toast.error("Stripe not available");
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
@@ -31,7 +31,7 @@ function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
// Load geo-based onramp options like in PanelOnramp
|
|
34
|
-
const { coinbaseAvailablePaymentMethods,
|
|
34
|
+
const { coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = (0, react_1.useGeoOnrampOptions)(isMainnet, srcAmountOnRamp);
|
|
35
35
|
// Generate payment methods based on geo availability (like in PanelOnrampPayment)
|
|
36
36
|
const availablePaymentMethods = [];
|
|
37
37
|
// Add Coinbase Pay if available
|
|
@@ -47,7 +47,7 @@ function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
// Add Stripe if available
|
|
50
|
-
if (
|
|
50
|
+
if (stripeWeb2Support && stripeWeb2Support.isSupport) {
|
|
51
51
|
const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE);
|
|
52
52
|
availablePaymentMethods.push({
|
|
53
53
|
id: FiatPaymentMethod.STRIPE,
|
|
@@ -19,7 +19,7 @@ function PanelOnrampPayment(props) {
|
|
|
19
19
|
}
|
|
20
20
|
function PanelOnrampPaymentInner(props) {
|
|
21
21
|
const { srcAmountOnRamp, recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, } = props;
|
|
22
|
-
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods,
|
|
22
|
+
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = (0, react_1.useGeoOnrampOptions)(isMainnet, srcAmountOnRamp);
|
|
23
23
|
const isLoading = isLoadingGeoOnramp;
|
|
24
24
|
const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOnrampOrder)({
|
|
25
25
|
onSuccess: data => {
|
|
@@ -45,10 +45,6 @@ function PanelOnrampPaymentInner(props) {
|
|
|
45
45
|
sonner_1.toast.error("Onramp options not available");
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (vendor === "stripe" && !isStripeOnrampSupported) {
|
|
49
|
-
sonner_1.toast.error("Stripe onramp not available");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
48
|
if (vendor === "stripe-web2" && !stripeWeb2Support.isSupport) {
|
|
53
49
|
sonner_1.toast.error("Stripe credit card not available");
|
|
54
50
|
return;
|
|
@@ -16,7 +16,7 @@ function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
16
16
|
// Use existing hooks
|
|
17
17
|
const { geoData, loading: isLoadingGeo, error: geoError } = (0, useGetGeo_1.useGetGeo)();
|
|
18
18
|
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = (0, useCoinbaseOnrampOptions_1.useCoinbaseOnrampOptions)(isMainnet, geoData?.country, visitorData);
|
|
19
|
-
const {
|
|
19
|
+
const { stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = (0, useStripeSupport_1.useStripeSupport)(isMainnet, srcFiatAmount, visitorData);
|
|
20
20
|
// Calculate available payment methods based on the amount
|
|
21
21
|
const coinbaseAvailablePaymentMethods = (0, react_1.useMemo)(() => {
|
|
22
22
|
if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
|
|
@@ -34,9 +34,8 @@ function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
34
34
|
geoData,
|
|
35
35
|
coinbaseOnrampOptions,
|
|
36
36
|
coinbaseAvailablePaymentMethods,
|
|
37
|
-
isStripeOnrampSupported,
|
|
38
37
|
stripeWeb2Support,
|
|
39
|
-
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 ||
|
|
38
|
+
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 || stripeWeb2Support,
|
|
40
39
|
isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport || isLoadingVisitorData,
|
|
41
40
|
isLoadingGeo,
|
|
42
41
|
isLoadingCoinbaseOnrampOptions,
|
|
@@ -48,7 +47,6 @@ function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
48
47
|
geoData,
|
|
49
48
|
coinbaseOnrampOptions,
|
|
50
49
|
coinbaseAvailablePaymentMethods,
|
|
51
|
-
isStripeOnrampSupported,
|
|
52
50
|
stripeWeb2Support,
|
|
53
51
|
isLoadingGeo,
|
|
54
52
|
isLoadingCoinbaseOnrampOptions,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
2
|
export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
3
|
-
isStripeOnrampSupported: boolean;
|
|
4
3
|
stripeWeb2Support: {
|
|
5
4
|
isSupport: false;
|
|
6
5
|
} | {
|
|
@@ -11,7 +11,6 @@ function useStripeSupport(isMainnet, usdAmount, visitorData, isLoadingVisitorDat
|
|
|
11
11
|
enabled: !isLoadingVisitorData,
|
|
12
12
|
});
|
|
13
13
|
return (0, react_1.useMemo)(() => ({
|
|
14
|
-
isStripeOnrampSupported: data?.stripeOnramp || false,
|
|
15
14
|
stripeWeb2Support: data?.stripeWeb2 || { isSupport: false },
|
|
16
15
|
isLoadingStripeSupport: isLoading,
|
|
17
16
|
stripeSupportError: error,
|
|
@@ -294,7 +294,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
294
294
|
setRecipientAddress(recipientAddressFromProps || globalAddress);
|
|
295
295
|
}, [recipientAddressFromProps, globalAddress]);
|
|
296
296
|
// Get geo-based onramp options for fiat payments
|
|
297
|
-
const { geoData, coinbaseAvailablePaymentMethods,
|
|
297
|
+
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(isMainnet, srcAmountOnRamp);
|
|
298
298
|
// Helper function to map payment method to onramp vendor
|
|
299
299
|
const getOnrampVendor = (paymentMethod) => {
|
|
300
300
|
switch (paymentMethod) {
|
|
@@ -302,10 +302,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
302
302
|
return "coinbase";
|
|
303
303
|
case FiatPaymentMethod.STRIPE:
|
|
304
304
|
// Determine if it's stripe onramp or stripe-web2 based on support
|
|
305
|
-
if (
|
|
306
|
-
return "stripe";
|
|
307
|
-
}
|
|
308
|
-
else if (stripeWeb2Support?.isSupport) {
|
|
305
|
+
if (stripeWeb2Support?.isSupport) {
|
|
309
306
|
return "stripe-web2";
|
|
310
307
|
}
|
|
311
308
|
return undefined;
|
|
@@ -685,7 +682,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
|
|
|
685
682
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || ""; // Use first available payment method ID
|
|
686
683
|
}
|
|
687
684
|
else if (paymentMethod === FiatPaymentMethod.STRIPE) {
|
|
688
|
-
if (!
|
|
685
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
689
686
|
toast.error("Stripe not available");
|
|
690
687
|
return;
|
|
691
688
|
}
|
|
@@ -218,7 +218,7 @@ function AnySpendCustomInner({ isMainnet = true, loadOrder, mode = "modal", reci
|
|
|
218
218
|
const formattedSrcAmount = srcAmount ? formatTokenAmount(srcAmount, srcToken.decimals, 6, false) : null;
|
|
219
219
|
const srcFiatAmount = useMemo(() => (activeTab === "fiat" && srcAmount ? formatUnits(srcAmount.toString(), USDC_BASE.decimals) : "0"), [activeTab, srcAmount]);
|
|
220
220
|
// Get geo data and onramp options (after quote is available)
|
|
221
|
-
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods,
|
|
221
|
+
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(isMainnet, srcFiatAmount);
|
|
222
222
|
useEffect(() => {
|
|
223
223
|
if (oat?.data?.order.status === "executed") {
|
|
224
224
|
console.log("Calling onSuccess");
|
|
@@ -378,7 +378,7 @@ function AnySpendCustomInner({ isMainnet = true, loadOrder, mode = "modal", reci
|
|
|
378
378
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || "";
|
|
379
379
|
}
|
|
380
380
|
else if (paymentMethod === FiatPaymentMethod.STRIPE) {
|
|
381
|
-
if (!
|
|
381
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
382
382
|
toast.error("Stripe not available");
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
@@ -27,7 +27,7 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
// Load geo-based onramp options like in PanelOnramp
|
|
30
|
-
const { coinbaseAvailablePaymentMethods,
|
|
30
|
+
const { coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(isMainnet, srcAmountOnRamp);
|
|
31
31
|
// Generate payment methods based on geo availability (like in PanelOnrampPayment)
|
|
32
32
|
const availablePaymentMethods = [];
|
|
33
33
|
// Add Coinbase Pay if available
|
|
@@ -43,7 +43,7 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
// Add Stripe if available
|
|
46
|
-
if (
|
|
46
|
+
if (stripeWeb2Support && stripeWeb2Support.isSupport) {
|
|
47
47
|
const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE);
|
|
48
48
|
availablePaymentMethods.push({
|
|
49
49
|
id: FiatPaymentMethod.STRIPE,
|
|
@@ -13,7 +13,7 @@ export function PanelOnrampPayment(props) {
|
|
|
13
13
|
}
|
|
14
14
|
function PanelOnrampPaymentInner(props) {
|
|
15
15
|
const { srcAmountOnRamp, recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, } = props;
|
|
16
|
-
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods,
|
|
16
|
+
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(isMainnet, srcAmountOnRamp);
|
|
17
17
|
const isLoading = isLoadingGeoOnramp;
|
|
18
18
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
19
19
|
onSuccess: data => {
|
|
@@ -39,10 +39,6 @@ function PanelOnrampPaymentInner(props) {
|
|
|
39
39
|
toast.error("Onramp options not available");
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (vendor === "stripe" && !isStripeOnrampSupported) {
|
|
43
|
-
toast.error("Stripe onramp not available");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
42
|
if (vendor === "stripe-web2" && !stripeWeb2Support.isSupport) {
|
|
47
43
|
toast.error("Stripe credit card not available");
|
|
48
44
|
return;
|
|
@@ -13,7 +13,7 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
13
13
|
// Use existing hooks
|
|
14
14
|
const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
|
|
15
15
|
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(isMainnet, geoData?.country, visitorData);
|
|
16
|
-
const {
|
|
16
|
+
const { stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(isMainnet, srcFiatAmount, visitorData);
|
|
17
17
|
// Calculate available payment methods based on the amount
|
|
18
18
|
const coinbaseAvailablePaymentMethods = useMemo(() => {
|
|
19
19
|
if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
|
|
@@ -31,9 +31,8 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
31
31
|
geoData,
|
|
32
32
|
coinbaseOnrampOptions,
|
|
33
33
|
coinbaseAvailablePaymentMethods,
|
|
34
|
-
isStripeOnrampSupported,
|
|
35
34
|
stripeWeb2Support,
|
|
36
|
-
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 ||
|
|
35
|
+
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 || stripeWeb2Support,
|
|
37
36
|
isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport || isLoadingVisitorData,
|
|
38
37
|
isLoadingGeo,
|
|
39
38
|
isLoadingCoinbaseOnrampOptions,
|
|
@@ -45,7 +44,6 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
45
44
|
geoData,
|
|
46
45
|
coinbaseOnrampOptions,
|
|
47
46
|
coinbaseAvailablePaymentMethods,
|
|
48
|
-
isStripeOnrampSupported,
|
|
49
47
|
stripeWeb2Support,
|
|
50
48
|
isLoadingGeo,
|
|
51
49
|
isLoadingCoinbaseOnrampOptions,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
2
|
export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
3
|
-
isStripeOnrampSupported: boolean;
|
|
4
3
|
stripeWeb2Support: {
|
|
5
4
|
isSupport: false;
|
|
6
5
|
} | {
|
|
@@ -8,7 +8,6 @@ export function useStripeSupport(isMainnet, usdAmount, visitorData, isLoadingVis
|
|
|
8
8
|
enabled: !isLoadingVisitorData,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
11
|
-
isStripeOnrampSupported: data?.stripeOnramp || false,
|
|
12
11
|
stripeWeb2Support: data?.stripeWeb2 || { isSupport: false },
|
|
13
12
|
isLoadingStripeSupport: isLoading,
|
|
14
13
|
stripeSupportError: error,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
2
2
|
export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
3
|
-
isStripeOnrampSupported: boolean;
|
|
4
3
|
stripeWeb2Support: {
|
|
5
4
|
isSupport: false;
|
|
6
5
|
} | {
|
package/package.json
CHANGED
|
@@ -415,7 +415,7 @@ function AnySpendInner({
|
|
|
415
415
|
}, [recipientAddressFromProps, globalAddress]);
|
|
416
416
|
|
|
417
417
|
// Get geo-based onramp options for fiat payments
|
|
418
|
-
const { geoData, coinbaseAvailablePaymentMethods,
|
|
418
|
+
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(
|
|
419
419
|
isMainnet,
|
|
420
420
|
srcAmountOnRamp,
|
|
421
421
|
);
|
|
@@ -427,9 +427,7 @@ function AnySpendInner({
|
|
|
427
427
|
return "coinbase";
|
|
428
428
|
case FiatPaymentMethod.STRIPE:
|
|
429
429
|
// Determine if it's stripe onramp or stripe-web2 based on support
|
|
430
|
-
if (
|
|
431
|
-
return "stripe";
|
|
432
|
-
} else if (stripeWeb2Support?.isSupport) {
|
|
430
|
+
if (stripeWeb2Support?.isSupport) {
|
|
433
431
|
return "stripe-web2";
|
|
434
432
|
}
|
|
435
433
|
return undefined;
|
|
@@ -844,7 +842,7 @@ function AnySpendInner({
|
|
|
844
842
|
vendor = "coinbase";
|
|
845
843
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || ""; // Use first available payment method ID
|
|
846
844
|
} else if (paymentMethod === FiatPaymentMethod.STRIPE) {
|
|
847
|
-
if (!
|
|
845
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
848
846
|
toast.error("Stripe not available");
|
|
849
847
|
return;
|
|
850
848
|
}
|
|
@@ -371,8 +371,10 @@ function AnySpendCustomInner({
|
|
|
371
371
|
);
|
|
372
372
|
|
|
373
373
|
// Get geo data and onramp options (after quote is available)
|
|
374
|
-
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods,
|
|
375
|
-
|
|
374
|
+
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(
|
|
375
|
+
isMainnet,
|
|
376
|
+
srcFiatAmount,
|
|
377
|
+
);
|
|
376
378
|
|
|
377
379
|
useEffect(() => {
|
|
378
380
|
if (oat?.data?.order.status === "executed") {
|
|
@@ -556,7 +558,7 @@ function AnySpendCustomInner({
|
|
|
556
558
|
vendor = "coinbase";
|
|
557
559
|
paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || "";
|
|
558
560
|
} else if (paymentMethod === FiatPaymentMethod.STRIPE) {
|
|
559
|
-
if (!
|
|
561
|
+
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
560
562
|
toast.error("Stripe not available");
|
|
561
563
|
return;
|
|
562
564
|
}
|
|
@@ -47,7 +47,6 @@ export function FiatPaymentMethodComponent({
|
|
|
47
47
|
// Load geo-based onramp options like in PanelOnramp
|
|
48
48
|
const {
|
|
49
49
|
coinbaseAvailablePaymentMethods,
|
|
50
|
-
isStripeOnrampSupported,
|
|
51
50
|
stripeWeb2Support,
|
|
52
51
|
isLoading: isLoadingGeoOnramp,
|
|
53
52
|
} = useGeoOnrampOptions(isMainnet, srcAmountOnRamp);
|
|
@@ -69,7 +68,7 @@ export function FiatPaymentMethodComponent({
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// Add Stripe if available
|
|
72
|
-
if (
|
|
71
|
+
if (stripeWeb2Support && stripeWeb2Support.isSupport) {
|
|
73
72
|
const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE);
|
|
74
73
|
availablePaymentMethods.push({
|
|
75
74
|
id: FiatPaymentMethod.STRIPE,
|
|
@@ -67,7 +67,6 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
67
67
|
geoData,
|
|
68
68
|
coinbaseOnrampOptions,
|
|
69
69
|
coinbaseAvailablePaymentMethods,
|
|
70
|
-
isStripeOnrampSupported,
|
|
71
70
|
stripeWeb2Support,
|
|
72
71
|
isLoading: isLoadingGeoOnramp,
|
|
73
72
|
} = useGeoOnrampOptions(isMainnet, srcAmountOnRamp);
|
|
@@ -105,11 +104,6 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
if (vendor === "stripe" && !isStripeOnrampSupported) {
|
|
109
|
-
toast.error("Stripe onramp not available");
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
107
|
if (vendor === "stripe-web2" && !stripeWeb2Support.isSupport) {
|
|
114
108
|
toast.error("Stripe credit card not available");
|
|
115
109
|
return;
|
|
@@ -20,7 +20,7 @@ export function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: string) {
|
|
|
20
20
|
const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
|
|
21
21
|
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } =
|
|
22
22
|
useCoinbaseOnrampOptions(isMainnet, geoData?.country, visitorData);
|
|
23
|
-
const {
|
|
23
|
+
const { stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(
|
|
24
24
|
isMainnet,
|
|
25
25
|
srcFiatAmount,
|
|
26
26
|
visitorData,
|
|
@@ -44,9 +44,8 @@ export function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: string) {
|
|
|
44
44
|
geoData,
|
|
45
45
|
coinbaseOnrampOptions,
|
|
46
46
|
coinbaseAvailablePaymentMethods,
|
|
47
|
-
isStripeOnrampSupported,
|
|
48
47
|
stripeWeb2Support,
|
|
49
|
-
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 ||
|
|
48
|
+
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 || stripeWeb2Support,
|
|
50
49
|
isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport || isLoadingVisitorData,
|
|
51
50
|
isLoadingGeo,
|
|
52
51
|
isLoadingCoinbaseOnrampOptions,
|
|
@@ -59,7 +58,6 @@ export function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: string) {
|
|
|
59
58
|
geoData,
|
|
60
59
|
coinbaseOnrampOptions,
|
|
61
60
|
coinbaseAvailablePaymentMethods,
|
|
62
|
-
isStripeOnrampSupported,
|
|
63
61
|
stripeWeb2Support,
|
|
64
62
|
isLoadingGeo,
|
|
65
63
|
isLoadingCoinbaseOnrampOptions,
|