@b3dotfun/sdk 0.1.70-alpha.1 → 0.1.70
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
|
@@ -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 */
|
package/package.json
CHANGED
|
@@ -42,6 +42,7 @@ export function AnySpendBondKit({
|
|
|
42
42
|
slots,
|
|
43
43
|
content,
|
|
44
44
|
theme,
|
|
45
|
+
showFiatOption,
|
|
45
46
|
}: AnySpendBondKitProps & {
|
|
46
47
|
slots?: AnySpendSlots;
|
|
47
48
|
content?: AnySpendContent;
|
|
@@ -382,6 +383,7 @@ export function AnySpendBondKit({
|
|
|
382
383
|
slots={slots}
|
|
383
384
|
content={content}
|
|
384
385
|
theme={theme}
|
|
386
|
+
showFiatOption={showFiatOption}
|
|
385
387
|
/>
|
|
386
388
|
);
|
|
387
389
|
}
|
|
@@ -135,6 +135,7 @@ export function AnySpendBuySpin({
|
|
|
135
135
|
slots,
|
|
136
136
|
content,
|
|
137
137
|
theme,
|
|
138
|
+
showFiatOption,
|
|
138
139
|
}: {
|
|
139
140
|
loadOrder?: string;
|
|
140
141
|
mode?: "modal" | "page";
|
|
@@ -148,6 +149,7 @@ export function AnySpendBuySpin({
|
|
|
148
149
|
slots?: AnySpendSlots;
|
|
149
150
|
content?: AnySpendContent;
|
|
150
151
|
theme?: AnySpendTheme;
|
|
152
|
+
showFiatOption?: boolean;
|
|
151
153
|
}) {
|
|
152
154
|
const hasMounted = useHasMounted();
|
|
153
155
|
const { setB3ModalOpen } = useModalStore();
|
|
@@ -695,6 +697,7 @@ export function AnySpendBuySpin({
|
|
|
695
697
|
slots={slots}
|
|
696
698
|
content={content}
|
|
697
699
|
theme={theme}
|
|
700
|
+
showFiatOption={showFiatOption}
|
|
698
701
|
/>
|
|
699
702
|
);
|
|
700
703
|
}
|
|
@@ -96,6 +96,8 @@ export interface AnySpendCustomExactInProps {
|
|
|
96
96
|
content?: AnySpendContent;
|
|
97
97
|
/** Structured color/theme configuration */
|
|
98
98
|
theme?: AnySpendTheme;
|
|
99
|
+
/** Whether to show fiat payment option. Defaults to true. When false, paymentType is forced to "crypto". */
|
|
100
|
+
showFiatOption?: boolean;
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
export function AnySpendCustomExactIn(props: AnySpendCustomExactInProps) {
|
|
@@ -137,8 +139,10 @@ function AnySpendCustomExactInInner({
|
|
|
137
139
|
allowDirectTransfer = false,
|
|
138
140
|
callbackMetadata,
|
|
139
141
|
senderAddress,
|
|
142
|
+
showFiatOption = true,
|
|
140
143
|
}: AnySpendCustomExactInProps) {
|
|
141
144
|
const { slots, content } = useAnySpendCustomization();
|
|
145
|
+
const effectivePaymentType = showFiatOption ? paymentType : "crypto";
|
|
142
146
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
143
147
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
144
148
|
|
|
@@ -191,7 +195,7 @@ function AnySpendCustomExactInInner({
|
|
|
191
195
|
createOnrampOrder,
|
|
192
196
|
isCreatingOnrampOrder,
|
|
193
197
|
} = useAnyspendFlow({
|
|
194
|
-
paymentType,
|
|
198
|
+
paymentType: effectivePaymentType,
|
|
195
199
|
recipientAddress,
|
|
196
200
|
loadOrder,
|
|
197
201
|
onTransactionSuccess: onSuccess,
|
|
@@ -213,11 +217,17 @@ function AnySpendCustomExactInInner({
|
|
|
213
217
|
// Check if source and destination are the same token on the same chain
|
|
214
218
|
const isSameChainSameToken = useMemo(() => {
|
|
215
219
|
return (
|
|
216
|
-
|
|
220
|
+
effectivePaymentType === "crypto" &&
|
|
217
221
|
selectedSrcChainId === selectedDstChainId &&
|
|
218
222
|
selectedSrcToken?.address?.toLowerCase() === selectedDstToken?.address?.toLowerCase()
|
|
219
223
|
);
|
|
220
|
-
}, [
|
|
224
|
+
}, [
|
|
225
|
+
effectivePaymentType,
|
|
226
|
+
selectedSrcChainId,
|
|
227
|
+
selectedDstChainId,
|
|
228
|
+
selectedSrcToken?.address,
|
|
229
|
+
selectedDstToken?.address,
|
|
230
|
+
]);
|
|
221
231
|
|
|
222
232
|
// Check if this is a direct transfer
|
|
223
233
|
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
@@ -322,7 +332,7 @@ function AnySpendCustomExactInInner({
|
|
|
322
332
|
}
|
|
323
333
|
}
|
|
324
334
|
|
|
325
|
-
if (
|
|
335
|
+
if (effectivePaymentType === "crypto") {
|
|
326
336
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.NONE) {
|
|
327
337
|
return { text: "Choose payment method", disable: false, error: false, loading: false };
|
|
328
338
|
}
|
|
@@ -342,7 +352,7 @@ function AnySpendCustomExactInInner({
|
|
|
342
352
|
return { text: buttonText, disable: false, error: false, loading: false };
|
|
343
353
|
}
|
|
344
354
|
|
|
345
|
-
if (
|
|
355
|
+
if (effectivePaymentType === "fiat") {
|
|
346
356
|
if (selectedFiatPaymentMethod === FiatPaymentMethod.NONE) {
|
|
347
357
|
return { text: "Select payment method", disable: false, error: false, loading: false };
|
|
348
358
|
}
|
|
@@ -358,7 +368,7 @@ function AnySpendCustomExactInInner({
|
|
|
358
368
|
isSwitchingOrExecuting,
|
|
359
369
|
selectedRecipientOrDefault,
|
|
360
370
|
anyspendQuote,
|
|
361
|
-
|
|
371
|
+
effectivePaymentType,
|
|
362
372
|
effectiveCryptoPaymentMethod,
|
|
363
373
|
selectedFiatPaymentMethod,
|
|
364
374
|
hasEnoughBalance,
|
|
@@ -386,13 +396,13 @@ function AnySpendCustomExactInInner({
|
|
|
386
396
|
return;
|
|
387
397
|
}
|
|
388
398
|
|
|
389
|
-
if (
|
|
399
|
+
if (effectivePaymentType === "crypto") {
|
|
390
400
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.NONE) {
|
|
391
401
|
setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD);
|
|
392
402
|
return;
|
|
393
403
|
}
|
|
394
404
|
await handleCryptoOrder();
|
|
395
|
-
} else if (
|
|
405
|
+
} else if (effectivePaymentType === "fiat") {
|
|
396
406
|
if (selectedFiatPaymentMethod === FiatPaymentMethod.NONE) {
|
|
397
407
|
setActivePanel(PanelView.FIAT_PAYMENT_METHOD);
|
|
398
408
|
return;
|
|
@@ -423,7 +433,7 @@ function AnySpendCustomExactInInner({
|
|
|
423
433
|
|
|
424
434
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|
|
425
435
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|
|
426
|
-
{
|
|
436
|
+
{effectivePaymentType === "crypto" ? (
|
|
427
437
|
<CryptoPaySection
|
|
428
438
|
selectedSrcChainId={selectedSrcChainId}
|
|
429
439
|
setSelectedSrcChainId={setSelectedSrcChainId}
|
|
@@ -469,7 +479,10 @@ function AnySpendCustomExactInInner({
|
|
|
469
479
|
)}
|
|
470
480
|
|
|
471
481
|
<div
|
|
472
|
-
className={cn(
|
|
482
|
+
className={cn(
|
|
483
|
+
"relative -my-1 flex h-0 items-center justify-center",
|
|
484
|
+
effectivePaymentType === "fiat" && "hidden",
|
|
485
|
+
)}
|
|
473
486
|
>
|
|
474
487
|
<Button
|
|
475
488
|
variant="ghost"
|
|
@@ -484,7 +497,7 @@ function AnySpendCustomExactInInner({
|
|
|
484
497
|
</Button>
|
|
485
498
|
</div>
|
|
486
499
|
|
|
487
|
-
{
|
|
500
|
+
{effectivePaymentType === "crypto" && (
|
|
488
501
|
<CryptoReceiveSection
|
|
489
502
|
isDepositMode={false}
|
|
490
503
|
isBuyMode={false}
|
|
@@ -551,7 +564,7 @@ function AnySpendCustomExactInInner({
|
|
|
551
564
|
</motion.div>
|
|
552
565
|
|
|
553
566
|
{/* Gas indicator - show when source chain has gas data, hide for direct transfers */}
|
|
554
|
-
{gasPriceData && !isLoadingGas &&
|
|
567
|
+
{gasPriceData && !isLoadingGas && effectivePaymentType === "crypto" && !isDirectTransfer && (
|
|
555
568
|
<GasIndicator gasPrice={gasPriceData} className={classes?.gasIndicator || "mt-2 w-full"} />
|
|
556
569
|
)}
|
|
557
570
|
|
|
@@ -735,7 +748,9 @@ function AnySpendCustomExactInInner({
|
|
|
735
748
|
relayTxs={oat.data.relayTxs}
|
|
736
749
|
executeTx={oat.data.executeTx}
|
|
737
750
|
refundTxs={oat.data.refundTxs}
|
|
738
|
-
cryptoPaymentMethod={
|
|
751
|
+
cryptoPaymentMethod={
|
|
752
|
+
effectivePaymentType === "fiat" ? CryptoPaymentMethodType.NONE : effectiveCryptoPaymentMethod
|
|
753
|
+
}
|
|
739
754
|
selectedCryptoPaymentMethod={effectiveCryptoPaymentMethod}
|
|
740
755
|
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
741
756
|
onBack={() => {
|
|
@@ -806,7 +821,7 @@ function AnySpendCustomExactInInner({
|
|
|
806
821
|
<FeeDetailPanel
|
|
807
822
|
fee={anyspendQuote.data.fee}
|
|
808
823
|
transactionAmountUsd={
|
|
809
|
-
|
|
824
|
+
effectivePaymentType === "fiat"
|
|
810
825
|
? parseFloat(srcAmount)
|
|
811
826
|
: anyspendQuote.data.currencyIn?.amountUsd
|
|
812
827
|
? Number(anyspendQuote.data.currencyIn.amountUsd)
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
NetworkPolygonPos,
|
|
12
12
|
} from "@web3icons/react";
|
|
13
13
|
import { ChevronRight } from "lucide-react";
|
|
14
|
-
import { useMemo, useState } from "react";
|
|
14
|
+
import { useEffect, useMemo, useState } from "react";
|
|
15
15
|
import { AnySpend } from "./AnySpend";
|
|
16
16
|
import { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
17
17
|
import { ChainWarningText } from "./common/WarningText";
|
|
@@ -273,12 +273,20 @@ export function AnySpendDeposit({
|
|
|
273
273
|
const { connectedEOAWallet } = useAccountWallet();
|
|
274
274
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
275
275
|
|
|
276
|
+
const effectiveInitialPaymentType = !showFiatOption && initialPaymentType === "fiat" ? "crypto" : initialPaymentType;
|
|
277
|
+
|
|
276
278
|
// Determine if we should show chain selection
|
|
277
|
-
const shouldShowChainSelection = showChainSelection ?? (!initialSourceChainId && !
|
|
279
|
+
const shouldShowChainSelection = showChainSelection ?? (!initialSourceChainId && !effectiveInitialPaymentType);
|
|
278
280
|
|
|
279
281
|
const [step, setStep] = useState<DepositStep>(shouldShowChainSelection ? "select-chain" : "deposit");
|
|
280
282
|
const [selectedChainId, setSelectedChainId] = useState<number | undefined>(initialSourceChainId);
|
|
281
|
-
const [paymentType, setPaymentType] = useState<"crypto" | "fiat">(
|
|
283
|
+
const [paymentType, setPaymentType] = useState<"crypto" | "fiat">(effectiveInitialPaymentType ?? "crypto");
|
|
284
|
+
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (!showFiatOption && paymentType === "fiat") {
|
|
287
|
+
setPaymentType("crypto");
|
|
288
|
+
}
|
|
289
|
+
}, [showFiatOption, paymentType]);
|
|
282
290
|
|
|
283
291
|
// Fetch destination token data
|
|
284
292
|
const { data: destinationTokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
@@ -723,6 +731,7 @@ export function AnySpendDeposit({
|
|
|
723
731
|
destinationTokenAmount={destinationTokenAmount}
|
|
724
732
|
callbackMetadata={callbackMetadata}
|
|
725
733
|
senderAddress={senderAddress}
|
|
734
|
+
showFiatOption={showFiatOption}
|
|
726
735
|
slots={slots}
|
|
727
736
|
content={content}
|
|
728
737
|
theme={theme}
|
|
@@ -751,6 +760,7 @@ export function AnySpendDeposit({
|
|
|
751
760
|
destinationTokenAmount={destinationTokenAmount}
|
|
752
761
|
callbackMetadata={callbackMetadata}
|
|
753
762
|
senderAddress={senderAddress}
|
|
763
|
+
showFiatOption={showFiatOption}
|
|
754
764
|
slots={slots}
|
|
755
765
|
content={content}
|
|
756
766
|
theme={theme}
|
|
@@ -35,6 +35,7 @@ export function AnySpendDepositUpside({
|
|
|
35
35
|
token,
|
|
36
36
|
onSuccess,
|
|
37
37
|
senderAddress,
|
|
38
|
+
showFiatOption,
|
|
38
39
|
slots,
|
|
39
40
|
content,
|
|
40
41
|
theme,
|
|
@@ -49,6 +50,7 @@ export function AnySpendDepositUpside({
|
|
|
49
50
|
onSuccess?: (amount: string) => void;
|
|
50
51
|
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
51
52
|
senderAddress?: string;
|
|
53
|
+
showFiatOption?: boolean;
|
|
52
54
|
slots?: AnySpendSlots;
|
|
53
55
|
content?: AnySpendContent;
|
|
54
56
|
theme?: AnySpendTheme;
|
|
@@ -87,6 +89,7 @@ export function AnySpendDepositUpside({
|
|
|
87
89
|
header={header}
|
|
88
90
|
onSuccess={onSuccess}
|
|
89
91
|
senderAddress={senderAddress}
|
|
92
|
+
showFiatOption={showFiatOption}
|
|
90
93
|
slots={slots}
|
|
91
94
|
content={content}
|
|
92
95
|
theme={theme}
|
|
@@ -54,6 +54,7 @@ export function AnySpendStakeB3({
|
|
|
54
54
|
slots,
|
|
55
55
|
content,
|
|
56
56
|
theme,
|
|
57
|
+
showFiatOption,
|
|
57
58
|
}: {
|
|
58
59
|
loadOrder?: string;
|
|
59
60
|
mode?: "modal" | "page";
|
|
@@ -65,6 +66,7 @@ export function AnySpendStakeB3({
|
|
|
65
66
|
slots?: AnySpendSlots;
|
|
66
67
|
content?: AnySpendContent;
|
|
67
68
|
theme?: AnySpendTheme;
|
|
69
|
+
showFiatOption?: boolean;
|
|
68
70
|
}) {
|
|
69
71
|
const hasMounted = useHasMounted();
|
|
70
72
|
const { setB3ModalOpen } = useModalStore();
|
|
@@ -521,6 +523,7 @@ export function AnySpendStakeB3({
|
|
|
521
523
|
slots={slots}
|
|
522
524
|
content={content}
|
|
523
525
|
theme={theme}
|
|
526
|
+
showFiatOption={showFiatOption}
|
|
524
527
|
/>
|
|
525
528
|
);
|
|
526
529
|
}
|
|
@@ -56,6 +56,7 @@ export function AnySpendStakeB3ExactIn({
|
|
|
56
56
|
stakeAmount,
|
|
57
57
|
onSuccess,
|
|
58
58
|
senderAddress,
|
|
59
|
+
showFiatOption,
|
|
59
60
|
slots,
|
|
60
61
|
content,
|
|
61
62
|
theme,
|
|
@@ -69,6 +70,7 @@ export function AnySpendStakeB3ExactIn({
|
|
|
69
70
|
onSuccess?: (amount: string) => void;
|
|
70
71
|
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
71
72
|
senderAddress?: string;
|
|
73
|
+
showFiatOption?: boolean;
|
|
72
74
|
slots?: AnySpendSlots;
|
|
73
75
|
content?: AnySpendContent;
|
|
74
76
|
theme?: AnySpendTheme;
|
|
@@ -529,6 +531,7 @@ export function AnySpendStakeB3ExactIn({
|
|
|
529
531
|
header={header}
|
|
530
532
|
onSuccess={onSuccess}
|
|
531
533
|
senderAddress={senderAddress}
|
|
534
|
+
showFiatOption={showFiatOption}
|
|
532
535
|
slots={slots}
|
|
533
536
|
content={content}
|
|
534
537
|
theme={theme}
|
|
@@ -28,6 +28,7 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
28
28
|
token,
|
|
29
29
|
onSuccess,
|
|
30
30
|
senderAddress,
|
|
31
|
+
showFiatOption,
|
|
31
32
|
slots,
|
|
32
33
|
content,
|
|
33
34
|
theme,
|
|
@@ -43,6 +44,7 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
43
44
|
onSuccess?: (amount: string) => void;
|
|
44
45
|
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
45
46
|
senderAddress?: string;
|
|
47
|
+
showFiatOption?: boolean;
|
|
46
48
|
slots?: AnySpendSlots;
|
|
47
49
|
content?: AnySpendContent;
|
|
48
50
|
theme?: AnySpendTheme;
|
|
@@ -82,6 +84,7 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
82
84
|
header={header}
|
|
83
85
|
onSuccess={onSuccess}
|
|
84
86
|
senderAddress={senderAddress}
|
|
87
|
+
showFiatOption={showFiatOption}
|
|
85
88
|
slots={slots}
|
|
86
89
|
content={content}
|
|
87
90
|
theme={theme}
|
|
@@ -30,6 +30,8 @@ export interface AnySpendWorkflowTriggerProps {
|
|
|
30
30
|
actionLabel?: string;
|
|
31
31
|
/** Custom class names */
|
|
32
32
|
classes?: AnySpendAllClasses;
|
|
33
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
34
|
+
showFiatOption?: boolean;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export function AnySpendWorkflowTrigger({
|
|
@@ -45,6 +47,7 @@ export function AnySpendWorkflowTrigger({
|
|
|
45
47
|
mode,
|
|
46
48
|
actionLabel,
|
|
47
49
|
classes,
|
|
50
|
+
showFiatOption,
|
|
48
51
|
}: AnySpendWorkflowTriggerProps) {
|
|
49
52
|
const metadata = useMemo(
|
|
50
53
|
() => ({
|
|
@@ -68,6 +71,7 @@ export function AnySpendWorkflowTrigger({
|
|
|
68
71
|
actionLabel={actionLabel}
|
|
69
72
|
classes={classes}
|
|
70
73
|
allowDirectTransfer
|
|
74
|
+
showFiatOption={showFiatOption}
|
|
71
75
|
/>
|
|
72
76
|
);
|
|
73
77
|
}
|
|
@@ -32,6 +32,7 @@ export interface AnySpendDepositHypeProps {
|
|
|
32
32
|
customRecipientLabel?: string;
|
|
33
33
|
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
34
34
|
senderAddress?: string;
|
|
35
|
+
showFiatOption?: boolean;
|
|
35
36
|
slots?: AnySpendSlots;
|
|
36
37
|
content?: AnySpendContent;
|
|
37
38
|
theme?: AnySpendTheme;
|
|
@@ -51,6 +52,7 @@ export function AnySpendDepositHype({
|
|
|
51
52
|
customUsdInputValues,
|
|
52
53
|
preferEoa,
|
|
53
54
|
senderAddress,
|
|
55
|
+
showFiatOption,
|
|
54
56
|
slots,
|
|
55
57
|
content,
|
|
56
58
|
theme,
|
|
@@ -97,6 +99,7 @@ export function AnySpendDepositHype({
|
|
|
97
99
|
customUsdInputValues={customUsdInputValues}
|
|
98
100
|
preferEoa={preferEoa}
|
|
99
101
|
senderAddress={senderAddress}
|
|
102
|
+
showFiatOption={showFiatOption}
|
|
100
103
|
slots={slots}
|
|
101
104
|
content={content}
|
|
102
105
|
theme={theme}
|
|
@@ -48,6 +48,7 @@ export function AnyspendSignatureMint({
|
|
|
48
48
|
signatureData,
|
|
49
49
|
imageUrl,
|
|
50
50
|
onSuccess,
|
|
51
|
+
showFiatOption,
|
|
51
52
|
slots,
|
|
52
53
|
content,
|
|
53
54
|
theme,
|
|
@@ -57,6 +58,7 @@ export function AnyspendSignatureMint({
|
|
|
57
58
|
signatureData: GenerateSigMintResponse;
|
|
58
59
|
imageUrl?: string;
|
|
59
60
|
onSuccess?: (txHash?: string) => void;
|
|
61
|
+
showFiatOption?: boolean;
|
|
60
62
|
slots?: AnySpendSlots;
|
|
61
63
|
content?: AnySpendContent;
|
|
62
64
|
theme?: AnySpendTheme;
|
|
@@ -156,6 +158,7 @@ export function AnyspendSignatureMint({
|
|
|
156
158
|
header={header}
|
|
157
159
|
onSuccess={onSuccess}
|
|
158
160
|
showRecipient={true}
|
|
161
|
+
showFiatOption={showFiatOption}
|
|
159
162
|
slots={slots}
|
|
160
163
|
content={content}
|
|
161
164
|
theme={theme}
|
|
@@ -140,6 +140,8 @@ export interface AnySpendCheckoutProps {
|
|
|
140
140
|
kycEnabled?: boolean;
|
|
141
141
|
/** Extra metadata included under the 'callbackMetadata' key in the order's callbackMetadata (e.g. workflowId, orgId from checkout session) */
|
|
142
142
|
callbackMetadata?: Record<string, unknown>;
|
|
143
|
+
/** Whether to show fiat payment options (card + coinbase). Defaults to true. */
|
|
144
|
+
showFiatOption?: boolean;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
const emptyAddress: AddressData = { street: "", city: "", state: "", zip: "", country: "" };
|
|
@@ -190,6 +192,7 @@ export function AnySpendCheckout({
|
|
|
190
192
|
feeOnTop,
|
|
191
193
|
kycEnabled = false,
|
|
192
194
|
callbackMetadata: callbackMetadataProp,
|
|
195
|
+
showFiatOption,
|
|
193
196
|
}: AnySpendCheckoutProps) {
|
|
194
197
|
// ===== Variable pricing state =====
|
|
195
198
|
const [variablePricingAmount, setVariablePricingAmount] = useState<string>("0");
|
|
@@ -452,6 +455,7 @@ export function AnySpendCheckout({
|
|
|
452
455
|
isFormValid={isFormValid}
|
|
453
456
|
feeOnTop={feeOnTop}
|
|
454
457
|
kycEnabled={kycEnabled}
|
|
458
|
+
showFiatOption={showFiatOption}
|
|
455
459
|
/>
|
|
456
460
|
</>
|
|
457
461
|
}
|
|
@@ -75,6 +75,8 @@ export interface AnySpendCheckoutTriggerProps {
|
|
|
75
75
|
summaryLines?: CheckoutSummaryLine[];
|
|
76
76
|
/** When true, identity verification (KYC) is required before card payment. Defaults to false. */
|
|
77
77
|
kycEnabled?: boolean;
|
|
78
|
+
/** Whether to show fiat payment options (card + coinbase). Defaults to true. */
|
|
79
|
+
showFiatOption?: boolean;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
export function AnySpendCheckoutTrigger({
|
|
@@ -106,6 +108,7 @@ export function AnySpendCheckoutTrigger({
|
|
|
106
108
|
discount,
|
|
107
109
|
summaryLines,
|
|
108
110
|
kycEnabled = false,
|
|
111
|
+
showFiatOption,
|
|
109
112
|
}: AnySpendCheckoutTriggerProps) {
|
|
110
113
|
// Merge workflowId + orgId into callbackMetadata
|
|
111
114
|
const mergedMetadata = useMemo(() => {
|
|
@@ -216,6 +219,7 @@ export function AnySpendCheckoutTrigger({
|
|
|
216
219
|
defaultPaymentMethod={defaultPaymentMethod}
|
|
217
220
|
senderAddress={senderAddress}
|
|
218
221
|
kycEnabled={kycEnabled}
|
|
222
|
+
showFiatOption={showFiatOption}
|
|
219
223
|
/>
|
|
220
224
|
</div>
|
|
221
225
|
</div>
|