@b3dotfun/sdk 0.1.68-alpha.3 → 0.1.68-alpha.5

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 (167) 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 +3 -1
  38. package/dist/cjs/anyspend/react/components/AnySpend.js +128 -11
  39. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +13 -12
  40. package/dist/cjs/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  41. package/dist/cjs/anyspend/react/components/checkout/KycGate.js +181 -0
  42. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  43. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  44. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +9 -0
  45. package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +42 -0
  46. package/dist/cjs/anyspend/react/hooks/useKycStatus.js +113 -0
  47. package/dist/cjs/anyspend/services/anyspend.d.ts +3 -1
  48. package/dist/cjs/anyspend/services/anyspend.js +2 -1
  49. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
  50. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  51. package/dist/cjs/global-account/react/hooks/useAuth.js +1 -1
  52. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  53. package/dist/cjs/global-account/react/stores/useModalStore.js +2 -0
  54. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  55. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +17 -0
  56. package/dist/esm/anyspend/platform/client.d.ts +35 -0
  57. package/dist/esm/anyspend/platform/client.js +153 -0
  58. package/dist/esm/anyspend/platform/errors.d.ts +38 -0
  59. package/dist/esm/anyspend/platform/errors.js +67 -0
  60. package/dist/esm/anyspend/platform/index.d.ts +87 -0
  61. package/dist/esm/anyspend/platform/index.js +75 -0
  62. package/dist/esm/anyspend/platform/resources/analytics.d.ts +7 -0
  63. package/dist/esm/anyspend/platform/resources/analytics.js +8 -0
  64. package/dist/esm/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  65. package/dist/esm/anyspend/platform/resources/checkout-sessions.js +23 -0
  66. package/dist/esm/anyspend/platform/resources/customers.d.ts +19 -0
  67. package/dist/esm/anyspend/platform/resources/customers.js +30 -0
  68. package/dist/esm/anyspend/platform/resources/discount-codes.d.ts +29 -0
  69. package/dist/esm/anyspend/platform/resources/discount-codes.js +27 -0
  70. package/dist/esm/anyspend/platform/resources/events.d.ts +14 -0
  71. package/dist/esm/anyspend/platform/resources/events.js +12 -0
  72. package/dist/esm/anyspend/platform/resources/notifications.d.ts +18 -0
  73. package/dist/esm/anyspend/platform/resources/notifications.js +23 -0
  74. package/dist/esm/anyspend/platform/resources/organization.d.ts +17 -0
  75. package/dist/esm/anyspend/platform/resources/organization.js +11 -0
  76. package/dist/esm/anyspend/platform/resources/payment-links.d.ts +21 -0
  77. package/dist/esm/anyspend/platform/resources/payment-links.js +45 -0
  78. package/dist/esm/anyspend/platform/resources/products.d.ts +27 -0
  79. package/dist/esm/anyspend/platform/resources/products.js +27 -0
  80. package/dist/esm/anyspend/platform/resources/transactions.d.ts +11 -0
  81. package/dist/esm/anyspend/platform/resources/transactions.js +21 -0
  82. package/dist/esm/anyspend/platform/resources/webhooks.d.ts +14 -0
  83. package/dist/esm/anyspend/platform/resources/webhooks.js +29 -0
  84. package/dist/esm/anyspend/platform/resources/widgets.d.ts +38 -0
  85. package/dist/esm/anyspend/platform/resources/widgets.js +27 -0
  86. package/dist/esm/anyspend/platform/types.d.ts +478 -0
  87. package/dist/esm/anyspend/platform/types.js +4 -0
  88. package/dist/esm/anyspend/platform/utils/idempotency.d.ts +4 -0
  89. package/dist/esm/anyspend/platform/utils/idempotency.js +14 -0
  90. package/dist/esm/anyspend/platform/utils/pagination.d.ts +12 -0
  91. package/dist/esm/anyspend/platform/utils/pagination.js +19 -0
  92. package/dist/esm/anyspend/react/components/AnySpend.d.ts +3 -1
  93. package/dist/esm/anyspend/react/components/AnySpend.js +129 -12
  94. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +13 -12
  95. package/dist/esm/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  96. package/dist/esm/anyspend/react/components/checkout/KycGate.js +145 -0
  97. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  98. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  99. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +9 -0
  100. package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +42 -0
  101. package/dist/esm/anyspend/react/hooks/useKycStatus.js +107 -0
  102. package/dist/esm/anyspend/services/anyspend.d.ts +3 -1
  103. package/dist/esm/anyspend/services/anyspend.js +2 -1
  104. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  105. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  106. package/dist/esm/global-account/react/hooks/useAuth.js +2 -2
  107. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  108. package/dist/esm/global-account/react/stores/useModalStore.js +2 -0
  109. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  110. package/dist/esm/global-account/react/utils/createWagmiConfig.js +16 -0
  111. package/dist/styles/index.css +1 -1
  112. package/dist/types/anyspend/platform/client.d.ts +35 -0
  113. package/dist/types/anyspend/platform/errors.d.ts +38 -0
  114. package/dist/types/anyspend/platform/index.d.ts +87 -0
  115. package/dist/types/anyspend/platform/resources/analytics.d.ts +7 -0
  116. package/dist/types/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  117. package/dist/types/anyspend/platform/resources/customers.d.ts +19 -0
  118. package/dist/types/anyspend/platform/resources/discount-codes.d.ts +29 -0
  119. package/dist/types/anyspend/platform/resources/events.d.ts +14 -0
  120. package/dist/types/anyspend/platform/resources/notifications.d.ts +18 -0
  121. package/dist/types/anyspend/platform/resources/organization.d.ts +17 -0
  122. package/dist/types/anyspend/platform/resources/payment-links.d.ts +21 -0
  123. package/dist/types/anyspend/platform/resources/products.d.ts +27 -0
  124. package/dist/types/anyspend/platform/resources/transactions.d.ts +11 -0
  125. package/dist/types/anyspend/platform/resources/webhooks.d.ts +14 -0
  126. package/dist/types/anyspend/platform/resources/widgets.d.ts +38 -0
  127. package/dist/types/anyspend/platform/types.d.ts +478 -0
  128. package/dist/types/anyspend/platform/utils/idempotency.d.ts +4 -0
  129. package/dist/types/anyspend/platform/utils/pagination.d.ts +12 -0
  130. package/dist/types/anyspend/react/components/AnySpend.d.ts +3 -1
  131. package/dist/types/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  132. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  133. package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +42 -0
  134. package/dist/types/anyspend/services/anyspend.d.ts +3 -1
  135. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  136. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  137. package/package.json +7 -1
  138. package/src/anyspend/platform/client.ts +198 -0
  139. package/src/anyspend/platform/errors.ts +92 -0
  140. package/src/anyspend/platform/index.ts +129 -0
  141. package/src/anyspend/platform/resources/analytics.ts +10 -0
  142. package/src/anyspend/platform/resources/checkout-sessions.ts +36 -0
  143. package/src/anyspend/platform/resources/customers.ts +54 -0
  144. package/src/anyspend/platform/resources/discount-codes.ts +63 -0
  145. package/src/anyspend/platform/resources/events.ts +22 -0
  146. package/src/anyspend/platform/resources/notifications.ts +37 -0
  147. package/src/anyspend/platform/resources/organization.ts +24 -0
  148. package/src/anyspend/platform/resources/payment-links.ts +74 -0
  149. package/src/anyspend/platform/resources/products.ts +59 -0
  150. package/src/anyspend/platform/resources/transactions.ts +33 -0
  151. package/src/anyspend/platform/resources/webhooks.ts +47 -0
  152. package/src/anyspend/platform/resources/widgets.ts +63 -0
  153. package/src/anyspend/platform/types.ts +532 -0
  154. package/src/anyspend/platform/utils/idempotency.ts +15 -0
  155. package/src/anyspend/platform/utils/pagination.ts +32 -0
  156. package/src/anyspend/react/components/AnySpend.tsx +150 -13
  157. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +16 -13
  158. package/src/anyspend/react/components/checkout/KycGate.tsx +351 -0
  159. package/src/anyspend/react/hooks/index.ts +1 -0
  160. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +10 -0
  161. package/src/anyspend/react/hooks/useKycStatus.ts +140 -0
  162. package/src/anyspend/services/anyspend.ts +4 -0
  163. package/src/global-account/react/components/B3DynamicModal.tsx +0 -2
  164. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +7 -7
  165. package/src/global-account/react/hooks/useAuth.ts +2 -2
  166. package/src/global-account/react/stores/useModalStore.ts +6 -0
  167. package/src/global-account/react/utils/createWagmiConfig.tsx +18 -0
