@djangocfg/ext-payments 1.0.17 → 1.0.20

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 (65) hide show
  1. package/README.md +117 -145
  2. package/dist/api/hooks.cjs +1701 -0
  3. package/dist/api/hooks.d.cts +4 -0
  4. package/dist/api/hooks.d.ts +4 -0
  5. package/dist/api/hooks.js +1681 -0
  6. package/dist/api/index.cjs +1738 -0
  7. package/dist/api/index.d.cts +372 -0
  8. package/dist/api/index.d.ts +372 -0
  9. package/dist/api/index.js +1688 -0
  10. package/dist/api-hooks-DG8taGyN.d.cts +1172 -0
  11. package/dist/api-hooks-DG8taGyN.d.ts +1172 -0
  12. package/dist/api-hooks.cjs +1701 -0
  13. package/dist/api-hooks.d.cts +4 -0
  14. package/dist/api-hooks.d.ts +4 -0
  15. package/dist/api-hooks.js +1681 -0
  16. package/dist/config.cjs +11 -1
  17. package/dist/config.js +11 -1
  18. package/dist/hooks-DG8taGyN.d.cts +1172 -0
  19. package/dist/hooks-DG8taGyN.d.ts +1172 -0
  20. package/dist/index.cjs +1185 -290
  21. package/dist/index.d.cts +45 -1283
  22. package/dist/index.d.ts +45 -1283
  23. package/dist/index.js +1167 -255
  24. package/package.json +19 -9
  25. package/src/WalletPage.tsx +100 -0
  26. package/src/api/generated/ext_payments/CLAUDE.md +6 -4
  27. package/src/api/generated/ext_payments/_utils/fetchers/ext_payments__payments.ts +37 -6
  28. package/src/api/generated/ext_payments/_utils/hooks/ext_payments__payments.ts +34 -3
  29. package/src/api/generated/ext_payments/_utils/schemas/Balance.schema.ts +1 -1
  30. package/src/api/generated/ext_payments/_utils/schemas/PaymentCreateResponse.schema.ts +22 -0
  31. package/src/api/generated/ext_payments/_utils/schemas/PaymentDetail.schema.ts +3 -3
  32. package/src/api/generated/ext_payments/_utils/schemas/PaymentList.schema.ts +2 -2
  33. package/src/api/generated/ext_payments/_utils/schemas/Transaction.schema.ts +1 -1
  34. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCancelResponse.schema.ts +22 -0
  35. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCreateResponse.schema.ts +22 -0
  36. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalDetail.schema.ts +5 -5
  37. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalList.schema.ts +2 -2
  38. package/src/api/generated/ext_payments/_utils/schemas/index.ts +3 -0
  39. package/src/api/generated/ext_payments/client.ts +1 -1
  40. package/src/api/generated/ext_payments/ext_payments__payments/client.ts +49 -4
  41. package/src/api/generated/ext_payments/ext_payments__payments/models.ts +33 -14
  42. package/src/api/generated/ext_payments/index.ts +1 -1
  43. package/src/api/generated/ext_payments/schema.json +167 -33
  44. package/src/api/hooks.ts +16 -0
  45. package/src/api/index.ts +20 -1
  46. package/src/components/AddFundsSheet.tsx +157 -73
  47. package/src/components/CurrencyCombobox.tsx +49 -0
  48. package/src/components/PaymentSheet.tsx +94 -32
  49. package/src/components/WithdrawSheet.tsx +121 -95
  50. package/src/components/WithdrawalSheet.tsx +332 -0
  51. package/src/components/index.ts +1 -8
  52. package/src/config.ts +1 -0
  53. package/src/contexts/WalletContext.tsx +10 -9
  54. package/src/contexts/index.ts +5 -1
  55. package/src/contexts/types.ts +46 -0
  56. package/src/hooks/index.ts +3 -0
  57. package/src/hooks/useCurrencyOptions.ts +79 -0
  58. package/src/hooks/useEstimate.ts +113 -0
  59. package/src/hooks/useWithdrawalEstimate.ts +117 -0
  60. package/src/index.ts +3 -0
  61. package/src/types/index.ts +78 -0
  62. package/src/utils/errors.ts +36 -0
  63. package/src/utils/format.ts +65 -0
  64. package/src/utils/index.ts +3 -0
  65. package/src/components/ResponsiveSheet.tsx +0 -151
package/dist/index.d.ts CHANGED
@@ -1,468 +1,14 @@
1
- import { ConsolaInstance } from 'consola';
2
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { z, ZodError } from 'zod';
4
- import * as React from 'react';
2
+ import { E as ExtPaymentsPayments, L as LoggerConfig, R as RetryConfig, d as PaymentCreateRequest, i as PaymentCreateRequestSchema, e as PaymentCreateResponse, j as PaymentCreateResponseSchema, c as PaymentList, k as PaymentListSchema, f as WithdrawalCancelResponse, l as WithdrawalCancelResponseSchema, g as WithdrawalCreateRequest, m as WithdrawalCreateRequestSchema, h as WithdrawalCreateResponse, n as WithdrawalCreateResponseSchema, D as APIOptions, A as API } from './hooks-DG8taGyN.js';
3
+ export { U as APILogger, G as CookieStorageAdapter, Z as DEFAULT_RETRY_CONFIG, K as Enums, Q as ErrorLog, J as ExtPaymentsPaymentsTypes, V as FailedAttemptInfo, F as LocalStorageAdapter, M as MemoryStorageAdapter, I as REFRESH_TOKEN_KEY, N as RequestLog, O as ResponseLog, S as StorageAdapter, H as TOKEN_KEY, Y as shouldRetry, X as withRetry } from './hooks-DG8taGyN.js';
4
+ import { Balance, BalanceSchema, Currency, CurrencySchema, PaginatedPaymentListList, PaginatedPaymentListListSchema, PaginatedWithdrawalListList, PaginatedWithdrawalListListSchema, PaymentDetail, PaymentDetailSchema, Transaction, TransactionSchema, WithdrawalDetail, WithdrawalDetailSchema, WithdrawalList, WithdrawalListSchema, createPaymentsPaymentsConfirmCreate, createPaymentsPaymentsCreateCreate, createPaymentsWithdrawalsCancelCreate, createPaymentsWithdrawalsCreateCreate, getPaymentsBalanceRetrieve, getPaymentsCurrenciesEstimateRetrieve, getPaymentsCurrenciesList, getPaymentsCurrenciesWithdrawalEstimateRetrieve, getPaymentsPaymentsList, getPaymentsPaymentsRetrieve, getPaymentsPaymentsStatusRetrieve, getPaymentsTransactionsList, getPaymentsWithdrawalsList, getPaymentsWithdrawalsRetrieve } from './api/index.js';
5
+ export { apiPayments } from './api/index.js';
5
6
  import * as _djangocfg_ext_base from '@djangocfg/ext-base';
7
+ import { ZodError } from 'zod';
8
+ import 'swr';
9
+ import 'consola';
6
10
 
