@b3dotfun/sdk 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +66 -15
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +185 -50
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/cjs/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/cjs/anyspend/react/components/types/classes.js +6 -0
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +119 -15
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.js +46 -0
- package/dist/cjs/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +12 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +17 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -152
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +14 -31
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +68 -17
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +189 -54
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/esm/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/esm/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/esm/anyspend/react/components/types/classes.js +5 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +119 -16
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.js +43 -0
- package/dist/esm/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/esm/anyspend/utils/format.js +12 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +16 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -153
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.js +14 -31
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/types/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +8 -19
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +164 -36
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +11 -6
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +278 -69
- package/src/anyspend/react/components/AnySpendDeposit.tsx +176 -52
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/QRDeposit.tsx +91 -35
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +31 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -4
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +43 -23
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +53 -32
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +26 -13
- package/src/anyspend/react/components/common/OrderDetails.tsx +20 -9
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +12 -7
- package/src/anyspend/react/components/common/OrderHistory.tsx +2 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -1
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +118 -40
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +28 -14
- package/src/anyspend/react/components/common/RecipientSelection.tsx +20 -5
- package/src/anyspend/react/components/common/TabSection.tsx +21 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +12 -4
- package/src/anyspend/react/components/common/WarningText.tsx +10 -10
- package/src/anyspend/react/components/index.ts +16 -0
- package/src/anyspend/react/components/types/classes.ts +476 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +141 -17
- package/src/anyspend/react/hooks/useDirectTransfer.ts +67 -0
- package/src/anyspend/react/hooks/useRecipientAddressState.ts +1 -1
- package/src/anyspend/utils/format.ts +13 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -5
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -4
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -11
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +33 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +27 -184
- package/src/global-account/react/components/index.ts +0 -3
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +14 -31
- package/src/global-account/react/hooks/useTWAuth.tsx +3 -5
- package/src/global-account/react/stores/useModalStore.ts +7 -20
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +0 -86
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +0 -142
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +0 -83
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +0 -136
- package/dist/types/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/types/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +0 -243
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +0 -171
|
@@ -12,6 +12,7 @@ import { motion } from "motion/react";
|
|
|
12
12
|
import { memo, useState } from "react";
|
|
13
13
|
|
|
14
14
|
import { b3 } from "viem/chains";
|
|
15
|
+
import type { OrderDetailsCollapsibleClasses } from "../types/classes";
|
|
15
16
|
|
|
16
17
|
type Order = components["schemas"]["Order"];
|
|
17
18
|
type Token = components["schemas"]["Token"];
|
|
@@ -31,6 +32,7 @@ interface OrderDetailsCollapsibleProps {
|
|
|
31
32
|
points?: number;
|
|
32
33
|
isOpen?: boolean;
|
|
33
34
|
onOpenChange?: (isOpen: boolean) => void;
|
|
35
|
+
classes?: OrderDetailsCollapsibleClasses;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
@@ -46,6 +48,7 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
46
48
|
points,
|
|
47
49
|
isOpen,
|
|
48
50
|
onOpenChange,
|
|
51
|
+
classes,
|
|
49
52
|
}: OrderDetailsCollapsibleProps) {
|
|
50
53
|
const [internalOpen, setInternalOpen] = useState(true);
|
|
51
54
|
|
|
@@ -54,14 +57,13 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
54
57
|
const setShowOrderDetails = onOpenChange || setInternalOpen;
|
|
55
58
|
|
|
56
59
|
// Calculate expected amount if not provided
|
|
60
|
+
// For custom orders, use payload.amount as the expected destination amount
|
|
57
61
|
const expectedDstAmount =
|
|
58
|
-
order.type === "mint_nft" ||
|
|
59
|
-
order.type === "join_tournament" ||
|
|
60
|
-
order.type === "fund_tournament" ||
|
|
61
|
-
order.type === "custom" ||
|
|
62
|
-
order.type === "deposit_first"
|
|
62
|
+
order.type === "mint_nft" || order.type === "join_tournament" || order.type === "fund_tournament"
|
|
63
63
|
? "0"
|
|
64
|
-
: order.
|
|
64
|
+
: order.type === "custom" || order.type === "deposit_first"
|
|
65
|
+
? order.payload.amount?.toString() || "0"
|
|
66
|
+
: order.payload.expectedDstAmount.toString();
|
|
65
67
|
|
|
66
68
|
const finalFormattedExpectedDstAmount =
|
|
67
69
|
formattedExpectedDstAmount || formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
@@ -69,7 +71,8 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
69
71
|
return (
|
|
70
72
|
<div
|
|
71
73
|
className={cn(
|
|
72
|
-
|
|
74
|
+
classes?.container ||
|
|
75
|
+
"order-details-collapsible bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2",
|
|
73
76
|
className,
|
|
74
77
|
)}
|
|
75
78
|
>
|
|
@@ -145,6 +148,8 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
145
148
|
{formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals)} HYPE
|
|
146
149
|
</div>
|
|
147
150
|
</div>
|
|
151
|
+
) : order.type === "custom" || order.type === "custom_exact_in" ? (
|
|
152
|
+
<span className="order-details-amount-text">{`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`}</span>
|
|
148
153
|
) : null}
|
|
149
154
|
|
|
150
155
|
<div className="order-details-chain-info text-as-primary/50 flex items-center gap-2">
|
|
@@ -13,7 +13,8 @@ interface OrderHistoryProps {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function OrderHistory({ mode, onBack, onSelectOrder }: OrderHistoryProps) {
|
|
16
|
-
const { address } = useAccountWallet();
|
|
16
|
+
const { connectedEOAWallet, address: smartWalletAddress } = useAccountWallet();
|
|
17
|
+
const address = connectedEOAWallet?.getAccount()?.address || smartWalletAddress;
|
|
17
18
|
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(address);
|
|
18
19
|
|
|
19
20
|
return (
|
|
@@ -11,6 +11,7 @@ import { useRef } from "react";
|
|
|
11
11
|
import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
12
12
|
import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat";
|
|
13
13
|
import { PointsBadge } from "./PointsBadge";
|
|
14
|
+
import type { PanelOnrampClasses } from "../types/classes";
|
|
14
15
|
|
|
15
16
|
const ONE_CHAR_WIDTH = 30;
|
|
16
17
|
|
|
@@ -34,6 +35,7 @@ export function PanelOnramp({
|
|
|
34
35
|
onShowFeeDetail,
|
|
35
36
|
customUsdInputValues = ["5", "10", "20", "25"],
|
|
36
37
|
customRecipientLabel,
|
|
38
|
+
classes,
|
|
37
39
|
}: {
|
|
38
40
|
srcAmountOnRamp: string;
|
|
39
41
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
@@ -55,6 +57,7 @@ export function PanelOnramp({
|
|
|
55
57
|
customUsdInputValues?: string[];
|
|
56
58
|
/** Custom label for recipient display (overrides recipientName) */
|
|
57
59
|
customRecipientLabel?: string;
|
|
60
|
+
classes?: PanelOnrampClasses;
|
|
58
61
|
}) {
|
|
59
62
|
// Helper function to get fees from anyspend quote
|
|
60
63
|
const getFeeFromApi = (paymentMethod: FiatPaymentMethod): number | null => {
|
|
@@ -135,7 +138,7 @@ export function PanelOnramp({
|
|
|
135
138
|
};
|
|
136
139
|
|
|
137
140
|
return (
|
|
138
|
-
<div className="panel-onramp bg-as-surface-primary flex w-full flex-col">
|
|
141
|
+
<div className={classes?.container || "panel-onramp bg-as-surface-primary flex w-full flex-col"}>
|
|
139
142
|
{/* Pay Section */}
|
|
140
143
|
<div className="border-as-border-secondary bg-as-surface-secondary relative flex w-full flex-col rounded-2xl border p-4">
|
|
141
144
|
<div className="flex h-7 w-full items-center justify-between">
|
|
@@ -8,6 +8,7 @@ import { ChevronLeft, ChevronRight, Landmark, Loader2 } from "lucide-react";
|
|
|
8
8
|
import { motion } from "motion/react";
|
|
9
9
|
|
|
10
10
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper";
|
|
11
|
+
import type { PanelOnrampPaymentClasses } from "../types/classes";
|
|
11
12
|
|
|
12
13
|
interface PanelOnrampPaymentProps {
|
|
13
14
|
srcAmountOnRamp: string;
|
|
@@ -28,6 +29,7 @@ interface PanelOnrampPaymentProps {
|
|
|
28
29
|
payload?: any;
|
|
29
30
|
recipientEnsName?: string;
|
|
30
31
|
recipientImageUrl?: string;
|
|
32
|
+
classes?: PanelOnrampPaymentClasses;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export function PanelOnrampPayment(props: PanelOnrampPaymentProps) {
|
|
@@ -59,6 +61,7 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
59
61
|
payload,
|
|
60
62
|
recipientEnsName,
|
|
61
63
|
recipientImageUrl,
|
|
64
|
+
classes,
|
|
62
65
|
} = props;
|
|
63
66
|
|
|
64
67
|
const {
|
|
@@ -151,11 +154,16 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
151
154
|
};
|
|
152
155
|
|
|
153
156
|
return (
|
|
154
|
-
<div className="mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5 pt-5">
|
|
157
|
+
<div className={classes?.container || "mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5 pt-5"}>
|
|
155
158
|
{/* Order Summary Section */}
|
|
156
159
|
<>
|
|
157
|
-
<h2 className="-mb-3 text-lg font-semibold">Order summary</h2>
|
|
158
|
-
<div
|
|
160
|
+
<h2 className={classes?.summaryTitle || "-mb-3 text-lg font-semibold"}>Order summary</h2>
|
|
161
|
+
<div
|
|
162
|
+
className={
|
|
163
|
+
classes?.summaryCard ||
|
|
164
|
+
"bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4"
|
|
165
|
+
}
|
|
166
|
+
>
|
|
159
167
|
{/* Recipient Section */}
|
|
160
168
|
{recipientAddress && (
|
|
161
169
|
<motion.div
|
|
@@ -166,9 +174,9 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
166
174
|
filter: "blur(0px)",
|
|
167
175
|
}}
|
|
168
176
|
transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
|
|
169
|
-
className="flex items-center justify-between"
|
|
177
|
+
className={classes?.summaryRow || "flex items-center justify-between"}
|
|
170
178
|
>
|
|
171
|
-
<p className="text-b3-react-foreground/60">
|
|
179
|
+
<p className={classes?.summaryLabel || "text-b3-react-foreground/60"}>
|
|
172
180
|
{orderType === "swap"
|
|
173
181
|
? "Recipient"
|
|
174
182
|
: orderType === "mint_nft"
|
|
@@ -186,18 +194,25 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
186
194
|
/>
|
|
187
195
|
)}
|
|
188
196
|
<div className="flex flex-col items-end gap-1">
|
|
189
|
-
{recipientEnsName &&
|
|
190
|
-
|
|
197
|
+
{recipientEnsName && (
|
|
198
|
+
<span className={classes?.summaryValue || "text-b3-react-foreground/80"}>@{recipientEnsName}</span>
|
|
199
|
+
)}
|
|
200
|
+
<span className={classes?.summaryValue || "text-b3-react-foreground/80"}>
|
|
201
|
+
{centerTruncate(recipientAddress)}
|
|
202
|
+
</span>
|
|
191
203
|
</div>
|
|
192
204
|
</div>
|
|
193
205
|
</motion.div>
|
|
194
206
|
)}
|
|
195
|
-
<div className="border-b3-react-border border-t pt-3">
|
|
196
|
-
<div className="flex items-center justify-between">
|
|
197
|
-
<p className="text-b3-react-foreground font-semibold">Amount</p>
|
|
207
|
+
<div className={classes?.summaryDivider || "border-b3-react-border border-t pt-3"}>
|
|
208
|
+
<div className={classes?.amountRow || "flex items-center justify-between"}>
|
|
209
|
+
<p className={classes?.summaryLabel || "text-b3-react-foreground font-semibold"}>Amount</p>
|
|
198
210
|
<div className="flex flex-col items-end gap-0.5">
|
|
199
211
|
<p
|
|
200
|
-
className=
|
|
212
|
+
className={
|
|
213
|
+
classes?.amountValue ||
|
|
214
|
+
"text-b3-react-foreground hover:text-b3-react-foreground/80 cursor-pointer text-xl font-semibold transition-colors"
|
|
215
|
+
}
|
|
201
216
|
onClick={onBack}
|
|
202
217
|
>
|
|
203
218
|
${parseFloat(srcAmountOnRamp).toFixed(2)}
|
|
@@ -221,19 +236,29 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
221
236
|
</>
|
|
222
237
|
|
|
223
238
|
{isCreatingOrder ? (
|
|
224
|
-
<div
|
|
225
|
-
|
|
226
|
-
|
|
239
|
+
<div
|
|
240
|
+
className={
|
|
241
|
+
classes?.loadingContainer ||
|
|
242
|
+
"bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6"
|
|
243
|
+
}
|
|
244
|
+
>
|
|
245
|
+
<Loader2 className={classes?.loadingSpinner || "h-4 w-4 animate-spin"} />
|
|
246
|
+
<span className={classes?.loadingText || "text-as-primary/70"}>Creating onramp order...</span>
|
|
227
247
|
</div>
|
|
228
248
|
) : isLoading ? (
|
|
229
|
-
<div
|
|
230
|
-
|
|
231
|
-
|
|
249
|
+
<div
|
|
250
|
+
className={
|
|
251
|
+
classes?.loadingContainer ||
|
|
252
|
+
"bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6"
|
|
253
|
+
}
|
|
254
|
+
>
|
|
255
|
+
<Loader2 className={classes?.loadingSpinner || "h-4 w-4 animate-spin"} />
|
|
256
|
+
<span className={classes?.loadingText || "text-as-primary/70"}>Loading payment options...</span>
|
|
232
257
|
</div>
|
|
233
258
|
) : (
|
|
234
259
|
<>
|
|
235
260
|
<div className="mb-3 flex items-center justify-between">
|
|
236
|
-
<h2 className="text-lg font-semibold">Payment method</h2>
|
|
261
|
+
<h2 className={classes?.paymentMethodTitle || "text-lg font-semibold"}>Payment method</h2>
|
|
237
262
|
<div className="flex items-center gap-1">
|
|
238
263
|
{coinbaseAvailablePaymentMethods.length > 0 &&
|
|
239
264
|
(() => {
|
|
@@ -290,26 +315,43 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
290
315
|
<button
|
|
291
316
|
onClick={() => handlePaymentMethodClick("coinbase", method.id)}
|
|
292
317
|
disabled={isCreatingOrder}
|
|
293
|
-
className=
|
|
318
|
+
className={
|
|
319
|
+
classes?.paymentOption ||
|
|
320
|
+
"bg-b3-react-background border-b3-react-border hover:border-as-brand disabled:hover:border-b3-react-border group flex w-full items-center justify-between gap-4 rounded-xl border p-5 transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50"
|
|
321
|
+
}
|
|
294
322
|
>
|
|
295
|
-
<div className="flex items-center gap-4">
|
|
296
|
-
<div
|
|
323
|
+
<div className={classes?.paymentOptionContent || "flex items-center gap-4"}>
|
|
324
|
+
<div
|
|
325
|
+
className={
|
|
326
|
+
classes?.paymentOptionIcon ||
|
|
327
|
+
"flex h-12 w-12 items-center justify-center rounded-full bg-blue-50"
|
|
328
|
+
}
|
|
329
|
+
>
|
|
297
330
|
<img src="https://cdn.b3.fun/coinbase-wordmark-blue.svg" alt="Coinbase" className="h-6" />
|
|
298
331
|
</div>
|
|
299
332
|
<div className="flex flex-col items-start text-left">
|
|
300
|
-
<h4 className="text-b3-react-foreground text-lg font-semibold">
|
|
301
|
-
|
|
333
|
+
<h4 className={classes?.paymentOptionTitle || "text-b3-react-foreground text-lg font-semibold"}>
|
|
334
|
+
Coinbase Pay
|
|
335
|
+
</h4>
|
|
336
|
+
<p className={classes?.paymentOptionDescription || "text-b3-react-foreground/60 text-sm"}>
|
|
302
337
|
{method.id === "CARD" && "Debit card, bank account, or Coinbase Account"}
|
|
303
338
|
{method.id === "FIAT_WALLET" && "Pay with your Coinbase account balance"}
|
|
304
339
|
{method.id === "APPLE_PAY" && "Quick payment with Apple Pay"}
|
|
305
340
|
{method.id === "ACH_BANK_ACCOUNT" && "Direct bank account transfer"}
|
|
306
341
|
</p>
|
|
307
342
|
<div className="mt-1 flex items-center gap-1">
|
|
308
|
-
<span className="text-xs font-medium text-green-600">
|
|
343
|
+
<span className={classes?.paymentOptionFee || "text-xs font-medium text-green-600"}>
|
|
344
|
+
Free
|
|
345
|
+
</span>
|
|
309
346
|
</div>
|
|
310
347
|
</div>
|
|
311
348
|
</div>
|
|
312
|
-
<ChevronRight
|
|
349
|
+
<ChevronRight
|
|
350
|
+
className={
|
|
351
|
+
classes?.paymentOptionChevron ||
|
|
352
|
+
"text-b3-react-foreground/40 group-hover:text-b3-react-foreground/60 h-5 w-5 transition-colors"
|
|
353
|
+
}
|
|
354
|
+
/>
|
|
313
355
|
</button>
|
|
314
356
|
);
|
|
315
357
|
})()}
|
|
@@ -318,10 +360,18 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
318
360
|
{stripeOnrampSupport && (
|
|
319
361
|
<button
|
|
320
362
|
onClick={() => handlePaymentMethodClick("stripe")}
|
|
321
|
-
className=
|
|
363
|
+
className={
|
|
364
|
+
classes?.paymentOption ||
|
|
365
|
+
"bg-b3-react-background border-b3-react-border hover:border-as-brand group flex w-full items-center justify-between gap-4 rounded-xl border p-5 transition-all duration-200 hover:shadow-md"
|
|
366
|
+
}
|
|
322
367
|
>
|
|
323
|
-
<div className="flex items-center gap-4">
|
|
324
|
-
<div
|
|
368
|
+
<div className={classes?.paymentOptionContent || "flex items-center gap-4"}>
|
|
369
|
+
<div
|
|
370
|
+
className={
|
|
371
|
+
classes?.paymentOptionIcon ||
|
|
372
|
+
"flex h-12 w-12 items-center justify-center rounded-full bg-purple-50"
|
|
373
|
+
}
|
|
374
|
+
>
|
|
325
375
|
<img
|
|
326
376
|
src="https://raw.githubusercontent.com/stripe/stripe.github.io/455f506a628dc3f6c505e3001db45a64e29e9fc3/images/stripe-logo.svg"
|
|
327
377
|
alt="Stripe"
|
|
@@ -329,18 +379,27 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
329
379
|
/>
|
|
330
380
|
</div>
|
|
331
381
|
<div className="flex flex-col items-start text-left">
|
|
332
|
-
<h4 className="text-b3-react-foreground text-lg font-semibold">
|
|
333
|
-
|
|
382
|
+
<h4 className={classes?.paymentOptionTitle || "text-b3-react-foreground text-lg font-semibold"}>
|
|
383
|
+
Credit/Debit Card
|
|
384
|
+
</h4>
|
|
385
|
+
<p className={classes?.paymentOptionDescription || "text-b3-react-foreground/60 text-sm"}>
|
|
386
|
+
Pay via Stripe checkout
|
|
387
|
+
</p>
|
|
334
388
|
{stripeWeb2Support?.isSupport && stripeWeb2Support.formattedFeeUsd && (
|
|
335
389
|
<div className="mt-1">
|
|
336
|
-
<span className="text-xs text-gray-500">
|
|
390
|
+
<span className={classes?.paymentOptionFee || "text-xs text-gray-500"}>
|
|
337
391
|
${Number(stripeWeb2Support.formattedFeeUsd).toFixed(2)} fee
|
|
338
392
|
</span>
|
|
339
393
|
</div>
|
|
340
394
|
)}
|
|
341
395
|
</div>
|
|
342
396
|
</div>
|
|
343
|
-
<ChevronRight
|
|
397
|
+
<ChevronRight
|
|
398
|
+
className={
|
|
399
|
+
classes?.paymentOptionChevron ||
|
|
400
|
+
"text-b3-react-foreground/40 group-hover:text-b3-react-foreground/60 h-5 w-5 transition-colors"
|
|
401
|
+
}
|
|
402
|
+
/>
|
|
344
403
|
</button>
|
|
345
404
|
)}
|
|
346
405
|
|
|
@@ -348,10 +407,18 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
348
407
|
{stripeWeb2Support.isSupport && (
|
|
349
408
|
<button
|
|
350
409
|
onClick={() => handlePaymentMethodClick("stripe-web2")}
|
|
351
|
-
className=
|
|
410
|
+
className={
|
|
411
|
+
classes?.paymentOption ||
|
|
412
|
+
"bg-b3-react-background border-b3-react-border hover:border-as-brand group flex w-full items-center justify-between gap-4 rounded-xl border p-5 transition-all duration-200 hover:shadow-md"
|
|
413
|
+
}
|
|
352
414
|
>
|
|
353
|
-
<div className="flex items-center gap-4">
|
|
354
|
-
<div
|
|
415
|
+
<div className={classes?.paymentOptionContent || "flex items-center gap-4"}>
|
|
416
|
+
<div
|
|
417
|
+
className={
|
|
418
|
+
classes?.paymentOptionIcon ||
|
|
419
|
+
"flex h-12 w-12 items-center justify-center rounded-full bg-purple-50"
|
|
420
|
+
}
|
|
421
|
+
>
|
|
355
422
|
<img
|
|
356
423
|
src="https://raw.githubusercontent.com/stripe/stripe.github.io/455f506a628dc3f6c505e3001db45a64e29e9fc3/images/stripe-logo.svg"
|
|
357
424
|
alt="Stripe"
|
|
@@ -359,25 +426,36 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
359
426
|
/>
|
|
360
427
|
</div>
|
|
361
428
|
<div className="flex flex-col items-start text-left">
|
|
362
|
-
<h4 className="text-b3-react-foreground text-lg font-semibold">
|
|
363
|
-
|
|
429
|
+
<h4 className={classes?.paymentOptionTitle || "text-b3-react-foreground text-lg font-semibold"}>
|
|
430
|
+
Quick Pay
|
|
431
|
+
</h4>
|
|
432
|
+
<p className={classes?.paymentOptionDescription || "text-b3-react-foreground/60 text-sm"}>
|
|
433
|
+
Credit or debit card
|
|
434
|
+
</p>
|
|
364
435
|
{stripeWeb2Support.formattedFeeUsd && (
|
|
365
436
|
<div className="mt-1">
|
|
366
|
-
<span className="text-xs text-gray-500">
|
|
437
|
+
<span className={classes?.paymentOptionFee || "text-xs text-gray-500"}>
|
|
367
438
|
${Number(stripeWeb2Support.formattedFeeUsd).toFixed(2)} fee
|
|
368
439
|
</span>
|
|
369
440
|
</div>
|
|
370
441
|
)}
|
|
371
442
|
</div>
|
|
372
443
|
</div>
|
|
373
|
-
<ChevronRight
|
|
444
|
+
<ChevronRight
|
|
445
|
+
className={
|
|
446
|
+
classes?.paymentOptionChevron ||
|
|
447
|
+
"text-b3-react-foreground/40 group-hover:text-b3-react-foreground/60 h-5 w-5 transition-colors"
|
|
448
|
+
}
|
|
449
|
+
/>
|
|
374
450
|
</button>
|
|
375
451
|
)}
|
|
376
452
|
|
|
377
453
|
<Button
|
|
378
454
|
variant="link"
|
|
379
455
|
onClick={onBack}
|
|
380
|
-
className=
|
|
456
|
+
className={
|
|
457
|
+
classes?.backButton || "text-b3-react-foreground/70 hover:text-b3-react-foreground/90 mt-2 w-full"
|
|
458
|
+
}
|
|
381
459
|
>
|
|
382
460
|
<ChevronLeft className="mr-2 h-4 w-4" />
|
|
383
461
|
Back
|
|
@@ -1,38 +1,52 @@
|
|
|
1
1
|
import { ShinyButton } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
3
3
|
import Link from "next/link";
|
|
4
|
+
import type { PointsDetailPanelClasses } from "../types/classes";
|
|
4
5
|
|
|
5
6
|
interface PointsDetailPanelProps {
|
|
6
7
|
pointsAmount?: number;
|
|
7
8
|
onBack: () => void;
|
|
9
|
+
classes?: PointsDetailPanelClasses;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
export function PointsDetailPanel({ pointsAmount = 0, onBack }: PointsDetailPanelProps) {
|
|
12
|
+
export function PointsDetailPanel({ pointsAmount = 0, onBack, classes }: PointsDetailPanelProps) {
|
|
11
13
|
return (
|
|
12
|
-
<div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-4 px-5">
|
|
14
|
+
<div className={classes?.container || "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4 px-5"}>
|
|
13
15
|
<div className="flex flex-col items-center gap-4 text-center">
|
|
14
|
-
<h3 className="text-as-primary text-xl font-bold">Earn Points with Every Swap</h3>
|
|
15
|
-
<p className="text-as-primary/70 text-balance text-sm leading-relaxed">
|
|
16
|
-
You'll earn
|
|
16
|
+
<h3 className={classes?.title || "text-as-primary text-xl font-bold"}>Earn Points with Every Swap</h3>
|
|
17
|
+
<p className={classes?.description || "text-as-primary/70 text-balance text-sm leading-relaxed"}>
|
|
18
|
+
You'll earn{" "}
|
|
19
|
+
<span className={classes?.highlightText || "text-as-brand font-semibold"}>
|
|
20
|
+
+{pointsAmount.toLocaleString()} points
|
|
21
|
+
</span>{" "}
|
|
17
22
|
towards the{" "}
|
|
18
|
-
<Link
|
|
23
|
+
<Link
|
|
24
|
+
href="https://anyspend.com/points"
|
|
25
|
+
target="_blank"
|
|
26
|
+
className={classes?.link || "text-as-brand underline"}
|
|
27
|
+
>
|
|
19
28
|
next AnySpend airdrop
|
|
20
29
|
</Link>{" "}
|
|
21
30
|
when you complete this transaction.
|
|
22
31
|
</p>
|
|
23
|
-
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
<div
|
|
33
|
+
className={
|
|
34
|
+
classes?.infoCard ||
|
|
35
|
+
"bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left"
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
<h4 className={classes?.infoCardTitle || "text-as-primary mb-2 font-semibold"}>How it works:</h4>
|
|
39
|
+
<ul className={classes?.infoList || "text-as-primary/70 space-y-1 text-sm"}>
|
|
40
|
+
<li className={classes?.infoListItem}>• Points are earned based on transaction volume</li>
|
|
41
|
+
<li className={classes?.infoListItem}>• Higher volume = more points</li>
|
|
42
|
+
<li className={classes?.infoListItem}>• Points contribute to future airdrops</li>
|
|
43
|
+
<li className={classes?.infoListItem}>• Keep swapping to maximize your rewards</li>
|
|
30
44
|
</ul>
|
|
31
45
|
</div>
|
|
32
46
|
<ShinyButton
|
|
33
47
|
accentColor={"hsl(var(--as-brand))"}
|
|
34
48
|
onClick={onBack}
|
|
35
|
-
className={cn("as-main-button !bg-as-brand relative w-full")}
|
|
49
|
+
className={classes?.backButton || cn("as-main-button !bg-as-brand relative w-full")}
|
|
36
50
|
textClassName={cn("text-white")}
|
|
37
51
|
>
|
|
38
52
|
Back to Swap
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ChevronLeft } from "lucide-react";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
+
import type { RecipientSelectionClasses } from "../types/classes";
|
|
5
6
|
|
|
6
7
|
export interface RecipientSelectionProps {
|
|
7
8
|
/**
|
|
@@ -43,6 +44,10 @@ export interface RecipientSelectionProps {
|
|
|
43
44
|
* @returns true if valid, false otherwise
|
|
44
45
|
*/
|
|
45
46
|
validateAddress?: (address: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Custom classes for styling
|
|
49
|
+
*/
|
|
50
|
+
classes?: RecipientSelectionClasses;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
export function RecipientSelection({
|
|
@@ -55,6 +60,7 @@ export function RecipientSelection({
|
|
|
55
60
|
onConfirm,
|
|
56
61
|
autoFocus = true,
|
|
57
62
|
validateAddress,
|
|
63
|
+
classes,
|
|
58
64
|
}: RecipientSelectionProps) {
|
|
59
65
|
const [recipientAddress, setRecipientAddress] = useState<string>(initialValue);
|
|
60
66
|
|
|
@@ -88,13 +94,16 @@ export function RecipientSelection({
|
|
|
88
94
|
const canConfirm = recipientAddress && isAddressValid;
|
|
89
95
|
|
|
90
96
|
return (
|
|
91
|
-
<div className="recipient-selection mx-auto w-[460px] max-w-full p-5">
|
|
97
|
+
<div className={classes?.container || "recipient-selection mx-auto w-[460px] max-w-full p-5"}>
|
|
92
98
|
<div className="flex flex-col gap-6">
|
|
93
99
|
{/* Header */}
|
|
94
|
-
<div className="flex justify-around">
|
|
100
|
+
<div className={classes?.header || "flex justify-around"}>
|
|
95
101
|
<button
|
|
96
102
|
onClick={onBack}
|
|
97
|
-
className=
|
|
103
|
+
className={
|
|
104
|
+
classes?.backButton ||
|
|
105
|
+
"text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors"
|
|
106
|
+
}
|
|
98
107
|
>
|
|
99
108
|
<ChevronLeft className="h-6 w-6" />
|
|
100
109
|
</button>
|
|
@@ -113,7 +122,10 @@ export function RecipientSelection({
|
|
|
113
122
|
value={recipientAddress}
|
|
114
123
|
onChange={e => setRecipientAddress(e.target.value)}
|
|
115
124
|
onKeyDown={handleKeyDown}
|
|
116
|
-
className=
|
|
125
|
+
className={
|
|
126
|
+
classes?.searchInput ||
|
|
127
|
+
"text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none"
|
|
128
|
+
}
|
|
117
129
|
autoFocus={autoFocus}
|
|
118
130
|
/>
|
|
119
131
|
<div className="border-as-border-secondary border-l">
|
|
@@ -135,7 +147,10 @@ export function RecipientSelection({
|
|
|
135
147
|
<button
|
|
136
148
|
onClick={handleConfirm}
|
|
137
149
|
disabled={!canConfirm}
|
|
138
|
-
className=
|
|
150
|
+
className={
|
|
151
|
+
classes?.confirmButton ||
|
|
152
|
+
"bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed"
|
|
153
|
+
}
|
|
139
154
|
>
|
|
140
155
|
{confirmText}
|
|
141
156
|
</button>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
2
2
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
3
3
|
import { FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
4
|
+
import type { TabSectionClasses } from "../types/classes";
|
|
4
5
|
|
|
5
6
|
interface TabSectionProps {
|
|
6
7
|
activeTab: "crypto" | "fiat";
|
|
7
8
|
setActiveTab: (tab: "crypto" | "fiat") => void;
|
|
8
9
|
setSelectedCryptoPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
9
10
|
setSelectedFiatPaymentMethod: (method: FiatPaymentMethod) => void;
|
|
11
|
+
classes?: TabSectionClasses;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export function TabSection({
|
|
@@ -14,40 +16,47 @@ export function TabSection({
|
|
|
14
16
|
setActiveTab,
|
|
15
17
|
setSelectedCryptoPaymentMethod,
|
|
16
18
|
setSelectedFiatPaymentMethod,
|
|
19
|
+
classes,
|
|
17
20
|
}: TabSectionProps) {
|
|
18
21
|
return (
|
|
19
|
-
<div className="tab-section w-full">
|
|
20
|
-
<div className="bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl">
|
|
22
|
+
<div className={classes?.root || "tab-section w-full"}>
|
|
23
|
+
<div className={classes?.container || "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl"}>
|
|
21
24
|
<div
|
|
22
25
|
className={cn(
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
classes?.tabIndicator ||
|
|
27
|
+
"bg-as-brand absolute bottom-0 left-0 top-0 z-0 h-full w-1/2 rounded-xl transition-transform duration-100",
|
|
25
28
|
activeTab === "fiat" ? "translate-x-full" : "translate-x-0",
|
|
26
29
|
)}
|
|
27
30
|
style={{ willChange: "transform" }}
|
|
28
31
|
/>
|
|
29
32
|
<button
|
|
30
33
|
className={cn(
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
activeTab === "crypto"
|
|
35
|
+
? classes?.tabButtonActive ||
|
|
36
|
+
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium text-white transition-colors duration-100"
|
|
37
|
+
: classes?.tabButton ||
|
|
38
|
+
"text-as-primary/70 hover:bg-as-on-surface-2 relative z-10 h-full w-full rounded-xl bg-transparent px-3 text-sm font-medium transition-colors duration-100",
|
|
33
39
|
)}
|
|
34
40
|
onClick={() => {
|
|
35
41
|
setActiveTab("crypto");
|
|
36
|
-
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
37
|
-
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
42
|
+
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
43
|
+
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
38
44
|
}}
|
|
39
45
|
>
|
|
40
46
|
Pay with crypto
|
|
41
47
|
</button>
|
|
42
48
|
<button
|
|
43
49
|
className={cn(
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
activeTab === "fiat"
|
|
51
|
+
? classes?.tabButtonActive ||
|
|
52
|
+
"relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium text-white transition-colors duration-100"
|
|
53
|
+
: classes?.tabButton ||
|
|
54
|
+
"text-as-primary/70 hover:bg-as-on-surface-2 relative z-10 h-full w-full rounded-xl bg-transparent px-3 text-sm font-medium transition-colors duration-100",
|
|
46
55
|
)}
|
|
47
56
|
onClick={() => {
|
|
48
57
|
setActiveTab("fiat");
|
|
49
|
-
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
50
|
-
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
58
|
+
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
59
|
+
setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
|
|
51
60
|
}}
|
|
52
61
|
>
|
|
53
62
|
Pay with Fiat
|