@@ -0,0 +1,38 @@
1
+ import type { HttpClient } from "../client";
2
+ import type { WidgetConfig, ListResponse, DeletedResponse, CreateWidgetParams, PaginationParams } from "../types";
3
+ export interface ListWidgetsParams extends PaginationParams {
4
+ search?: string;
5
+ widget_type?: "swap" | "checkout" | "nft" | "deposit";
6
+ active?: "true" | "false";
7
+ sort?: "created_at" | "updated_at" | "name" | "current_views";
8
+ order?: "asc" | "desc";
9
+ }
10
+ export interface UpdateWidgetParams extends Partial<CreateWidgetParams> {
11
+ is_active?: boolean;
12
+ }
13
+ export interface WidgetStats {
14
+ object: "widget_stats";
15
+ widget_id: string;
16
+ summary: {
17
+ total_views: number;
18
+ total_interactions: number;
19
+ total_completions: number;
20
+ };
21
+ daily: {
22
+ date: string;
23
+ views: number;
24
+ interactions: number;
25
+ completions: number;
26
+ }[];
27
+ }
28
+ export declare class WidgetsResource {
29
+ private client;
30
+ constructor(client: HttpClient);
31
+ list(params?: ListWidgetsParams): Promise<ListResponse<WidgetConfig>>;
32
+ listAutoPaginate(params?: Omit<ListWidgetsParams, "page">): AsyncGenerator<WidgetConfig>;
33
+ create(params: CreateWidgetParams): Promise<WidgetConfig>;
34
+ get(id: string): Promise<WidgetConfig>;
35
+ update(id: string, params: UpdateWidgetParams): Promise<WidgetConfig>;
36
+ delete(id: string): Promise<DeletedResponse>;
37
+ stats(id: string, days?: number): Promise<WidgetStats>;
38
+ }
@@ -0,0 +1,27 @@
1
+ import { autoPaginate } from "../utils/pagination.js";
2
+ export class WidgetsResource {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ async list(params) {
7
+ return this.client.get("/widgets", params);
8
+ }
9
+ async *listAutoPaginate(params) {
10
+ yield* autoPaginate((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
11
+ }
12
+ async create(params) {
13
+ return this.client.post("/widgets", params);
14
+ }
15
+ async get(id) {
16
+ return this.client.get(`/widgets/${id}`);
17
+ }
18
+ async update(id, params) {
19
+ return this.client.patch(`/widgets/${id}`, params);
20
+ }
21
+ async delete(id) {
22
+ return this.client.delete(`/widgets/${id}`);
23
+ }
24
+ async stats(id, days) {
25
+ return this.client.get(`/widgets/${id}/stats`, days !== undefined ? { days } : undefined);
26
+ }
27
+ }
@@ -0,0 +1,478 @@
1
+ /**
2
+ * TypeScript types for the AnySpend Platform API.
3
+ */
4
+ export interface ListResponse<T> {
5
+ object: "list";
6
+ data: T[];
7
+ has_more: boolean;
8
+ total_count: number;
9
+ url: string;
10
+ }
11
+ export interface DeletedResponse {
12
+ object: string;
13
+ id: string;
14
+ deleted: true;
15
+ }
16
+ export interface ActionResponse {
17
+ object: "action";
18
+ action: string;
19
+ [key: string]: unknown;
20
+ }
21
+ export interface PaginationParams {
22
+ page?: number;
23
+ limit?: number;
24
+ }
25
+ export interface PaymentLink {
26
+ object: "payment_link";
27
+ id: string;
28
+ short_code: string;
29
+ url?: string;
30
+ name: string;
31
+ description: string | null;
32
+ amount: string | null;
33
+ min_amount: string | null;
34
+ max_amount: string | null;
35
+ suggested_amount: string | null;
36
+ token_address: string;
37
+ chain_id: number;
38
+ recipient_address: string;
39
+ product_id: string | null;
40
+ image_url: string | null;
41
+ theme_color: string | null;
42
+ button_text: string;
43
+ max_uses: number | null;
44
+ current_uses: number;
45
+ expires_at: number | null;
46
+ is_active: boolean;
47
+ form_schema: string | null;
48
+ shipping_options: string | null;
49
+ collect_shipping_address: boolean;
50
+ return_url: string | null;
51
+ return_label: string | null;
52
+ branding: string | null;
53
+ fee_on_top: boolean;
54
+ items?: PaymentLinkItem[];
55
+ created_at: number;
56
+ updated_at: number;
57
+ }
58
+ export interface PaymentLinkItem {
59
+ object: "payment_link_item";
60
+ id: string;
61
+ payment_link_id: string;
62
+ product_id: string | null;
63
+ name: string;
64
+ description: string | null;
65
+ image_url: string | null;
66
+ amount: string;
67
+ quantity: number;
68
+ sort_order: number;
69
+ created_at: number;
70
+ updated_at: number;
71
+ }
72
+ export interface CreatePaymentLinkParams {
73
+ name: string;
74
+ token_address: string;
75
+ chain_id: number;
76
+ recipient_address: string;
77
+ description?: string;
78
+ amount?: string;
79
+ min_amount?: string;
80
+ max_amount?: string;
81
+ suggested_amount?: string;
82
+ product_id?: string;
83
+ image_url?: string;
84
+ theme_color?: string;
85
+ button_text?: string;
86
+ max_uses?: number;
87
+ expires_at?: number;
88
+ form_schema?: Record<string, unknown>;
89
+ shipping_options?: Record<string, unknown>[];
90
+ collect_shipping_address?: boolean;
91
+ return_url?: string;
92
+ return_label?: string;
93
+ branding?: Record<string, unknown>;
94
+ fee_on_top?: boolean;
95
+ items?: CreatePaymentLinkItemParams[];
96
+ }
97
+ export interface CreatePaymentLinkItemParams {
98
+ name: string;
99
+ amount: string;
100
+ description?: string;
101
+ image_url?: string;
102
+ quantity?: number;
103
+ sort_order?: number;
104
+ product_id?: string;
105
+ }
106
+ export interface UpdatePaymentLinkParams extends Partial<Omit<CreatePaymentLinkParams, "items">> {
107
+ is_active?: boolean;
108
+ items?: CreatePaymentLinkItemParams[];
109
+ }
110
+ export interface ListPaymentLinksParams extends PaginationParams {
111
+ search?: string;
112
+ active?: "true" | "false";
113
+ sort?: "created_at" | "updated_at" | "name" | "current_uses";
114
+ order?: "asc" | "desc";
115
+ }
116
+ export interface PaymentLinkStats {
117
+ object: "payment_link_stats";
118
+ payment_link_id: string;
119
+ summary: {
120
+ total_views: number;
121
+ total_sessions: number;
122
+ total_completions: number;
123
+ lifetime_completions: number;
124
+ view_to_session_rate: string;
125
+ session_to_completion_rate: string;
126
+ overall_conversion_rate: string;
127
+ };
128
+ daily: {
129
+ views: {
130
+ date: string;
131
+ view_count: number;
132
+ unique_visitors: number;
133
+ }[];
134
+ sessions: {
135
+ date: string;
136
+ sessions: number;
137
+ completions: number;
138
+ }[];
139
+ };
140
+ utm_breakdown: Record<string, unknown>[];
141
+ }
142
+ export interface Product {
143
+ object: "product";
144
+ id: string;
145
+ name: string;
146
+ description: string | null;
147
+ image_url: string | null;
148
+ amount: string;
149
+ token_address: string;
150
+ chain_id: number;
151
+ recipient_address: string | null;
152
+ product_type: "one_time" | "subscription" | "variable";
153
+ is_active: boolean;
154
+ metadata: Record<string, unknown> | null;
155
+ form_schema: string | null;
156
+ shipping_options: string | null;
157
+ created_at: number;
158
+ updated_at: number;
159
+ }
160
+ export interface CreateProductParams {
161
+ name: string;
162
+ amount: string;
163
+ token_address: string;
164
+ chain_id: number;
165
+ description?: string;
166
+ image_url?: string;
167
+ recipient_address?: string;
168
+ product_type?: "one_time" | "subscription" | "variable";
169
+ metadata?: Record<string, unknown>;
170
+ form_schema?: Record<string, unknown>;
171
+ shipping_options?: Record<string, unknown>[];
172
+ }
173
+ export interface UpdateProductParams extends Partial<CreateProductParams> {
174
+ is_active?: boolean;
175
+ }
176
+ export interface Customer {
177
+ object: "customer";
178
+ id: string;
179
+ wallet_address: string;
180
+ name: string | null;
181
+ email: string | null;
182
+ metadata: Record<string, unknown> | null;
183
+ total_paid: string | null;
184
+ transaction_count: number;
185
+ first_payment_at: number | null;
186
+ last_payment_at: number | null;
187
+ created_at: number;
188
+ updated_at: number;
189
+ }
190
+ export interface CreateCustomerParams {
191
+ wallet_address: string;
192
+ name?: string;
193
+ email?: string;
194
+ metadata?: Record<string, unknown>;
195
+ }
196
+ export interface UpdateCustomerParams {
197
+ name?: string;
198
+ email?: string;
199
+ metadata?: Record<string, unknown>;
200
+ }
201
+ export interface Transaction {
202
+ object: "transaction";
203
+ id: string;
204
+ tx_hash: string;
205
+ chain_id: number;
206
+ from_address: string;
207
+ to_address: string;
208
+ token_address: string;
209
+ amount: string;
210
+ amount_usd: string | null;
211
+ status: "pending" | "confirming" | "completed" | "failed";
212
+ payment_link_id: string | null;
213
+ customer_id: string | null;
214
+ created_at: number;
215
+ updated_at: number;
216
+ }
217
+ export interface TransactionStats {
218
+ object: "transaction_stats";
219
+ totalTransactions: number;
220
+ completedTransactions: number;
221
+ totalVolumeUsd: string;
222
+ last24h: {
223
+ transactions: number;
224
+ volumeUsd: string;
225
+ };
226
+ statusBreakdown: Record<string, number>;
227
+ }
228
+ export interface ListTransactionsParams extends PaginationParams {
229
+ status?: string;
230
+ customer_id?: string;
231
+ payment_link_id?: string;
232
+ from?: number;
233
+ to?: number;
234
+ }
235
+ export interface CheckoutSession {
236
+ object: "checkout_session";
237
+ id: string;
238
+ url: string | null;
239
+ status: "open" | "processing" | "completed" | "expired" | "failed";
240
+ payment_link_id: string | null;
241
+ product_id: string | null;
242
+ amount: string | null;
243
+ token_address: string;
244
+ chain_id: number;
245
+ recipient_address: string;
246
+ success_url: string | null;
247
+ cancel_url: string | null;
248
+ client_reference_id: string | null;
249
+ /** The API returns metadata as a serialized JSON string. Use JSON.parse() to recover the original object. */
250
+ metadata: string | null;
251
+ customer_email: string | null;
252
+ customer_name: string | null;
253
+ tx_hash: string | null;
254
+ completed_at: number | null;
255
+ expires_at: number;
256
+ created_at: number;
257
+ updated_at: number;
258
+ }
259
+ export interface CreateCheckoutSessionParams {
260
+ payment_link_id?: string;
261
+ token_address?: string;
262
+ chain_id?: number;
263
+ recipient_address?: string;
264
+ amount?: string;
265
+ product_id?: string;
266
+ success_url?: string;
267
+ cancel_url?: string;
268
+ client_reference_id?: string;
269
+ metadata?: Record<string, unknown>;
270
+ customer_email?: string;
271
+ customer_name?: string;
272
+ expires_in?: number;
273
+ utm_source?: string;
274
+ utm_medium?: string;
275
+ utm_campaign?: string;
276
+ }
277
+ export interface Webhook {
278
+ object: "webhook";
279
+ id: string;
280
+ url: string;
281
+ events: string[];
282
+ secret?: string;
283
+ is_active: boolean;
284
+ success_count: number;
285
+ failure_count: number;
286
+ last_triggered_at: number | null;
287
+ created_at: number;
288
+ updated_at: number;
289
+ }
290
+ export interface CreateWebhookParams {
291
+ url: string;
292
+ events: string[];
293
+ description?: string;
294
+ }
295
+ export interface UpdateWebhookParams {
296
+ url?: string;
297
+ events?: string[];
298
+ is_active?: boolean;
299
+ }
300
+ export interface DiscountCode {
301
+ object: "discount_code";
302
+ id: string;
303
+ code: string;
304
+ type: "percentage" | "fixed";
305
+ value: string;
306
+ payment_link_id: string | null;
307
+ max_uses: number | null;
308
+ current_uses: number;
309
+ min_order_amount: string | null;
310
+ expires_at: number | null;
311
+ is_active: boolean;
312
+ created_at: number;
313
+ updated_at: number;
314
+ }
315
+ export interface CreateDiscountCodeParams {
316
+ code: string;
317
+ type: "percentage" | "fixed";
318
+ value: string;
319
+ payment_link_id?: string;
320
+ max_uses?: number;
321
+ min_order_amount?: string;
322
+ expires_at?: number;
323
+ }
324
+ export interface BatchCreateDiscountCodesParams {
325
+ codes: string[];
326
+ type: "percentage" | "fixed";
327
+ value: string;
328
+ payment_link_id?: string;
329
+ max_uses?: number;
330
+ min_order_amount?: string;
331
+ expires_at?: number;
332
+ }
333
+ export interface NotificationSettings {
334
+ object: "notification_settings";
335
+ id: string;
336
+ email_enabled: boolean;
337
+ email_address: string | null;
338
+ telegram_enabled: boolean;
339
+ telegram_chat_id: string | null;
340
+ enabled_events: string[];
341
+ }
342
+ export interface UpdateNotificationSettingsParams {
343
+ email_enabled?: boolean;
344
+ email_address?: string;
345
+ telegram_enabled?: boolean;
346
+ enabled_events?: string[];
347
+ }
348
+ export interface WidgetConfig {
349
+ object: "widget_config";
350
+ id: string;
351
+ short_code: string;
352
+ name: string;
353
+ description: string | null;
354
+ widget_type: string;
355
+ config: string;
356
+ theme: string;
357
+ is_active: boolean;
358
+ current_views: number;
359
+ created_at: number;
360
+ updated_at: number;
361
+ }
362
+ export interface CreateWidgetParams {
363
+ name: string;
364
+ widget_type: "swap" | "checkout" | "nft" | "deposit";
365
+ config: Record<string, unknown>;
366
+ description?: string;
367
+ theme?: Record<string, unknown>;
368
+ }
369
+ export interface Organization {
370
+ object: "organization";
371
+ id: string;
372
+ name: string;
373
+ slug: string;
374
+ description: string | null;
375
+ logo_url: string | null;
376
+ website_url: string | null;
377
+ default_recipient_address: string | null;
378
+ default_chain_id: number | null;
379
+ default_token_address: string | null;
380
+ }
381
+ export interface AnalyticsOverview {
382
+ object: "analytics_overview";
383
+ period: string;
384
+ revenue: {
385
+ period_usd: string;
386
+ period_transactions: number;
387
+ all_time_usd: string;
388
+ all_time_transactions: number;
389
+ };
390
+ customers: {
391
+ total: number;
392
+ new_in_period: number;
393
+ };
394
+ payment_links: {
395
+ total: number;
396
+ active: number;
397
+ };
398
+ conversion_rate: string;
399
+ daily: {
400
+ date: string;
401
+ transactions: number;
402
+ revenue_usd: number;
403
+ }[];
404
+ top_payment_links: Record<string, unknown>[];
405
+ top_tokens: Record<string, unknown>[];
406
+ top_chains: Record<string, unknown>[];
407
+ }
408
+ export interface ApiEvent {
409
+ object: "event";
410
+ id: string;
411
+ event_type: string;
412
+ resource_type: string;
413
+ resource_id: string | null;
414
+ ip_address: string | null;
415
+ request_method: string;
416
+ request_path: string;
417
+ status_code: number;
418
+ created_at: number;
419
+ }
420
+ export interface QuickPayParams {
421
+ recipient_address: string;
422
+ amount?: string;
423
+ token_address?: string;
424
+ chain_id?: number;
425
+ name?: string;
426
+ description?: string;
427
+ expires_in?: number;
428
+ }
429
+ export interface ApiKey {
430
+ object: "api_key";
431
+ id: string;
432
+ name: string;
433
+ prefix: string;
434
+ permissions: string[];
435
+ last_used_at: number | null;
436
+ created_at: number;
437
+ updated_at: number;
438
+ }
439
+ export interface WebhookDelivery {
440
+ object: "webhook_delivery";
441
+ id: string;
442
+ webhook_id: string;
443
+ event_type: string;
444
+ url: string;
445
+ status: "pending" | "success" | "failed";
446
+ status_code: number | null;
447
+ response_body: string | null;
448
+ error_message: string | null;
449
+ attempted_at: number;
450
+ created_at: number;
451
+ }
452
+ export interface ValidateDiscountResult {
453
+ object: "discount_validation";
454
+ valid: boolean;
455
+ discount_code?: DiscountCode;
456
+ discount_amount?: string;
457
+ final_amount?: string;
458
+ reason?: string;
459
+ }
460
+ export interface BatchCreateResult {
461
+ object: "batch_result";
462
+ created: DiscountCode[];
463
+ errors: {
464
+ code: string;
465
+ error: string;
466
+ }[];
467
+ }
468
+ export interface ExportTransactionsParams {
469
+ format?: "csv" | "json";
470
+ status?: string;
471
+ from?: number;
472
+ to?: number;
473
+ }
474
+ export interface ExportCustomersParams {
475
+ format?: "csv" | "json";
476
+ from?: number;
477
+ to?: number;
478
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * TypeScript types for the AnySpend Platform API.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Idempotency key generation utility.
3
+ */
4
+ export declare function generateIdempotencyKey(): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Idempotency key generation utility.
3
+ */
4
+ export function generateIdempotencyKey() {
5
+ if (typeof crypto !== "undefined" && crypto.randomUUID) {
6
+ return crypto.randomUUID();
7
+ }
8
+ // Fallback for environments without crypto.randomUUID
9
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
10
+ const r = (Math.random() * 16) | 0;
11
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
12
+ return v.toString(16);
13
+ });
14
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Auto-pagination async iterator for list endpoints.
3
+ */
4
+ import type { ListResponse } from "../types";
5
+ export interface AutoPaginateOptions {
6
+ startPage?: number;
7
+ limit?: number;
8
+ }
9
+ /**
10
+ * Creates an async iterator that automatically paginates through all results.
11
+ */
12
+ export declare function autoPaginate<T>(fetchPage: (page: number, limit: number) => Promise<ListResponse<T>>, options?: AutoPaginateOptions): AsyncGenerator<T, void, undefined>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Auto-pagination async iterator for list endpoints.
3
+ */
4
+ /**
5
+ * Creates an async iterator that automatically paginates through all results.
6
+ */
7
+ export async function* autoPaginate(fetchPage, options = {}) {
8
+ let page = options.startPage || 1;
9
+ const limit = options.limit || 100;
10
+ while (true) {
11
+ const result = await fetchPage(page, limit);
12
+ for (const item of result.data) {
13
+ yield item;
14
+ }
15
+ if (!result.has_more)
16
+ break;
17
+ page++;
18
+ }
19
+ }
@@ -18,7 +18,9 @@ export declare enum PanelView {
18
18
  FIAT_PAYMENT_METHOD = 7,
19
19
  POINTS_DETAIL = 8,
20
20
  FEE_DETAIL = 9,
21
- DIRECT_TRANSFER_SUCCESS = 10
21
+ DIRECT_TRANSFER_SUCCESS = 10,
22
+ FIAT_KYC = 11,
23
+ FIAT_AUTH = 12
22
24
  }
23
25
  export declare function AnySpend(props: {
24
26
  mode?: "page" | "modal";