@b3dotfun/sdk 0.1.69-alpha.22 → 0.1.69-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +2 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -0
- package/dist/cjs/global-account/react/components/index.js +5 -3
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +5 -4
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +2 -2
- package/dist/esm/global-account/react/components/index.d.ts +1 -0
- package/dist/esm/global-account/react/components/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +5 -4
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/types/global-account/react/components/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +24 -12
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
- package/src/anyspend/react/components/AnySpendNFT.tsx +4 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +7 -1
- package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +8 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +4 -2
- package/src/global-account/react/components/index.ts +5 -0
- package/src/global-account/react/hooks/useBetterAuth.ts +5 -4
- package/src/global-account/react/stores/useModalStore.ts +4 -0
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -67,7 +67,7 @@ function AnySpend(props) {
|
|
|
67
67
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
68
68
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }) }));
|
|
69
69
|
}
|
|
70
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, }) {
|
|
70
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
|
|
71
71
|
const { slots, content } = (0, AnySpendCustomizationContext_1.useAnySpendCustomization)();
|
|
72
72
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
73
73
|
const router = (0, react_2.useRouter)();
|
|
@@ -91,6 +91,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
91
91
|
// Track previous panel for proper back navigation
|
|
92
92
|
const previousPanel = (0, react_4.useRef)(PanelView.MAIN);
|
|
93
93
|
const [activeTab, setActiveTab] = (0, react_4.useState)(() => {
|
|
94
|
+
if (!showFiatOption)
|
|
95
|
+
return "crypto";
|
|
94
96
|
if (typeof window !== "undefined") {
|
|
95
97
|
const stored = sessionStorage.getItem("anyspend_active_tab");
|
|
96
98
|
if (stored === "crypto" || stored === "fiat")
|
|
@@ -99,8 +101,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
99
101
|
return defaultActiveTab;
|
|
100
102
|
});
|
|
101
103
|
(0, react_4.useEffect)(() => {
|
|
104
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
105
|
+
setActiveTab("crypto");
|
|
106
|
+
}, [showFiatOption, activeTab]);
|
|
107
|
+
(0, react_4.useEffect)(() => {
|
|
108
|
+
if (!showFiatOption)
|
|
109
|
+
return;
|
|
102
110
|
sessionStorage.setItem("anyspend_active_tab", activeTab);
|
|
103
|
-
}, [activeTab]);
|
|
111
|
+
}, [activeTab, showFiatOption]);
|
|
104
112
|
const [orderId, setOrderId] = (0, react_4.useState)(loadOrder);
|
|
105
113
|
const [directTransferTxHash, setDirectTransferTxHash] = (0, react_4.useState)();
|
|
106
114
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(orderId);
|
|
@@ -979,12 +987,12 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
979
987
|
// Reset payment methods when going back
|
|
980
988
|
resetPaymentMethods();
|
|
981
989
|
}, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
|
|
982
|
-
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
990
|
+
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.mainContent || "mx-auto flex w-full max-w-[460px] flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), showFiatOption && ((0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
983
991
|
setActiveTab(tab);
|
|
984
992
|
// Reset payment methods when switching tabs
|
|
985
993
|
resetPaymentMethods();
|
|
986
994
|
setSelectedFiatPaymentMethod(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
|
|
987
|
-
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
995
|
+
}, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod })), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
|
|
988
996
|
// Map panel index to navigation with direction
|
|
989
997
|
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
990
998
|
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
@@ -70,6 +70,10 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
70
70
|
* Force fiat payment
|
|
71
71
|
*/
|
|
72
72
|
forceFiatPayment?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show the "Pay with fiat" tab. Defaults to true.
|
|
75
|
+
*/
|
|
76
|
+
showFiatOption?: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Optional discount code to apply to the purchase.
|
|
75
79
|
* When provided, validates on-chain and adjusts the price accordingly.
|
|
@@ -79,4 +83,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
79
83
|
content?: AnySpendContent;
|
|
80
84
|
theme?: AnySpendTheme;
|
|
81
85
|
}
|
|
82
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, showFiatOption, discountCode, slots, content, theme, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -44,7 +44,7 @@ const basePublicClient = (0, viem_1.createPublicClient)({
|
|
|
44
44
|
chain: chains_1.base,
|
|
45
45
|
transport: (0, viem_1.http)(constants_2.PUBLIC_BASE_RPC_URL),
|
|
46
46
|
});
|
|
47
|
-
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, discountCode, slots, content, theme, }) {
|
|
47
|
+
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, showFiatOption = true, discountCode, slots, content, theme, }) {
|
|
48
48
|
const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
|
|
49
49
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
50
50
|
const totalAmount = (0, react_1.useMemo)(() => {
|
|
@@ -218,5 +218,5 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
|
|
|
218
218
|
...(discountCode && discountInfo.isValid
|
|
219
219
|
? { discountCode, discountAmount: discountInfo.discountAmount.toString() }
|
|
220
220
|
: {}),
|
|
221
|
-
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, slots: slots, content: content, theme: theme }));
|
|
221
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount, forceFiatPayment: forceFiatPayment, showFiatOption: showFiatOption, slots: slots, content: content, theme: theme }));
|
|
222
222
|
}
|
|
@@ -13,6 +13,8 @@ export declare function AnySpendCustom(props: {
|
|
|
13
13
|
dstToken: components["schemas"]["Token"];
|
|
14
14
|
dstAmount: string;
|
|
15
15
|
forceFiatPayment?: boolean;
|
|
16
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
17
|
+
showFiatOption?: boolean;
|
|
16
18
|
contractAddress: string;
|
|
17
19
|
encodedData: string;
|
|
18
20
|
metadata: any;
|
|
@@ -115,12 +115,16 @@ function AnySpendCustom(props) {
|
|
|
115
115
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
116
116
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendCustomInner, { ...props }) }) }));
|
|
117
117
|
}
|
|
118
|
-
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, forceFiatPayment, senderAddress, }) {
|
|
118
|
+
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, forceFiatPayment, showFiatOption = true, senderAddress, }) {
|
|
119
119
|
const hasMounted = (0, react_2.useHasMounted)();
|
|
120
120
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
121
121
|
const router = (0, react_2.useRouter)();
|
|
122
122
|
const [activePanel, setActivePanel] = (0, react_5.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
123
|
-
const [activeTab, setActiveTab] = (0, react_5.useState)(forceFiatPayment ? "fiat" : activeTabProps);
|
|
123
|
+
const [activeTab, setActiveTab] = (0, react_5.useState)(!showFiatOption ? "crypto" : forceFiatPayment ? "fiat" : activeTabProps);
|
|
124
|
+
(0, react_5.useEffect)(() => {
|
|
125
|
+
if (!showFiatOption && activeTab === "fiat")
|
|
126
|
+
setActiveTab("crypto");
|
|
127
|
+
}, [showFiatOption, activeTab]);
|
|
124
128
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
125
129
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
126
130
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = (0, useCryptoPaymentMethodState_1.useCryptoPaymentMethodState)();
|
|
@@ -501,7 +505,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
501
505
|
return null;
|
|
502
506
|
};
|
|
503
507
|
// Confirm order view.
|
|
504
|
-
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [!forceFiatPayment && ((0, jsx_runtime_1.jsx)("div", { className: "w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
|
|
508
|
+
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [!forceFiatPayment && showFiatOption && ((0, jsx_runtime_1.jsx)("div", { className: "w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
|
|
505
509
|
setActiveTab("crypto");
|
|
506
510
|
// Reset payment methods when switching tabs
|
|
507
511
|
resetPaymentMethods();
|
|
@@ -73,6 +73,8 @@ export interface AnySpendDepositProps {
|
|
|
73
73
|
depositContractConfig?: DepositContractConfig;
|
|
74
74
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
75
75
|
showChainSelection?: boolean;
|
|
76
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
77
|
+
showFiatOption?: boolean;
|
|
76
78
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
77
79
|
supportedChains?: ChainConfig[];
|
|
78
80
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
@@ -148,4 +150,4 @@ export interface AnySpendDepositProps {
|
|
|
148
150
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
149
151
|
* />
|
|
150
152
|
*/
|
|
151
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
153
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -97,7 +97,7 @@ function ChainIcon({ chainId, className }) {
|
|
|
97
97
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
98
98
|
* />
|
|
99
99
|
*/
|
|
100
|
-
function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
100
|
+
function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption = true, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }) {
|
|
101
101
|
// Extract deposit-specific classes for convenience
|
|
102
102
|
const depositClasses = classes?.deposit;
|
|
103
103
|
const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
|
|
@@ -199,9 +199,9 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
|
|
|
199
199
|
"anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
200
200
|
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.divider || "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: depositClasses?.dividerText || "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: depositClasses?.dividerLine || "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: depositClasses?.qrButton ||
|
|
201
201
|
"anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
202
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
202
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), showFiatOption && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: depositClasses?.fiatButton ||
|
|
203
203
|
"anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.optionInfo || "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: depositClasses?.optionDescription ||
|
|
204
|
-
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
204
|
+
"anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }))] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "mt-2" } })] })] }));
|
|
205
205
|
}
|
|
206
206
|
// QR Deposit view
|
|
207
207
|
if (step === "qr-deposit") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
@@ -12,4 +12,6 @@ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftCont
|
|
|
12
12
|
slots?: AnySpendSlots;
|
|
13
13
|
content?: AnySpendContent;
|
|
14
14
|
theme?: AnySpendTheme;
|
|
15
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
16
|
+
showFiatOption?: boolean;
|
|
15
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,7 +29,7 @@ const CONTRACT_URI_ABI = [
|
|
|
29
29
|
type: "function",
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
|
-
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, }) {
|
|
32
|
+
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
33
33
|
const [imageUrlWithFallback, setFallbackImageUrl] = (0, react_3.useState)(nftContract.imageUrl);
|
|
34
34
|
const hasFetchedRef = (0, react_3.useRef)(false);
|
|
35
35
|
// Fetch contract metadata when imageUrl is empty
|
|
@@ -83,7 +83,7 @@ function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract,
|
|
|
83
83
|
const header = (0, react_3.useCallback)(({ anyspendPrice, isLoadingAnyspendPrice, }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative size-[200px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCard, { className: "overflow-hidden", children: [imageUrlWithFallback && ((0, jsx_runtime_1.jsx)("img", { src: imageUrlWithFallback, alt: nftContract.name, className: "size-full object-cover" })), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), (0, jsx_runtime_1.jsx)(DropdownMenu, { nftContract: nftContract })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 -mb-5 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(react_2.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
|
|
84
84
|
"opacity-0": isLoadingAnyspendPrice,
|
|
85
85
|
}), children: (0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[36px] w-full" })) })] })] })] })), [imageUrlWithFallback, nftContract]);
|
|
86
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", showFiatOption: showFiatOption, recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
87
87
|
type: "mint_nft",
|
|
88
88
|
nftContract: nftContract,
|
|
89
89
|
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }: {
|
|
3
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
beneficiaryAddress: string;
|
|
@@ -14,4 +14,6 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
|
|
|
14
14
|
slots?: AnySpendSlots;
|
|
15
15
|
content?: AnySpendContent;
|
|
16
16
|
theme?: AnySpendTheme;
|
|
17
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
18
|
+
showFiatOption?: boolean;
|
|
17
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,7 +20,7 @@ function generateEncodedDataForStaking(amount, beneficiary) {
|
|
|
20
20
|
args: [beneficiary, BigInt(amount)],
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }) {
|
|
23
|
+
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption = true, }) {
|
|
24
24
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? (0, number_1.formatTokenAmount)(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
|
|
25
25
|
// Only generate encoded data if we have a valid beneficiary address
|
|
26
26
|
// This is used for the AnySpendCustom swap & stake flow
|
|
@@ -30,5 +30,5 @@ function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, st
|
|
|
30
30
|
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
32
32
|
action: `stake ${token.symbol}`,
|
|
33
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
33
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, showFiatOption: showFiatOption, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
34
34
|
}
|
|
@@ -10,6 +10,11 @@ export interface BetterAuthSignInProps {
|
|
|
10
10
|
showEmail?: boolean;
|
|
11
11
|
/** URL to redirect to after password reset link is clicked. Token is appended as ?token=... */
|
|
12
12
|
passwordResetRedirectTo?: string;
|
|
13
|
+
/**
|
|
14
|
+
* URL Better Auth redirects to after server-side email verification. Render
|
|
15
|
+
* `BetterAuthVerifyEmail` at this route so the user gets a confirmation page.
|
|
16
|
+
*/
|
|
17
|
+
verifyEmailRedirectTo?: string;
|
|
13
18
|
/** Called after successful authentication */
|
|
14
19
|
onSuccess?: () => void;
|
|
15
20
|
/** Called on authentication error */
|
|
@@ -31,4 +36,4 @@ export interface BetterAuthSignInProps {
|
|
|
31
36
|
* />
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
export declare function BetterAuthSignIn({ title, subtitle, socialProviders, showEmail, passwordResetRedirectTo, onSuccess, onError, className, }: BetterAuthSignInProps): import("react/jsx-runtime").JSX.Element | null;
|
|
39
|
+
export declare function BetterAuthSignIn({ title, subtitle, socialProviders, showEmail, passwordResetRedirectTo, verifyEmailRedirectTo, onSuccess, onError, className, }: BetterAuthSignInProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -31,7 +31,7 @@ const DEFAULT_SOCIAL_PROVIDERS = [
|
|
|
31
31
|
* />
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access your account", socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id), showEmail = true, passwordResetRedirectTo, onSuccess, onError, className, }) {
|
|
34
|
+
function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access your account", socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id), showEmail = true, passwordResetRedirectTo, verifyEmailRedirectTo, onSuccess, onError, className, }) {
|
|
35
35
|
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = (0, useBetterAuth_1.useBetterAuth)();
|
|
36
36
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
37
37
|
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
@@ -101,7 +101,7 @@ function BetterAuthSignIn({ title, subtitle = "Enter your credentials to access
|
|
|
101
101
|
setIsLoading(true);
|
|
102
102
|
setError(null);
|
|
103
103
|
if (mode === "sign-up") {
|
|
104
|
-
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
104
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
107
|
await signInWithEmail(normalizedEmail, password);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type BetterAuthVerifyEmailState = "success" | "expired" | "invalid" | "already-verified" | "error";
|
|
2
|
+
export interface BetterAuthVerifyEmailProps {
|
|
3
|
+
/**
|
|
4
|
+
* Error code from the callback URL's `?error=` query param. Pass `null` /
|
|
5
|
+
* `undefined` when the user landed here cleanly (successful verification).
|
|
6
|
+
* Better Auth appends this param when server-side verification fails.
|
|
7
|
+
*/
|
|
8
|
+
errorCode?: string | null;
|
|
9
|
+
/** Called when the user clicks the "Go to sign in" button. */
|
|
10
|
+
onGoToSignIn?: () => void;
|
|
11
|
+
/** Fallback href used when `onGoToSignIn` is not provided. Defaults to "/login". */
|
|
12
|
+
signInHref?: string;
|
|
13
|
+
/** Optional override for the success headline. */
|
|
14
|
+
successTitle?: string;
|
|
15
|
+
/** Optional override for the success body text. */
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
/** Optional class name for the root container. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
22
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
23
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
24
|
+
*
|
|
25
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
26
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
31
|
+
* <BetterAuthVerifyEmail
|
|
32
|
+
* errorCode={error}
|
|
33
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref, successTitle, successMessage, className, }: BetterAuthVerifyEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BetterAuthVerifyEmail = BetterAuthVerifyEmail;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../global-account/react");
|
|
6
|
+
const debug_1 = require("../../../../shared/utils/debug");
|
|
7
|
+
const debug = (0, debug_1.debugB3React)("BetterAuthVerifyEmail");
|
|
8
|
+
function classifyError(code) {
|
|
9
|
+
if (!code)
|
|
10
|
+
return "success";
|
|
11
|
+
const normalized = code.toLowerCase();
|
|
12
|
+
// Exact matches for Better Auth's documented verification error codes.
|
|
13
|
+
if (normalized === "expired_token")
|
|
14
|
+
return "expired";
|
|
15
|
+
if (normalized === "invalid_token")
|
|
16
|
+
return "invalid";
|
|
17
|
+
if (normalized === "already_verified" || normalized === "email_already_verified")
|
|
18
|
+
return "already-verified";
|
|
19
|
+
// Loose fallbacks for close variants. Order matters — check "already" before
|
|
20
|
+
// "verified" so `email_already_verified` maps to already-verified, not invalid.
|
|
21
|
+
if (normalized.includes("expired"))
|
|
22
|
+
return "expired";
|
|
23
|
+
if (normalized.includes("already"))
|
|
24
|
+
return "already-verified";
|
|
25
|
+
if (normalized.includes("invalid"))
|
|
26
|
+
return "invalid";
|
|
27
|
+
return "error";
|
|
28
|
+
}
|
|
29
|
+
const COPY = {
|
|
30
|
+
success: {
|
|
31
|
+
title: "Email verified",
|
|
32
|
+
message: "Your email is confirmed. You can now sign in to your account.",
|
|
33
|
+
},
|
|
34
|
+
expired: {
|
|
35
|
+
title: "Link expired",
|
|
36
|
+
message: "This verification link has expired. Request a new one from the sign-in page.",
|
|
37
|
+
},
|
|
38
|
+
invalid: {
|
|
39
|
+
title: "Invalid link",
|
|
40
|
+
message: "This verification link is invalid or has already been used. Try signing in or request a new link.",
|
|
41
|
+
},
|
|
42
|
+
"already-verified": {
|
|
43
|
+
title: "Already verified",
|
|
44
|
+
message: "Your email was already confirmed. You can sign in now.",
|
|
45
|
+
},
|
|
46
|
+
error: {
|
|
47
|
+
title: "Verification failed",
|
|
48
|
+
message: "We couldn't verify your email. Request a new link from the sign-in page.",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
53
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
54
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
55
|
+
*
|
|
56
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
57
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
58
|
+
*
|
|
59
|
+
* Usage:
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
62
|
+
* <BetterAuthVerifyEmail
|
|
63
|
+
* errorCode={error}
|
|
64
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref = "/login", successTitle, successMessage, className, }) {
|
|
69
|
+
const state = classifyError(errorCode);
|
|
70
|
+
const isSuccess = state === "success" || state === "already-verified";
|
|
71
|
+
const copy = COPY[state];
|
|
72
|
+
const title = isSuccess && successTitle ? successTitle : copy.title;
|
|
73
|
+
const message = isSuccess && successMessage ? successMessage : copy.message;
|
|
74
|
+
debug("Rendering verify-email state", { state, errorCode });
|
|
75
|
+
const handleClick = () => {
|
|
76
|
+
if (onGoToSignIn) {
|
|
77
|
+
onGoToSignIn();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof window !== "undefined") {
|
|
81
|
+
window.location.href = signInHref;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `w-full max-w-[400px] px-6 ${className || ""}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: `mx-auto flex h-12 w-12 items-center justify-center rounded-full ${isSuccess ? "bg-green-100" : "bg-red-100"}`, children: isSuccess ? ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-red-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-[28px] font-semibold tracking-tight text-gray-900 dark:text-gray-100", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "mt-3 text-[15px] text-gray-500 dark:text-gray-400", children: message })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleClick, className: "h-11 w-full bg-gray-900 text-[15px] font-medium text-white hover:bg-gray-800 dark:bg-white dark:text-gray-900 dark:hover:bg-gray-100", children: isSuccess ? "Go to sign in" : "Back to sign in" })] }) }));
|
|
85
|
+
}
|
|
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "../../../../global-account/react";
|
|
|
3
3
|
* Component that manages the authentication flow for Sign In With B3
|
|
4
4
|
* Handles different login providers, authentication steps, and session key management
|
|
5
5
|
*/
|
|
6
|
-
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, verifyEmailRedirectTo, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
16
16
|
* Component that manages the authentication flow for Sign In With B3
|
|
17
17
|
* Handles different login providers, authentication steps, and session key management
|
|
18
18
|
*/
|
|
19
|
-
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
19
|
+
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, verifyEmailRedirectTo, }) {
|
|
20
20
|
const { automaticallySetFirstEoa, authStrategy } = (0, react_1.useB3Config)();
|
|
21
21
|
// skipAutoConnect: this component intentionally logs out on mount to show a fresh login screen.
|
|
22
22
|
// AuthenticationProvider is the sole owner of useAutoConnect to avoid competing auth cycles.
|
|
@@ -247,7 +247,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
247
247
|
// Better Auth manages its own loading/verification states internally.
|
|
248
248
|
// Don't gate on isAuthenticating — it would unmount the component
|
|
249
249
|
// and lose verification state when setIsAuthenticating(false) fires.
|
|
250
|
-
content = (0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError });
|
|
250
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError, verifyEmailRedirectTo: verifyEmailRedirectTo }));
|
|
251
251
|
}
|
|
252
252
|
else if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
|
|
253
253
|
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface LoginStepBetterAuthProps {
|
|
2
2
|
onSuccess?: () => void;
|
|
3
3
|
onError?: (error: Error) => Promise<void>;
|
|
4
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
5
|
+
verifyEmailRedirectTo?: string;
|
|
4
6
|
}
|
|
5
|
-
export declare function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -17,7 +17,7 @@ const SOCIAL_PROVIDERS = [
|
|
|
17
17
|
{ id: "microsoft", label: "Microsoft" },
|
|
18
18
|
{ id: "slack", label: "Slack" },
|
|
19
19
|
];
|
|
20
|
-
function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
20
|
+
function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }) {
|
|
21
21
|
const { partnerId } = (0, react_1.useB3Config)();
|
|
22
22
|
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = (0, useBetterAuth_1.useBetterAuth)();
|
|
23
23
|
const [mode, setMode] = (0, react_2.useState)("sign-in");
|
|
@@ -48,7 +48,7 @@ function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
|
48
48
|
setError(null);
|
|
49
49
|
if (mode === "sign-up") {
|
|
50
50
|
debug("Signing up", { email: normalizedEmail, name: name.trim() });
|
|
51
|
-
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
51
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
debug("Signing in", { email: normalizedEmail });
|
|
@@ -8,6 +8,7 @@ export { useB3Config } from "./B3Provider/useB3Config";
|
|
|
8
8
|
export { StyleRoot } from "./StyleRoot";
|
|
9
9
|
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
10
10
|
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
11
|
+
export { BetterAuthVerifyEmail, type BetterAuthVerifyEmailProps, type BetterAuthVerifyEmailState, } from "./SignInWithB3/BetterAuthVerifyEmail";
|
|
11
12
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
12
13
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
13
14
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = void 0;
|
|
6
|
+
exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.BetterAuthVerifyEmail = exports.BetterAuthSignIn = exports.BetterAuthResetPassword = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = exports.TransitionPanel = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
@@ -27,6 +27,8 @@ var BetterAuthResetPassword_1 = require("./SignInWithB3/BetterAuthResetPassword"
|
|
|
27
27
|
Object.defineProperty(exports, "BetterAuthResetPassword", { enumerable: true, get: function () { return BetterAuthResetPassword_1.BetterAuthResetPassword; } });
|
|
28
28
|
var BetterAuthSignIn_1 = require("./SignInWithB3/BetterAuthSignIn");
|
|
29
29
|
Object.defineProperty(exports, "BetterAuthSignIn", { enumerable: true, get: function () { return BetterAuthSignIn_1.BetterAuthSignIn; } });
|
|
30
|
+
var BetterAuthVerifyEmail_1 = require("./SignInWithB3/BetterAuthVerifyEmail");
|
|
31
|
+
Object.defineProperty(exports, "BetterAuthVerifyEmail", { enumerable: true, get: function () { return BetterAuthVerifyEmail_1.BetterAuthVerifyEmail; } });
|
|
30
32
|
var AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
31
33
|
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
32
34
|
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
@@ -13,7 +13,7 @@ export declare class EmailVerificationRequiredError extends Error {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function useBetterAuth(): {
|
|
15
15
|
signInWithEmail: (email: string, password: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
-
signUpWithEmail: (email: string, password: string, name: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
+
signUpWithEmail: (email: string, password: string, name: string, verifyCallbackURL?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
17
17
|
signInWithSocial: (provider: BetterAuthSocialProvider) => Promise<void>;
|
|
18
18
|
requestPasswordReset: (email: string, redirectTo?: string) => Promise<{
|
|
19
19
|
data: {
|
|
@@ -73,7 +73,7 @@ function useBetterAuth() {
|
|
|
73
73
|
throw error;
|
|
74
74
|
}
|
|
75
75
|
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
76
|
-
const signUpWithEmail = (0, react_2.useCallback)(async (email, password, name) => {
|
|
76
|
+
const signUpWithEmail = (0, react_2.useCallback)(async (email, password, name, verifyCallbackURL) => {
|
|
77
77
|
debug("Signing up with email", { email, name });
|
|
78
78
|
setHasStartedConnecting(true);
|
|
79
79
|
setIsAuthenticating(true);
|
|
@@ -84,11 +84,12 @@ function useBetterAuth() {
|
|
|
84
84
|
}
|
|
85
85
|
const token = result.data?.token;
|
|
86
86
|
if (!token) {
|
|
87
|
-
// requireEmailVerification is enabled — send verification email
|
|
88
|
-
//
|
|
87
|
+
// requireEmailVerification is enabled — send verification email with
|
|
88
|
+
// a callbackURL Better Auth redirects to after server-side verify.
|
|
89
|
+
// Pass verifyCallbackURL to land on a dedicated confirmation page.
|
|
89
90
|
await better_auth_client_1.betterAuthClient.sendVerificationEmail({
|
|
90
91
|
email,
|
|
91
|
-
callbackURL: `${window.location.origin}?authStrategy=better-auth`,
|
|
92
|
+
callbackURL: verifyCallbackURL || `${window.location.origin}?authStrategy=better-auth`,
|
|
92
93
|
});
|
|
93
94
|
throw new EmailVerificationRequiredError();
|
|
94
95
|
}
|
|
@@ -41,6 +41,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
41
41
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
42
42
|
/** Whether to show the signers enabled modal */
|
|
43
43
|
signersEnabled?: boolean;
|
|
44
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
45
|
+
verifyEmailRedirectTo?: string;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Props for the Request Permissions modal
|
|
@@ -609,6 +611,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
609
611
|
actionLabel?: string;
|
|
610
612
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
611
613
|
showChainSelection?: boolean;
|
|
614
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
615
|
+
showFiatOption?: boolean;
|
|
612
616
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
613
617
|
minPoolSize?: number;
|
|
614
618
|
/** Custom title for chain selection step */
|
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|