7
- /**
8
- * Current payment status
9
- * * `pending` - Pending
10
- * * `confirming` - Confirming
11
- * * `confirmed` - Confirmed
12
- * * `completed` - Completed
13
- * * `partially_paid` - Partially Paid
14
- * * `failed` - Failed
15
- * * `expired` - Expired
16
- * * `cancelled` - Cancelled
17
- */
18
- declare enum PaymentDetailStatus {
19
- PENDING = "pending",
20
- CONFIRMING = "confirming",
21
- CONFIRMED = "confirmed",
22
- COMPLETED = "completed",
23
- PARTIALLY_PAID = "partially_paid",
24
- FAILED = "failed",
25
- EXPIRED = "expired",
26
- CANCELLED = "cancelled"
27
- }
28
- /**
29
- * Current payment status
30
- * * `pending` - Pending
31
- * * `confirming` - Confirming
32
- * * `confirmed` - Confirmed
33
- * * `completed` - Completed
34
- * * `partially_paid` - Partially Paid
35
- * * `failed` - Failed
36
- * * `expired` - Expired
37
- * * `cancelled` - Cancelled
38
- */
39
- declare enum PaymentListStatus {
40
- PENDING = "pending",
41
- CONFIRMING = "confirming",
42
- CONFIRMED = "confirmed",
43
- COMPLETED = "completed",
44
- PARTIALLY_PAID = "partially_paid",
45
- FAILED = "failed",
46
- EXPIRED = "expired",
47
- CANCELLED = "cancelled"
48
- }
49
- /**
50
- * Type of transaction
51
- * * `deposit` - Deposit
52
- * * `withdrawal` - Withdrawal
53
- * * `payment` - Payment
54
- * * `refund` - Refund
55
- * * `fee` - Fee
56
- * * `bonus` - Bonus
57
- * * `adjustment` - Adjustment
58
- */
59
- declare enum TransactionTransactionType {
60
- DEPOSIT = "deposit",
61
- WITHDRAWAL = "withdrawal",
62
- PAYMENT = "payment",
63
- REFUND = "refund",
64
- FEE = "fee",
65
- BONUS = "bonus",
66
- ADJUSTMENT = "adjustment"
67
- }
68
- /**
69
- * Withdrawal status
70
- * * `pending` - Pending
71
- * * `approved` - Approved
72
- * * `processing` - Processing
73
- * * `completed` - Completed
74
- * * `rejected` - Rejected
75
- * * `cancelled` - Cancelled
76
- */
77
- declare enum WithdrawalDetailStatus {
78
- PENDING = "pending",
79
- APPROVED = "approved",
80
- PROCESSING = "processing",
81
- COMPLETED = "completed",
82
- REJECTED = "rejected",
83
- CANCELLED = "cancelled"
84
- }
85
- /**
86
- * Withdrawal status
87
- * * `pending` - Pending
88
- * * `approved` - Approved
89
- * * `processing` - Processing
90
- * * `completed` - Completed
91
- * * `rejected` - Rejected
92
- * * `cancelled` - Cancelled
93
- */
94
- declare enum WithdrawalListStatus {
95
- PENDING = "pending",
96
- APPROVED = "approved",
97
- PROCESSING = "processing",
98
- COMPLETED = "completed",
99
- REJECTED = "rejected",
100
- CANCELLED = "cancelled"
101
- }
102
-
103
- type enums_PaymentDetailStatus = PaymentDetailStatus;
104
- declare const enums_PaymentDetailStatus: typeof PaymentDetailStatus;
105
- type enums_PaymentListStatus = PaymentListStatus;
106
- declare const enums_PaymentListStatus: typeof PaymentListStatus;
107
- type enums_TransactionTransactionType = TransactionTransactionType;
108
- declare const enums_TransactionTransactionType: typeof TransactionTransactionType;
109
- type enums_WithdrawalDetailStatus = WithdrawalDetailStatus;
110
- declare const enums_WithdrawalDetailStatus: typeof WithdrawalDetailStatus;
111
- type enums_WithdrawalListStatus = WithdrawalListStatus;
112
- declare const enums_WithdrawalListStatus: typeof WithdrawalListStatus;
113
- declare namespace enums {
114
- export { enums_PaymentDetailStatus as PaymentDetailStatus, enums_PaymentListStatus as PaymentListStatus, enums_TransactionTransactionType as TransactionTransactionType, enums_WithdrawalDetailStatus as WithdrawalDetailStatus, enums_WithdrawalListStatus as WithdrawalListStatus };
115
- }
116
-
117
- /**
118
- * User balance serializer.
119
- *
120
- * Response model (includes read-only fields).
121
- */
122
- interface Balance$1 {
123
- /** Current balance in USD */
124
- balance_usd: string;
125
- balance_display: string;
126
- /** Total amount deposited (lifetime) */
127
- total_deposited: string;
128
- /** Total amount withdrawn (lifetime) */
129
- total_withdrawn: string;
130
- /** When the last transaction occurred */
131
- last_transaction_at?: string | null;
132
- }
133
- /**
134
- *
135
- * Response model (includes read-only fields).
136
- */
137
- interface PaginatedPaymentListList$1 {
138
- /** Total number of items across all pages */
139
- count: number;
140
- /** Current page number (1-based) */
141
- page: number;
142
- /** Total number of pages */
143
- pages: number;
144
- /** Number of items per page */
145
- page_size: number;
146
- /** Whether there is a next page */
147
- has_next: boolean;
148
- /** Whether there is a previous page */
149
- has_previous: boolean;
150
- /** Next page number (null if no next page) */
151
- next_page?: number | null;
152
- /** Previous page number (null if no previous page) */
153
- previous_page?: number | null;
154
- /** Array of items for current page */
155
- results: Array<PaymentList$1>;
156
- }
157
- /**
158
- * Detailed payment information.
159
- *
160
- * Response model (includes read-only fields).
161
- */
162
- interface PaymentDetail$1 {
163
- /** Unique identifier for this record */
164
- id: string;
165
- /** Internal payment identifier (PAY_YYYYMMDDHHMMSS_UUID) */
166
- internal_payment_id: string;
167
- /** Payment amount in USD */
168
- amount_usd: string;
169
- currency_code: string;
170
- currency_name: string;
171
- currency_token: string;
172
- currency_network: string;
173
- /** Amount to pay in cryptocurrency */
174
- pay_amount?: string | null;
175
- /** Actual amount received in cryptocurrency */
176
- actual_amount?: string | null;
177
- /** Actual amount received in USD */
178
- actual_amount_usd?: string | null;
179
- /** Current payment status
180
-
181
- * `pending` - Pending
182
- * `confirming` - Confirming
183
- * `confirmed` - Confirmed
184
- * `completed` - Completed
185
- * `partially_paid` - Partially Paid
186
- * `failed` - Failed
187
- * `expired` - Expired
188
- * `cancelled` - Cancelled */
189
- status: PaymentDetailStatus;
190
- status_display: string;
191
- /** Cryptocurrency payment address */
192
- pay_address?: string | null;
193
- /** Get QR code URL. */
194
- qr_code_url?: string | null;
195
- /** Payment page URL (if provided by provider) */
196
- payment_url?: string | null;
197
- /** Blockchain transaction hash */
198
- transaction_hash?: string | null;
199
- /** Get blockchain explorer link. */
200
- explorer_link?: string | null;
201
- /** Number of blockchain confirmations */
202
- confirmations_count: number;
203
- /** When this payment expires (typically 30 minutes) */
204
- expires_at?: string | null;
205
- /** When this payment was completed */
206
- completed_at?: string | null;
207
- /** When this record was created */
208
- created_at: string;
209
- is_completed: boolean;
210
- is_failed: boolean;
211
- is_expired: boolean;
212
- /** Payment description */
213
- description: string;
214
- }
215
- /**
216
- * Payment list item (lighter than detail).
217
- *
218
- * Response model (includes read-only fields).
219
- */
220
- interface PaymentList$1 {
221
- /** Unique identifier for this record */
222
- id: string;
223
- /** Internal payment identifier (PAY_YYYYMMDDHHMMSS_UUID) */
224
- internal_payment_id: string;
225
- /** Payment amount in USD */
226
- amount_usd: string;
227
- currency_code: string;
228
- currency_token: string;
229
- /** Current payment status
230
-
231
- * `pending` - Pending
232
- * `confirming` - Confirming
233
- * `confirmed` - Confirmed
234
- * `completed` - Completed
235
- * `partially_paid` - Partially Paid
236
- * `failed` - Failed
237
- * `expired` - Expired
238
- * `cancelled` - Cancelled */
239
- status: PaymentListStatus;
240
- status_display: string;
241
- /** When this record was created */
242
- created_at: string;
243
- /** When this payment was completed */
244
- completed_at?: string | null;
245
- }
246
- /**
247
- * Serializer for creating payment.
248
- *
249
- * Request model (no read-only fields).
250
- */
251
- interface PaymentCreateRequest$1 {
252
- /** Payment amount in USD */
253
- amount_usd: string;
254
- /** Currency code (e.g., USDTTRC20) */
255
- currency_code: string;
256
- /** Optional payment description */
257
- description?: string;
258
- }
259
- /**
260
- *
261
- * Response model (includes read-only fields).
262
- */
263
- interface PaginatedWithdrawalListList$1 {
264
- /** Total number of items across all pages */
265
- count: number;
266
- /** Current page number (1-based) */
267
- page: number;
268
- /** Total number of pages */
269
- pages: number;
270
- /** Number of items per page */
271
- page_size: number;
272
- /** Whether there is a next page */
273
- has_next: boolean;
274
- /** Whether there is a previous page */
275
- has_previous: boolean;
276
- /** Next page number (null if no next page) */
277
- next_page?: number | null;
278
- /** Previous page number (null if no previous page) */
279
- previous_page?: number | null;
280
- /** Array of items for current page */
281
- results: Array<WithdrawalList$1>;
282
- }
283
- /**
284
- * Detailed withdrawal information.
285
- *
286
- * Response model (includes read-only fields).
287
- */
288
- interface WithdrawalDetail$1 {
289
- /** Unique identifier for this record */
290
- id: string;
291
- /** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
292
- internal_withdrawal_id: string;
293
- /** Withdrawal amount in USD (min $10) */
294
- amount_usd: string;
295
- currency_code: string;
296
- currency_name: string;
297
- currency_token: string;
298
- currency_network: string;
299
- /** Destination wallet address */
300
- wallet_address: string;
301
- /** Network transaction fee in USD */
302
- network_fee_usd: string;
303
- /** Service fee in USD */
304
- service_fee_usd: string;
305
- /** Total fee (network + service) in USD */
306
- total_fee_usd: string;
307
- /** Final amount to receive (amount - total_fee) */
308
- final_amount_usd: string;
309
- /** Amount in cryptocurrency (calculated at processing time) */
310
- crypto_amount?: string | null;
311
- /** Withdrawal status
312
-
313
- * `pending` - Pending
314
- * `approved` - Approved
315
- * `processing` - Processing
316
- * `completed` - Completed
317
- * `rejected` - Rejected
318
- * `cancelled` - Cancelled */
319
- status: WithdrawalDetailStatus;
320
- status_display: string;
321
- /** Blockchain transaction hash (after sending) */
322
- transaction_hash?: string | null;
323
- /** Get blockchain explorer link. */
324
- explorer_link?: string | null;
325
- /** Admin notes (reason for rejection, etc.) */
326
- admin_notes: string;
327
- /** When this record was created */
328
- created_at: string;
329
- /** When approved by admin */
330
- approved_at?: string | null;
331
- /** When withdrawal was completed */
332
- completed_at?: string | null;
333
- /** When rejected by admin */
334
- rejected_at?: string | null;
335
- /** When cancelled by user */
336
- cancelled_at?: string | null;
337
- }
338
- /**
339
- * Serializer for creating withdrawal request.
340
- *
341
- * Request model (no read-only fields).
342
- */
343
- interface WithdrawalCreateRequest$1 {
344
- /** Withdrawal amount in USD (min $10) */
345
- amount_usd: string;
346
- /** Currency code (e.g., USDTTRC20) */
347
- currency_code: string;
348
- /** Destination wallet address */
349
- wallet_address: string;
350
- }
351
- /**
352
- * Withdrawal list item (lighter than detail).
353
- *
354
- * Response model (includes read-only fields).
355
- */
356
- interface WithdrawalList$1 {
357
- /** Unique identifier for this record */
358
- id: string;
359
- /** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
360
- internal_withdrawal_id: string;
361
- /** Withdrawal amount in USD (min $10) */
362
- amount_usd: string;
363
- /** Final amount to receive (amount - total_fee) */
364
- final_amount_usd: string;
365
- currency_code: string;
366
- currency_token: string;
367
- /** Withdrawal status
368
-
369
- * `pending` - Pending
370
- * `approved` - Approved
371
- * `processing` - Processing
372
- * `completed` - Completed
373
- * `rejected` - Rejected
374
- * `cancelled` - Cancelled */
375
- status: WithdrawalListStatus;
376
- status_display: string;
377
- /** When this record was created */
378
- created_at: string;
379
- /** When withdrawal was completed */
380
- completed_at?: string | null;
381
- }
382
-
383
- declare namespace models {
384
- export type { Balance$1 as Balance, PaginatedPaymentListList$1 as PaginatedPaymentListList, PaginatedWithdrawalListList$1 as PaginatedWithdrawalListList, PaymentCreateRequest$1 as PaymentCreateRequest, PaymentDetail$1 as PaymentDetail, PaymentList$1 as PaymentList, WithdrawalCreateRequest$1 as WithdrawalCreateRequest, WithdrawalDetail$1 as WithdrawalDetail, WithdrawalList$1 as WithdrawalList };
385
- }
386
-
387
- /**
388
- * API endpoints for Payments.
389
- */
390
- declare class ExtPaymentsPayments {
391
- private client;
392
- constructor(client: any);
393
- /**
394
- * Get user balance
395
- *
396
- * Get current user balance and transaction statistics
397
- */
398
- balanceRetrieve(): Promise<Balance$1>;
399
- /**
400
- * Get available currencies
401
- *
402
- * Returns list of available currencies with token+network info
403
- */
404
- currenciesList(): Promise<any>;
405
- paymentsList(page?: number, page_size?: number): Promise<PaginatedPaymentListList$1>;
406
- paymentsList(params?: {
407
- page?: number;
408
- page_size?: number;
409
- }): Promise<PaginatedPaymentListList$1>;
410
- /**
411
- * ViewSet for payment operations. Endpoints: - GET /payments/ - List
412
- * user's payments - GET /payments/{id}/ - Get payment details - POST
413
- * /payments/create/ - Create new payment - GET /payments/{id}/status/ -
414
- * Check payment status - POST /payments/{id}/confirm/ - Confirm payment
415
- */
416
- paymentsRetrieve(id: string): Promise<PaymentDetail$1>;
417
- /**
418
- * POST /api/v1/payments/{id}/confirm/ Confirm payment (user clicked "I
419
- * have paid"). Checks status with provider and creates transaction if
420
- * completed.
421
- */
422
- paymentsConfirmCreate(id: string): Promise<PaymentList$1>;
423
- /**
424
- * GET /api/v1/payments/{id}/status/?refresh=true Check payment status
425
- * (with optional refresh from provider). Query params: - refresh: boolean
426
- * (default: false) - Force refresh from provider
427
- */
428
- paymentsStatusRetrieve(id: string): Promise<PaymentList$1[]>;
429
- /**
430
- * Create payment
431
- *
432
- * Create a new payment with specified amount and currency
433
- */
434
- paymentsCreateCreate(data: PaymentCreateRequest$1): Promise<PaymentDetail$1>;
435
- transactionsList(limit?: number, offset?: number, type?: string): Promise<any>;
436
- transactionsList(params?: {
437
- limit?: number;
438
- offset?: number;
439
- type?: string;
440
- }): Promise<any>;
441
- withdrawalsList(page?: number, page_size?: number): Promise<PaginatedWithdrawalListList$1>;
442
- withdrawalsList(params?: {
443
- page?: number;
444
- page_size?: number;
445
- }): Promise<PaginatedWithdrawalListList$1>;
446
- /**
447
- * ViewSet for withdrawal operations. Endpoints: - GET /withdrawals/ - List
448
- * user's withdrawal requests - GET /withdrawals/{id}/ - Get withdrawal
449
- * details - POST /withdrawals/create/ - Create withdrawal request - POST
450
- * /withdrawals/{id}/cancel/ - Cancel pending withdrawal
451
- */
452
- withdrawalsRetrieve(id: string): Promise<WithdrawalDetail$1>;
453
- /**
454
- * Cancel withdrawal request
455
- *
456
- * Cancel a pending withdrawal request
457
- */
458
- withdrawalsCancelCreate(id: string): Promise<WithdrawalDetail$1>;
459
- /**
460
- * Create withdrawal request
461
- *
462
- * Create a new withdrawal request (requires admin approval)
463
- */
464
- withdrawalsCreateCreate(data: WithdrawalCreateRequest$1): Promise<WithdrawalDetail$1>;
465
- }
11
+ declare function WalletPage(): react_jsx_runtime.JSX.Element;
466
12
 
