@b3dotfun/sdk 0.1.66-alpha.0 → 0.1.66-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.
Files changed (127) hide show
  1. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  2. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +30 -0
  3. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  4. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +45 -0
  5. package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  6. package/dist/cjs/anyspend/react/components/checkout/CartItemRow.js +9 -0
  7. package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  8. package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +9 -0
  9. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  10. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +19 -0
  11. package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  12. package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.js +25 -0
  13. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  14. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +45 -0
  15. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  16. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +11 -0
  17. package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  18. package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +27 -0
  19. package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  20. package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.js +317 -0
  21. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  22. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +233 -0
  23. package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  24. package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.js +9 -0
  25. package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  26. package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.js +148 -0
  27. package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
  28. package/dist/cjs/anyspend/react/components/index.js +6 -1
  29. package/dist/cjs/anyspend/react/components/types/classes.d.ts +32 -0
  30. package/dist/cjs/app.shared.js +8 -0
  31. package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -1
  32. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  33. package/dist/cjs/global-account/react/components/ui/command.d.ts +7 -7
  34. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +1 -1
  35. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
  36. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -4
  37. package/dist/cjs/global-account/react/hooks/useUser.d.ts +1 -1
  38. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
  39. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +53 -1
  40. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
  41. package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
  42. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  43. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +27 -0
  44. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  45. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +42 -0
  46. package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  47. package/dist/esm/anyspend/react/components/checkout/CartItemRow.js +6 -0
  48. package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  49. package/dist/esm/anyspend/react/components/checkout/CartSummary.js +6 -0
  50. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  51. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +16 -0
  52. package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  53. package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.js +22 -0
  54. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  55. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +42 -0
  56. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  57. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +8 -0
  58. package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  59. package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +24 -0
  60. package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  61. package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.js +313 -0
  62. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  63. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +230 -0
  64. package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  65. package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.js +6 -0
  66. package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  67. package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.js +145 -0
  68. package/dist/esm/anyspend/react/components/index.d.ts +5 -1
  69. package/dist/esm/anyspend/react/components/index.js +3 -0
  70. package/dist/esm/anyspend/react/components/types/classes.d.ts +32 -0
  71. package/dist/esm/app.shared.js +8 -0
  72. package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -1
  73. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  74. package/dist/esm/global-account/react/components/ui/command.d.ts +7 -7
  75. package/dist/esm/global-account/react/hooks/useAuth.d.ts +1 -1
  76. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
  77. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -4
  78. package/dist/esm/global-account/react/hooks/useUser.d.ts +1 -1
  79. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
  80. package/dist/esm/global-account/react/stores/useModalStore.d.ts +53 -1
  81. package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
  82. package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
  83. package/dist/styles/index.css +1 -1
  84. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  85. package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  86. package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  87. package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  88. package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  89. package/dist/types/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  90. package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  91. package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  92. package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  93. package/dist/types/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  94. package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  95. package/dist/types/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  96. package/dist/types/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  97. package/dist/types/anyspend/react/components/index.d.ts +5 -1
  98. package/dist/types/anyspend/react/components/types/classes.d.ts +32 -0
  99. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  100. package/dist/types/global-account/react/components/ui/command.d.ts +7 -7
  101. package/dist/types/global-account/react/hooks/useAuth.d.ts +1 -1
  102. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
  103. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -4
  104. package/dist/types/global-account/react/hooks/useUser.d.ts +1 -1
  105. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
  106. package/dist/types/global-account/react/stores/useModalStore.d.ts +53 -1
  107. package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
  108. package/dist/types/shared/constants/chains/supported.d.ts +3 -3
  109. package/package.json +1 -1
  110. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +127 -0
  111. package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +166 -0
  112. package/src/anyspend/react/components/checkout/CartItemRow.tsx +43 -0
  113. package/src/anyspend/react/components/checkout/CartSummary.tsx +23 -0
  114. package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +60 -0
  115. package/src/anyspend/react/components/checkout/CheckoutLayout.tsx +72 -0
  116. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +320 -0
  117. package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +91 -0
  118. package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +90 -0
  119. package/src/anyspend/react/components/checkout/CryptoCheckoutPanel.tsx +643 -0
  120. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +568 -0
  121. package/src/anyspend/react/components/checkout/PoweredByBranding.tsx +32 -0
  122. package/src/anyspend/react/components/checkout/QRCheckoutPanel.tsx +320 -0
  123. package/src/anyspend/react/components/index.ts +7 -0
  124. package/src/anyspend/react/components/types/classes.ts +48 -0
  125. package/src/app.shared.ts +11 -0
  126. package/src/global-account/react/components/B3DynamicModal.tsx +5 -0
  127. package/src/global-account/react/stores/useModalStore.ts +52 -1
