@varity-labs/ui-kit 2.0.0-beta.7 → 2.0.0-beta.8

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 (242) hide show
  1. package/README.md +1 -1
  2. package/dist/components/PaymentWidget/PaymentWidget.d.ts +7 -19
  3. package/dist/components/PaymentWidget/PaymentWidget.d.ts.map +1 -1
  4. package/dist/components/PaymentWidget/PaymentWidget.js +10 -176
  5. package/dist/components/PaymentWidget/PaymentWidget.js.map +1 -1
  6. package/dist/components/PaymentWidget/useSeamlessPayment.d.ts +8 -34
  7. package/dist/components/PaymentWidget/useSeamlessPayment.d.ts.map +1 -1
  8. package/dist/components/PaymentWidget/useSeamlessPayment.js +12 -158
  9. package/dist/components/PaymentWidget/useSeamlessPayment.js.map +1 -1
  10. package/dist/components/PaymentWidget/useVarityPayment.d.ts +5 -6
  11. package/dist/components/PaymentWidget/useVarityPayment.d.ts.map +1 -1
  12. package/dist/components/PaymentWidget/useVarityPayment.js +11 -147
  13. package/dist/components/PaymentWidget/useVarityPayment.js.map +1 -1
  14. package/dist/providers/PrivyStack.d.ts +14 -9
  15. package/dist/providers/PrivyStack.d.ts.map +1 -1
  16. package/dist/providers/PrivyStack.js +2 -4
  17. package/dist/providers/PrivyStack.js.map +1 -1
  18. package/dist/providers/VarityDashboardProvider.d.ts +2 -2
  19. package/dist/providers/VarityDashboardProvider.d.ts.map +1 -1
  20. package/dist/providers/VarityDashboardProvider.js +3 -26
  21. package/dist/providers/VarityDashboardProvider.js.map +1 -1
  22. package/dist/providers/WalletSyncProvider.d.ts +3 -7
  23. package/dist/providers/WalletSyncProvider.d.ts.map +1 -1
  24. package/dist/providers/WalletSyncProvider.js +6 -14
  25. package/dist/providers/WalletSyncProvider.js.map +1 -1
  26. package/package.json +20 -20
  27. package/dist/components/Analytics/__tests__/DataTable.test.d.ts +0 -2
  28. package/dist/components/Analytics/__tests__/DataTable.test.d.ts.map +0 -1
  29. package/dist/components/Analytics/__tests__/DataTable.test.js +0 -113
  30. package/dist/components/Analytics/__tests__/DataTable.test.js.map +0 -1
  31. package/dist/components/Dashboard/__tests__/EmptyState.test.d.ts +0 -2
  32. package/dist/components/Dashboard/__tests__/EmptyState.test.d.ts.map +0 -1
  33. package/dist/components/Dashboard/__tests__/EmptyState.test.js +0 -81
  34. package/dist/components/Dashboard/__tests__/EmptyState.test.js.map +0 -1
  35. package/dist/components/Dashboard/__tests__/KPICard.test.d.ts +0 -2
  36. package/dist/components/Dashboard/__tests__/KPICard.test.d.ts.map +0 -1
  37. package/dist/components/Dashboard/__tests__/KPICard.test.js +0 -78
  38. package/dist/components/Dashboard/__tests__/KPICard.test.js.map +0 -1
  39. package/dist/components/InAppWallet/EmailLoginButton.d.ts +0 -27
  40. package/dist/components/InAppWallet/EmailLoginButton.d.ts.map +0 -1
  41. package/dist/components/InAppWallet/EmailLoginButton.js +0 -84
  42. package/dist/components/InAppWallet/EmailLoginButton.js.map +0 -1
  43. package/dist/components/InAppWallet/InAppWalletProvider.d.ts +0 -54
  44. package/dist/components/InAppWallet/InAppWalletProvider.d.ts.map +0 -1
  45. package/dist/components/InAppWallet/InAppWalletProvider.js +0 -225
  46. package/dist/components/InAppWallet/InAppWalletProvider.js.map +0 -1
  47. package/dist/components/InAppWallet/OnboardingFlow.d.ts +0 -25
  48. package/dist/components/InAppWallet/OnboardingFlow.d.ts.map +0 -1
  49. package/dist/components/InAppWallet/OnboardingFlow.js +0 -159
  50. package/dist/components/InAppWallet/OnboardingFlow.js.map +0 -1
  51. package/dist/components/InAppWallet/SocialLoginButtons.d.ts +0 -28
  52. package/dist/components/InAppWallet/SocialLoginButtons.d.ts.map +0 -1
  53. package/dist/components/InAppWallet/SocialLoginButtons.js +0 -128
  54. package/dist/components/InAppWallet/SocialLoginButtons.js.map +0 -1
  55. package/dist/components/InAppWallet/index.d.ts +0 -15
  56. package/dist/components/InAppWallet/index.d.ts.map +0 -1
  57. package/dist/components/InAppWallet/index.js +0 -14
  58. package/dist/components/InAppWallet/index.js.map +0 -1
  59. package/dist/components/Payments/CheckoutModal.d.ts +0 -19
  60. package/dist/components/Payments/CheckoutModal.d.ts.map +0 -1
  61. package/dist/components/Payments/CheckoutModal.js +0 -194
  62. package/dist/components/Payments/CheckoutModal.js.map +0 -1
  63. package/dist/components/Payments/SubscriptionWidget.d.ts +0 -17
  64. package/dist/components/Payments/SubscriptionWidget.d.ts.map +0 -1
  65. package/dist/components/Payments/SubscriptionWidget.js +0 -89
  66. package/dist/components/Payments/SubscriptionWidget.js.map +0 -1
  67. package/dist/components/Payments/constants.d.ts +0 -59
  68. package/dist/components/Payments/constants.d.ts.map +0 -1
  69. package/dist/components/Payments/constants.js +0 -145
  70. package/dist/components/Payments/constants.js.map +0 -1
  71. package/dist/components/Payments/index.d.ts +0 -10
  72. package/dist/components/Payments/index.d.ts.map +0 -1
  73. package/dist/components/Payments/index.js +0 -12
  74. package/dist/components/Payments/index.js.map +0 -1
  75. package/dist/components/Payments/types.d.ts +0 -119
  76. package/dist/components/Payments/types.d.ts.map +0 -1
  77. package/dist/components/Payments/types.js +0 -27
  78. package/dist/components/Payments/types.js.map +0 -1
  79. package/dist/components/Payments/usePayments.d.ts +0 -33
  80. package/dist/components/Payments/usePayments.d.ts.map +0 -1
  81. package/dist/components/Payments/usePayments.js +0 -249
  82. package/dist/components/Payments/usePayments.js.map +0 -1
  83. package/dist/components/Privy/__tests__/InitScreens.test.d.ts +0 -2
  84. package/dist/components/Privy/__tests__/InitScreens.test.d.ts.map +0 -1
  85. package/dist/components/Privy/__tests__/InitScreens.test.js +0 -74
  86. package/dist/components/Privy/__tests__/InitScreens.test.js.map +0 -1
  87. package/dist/components/SIWE/AuthStatus.d.ts +0 -15
  88. package/dist/components/SIWE/AuthStatus.d.ts.map +0 -1
  89. package/dist/components/SIWE/AuthStatus.js +0 -47
  90. package/dist/components/SIWE/AuthStatus.js.map +0 -1
  91. package/dist/components/SIWE/ProtectedRoute.d.ts +0 -17
  92. package/dist/components/SIWE/ProtectedRoute.d.ts.map +0 -1
  93. package/dist/components/SIWE/ProtectedRoute.js +0 -52
  94. package/dist/components/SIWE/ProtectedRoute.js.map +0 -1
  95. package/dist/components/SIWE/SIWEButton.d.ts +0 -22
  96. package/dist/components/SIWE/SIWEButton.d.ts.map +0 -1
  97. package/dist/components/SIWE/SIWEButton.js +0 -106
  98. package/dist/components/SIWE/SIWEButton.js.map +0 -1
  99. package/dist/components/SIWE/SIWEModal.d.ts +0 -19
  100. package/dist/components/SIWE/SIWEModal.d.ts.map +0 -1
  101. package/dist/components/SIWE/SIWEModal.js +0 -75
  102. package/dist/components/SIWE/SIWEModal.js.map +0 -1
  103. package/dist/components/SIWE/SIWEProvider.d.ts +0 -38
  104. package/dist/components/SIWE/SIWEProvider.d.ts.map +0 -1
  105. package/dist/components/SIWE/SIWEProvider.js +0 -227
  106. package/dist/components/SIWE/SIWEProvider.js.map +0 -1
  107. package/dist/components/SIWE/index.d.ts +0 -15
  108. package/dist/components/SIWE/index.d.ts.map +0 -1
  109. package/dist/components/SIWE/index.js +0 -10
  110. package/dist/components/SIWE/index.js.map +0 -1
  111. package/dist/core/VarityClient.d.ts +0 -76
  112. package/dist/core/VarityClient.d.ts.map +0 -1
  113. package/dist/core/VarityClient.js +0 -99
  114. package/dist/core/VarityClient.js.map +0 -1
  115. package/dist/core/config.d.ts +0 -136
  116. package/dist/core/config.d.ts.map +0 -1
  117. package/dist/core/config.js +0 -156
  118. package/dist/core/config.js.map +0 -1
  119. package/dist/hooks/useAnalytics.d.ts +0 -94
  120. package/dist/hooks/useAnalytics.d.ts.map +0 -1
  121. package/dist/hooks/useAnalytics.js +0 -116
  122. package/dist/hooks/useAnalytics.js.map +0 -1
  123. package/dist/hooks/useAuth.d.ts +0 -71
  124. package/dist/hooks/useAuth.d.ts.map +0 -1
  125. package/dist/hooks/useAuth.js +0 -198
  126. package/dist/hooks/useAuth.js.map +0 -1
  127. package/dist/hooks/useDashboard.d.ts +0 -110
  128. package/dist/hooks/useDashboard.d.ts.map +0 -1
  129. package/dist/hooks/useDashboard.js +0 -201
  130. package/dist/hooks/useDashboard.js.map +0 -1
  131. package/dist/hooks/useVarityAPI.d.ts +0 -88
  132. package/dist/hooks/useVarityAPI.d.ts.map +0 -1
  133. package/dist/hooks/useVarityAPI.js +0 -138
  134. package/dist/hooks/useVarityAPI.js.map +0 -1
  135. package/dist/hooks/useWalletAuth.d.ts +0 -108
  136. package/dist/hooks/useWalletAuth.d.ts.map +0 -1
  137. package/dist/hooks/useWalletAuth.js +0 -415
  138. package/dist/hooks/useWalletAuth.js.map +0 -1
  139. package/dist/hooks/web3/index.d.ts +0 -5
  140. package/dist/hooks/web3/index.d.ts.map +0 -1
  141. package/dist/hooks/web3/index.js +0 -6
  142. package/dist/hooks/web3/index.js.map +0 -1
  143. package/dist/hooks/web3/useAddressValidation.d.ts +0 -37
  144. package/dist/hooks/web3/useAddressValidation.d.ts.map +0 -1
  145. package/dist/hooks/web3/useAddressValidation.js +0 -59
  146. package/dist/hooks/web3/useAddressValidation.js.map +0 -1
  147. package/dist/hooks/web3/useBlockExplorer.d.ts +0 -37
  148. package/dist/hooks/web3/useBlockExplorer.d.ts.map +0 -1
  149. package/dist/hooks/web3/useBlockExplorer.js +0 -59
  150. package/dist/hooks/web3/useBlockExplorer.js.map +0 -1
  151. package/dist/hooks/web3/useUSDCFormat.d.ts +0 -34
  152. package/dist/hooks/web3/useUSDCFormat.d.ts.map +0 -1
  153. package/dist/hooks/web3/useUSDCFormat.js +0 -43
  154. package/dist/hooks/web3/useUSDCFormat.js.map +0 -1
  155. package/dist/hooks/web3/useVarityWallet.d.ts +0 -48
  156. package/dist/hooks/web3/useVarityWallet.d.ts.map +0 -1
  157. package/dist/hooks/web3/useVarityWallet.js +0 -70
  158. package/dist/hooks/web3/useVarityWallet.js.map +0 -1
  159. package/dist/modules/cache/index.d.ts +0 -12
  160. package/dist/modules/cache/index.d.ts.map +0 -1
  161. package/dist/modules/cache/index.js +0 -13
  162. package/dist/modules/cache/index.js.map +0 -1
  163. package/dist/providers/ChainContext.d.ts +0 -65
  164. package/dist/providers/ChainContext.d.ts.map +0 -1
  165. package/dist/providers/ChainContext.js +0 -92
  166. package/dist/providers/ChainContext.js.map +0 -1
  167. package/dist/providers/VarityProvider.d.ts +0 -32
  168. package/dist/providers/VarityProvider.d.ts.map +0 -1
  169. package/dist/providers/VarityProvider.js +0 -56
  170. package/dist/providers/VarityProvider.js.map +0 -1
  171. package/dist/providers/WalletContext.d.ts +0 -68
  172. package/dist/providers/WalletContext.d.ts.map +0 -1
  173. package/dist/providers/WalletContext.js +0 -98
  174. package/dist/providers/WalletContext.js.map +0 -1
  175. package/dist/providers/index.d.ts +0 -48
  176. package/dist/providers/index.d.ts.map +0 -1
  177. package/dist/providers/index.js +0 -53
  178. package/dist/providers/index.js.map +0 -1
  179. package/dist/types/api-extensions.d.ts +0 -92
  180. package/dist/types/api-extensions.d.ts.map +0 -1
  181. package/dist/types/api-extensions.js +0 -7
  182. package/dist/types/api-extensions.js.map +0 -1
  183. package/dist/wallets/SimpleSmartWallet.d.ts +0 -68
  184. package/dist/wallets/SimpleSmartWallet.d.ts.map +0 -1
  185. package/dist/wallets/SimpleSmartWallet.js +0 -74
  186. package/dist/wallets/SimpleSmartWallet.js.map +0 -1
  187. package/dist/wallets/SmartWalletProvider.d.ts +0 -217
  188. package/dist/wallets/SmartWalletProvider.d.ts.map +0 -1
  189. package/dist/wallets/SmartWalletProvider.js +0 -366
  190. package/dist/wallets/SmartWalletProvider.js.map +0 -1
  191. package/dist/wallets/config.d.ts +0 -222
  192. package/dist/wallets/config.d.ts.map +0 -1
  193. package/dist/wallets/config.js +0 -206
  194. package/dist/wallets/config.js.map +0 -1
  195. package/dist/wallets/index.d.ts +0 -9
  196. package/dist/wallets/index.d.ts.map +0 -1
  197. package/dist/wallets/index.js +0 -9
  198. package/dist/wallets/index.js.map +0 -1
  199. package/dist/web3/AddressDisplay/AddressDisplay.d.ts +0 -33
  200. package/dist/web3/AddressDisplay/AddressDisplay.d.ts.map +0 -1
  201. package/dist/web3/AddressDisplay/AddressDisplay.js +0 -42
  202. package/dist/web3/AddressDisplay/AddressDisplay.js.map +0 -1
  203. package/dist/web3/AddressInput/AddressInput.d.ts +0 -36
  204. package/dist/web3/AddressInput/AddressInput.d.ts.map +0 -1
  205. package/dist/web3/AddressInput/AddressInput.js +0 -54
  206. package/dist/web3/AddressInput/AddressInput.js.map +0 -1
  207. package/dist/web3/AmountInput/AmountInput.d.ts +0 -41
  208. package/dist/web3/AmountInput/AmountInput.d.ts.map +0 -1
  209. package/dist/web3/AmountInput/AmountInput.js +0 -74
  210. package/dist/web3/AmountInput/AmountInput.js.map +0 -1
  211. package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts +0 -30
  212. package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts.map +0 -1
  213. package/dist/web3/BalanceDisplay/BalanceDisplay.js +0 -35
  214. package/dist/web3/BalanceDisplay/BalanceDisplay.js.map +0 -1
  215. package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts +0 -41
  216. package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts.map +0 -1
  217. package/dist/web3/BlockExplorerLink/BlockExplorerLink.js +0 -46
  218. package/dist/web3/BlockExplorerLink/BlockExplorerLink.js.map +0 -1
  219. package/dist/web3/ConnectWallet/ConnectWallet.d.ts +0 -35
  220. package/dist/web3/ConnectWallet/ConnectWallet.d.ts.map +0 -1
  221. package/dist/web3/ConnectWallet/ConnectWallet.js +0 -58
  222. package/dist/web3/ConnectWallet/ConnectWallet.js.map +0 -1
  223. package/dist/web3/DisconnectButton/DisconnectButton.d.ts +0 -30
  224. package/dist/web3/DisconnectButton/DisconnectButton.d.ts.map +0 -1
  225. package/dist/web3/DisconnectButton/DisconnectButton.js +0 -48
  226. package/dist/web3/DisconnectButton/DisconnectButton.js.map +0 -1
  227. package/dist/web3/WalletBalance/WalletBalance.d.ts +0 -27
  228. package/dist/web3/WalletBalance/WalletBalance.d.ts.map +0 -1
  229. package/dist/web3/WalletBalance/WalletBalance.js +0 -49
  230. package/dist/web3/WalletBalance/WalletBalance.js.map +0 -1
  231. package/dist/web3/WalletDropdown/WalletDropdown.d.ts +0 -29
  232. package/dist/web3/WalletDropdown/WalletDropdown.d.ts.map +0 -1
  233. package/dist/web3/WalletDropdown/WalletDropdown.js +0 -93
  234. package/dist/web3/WalletDropdown/WalletDropdown.js.map +0 -1
  235. package/dist/web3/WalletInfo/WalletInfo.d.ts +0 -31
  236. package/dist/web3/WalletInfo/WalletInfo.d.ts.map +0 -1
  237. package/dist/web3/WalletInfo/WalletInfo.js +0 -41
  238. package/dist/web3/WalletInfo/WalletInfo.js.map +0 -1
  239. package/dist/web3/index.d.ts +0 -11
  240. package/dist/web3/index.d.ts.map +0 -1
  241. package/dist/web3/index.js +0 -14
  242. package/dist/web3/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/InAppWallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * In-App Wallet Components Export
