@varity-labs/ui-kit 2.0.0-beta.6 → 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 +14 -16
  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 +5 -6
  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
package/README.md CHANGED
@@ -16,13 +16,13 @@ Peer dependencies: `react` and `react-dom` 18+.
16
16
  ## Quick Start
17
17
 
18
18
  ```tsx
19
- import { PrivyStack } from '@varity-labs/ui-kit'
19
+ import { AuthProvider } from '@varity-labs/ui-kit'
20
20
 
21
21
  function App() {
22
22
  return (
23
- <PrivyStack>
23
+ <AuthProvider>
24
24
  <YourApp />
25
- </PrivyStack>
25
+ </AuthProvider>
26
26
  )
27
27
  }
28
28
  ```
@@ -110,14 +110,14 @@ Authentication, theming, and providers are all configured automatically with zer
110
110
  Built-in authentication -- email, Google, and social login with zero configuration:
111
111
 
112
112
  ```tsx
113
- import { PrivyStack, PrivyLoginButton } from '@varity-labs/ui-kit'
113
+ import { AuthProvider, LoginButton } from '@varity-labs/ui-kit'
114
114
  import { useAuth } from '@varity-labs/ui-kit'
115
115
 
116
116
  function App() {
117
117
  return (
118
- <PrivyStack>
118
+ <AuthProvider>
119
119
  <Dashboard />
120
- </PrivyStack>
120
+ </AuthProvider>
121
121
  )
122
122
  }
123
123
 
@@ -141,10 +141,10 @@ function Dashboard() {
141
141
 
142
142
  | Component | Description |
143
143
  |-----------|-------------|
144
- | `PrivyLoginButton` | Drop-in login button |
145
- | `PrivyUserProfile` | User profile display |
146
- | `PrivyProtectedRoute` | Route protection wrapper |
147
- | `PrivyReadyGate` | Loading gate during initialization |
144
+ | `LoginButton` | Drop-in login button |
145
+ | `UserProfile` | User profile display |
146
+ | `ProtectedRoute` | Route protection wrapper |
147
+ | `ReadyGate` | Loading gate during initialization |
148
148
 
149
149
  ### Auth Hooks
150
150
 
@@ -166,7 +166,7 @@ import { PaymentWidget, PaymentGate, useVarityPayment } from '@varity-labs/ui-ki
166
166
  // Wrap a trigger element -- opens checkout on click
167
167
  // appId is a number (from Varity App Registry)
168
168
  // price is in cents (e.g., 9900 = $99.00)
169
- <PaymentWidget appId={123} price={9900} onSuccess={(txHash) => console.log('Paid!', txHash)}>
169
+ <PaymentWidget appId={123} price={9900} onSuccess={(receipt) => console.log('Paid!', receipt)}>
170
170
  <button>Buy Premium - $99</button>
171
171
  </PaymentWidget>
172
172
 
@@ -219,7 +219,7 @@ import {
219
219
 
220
220
  function App() {
221
221
  return (
222
- <PrivyStack>
222
+ <AuthProvider>
223
223
  <ToastProvider>
224
224
  <DashboardLayout>
225
225
  <DashboardSidebar items={sidebarItems} />
@@ -231,7 +231,7 @@ function App() {
231
231
  </main>
232
232
  </DashboardLayout>
233
233
  </ToastProvider>
234
- </PrivyStack>
234
+ </AuthProvider>
235
235
  )
236
236
  }
237
237
  ```
