@djangocfg/ext-payments 1.0.1 → 1.0.3

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.
@@ -0,0 +1,187 @@
1
+ import { API, PaymentList as PaymentList$1 } from './index.cjs';
2
+ export { APIClient, APIError, APILogger, APIOptions, Balance, BalanceSchema, CookieStorageAdapter, Currency, CurrencySchema, DEFAULT_RETRY_CONFIG, Enums, ErrorLog, ExtPaymentsPaymentsTypes, FailedAttemptInfo, FetchAdapter, Fetchers, HttpClientAdapter, HttpRequest, HttpResponse, LocalStorageAdapter, LoggerConfig, MemoryStorageAdapter, NetworkError, PAYMENT_EVENTS, PaginatedPaymentListList, PaginatedPaymentListListSchema, PaymentDetail, PaymentDetailSchema, PaymentEvent, PaymentListSchema, PaymentTab, PaymentsLayout, PaymentsLayoutProps, REFRESH_TOKEN_KEY, RequestLog, ResponseLog, RetryConfig, Schemas, StorageAdapter, TOKEN_KEY, Transaction, TransactionSchema, ValidationErrorDetail, ValidationErrorEvent, apiPayments, clearAPITokens, closePaymentsDialog, configureAPI, createPaymentsPaymentsConfirmCreate, createPaymentsPaymentsCreateCreate, dispatchValidationError, extensionConfig, formatZodError, getAPIInstance, getPaymentsBalanceRetrieve, getPaymentsCurrenciesList, getPaymentsPaymentsList, getPaymentsPaymentsRetrieve, getPaymentsPaymentsStatusRetrieve, getPaymentsTransactionsList, isAPIConfigured, onValidationError, openCreatePaymentDialog, openPaymentDetailsDialog, reconfigureAPI, resetAPI, shouldRetry, withRetry } from './index.cjs';
3
+ import useSWR from 'swr';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import React, { ReactNode } from 'react';
6
+ import 'consola';
7
+ import 'zod';
8
+ import '@djangocfg/ext-base';
9
+
10
+ /**
11
+ * SWR Hooks for Payments
12
+ *
13
+ * React hooks powered by SWR for data fetching with automatic caching,
14
+ * revalidation, and optimistic updates.
15
+ *
16
+ * Usage:
17
+ * ```typescript
18
+ * // Query hooks (GET)
19
+ * const { data, error, isLoading } = useUsers({ page: 1 })
20
+ *
21
+ * // Mutation hooks (POST/PUT/PATCH/DELETE)
22
+ * const createUser = useCreateUser()
23
+ * await createUser({ name: 'John', email: 'john@example.com' })
24
+ * ```
25
+ */
26
+
27
+ /**
28
+ * Get user balance
29
+ *
30
+ * @method GET
31
+ * @path /cfg/payments/balance/
32
+ */
33
+ declare function usePaymentsBalanceRetrieve(client?: API): ReturnType<typeof useSWR<Balance>>;
34
+ /**
35
+ * Get available currencies
36
+ *
37
+ * @method GET
38
+ * @path /cfg/payments/currencies/
39
+ */
40
+ declare function usePaymentsCurrenciesList(client?: API): ReturnType<typeof useSWR<any>>;
41
+ /**
42
+ * API operation
43
+ *
44
+ * @method GET
45
+ * @path /cfg/payments/payments/
46
+ */
47
+ declare function usePaymentsPaymentsList(params?: {
48
+ page?: number;
49
+ page_size?: number;
50
+ }, client?: API): ReturnType<typeof useSWR<PaginatedPaymentListList>>;
51
+ /**
52
+ * API operation
53
+ *
54
+ * @method GET
55
+ * @path /cfg/payments/payments/{id}/
56
+ */
57
+ declare function usePaymentsPaymentsRetrieve(id: string, client?: API): ReturnType<typeof useSWR<PaymentDetail>>;
58
+ /**
59
+ * API operation
60
+ *
61
+ * @method POST
62
+ * @path /cfg/payments/payments/{id}/confirm/
63
+ */
64
+ declare function useCreatePaymentsPaymentsConfirmCreate(): (id: string, client?: API) => Promise<PaymentList$1>;
65
+ /**
66
+ * API operation
67
+ *
68
+ * @method GET
69
+ * @path /cfg/payments/payments/{id}/status/
70
+ */
71
+ declare function usePaymentsPaymentsStatusRetrieve(id: string, client?: API): ReturnType<typeof useSWR<PaymentList>>;
72
+ /**
73
+ * API operation
74
+ *
75
+ * @method POST
76
+ * @path /cfg/payments/payments/create/
77
+ */
78
+ declare function useCreatePaymentsPaymentsCreateCreate(): (client?: API) => Promise<PaymentList$1>;
79
+ /**
80
+ * Get user transactions
81
+ *
82
+ * @method GET
83
+ * @path /cfg/payments/transactions/
84
+ */
85
+ declare function usePaymentsTransactionsList(params?: {
86
+ limit?: number;
87
+ offset?: number;
88
+ type?: string;
89
+ }, client?: API): ReturnType<typeof useSWR<any>>;
90
+
91
+ /**
92
+ * Payments Types
93
+ * Centralized type definitions for payments contexts
94
+ */
95
+
96
+ type PaginatedPaymentListList = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsList>>['data']>;
97
+ type PaymentDetail = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsRetrieve>>['data']>;
98
+ type PaymentList = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsList>>['data']> extends {
99
+ results: infer T;
100
+ } ? T extends Array<infer U> ? U : never : never;
101
+
102
+ interface PaymentsContextValue {
103
+ payments: PaginatedPaymentListList | undefined;
104
+ isLoadingPayments: boolean;
105
+ paymentsError: Error | undefined;
106
+ refreshPayments: () => Promise<void>;
107
+ getPayment: (id: string) => Promise<PaymentDetail | undefined>;
108
+ createPayment: () => Promise<PaymentList>;
109
+ confirmPayment: (id: string) => Promise<PaymentList>;
110
+ checkPaymentStatus: (id: string) => Promise<PaymentList | undefined>;
111
+ }
112
+ declare function PaymentsProvider({ children }: {
113
+ children: ReactNode;
114
+ }): react_jsx_runtime.JSX.Element;
115
+ declare function usePaymentsContext(): PaymentsContextValue;
116
+
117
+ interface BalancesContextValue {
118
+ balance: any | undefined;
119
+ isLoadingBalance: boolean;
120
+ balanceError: Error | undefined;
121
+ refreshBalance: () => Promise<void>;
122
+ }
123
+ declare function BalancesProvider({ children }: {
124
+ children: ReactNode;
125
+ }): react_jsx_runtime.JSX.Element;
126
+ declare function useBalancesContext(): BalancesContextValue;
127
+
128
+ interface CurrenciesContextValue {
129
+ currencies: any | undefined;
130
+ isLoadingCurrencies: boolean;
131
+ currenciesError: Error | undefined;
132
+ refreshCurrencies: () => Promise<void>;
133
+ }
134
+ declare function CurrenciesProvider({ children }: {
135
+ children: ReactNode;
136
+ }): react_jsx_runtime.JSX.Element;
137
+ declare function useCurrenciesContext(): CurrenciesContextValue;
138
+
139
+ interface OverviewContextValue {
140
+ balance: any | undefined;
141
+ isLoadingBalance: boolean;
142
+ balanceError: Error | undefined;
143
+ refreshBalance: () => Promise<void>;
144
+ payments: PaginatedPaymentListList | undefined;
145
+ isLoadingPayments: boolean;
146
+ paymentsError: Error | undefined;
147
+ refreshPayments: () => Promise<void>;
148
+ transactions: any | undefined;
149
+ isLoadingTransactions: boolean;
150
+ transactionsError: Error | undefined;
151
+ refreshTransactions: () => Promise<void>;
152
+ createPayment: () => Promise<PaymentList>;
153
+ isLoadingOverview: boolean;
154
+ overviewError: Error | undefined;
155
+ refreshOverview: () => Promise<void>;
156
+ }
157
+ declare function OverviewProvider({ children }: {
158
+ children: ReactNode;
159
+ }): react_jsx_runtime.JSX.Element;
160
+ declare function useOverviewContext(): OverviewContextValue;
161
+
162
+ interface RootPaymentsContextValue {
163
+ currencies: any | undefined;
164
+ isLoadingCurrencies: boolean;
165
+ currenciesError: Error | undefined;
166
+ refreshCurrencies: () => Promise<void>;
167
+ }
168
+ declare function RootPaymentsProvider({ children }: {
169
+ children: ReactNode;
170
+ }): react_jsx_runtime.JSX.Element;
171
+ declare function useRootPaymentsContext(): RootPaymentsContextValue;
172
+
173
+ /**
174
+ * Create Payment Dialog (v2.0 - Simplified)
175
+ * Dialog for creating new payments
176
+ */
177
+
178
+ declare const CreatePaymentDialog: React.FC;
179
+
180
+ /**
181
+ * Payment Details Dialog (v2.0 - Simplified)
182
+ * Shows payment details with QR code, address, and status
183
+ */
184
+
185
+ declare const PaymentDetailsDialog: React.FC;
186
+
187
+ export { API, type BalancesContextValue, BalancesProvider, CreatePaymentDialog, type CurrenciesContextValue, CurrenciesProvider, type OverviewContextValue, OverviewProvider, PaymentDetailsDialog, PaymentList$1 as PaymentList, type PaymentsContextValue, PaymentsProvider, type RootPaymentsContextValue, RootPaymentsProvider, useBalancesContext, useCreatePaymentsPaymentsConfirmCreate, useCreatePaymentsPaymentsCreateCreate, useCurrenciesContext, useOverviewContext, usePaymentsBalanceRetrieve, usePaymentsContext, usePaymentsCurrenciesList, usePaymentsPaymentsList, usePaymentsPaymentsRetrieve, usePaymentsPaymentsStatusRetrieve, usePaymentsTransactionsList, useRootPaymentsContext };
@@ -0,0 +1,187 @@
1
+ import { API, PaymentList as PaymentList$1 } from './index.js';
2
+ export { APIClient, APIError, APILogger, APIOptions, Balance, BalanceSchema, CookieStorageAdapter, Currency, CurrencySchema, DEFAULT_RETRY_CONFIG, Enums, ErrorLog, ExtPaymentsPaymentsTypes, FailedAttemptInfo, FetchAdapter, Fetchers, HttpClientAdapter, HttpRequest, HttpResponse, LocalStorageAdapter, LoggerConfig, MemoryStorageAdapter, NetworkError, PAYMENT_EVENTS, PaginatedPaymentListList, PaginatedPaymentListListSchema, PaymentDetail, PaymentDetailSchema, PaymentEvent, PaymentListSchema, PaymentTab, PaymentsLayout, PaymentsLayoutProps, REFRESH_TOKEN_KEY, RequestLog, ResponseLog, RetryConfig, Schemas, StorageAdapter, TOKEN_KEY, Transaction, TransactionSchema, ValidationErrorDetail, ValidationErrorEvent, apiPayments, clearAPITokens, closePaymentsDialog, configureAPI, createPaymentsPaymentsConfirmCreate, createPaymentsPaymentsCreateCreate, dispatchValidationError, extensionConfig, formatZodError, getAPIInstance, getPaymentsBalanceRetrieve, getPaymentsCurrenciesList, getPaymentsPaymentsList, getPaymentsPaymentsRetrieve, getPaymentsPaymentsStatusRetrieve, getPaymentsTransactionsList, isAPIConfigured, onValidationError, openCreatePaymentDialog, openPaymentDetailsDialog, reconfigureAPI, resetAPI, shouldRetry, withRetry } from './index.js';
3
+ import useSWR from 'swr';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import React, { ReactNode } from 'react';
6
+ import 'consola';
7
+ import 'zod';
8
+ import '@djangocfg/ext-base';
9
+
10
+ /**
11
+ * SWR Hooks for Payments
12
+ *
13
+ * React hooks powered by SWR for data fetching with automatic caching,
14
+ * revalidation, and optimistic updates.
15
+ *
16
+ * Usage:
17
+ * ```typescript
18
+ * // Query hooks (GET)
19
+ * const { data, error, isLoading } = useUsers({ page: 1 })
20
+ *
21
+ * // Mutation hooks (POST/PUT/PATCH/DELETE)
22
+ * const createUser = useCreateUser()
23
+ * await createUser({ name: 'John', email: 'john@example.com' })
24
+ * ```
25
+ */
26
+
27
+ /**
28
+ * Get user balance
29
+ *
30
+ * @method GET
31
+ * @path /cfg/payments/balance/
32
+ */
33
+ declare function usePaymentsBalanceRetrieve(client?: API): ReturnType<typeof useSWR<Balance>>;
34
+ /**
35
+ * Get available currencies
36
+ *
37
+ * @method GET
38
+ * @path /cfg/payments/currencies/
39
+ */
40
+ declare function usePaymentsCurrenciesList(client?: API): ReturnType<typeof useSWR<any>>;
41
+ /**
42
+ * API operation
43
+ *
44
+ * @method GET
45
+ * @path /cfg/payments/payments/
46
+ */
47
+ declare function usePaymentsPaymentsList(params?: {
48
+ page?: number;
49
+ page_size?: number;
50
+ }, client?: API): ReturnType<typeof useSWR<PaginatedPaymentListList>>;
51
+ /**
52
+ * API operation
53
+ *
54
+ * @method GET
55
+ * @path /cfg/payments/payments/{id}/
56
+ */
57
+ declare function usePaymentsPaymentsRetrieve(id: string, client?: API): ReturnType<typeof useSWR<PaymentDetail>>;
58
+ /**
59
+ * API operation
60
+ *
61
+ * @method POST
62
+ * @path /cfg/payments/payments/{id}/confirm/
63
+ */
64
+ declare function useCreatePaymentsPaymentsConfirmCreate(): (id: string, client?: API) => Promise<PaymentList$1>;
65
+ /**
66
+ * API operation
67
+ *
68
+ * @method GET
69
+ * @path /cfg/payments/payments/{id}/status/
70
+ */
71
+ declare function usePaymentsPaymentsStatusRetrieve(id: string, client?: API): ReturnType<typeof useSWR<PaymentList>>;
72
+ /**
73
+ * API operation
74
+ *
75
+ * @method POST
76
+ * @path /cfg/payments/payments/create/
77
+ */
78
+ declare function useCreatePaymentsPaymentsCreateCreate(): (client?: API) => Promise<PaymentList$1>;
79
+ /**
80
+ * Get user transactions
81
+ *
82
+ * @method GET
83
+ * @path /cfg/payments/transactions/
84
+ */
85
+ declare function usePaymentsTransactionsList(params?: {
86
+ limit?: number;
87
+ offset?: number;
88
+ type?: string;
89
+ }, client?: API): ReturnType<typeof useSWR<any>>;
90
+
91
+ /**
92
+ * Payments Types
93
+ * Centralized type definitions for payments contexts
94
+ */
95
+
96
+ type PaginatedPaymentListList = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsList>>['data']>;
97
+ type PaymentDetail = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsRetrieve>>['data']>;
98
+ type PaymentList = NonNullable<Awaited<ReturnType<typeof usePaymentsPaymentsList>>['data']> extends {
99
+ results: infer T;
100
+ } ? T extends Array<infer U> ? U : never : never;
101
+
102
+ interface PaymentsContextValue {
103
+ payments: PaginatedPaymentListList | undefined;
104
+ isLoadingPayments: boolean;
105
+ paymentsError: Error | undefined;
106
+ refreshPayments: () => Promise<void>;
107
+ getPayment: (id: string) => Promise<PaymentDetail | undefined>;
108
+ createPayment: () => Promise<PaymentList>;
109
+ confirmPayment: (id: string) => Promise<PaymentList>;
110
+ checkPaymentStatus: (id: string) => Promise<PaymentList | undefined>;
111
+ }
112
+ declare function PaymentsProvider({ children }: {
113
+ children: ReactNode;
114
+ }): react_jsx_runtime.JSX.Element;
115
+ declare function usePaymentsContext(): PaymentsContextValue;
116
+
117
+ interface BalancesContextValue {
118
+ balance: any | undefined;
119
+ isLoadingBalance: boolean;
120
+ balanceError: Error | undefined;
121
+ refreshBalance: () => Promise<void>;
122
+ }
123
+ declare function BalancesProvider({ children }: {
124
+ children: ReactNode;
125
+ }): react_jsx_runtime.JSX.Element;
126
+ declare function useBalancesContext(): BalancesContextValue;
127
+
128
+ interface CurrenciesContextValue {
129
+ currencies: any | undefined;
130
+ isLoadingCurrencies: boolean;
131
+ currenciesError: Error | undefined;
132
+ refreshCurrencies: () => Promise<void>;
133
+ }
134
+ declare function CurrenciesProvider({ children }: {
135
+ children: ReactNode;
136
+ }): react_jsx_runtime.JSX.Element;
137
+ declare function useCurrenciesContext(): CurrenciesContextValue;
138
+
139
+ interface OverviewContextValue {
140
+ balance: any | undefined;
141
+ isLoadingBalance: boolean;
142
+ balanceError: Error | undefined;
143
+ refreshBalance: () => Promise<void>;
144
+ payments: PaginatedPaymentListList | undefined;
145
+ isLoadingPayments: boolean;
146
+ paymentsError: Error | undefined;
147
+ refreshPayments: () => Promise<void>;
148
+ transactions: any | undefined;
149
+ isLoadingTransactions: boolean;
150
+ transactionsError: Error | undefined;
151
+ refreshTransactions: () => Promise<void>;
152
+ createPayment: () => Promise<PaymentList>;
153
+ isLoadingOverview: boolean;
154
+ overviewError: Error | undefined;
155
+ refreshOverview: () => Promise<void>;
156
+ }
157
+ declare function OverviewProvider({ children }: {
158
+ children: ReactNode;
159
+ }): react_jsx_runtime.JSX.Element;
160
+ declare function useOverviewContext(): OverviewContextValue;
161
+
162
+ interface RootPaymentsContextValue {
163
+ currencies: any | undefined;
164
+ isLoadingCurrencies: boolean;
165
+ currenciesError: Error | undefined;
166
+ refreshCurrencies: () => Promise<void>;
167
+ }
168
+ declare function RootPaymentsProvider({ children }: {
169
+ children: ReactNode;
170
+ }): react_jsx_runtime.JSX.Element;
171
+ declare function useRootPaymentsContext(): RootPaymentsContextValue;
172
+
173
+ /**
174
+ * Create Payment Dialog (v2.0 - Simplified)
175
+ * Dialog for creating new payments
176
+ */
177
+
178
+ declare const CreatePaymentDialog: React.FC;
179
+
180
+ /**
181
+ * Payment Details Dialog (v2.0 - Simplified)
182
+ * Shows payment details with QR code, address, and status
183
+ */
184
+
185
+ declare const PaymentDetailsDialog: React.FC;
186
+
187
+ export { API, type BalancesContextValue, BalancesProvider, CreatePaymentDialog, type CurrenciesContextValue, CurrenciesProvider, type OverviewContextValue, OverviewProvider, PaymentDetailsDialog, PaymentList$1 as PaymentList, type PaymentsContextValue, PaymentsProvider, type RootPaymentsContextValue, RootPaymentsProvider, useBalancesContext, useCreatePaymentsPaymentsConfirmCreate, useCreatePaymentsPaymentsCreateCreate, useCurrenciesContext, useOverviewContext, usePaymentsBalanceRetrieve, usePaymentsContext, usePaymentsCurrenciesList, usePaymentsPaymentsList, usePaymentsPaymentsRetrieve, usePaymentsPaymentsStatusRetrieve, usePaymentsTransactionsList, useRootPaymentsContext };