@b3dotfun/sdk 0.1.68 → 0.1.69-alpha.0

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 (263) hide show
  1. package/dist/cjs/anyspend/platform/client.d.ts +35 -0
  2. package/dist/cjs/anyspend/platform/client.js +158 -0
  3. package/dist/cjs/anyspend/platform/errors.d.ts +38 -0
  4. package/dist/cjs/anyspend/platform/errors.js +77 -0
  5. package/dist/cjs/anyspend/platform/index.d.ts +87 -0
  6. package/dist/cjs/anyspend/platform/index.js +85 -0
  7. package/dist/cjs/anyspend/platform/resources/analytics.d.ts +7 -0
  8. package/dist/cjs/anyspend/platform/resources/analytics.js +12 -0
  9. package/dist/cjs/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  10. package/dist/cjs/anyspend/platform/resources/checkout-sessions.js +27 -0
  11. package/dist/cjs/anyspend/platform/resources/customers.d.ts +19 -0
  12. package/dist/cjs/anyspend/platform/resources/customers.js +34 -0
  13. package/dist/cjs/anyspend/platform/resources/discount-codes.d.ts +29 -0
  14. package/dist/cjs/anyspend/platform/resources/discount-codes.js +31 -0
  15. package/dist/cjs/anyspend/platform/resources/events.d.ts +14 -0
  16. package/dist/cjs/anyspend/platform/resources/events.js +16 -0
  17. package/dist/cjs/anyspend/platform/resources/notifications.d.ts +18 -0
  18. package/dist/cjs/anyspend/platform/resources/notifications.js +27 -0
  19. package/dist/cjs/anyspend/platform/resources/organization.d.ts +17 -0
  20. package/dist/cjs/anyspend/platform/resources/organization.js +15 -0
  21. package/dist/cjs/anyspend/platform/resources/payment-links.d.ts +21 -0
  22. package/dist/cjs/anyspend/platform/resources/payment-links.js +49 -0
  23. package/dist/cjs/anyspend/platform/resources/products.d.ts +27 -0
  24. package/dist/cjs/anyspend/platform/resources/products.js +31 -0
  25. package/dist/cjs/anyspend/platform/resources/transactions.d.ts +11 -0
  26. package/dist/cjs/anyspend/platform/resources/transactions.js +25 -0
  27. package/dist/cjs/anyspend/platform/resources/webhooks.d.ts +14 -0
  28. package/dist/cjs/anyspend/platform/resources/webhooks.js +33 -0
  29. package/dist/cjs/anyspend/platform/resources/widgets.d.ts +38 -0
  30. package/dist/cjs/anyspend/platform/resources/widgets.js +31 -0
  31. package/dist/cjs/anyspend/platform/types.d.ts +478 -0
  32. package/dist/cjs/anyspend/platform/types.js +5 -0
  33. package/dist/cjs/anyspend/platform/utils/idempotency.d.ts +4 -0
  34. package/dist/cjs/anyspend/platform/utils/idempotency.js +17 -0
  35. package/dist/cjs/anyspend/platform/utils/pagination.d.ts +12 -0
  36. package/dist/cjs/anyspend/platform/utils/pagination.js +22 -0
  37. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -1
  38. package/dist/cjs/anyspend/react/components/AnySpend.js +127 -16
  39. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -4
  40. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +2 -2
  41. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
  42. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
  43. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  44. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  45. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
  46. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
  47. package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
  48. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
  49. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +48 -16
  50. package/dist/cjs/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  51. package/dist/cjs/anyspend/react/components/checkout/KycGate.js +203 -0
  52. package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  53. package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.js +145 -0
  54. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
  55. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  56. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  57. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
  58. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  59. package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
  60. package/dist/cjs/anyspend/react/components/index.d.ts +1 -1
  61. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  62. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  63. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
  64. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -0
  65. package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  66. package/dist/cjs/anyspend/react/hooks/useKycStatus.js +124 -0
  67. package/dist/cjs/anyspend/services/anyspend.d.ts +4 -1
  68. package/dist/cjs/anyspend/services/anyspend.js +3 -1
  69. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
  70. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  71. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  72. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
  73. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  74. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
  75. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  76. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  77. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
  78. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  79. package/dist/cjs/global-account/react/hooks/useAuth.js +1 -1
  80. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +3 -1
  81. package/dist/cjs/global-account/react/hooks/useAuthentication.js +94 -24
  82. package/dist/cjs/global-account/react/hooks/useGetAllTWSigners.js +2 -1
  83. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  84. package/dist/cjs/global-account/react/stores/useModalStore.js +2 -0
  85. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  86. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +17 -0
  87. package/dist/esm/anyspend/platform/client.d.ts +35 -0
  88. package/dist/esm/anyspend/platform/client.js +153 -0
  89. package/dist/esm/anyspend/platform/errors.d.ts +38 -0
  90. package/dist/esm/anyspend/platform/errors.js +67 -0
  91. package/dist/esm/anyspend/platform/index.d.ts +87 -0
  92. package/dist/esm/anyspend/platform/index.js +75 -0
  93. package/dist/esm/anyspend/platform/resources/analytics.d.ts +7 -0
  94. package/dist/esm/anyspend/platform/resources/analytics.js +8 -0
  95. package/dist/esm/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  96. package/dist/esm/anyspend/platform/resources/checkout-sessions.js +23 -0
  97. package/dist/esm/anyspend/platform/resources/customers.d.ts +19 -0
  98. package/dist/esm/anyspend/platform/resources/customers.js +30 -0
  99. package/dist/esm/anyspend/platform/resources/discount-codes.d.ts +29 -0
  100. package/dist/esm/anyspend/platform/resources/discount-codes.js +27 -0
  101. package/dist/esm/anyspend/platform/resources/events.d.ts +14 -0
  102. package/dist/esm/anyspend/platform/resources/events.js +12 -0
  103. package/dist/esm/anyspend/platform/resources/notifications.d.ts +18 -0
  104. package/dist/esm/anyspend/platform/resources/notifications.js +23 -0
  105. package/dist/esm/anyspend/platform/resources/organization.d.ts +17 -0
  106. package/dist/esm/anyspend/platform/resources/organization.js +11 -0
  107. package/dist/esm/anyspend/platform/resources/payment-links.d.ts +21 -0
  108. package/dist/esm/anyspend/platform/resources/payment-links.js +45 -0
  109. package/dist/esm/anyspend/platform/resources/products.d.ts +27 -0
  110. package/dist/esm/anyspend/platform/resources/products.js +27 -0
  111. package/dist/esm/anyspend/platform/resources/transactions.d.ts +11 -0
  112. package/dist/esm/anyspend/platform/resources/transactions.js +21 -0
  113. package/dist/esm/anyspend/platform/resources/webhooks.d.ts +14 -0
  114. package/dist/esm/anyspend/platform/resources/webhooks.js +29 -0
  115. package/dist/esm/anyspend/platform/resources/widgets.d.ts +38 -0
  116. package/dist/esm/anyspend/platform/resources/widgets.js +27 -0
  117. package/dist/esm/anyspend/platform/types.d.ts +478 -0
  118. package/dist/esm/anyspend/platform/types.js +4 -0
  119. package/dist/esm/anyspend/platform/utils/idempotency.d.ts +4 -0
  120. package/dist/esm/anyspend/platform/utils/idempotency.js +14 -0
  121. package/dist/esm/anyspend/platform/utils/pagination.d.ts +12 -0
  122. package/dist/esm/anyspend/platform/utils/pagination.js +19 -0
  123. package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -1
  124. package/dist/esm/anyspend/react/components/AnySpend.js +128 -17
  125. package/dist/esm/anyspend/react/components/AnySpendCustom.js +4 -4
  126. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -2
  127. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
  128. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
  129. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  130. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  131. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
  132. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
  133. package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
  134. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
  135. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +50 -18
  136. package/dist/esm/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  137. package/dist/esm/anyspend/react/components/checkout/KycGate.js +167 -0
  138. package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  139. package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.js +142 -0
  140. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
  141. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  142. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  143. package/dist/esm/anyspend/react/components/common/OrderDetails.js +1 -1
  144. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  145. package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
  146. package/dist/esm/anyspend/react/components/index.d.ts +1 -1
  147. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  148. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  149. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
  150. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -0
  151. package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  152. package/dist/esm/anyspend/react/hooks/useKycStatus.js +117 -0
  153. package/dist/esm/anyspend/services/anyspend.d.ts +4 -1
  154. package/dist/esm/anyspend/services/anyspend.js +3 -1
  155. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  156. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  157. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  158. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
  159. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  160. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
  161. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  162. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  163. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
  164. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  165. package/dist/esm/global-account/react/hooks/useAuth.js +2 -2
  166. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +3 -1
  167. package/dist/esm/global-account/react/hooks/useAuthentication.js +94 -24
  168. package/dist/esm/global-account/react/hooks/useGetAllTWSigners.js +2 -1
  169. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  170. package/dist/esm/global-account/react/stores/useModalStore.js +2 -0
  171. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  172. package/dist/esm/global-account/react/utils/createWagmiConfig.js +16 -0
  173. package/dist/styles/index.css +1 -1
  174. package/dist/types/anyspend/platform/client.d.ts +35 -0
  175. package/dist/types/anyspend/platform/errors.d.ts +38 -0
  176. package/dist/types/anyspend/platform/index.d.ts +87 -0
  177. package/dist/types/anyspend/platform/resources/analytics.d.ts +7 -0
  178. package/dist/types/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  179. package/dist/types/anyspend/platform/resources/customers.d.ts +19 -0
  180. package/dist/types/anyspend/platform/resources/discount-codes.d.ts +29 -0
  181. package/dist/types/anyspend/platform/resources/events.d.ts +14 -0
  182. package/dist/types/anyspend/platform/resources/notifications.d.ts +18 -0
  183. package/dist/types/anyspend/platform/resources/organization.d.ts +17 -0
  184. package/dist/types/anyspend/platform/resources/payment-links.d.ts +21 -0
  185. package/dist/types/anyspend/platform/resources/products.d.ts +27 -0
  186. package/dist/types/anyspend/platform/resources/transactions.d.ts +11 -0
  187. package/dist/types/anyspend/platform/resources/webhooks.d.ts +14 -0
  188. package/dist/types/anyspend/platform/resources/widgets.d.ts +38 -0
  189. package/dist/types/anyspend/platform/types.d.ts +478 -0
  190. package/dist/types/anyspend/platform/utils/idempotency.d.ts +4 -0
  191. package/dist/types/anyspend/platform/utils/pagination.d.ts +12 -0
  192. package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -1
  193. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
  194. package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  195. package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
  196. package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
  197. package/dist/types/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  198. package/dist/types/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  199. package/dist/types/anyspend/react/components/index.d.ts +1 -1
  200. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  201. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
  202. package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  203. package/dist/types/anyspend/services/anyspend.d.ts +4 -1
  204. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  205. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +3 -1
  206. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  207. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  208. package/package.json +7 -1
  209. package/src/anyspend/docs/checkout-sessions.md +20 -3
  210. package/src/anyspend/platform/client.ts +198 -0
  211. package/src/anyspend/platform/errors.ts +92 -0
  212. package/src/anyspend/platform/index.ts +129 -0
  213. package/src/anyspend/platform/resources/analytics.ts +10 -0
  214. package/src/anyspend/platform/resources/checkout-sessions.ts +36 -0
  215. package/src/anyspend/platform/resources/customers.ts +54 -0
  216. package/src/anyspend/platform/resources/discount-codes.ts +63 -0
  217. package/src/anyspend/platform/resources/events.ts +22 -0
  218. package/src/anyspend/platform/resources/notifications.ts +37 -0
  219. package/src/anyspend/platform/resources/organization.ts +24 -0
  220. package/src/anyspend/platform/resources/payment-links.ts +74 -0
  221. package/src/anyspend/platform/resources/products.ts +59 -0
  222. package/src/anyspend/platform/resources/transactions.ts +33 -0
  223. package/src/anyspend/platform/resources/webhooks.ts +47 -0
  224. package/src/anyspend/platform/resources/widgets.ts +63 -0
  225. package/src/anyspend/platform/types.ts +532 -0
  226. package/src/anyspend/platform/utils/idempotency.ts +15 -0
  227. package/src/anyspend/platform/utils/pagination.ts +32 -0
  228. package/src/anyspend/react/components/AnySpend.tsx +152 -18
  229. package/src/anyspend/react/components/AnySpendCustom.tsx +4 -4
  230. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -2
  231. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +81 -18
  232. package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
  233. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +8 -0
  234. package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +4 -13
  235. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +86 -17
  236. package/src/anyspend/react/components/checkout/KycGate.tsx +387 -0
  237. package/src/anyspend/react/components/checkout/VariablePricingInput.tsx +247 -0
  238. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -1
  239. package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
  240. package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
  241. package/src/anyspend/react/components/common/OrderDetails.tsx +1 -1
  242. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
  243. package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
  244. package/src/anyspend/react/components/index.ts +1 -0
  245. package/src/anyspend/react/hooks/index.ts +1 -0
  246. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +17 -0
  247. package/src/anyspend/react/hooks/useKycStatus.ts +150 -0
  248. package/src/anyspend/services/anyspend.ts +7 -0
  249. package/src/global-account/react/components/B3DynamicModal.tsx +0 -2
  250. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +7 -7
  251. package/src/global-account/react/components/ManageAccount/HomeActions.tsx +2 -2
  252. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +7 -7
  253. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +1 -1
  254. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +1 -1
  255. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -5
  256. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -1
  257. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +35 -25
  258. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +1 -1
  259. package/src/global-account/react/hooks/useAuth.ts +2 -2
  260. package/src/global-account/react/hooks/useAuthentication.ts +92 -27
  261. package/src/global-account/react/hooks/useGetAllTWSigners.tsx +2 -1
  262. package/src/global-account/react/stores/useModalStore.ts +6 -0
  263. package/src/global-account/react/utils/createWagmiConfig.tsx +18 -0