@@ -240,9 +240,7 @@ function App() {
240
240
 
241
241
  | Provider | Description |
242
242
  |----------|-------------|
243
- | `PrivyStack` | All-in-one provider (auth + theme + query client) |
244
- | `VarityPrivyProvider` | Auth provider (lower-level) |
245
- | `ZeroDevProvider` | Gas sponsorship provider (automatic in PrivyStack) |
243
+ | `AuthProvider` | All-in-one provider (auth + theme + query client) |
246
244
  | `ThemeProvider` | Theme management |
247
245
  | `ToastProvider` | Toast notifications |
248
246
  | `VarityDashboardProvider` | Dashboard state management |
@@ -1,21 +1,9 @@
1
1
  /**
2
2
  * PaymentWidget Component
3
3
  *
4
- * REQUIRED in every Varity app that charges users.
5
- * All payments go through the VarityPayments contract with 90/10 revenue split:
6
- * - 90% to developer
7
- * - 10% to Varity treasury
8
- *
9
- * Zero-crypto checkout: Users pay with credit card via thirdweb Pay.
10
- * No wallets, no tokens, no blockchain terminology visible.
11
- * The experience is identical to Stripe checkout.
12
- *
13
- * Flow:
14
- * 1. User clicks purchase button
15
- * 2. Credit card form appears (thirdweb Pay modal)
16
- * 3. thirdweb converts USD → USDC on Arbitrum One
17
- * 4. USDC approve + purchaseApp() execute automatically
18
- * 5. User sees "Purchase complete" — never sees crypto
4
+ * Payments are coming soon. This component currently passes children through
5
+ * unchanged. Full payment processing (credit card checkout, 90/10 revenue
6
+ * split) will be enabled in a future release.
19
7
  *
20
8
  * @example
21
9
  * ```tsx
@@ -29,11 +17,11 @@
29
17
  import React from 'react';
30
18
  import { PaymentWidgetProps } from './types';
31
19
  /**
32
- * PaymentWidget - Required component for app monetization
20
+ * PaymentWidget - Coming soon
33
21
  *
34
- * Wraps a trigger element and handles the full purchase flow.
35
- * Automatically checks USDC allowance skips authorize step if sufficient.
36
- * Credit card payments handled seamlessly via thirdweb Pay.
22
+ * Renders children as-is until payment processing is enabled in a future
23
+ * release. Wrap your purchase button with this component so you can enable
24
+ * payments without any code changes when they launch.
37
25
  */
38
26
  export declare const PaymentWidget: React.FC<PaymentWidgetProps>;
39
27
  export default PaymentWidget;
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentWidget.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/PaymentWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA6C7C;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA4KtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"PaymentWidget.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/PaymentWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAKtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,21 +1,9 @@
1
1
  /**
2
2
  * PaymentWidget Component
3
3
  *
4
- * REQUIRED in every Varity app that charges users.
5
- * All payments go through the VarityPayments contract with 90/10 revenue split:
6
- * - 90% to developer
7
- * - 10% to Varity treasury
8
- *
9
- * Zero-crypto checkout: Users pay with credit card via thirdweb Pay.
10
- * No wallets, no tokens, no blockchain terminology visible.
11
- * The experience is identical to Stripe checkout.
12
- *
13
- * Flow:
14
- * 1. User clicks purchase button
15
- * 2. Credit card form appears (thirdweb Pay modal)
16
- * 3. thirdweb converts USD → USDC on Arbitrum One
17
- * 4. USDC approve + purchaseApp() execute automatically
18
- * 5. User sees "Purchase complete" — never sees crypto
4
+ * Payments are coming soon. This component currently passes children through
5
+ * unchanged. Full payment processing (credit card checkout, 90/10 revenue
6
+ * split) will be enabled in a future release.
19
7
  *
20
8
  * @example
21
9
  * ```tsx
@@ -26,170 +14,16 @@
26
14
  * </PaymentWidget>
27
15
  * ```
28
16
  */
29
- import React, { useState, useEffect } from 'react';
30
- import { TransactionButton, useActiveAccount } from 'thirdweb/react';
31
- import { prepareContractCall, getContract, readContract, defineChain } from 'thirdweb';
32
- import { approve } from 'thirdweb/extensions/erc20';
33
- import { useVarityPayment } from './useVarityPayment';
34
- /** Arbitrum One USDC contract address */
35
- const USDC_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
36
- /** Arbitrum One chain config for thirdweb */
37
- const ARBITRUM_ONE = defineChain(42161);
38
- /**
39
- * Build the payModal config that hides all crypto complexity.
40
- * Users see a clean credit card checkout — no wallets, tokens, or chains.
41
- *
42
- * The payModal auto-detects that the transaction needs USDC on Arbitrum One
43
- * and shows the credit card on-ramp when the user has insufficient balance.
44
- */
45
- function buildPayModalConfig(opts) {
46
- return {
47
- theme: opts.theme,
48
- metadata: {
49
- name: opts.title,
50
- image: '/logo/varity-logo-color.svg',
51
- },
52
- // Credit card only — hide crypto swap/transfer options
53
- buyWithCrypto: false,
54
- // Prefer Stripe for the cleanest credit card experience
55
- buyWithFiat: {
56
- preferredProvider: 'stripe',
57
- },
58
- // Only show USDC on Arbitrum One, labeled as "USD" to hide crypto
59
- supportedTokens: {
60
- 42161: [{
61
- address: USDC_ADDRESS,
62
- name: 'USD',
63
- symbol: 'USD',
64
- icon: 'https://assets.coingecko.com/coins/images/6319/standard/usdc.png',
65
- }],
66
- },
67
- showThirdwebBranding: false,
68
- };
69
- }
17
+ import React from 'react';
70
18
  /**
71
- * PaymentWidget - Required component for app monetization
19
+ * PaymentWidget - Coming soon
72
20
  *
73
- * Wraps a trigger element and handles the full purchase flow.
74
- * Automatically checks USDC allowance skips authorize step if sufficient.
75
- * Credit card payments handled seamlessly via thirdweb Pay.
21
+ * Renders children as-is until payment processing is enabled in a future
22
+ * release. Wrap your purchase button with this component so you can enable
23
+ * payments without any code changes when they launch.
76
24
  */
77
- export const PaymentWidget = ({ appId, price, type = 'one-time', intervalDays = 30, onSuccess, onCancel, onError, theme = 'dark', className = '', children, disabled = false, }) => {
78
- const { hasPurchased, isLoading, pricing, } = useVarityPayment({ appId });
79
- const account = useActiveAccount();
80
- const [isAuthorized, setIsAuthorized] = useState(false);
81
- const [hasAllowance, setHasAllowance] = useState(null);
82
- // Get payment contract address
83
- const paymentsAddress = (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_VARITY_PAYMENTS_ADDRESS
84
- ? process.env.NEXT_PUBLIC_VARITY_PAYMENTS_ADDRESS
85
- : '0x0568cf3b5b9c94542aa8d32eb51ffa38912fc48c');
86
- // Amount needed in raw USDC units
87
- const amountNeeded = pricing?.priceUsdc
88
- ? pricing.priceUsdc
89
- : price
90
- ? BigInt(price * 10000) // cents * 10000 = USDC units (6 decimals)
91
- : BigInt(0);
92
- // Check USDC allowance on mount — skip authorize step if sufficient
93
- useEffect(() => {
94
- if (!account?.address || amountNeeded === BigInt(0)) {
95
- setHasAllowance(false);
96
- return;
97
- }
98
- const checkAllowance = async () => {
99
- try {
100
- const { createThirdwebClient } = await import('thirdweb');
101
- const client = createThirdwebClient({
102
- clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID || '',
103
- });
104
- const usdcContract = getContract({ client, chain: ARBITRUM_ONE, address: USDC_ADDRESS });
105
- const currentAllowance = await readContract({
106
- contract: usdcContract,
107
- method: 'function allowance(address owner, address spender) view returns (uint256)',
108
- params: [account.address, paymentsAddress],
109
- });
110
- setHasAllowance(BigInt(currentAllowance.toString()) >= amountNeeded);
111
- }
112
- catch {
113
- setHasAllowance(false);
114
- }
115
- };
116
- checkAllowance();
117
- }, [account?.address, amountNeeded, paymentsAddress]);
118
- // Calculate price in USD for display and payModal
119
- const priceUsd = pricing?.priceUsdc
120
- ? Number(pricing.priceUsdc) / 1_000_000
121
- : price
122
- ? price / 100
123
- : 0;
124
- const displayPrice = priceUsd > 0 ? `$${priceUsd.toFixed(2)}` : null;
125
- // Already purchased
126
- if (hasPurchased && !isLoading) {
127
- return (React.createElement("div", { className: `inline-flex items-center gap-2 text-green-500 ${className}` },
128
- React.createElement("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
129
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" })),
130
- React.createElement("span", null, "Purchased")));
131
- }
132
- // Loading
133
- if (isLoading) {
134
- return React.createElement("div", { className: className }, children);
135
- }
136
- // No pricing set
137
- if (!pricing?.isActive) {
138
- return null;
139
- }
140
- // Helper to get thirdweb client
141
- const getClient = async () => {
142
- const { createThirdwebClient } = await import('thirdweb');
143
- return createThirdwebClient({
144
- clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID || '',
145
- });
146
- };
147
- const needsAuthorization = hasAllowance === false && !isAuthorized;
148
- if (needsAuthorization) {
149
- // Step 1: Authorize payment (sets USDC allowance)
150
- // payModal handles credit card on-ramp if user has no USDC
151
- return (React.createElement(TransactionButton, { transaction: async () => {
152
- const client = await getClient();
153
- const usdcContract = getContract({ client, chain: ARBITRUM_ONE, address: USDC_ADDRESS });
154
- return approve({
155
- contract: usdcContract,
156
- spender: paymentsAddress,
157
- amount: priceUsd,
158
- });
159
- }, onTransactionConfirmed: () => {
160
- setIsAuthorized(true);
161
- }, onError: (error) => {
162
- onError?.(error);
163
- }, payModal: buildPayModalConfig({
164
- theme,
165
- title: `Payment — ${displayPrice}`,
166
- }), className: className, disabled: disabled }, children));
167
- }
168
- // Step 2 (or only step if allowance exists): Complete purchase
169
- return (React.createElement(TransactionButton, { transaction: async () => {
170
- const client = await getClient();
171
- const contract = getContract({ client, chain: ARBITRUM_ONE, address: paymentsAddress });
172
- return prepareContractCall({
173
- contract,
174
- method: {
175
- name: 'purchaseApp',
176
- type: 'function',
177
- stateMutability: 'nonpayable',
178
- inputs: [{ name: 'appId', type: 'uint64' }],
179
- outputs: [],
180
- },
181
- params: [BigInt(appId)],
182
- });
183
- }, onTransactionConfirmed: (receipt) => {
184
- onSuccess?.(receipt.transactionHash);
185
- }, onError: (error) => {
186
- onError?.(error);
187
- }, payModal: buildPayModalConfig({
188
- theme,
189
- title: type === 'subscription'
190
- ? `Subscribe — ${displayPrice}/mo`
191
- : `Purchase — ${displayPrice}`,
192
- }), className: className, disabled: disabled }, children));
25
+ export const PaymentWidget = ({ children, className = '', }) => {
26
+ return React.createElement("span", { className: className || undefined }, children);
193
27
  };
194
28
  export default PaymentWidget;
195
29
  //# sourceMappingURL=PaymentWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentWidget.js","sourceRoot":"","sources":["../../../src/components/PaymentWidget/PaymentWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,yCAAyC;AACzC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AAElE,6CAA6C;AAC7C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;AAExC;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,IAG5B;IACC,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,KAAK,EAAE,6BAA6B;SACrC;QACD,uDAAuD;QACvD,aAAa,EAAE,KAAc;QAC7B,wDAAwD;QACxD,WAAW,EAAE;YACX,iBAAiB,EAAE,QAAiB;SACrC;QACD,kEAAkE;QAClE,eAAe,EAAE;YACf,KAAK,EAAE,CAAC;oBACN,OAAO,EAAE,YAAY;oBACrB,IAAI,EAAE,KAAK;oBACX,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,kEAAkE;iBACzE,CAAC;SACH;QACD,oBAAoB,EAAE,KAAK;KAC5B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,KAAK,EACL,KAAK,E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Ae,YAAY,KAAK;gBAClC,CAAC,CAAC,cAAc,YAAY,EAAE;SACjC,CAAC,EACF,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,IAEjB,QAAQ,CACS,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"PaymentWidget.js","sourceRoot":"","sources":["../../../src/components/PaymentWidget/PaymentWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,QAAQ,EACR,SAAS,GAAG,EAAE,GACf,EAAE,EAAE;IACH,OAAO,8BAAM,SAAS,EAAE,SAAS,IAAI,SAAS,IAAG,QAAQ,CAAQ,CAAC;AACpE,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,45 +1,19 @@
1
1
  /**
2
- * useSeamlessPayment - One-Click Payment with Auto On-Ramp
2
+ * useSeamlessPayment Hook
3
3
  *
4
- * Combines balance check + on-ramp + approval + purchase into a single flow.
5
- * User just clicks "Pay" - everything happens automatically.
6
- *
7
- * Flow:
8
- * 1. Check USDC balance
9
- * 2. If insufficient → Auto-trigger Privy on-ramp (Bridge/MoonPay/Coinbase modal)
10
- * 3. Auto-approve USDC allowance if needed
11
- * 4. Execute purchase (90/10 split)
12
- *
13
- * Integration with Bridge:
14
- * - Once Bridge is configured in PrivyProvider's fundingMethodConfig
15
- * - useFundWallet automatically uses Bridge (Stripe UX)
16
- * - Falls back to MoonPay/Coinbase if Bridge unavailable
17
- *
18
- * @example
19
- * ```tsx
20
- * const { seamlessPurchase } = useSeamlessPayment({ appId: 123 });
21
- *
22
- * <button onClick={() => seamlessPurchase()}>
23
- * Pay $99
24
- * </button>
25
- * ```
26
- */
27
- /**
28
- * Enhanced payment hook with seamless on-ramp integration
4
+ * Payments are coming soon. Returns safe defaults until payment processing
5
+ * is enabled in a future release.
29
6
  */
30
7
  export declare function useSeamlessPayment({ appId }: {
31
8
  appId: number;
32
9
  }): {
33
10
  seamlessPurchase: () => Promise<{
34
- success: boolean;
35
- txHash?: string;
36
- error?: string;
37
- needsApproval?: boolean;
38
- needsFunding?: boolean;
11
+ success: false;
12
+ error: string;
39
13
  }>;
40
- onrampStatus: "idle" | "checking" | "funding" | "approving" | "purchasing";
41
- checkBalance: (address: string) => Promise<bigint>;
42
- checkAllowance: (address: string) => Promise<bigint>;
14
+ onrampStatus: "idle";
15
+ checkBalance: (_address: string) => Promise<bigint>;
16
+ checkAllowance: (_address: string) => Promise<bigint>;
43
17
  hasPurchased: boolean;
44
18
  isLoading: boolean;
45
19
  isPurchasing: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useSeamlessPayment.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useSeamlessPayment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAaH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;4BAiEd,OAAO,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;;4BA5D+C,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;8BAmBtB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;;;;;;;;EA6H5E"}
1
+ {"version":3,"file":"useSeamlessPayment.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useSeamlessPayment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;;;;;;6BAU5B,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;+BACtB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;;;;;;;;EAE5D"}
@@ -1,167 +1,21 @@
1
1
  /**
2
- * useSeamlessPayment - One-Click Payment with Auto On-Ramp
2
+ * useSeamlessPayment Hook
3
3
  *
4
- * Combines balance check + on-ramp + approval + purchase into a single flow.
5
- * User just clicks "Pay" - everything happens automatically.
6
- *
7
- * Flow:
8
- * 1. Check USDC balance
9
- * 2. If insufficient → Auto-trigger Privy on-ramp (Bridge/MoonPay/Coinbase modal)
10
- * 3. Auto-approve USDC allowance if needed
11
- * 4. Execute purchase (90/10 split)
12
- *
13
- * Integration with Bridge:
14
- * - Once Bridge is configured in PrivyProvider's fundingMethodConfig
15
- * - useFundWallet automatically uses Bridge (Stripe UX)
16
- * - Falls back to MoonPay/Coinbase if Bridge unavailable
17
- *
18
- * @example
19
- * ```tsx
20
- * const { seamlessPurchase } = useSeamlessPayment({ appId: 123 });
21
- *
22
- * <button onClick={() => seamlessPurchase()}>
23
- * Pay $99
24
- * </button>
25
- * ```
4
+ * Payments are coming soon. Returns safe defaults until payment processing
5
+ * is enabled in a future release.
26
6
  */
27
- import { useCallback, useState } from 'react';
28
- import { useFundWallet } from '@privy-io/react-auth';
29
- import { useActiveAccount } from 'thirdweb/react';
30
- import { readContract, getContract } from 'thirdweb';
31
- import { createThirdwebClient, defineChain } from 'thirdweb';
32
7
  import { useVarityPayment } from './useVarityPayment';
33
- import { THIRDWEB_CLIENT_ID } from '../../config/chains';
34
- const USDC_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'; // Arbitrum One USDC
35
- const VARITY_PAYMENTS_ADDRESS = '0x0568cf3b5b9c94542aa8d32eb51ffa38912fc48c';
36
- /**
37
- * Enhanced payment hook with seamless on-ramp integration
38
- */
39
8
  export function useSeamlessPayment({ appId }) {
40
- const basePayment = useVarityPayment({ appId });
41
- const { fundWallet } = useFundWallet();
42
- const account = useActiveAccount();
43
- const [onrampStatus, setOnrampStatus] = useState('idle');
44
- const client = createThirdwebClient({ clientId: THIRDWEB_CLIENT_ID });
45
- /**
46
- * Check USDC balance on Arbitrum One
47
- */
48
- const checkBalance = useCallback(async (address) => {
49
- const usdcContract = getContract({
50
- client,
51
- chain: defineChain(42161), // Arbitrum One
52
- address: USDC_ADDRESS,
53
- });
54
- const balance = await readContract({
55
- contract: usdcContract,
56
- method: 'function balanceOf(address) view returns (uint256)',
57
- params: [address],
58
- });
59
- return BigInt(balance.toString());
60
- }, [client]);
61
- /**
62
- * Check USDC allowance for VarityPayments contract
63
- */
64
- const checkAllowance = useCallback(async (address) => {
65
- const usdcContract = getContract({
66
- client,
67
- chain: defineChain(42161), // Arbitrum One
68
- address: USDC_ADDRESS,
69
- });
70
- const allowance = await readContract({
71
- contract: usdcContract,
72
- method: 'function allowance(address owner, address spender) view returns (uint256)',
73
- params: [address, VARITY_PAYMENTS_ADDRESS],
74
- });
75
- return BigInt(allowance.toString());
76
- }, [client]);
77
- /**
78
- * Seamless purchase flow - ONE CLICK handles everything
79
- *
80
- * Steps:
81
- * 1. Check USDC balance
82
- * 2. If insufficient → Open Bridge/MoonPay/Coinbase modal (via Privy)
83
- * 3. Check USDC allowance
84
- * 4. If insufficient → PaymentWidget's TransactionButton handles approval
85
- * 5. Execute purchase
86
- *
87
- * User Experience:
88
- * - Click "Pay $99"
89
- * - If no USDC → Credit card modal opens (Bridge = Stripe UX)
90
- * - Enter card details
91
- * - "Processing..." (approval + purchase happen automatically)
92
- * - "Payment successful!"
93
- *
94
- * User NEVER sees: USDC, blockchain, transactions, approvals
95
- */
96
- const seamlessPurchase = useCallback(async () => {
97
- if (!account?.address) {
98
- return { success: false, error: 'Please connect your wallet first' };
99
- }
100
- if (!basePayment.pricing || !basePayment.pricing.isActive) {
101
- return { success: false, error: 'This app is not available for purchase' };
102
- }
103
- if (basePayment.hasPurchased) {
104
- return { success: false, error: 'You have already purchased this app' };
105
- }
106
- const needed = basePayment.pricing.priceUsdc;
107
- try {
108
- // Step 1: Check USDC balance
109
- setOnrampStatus('checking');
110
- const balance = await checkBalance(account.address);
111
- console.log(`[SeamlessPayment] Balance: ${balance}, Needed: ${needed}`);
112
- // Step 2: If insufficient balance, trigger on-ramp
113
- if (balance < needed) {
114
- const amountToFund = Number(needed - balance) / 1_000_000; // USDC has 6 decimals
115
- const amountRounded = Math.ceil(amountToFund); // Round up to nearest dollar
116
- console.log(`[SeamlessPayment] Insufficient USDC. Funding $${amountRounded}...`);
117
- setOnrampStatus('funding');
118
- // This opens Privy's funding modal
119
- // If Bridge is configured → Bridge (Stripe) modal
120
- // Otherwise → MoonPay/Coinbase modal
121
- await fundWallet(account.address, {
122
- chain: defineChain(42161), // Arbitrum One
123
- asset: 'USDC',
124
- amount: amountRounded.toString(),
125
- });
126
- console.log('[SeamlessPayment] Funding complete!');
127
- // Return status so PaymentWidget can show "Please click again to complete purchase"
128
- return {
129
- success: false,
130
- needsFunding: true,
131
- error: 'Funding complete! Please click the purchase button again to complete your purchase.'
132
- };
133
- }
134
- // Step 3: Check allowance
135
- const allowance = await checkAllowance(account.address);
136
- if (allowance < needed) {
137
- // Let PaymentWidget's TransactionButton handle approval
138
- console.log('[SeamlessPayment] Allowance insufficient, needs approval');
139
- return { success: false, needsApproval: true };
140
- }
141
- // Step 4: Execute purchase (handled by basePayment.purchase)
142
- setOnrampStatus('purchasing');
143
- const txHash = await basePayment.purchase();
144
- if (txHash) {
145
- setOnrampStatus('idle');
146
- return { success: true, txHash };
147
- }
148
- else {
149
- return { success: false, error: 'Purchase failed - no transaction hash' };
150
- }
151
- }
152
- catch (error) {
153
- console.error('[SeamlessPayment] Error:', error);
154
- setOnrampStatus('idle');
155
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
156
- return { success: false, error: errorMessage };
157
- }
158
- }, [account, basePayment, checkBalance, checkAllowance, fundWallet]);
9
+ const base = useVarityPayment({ appId });
159
10
  return {
160
- ...basePayment,
161
- seamlessPurchase,
162
- onrampStatus,
163
- checkBalance,
164
- checkAllowance,
11
+ ...base,
12
+ seamlessPurchase: async () => ({
13
+ success: false,
14
+ error: 'Payments coming soon',
15
+ }),
16
+ onrampStatus: 'idle',
17
+ checkBalance: async (_address) => BigInt(0),
18
+ checkAllowance: async (_address) => BigInt(0),
165
19
  };
166
20
  }
167
21
  //# sourceMappingURL=useSeamlessPayment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSeamlessPayment.js","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useSeamlessPayment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAuB,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,YAAY,GAAG,4CAA4C,CAAC,CAAC,oBAAoB;AACvF,MAAM,uBAAuB,GAAG,4CAA4C,CAAC;AAE7E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAqB;IAC7D,MAAM,WAAW,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAA+D,MAAM,CAAC,CAAC;IAEvH,MAA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AErE,OAAO;QACL,GAAG,WAAW;QACd,gBAAgB;QAChB,YAAY;QACZ,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"useSeamlessPayment.js","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useSeamlessPayment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAqB;IAC7D,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG,IAAI;QACP,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC7B,OAAO,EAAE,KAAc;YACvB,KAAK,EAAE,sBAAsB;SAC9B,CAAC;QACF,YAAY,EAAE,MAAe;QAC7B,YAAY,EAAE,KAAK,EAAE,QAAgB,EAAmB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACpE,cAAc,EAAE,KAAK,EAAE,QAAgB,EAAmB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;KACvE,CAAC;AACJ,CAAC"}
@@ -1,10 +1,8 @@
1
1
  /**
2
2
  * useVarityPayment Hook
3
- * Manages purchase state for developer apps with 90/10 revenue split
4
- */
5
- import { UseVarityPaymentReturn, UseVarityPaymentOptions } from './types';
6
- /**
7
- * Hook for managing app purchase state
3
+ *
4
+ * Payments are coming soon. Returns safe defaults until payment processing
5
+ * is enabled in a future release.
8
6
  *
9
7
  * @example
10
8
  * ```tsx
@@ -15,6 +13,7 @@ import { UseVarityPaymentReturn, UseVarityPaymentOptions } from './types';
15
13
  * return <PremiumContent />;
16
14
  * ```
17
15
  */
18
- export declare function useVarityPayment({ appId, autoFetch, }: UseVarityPaymentOptions): UseVarityPaymentReturn;
16
+ import type { UseVarityPaymentOptions, UseVarityPaymentReturn } from './types';
17
+ export declare function useVarityPayment(_options: UseVarityPaymentOptions): UseVarityPaymentReturn;
19
18
  export default useVarityPayment;
20
19
  //# sourceMappingURL=useVarityPayment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useVarityPayment.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useVarityPayment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAIxB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,SAAgB,GACjB,EAAE,uBAAuB,GAAG,sBAAsB,CA4JlD;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"useVarityPayment.d.ts","sourceRoot":"","sources":["../../../src/components/PaymentWidget/useVarityPayment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE/E,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,uBAAuB,GAChC,sBAAsB,CAUxB;AAED,eAAe,gBAAgB,CAAC"}