467
13
  /**
468
14
  * HTTP Client Adapter Pattern
@@ -503,217 +49,7 @@ declare class FetchAdapter implements HttpClientAdapter {
503
49
  }
504
50
 
505
51
  /**
506
- * API Logger with Consola
507
- * Beautiful console logging for API requests and responses
508
- *
509
- * Installation:
510
- * npm install consola
511
- */
512
-
513
- /**
514
- * Request log data
515
- */
516
- interface RequestLog {
517
- method: string;
518
- url: string;
519
- headers?: Record<string, string>;
520
- body?: any;
521
- timestamp: number;
522
- }
523
- /**
524
- * Response log data
525
- */
526
- interface ResponseLog {
527
- status: number;
528
- statusText: string;
529
- data?: any;
530
- duration: number;
531
- timestamp: number;
532
- }
533
- /**
534
- * Error log data
535
- */
536
- interface ErrorLog {
537
- message: string;
538
- statusCode?: number;
539
- fieldErrors?: Record<string, string[]>;
540
- duration: number;
541
- timestamp: number;
542
- }
543
- /**
544
- * Logger configuration
545
- */
546
- interface LoggerConfig {
547
- /** Enable logging */
548
- enabled: boolean;
549
- /** Log requests */
550
- logRequests: boolean;
551
- /** Log responses */
552
- logResponses: boolean;
553
- /** Log errors */
554
- logErrors: boolean;
555
- /** Log request/response bodies */
556
- logBodies: boolean;
557
- /** Log headers (excluding sensitive ones) */
558
- logHeaders: boolean;
559
- /** Custom consola instance */
560
- consola?: ConsolaInstance;
561
- }
562
- /**
563
- * API Logger class
564
- */
565
- declare class APILogger {
566
- private config;
567
- private consola;
568
- constructor(config?: Partial<LoggerConfig>);
569
- /**
570
- * Enable logging
571
- */
572
- enable(): void;
573
- /**
574
- * Disable logging
575
- */
576
- disable(): void;
577
- /**
578
- * Update configuration
579
- */
580
- setConfig(config: Partial<LoggerConfig>): void;
581
- /**
582
- * Filter sensitive headers
583
- */
584
- private filterHeaders;
585
- /**
586
- * Log request
587
- */
588
- logRequest(request: RequestLog): void;
589
- /**
590
- * Log response
591
- */
592
- logResponse(request: RequestLog, response: ResponseLog): void;
593
- /**
594
- * Log error
595
- */
596
- logError(request: RequestLog, error: ErrorLog): void;
597
- /**
598
- * Log general info
599
- */
600
- info(message: string, ...args: any[]): void;
601
- /**
602
- * Log warning
603
- */
604
- warn(message: string, ...args: any[]): void;
605
- /**
606
- * Log error
607
- */
608
- error(message: string, ...args: any[]): void;
609
- /**
610
- * Log debug
611
- */
612
- debug(message: string, ...args: any[]): void;
613
- /**
614
- * Log success
615
- */
616
- success(message: string, ...args: any[]): void;
617
- /**
618
- * Create a sub-logger with prefix
619
- */
620
- withTag(tag: string): ConsolaInstance;
621
- }
622
-
623
- /**
624
- * Retry Configuration and Utilities
625
- *
626
- * Provides automatic retry logic for failed HTTP requests using p-retry.
627
- * Retries only on network errors and server errors (5xx), not client errors (4xx).
628
- */
629
- /**
630
- * Information about a failed retry attempt.
631
- */
632
- interface FailedAttemptInfo {
633
- /** The error that caused the failure */
634
- error: Error;
635
- /** The attempt number (1-indexed) */
636
- attemptNumber: number;
637
- /** Number of retries left */
638
- retriesLeft: number;
639
- }
640
- /**
641
- * Retry configuration options.
642
- *
643
- * Uses exponential backoff with jitter by default to avoid thundering herd.
644
- */
645
- interface RetryConfig {
646
- /**
647
- * Maximum number of retry attempts.
648
- * @default 3
649
- */
650
- retries?: number;
651
- /**
652
- * Exponential backoff factor.
653
- * @default 2
654
- */
655
- factor?: number;
656
- /**
657
- * Minimum wait time between retries (ms).
658
- * @default 1000
659
- */
660
- minTimeout?: number;
661
- /**
662
- * Maximum wait time between retries (ms).
663
- * @default 60000
664
- */
665
- maxTimeout?: number;
666
- /**
667
- * Add randomness to wait times (jitter).
668
- * Helps avoid thundering herd problem.
669
- * @default true
670
- */
671
- randomize?: boolean;
672
- /**
673
- * Callback called on each failed attempt.
674
- */
675
- onFailedAttempt?: (info: FailedAttemptInfo) => void;
676
- }
677
- /**
678
- * Default retry configuration.
679
- */
680
- declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
681
- /**
682
- * Determine if an error should trigger a retry.
683
- *
684
- * Retries on:
685
- * - Network errors (connection refused, timeout, etc.)
686
- * - Server errors (5xx status codes)
687
- * - Rate limiting (429 status code)
688
- *
689
- * Does NOT retry on:
690
- * - Client errors (4xx except 429)
691
- * - Authentication errors (401, 403)
692
- * - Not found (404)
693
- *
694
- * @param error - The error to check
695
- * @returns true if should retry, false otherwise
696
- */
697
- declare function shouldRetry(error: any): boolean;
698
- /**
699
- * Wrap a function with retry logic.
700
- *
701
- * @param fn - Async function to retry
702
- * @param config - Retry configuration
703
- * @returns Result of the function
704
- *
705
- * @example
706
- * ```typescript
707
- * const result = await withRetry(
708
- * async () => fetch('https://api.example.com/users'),
709
- * { retries: 5, minTimeout: 2000 }
710
- * );
711
- * ```
712
- */
713
- declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
714
-
715
- /**
716
- * Async API client for Django CFG API.
52
+ * Async API client for Cmdop API.
717
53
  *
718
54
  * Usage:
719
55
  * ```typescript
@@ -773,364 +109,6 @@ declare class APIClient {
773
109
  private _makeRequest;
774
110
  }
775
111
 
776
- /**
777
- * Storage adapters for cross-platform token storage.
778
- *
779
- * Supports:
780
- * - LocalStorage (browser)
781
- * - Cookies (SSR/browser)
782
- * - Memory (Node.js/Electron/testing)
783
- */
784
-
785
- /**
786
- * Storage adapter interface for cross-platform token storage.
787
- */
788
- interface StorageAdapter {
789
- getItem(key: string): string | null;
790
- setItem(key: string, value: string): void;
791
- removeItem(key: string): void;
792
- }
793
- /**
794
- * LocalStorage adapter with safe try-catch for browser environments.
795
- * Works in modern browsers with localStorage support.
796
- *
797
- * Note: This adapter uses window.localStorage and should only be used in browser/client environments.
798
- * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.
799
- */
800
- declare class LocalStorageAdapter implements StorageAdapter {
801
- private logger?;
802
- constructor(logger?: APILogger);
803
- getItem(key: string): string | null;
804
- setItem(key: string, value: string): void;
805
- removeItem(key: string): void;
806
- }
807
- /**
808
- * Cookie-based storage adapter for SSR and browser environments.
809
- * Useful for Next.js, Nuxt.js, and other SSR frameworks.
810
- */
811
- declare class CookieStorageAdapter implements StorageAdapter {
812
- private logger?;
813
- constructor(logger?: APILogger);
814
- getItem(key: string): string | null;
815
- setItem(key: string, value: string): void;
816
- removeItem(key: string): void;
817
- }
818
- /**
819
- * In-memory storage adapter for Node.js, Electron, and testing environments.
820
- * Data is stored in RAM and cleared when process exits.
821
- */
822
- declare class MemoryStorageAdapter implements StorageAdapter {
823
- private storage;
824
- private logger?;
825
- constructor(logger?: APILogger);
826
- getItem(key: string): string | null;
827
- setItem(key: string, value: string): void;
828
- removeItem(key: string): void;
829
- }
830
-
831
- /**
832
- * Zod schema for Balance
833
- *
834
- * This schema provides runtime validation and type inference.
835
- * * User balance serializer.
836
- * */
837
-
838
- /**
839
- * User balance serializer.
840
- */
841
- declare const BalanceSchema: z.ZodObject<{
842
- balance_usd: z.ZodString;
843
- balance_display: z.ZodString;
844
- total_deposited: z.ZodString;
845
- total_withdrawn: z.ZodString;
846
- last_transaction_at: z.ZodNullable<z.ZodISODateTime>;
847
- }, z.core.$strip>;
848
- /**
849
- * Infer TypeScript type from Zod schema
850
- */
851
- type Balance = z.infer<typeof BalanceSchema>;
852
-
853
- /**
854
- * Zod schema for Currency
855
- *
856
- * This schema provides runtime validation and type inference.
857
- * * Currency list serializer.
858
- * */
859
-
860
- /**
861
- * Currency list serializer.
862
- */
863
- declare const CurrencySchema: z.ZodObject<{
864
- code: z.ZodString;
865
- name: z.ZodString;
866
- token: z.ZodString;
867
- network: z.ZodNullable<z.ZodString>;
868
- display_name: z.ZodString;
869
- symbol: z.ZodString;
870
- decimal_places: z.ZodInt;
871
- is_active: z.ZodBoolean;
872
- min_amount_usd: z.ZodString;
873
- sort_order: z.ZodInt;
874
- }, z.core.$strip>;
875
- /**
876
- * Infer TypeScript type from Zod schema
877
- */
878
- type Currency = z.infer<typeof CurrencySchema>;
879
-
880
- declare const PaginatedPaymentListListSchema: z.ZodObject<{
881
- count: z.ZodInt;
882
- page: z.ZodInt;
883
- pages: z.ZodInt;
884
- page_size: z.ZodInt;
885
- has_next: z.ZodBoolean;
886
- has_previous: z.ZodBoolean;
887
- next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
888
- previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
889
- results: z.ZodArray<z.ZodObject<{
890
- id: z.ZodString;
891
- internal_payment_id: z.ZodString;
892
- amount_usd: z.ZodString;
893
- currency_code: z.ZodString;
894
- currency_token: z.ZodString;
895
- status: z.ZodEnum<typeof PaymentListStatus>;
896
- status_display: z.ZodString;
897
- created_at: z.ZodISODateTime;
898
- completed_at: z.ZodNullable<z.ZodISODateTime>;
899
- }, z.core.$strip>>;
900
- }, z.core.$strip>;
901
- /**
902
- * Infer TypeScript type from Zod schema
903
- */
904
- type PaginatedPaymentListList = z.infer<typeof PaginatedPaymentListListSchema>;
905
-
906
- declare const PaginatedWithdrawalListListSchema: z.ZodObject<{
907
- count: z.ZodInt;
908
- page: z.ZodInt;
909
- pages: z.ZodInt;
910
- page_size: z.ZodInt;
911
- has_next: z.ZodBoolean;
912
- has_previous: z.ZodBoolean;
913
- next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
914
- previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
915
- results: z.ZodArray<z.ZodObject<{
916
- id: z.ZodString;
917
- internal_withdrawal_id: z.ZodString;
918
- amount_usd: z.ZodString;
919
- final_amount_usd: z.ZodString;
920
- currency_code: z.ZodString;
921
- currency_token: z.ZodString;
922
- status: z.ZodEnum<typeof WithdrawalListStatus>;
923
- status_display: z.ZodString;
924
- created_at: z.ZodISODateTime;
925
- completed_at: z.ZodNullable<z.ZodISODateTime>;
926
- }, z.core.$strip>>;
927
- }, z.core.$strip>;
928
- /**
929
- * Infer TypeScript type from Zod schema
930
- */
931
- type PaginatedWithdrawalListList = z.infer<typeof PaginatedWithdrawalListListSchema>;
932
-
933
- /**
934
- * Zod schema for PaymentCreateRequest
935
- *
936
- * This schema provides runtime validation and type inference.
937
- * * Serializer for creating payment.
938
- * */
939
-
940
- /**
941
- * Serializer for creating payment.
942
- */
943
- declare const PaymentCreateRequestSchema: z.ZodObject<{
944
- amount_usd: z.ZodString;
945
- currency_code: z.ZodString;
946
- description: z.ZodOptional<z.ZodString>;
947
- }, z.core.$strip>;
948
- /**
949
- * Infer TypeScript type from Zod schema
950
- */
951
- type PaymentCreateRequest = z.infer<typeof PaymentCreateRequestSchema>;
952
-
953
- /**
954
- * Zod schema for PaymentDetail
955
- *
956
- * This schema provides runtime validation and type inference.
957
- * * Detailed payment information.
958
- * */
959
-
960
- /**
961
- * Detailed payment information.
962
- */
963
- declare const PaymentDetailSchema: z.ZodObject<{
964
- id: z.ZodString;
965
- internal_payment_id: z.ZodString;
966
- amount_usd: z.ZodString;
967
- currency_code: z.ZodString;
968
- currency_name: z.ZodString;
969
- currency_token: z.ZodString;
970
- currency_network: z.ZodString;
971
- pay_amount: z.ZodNullable<z.ZodString>;
972
- actual_amount: z.ZodNullable<z.ZodString>;
973
- actual_amount_usd: z.ZodNullable<z.ZodString>;
974
- status: z.ZodEnum<typeof PaymentDetailStatus>;
975
- status_display: z.ZodString;
976
- pay_address: z.ZodNullable<z.ZodString>;
977
- qr_code_url: z.ZodNullable<z.ZodString>;
978
- payment_url: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
979
- transaction_hash: z.ZodNullable<z.ZodString>;
980
- explorer_link: z.ZodNullable<z.ZodString>;
981
- confirmations_count: z.ZodInt;
982
- expires_at: z.ZodNullable<z.ZodISODateTime>;
983
- completed_at: z.ZodNullable<z.ZodISODateTime>;
984
- created_at: z.ZodISODateTime;
985
- is_completed: z.ZodBoolean;
986
- is_failed: z.ZodBoolean;
987
- is_expired: z.ZodBoolean;
988
- description: z.ZodString;
989
- }, z.core.$strip>;
990
- /**
991
- * Infer TypeScript type from Zod schema
992
- */
993
- type PaymentDetail = z.infer<typeof PaymentDetailSchema>;
994
-
995
- /**
996
- * Zod schema for PaymentList
997
- *
998
- * This schema provides runtime validation and type inference.
999
- * * Payment list item (lighter than detail).
1000
- * */
1001
-
1002
- /**
1003
- * Payment list item (lighter than detail).
1004
- */
1005
- declare const PaymentListSchema: z.ZodObject<{
1006
- id: z.ZodString;
1007
- internal_payment_id: z.ZodString;
1008
- amount_usd: z.ZodString;
1009
- currency_code: z.ZodString;
1010
- currency_token: z.ZodString;
1011
- status: z.ZodEnum<typeof PaymentListStatus>;
1012
- status_display: z.ZodString;
1013
- created_at: z.ZodISODateTime;
1014
- completed_at: z.ZodNullable<z.ZodISODateTime>;
1015
- }, z.core.$strip>;
1016
- /**
1017
- * Infer TypeScript type from Zod schema
1018
- */
1019
- type PaymentList = z.infer<typeof PaymentListSchema>;
1020
-
1021
- /**
1022
- * Zod schema for Transaction
1023
- *
1024
- * This schema provides runtime validation and type inference.
1025
- * * Transaction serializer.
1026
- * */
1027
-
1028
- /**
1029
- * Transaction serializer.
1030
- */
1031
- declare const TransactionSchema: z.ZodObject<{
1032
- id: z.ZodString;
1033
- transaction_type: z.ZodEnum<typeof TransactionTransactionType>;
1034
- type_display: z.ZodString;
1035
- amount_usd: z.ZodString;
1036
- amount_display: z.ZodString;
1037
- balance_after: z.ZodString;
1038
- payment_id: z.ZodNullable<z.ZodString>;
1039
- description: z.ZodString;
1040
- created_at: z.ZodISODateTime;
1041
- }, z.core.$strip>;
1042
- /**
1043
- * Infer TypeScript type from Zod schema
1044
- */
1045
- type Transaction = z.infer<typeof TransactionSchema>;
1046
-
1047
- /**
1048
- * Zod schema for WithdrawalCreateRequest
1049
- *
1050
- * This schema provides runtime validation and type inference.
1051
- * * Serializer for creating withdrawal request.
1052
- * */
1053
-
1054
- /**
1055
- * Serializer for creating withdrawal request.
1056
- */
1057
- declare const WithdrawalCreateRequestSchema: z.ZodObject<{
1058
- amount_usd: z.ZodString;
1059
- currency_code: z.ZodString;
1060
- wallet_address: z.ZodString;
1061
- }, z.core.$strip>;
1062
- /**
1063
- * Infer TypeScript type from Zod schema
1064
- */
1065
- type WithdrawalCreateRequest = z.infer<typeof WithdrawalCreateRequestSchema>;
1066
-
1067
- /**
1068
- * Zod schema for WithdrawalDetail
1069
- *
1070
- * This schema provides runtime validation and type inference.
1071
- * * Detailed withdrawal information.
1072
- * */
1073
-
1074
- /**
1075
- * Detailed withdrawal information.
1076
- */
1077
- declare const WithdrawalDetailSchema: z.ZodObject<{
1078
- id: z.ZodString;
1079
- internal_withdrawal_id: z.ZodString;
1080
- amount_usd: z.ZodString;
1081
- currency_code: z.ZodString;
1082
- currency_name: z.ZodString;
1083
- currency_token: z.ZodString;
1084
- currency_network: z.ZodString;
1085
- wallet_address: z.ZodString;
1086
- network_fee_usd: z.ZodString;
1087
- service_fee_usd: z.ZodString;
1088
- total_fee_usd: z.ZodString;
1089
- final_amount_usd: z.ZodString;
1090
- crypto_amount: z.ZodNullable<z.ZodString>;
1091
- status: z.ZodEnum<typeof WithdrawalDetailStatus>;
1092
- status_display: z.ZodString;
1093
- transaction_hash: z.ZodNullable<z.ZodString>;
1094
- explorer_link: z.ZodNullable<z.ZodString>;
1095
- admin_notes: z.ZodString;
1096
- created_at: z.ZodISODateTime;
1097
- approved_at: z.ZodNullable<z.ZodISODateTime>;
1098
- completed_at: z.ZodNullable<z.ZodISODateTime>;
1099
- rejected_at: z.ZodNullable<z.ZodISODateTime>;
1100
- cancelled_at: z.ZodNullable<z.ZodISODateTime>;
1101
- }, z.core.$strip>;
1102
- /**
1103
- * Infer TypeScript type from Zod schema
1104
- */
1105
- type WithdrawalDetail = z.infer<typeof WithdrawalDetailSchema>;
1106
-
1107
- /**
1108
- * Zod schema for WithdrawalList
1109
- *
1110
- * This schema provides runtime validation and type inference.
1111
- * * Withdrawal list item (lighter than detail).
1112
- * */
1113
-
1114
- /**
1115
- * Withdrawal list item (lighter than detail).
1116
- */
1117
- declare const WithdrawalListSchema: z.ZodObject<{
1118
- id: z.ZodString;
1119
- internal_withdrawal_id: z.ZodString;
1120
- amount_usd: z.ZodString;
1121
- final_amount_usd: z.ZodString;
1122
- currency_code: z.ZodString;
1123
- currency_token: z.ZodString;
1124
- status: z.ZodEnum<typeof WithdrawalListStatus>;
1125
- status_display: z.ZodString;
1126
- created_at: z.ZodISODateTime;
1127
- completed_at: z.ZodNullable<z.ZodISODateTime>;
1128
- }, z.core.$strip>;
1129
- /**
1130
- * Infer TypeScript type from Zod schema
1131
- */
1132
- type WithdrawalList = z.infer<typeof WithdrawalListSchema>;
1133
-
1134
112
  /**
1135
113
  * Zod Schemas - Runtime validation and type inference
1136
114
  *
@@ -1149,30 +127,36 @@ type WithdrawalList = z.infer<typeof WithdrawalListSchema>;
1149
127
  * ```
1150
128
  */
