@b3dotfun/sdk 0.1.70-alpha.1 → 0.1.70-alpha.2
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/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +9 -3
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- 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/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +13 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -3
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +5 -6
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -5
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +13 -14
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +28 -0
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +10 -4
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- 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/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +14 -4
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -3
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +3 -4
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +6 -7
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +28 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +28 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +3 -0
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +29 -14
- package/src/anyspend/react/components/AnySpendDeposit.tsx +13 -3
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/AnySpendWorkflowTrigger.tsx +4 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +3 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +4 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +97 -79
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -36
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +3 -4
- package/src/global-account/react/components/index.ts +0 -1
- package/src/global-account/react/hooks/useBetterAuth.ts +6 -7
- package/src/global-account/react/stores/useModalStore.ts +28 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -31
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -27
- package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +0 -40
|
@@ -29,8 +29,18 @@ function AmexLogo() {
|
|
|
29
29
|
function CoinbaseLogo() {
|
|
30
30
|
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", style: { width: 20, height: 20 }, "aria-label": "Coinbase", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "#0052FF" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 4.5a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15zm-1.8 4.8h3.6c.33 0 .6.27.6.6v4.2c0 .33-.27.6-.6.6h-3.6a.6.6 0 0 1-.6-.6V9.9c0-.33.27-.6.6-.6z", fill: "white" })] }));
|
|
31
31
|
}
|
|
32
|
-
function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid = true, feeOnTop, kycEnabled = false, }) {
|
|
33
|
-
const [paymentMethod, setPaymentMethod] = (0, react_2.useState)(
|
|
32
|
+
function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid = true, feeOnTop, kycEnabled = false, showFiatOption = true, }) {
|
|
33
|
+
const [paymentMethod, setPaymentMethod] = (0, react_2.useState)(() => {
|
|
34
|
+
if (!showFiatOption && (defaultPaymentMethod === "card" || defaultPaymentMethod === "coinbase")) {
|
|
35
|
+
return "crypto";
|
|
36
|
+
}
|
|
37
|
+
return defaultPaymentMethod ?? null;
|
|
38
|
+
});
|
|
39
|
+
(0, react_2.useEffect)(() => {
|
|
40
|
+
if (!showFiatOption && (paymentMethod === "card" || paymentMethod === "coinbase")) {
|
|
41
|
+
setPaymentMethod("crypto");
|
|
42
|
+
}
|
|
43
|
+
}, [showFiatOption, paymentMethod]);
|
|
34
44
|
// Restore activeOrderId from sessionStorage (handles page refresh / Coinbase return)
|
|
35
45
|
const [activeOrderId, setActiveOrderId] = (0, react_2.useState)(() => {
|
|
36
46
|
if (typeof window !== "undefined") {
|
|
@@ -58,5 +68,5 @@ function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, desti
|
|
|
58
68
|
}
|
|
59
69
|
const accordionButtonClass = (active) => (0, cn_1.cn)("anyspend-payment-method-btn flex w-full items-center gap-3 px-4 py-4 text-left transition-colors", !active && "hover:bg-gray-50 dark:hover:bg-neutral-800", classes?.paymentMethodButton);
|
|
60
70
|
const expandedPanelClass = (0, cn_1.cn)("anyspend-payment-method-panel border-t border-gray-100 px-4 py-4 dark:border-neutral-800");
|
|
61
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), !isFormValid && ((0, jsx_runtime_1.jsx)("p", { className: "text-sm text-amber-600 dark:text-amber-400", children: "Please complete the required fields above before proceeding to payment." })), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-neutral-700 dark:border-neutral-700", !isFormValid && "pointer-events-none opacity-50", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "crypto" ? null : "crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Pay with crypto" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoPayPanel_1.CryptoPayPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, senderAddress: senderAddress }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "card" ? null : "card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, feeOnTop: feeOnTop, kycEnabled: kycEnabled }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), !isFormValid && ((0, jsx_runtime_1.jsx)("p", { className: "text-sm text-amber-600 dark:text-amber-400", children: "Please complete the required fields above before proceeding to payment." })), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-neutral-700 dark:border-neutral-700", !isFormValid && "pointer-events-none opacity-50", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "crypto" ? null : "crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Pay with crypto" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoPayPanel_1.CryptoPayPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, senderAddress: senderAddress }) }) }, "crypto-panel")) })] }), showFiatOption && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "card" ? null : "card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, feeOnTop: feeOnTop, kycEnabled: kycEnabled }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] }))] })] }));
|
|
62
72
|
}
|
|
@@ -15,10 +15,8 @@ export interface B3ConfigContextType {
|
|
|
15
15
|
stripePublishableKey?: string;
|
|
16
16
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
17
17
|
authStrategy: AuthStrategy;
|
|
18
|
-
/** Override the API base URL for all auth operations (Better Auth client, Feathers JWT exchange). */
|
|
19
|
-
apiUrl?: string;
|
|
20
18
|
}
|
|
21
|
-
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, authStrategy,
|
|
19
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, authStrategy, }: {
|
|
22
20
|
children: React.ReactNode;
|
|
23
21
|
accountOverride?: Account;
|
|
24
22
|
environment?: "development" | "production";
|
|
@@ -30,7 +28,5 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
30
28
|
stripePublishableKey?: string;
|
|
31
29
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
32
30
|
authStrategy?: AuthStrategy;
|
|
33
|
-
/** Override the API base URL for all auth operations (Better Auth client, Feathers JWT exchange). */
|
|
34
|
-
apiUrl?: string;
|
|
35
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
36
32
|
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -14,7 +14,7 @@ const DEFAULT_PERMISSIONS = {
|
|
|
14
14
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
15
15
|
};
|
|
16
16
|
const B3ConfigContext = (0, react_1.createContext)(null);
|
|
17
|
-
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, authStrategy = "thirdweb",
|
|
17
|
+
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, authStrategy = "thirdweb", }) {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(B3ConfigContext.Provider, { value: {
|
|
19
19
|
accountOverride,
|
|
20
20
|
environment,
|
|
@@ -26,7 +26,6 @@ function B3ConfigProvider({ children, accountOverride, environment = "developmen
|
|
|
26
26
|
stripePublishableKey,
|
|
27
27
|
createClientReferenceId,
|
|
28
28
|
authStrategy,
|
|
29
|
-
apiUrl,
|
|
30
29
|
}, children: children }));
|
|
31
30
|
}
|
|
32
31
|
function useB3Config() {
|
|
@@ -10,7 +10,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
10
10
|
/**
|
|
11
11
|
* Main B3Provider component
|
|
12
12
|
*/
|
|
13
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy,
|
|
13
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy, }: {
|
|
14
14
|
theme: "light" | "dark";
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
accountOverride?: Account;
|
|
@@ -39,20 +39,4 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
39
39
|
queryClient?: QueryClient;
|
|
40
40
|
/** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
|
|
41
41
|
authStrategy?: AuthStrategy;
|
|
42
|
-
/**
|
|
43
|
-
* Override the API base URL for Better Auth operations.
|
|
44
|
-
*
|
|
45
|
-
* When set, the Better Auth client (signIn, signUp, signOut, getSession) will
|
|
46
|
-
* target this URL instead of the default `B3_API_URL` / `NEXT_PUBLIC_B3_API`.
|
|
47
|
-
*
|
|
48
|
-
* Useful for local development where the frontend runs on localhost:3003 and
|
|
49
|
-
* the b3-api runs on localhost:3031 — keeps the entire OAuth flow local so
|
|
50
|
-
* sessions, cookies, and token exchange all hit the same server.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <B3Provider apiUrl="http://localhost:3031" ... />
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
apiUrl?: string;
|
|
58
42
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,6 @@ const StyleRoot_1 = require("../StyleRoot");
|
|
|
16
16
|
const index_1 = require("../Toast/index");
|
|
17
17
|
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
18
18
|
const B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
19
|
-
const BetterAuthClientProvider_1 = require("./BetterAuthClientProvider");
|
|
20
19
|
const BetterAuthProvider_1 = __importDefault(require("./BetterAuthProvider"));
|
|
21
20
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
22
21
|
/**
|
|
@@ -24,7 +23,7 @@ const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
|
24
23
|
*/
|
|
25
24
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey,
|
|
26
25
|
// deprecated since v0.0.87
|
|
27
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb",
|
|
26
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb", }) {
|
|
28
27
|
// Initialize Google Analytics on mount
|
|
29
28
|
(0, react_3.useEffect)(() => {
|
|
30
29
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -34,7 +33,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
34
33
|
(0, client_manager_1.setClientType)(clientType);
|
|
35
34
|
}, [clientType]);
|
|
36
35
|
const wagmiConfig = (0, react_3.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(react_2.WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: (0, jsx_runtime_1.
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_2.WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, authStrategy: authStrategy, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), authStrategy === "better-auth" ? ((0, jsx_runtime_1.jsx)(BetterAuthProvider_1.default, { partnerId: partnerId })) : ((0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider }))] }) }) }) }) }));
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Component to connect the toast context to the global toast API
|
|
@@ -9,8 +9,8 @@ const constants_1 = require("../../../../shared/constants");
|
|
|
9
9
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
10
10
|
const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
11
11
|
const react_2 = require("react");
|
|
12
|
+
const better_auth_client_1 = require("../../../better-auth-client");
|
|
12
13
|
const useUserQuery_1 = require("../../hooks/useUserQuery");
|
|
13
|
-
const BetterAuthClientProvider_1 = require("./BetterAuthClientProvider");
|
|
14
14
|
const debug = (0, debug_1.debugB3React)("BetterAuthProvider");
|
|
15
15
|
/**
|
|
16
16
|
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
@@ -25,7 +25,6 @@ const debug = (0, debug_1.debugB3React)("BetterAuthProvider");
|
|
|
25
25
|
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
26
26
|
*/
|
|
27
27
|
const BetterAuthProvider = ({ partnerId }) => {
|
|
28
|
-
const betterAuthClient = (0, BetterAuthClientProvider_1.useBetterAuthClient)();
|
|
29
28
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
30
29
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
31
30
|
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
@@ -46,7 +45,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
46
45
|
app_1.default.logout = async () => {
|
|
47
46
|
debug("Patched logout: clearing Better Auth session");
|
|
48
47
|
try {
|
|
49
|
-
await betterAuthClient.signOut();
|
|
48
|
+
await better_auth_client_1.betterAuthClient.signOut();
|
|
50
49
|
}
|
|
51
50
|
catch {
|
|
52
51
|
debug("Better Auth signOut failed (non-critical)");
|
|
@@ -57,7 +56,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
57
56
|
app_1.default.logout = originalLogout;
|
|
58
57
|
hasPatched.current = false;
|
|
59
58
|
};
|
|
60
|
-
}, [
|
|
59
|
+
}, []);
|
|
61
60
|
// Session restore on mount
|
|
62
61
|
(0, react_2.useEffect)(() => {
|
|
63
62
|
if (hasAttemptedRestore.current)
|
|
@@ -82,7 +81,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
82
81
|
}
|
|
83
82
|
// 2. Check for a Better Auth session (e.g. after OAuth redirect sets a cookie)
|
|
84
83
|
try {
|
|
85
|
-
const session = await betterAuthClient.getSession();
|
|
84
|
+
const session = await better_auth_client_1.betterAuthClient.getSession();
|
|
86
85
|
if (session.data?.session?.token) {
|
|
87
86
|
debug("Better Auth session found, exchanging for Feathers JWT", {
|
|
88
87
|
betterAuthUserId: session.data.user?.id,
|
|
@@ -115,7 +114,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
115
114
|
setIsAuthenticating(false);
|
|
116
115
|
};
|
|
117
116
|
restoreSession();
|
|
118
|
-
}, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId
|
|
117
|
+
}, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId]);
|
|
119
118
|
return null;
|
|
120
119
|
};
|
|
121
120
|
exports.default = BetterAuthProvider;
|
|
@@ -5,7 +5,6 @@ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
|
5
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
6
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
7
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
8
|
-
export { useBetterAuthClient } from "./B3Provider/BetterAuthClientProvider";
|
|
9
8
|
export { StyleRoot } from "./StyleRoot";
|
|
10
9
|
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
11
10
|
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
@@ -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.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.UserAvatar = 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.
|
|
7
|
-
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 = exports.Dialog =
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger =
|
|
6
|
+
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.UserAvatar = 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.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 = exports.Dialog = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = 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");
|
|
@@ -20,8 +20,6 @@ var useB3Account_1 = require("./B3Provider/useB3Account");
|
|
|
20
20
|
Object.defineProperty(exports, "useB3Account", { enumerable: true, get: function () { return useB3Account_1.useB3Account; } });
|
|
21
21
|
var useB3Config_1 = require("./B3Provider/useB3Config");
|
|
22
22
|
Object.defineProperty(exports, "useB3Config", { enumerable: true, get: function () { return useB3Config_1.useB3Config; } });
|
|
23
|
-
var BetterAuthClientProvider_1 = require("./B3Provider/BetterAuthClientProvider");
|
|
24
|
-
Object.defineProperty(exports, "useBetterAuthClient", { enumerable: true, get: function () { return BetterAuthClientProvider_1.useBetterAuthClient; } });
|
|
25
23
|
var StyleRoot_1 = require("./StyleRoot");
|
|
26
24
|
Object.defineProperty(exports, "StyleRoot", { enumerable: true, get: function () { return StyleRoot_1.StyleRoot; } });
|
|
27
25
|
// SignInWithB3 Components
|
|
@@ -9,7 +9,7 @@ const app_1 = __importDefault(require("../../../global-account/app"));
|
|
|
9
9
|
const react_1 = require("../../../global-account/react");
|
|
10
10
|
const debug_1 = require("../../../shared/utils/debug");
|
|
11
11
|
const react_2 = require("react");
|
|
12
|
-
const
|
|
12
|
+
const better_auth_client_1 = require("../../better-auth-client");
|
|
13
13
|
const useUserQuery_1 = require("./useUserQuery");
|
|
14
14
|
const debug = (0, debug_1.debugB3React)("useBetterAuth");
|
|
15
15
|
/** Thrown when email verification is required before the user can sign in. */
|
|
@@ -30,7 +30,6 @@ exports.EmailVerificationRequiredError = EmailVerificationRequiredError;
|
|
|
30
30
|
*/
|
|
31
31
|
function useBetterAuth() {
|
|
32
32
|
const { partnerId } = (0, react_1.useB3Config)();
|
|
33
|
-
const betterAuthClient = (0, BetterAuthClientProvider_1.useBetterAuthClient)();
|
|
34
33
|
const { setUser } = (0, useUserQuery_1.useUserQuery)();
|
|
35
34
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
36
35
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
@@ -58,7 +57,7 @@ function useBetterAuth() {
|
|
|
58
57
|
setHasStartedConnecting(true);
|
|
59
58
|
setIsAuthenticating(true);
|
|
60
59
|
try {
|
|
61
|
-
const result = await betterAuthClient.signIn.email({ email, password });
|
|
60
|
+
const result = await better_auth_client_1.betterAuthClient.signIn.email({ email, password });
|
|
62
61
|
if (result.error) {
|
|
63
62
|
throw new Error(result.error.message || "Sign in failed");
|
|
64
63
|
}
|
|
@@ -73,13 +72,13 @@ function useBetterAuth() {
|
|
|
73
72
|
debug("Sign in failed", error);
|
|
74
73
|
throw error;
|
|
75
74
|
}
|
|
76
|
-
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting
|
|
75
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
77
76
|
const signUpWithEmail = (0, react_2.useCallback)(async (email, password, name, verifyCallbackURL) => {
|
|
78
77
|
debug("Signing up with email", { email, name });
|
|
79
78
|
setHasStartedConnecting(true);
|
|
80
79
|
setIsAuthenticating(true);
|
|
81
80
|
try {
|
|
82
|
-
const result = await betterAuthClient.signUp.email({ email, password, name });
|
|
81
|
+
const result = await better_auth_client_1.betterAuthClient.signUp.email({ email, password, name });
|
|
83
82
|
if (result.error) {
|
|
84
83
|
throw new Error(result.error.message || "Sign up failed");
|
|
85
84
|
}
|
|
@@ -88,7 +87,7 @@ function useBetterAuth() {
|
|
|
88
87
|
// requireEmailVerification is enabled — send verification email with
|
|
89
88
|
// a callbackURL Better Auth redirects to after server-side verify.
|
|
90
89
|
// Pass verifyCallbackURL to land on a dedicated confirmation page.
|
|
91
|
-
await betterAuthClient.sendVerificationEmail({
|
|
90
|
+
await better_auth_client_1.betterAuthClient.sendVerificationEmail({
|
|
92
91
|
email,
|
|
93
92
|
callbackURL: verifyCallbackURL || `${window.location.origin}?authStrategy=better-auth`,
|
|
94
93
|
});
|
|
@@ -101,13 +100,13 @@ function useBetterAuth() {
|
|
|
101
100
|
debug("Sign up failed", error);
|
|
102
101
|
throw error;
|
|
103
102
|
}
|
|
104
|
-
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting
|
|
103
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
105
104
|
const signInWithSocial = (0, react_2.useCallback)(async (provider) => {
|
|
106
105
|
debug("Signing in with social provider", { provider });
|
|
107
106
|
setHasStartedConnecting(true);
|
|
108
107
|
setIsAuthenticating(true);
|
|
109
108
|
try {
|
|
110
|
-
const result = await betterAuthClient.signIn.social({
|
|
109
|
+
const result = await better_auth_client_1.betterAuthClient.signIn.social({
|
|
111
110
|
provider,
|
|
112
111
|
callbackURL: window.location.href,
|
|
113
112
|
});
|
|
@@ -122,10 +121,10 @@ function useBetterAuth() {
|
|
|
122
121
|
debug("Social sign in failed", error);
|
|
123
122
|
throw error;
|
|
124
123
|
}
|
|
125
|
-
}, [setIsAuthenticating, setHasStartedConnecting
|
|
124
|
+
}, [setIsAuthenticating, setHasStartedConnecting]);
|
|
126
125
|
const requestPasswordReset = (0, react_2.useCallback)(async (email, redirectTo) => {
|
|
127
126
|
debug("Requesting password reset", { email });
|
|
128
|
-
const result = await betterAuthClient.requestPasswordReset({
|
|
127
|
+
const result = await better_auth_client_1.betterAuthClient.requestPasswordReset({
|
|
129
128
|
email,
|
|
130
129
|
redirectTo,
|
|
131
130
|
});
|
|
@@ -134,10 +133,10 @@ function useBetterAuth() {
|
|
|
134
133
|
}
|
|
135
134
|
debug("Password reset email sent");
|
|
136
135
|
return result;
|
|
137
|
-
}, [
|
|
136
|
+
}, []);
|
|
138
137
|
const resetPassword = (0, react_2.useCallback)(async (newPassword, token) => {
|
|
139
138
|
debug("Resetting password");
|
|
140
|
-
const result = await betterAuthClient.resetPassword({
|
|
139
|
+
const result = await better_auth_client_1.betterAuthClient.resetPassword({
|
|
141
140
|
newPassword,
|
|
142
141
|
token,
|
|
143
142
|
});
|
|
@@ -146,7 +145,7 @@ function useBetterAuth() {
|
|
|
146
145
|
}
|
|
147
146
|
debug("Password reset successful");
|
|
148
147
|
return result;
|
|
149
|
-
}, [
|
|
148
|
+
}, []);
|
|
150
149
|
return {
|
|
151
150
|
signInWithEmail,
|
|
152
151
|
signUpWithEmail,
|
|
@@ -154,6 +153,6 @@ function useBetterAuth() {
|
|
|
154
153
|
requestPasswordReset,
|
|
155
154
|
resetPassword,
|
|
156
155
|
exchangeForFeathersJWT,
|
|
157
|
-
betterAuthClient,
|
|
156
|
+
betterAuthClient: better_auth_client_1.betterAuthClient,
|
|
158
157
|
};
|
|
159
158
|
}
|
|
@@ -135,6 +135,8 @@ export interface AnySpendModalProps extends BaseModalProps {
|
|
|
135
135
|
disableUrlParamManagement?: boolean;
|
|
136
136
|
/** Staging environment support */
|
|
137
137
|
isStaging?: boolean;
|
|
138
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
139
|
+
showFiatOption?: boolean;
|
|
138
140
|
}
|
|
139
141
|
/**
|
|
140
142
|
* Props for the AnySpend NFT modal
|
|
@@ -151,6 +153,8 @@ export interface AnySpendNftProps extends BaseModalProps {
|
|
|
151
153
|
onSuccess?: (txHash?: string) => void;
|
|
152
154
|
/** Client-provided reference ID for tracking orders */
|
|
153
155
|
clientReferenceId?: string;
|
|
156
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
157
|
+
showFiatOption?: boolean;
|
|
154
158
|
}
|
|
155
159
|
/**
|
|
156
160
|
* Props for the AnySpend tournament modal
|
|
@@ -224,6 +228,8 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
|
|
|
224
228
|
stakeAmount?: string;
|
|
225
229
|
/** Callback function called when the stake is successful */
|
|
226
230
|
onSuccess?: () => void;
|
|
231
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
232
|
+
showFiatOption?: boolean;
|
|
227
233
|
}
|
|
228
234
|
/**
|
|
229
235
|
* Props for the AnySpend Stake B3 (Custom Exact In) modal
|
|
@@ -238,6 +244,8 @@ export interface AnySpendStakeB3ExactInProps extends BaseModalProps {
|
|
|
238
244
|
stakeAmount?: string;
|
|
239
245
|
/** Callback function called when the stake is successful */
|
|
240
246
|
onSuccess?: () => void;
|
|
247
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
248
|
+
showFiatOption?: boolean;
|
|
241
249
|
}
|
|
242
250
|
/**
|
|
243
251
|
* Props for the AnySpend Stake Contract modal
|
|
@@ -258,6 +266,8 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
|
|
|
258
266
|
activeTab?: "crypto" | "fiat";
|
|
259
267
|
/** Callback function called when the stake is successful */
|
|
260
268
|
onSuccess?: () => void;
|
|
269
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
270
|
+
showFiatOption?: boolean;
|
|
261
271
|
}
|
|
262
272
|
/**
|
|
263
273
|
* Props for the AnySpend Stake Upside (Exact In) modal
|
|
@@ -274,6 +284,8 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
274
284
|
token: components["schemas"]["Token"];
|
|
275
285
|
/** Callback function called when the stake is successful */
|
|
276
286
|
onSuccess?: () => void;
|
|
287
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
288
|
+
showFiatOption?: boolean;
|
|
277
289
|
}
|
|
278
290
|
/**
|
|
279
291
|
* Props for the AnySpend Deposit Upside (Exact In) modal
|
|
@@ -296,6 +308,8 @@ export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
|
296
308
|
destinationTokenAmount?: string;
|
|
297
309
|
/** Callback function called when the deposit is successful */
|
|
298
310
|
onSuccess?: () => void;
|
|
311
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
312
|
+
showFiatOption?: boolean;
|
|
299
313
|
}
|
|
300
314
|
/**
|
|
301
315
|
* Props for the AnySpend Buy Spin modal
|
|
@@ -314,6 +328,8 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
|
|
|
314
328
|
onSuccess?: (txHash?: string) => void;
|
|
315
329
|
/** Prefill quantity of spins to purchase */
|
|
316
330
|
prefillQuantity?: string;
|
|
331
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
332
|
+
showFiatOption?: boolean;
|
|
317
333
|
}
|
|
318
334
|
/**
|
|
319
335
|
* Props for the AnySpend Signature Mint modal
|
|
@@ -328,6 +344,8 @@ export interface AnySpendSignatureMintProps extends BaseModalProps {
|
|
|
328
344
|
imageUrl?: string;
|
|
329
345
|
/** Callback function called when minting is successful */
|
|
330
346
|
onSuccess?: (txHash?: string) => void;
|
|
347
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
348
|
+
showFiatOption?: boolean;
|
|
331
349
|
}
|
|
332
350
|
/**
|
|
333
351
|
* Props for the AnySpend bondKit modal
|
|
@@ -352,6 +370,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
|
|
|
352
370
|
b3Amount?: string;
|
|
353
371
|
/** Callback function called when purchase is successful */
|
|
354
372
|
onSuccess?: (txHash?: string) => void;
|
|
373
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
374
|
+
showFiatOption?: boolean;
|
|
355
375
|
}
|
|
356
376
|
export interface LinkAccountModalProps extends BaseModalProps {
|
|
357
377
|
type: "linkAccount";
|
|
@@ -398,6 +418,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
398
418
|
customRecipientLabel?: string;
|
|
399
419
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
400
420
|
returnHomeLabel?: string;
|
|
421
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
422
|
+
showFiatOption?: boolean;
|
|
401
423
|
}
|
|
402
424
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
403
425
|
/** Modal type identifier */
|
|
@@ -483,6 +505,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
483
505
|
isStaging?: boolean;
|
|
484
506
|
/** Optional discount code to apply to the purchase */
|
|
485
507
|
discountCode?: string;
|
|
508
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
509
|
+
showFiatOption?: boolean;
|
|
486
510
|
}
|
|
487
511
|
/**
|
|
488
512
|
* Props for the AnySpend Deposit modal
|
|
@@ -543,6 +567,8 @@ export interface AnySpendCheckoutTriggerModalProps extends BaseModalProps {
|
|
|
543
567
|
returnUrl?: string;
|
|
544
568
|
/** Label for the return button */
|
|
545
569
|
returnLabel?: string;
|
|
570
|
+
/** Whether to show fiat payment options (card + coinbase). Defaults to true. */
|
|
571
|
+
showFiatOption?: boolean;
|
|
546
572
|
}
|
|
547
573
|
export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
|
|
548
574
|
/** Modal type identifier */
|
|
@@ -571,6 +597,8 @@ export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
|
|
|
571
597
|
actionLabel?: string;
|
|
572
598
|
/** Custom class names */
|
|
573
599
|
classes?: AnySpendAllClasses;
|
|
600
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
601
|
+
showFiatOption?: boolean;
|
|
574
602
|
}
|
|
575
603
|
export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
576
604
|
/** Modal type identifier */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
2
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
3
|
-
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, slots, content, theme, }: AnySpendBondKitProps & {
|
|
3
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, slots, content, theme, showFiatOption, }: AnySpendBondKitProps & {
|
|
4
4
|
slots?: AnySpendSlots;
|
|
5
5
|
content?: AnySpendContent;
|
|
6
6
|
theme?: AnySpendTheme;
|
|
@@ -20,7 +20,7 @@ function formatNumberWithCommas(x) {
|
|
|
20
20
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
21
21
|
return parts.join(".");
|
|
22
22
|
}
|
|
23
|
-
export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, slots, content, theme, }) {
|
|
23
|
+
export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, slots, content, theme, showFiatOption, }) {
|
|
24
24
|
const hasMounted = useHasMounted();
|
|
25
25
|
const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
|
|
26
26
|
const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
|
|
@@ -200,5 +200,5 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
200
200
|
});
|
|
201
201
|
return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
202
202
|
action: "BondKit Buy",
|
|
203
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true, slots: slots, content: content, theme: theme }));
|
|
203
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true, slots: slots, content: content, theme: theme, showFiatOption: showFiatOption }));
|
|
204
204
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
2
|
-
export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, senderAddress, slots, content, theme, }: {
|
|
2
|
+
export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, senderAddress, slots, content, theme, showFiatOption, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
spinwheelContractAddress: string;
|
|
@@ -12,4 +12,5 @@ export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddr
|
|
|
12
12
|
slots?: AnySpendSlots;
|
|
13
13
|
content?: AnySpendContent;
|
|
14
14
|
theme?: AnySpendTheme;
|
|
15
|
+
showFiatOption?: boolean;
|
|
15
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -84,7 +84,7 @@ const basePublicClient = createPublicClient({
|
|
|
84
84
|
chain: baseMainnet,
|
|
85
85
|
transport: http(PUBLIC_BASE_RPC_URL),
|
|
86
86
|
});
|
|
87
|
-
export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, senderAddress, slots, content, theme, }) {
|
|
87
|
+
export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, senderAddress, slots, content, theme, showFiatOption, }) {
|
|
88
88
|
const hasMounted = useHasMounted();
|
|
89
89
|
const { setB3ModalOpen } = useModalStore();
|
|
90
90
|
// Payment config state
|
|
@@ -390,5 +390,5 @@ export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAd
|
|
|
390
390
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
391
391
|
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
392
392
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
393
|
-
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false, senderAddress: senderAddress, slots: slots, content: content, theme: theme }));
|
|
393
|
+
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false, senderAddress: senderAddress, slots: slots, content: content, theme: theme, showFiatOption: showFiatOption }));
|
|
394
394
|
}
|
|
@@ -55,6 +55,8 @@ export interface AnySpendCustomExactInProps {
|
|
|
55
55
|
content?: AnySpendContent;
|
|
56
56
|
/** Structured color/theme configuration */
|
|
57
57
|
theme?: AnySpendTheme;
|
|
58
|
+
/** Whether to show fiat payment option. Defaults to true. When false, paymentType is forced to "crypto". */
|
|
59
|
+
showFiatOption?: boolean;
|
|
58
60
|
}
|
|
59
61
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
60
62
|
export {};
|