3
- *
4
- * Thirdweb In-App Wallets for seamless Web2 user onboarding
5
- * - Email OTP authentication
6
- * - Social OAuth (Google, Apple, Facebook, Discord, Twitter)
7
- * - Automatic custodial wallet creation
8
- * - Complete onboarding flow
9
- */
10
- export { InAppWalletProvider, useInAppWallet } from './InAppWalletProvider';
11
- export { EmailLoginButton } from './EmailLoginButton';
12
- export { SocialLoginButtons } from './SocialLoginButtons';
13
- export { OnboardingFlow } from './OnboardingFlow';
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/InAppWallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { SubscriptionPlan } from './types';
3
- /**
4
- * Checkout Modal Component
5
- * Handles USDC payment processing for subscriptions
6
- */
7
- interface CheckoutModalProps {
8
- isOpen: boolean;
9
- onClose: () => void;
10
- plan: SubscriptionPlan;
11
- clientId: string;
12
- paymentRecipient: string;
13
- onSuccess?: (txHash: string) => void;
14
- onError?: (error: Error) => void;
15
- theme?: 'light' | 'dark';
16
- }
17
- export declare const CheckoutModal: React.FC<CheckoutModalProps>;
18
- export default CheckoutModal;
19
- //# sourceMappingURL=CheckoutModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckoutModal.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/CheckoutModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK3C;;;GAGG;AAEH,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAWD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuLtD,CAAC;AA0NF,eAAe,aAAa,CAAC"}
@@ -1,194 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useActiveAccount, useSendTransaction } from 'thirdweb/react';
3
- import { prepareContractCall, waitForReceipt } from 'thirdweb';
4
- import { getContract } from 'thirdweb';
5
- import { createThirdwebClient } from 'thirdweb';
6
- import { formatUSDC, USDC_CONTRACT_ADDRESS } from './constants';
7
- import { useSIWE } from '../SIWE/SIWEProvider';
8
- import { varityL3Testnet } from '../../config/chains';
9
- var CheckoutStep;
10
- (function (CheckoutStep) {
11
- CheckoutStep["REVIEW"] = "review";
12
- CheckoutStep["APPROVE"] = "approve";
13
- CheckoutStep["PAYMENT"] = "payment";
14
- CheckoutStep["CONFIRMING"] = "confirming";
15
- CheckoutStep["SUCCESS"] = "success";
16
- CheckoutStep["ERROR"] = "error";
17
- })(CheckoutStep || (CheckoutStep = {}));
18
- export const CheckoutModal = ({ isOpen, onClose, plan, clientId, paymentRecipient, onSuccess, onError, theme = 'dark', }) => {
19
- const [currentStep, setCurrentStep] = useState(CheckoutStep.REVIEW);
20
- const [error, setError] = useState(null);
21
- const [txHash, setTxHash] = useState(null);
22
- const { isAuthenticated } = useSIWE();
23
- const account = useActiveAccount();
24
- const { mutate: sendTransaction, isPending } = useSendTransaction();
25
- const client = createThirdwebClient({ clientId });
26
- // Reset state when modal opens
27
- useEffect(() => {
28
- if (isOpen) {
29
- setCurrentStep(CheckoutStep.REVIEW);
30
- setError(null);
31
- setTxHash(null);
32
- }
33
- }, [isOpen]);
34
- if (!isOpen)
35
- return null;
36
- const bgColor = theme === 'dark' ? 'bg-gray-900' : 'bg-white';
37
- const textColor = theme === 'dark' ? 'text-white' : 'text-gray-900';
38
- const mutedTextColor = theme === 'dark' ? 'text-gray-400' : 'text-gray-600';
39
- const borderColor = theme === 'dark' ? 'border-gray-700' : 'border-gray-200';
40
- const handlePayment = async () => {
41
- if (!account || !isAuthenticated) {
42
- setError('Please connect wallet and authenticate first');
43
- setCurrentStep(CheckoutStep.ERROR);
44
- return;
45
- }
46
- try {
47
- setCurrentStep(CheckoutStep.PAYMENT);
48
- setError(null);
49
- // Get USDC contract
50
- const usdcContract = getContract({
51
- client,
52
- chain: varityL3Testnet,
53
- address: USDC_CONTRACT_ADDRESS,
54
- });
55
- // Prepare USDC transfer transaction
56
- const transaction = prepareContractCall({
57
- contract: usdcContract,
58
- method: 'function transfer(address to, uint256 amount) returns (bool)',
59
- params: [paymentRecipient, BigInt(plan.price)],
60
- });
61
- // Send transaction
62
- sendTransaction(transaction, {
63
- onSuccess: async (result) => {
64
- setTxHash(result.transactionHash);
65
- setCurrentStep(CheckoutStep.CONFIRMING);
66
- try {
67
- // Wait for on-chain confirmation instead of a fixed timeout
68
- await waitForReceipt({
69
- client,
70
- chain: varityL3Testnet,
71
- transactionHash: result.transactionHash,
72
- });
73
- setCurrentStep(CheckoutStep.SUCCESS);
74
- onSuccess?.(result.transactionHash);
75
- }
76
- catch (receiptErr) {
77
- const msg = receiptErr?.message || 'Transaction failed on-chain';
78
- setError(msg);
79
- setCurrentStep(CheckoutStep.ERROR);
80
- onError?.(receiptErr);
81
- }
82
- },
83
- onError: (err) => {
84
- const errorMessage = err.message || 'Payment failed';
85
- setError(errorMessage);
86
- setCurrentStep(CheckoutStep.ERROR);
87
- onError?.(err);
88
- },
89
- });
90
- }
91
- catch (err) {
92
- const errorMessage = err.message || 'Payment failed';
93
- setError(errorMessage);
94
- setCurrentStep(CheckoutStep.ERROR);
95
- onError?.(err);
96
- }
97
- };
98
- const handleClose = () => {
99
- if (currentStep !== CheckoutStep.PAYMENT && currentStep !== CheckoutStep.CONFIRMING) {
100
- onClose();
101
- }
102
- };
103
- return (React.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" },
104
- React.createElement("div", { className: "absolute inset-0 bg-black bg-opacity-50", onClick: handleClose }),
105
- React.createElement("div", { className: `relative w-full max-w-2xl mx-4 rounded-2xl shadow-2xl ${bgColor} ${textColor} border ${borderColor}` },
106
- currentStep !== CheckoutStep.PAYMENT && currentStep !== CheckoutStep.CONFIRMING && (React.createElement("button", { onClick: handleClose, className: "absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors" },
107
- React.createElement("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
108
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })))),
109
- React.createElement("div", { className: "p-8" },
110
- React.createElement("h2", { className: "text-3xl font-bold mb-6" }, "Complete Your Subscription"),
111
- currentStep === CheckoutStep.REVIEW && (React.createElement(ReviewStep, { plan: plan, onProceed: handlePayment, theme: theme, textColor: textColor, mutedTextColor: mutedTextColor, borderColor: borderColor, isPending: isPending })),
112
- currentStep === CheckoutStep.PAYMENT && (React.createElement(ProcessingStep, { message: "Processing payment...", theme: theme, textColor: textColor })),
113
- currentStep === CheckoutStep.CONFIRMING && (React.createElement(ProcessingStep, { message: "Confirming transaction...", txHash: txHash, theme: theme, textColor: textColor, mutedTextColor: mutedTextColor })),
114
- currentStep === CheckoutStep.SUCCESS && (React.createElement(SuccessStep, { plan: plan, txHash: txHash, onClose: onClose, theme: theme, textColor: textColor, mutedTextColor: mutedTextColor })),
115
- currentStep === CheckoutStep.ERROR && (React.createElement(ErrorStep, { error: error, onRetry: handlePayment, onClose: onClose, theme: theme, textColor: textColor }))))));
116
- };
117
- const ReviewStep = ({ plan, onProceed, theme, textColor, mutedTextColor, borderColor, isPending, }) => (React.createElement(React.Fragment, null,
118
- React.createElement("div", { className: `border ${borderColor} rounded-lg p-6 mb-6` },
119
- React.createElement("div", { className: "flex justify-between items-start mb-4" },
120
- React.createElement("div", null,
121
- React.createElement("h3", { className: `text-xl font-bold ${textColor}` },
122
- plan.name,
123
- " Plan"),
124
- React.createElement("p", { className: mutedTextColor }, plan.description)),
125
- React.createElement("div", { className: "text-right" },
126
- React.createElement("p", { className: `text-2xl font-bold ${textColor}` }, formatUSDC(plan.price)),
127
- React.createElement("p", { className: `text-sm ${mutedTextColor}` }, "per month"))),
128
- React.createElement("div", { className: "space-y-2" },
129
- React.createElement("p", { className: `font-semibold ${textColor} mb-2` }, "Included features:"),
130
- plan.features.slice(0, 5).map((feature, index) => (React.createElement("div", { key: index, className: "flex items-center gap-2" },
131
- React.createElement("svg", { className: "w-4 h-4 text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
132
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" })),
133
- React.createElement("span", { className: `text-sm ${mutedTextColor}` }, feature)))))),
134
- React.createElement("div", { className: `bg-${theme === 'dark' ? 'gray-800' : 'gray-50'} rounded-lg p-6 mb-6` },
135
- React.createElement("h4", { className: `font-semibold mb-4 ${textColor}` }, "Payment Details"),
136
- React.createElement("div", { className: "space-y-2" },
137
- React.createElement("div", { className: "flex justify-between" },
138
- React.createElement("span", { className: mutedTextColor }, "Subtotal"),
139
- React.createElement("span", { className: textColor }, formatUSDC(plan.price))),
140
- React.createElement("div", { className: "flex justify-between" },
141
- React.createElement("span", { className: mutedTextColor }, "Currency"),
142
- React.createElement("span", { className: textColor }, "USDC (Varity L3)")),
143
- React.createElement("div", { className: `border-t ${borderColor} pt-2 mt-2` }),
144
- React.createElement("div", { className: "flex justify-between font-bold" },
145
- React.createElement("span", { className: textColor }, "Total Due Today"),
146
- React.createElement("span", { className: `text-xl ${textColor}` }, formatUSDC(plan.price))))),
147
- React.createElement("button", { onClick: onProceed, disabled: isPending, className: "w-full py-4 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2" }, isPending ? (React.createElement(React.Fragment, null,
148
- React.createElement(LoadingSpinner, null),
149
- "Processing...")) : (React.createElement(React.Fragment, null,
150
- "Pay ",
151
- formatUSDC(plan.price),
152
- " USDC"))),
153
- React.createElement("p", { className: `text-xs text-center mt-4 ${mutedTextColor}` }, "Your payment is secure and encrypted. Powered by Thirdweb on Varity L3.")));
154
- const ProcessingStep = ({ message, txHash, theme, textColor, mutedTextColor }) => (React.createElement("div", { className: "text-center py-12" },
155
- React.createElement("div", { className: "inline-flex items-center justify-center w-20 h-20 rounded-full bg-blue-500 text-white mb-6 animate-pulse" },
156
- React.createElement(LoadingSpinner, null)),
157
- React.createElement("h3", { className: `text-2xl font-bold mb-2 ${textColor}` }, message),
158
- React.createElement("p", { className: mutedTextColor }, "Please wait while we process your transaction"),
159
- txHash && (React.createElement("div", { className: "mt-6" },
160
- React.createElement("p", { className: `text-sm ${mutedTextColor} mb-2` }, "Transaction Hash:"),
161
- React.createElement("code", { className: `text-xs ${theme === 'dark' ? 'bg-gray-800 text-gray-300' : 'bg-gray-100 text-gray-700'} px-3 py-1 rounded` },
162
- txHash.substring(0, 10),
163
- "...",
164
- txHash.substring(txHash.length - 10))))));
165
- const SuccessStep = ({ plan, txHash, onClose, theme, textColor, mutedTextColor }) => (React.createElement("div", { className: "text-center py-12" },
166
- React.createElement("div", { className: "inline-flex items-center justify-center w-20 h-20 rounded-full bg-green-500 text-white mb-6" },
167
- React.createElement("svg", { className: "w-12 h-12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
168
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }))),
169
- React.createElement("h3", { className: `text-2xl font-bold mb-2 ${textColor}` }, "Payment Successful!"),
170
- React.createElement("p", { className: mutedTextColor },
171
- "You're now subscribed to the ",
172
- plan.name,
173
- " plan"),
174
- txHash && (React.createElement("div", { className: "mt-6" },
175
- React.createElement("p", { className: `text-sm ${mutedTextColor} mb-2` }, "Transaction Hash:"),
176
- React.createElement("code", { className: `text-xs ${theme === 'dark' ? 'bg-gray-800 text-gray-300' : 'bg-gray-100 text-gray-700'} px-3 py-1 rounded` }, txHash))),
177
- React.createElement("button", { onClick: onClose, className: "mt-8 px-8 py-3 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition-colors" }, "Go to Dashboard")));
178
- const ErrorStep = ({ error, onRetry, onClose, theme, textColor }) => (React.createElement("div", { className: "text-center py-12" },
179
- React.createElement("div", { className: "inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500 text-white mb-6" },
180
- React.createElement("svg", { className: "w-12 h-12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
181
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }))),
182
- React.createElement("h3", { className: `text-2xl font-bold mb-2 ${textColor}` }, "Payment Failed"),
183
- React.createElement("p", { className: "text-red-500 mb-8" }, error || 'An error occurred during payment'),
184
- React.createElement("div", { className: "flex gap-4 justify-center" },
185
- React.createElement("button", { onClick: onRetry, className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition-colors" }, "Try Again"),
186
- React.createElement("button", { onClick: onClose, className: `px-6 py-3 ${theme === 'dark' ? 'bg-gray-700 hover:bg-gray-600' : 'bg-gray-200 hover:bg-gray-300'} ${textColor} font-semibold rounded-lg transition-colors` }, "Cancel"))));
187
- /**
188
- * Loading Spinner Component
189
- */
190
- const LoadingSpinner = () => (React.createElement("svg", { className: "animate-spin h-6 w-6", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24" },
191
- React.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
192
- React.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })));
193
- export default CheckoutModal;
194
- //# sourceMappingURL=CheckoutModal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckoutModal.js","sourceRoot":"","sources":["../../../src/components/Payments/CheckoutModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAkBtD,IAAK,YAOJ;AAPD,WAAK,YAAY;IACf,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,mCAAmB,CAAA;IACnB,+BAAe,CAAA;AACjB,CAAC,EAPI,YAAY,KAAZ,YAAY,QAOhB;AAED,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,MAAM,EACN,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,KAAK,GAAG,MAAM,GACf,EAAE,EAAE;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAe,YAAY,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,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AK,SAAS,EAAC,2FAA2F;QACxG,6BAAK,SAAS,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW;YAC9E,8BAAM,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAC,sBAAsB,GAAG,CAC1F,CACF;IACN,4BAAI,SAAS,EAAE,2BAA2B,SAAS,EAAE,qBAAqB;IAC1E,2BAAG,SAAS,EAAC,mBAAmB,IAAE,KAAK,IAAI,kCAAkC,CAAK;IAElF,6BAAK,SAAS,EAAC,2BAA2B;QACxC,gCACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,+FAA+F,gBAGlG;QACT,gCACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,+BAA+B,IAAI,SAAS,6CAA6C,aAG/J,CACL,CACF,CACP,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAa,GAAG,EAAE,CAAC,CACrC,6BAAK,SAAS,EAAC,sBAAsB,EAAC,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW;IACtG,gCAAQ,SAAS,EAAC,YAAY,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,GAAG;IAC9F,8BACE,SAAS,EAAC,YAAY,EACtB,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,iHAAiH,GACnH,CACE,CACP,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { SubscriptionTier } from './types';
3
- /**
4
- * Subscription Widget Component
5
- * Displays subscription plans with feature comparison
6
- */
7
- interface SubscriptionWidgetProps {
8
- currentPlan?: SubscriptionTier;
9
- onSelectPlan: (planId: string) => void;
10
- theme?: 'light' | 'dark';
11
- showAnnualToggle?: boolean;
12
- className?: string;
13
- isLoading?: boolean;
14
- }
15
- export declare const SubscriptionWidget: React.FC<SubscriptionWidgetProps>;
16
- export default SubscriptionWidget;
17
- //# sourceMappingURL=SubscriptionWidget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SubscriptionWidget.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/SubscriptionWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG7D;;;GAGG;AAEH,UAAU,uBAAuB;IAC/B,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6FhE,CAAC;AA6KF,eAAe,kBAAkB,CAAC"}
@@ -1,89 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { SUBSCRIPTION_PLANS, formatUSDC } from './constants';
3
- export const SubscriptionWidget = ({ currentPlan, onSelectPlan, theme = 'dark', showAnnualToggle = false, className = '', isLoading = false, }) => {
4
- const [billingPeriod, setBillingPeriod] = useState('monthly');
5
- const bgColor = theme === 'dark' ? 'bg-gray-900' : 'bg-white';
6
- const textColor = theme === 'dark' ? 'text-white' : 'text-gray-900';
7
- const mutedTextColor = theme === 'dark' ? 'text-gray-400' : 'text-gray-600';
8
- const borderColor = theme === 'dark' ? 'border-gray-700' : 'border-gray-200';
9
- const calculateAnnualPrice = (monthlyPrice) => {
10
- // 20% discount for annual billing
11
- return Math.floor(monthlyPrice * 12 * 0.8);
12
- };
13
- return (React.createElement("div", { className: `${className}` },
14
- React.createElement("div", { className: "text-center mb-12" },
15
- React.createElement("h2", { className: `text-4xl font-bold mb-4 ${textColor}` }, "Choose Your Plan"),
16
- React.createElement("p", { className: `text-lg ${mutedTextColor}` }, "Select the perfect plan for your business needs")),
17
- showAnnualToggle && (React.createElement("div", { className: "flex justify-center items-center gap-4 mb-8" },
18
- React.createElement("button", { onClick: () => setBillingPeriod('monthly'), className: `px-4 py-2 rounded-lg font-semibold transition-colors ${billingPeriod === 'monthly'
19
- ? 'bg-blue-600 text-white'
20
- : theme === 'dark'
21
- ? 'bg-gray-800 text-gray-400 hover:bg-gray-700'
22
- : 'bg-gray-200 text-gray-600 hover:bg-gray-300'}` }, "Monthly"),
23
- React.createElement("button", { onClick: () => setBillingPeriod('annual'), className: `px-4 py-2 rounded-lg font-semibold transition-colors relative ${billingPeriod === 'annual'
24
- ? 'bg-blue-600 text-white'
25
- : theme === 'dark'
26
- ? 'bg-gray-800 text-gray-400 hover:bg-gray-700'
27
- : 'bg-gray-200 text-gray-600 hover:bg-gray-300'}` },
28
- "Annual",
29
- React.createElement("span", { className: "absolute -top-2 -right-2 bg-green-500 text-white text-xs px-2 py-0.5 rounded-full" }, "Save 20%")))),
30
- React.createElement("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-8 max-w-7xl mx-auto" }, SUBSCRIPTION_PLANS.map((plan) => (React.createElement(PlanCard, { key: plan.id, plan: plan, isCurrentPlan: currentPlan === plan.tier, onSelect: () => onSelectPlan(plan.id), billingPeriod: billingPeriod, calculateAnnualPrice: calculateAnnualPrice, theme: theme, bgColor: bgColor, textColor: textColor, mutedTextColor: mutedTextColor, borderColor: borderColor, isLoading: isLoading })))),
31
- React.createElement("div", { className: "text-center mt-12" },
32
- React.createElement("button", { className: `${mutedTextColor} hover:text-blue-500 underline transition-colors` }, "View detailed feature comparison"))));
33
- };
34
- const PlanCard = ({ plan, isCurrentPlan, onSelect, billingPeriod, calculateAnnualPrice, theme, bgColor, textColor, mutedTextColor, borderColor, isLoading, }) => {
35
- const displayPrice = billingPeriod === 'annual'
36
- ? calculateAnnualPrice(plan.price)
37
- : plan.price;
38
- const pricePerMonth = billingPeriod === 'annual'
39
- ? formatUSDC(displayPrice / 12)
40
- : formatUSDC(displayPrice);
41
- const totalPrice = formatUSDC(displayPrice);
42
- const cardBg = plan.isRecommended
43
- ? theme === 'dark'
44
- ? 'bg-gradient-to-br from-blue-900 to-gray-900'
45
- : 'bg-gradient-to-br from-blue-50 to-white'
46
- : theme === 'dark'
47
- ? 'bg-gray-800'
48
- : 'bg-white';
49
- const cardBorder = plan.isRecommended
50
- ? 'border-blue-500'
51
- : borderColor;
52
- return (React.createElement("div", { className: `relative rounded-2xl border-2 ${cardBorder} ${cardBg} p-8 shadow-xl transition-transform hover:scale-105` },
53
- plan.isRecommended && (React.createElement("div", { className: "absolute -top-4 left-1/2 transform -translate-x-1/2" },
54
- React.createElement("span", { className: "bg-blue-500 text-white px-4 py-1 rounded-full text-sm font-semibold" }, "Recommended"))),
55
- plan.isPopular && !plan.isRecommended && (React.createElement("div", { className: "absolute top-4 right-4" },
56
- React.createElement("span", { className: "bg-green-500 text-white px-3 py-1 rounded-full text-xs font-semibold" }, "Popular"))),
57
- React.createElement("h3", { className: `text-2xl font-bold mb-2 ${textColor}` }, plan.name),
58
- React.createElement("p", { className: `mb-6 ${mutedTextColor}` }, plan.description),
59
- React.createElement("div", { className: "mb-6" },
60
- React.createElement("div", { className: "flex items-baseline gap-2" },
61
- React.createElement("span", { className: `text-4xl font-bold ${textColor}` }, pricePerMonth),
62
- React.createElement("span", { className: mutedTextColor }, "/month")),
63
- billingPeriod === 'annual' && (React.createElement("p", { className: `text-sm mt-1 ${mutedTextColor}` },
64
- totalPrice,
65
- " billed annually"))),
66
- React.createElement("button", { onClick: onSelect, disabled: isCurrentPlan || isLoading, className: `w-full py-3 rounded-lg font-semibold transition-colors mb-6 ${isCurrentPlan
67
- ? theme === 'dark'
68
- ? 'bg-gray-700 text-gray-400 cursor-not-allowed'
69
- : 'bg-gray-200 text-gray-500 cursor-not-allowed'
70
- : plan.isRecommended
71
- ? 'bg-blue-600 hover:bg-blue-700 text-white'
72
- : theme === 'dark'
73
- ? 'bg-gray-700 hover:bg-gray-600 text-white'
74
- : 'bg-gray-900 hover:bg-gray-800 text-white'}` }, isLoading ? (React.createElement("span", { className: "flex items-center justify-center gap-2" },
75
- React.createElement(LoadingSpinner, null),
76
- "Processing...")) : isCurrentPlan ? ('Current Plan') : ('Select Plan')),
77
- React.createElement("div", { className: "space-y-3" }, plan.features.map((feature, index) => (React.createElement("div", { key: index, className: "flex items-start gap-3" },
78
- React.createElement("svg", { className: `w-5 h-5 mt-0.5 flex-shrink-0 ${plan.isRecommended ? 'text-blue-500' : 'text-green-500'}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
79
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" })),
80
- React.createElement("span", { className: `text-sm ${mutedTextColor}` }, feature)))))));
81
- };
82
- /**
83
- * Loading Spinner Component
84
- */
85
- const LoadingSpinner = () => (React.createElement("svg", { className: "animate-spin h-5 w-5", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24" },
86
- React.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
87
- React.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })));
88
- export default SubscriptionWidget;
89
- //# sourceMappingURL=SubscriptionWidget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SubscriptionWidget.js","sourceRoot":"","sources":["../../../src/components/Payments/SubscriptionWidget.tsx"],"names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Aa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAC,gBAAgB,GAAG,CACpF;YACN,8BAAM,SAAS,EAAE,WAAW,cAAc,EAAE,IAAG,OAAO,CAAQ,CAC1D,CACP,CAAC,CACE,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAa,GAAG,EAAE,CAAC,CACrC,6BACE,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW;IAEnB,gCACE,SAAS,EAAC,YAAY,EACtB,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,GACf;IACF,8BACE,SAAS,EAAC,YAAY,EACtB,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,iHAAiH,GACnH,CACE,CACP,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * Payment Constants
3
- * Subscription plans, pricing, and USDC configuration
4
- */
5
- import { SubscriptionPlan, SubscriptionTier } from './types';
6
- /**
7
- * Varity L3 Chain Configuration
8
- */
9
- export declare const VARITY_L3_CHAIN_ID = 33529;
10
- export declare const USDC_CONTRACT_ADDRESS = "0x6Fd8ee6B4C2193e9E2e0E2EC5D295689B607c0cE";
11
- export declare const USDC_DECIMALS = 6;
12
- /**
13
- * Subscription Plans
14
- * Prices in USDC (with 6 decimals)
15
- */
16
- export declare const SUBSCRIPTION_PLANS: SubscriptionPlan[];
17
- /**
18
- * Get subscription plan by ID
19
- */
20
- export declare function getSubscriptionPlan(planId: string): SubscriptionPlan | undefined;
21
- /**
22
- * Get subscription plan by tier
23
- */
24
- export declare function getSubscriptionPlanByTier(tier: SubscriptionTier): SubscriptionPlan | undefined;
25
- /**
26
- * Format USDC amount for display
27
- * Converts from 6 decimal representation to human-readable
28
- */
29
- export declare function formatUSDC(amount: number): string;
30
- /**
31
- * Convert human amount to USDC contract amount
32
- * e.g., 99 -> 99_000000 (6 decimals)
33
- */
34
- export declare function toUSDCAmount(humanAmount: number): number;
35
- /**
36
- * Convert USDC contract amount to human amount
37
- * e.g., 99_000000 -> 99
38
- */
39
- export declare function fromUSDCAmount(contractAmount: number): number;
40
- /**
41
- * Payment API Endpoints
42
- */
43
- export declare const PAYMENT_ENDPOINTS: {
44
- CREATE_CHECKOUT: string;
45
- GET_SUBSCRIPTION: string;
46
- CANCEL_SUBSCRIPTION: string;
47
- RESUME_SUBSCRIPTION: string;
48
- UPGRADE_SUBSCRIPTION: string;
49
- DOWNGRADE_SUBSCRIPTION: string;
50
- GET_INVOICES: string;
51
- GET_USAGE: string;
52
- WEBHOOK: string;
53
- };
54
- /**
55
- * Trial Period Configuration
56
- */
57
- export declare const TRIAL_PERIOD_DAYS = 14;
58
- export declare const TRIAL_ENABLED = true;
59
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,qBAAqB,+CAA+C,CAAC;AAClF,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAyEhD,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEhF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,SAAS,CAE9F;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;CAU7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,aAAa,OAAO,CAAC"}
@@ -1,145 +0,0 @@
1
- /**
2
- * Payment Constants
3
- * Subscription plans, pricing, and USDC configuration
4
- */
5
- import { SubscriptionTier } from './types';
6
- /**
7
- * Varity L3 Chain Configuration
8
- */
9
- export const VARITY_L3_CHAIN_ID = 33529;
10
- export const USDC_CONTRACT_ADDRESS = '0x6Fd8ee6B4C2193e9E2e0E2EC5D295689B607c0cE'; // Bridged USDC on Varity L3 (chain 33529)
11
- export const USDC_DECIMALS = 6;
12
- /**
13
- * Subscription Plans
14
- * Prices in USDC (with 6 decimals)
15
- */
16
- export const SUBSCRIPTION_PLANS = [
17
- {
18
- id: 'basic',
19
- tier: SubscriptionTier.BASIC,
20
- name: 'Basic',
21
- description: 'Perfect for small businesses getting started',
22
- price: 99_000000, // $99 USDC (6 decimals)
23
- priceDisplay: '$99/month',
24
- features: [
25
- '1 AI Dashboard',
26
- 'Up to 5 users',
27
- '10 GB storage',
28
- 'Community support',
29
- 'Basic analytics',
30
- 'Email notifications',
31
- ],
32
- maxUsers: 5,
33
- maxDashboards: 1,
34
- maxStorage: 10,
35
- supportLevel: 'community',
36
- isPopular: false,
37
- isRecommended: false,
38
- },
39
- {
40
- id: 'professional',
41
- tier: SubscriptionTier.PROFESSIONAL,
42
- name: 'Professional',
43
- description: 'Advanced features for growing businesses',
44
- price: 499_000000, // $499 USDC (6 decimals)
45
- priceDisplay: '$499/month',
46
- features: [
47
- 'Up to 5 AI Dashboards',
48
- 'Up to 25 users',
49
- '100 GB storage',
50
- 'Priority email support',
51
- 'Advanced analytics',
52
- 'Custom integrations',
53
- 'API access',
54
- 'White-label branding',
55
- ],
56
- maxUsers: 25,
57
- maxDashboards: 5,
58
- maxStorage: 100,
59
- supportLevel: 'priority',
60
- isPopular: true,
61
- isRecommended: true,
62
- },
63
- {
64
- id: 'enterprise',
65
- tier: SubscriptionTier.ENTERPRISE,
66
- name: 'Enterprise',
67
- description: 'Full-featured solution for large organizations',
68
- price: 2999_000000, // $2,999 USDC (6 decimals)
69
- priceDisplay: '$2,999/month',
70
- features: [
71
- 'Unlimited AI Dashboards',
72
- 'Unlimited users',
73
- 'Unlimited storage',
74
- 'Dedicated support manager',
75
- 'Enterprise analytics',
76
- 'Custom development',
77
- 'SLA guarantee (99.99%)',
78
- 'Full white-label',
79
- 'On-premise deployment',
80
- 'Custom contracts',
81
- ],
82
- maxUsers: undefined,
83
- maxDashboards: undefined,
84
- maxStorage: undefined,
85
- supportLevel: 'dedicated',
86
- isPopular: false,
87
- isRecommended: false,
88
- },
89
- ];
90
- /**
91
- * Get subscription plan by ID
92
- */
93
- export function getSubscriptionPlan(planId) {
94
- return SUBSCRIPTION_PLANS.find(plan => plan.id === planId);
95
- }
96
- /**
97
- * Get subscription plan by tier
98
- */
99
- export function getSubscriptionPlanByTier(tier) {
100
- return SUBSCRIPTION_PLANS.find(plan => plan.tier === tier);
101
- }
102
- /**
103
- * Format USDC amount for display
104
- * Converts from 6 decimal representation to human-readable
105
- */
106
- export function formatUSDC(amount) {
107
- return `$${(amount / 1_000000).toLocaleString('en-US', {
108
- minimumFractionDigits: 2,
109
- maximumFractionDigits: 2,
110
- })}`;
111
- }
112
- /**
113
- * Convert human amount to USDC contract amount
114
- * e.g., 99 -> 99_000000 (6 decimals)
115
- */
116
- export function toUSDCAmount(humanAmount) {
117
- return Math.floor(humanAmount * 1_000000);
118
- }
119
- /**
120
- * Convert USDC contract amount to human amount
121
- * e.g., 99_000000 -> 99
122
- */
123
- export function fromUSDCAmount(contractAmount) {
124
- return contractAmount / 1_000000;
125
- }
126
- /**
127
- * Payment API Endpoints
128
- */
129
- export const PAYMENT_ENDPOINTS = {
130
- CREATE_CHECKOUT: '/api/v1/payments/checkout',
131
- GET_SUBSCRIPTION: '/api/v1/payments/subscription',
132
- CANCEL_SUBSCRIPTION: '/api/v1/payments/subscription/cancel',
133
- RESUME_SUBSCRIPTION: '/api/v1/payments/subscription/resume',
134
- UPGRADE_SUBSCRIPTION: '/api/v1/payments/subscription/upgrade',
135
- DOWNGRADE_SUBSCRIPTION: '/api/v1/payments/subscription/downgrade',
136
- GET_INVOICES: '/api/v1/payments/invoices',
137
- GET_USAGE: '/api/v1/payments/usage',
138
- WEBHOOK: '/api/v1/webhooks/payments',
139
- };
140
- /**
141
- * Trial Period Configuration
142
- */
143
- export const TRIAL_PERIOD_DAYS = 14;
144
- export const TRIAL_ENABLED = true;
145
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/components/Payments/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,4CAA4C,CAAC,CAAC,0CAA0C;AAC7H,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,gBAAgB,CAAC,KAAK;QAC5B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,8CAA8C;QAC3D,KAAK,EAAE,SAAS,EAAE,wBAAwB;QAC1C,YAAY,EAAE,WAAW;QACzB,QAAQ,EAAE;YACR,gBAAgB;YAChB,eAAe;YACf,eAAe;YACf,mB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Widget } from './SubscriptionWidget';
6
- export { CheckoutModal } from './CheckoutModal';
7
- export { usePayments } from './usePayments';
8
- export * from './types';
9
- export * from './constants';
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC"}