1151
129
 
1152
- type index$1_Balance = Balance;
130
+ declare const index$1_Balance: typeof Balance;
1153
131
  declare const index$1_BalanceSchema: typeof BalanceSchema;
1154
- type index$1_Currency = Currency;
132
+ declare const index$1_Currency: typeof Currency;
1155
133
  declare const index$1_CurrencySchema: typeof CurrencySchema;
1156
- type index$1_PaginatedPaymentListList = PaginatedPaymentListList;
134
+ declare const index$1_PaginatedPaymentListList: typeof PaginatedPaymentListList;
1157
135
  declare const index$1_PaginatedPaymentListListSchema: typeof PaginatedPaymentListListSchema;
1158
- type index$1_PaginatedWithdrawalListList = PaginatedWithdrawalListList;
136
+ declare const index$1_PaginatedWithdrawalListList: typeof PaginatedWithdrawalListList;
1159
137
  declare const index$1_PaginatedWithdrawalListListSchema: typeof PaginatedWithdrawalListListSchema;
1160
- type index$1_PaymentCreateRequest = PaymentCreateRequest;
138
+ declare const index$1_PaymentCreateRequest: typeof PaymentCreateRequest;
1161
139
  declare const index$1_PaymentCreateRequestSchema: typeof PaymentCreateRequestSchema;