@@ -0,0 +1,54 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type {
4
+ Customer,
5
+ Transaction,
6
+ ListResponse,
7
+ DeletedResponse,
8
+ CreateCustomerParams,
9
+ UpdateCustomerParams,
10
+ ExportCustomersParams,
11
+ PaginationParams,
12
+ } from "../types";
13
+
14
+ export interface ListCustomersParams extends PaginationParams {
15
+ search?: string;
16
+ sort?: "created_at" | "updated_at" | "total_paid" | "transaction_count";
17
+ order?: "asc" | "desc";
18
+ }
19
+
20
+ export class CustomersResource {
21
+ constructor(private client: HttpClient) {}
22
+
23
+ async list(params?: ListCustomersParams): Promise<ListResponse<Customer>> {
24
+ return this.client.get<ListResponse<Customer>>("/customers", params);
25
+ }
26
+
27
+ async *listAutoPaginate(params?: Omit<ListCustomersParams, "page">): AsyncGenerator<Customer> {
28
+ yield* autoPaginate<Customer>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
29
+ }
30
+
31
+ async create(params: CreateCustomerParams): Promise<Customer> {
32
+ return this.client.post<Customer>("/customers", params);
33
+ }
34
+
35
+ async get(id: string): Promise<Customer> {
36
+ return this.client.get<Customer>(`/customers/${id}`);
37
+ }
38
+
39
+ async update(id: string, params: UpdateCustomerParams): Promise<Customer> {
40
+ return this.client.patch<Customer>(`/customers/${id}`, params);
41
+ }
42
+
43
+ async delete(id: string): Promise<DeletedResponse> {
44
+ return this.client.delete<DeletedResponse>(`/customers/${id}`);
45
+ }
46
+
47
+ async transactions(id: string, params?: PaginationParams): Promise<ListResponse<Transaction>> {
48
+ return this.client.get<ListResponse<Transaction>>(`/customers/${id}/transactions`, params);
49
+ }
50
+
51
+ async export(params?: ExportCustomersParams): Promise<string> {
52
+ return this.client.get<string>("/customers/export", params);
53
+ }
54
+ }
@@ -0,0 +1,63 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type {
4
+ DiscountCode,
5
+ ListResponse,
6
+ DeletedResponse,
7
+ CreateDiscountCodeParams,
8
+ BatchCreateDiscountCodesParams,
9
+ ValidateDiscountResult,
10
+ BatchCreateResult,
11
+ PaginationParams,
12
+ } from "../types";
13
+
14
+ export interface ListDiscountCodesParams extends PaginationParams {
15
+ payment_link_id?: string;
16
+ active?: "true" | "false";
17
+ search?: string;
18
+ }
19
+
20
+ export interface UpdateDiscountCodeParams {
21
+ is_active?: boolean;
22
+ max_uses?: number;
23
+ min_order_amount?: string;
24
+ expires_at?: number;
25
+ }
26
+
27
+ export interface ValidateDiscountParams {
28
+ code: string;
29
+ payment_link_id?: string;
30
+ amount?: string;
31
+ }
32
+
33
+ export class DiscountCodesResource {
34
+ constructor(private client: HttpClient) {}
35
+
36
+ async list(params?: ListDiscountCodesParams): Promise<ListResponse<DiscountCode>> {
37
+ return this.client.get<ListResponse<DiscountCode>>("/discount-codes", params);
38
+ }
39
+
40
+ async *listAutoPaginate(params?: Omit<ListDiscountCodesParams, "page">): AsyncGenerator<DiscountCode> {
41
+ yield* autoPaginate<DiscountCode>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
42
+ }
43
+
44
+ async create(params: CreateDiscountCodeParams): Promise<DiscountCode> {
45
+ return this.client.post<DiscountCode>("/discount-codes", params);
46
+ }
47
+
48
+ async update(id: string, params: UpdateDiscountCodeParams): Promise<DiscountCode> {
49
+ return this.client.patch<DiscountCode>(`/discount-codes/${id}`, params);
50
+ }
51
+
52
+ async delete(id: string): Promise<DeletedResponse> {
53
+ return this.client.delete<DeletedResponse>(`/discount-codes/${id}`);
54
+ }
55
+
56
+ async validate(params: ValidateDiscountParams): Promise<ValidateDiscountResult> {
57
+ return this.client.post<ValidateDiscountResult>("/discount-codes/validate", params);
58
+ }
59
+
60
+ async batchCreate(params: BatchCreateDiscountCodesParams): Promise<BatchCreateResult> {
61
+ return this.client.post<BatchCreateResult>("/discount-codes/batch", params);
62
+ }
63
+ }
@@ -0,0 +1,22 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type { ApiEvent, ListResponse, PaginationParams } from "../types";
4
+
5
+ export interface ListEventsParams extends PaginationParams {
6
+ event_type?: string;
7
+ resource_type?: string;
8
+ from?: number;
9
+ to?: number;
10
+ }
11
+
12
+ export class EventsResource {
13
+ constructor(private client: HttpClient) {}
14
+
15
+ async list(params?: ListEventsParams): Promise<ListResponse<ApiEvent>> {
16
+ return this.client.get<ListResponse<ApiEvent>>("/events", params);
17
+ }
18
+
19
+ async *listAutoPaginate(params?: Omit<ListEventsParams, "page">): AsyncGenerator<ApiEvent> {
20
+ yield* autoPaginate<ApiEvent>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
21
+ }
22
+ }
@@ -0,0 +1,37 @@
1
+ import type { HttpClient } from "../client";
2
+ import type { NotificationSettings, UpdateNotificationSettingsParams, ActionResponse } from "../types";
3
+
4
+ export interface TelegramLinkResult {
5
+ object: "telegram_link";
6
+ link_url: string;
7
+ link_code: string;
8
+ expires_at: number;
9
+ }
10
+
11
+ export class NotificationsResource {
12
+ constructor(private client: HttpClient) {}
13
+
14
+ async get(): Promise<NotificationSettings> {
15
+ return this.client.get<NotificationSettings>("/notifications");
16
+ }
17
+
18
+ async update(params: UpdateNotificationSettingsParams): Promise<NotificationSettings> {
19
+ return this.client.patch<NotificationSettings>("/notifications", params);
20
+ }
21
+
22
+ async linkTelegram(): Promise<TelegramLinkResult> {
23
+ return this.client.post<TelegramLinkResult>("/notifications/telegram/link");
24
+ }
25
+
26
+ async unlinkTelegram(): Promise<ActionResponse> {
27
+ return this.client.post<ActionResponse>("/notifications/telegram/unlink");
28
+ }
29
+
30
+ async testEmail(): Promise<ActionResponse> {
31
+ return this.client.post<ActionResponse>("/notifications/test/email");
32
+ }
33
+
34
+ async testTelegram(): Promise<ActionResponse> {
35
+ return this.client.post<ActionResponse>("/notifications/test/telegram");
36
+ }
37
+ }
@@ -0,0 +1,24 @@
1
+ import type { HttpClient } from "../client";
2
+ import type { Organization } from "../types";
3
+
4
+ export interface UpdateOrganizationParams {
5
+ name?: string;
6
+ description?: string;
7
+ logo_url?: string;
8
+ website_url?: string;
9
+ default_recipient_address?: string;
10
+ default_chain_id?: number;
11
+ default_token_address?: string;
12
+ }
13
+
14
+ export class OrganizationResource {
15
+ constructor(private client: HttpClient) {}
16
+
17
+ async get(): Promise<Organization> {
18
+ return this.client.get<Organization>("/organization");
19
+ }
20
+
21
+ async update(params: UpdateOrganizationParams): Promise<Organization> {
22
+ return this.client.patch<Organization>("/organization", params);
23
+ }
24
+ }
@@ -0,0 +1,74 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type {
4
+ PaymentLink,
5
+ PaymentLinkItem,
6
+ PaymentLinkStats,
7
+ CheckoutSession,
8
+ ListResponse,
9
+ DeletedResponse,
10
+ CreatePaymentLinkParams,
11
+ CreatePaymentLinkItemParams,
12
+ UpdatePaymentLinkParams,
13
+ ListPaymentLinksParams,
14
+ PaginationParams,
15
+ } from "../types";
16
+
17
+ export class PaymentLinksResource {
18
+ constructor(private client: HttpClient) {}
19
+
20
+ async list(params?: ListPaymentLinksParams): Promise<ListResponse<PaymentLink>> {
21
+ return this.client.get<ListResponse<PaymentLink>>("/payment-links", params);
22
+ }
23
+
24
+ async *listAutoPaginate(params?: Omit<ListPaymentLinksParams, "page">): AsyncGenerator<PaymentLink> {
25
+ yield* autoPaginate<PaymentLink>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
26
+ }
27
+
28
+ async create(params: CreatePaymentLinkParams): Promise<PaymentLink> {
29
+ return this.client.post<PaymentLink>("/payment-links", params);
30
+ }
31
+
32
+ async get(id: string): Promise<PaymentLink> {
33
+ return this.client.get<PaymentLink>(`/payment-links/${id}`);
34
+ }
35
+
36
+ async update(id: string, params: UpdatePaymentLinkParams): Promise<PaymentLink> {
37
+ return this.client.patch<PaymentLink>(`/payment-links/${id}`, params);
38
+ }
39
+
40
+ async delete(id: string): Promise<DeletedResponse> {
41
+ return this.client.delete<DeletedResponse>(`/payment-links/${id}`);
42
+ }
43
+
44
+ async duplicate(id: string, overrides?: Partial<CreatePaymentLinkParams>): Promise<PaymentLink> {
45
+ return this.client.post<PaymentLink>(`/payment-links/${id}/duplicate`, overrides ?? {});
46
+ }
47
+
48
+ async stats(id: string, days?: number): Promise<PaymentLinkStats> {
49
+ return this.client.get<PaymentLinkStats>(`/payment-links/${id}/stats`, days !== undefined ? { days } : undefined);
50
+ }
51
+
52
+ async sessions(id: string, params?: PaginationParams): Promise<ListResponse<CheckoutSession>> {
53
+ return this.client.get<ListResponse<CheckoutSession>>(`/payment-links/${id}/sessions`, params);
54
+ }
55
+
56
+ async visitors(
57
+ id: string,
58
+ params?: PaginationParams & { days?: number },
59
+ ): Promise<ListResponse<Record<string, unknown>>> {
60
+ return this.client.get<ListResponse<Record<string, unknown>>>(`/payment-links/${id}/visitors`, params);
61
+ }
62
+
63
+ async items(id: string): Promise<PaymentLinkItem[]> {
64
+ return this.client.get<PaymentLinkItem[]>(`/payment-links/${id}/items`);
65
+ }
66
+
67
+ async addItem(id: string, item: CreatePaymentLinkItemParams): Promise<PaymentLinkItem> {
68
+ return this.client.post<PaymentLinkItem>(`/payment-links/${id}/items`, item);
69
+ }
70
+
71
+ async removeItem(id: string, itemId: string): Promise<DeletedResponse> {
72
+ return this.client.delete<DeletedResponse>(`/payment-links/${id}/items/${itemId}`);
73
+ }
74
+ }
@@ -0,0 +1,59 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type {
4
+ Product,
5
+ PaymentLink,
6
+ ListResponse,
7
+ DeletedResponse,
8
+ CreateProductParams,
9
+ UpdateProductParams,
10
+ PaginationParams,
11
+ } from "../types";
12
+
13
+ export interface ListProductsParams extends PaginationParams {
14
+ search?: string;
15
+ active?: "true" | "false";
16
+ product_type?: "one_time" | "subscription" | "variable";
17
+ sort?: "created_at" | "updated_at" | "name";
18
+ order?: "asc" | "desc";
19
+ }
20
+
21
+ export interface GenerateLinkParams {
22
+ recipient_address?: string;
23
+ name?: string;
24
+ description?: string;
25
+ theme_color?: string;
26
+ button_text?: string;
27
+ }
28
+
29
+ export class ProductsResource {
30
+ constructor(private client: HttpClient) {}
31
+
32
+ async list(params?: ListProductsParams): Promise<ListResponse<Product>> {
33
+ return this.client.get<ListResponse<Product>>("/products", params);
34
+ }
35
+
36
+ async *listAutoPaginate(params?: Omit<ListProductsParams, "page">): AsyncGenerator<Product> {
37
+ yield* autoPaginate<Product>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
38
+ }
39
+
40
+ async create(params: CreateProductParams): Promise<Product> {
41
+ return this.client.post<Product>("/products", params);
42
+ }
43
+
44
+ async get(id: string): Promise<Product> {
45
+ return this.client.get<Product>(`/products/${id}`);
46
+ }
47
+
48
+ async update(id: string, params: UpdateProductParams): Promise<Product> {
49
+ return this.client.patch<Product>(`/products/${id}`, params);
50
+ }
51
+
52
+ async delete(id: string): Promise<DeletedResponse> {
53
+ return this.client.delete<DeletedResponse>(`/products/${id}`);
54
+ }
55
+
56
+ async generateLink(id: string, params?: GenerateLinkParams): Promise<PaymentLink> {
57
+ return this.client.post<PaymentLink>(`/products/${id}/generate-link`, params ?? {});
58
+ }
59
+ }
@@ -0,0 +1,33 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type {
4
+ Transaction,
5
+ TransactionStats,
6
+ ListResponse,
7
+ ListTransactionsParams,
8
+ ExportTransactionsParams,
9
+ } from "../types";
10
+
11
+ export class TransactionsResource {
12
+ constructor(private client: HttpClient) {}
13
+
14
+ async list(params?: ListTransactionsParams): Promise<ListResponse<Transaction>> {
15
+ return this.client.get<ListResponse<Transaction>>("/transactions", params);
16
+ }
17
+
18
+ async *listAutoPaginate(params?: Omit<ListTransactionsParams, "page">): AsyncGenerator<Transaction> {
19
+ yield* autoPaginate<Transaction>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
20
+ }
21
+
22
+ async get(id: string): Promise<Transaction> {
23
+ return this.client.get<Transaction>(`/transactions/${id}`);
24
+ }
25
+
26
+ async stats(): Promise<TransactionStats> {
27
+ return this.client.get<TransactionStats>("/transactions/stats");
28
+ }
29
+
30
+ async export(params?: ExportTransactionsParams): Promise<string> {
31
+ return this.client.get<string>("/transactions/export", params);
32
+ }
33
+ }
@@ -0,0 +1,47 @@
1
+ import type { HttpClient } from "../client";
2
+ import type {
3
+ Webhook,
4
+ WebhookDelivery,
5
+ ListResponse,
6
+ DeletedResponse,
7
+ ActionResponse,
8
+ CreateWebhookParams,
9
+ UpdateWebhookParams,
10
+ PaginationParams,
11
+ } from "../types";
12
+
13
+ export class WebhooksResource {
14
+ constructor(private client: HttpClient) {}
15
+
16
+ async list(): Promise<ListResponse<Webhook>> {
17
+ return this.client.get<ListResponse<Webhook>>("/webhooks");
18
+ }
19
+
20
+ async create(params: CreateWebhookParams): Promise<Webhook> {
21
+ return this.client.post<Webhook>("/webhooks", params);
22
+ }
23
+
24
+ async get(id: string): Promise<Webhook> {
25
+ return this.client.get<Webhook>(`/webhooks/${id}`);
26
+ }
27
+
28
+ async update(id: string, params: UpdateWebhookParams): Promise<Webhook> {
29
+ return this.client.patch<Webhook>(`/webhooks/${id}`, params);
30
+ }
31
+
32
+ async delete(id: string): Promise<DeletedResponse> {
33
+ return this.client.delete<DeletedResponse>(`/webhooks/${id}`);
34
+ }
35
+
36
+ async test(id: string): Promise<ActionResponse> {
37
+ return this.client.post<ActionResponse>(`/webhooks/${id}/test`);
38
+ }
39
+
40
+ async deliveries(id: string, params?: PaginationParams): Promise<ListResponse<WebhookDelivery>> {
41
+ return this.client.get<ListResponse<WebhookDelivery>>(`/webhooks/${id}/deliveries`, params);
42
+ }
43
+
44
+ async retry(id: string, deliveryId: string): Promise<ActionResponse> {
45
+ return this.client.post<ActionResponse>(`/webhooks/${id}/deliveries/${deliveryId}/retry`);
46
+ }
47
+ }
@@ -0,0 +1,63 @@
1
+ import type { HttpClient } from "../client";
2
+ import { autoPaginate } from "../utils/pagination";
3
+ import type { WidgetConfig, ListResponse, DeletedResponse, CreateWidgetParams, PaginationParams } from "../types";
4
+
5
+ export interface ListWidgetsParams extends PaginationParams {
6
+ search?: string;
7
+ widget_type?: "swap" | "checkout" | "nft" | "deposit";
8
+ active?: "true" | "false";
9
+ sort?: "created_at" | "updated_at" | "name" | "current_views";
10
+ order?: "asc" | "desc";
11
+ }
12
+
13
+ export interface UpdateWidgetParams extends Partial<CreateWidgetParams> {
14
+ is_active?: boolean;
15
+ }
16
+
17
+ export interface WidgetStats {
18
+ object: "widget_stats";
19
+ widget_id: string;
20
+ summary: {
21
+ total_views: number;
22
+ total_interactions: number;
23
+ total_completions: number;
24
+ };
25
+ daily: {
26
+ date: string;
27
+ views: number;
28
+ interactions: number;
29
+ completions: number;
30
+ }[];
31
+ }
32
+
33
+ export class WidgetsResource {
34
+ constructor(private client: HttpClient) {}
35
+
36
+ async list(params?: ListWidgetsParams): Promise<ListResponse<WidgetConfig>> {
37
+ return this.client.get<ListResponse<WidgetConfig>>("/widgets", params);
38
+ }
39
+
40
+ async *listAutoPaginate(params?: Omit<ListWidgetsParams, "page">): AsyncGenerator<WidgetConfig> {
41
+ yield* autoPaginate<WidgetConfig>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
42
+ }
43
+
44
+ async create(params: CreateWidgetParams): Promise<WidgetConfig> {
45
+ return this.client.post<WidgetConfig>("/widgets", params);
46
+ }
47
+
48
+ async get(id: string): Promise<WidgetConfig> {
49
+ return this.client.get<WidgetConfig>(`/widgets/${id}`);
50
+ }
51
+
52
+ async update(id: string, params: UpdateWidgetParams): Promise<WidgetConfig> {
53
+ return this.client.patch<WidgetConfig>(`/widgets/${id}`, params);
54
+ }
55
+
56
+ async delete(id: string): Promise<DeletedResponse> {
57
+ return this.client.delete<DeletedResponse>(`/widgets/${id}`);
58
+ }
59
+
60
+ async stats(id: string, days?: number): Promise<WidgetStats> {
61
+ return this.client.get<WidgetStats>(`/widgets/${id}/stats`, days !== undefined ? { days } : undefined);
62
+ }
63
+ }