@@ -0,0 +1,91 @@
1
+ "use client";
2
+
3
+ import { cn } from "@b3dotfun/sdk/shared/utils/cn";
4
+ import { Check, ExternalLink } from "lucide-react";
5
+ import { motion } from "motion/react";
6
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
7
+
8
+ interface CheckoutSuccessProps {
9
+ txHash?: string;
10
+ orderId?: string;
11
+ returnUrl?: string;
12
+ returnLabel?: string;
13
+ classes?: AnySpendCheckoutClasses;
14
+ }
15
+
16
+ export function CheckoutSuccess({ txHash, orderId, returnUrl, returnLabel, classes }: CheckoutSuccessProps) {
17
+ return (
18
+ <div className={cn("anyspend-checkout-success flex flex-col items-center py-8 text-center", classes?.successPanel)}>
19
+ {/* Animated success icon - scale + opacity entry */}
20
+ <motion.div
21
+ initial={{ scale: 0.3, opacity: 0 }}
22
+ animate={{ scale: 1, opacity: 1 }}
23
+ transition={{ duration: 0.5, ease: "easeOut" }}
24
+ className="anyspend-success-icon mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30"
25
+ >
26
+ <Check className="h-8 w-8 text-green-600 dark:text-green-400" />
27
+ </motion.div>
28
+
29
+ {/* Staggered text entry */}
30
+ <motion.h2
31
+ initial={{ opacity: 0, y: 10 }}
32
+ animate={{ opacity: 1, y: 0 }}
33
+ transition={{ duration: 0.3, delay: 0.2, ease: "easeOut" }}
34
+ className="anyspend-success-title text-xl font-semibold text-gray-900 dark:text-gray-100"
35
+ >
36
+ Payment Successful
37
+ </motion.h2>
38
+
39
+ <motion.p
40
+ initial={{ opacity: 0, y: 10 }}
41
+ animate={{ opacity: 1, y: 0 }}
42
+ transition={{ duration: 0.3, delay: 0.35, ease: "easeOut" }}
43
+ className="anyspend-success-description mt-2 text-sm text-gray-500 dark:text-gray-400"
44
+ >
45
+ Your payment has been processed successfully.
46
+ </motion.p>
47
+
48
+ {txHash && (
49
+ <motion.a
50
+ initial={{ opacity: 0 }}
51
+ animate={{ opacity: 1 }}
52
+ transition={{ duration: 0.3, delay: 0.5, ease: "easeOut" }}
53
+ href={`https://explorer.b3.fun/tx/${txHash}`}
54
+ target="_blank"
55
+ rel="noopener noreferrer"
56
+ className="anyspend-success-tx-link mt-4 flex items-center gap-1.5 text-sm text-blue-600 hover:underline dark:text-blue-400"
57
+ >
58
+ View Transaction
59
+ <ExternalLink className="h-3.5 w-3.5" />
60
+ </motion.a>
61
+ )}
62
+
63
+ {!txHash && orderId && (
64
+ <motion.p
65
+ initial={{ opacity: 0 }}
66
+ animate={{ opacity: 1 }}
67
+ transition={{ duration: 0.3, delay: 0.5, ease: "easeOut" }}
68
+ className="anyspend-success-order-id mt-4 text-xs text-gray-400 dark:text-gray-500"
69
+ >
70
+ Order ID: {orderId}
71
+ </motion.p>
72
+ )}
73
+
74
+ {returnUrl && (
75
+ <motion.a
76
+ initial={{ opacity: 0, y: 10 }}
77
+ animate={{ opacity: 1, y: 0 }}
78
+ transition={{ duration: 0.3, delay: 0.6, ease: "easeOut" }}
79
+ href={returnUrl}
80
+ className={cn(
81
+ "anyspend-success-return-btn mt-6 inline-flex rounded-xl px-6 py-3 text-sm font-medium transition-colors",
82
+ classes?.returnButton,
83
+ )}
84
+ style={{ backgroundColor: "#111827", color: "#fff" }}
85
+ >
86
+ {returnLabel || "Return to Store"}
87
+ </motion.a>
88
+ )}
89
+ </div>
90
+ );
91
+ }
@@ -0,0 +1,90 @@
1
+ "use client";
2
+
3
+ import { useGeoOnrampOptions } from "@b3dotfun/sdk/anyspend/react";
4
+ import { cn } from "@b3dotfun/sdk/shared/utils/cn";
5
+ import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
6
+ import { TextShimmer, useTokenData } from "@b3dotfun/sdk/global-account/react";
7
+ import { Loader2 } from "lucide-react";
8
+ import { motion } from "motion/react";
9
+ import { useMemo } from "react";
10
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
11
+
12
+ interface CoinbaseCheckoutPanelProps {
13
+ recipientAddress: string;
14
+ destinationTokenAddress: string;
15
+ destinationTokenChainId: number;
16
+ totalAmount: string;
17
+ themeColor?: string;
18
+ onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
19
+ onError?: (error: Error) => void;
20
+ classes?: AnySpendCheckoutClasses;
21
+ }
22
+
23
+ export function CoinbaseCheckoutPanel({
24
+ destinationTokenAddress,
25
+ destinationTokenChainId,
26
+ totalAmount,
27
+ themeColor,
28
+ }: CoinbaseCheckoutPanelProps) {
29
+ const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
30
+
31
+ const formattedAmount = useMemo(() => {
32
+ const decimals = tokenData?.decimals || 18;
33
+ return formatTokenAmount(BigInt(totalAmount), decimals);
34
+ }, [totalAmount, tokenData]);
35
+
36
+ const { coinbaseAvailablePaymentMethods, isLoading } = useGeoOnrampOptions(formattedAmount);
37
+
38
+ if (isLoading) {
39
+ return (
40
+ <motion.div
41
+ initial={{ opacity: 0 }}
42
+ animate={{ opacity: 1 }}
43
+ transition={{ duration: 0.2, ease: "easeOut" }}
44
+ className="anyspend-coinbase-loading flex items-center justify-center py-6"
45
+ >
46
+ <Loader2 className="h-5 w-5 animate-spin text-gray-400" />
47
+ <TextShimmer duration={1.5} className="ml-2 text-sm">
48
+ Checking availability...
49
+ </TextShimmer>
50
+ </motion.div>
51
+ );
52
+ }
53
+
54
+ if (coinbaseAvailablePaymentMethods.length === 0) {
55
+ return (
56
+ <motion.div
57
+ initial={{ opacity: 0, y: 8 }}
58
+ animate={{ opacity: 1, y: 0 }}
59
+ transition={{ duration: 0.25, ease: "easeOut" }}
60
+ className="anyspend-coinbase-unavailable py-4 text-center"
61
+ >
62
+ <p className="text-sm text-gray-500 dark:text-gray-400">
63
+ Coinbase Pay is not available in your region for this amount.
64
+ </p>
65
+ </motion.div>
66
+ );
67
+ }
68
+
69
+ return (
70
+ <motion.div
71
+ initial={{ opacity: 0, y: 10 }}
72
+ animate={{ opacity: 1, y: 0 }}
73
+ transition={{ duration: 0.3, ease: "easeOut" }}
74
+ className="anyspend-coinbase-panel flex flex-col gap-3"
75
+ >
76
+ <p className="anyspend-coinbase-description text-sm text-gray-600 dark:text-gray-400">
77
+ Pay with your Coinbase account using debit card, bank account, or crypto balance.
78
+ </p>
79
+ <button
80
+ className={cn(
81
+ "anyspend-coinbase-btn w-full rounded-xl px-4 py-3 text-sm font-semibold text-white transition-all",
82
+ "bg-[#0052FF] hover:bg-[#003ECF] active:scale-[0.98]",
83
+ )}
84
+ style={themeColor ? { backgroundColor: themeColor } : undefined}
85
+ >
86
+ Continue with Coinbase
87
+ </button>
88
+ </motion.div>
89
+ );
90
+ }