1162
- type index$1_PaymentDetail = PaymentDetail;
140
+ declare const index$1_PaymentCreateResponse: typeof PaymentCreateResponse;
141
+ declare const index$1_PaymentCreateResponseSchema: typeof PaymentCreateResponseSchema;
142
+ declare const index$1_PaymentDetail: typeof PaymentDetail;
1163
143
  declare const index$1_PaymentDetailSchema: typeof PaymentDetailSchema;
1164
- type index$1_PaymentList = PaymentList;
144
+ declare const index$1_PaymentList: typeof PaymentList;
1165
145
  declare const index$1_PaymentListSchema: typeof PaymentListSchema;
1166
- type index$1_Transaction = Transaction;
146
+ declare const index$1_Transaction: typeof Transaction;
1167
147
  declare const index$1_TransactionSchema: typeof TransactionSchema;
1168
- type index$1_WithdrawalCreateRequest = WithdrawalCreateRequest;
148
+ declare const index$1_WithdrawalCancelResponse: typeof WithdrawalCancelResponse;
149
+ declare const index$1_WithdrawalCancelResponseSchema: typeof WithdrawalCancelResponseSchema;
150
+ declare const index$1_WithdrawalCreateRequest: typeof WithdrawalCreateRequest;
1169
151
  declare const index$1_WithdrawalCreateRequestSchema: typeof WithdrawalCreateRequestSchema;
1170
- type index$1_WithdrawalDetail = WithdrawalDetail;
152
+ declare const index$1_WithdrawalCreateResponse: typeof WithdrawalCreateResponse;
153
+ declare const index$1_WithdrawalCreateResponseSchema: typeof WithdrawalCreateResponseSchema;
154
+ declare const index$1_WithdrawalDetail: typeof WithdrawalDetail;
1171
155
  declare const index$1_WithdrawalDetailSchema: typeof WithdrawalDetailSchema;
1172
- type index$1_WithdrawalList = WithdrawalList;
156
+ declare const index$1_WithdrawalList: typeof WithdrawalList;
1173
157
  declare const index$1_WithdrawalListSchema: typeof WithdrawalListSchema;
1174
158
  declare namespace index$1 {
1175
- export { type index$1_Balance as Balance, index$1_BalanceSchema as BalanceSchema, type index$1_Currency as Currency, index$1_CurrencySchema as CurrencySchema, type index$1_PaginatedPaymentListList as PaginatedPaymentListList, index$1_PaginatedPaymentListListSchema as PaginatedPaymentListListSchema, type index$1_PaginatedWithdrawalListList as PaginatedWithdrawalListList, index$1_PaginatedWithdrawalListListSchema as PaginatedWithdrawalListListSchema, type index$1_PaymentCreateRequest as PaymentCreateRequest, index$1_PaymentCreateRequestSchema as PaymentCreateRequestSchema, type index$1_PaymentDetail as PaymentDetail, index$1_PaymentDetailSchema as PaymentDetailSchema, type index$1_PaymentList as PaymentList, index$1_PaymentListSchema as PaymentListSchema, type index$1_Transaction as Transaction, index$1_TransactionSchema as TransactionSchema, type index$1_WithdrawalCreateRequest as WithdrawalCreateRequest, index$1_WithdrawalCreateRequestSchema as WithdrawalCreateRequestSchema, type index$1_WithdrawalDetail as WithdrawalDetail, index$1_WithdrawalDetailSchema as WithdrawalDetailSchema, type index$1_WithdrawalList as WithdrawalList, index$1_WithdrawalListSchema as WithdrawalListSchema };
159
+ export { index$1_Balance as Balance, index$1_BalanceSchema as BalanceSchema, index$1_Currency as Currency, index$1_CurrencySchema as CurrencySchema, index$1_PaginatedPaymentListList as PaginatedPaymentListList, index$1_PaginatedPaymentListListSchema as PaginatedPaymentListListSchema, index$1_PaginatedWithdrawalListList as PaginatedWithdrawalListList, index$1_PaginatedWithdrawalListListSchema as PaginatedWithdrawalListListSchema, index$1_PaymentCreateRequest as PaymentCreateRequest, index$1_PaymentCreateRequestSchema as PaymentCreateRequestSchema, index$1_PaymentCreateResponse as PaymentCreateResponse, index$1_PaymentCreateResponseSchema as PaymentCreateResponseSchema, index$1_PaymentDetail as PaymentDetail, index$1_PaymentDetailSchema as PaymentDetailSchema, index$1_PaymentList as PaymentList, index$1_PaymentListSchema as PaymentListSchema, index$1_Transaction as Transaction, index$1_TransactionSchema as TransactionSchema, index$1_WithdrawalCancelResponse as WithdrawalCancelResponse, index$1_WithdrawalCancelResponseSchema as WithdrawalCancelResponseSchema, index$1_WithdrawalCreateRequest as WithdrawalCreateRequest, index$1_WithdrawalCreateRequestSchema as WithdrawalCreateRequestSchema, index$1_WithdrawalCreateResponse as WithdrawalCreateResponse, index$1_WithdrawalCreateResponseSchema as WithdrawalCreateResponseSchema, index$1_WithdrawalDetail as WithdrawalDetail, index$1_WithdrawalDetailSchema as WithdrawalDetailSchema, index$1_WithdrawalList as WithdrawalList, index$1_WithdrawalListSchema as WithdrawalListSchema };
1176
160
  }
1177
161
 
1178
162
  /**
@@ -1248,101 +232,6 @@ declare function onValidationError(callback: (detail: ValidationErrorDetail) =>
1248
232
  */
1249
233
  declare function formatZodError(error: ZodError): string;
1250
234
 
1251
- /**
1252
- * Get user balance
1253
- *
1254
- * @method GET
1255
- * @path /cfg/payments/balance/
1256
- */
1257
- declare function getPaymentsBalanceRetrieve(client?: any): Promise<Balance>;
1258
- /**
1259
- * Get available currencies
1260
- *
1261
- * @method GET
1262
- * @path /cfg/payments/currencies/
1263
- */
1264
- declare function getPaymentsCurrenciesList(client?: any): Promise<any>;
1265
- /**
1266
- * API operation
1267
- *
1268
- * @method GET
1269
- * @path /cfg/payments/payments/
1270
- */
1271
- declare function getPaymentsPaymentsList(params?: {
1272
- page?: number;
1273
- page_size?: number;
1274
- }, client?: any): Promise<PaginatedPaymentListList>;
1275
- /**
1276
- * API operation
1277
- *
1278
- * @method GET
1279
- * @path /cfg/payments/payments/{id}/
1280
- */
1281
- declare function getPaymentsPaymentsRetrieve(id: string, client?: any): Promise<PaymentDetail>;
1282
- /**
1283
- * API operation
1284
- *
1285
- * @method POST
1286
- * @path /cfg/payments/payments/{id}/confirm/
1287
- */
1288
- declare function createPaymentsPaymentsConfirmCreate(id: string, client?: any): Promise<PaymentList>;
1289
- /**
1290
- * API operation
1291
- *
1292
- * @method GET
1293
- * @path /cfg/payments/payments/{id}/status/
1294
- */
1295
- declare function getPaymentsPaymentsStatusRetrieve(id: string, client?: any): Promise<PaymentList>;
1296
- /**
1297
- * Create payment
1298
- *
1299
- * @method POST
1300
- * @path /cfg/payments/payments/create/
1301
- */
1302
- declare function createPaymentsPaymentsCreateCreate(data: PaymentCreateRequest, client?: any): Promise<PaymentDetail>;
1303
- /**
1304
- * Get user transactions
1305
- *
1306
- * @method GET
1307
- * @path /cfg/payments/transactions/
1308
- */
1309
- declare function getPaymentsTransactionsList(params?: {
1310
- limit?: number;
1311
- offset?: number;
1312
- type?: string;
1313
- }, client?: any): Promise<any>;
1314
- /**
1315
- * API operation
1316
- *
1317
- * @method GET
1318
- * @path /cfg/payments/withdrawals/
1319
- */
1320
- declare function getPaymentsWithdrawalsList(params?: {
1321
- page?: number;
1322
- page_size?: number;
1323
- }, client?: any): Promise<PaginatedWithdrawalListList>;
1324
- /**
1325
- * API operation
1326
- *
1327
- * @method GET
1328
- * @path /cfg/payments/withdrawals/{id}/
1329
- */
1330
- declare function getPaymentsWithdrawalsRetrieve(id: string, client?: any): Promise<WithdrawalDetail>;
1331
- /**
1332
- * Cancel withdrawal request
1333
- *
1334
- * @method POST
1335
- * @path /cfg/payments/withdrawals/{id}/cancel/
1336
- */
1337
- declare function createPaymentsWithdrawalsCancelCreate(id: string, client?: any): Promise<WithdrawalDetail>;
1338
- /**
1339
- * Create withdrawal request
1340
- *
1341
- * @method POST
1342
- * @path /cfg/payments/withdrawals/create/
1343
- */
1344
- declare function createPaymentsWithdrawalsCreateCreate(data: WithdrawalCreateRequest, client?: any): Promise<WithdrawalDetail>;
1345
-
1346
235
  /**
1347
236
  * Typed Fetchers - Universal API functions
1348
237
  *
@@ -1375,7 +264,9 @@ declare const index_createPaymentsPaymentsCreateCreate: typeof createPaymentsPay
1375
264
  declare const index_createPaymentsWithdrawalsCancelCreate: typeof createPaymentsWithdrawalsCancelCreate;
1376
265
  declare const index_createPaymentsWithdrawalsCreateCreate: typeof createPaymentsWithdrawalsCreateCreate;
1377
266
  declare const index_getPaymentsBalanceRetrieve: typeof getPaymentsBalanceRetrieve;
267
+ declare const index_getPaymentsCurrenciesEstimateRetrieve: typeof getPaymentsCurrenciesEstimateRetrieve;
1378
268
  declare const index_getPaymentsCurrenciesList: typeof getPaymentsCurrenciesList;
269
+ declare const index_getPaymentsCurrenciesWithdrawalEstimateRetrieve: typeof getPaymentsCurrenciesWithdrawalEstimateRetrieve;
1379
270
  declare const index_getPaymentsPaymentsList: typeof getPaymentsPaymentsList;
1380
271
  declare const index_getPaymentsPaymentsRetrieve: typeof getPaymentsPaymentsRetrieve;
1381
272
  declare const index_getPaymentsPaymentsStatusRetrieve: typeof getPaymentsPaymentsStatusRetrieve;
@@ -1383,7 +274,7 @@ declare const index_getPaymentsTransactionsList: typeof getPaymentsTransactionsL
1383
274
  declare const index_getPaymentsWithdrawalsList: typeof getPaymentsWithdrawalsList;
1384
275
  declare const index_getPaymentsWithdrawalsRetrieve: typeof getPaymentsWithdrawalsRetrieve;
1385
276
  declare namespace index {
1386
- export { index_createPaymentsPaymentsConfirmCreate as createPaymentsPaymentsConfirmCreate, index_createPaymentsPaymentsCreateCreate as createPaymentsPaymentsCreateCreate, index_createPaymentsWithdrawalsCancelCreate as createPaymentsWithdrawalsCancelCreate, index_createPaymentsWithdrawalsCreateCreate as createPaymentsWithdrawalsCreateCreate, index_getPaymentsBalanceRetrieve as getPaymentsBalanceRetrieve, index_getPaymentsCurrenciesList as getPaymentsCurrenciesList, index_getPaymentsPaymentsList as getPaymentsPaymentsList, index_getPaymentsPaymentsRetrieve as getPaymentsPaymentsRetrieve, index_getPaymentsPaymentsStatusRetrieve as getPaymentsPaymentsStatusRetrieve, index_getPaymentsTransactionsList as getPaymentsTransactionsList, index_getPaymentsWithdrawalsList as getPaymentsWithdrawalsList, index_getPaymentsWithdrawalsRetrieve as getPaymentsWithdrawalsRetrieve };
277
+ export { index_createPaymentsPaymentsConfirmCreate as createPaymentsPaymentsConfirmCreate, index_createPaymentsPaymentsCreateCreate as createPaymentsPaymentsCreateCreate, index_createPaymentsWithdrawalsCancelCreate as createPaymentsWithdrawalsCancelCreate, index_createPaymentsWithdrawalsCreateCreate as createPaymentsWithdrawalsCreateCreate, index_getPaymentsBalanceRetrieve as getPaymentsBalanceRetrieve, index_getPaymentsCurrenciesEstimateRetrieve as getPaymentsCurrenciesEstimateRetrieve, index_getPaymentsCurrenciesList as getPaymentsCurrenciesList, index_getPaymentsCurrenciesWithdrawalEstimateRetrieve as getPaymentsCurrenciesWithdrawalEstimateRetrieve, index_getPaymentsPaymentsList as getPaymentsPaymentsList, index_getPaymentsPaymentsRetrieve as getPaymentsPaymentsRetrieve, index_getPaymentsPaymentsStatusRetrieve as getPaymentsPaymentsStatusRetrieve, index_getPaymentsTransactionsList as getPaymentsTransactionsList, index_getPaymentsWithdrawalsList as getPaymentsWithdrawalsList, index_getPaymentsWithdrawalsRetrieve as getPaymentsWithdrawalsRetrieve };
1387
278
  }
1388
279
 
1389
280
  /**
@@ -1536,116 +427,6 @@ declare class NetworkError extends Error {
1536
427
  constructor(message: string, url: string, originalError?: Error);
1537
428
  }
1538
429
 
1539
- /**
1540
- * Django CFG API - API Client with JWT Management
1541
- *
1542
- * Usage:
1543
- * ```typescript
1544
- * import { API } from './api';
1545
- *
1546
- * const api = new API('https://api.example.com');
1547
- *
1548
- * // Set JWT token
1549
- * api.setToken('your-jwt-token', 'refresh-token');
1550
- *
1551
- * // Use API
1552
- * const posts = await api.posts.list();
1553
- * const user = await api.users.retrieve(1);
1554
- *
1555
- * // Check authentication
1556
- * if (api.isAuthenticated()) {
1557
- * // ...
1558
- * }
1559
- *
1560
- * // Custom storage with logging (for Electron/Node.js)
1561
- * import { MemoryStorageAdapter, APILogger } from './storage';
1562
- * const logger = new APILogger({ enabled: true, logLevel: 'debug' });
1563
- * const api = new API('https://api.example.com', {
1564
- * storage: new MemoryStorageAdapter(logger),
1565
- * loggerConfig: { enabled: true, logLevel: 'debug' }
1566
- * });
1567
- *
1568
- * // Get OpenAPI schema
1569
- * const schema = api.getSchema();
1570
- * ```
1571
- */
1572
-
1573
- declare const TOKEN_KEY = "auth_token";
1574
- declare const REFRESH_TOKEN_KEY = "refresh_token";
1575
- interface APIOptions {
1576
- /** Custom storage adapter (defaults to LocalStorageAdapter) */
1577
- storage?: StorageAdapter;
1578
- /** Retry configuration for failed requests */
1579
- retryConfig?: RetryConfig;
1580
- /** Logger configuration */
1581
- loggerConfig?: Partial<LoggerConfig>;
1582
- }
1583
- declare class API {
1584
- private baseUrl;
1585
- private _client;
1586
- private _token;
1587
- private _refreshToken;
1588
- private storage;
1589
- private options?;
1590
- ext_payments_payments: ExtPaymentsPayments;
1591
- constructor(baseUrl: string, options?: APIOptions);
1592
- private _loadTokensFromStorage;
1593
- private _reinitClients;
1594
- private _injectAuthHeader;
1595
- /**
1596
- * Get current JWT token
1597
- */
1598
- getToken(): string | null;
1599
- /**
1600
- * Get current refresh token
1601
- */
1602
- getRefreshToken(): string | null;
1603
- /**
1604
- * Set JWT token and refresh token
1605
- * @param token - JWT access token
1606
- * @param refreshToken - JWT refresh token (optional)
1607
- */
1608
- setToken(token: string, refreshToken?: string): void;
1609
- /**
1610
- * Clear all tokens
1611
- */
1612
- clearTokens(): void;
1613
- /**
1614
- * Check if user is authenticated
1615
- */
1616
- isAuthenticated(): boolean;
1617
- /**
1618
- * Update base URL and reinitialize clients
1619
- * @param url - New base URL
1620
- */
1621
- setBaseUrl(url: string): void;
1622
- /**
1623
- * Get current base URL
1624
- */
1625
- getBaseUrl(): string;
1626
- /**
1627
- * Get OpenAPI schema path
1628
- * @returns Path to the OpenAPI schema JSON file
1629
- *
1630
- * Note: The OpenAPI schema is available in the schema.json file.
1631
- * You can load it dynamically using:
1632
- * ```typescript
1633
- * const schema = await fetch('./schema.json').then(r => r.json());
1634
- * // or using fs in Node.js:
1635
- * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
1636
- * ```
1637
- */
1638
- getSchemaPath(): string;
1639
- }
1640
-
1641
- /**
1642
- * Payments Extension API
1643
- *
1644
- * Pre-configured API instance with shared authentication
1645
- */
1646
-
1647
- declare const apiPayments: API;
1648
-
1649
430
  /**
1650
431
  * Balance Hero (Apple-style)
1651
432
  *
@@ -1702,6 +483,18 @@ interface WithdrawSheetProps {
1702
483
  }
1703
484
  declare function WithdrawSheet({ open, onOpenChange, onSuccess }: WithdrawSheetProps): react_jsx_runtime.JSX.Element;
1704
485
 
486
+ /**
487
+ * Withdrawal Details Sheet (Apple-style)
488
+ *
489
+ * Shows withdrawal request details and status
490
+ */
491
+ interface WithdrawalSheetProps {
492
+ withdrawalId: string | null;
493
+ open: boolean;
494
+ onOpenChange: (open: boolean) => void;
495
+ }
496
+ declare function WithdrawalSheet({ withdrawalId, open, onOpenChange }: WithdrawalSheetProps): react_jsx_runtime.JSX.Element;
497
+
1705
498
  /**
1706
499
  * Payment Sheet (Apple-style)
1707
500
  *
@@ -1712,44 +505,13 @@ interface PaymentSheetProps {
1712
505
  paymentId: string | null;
1713
506
  open: boolean;
1714
507
  onOpenChange: (open: boolean) => void;
508
+ onCreateNew?: () => void;
1715
509
  }
1716
- declare function PaymentSheet({ paymentId, open, onOpenChange }: PaymentSheetProps): react_jsx_runtime.JSX.Element;
1717
-
1718
- interface ResponsiveSheetProps {
1719
- open: boolean;
1720
- onOpenChange: (open: boolean) => void;
1721
- children: React.ReactNode;
1722
- }
1723
- interface ResponsiveSheetHeaderProps {
1724
- children: React.ReactNode;
1725
- className?: string;
1726
- }
1727
- interface ResponsiveSheetTitleProps {
1728
- children: React.ReactNode;
1729
- className?: string;
1730
- }
1731
- interface ResponsiveSheetDescriptionProps {
1732
- children: React.ReactNode;
1733
- className?: string;
1734
- }
1735
- interface ResponsiveSheetContentProps {
1736
- children: React.ReactNode;
1737
- className?: string;
1738
- }
1739
- interface ResponsiveSheetFooterProps {
1740
- children: React.ReactNode;
1741
- className?: string;
1742
- }
1743
- declare function ResponsiveSheet({ open, onOpenChange, children }: ResponsiveSheetProps): react_jsx_runtime.JSX.Element;
1744
- declare function ResponsiveSheetContent({ children, className }: ResponsiveSheetContentProps): react_jsx_runtime.JSX.Element;
1745
- declare function ResponsiveSheetHeader({ children, className }: ResponsiveSheetHeaderProps): react_jsx_runtime.JSX.Element;
1746
- declare function ResponsiveSheetTitle({ children, className }: ResponsiveSheetTitleProps): react_jsx_runtime.JSX.Element;
1747
- declare function ResponsiveSheetDescription({ children, className }: ResponsiveSheetDescriptionProps): react_jsx_runtime.JSX.Element;
1748
- declare function ResponsiveSheetFooter({ children, className }: ResponsiveSheetFooterProps): react_jsx_runtime.JSX.Element;
510
+ declare function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }: PaymentSheetProps): react_jsx_runtime.JSX.Element;
1749
511
 
1750
512
  /**
1751
513
  * Payments extension configuration
1752
514
  */
1753
515
  declare const extensionConfig: _djangocfg_ext_base.ExtensionMetadata;
1754
516
 
1755
- export { API, APIClient, APIError, APILogger, type APIOptions, ActivityItem, ActivityList, AddFundsSheet, type Balance, BalanceHero, BalanceSchema, CookieStorageAdapter, type Currency, CurrencySchema, DEFAULT_RETRY_CONFIG, enums as Enums, type ErrorLog, models as ExtPaymentsPaymentsTypes, type FailedAttemptInfo, FetchAdapter, index as Fetchers, type HttpClientAdapter, type HttpRequest, type HttpResponse, LocalStorageAdapter, type LoggerConfig, MemoryStorageAdapter, NetworkError, type PaginatedPaymentListList, PaginatedPaymentListListSchema, type PaginatedWithdrawalListList, PaginatedWithdrawalListListSchema, type PaymentCreateRequest, PaymentCreateRequestSchema, type PaymentDetail, PaymentDetailSchema, type PaymentList, PaymentListSchema, PaymentSheet, REFRESH_TOKEN_KEY, type RequestLog, type ResponseLog, ResponsiveSheet, ResponsiveSheetContent, ResponsiveSheetDescription, ResponsiveSheetFooter, ResponsiveSheetHeader, ResponsiveSheetTitle, type RetryConfig, index$1 as Schemas, type StorageAdapter, TOKEN_KEY, type Transaction, TransactionSchema, type ValidationErrorDetail, type ValidationErrorEvent, WithdrawSheet, type WithdrawalCreateRequest, WithdrawalCreateRequestSchema, type WithdrawalDetail, WithdrawalDetailSchema, type WithdrawalList, WithdrawalListSchema, apiPayments, clearAPITokens, configureAPI, createPaymentsPaymentsConfirmCreate, createPaymentsPaymentsCreateCreate, createPaymentsWithdrawalsCancelCreate, createPaymentsWithdrawalsCreateCreate, dispatchValidationError, extensionConfig, formatZodError, getAPIInstance, getPaymentsBalanceRetrieve, getPaymentsCurrenciesList, getPaymentsPaymentsList, getPaymentsPaymentsRetrieve, getPaymentsPaymentsStatusRetrieve, getPaymentsTransactionsList, getPaymentsWithdrawalsList, getPaymentsWithdrawalsRetrieve, isAPIConfigured, onValidationError, reconfigureAPI, resetAPI, shouldRetry, withRetry };
517
+ export { API, APIClient, APIError, APIOptions, ActivityItem, ActivityList, AddFundsSheet, Balance, BalanceHero, BalanceSchema, Currency, CurrencySchema, FetchAdapter, index as Fetchers, type HttpClientAdapter, type HttpRequest, type HttpResponse, LoggerConfig, NetworkError, PaginatedPaymentListList, PaginatedPaymentListListSchema, PaginatedWithdrawalListList, PaginatedWithdrawalListListSchema, PaymentCreateRequest, PaymentCreateRequestSchema, PaymentCreateResponse, PaymentCreateResponseSchema, PaymentDetail, PaymentDetailSchema, PaymentList, PaymentListSchema, PaymentSheet, RetryConfig, index$1 as Schemas, Transaction, TransactionSchema, type ValidationErrorDetail, type ValidationErrorEvent, WalletPage, WithdrawSheet, WithdrawalCancelResponse, WithdrawalCancelResponseSchema, WithdrawalCreateRequest, WithdrawalCreateRequestSchema, WithdrawalCreateResponse, WithdrawalCreateResponseSchema, WithdrawalDetail, WithdrawalDetailSchema, WithdrawalList, WithdrawalListSchema, WithdrawalSheet, clearAPITokens, configureAPI, createPaymentsPaymentsConfirmCreate, createPaymentsPaymentsCreateCreate, createPaymentsWithdrawalsCancelCreate, createPaymentsWithdrawalsCreateCreate, dispatchValidationError, extensionConfig, formatZodError, getAPIInstance, getPaymentsBalanceRetrieve, getPaymentsCurrenciesEstimateRetrieve, getPaymentsCurrenciesList, getPaymentsCurrenciesWithdrawalEstimateRetrieve, getPaymentsPaymentsList, getPaymentsPaymentsRetrieve, getPaymentsPaymentsStatusRetrieve, getPaymentsTransactionsList, getPaymentsWithdrawalsList, getPaymentsWithdrawalsRetrieve, isAPIConfigured, onValidationError, reconfigureAPI, resetAPI };