@smartbills/react-hooks-sdk 0.0.2-alpha.45 → 1.0.1-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 (163) hide show
  1. package/README.md +148 -73
  2. package/dist/cjs/index.cjs +1 -221
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/esm/index.mjs +1 -38
  5. package/dist/esm/index.mjs.map +1 -1
  6. package/dist/types/index.d.ts +594 -0
  7. package/package.json +58 -99
  8. package/dist/@types/index.d.ts +0 -1424
  9. package/dist/@types/index.d.ts.map +0 -1
  10. package/dist/cjs/apis/SBApiKeys.cjs +0 -55
  11. package/dist/cjs/apis/SBApiKeys.cjs.map +0 -1
  12. package/dist/cjs/apis/api-logs/LogsAPI.cjs +0 -42
  13. package/dist/cjs/apis/api-logs/LogsAPI.cjs.map +0 -1
  14. package/dist/cjs/apis/attachments/AttachmentsAPI.cjs +0 -147
  15. package/dist/cjs/apis/attachments/AttachmentsAPI.cjs.map +0 -1
  16. package/dist/cjs/apis/banks/accounts/BankAccountAPI.cjs +0 -88
  17. package/dist/cjs/apis/banks/accounts/BankAccountAPI.cjs.map +0 -1
  18. package/dist/cjs/apis/banks/bank-institutions/BankInstitutionsAPI.cjs +0 -58
  19. package/dist/cjs/apis/banks/bank-institutions/BankInstitutionsAPI.cjs.map +0 -1
  20. package/dist/cjs/apis/banks/bank-transactions/BankTransactionAPI.cjs +0 -57
  21. package/dist/cjs/apis/banks/bank-transactions/BankTransactionAPI.cjs.map +0 -1
  22. package/dist/cjs/apis/business/BusinessAPI.cjs +0 -172
  23. package/dist/cjs/apis/business/BusinessAPI.cjs.map +0 -1
  24. package/dist/cjs/apis/business/customers/CustomerAPI.cjs +0 -161
  25. package/dist/cjs/apis/business/customers/CustomerAPI.cjs.map +0 -1
  26. package/dist/cjs/apis/business/customers/CustomerBalanceTransactionsAPI.cjs +0 -71
  27. package/dist/cjs/apis/business/customers/CustomerBalanceTransactionsAPI.cjs.map +0 -1
  28. package/dist/cjs/apis/business/customers/CustomerPaymentMethodsAPI.cjs +0 -176
  29. package/dist/cjs/apis/business/customers/CustomerPaymentMethodsAPI.cjs.map +0 -1
  30. package/dist/cjs/apis/business/departments/DepartmentApi.cjs +0 -168
  31. package/dist/cjs/apis/business/departments/DepartmentApi.cjs.map +0 -1
  32. package/dist/cjs/apis/business/departments/employees/DepartmentEmployeesAPI.cjs +0 -137
  33. package/dist/cjs/apis/business/departments/employees/DepartmentEmployeesAPI.cjs.map +0 -1
  34. package/dist/cjs/apis/business/fees/FeesAPI.cjs +0 -167
  35. package/dist/cjs/apis/business/fees/FeesAPI.cjs.map +0 -1
  36. package/dist/cjs/apis/business/locations/LocationsAPI.cjs +0 -133
  37. package/dist/cjs/apis/business/locations/LocationsAPI.cjs.map +0 -1
  38. package/dist/cjs/apis/business/products/ProductsAPI.cjs +0 -184
  39. package/dist/cjs/apis/business/products/ProductsAPI.cjs.map +0 -1
  40. package/dist/cjs/apis/business/products/images/ProductImagesAPI.cjs +0 -195
  41. package/dist/cjs/apis/business/products/images/ProductImagesAPI.cjs.map +0 -1
  42. package/dist/cjs/apis/business/products/modifiers/ModifiersAPI.cjs +0 -169
  43. package/dist/cjs/apis/business/products/modifiers/ModifiersAPI.cjs.map +0 -1
  44. package/dist/cjs/apis/business/products/options/ProductOptionsAPI.cjs +0 -183
  45. package/dist/cjs/apis/business/products/options/ProductOptionsAPI.cjs.map +0 -1
  46. package/dist/cjs/apis/business/products/variants/ProductVariantsAPI.cjs +0 -185
  47. package/dist/cjs/apis/business/products/variants/ProductVariantsAPI.cjs.map +0 -1
  48. package/dist/cjs/apis/business/promo-codes/PromoCodesAPI.cjs +0 -139
  49. package/dist/cjs/apis/business/promo-codes/PromoCodesAPI.cjs.map +0 -1
  50. package/dist/cjs/apis/business/reviews/ReviewsAPI.cjs +0 -143
  51. package/dist/cjs/apis/business/reviews/ReviewsAPI.cjs.map +0 -1
  52. package/dist/cjs/apis/business/tables/TablesAPI.cjs +0 -75
  53. package/dist/cjs/apis/business/tables/TablesAPI.cjs.map +0 -1
  54. package/dist/cjs/apis/business/taxes/TaxesAPI.cjs +0 -140
  55. package/dist/cjs/apis/business/taxes/TaxesAPI.cjs.map +0 -1
  56. package/dist/cjs/apis/business/team/TeamMemberInvitationsAPI.cjs +0 -161
  57. package/dist/cjs/apis/business/team/TeamMemberInvitationsAPI.cjs.map +0 -1
  58. package/dist/cjs/apis/business/team/TeamMembersAPI.cjs +0 -93
  59. package/dist/cjs/apis/business/team/TeamMembersAPI.cjs.map +0 -1
  60. package/dist/cjs/apis/business/vendors/VendorsAPI.cjs +0 -239
  61. package/dist/cjs/apis/business/vendors/VendorsAPI.cjs.map +0 -1
  62. package/dist/cjs/apis/documents/DocumentsAPI.cjs +0 -87
  63. package/dist/cjs/apis/documents/DocumentsAPI.cjs.map +0 -1
  64. package/dist/cjs/apis/expenses/ExpensesAPI.cjs +0 -62
  65. package/dist/cjs/apis/expenses/ExpensesAPI.cjs.map +0 -1
  66. package/dist/cjs/apis/friends/FriendsAPI.cjs +0 -150
  67. package/dist/cjs/apis/friends/FriendsAPI.cjs.map +0 -1
  68. package/dist/cjs/apis/integrations/IntegrationsAPI.cjs +0 -55
  69. package/dist/cjs/apis/integrations/IntegrationsAPI.cjs.map +0 -1
  70. package/dist/cjs/apis/invoices/InvoicesAPI.cjs +0 -168
  71. package/dist/cjs/apis/invoices/InvoicesAPI.cjs.map +0 -1
  72. package/dist/cjs/apis/loyalty/LoyaltyProgramAPI.cjs +0 -484
  73. package/dist/cjs/apis/loyalty/LoyaltyProgramAPI.cjs.map +0 -1
  74. package/dist/cjs/apis/notifications/NotificationAPI.cjs +0 -103
  75. package/dist/cjs/apis/notifications/NotificationAPI.cjs.map +0 -1
  76. package/dist/cjs/apis/payment-methods/PaymentMethodsAPI.cjs +0 -125
  77. package/dist/cjs/apis/payment-methods/PaymentMethodsAPI.cjs.map +0 -1
  78. package/dist/cjs/apis/receipts/ReceiptAPI.cjs +0 -135
  79. package/dist/cjs/apis/receipts/ReceiptAPI.cjs.map +0 -1
  80. package/dist/cjs/apis/user/UserAPI.cjs +0 -130
  81. package/dist/cjs/apis/user/UserAPI.cjs.map +0 -1
  82. package/dist/cjs/apis/vendors/VendorsAPI.cjs +0 -171
  83. package/dist/cjs/apis/vendors/VendorsAPI.cjs.map +0 -1
  84. package/dist/cjs/context/ApiContext.cjs +0 -94
  85. package/dist/cjs/context/ApiContext.cjs.map +0 -1
  86. package/dist/esm/apis/SBApiKeys.mjs +0 -55
  87. package/dist/esm/apis/SBApiKeys.mjs.map +0 -1
  88. package/dist/esm/apis/api-logs/LogsAPI.mjs +0 -39
  89. package/dist/esm/apis/api-logs/LogsAPI.mjs.map +0 -1
  90. package/dist/esm/apis/attachments/AttachmentsAPI.mjs +0 -142
  91. package/dist/esm/apis/attachments/AttachmentsAPI.mjs.map +0 -1
  92. package/dist/esm/apis/banks/accounts/BankAccountAPI.mjs +0 -84
  93. package/dist/esm/apis/banks/accounts/BankAccountAPI.mjs.map +0 -1
  94. package/dist/esm/apis/banks/bank-institutions/BankInstitutionsAPI.mjs +0 -55
  95. package/dist/esm/apis/banks/bank-institutions/BankInstitutionsAPI.mjs.map +0 -1
  96. package/dist/esm/apis/banks/bank-transactions/BankTransactionAPI.mjs +0 -54
  97. package/dist/esm/apis/banks/bank-transactions/BankTransactionAPI.mjs.map +0 -1
  98. package/dist/esm/apis/business/BusinessAPI.mjs +0 -165
  99. package/dist/esm/apis/business/BusinessAPI.mjs.map +0 -1
  100. package/dist/esm/apis/business/customers/CustomerAPI.mjs +0 -155
  101. package/dist/esm/apis/business/customers/CustomerAPI.mjs.map +0 -1
  102. package/dist/esm/apis/business/customers/CustomerBalanceTransactionsAPI.mjs +0 -68
  103. package/dist/esm/apis/business/customers/CustomerBalanceTransactionsAPI.mjs.map +0 -1
  104. package/dist/esm/apis/business/customers/CustomerPaymentMethodsAPI.mjs +0 -170
  105. package/dist/esm/apis/business/customers/CustomerPaymentMethodsAPI.mjs.map +0 -1
  106. package/dist/esm/apis/business/departments/DepartmentApi.mjs +0 -161
  107. package/dist/esm/apis/business/departments/DepartmentApi.mjs.map +0 -1
  108. package/dist/esm/apis/business/departments/employees/DepartmentEmployeesAPI.mjs +0 -132
  109. package/dist/esm/apis/business/departments/employees/DepartmentEmployeesAPI.mjs.map +0 -1
  110. package/dist/esm/apis/business/fees/FeesAPI.mjs +0 -161
  111. package/dist/esm/apis/business/fees/FeesAPI.mjs.map +0 -1
  112. package/dist/esm/apis/business/locations/LocationsAPI.mjs +0 -127
  113. package/dist/esm/apis/business/locations/LocationsAPI.mjs.map +0 -1
  114. package/dist/esm/apis/business/products/ProductsAPI.mjs +0 -177
  115. package/dist/esm/apis/business/products/ProductsAPI.mjs.map +0 -1
  116. package/dist/esm/apis/business/products/images/ProductImagesAPI.mjs +0 -188
  117. package/dist/esm/apis/business/products/images/ProductImagesAPI.mjs.map +0 -1
  118. package/dist/esm/apis/business/products/modifiers/ModifiersAPI.mjs +0 -163
  119. package/dist/esm/apis/business/products/modifiers/ModifiersAPI.mjs.map +0 -1
  120. package/dist/esm/apis/business/products/options/ProductOptionsAPI.mjs +0 -177
  121. package/dist/esm/apis/business/products/options/ProductOptionsAPI.mjs.map +0 -1
  122. package/dist/esm/apis/business/products/variants/ProductVariantsAPI.mjs +0 -179
  123. package/dist/esm/apis/business/products/variants/ProductVariantsAPI.mjs.map +0 -1
  124. package/dist/esm/apis/business/promo-codes/PromoCodesAPI.mjs +0 -133
  125. package/dist/esm/apis/business/promo-codes/PromoCodesAPI.mjs.map +0 -1
  126. package/dist/esm/apis/business/reviews/ReviewsAPI.mjs +0 -137
  127. package/dist/esm/apis/business/reviews/ReviewsAPI.mjs.map +0 -1
  128. package/dist/esm/apis/business/tables/TablesAPI.mjs +0 -70
  129. package/dist/esm/apis/business/tables/TablesAPI.mjs.map +0 -1
  130. package/dist/esm/apis/business/taxes/TaxesAPI.mjs +0 -134
  131. package/dist/esm/apis/business/taxes/TaxesAPI.mjs.map +0 -1
  132. package/dist/esm/apis/business/team/TeamMemberInvitationsAPI.mjs +0 -153
  133. package/dist/esm/apis/business/team/TeamMemberInvitationsAPI.mjs.map +0 -1
  134. package/dist/esm/apis/business/team/TeamMembersAPI.mjs +0 -88
  135. package/dist/esm/apis/business/team/TeamMembersAPI.mjs.map +0 -1
  136. package/dist/esm/apis/business/vendors/VendorsAPI.mjs +0 -230
  137. package/dist/esm/apis/business/vendors/VendorsAPI.mjs.map +0 -1
  138. package/dist/esm/apis/documents/DocumentsAPI.mjs +0 -82
  139. package/dist/esm/apis/documents/DocumentsAPI.mjs.map +0 -1
  140. package/dist/esm/apis/expenses/ExpensesAPI.mjs +0 -58
  141. package/dist/esm/apis/expenses/ExpensesAPI.mjs.map +0 -1
  142. package/dist/esm/apis/friends/FriendsAPI.mjs +0 -144
  143. package/dist/esm/apis/friends/FriendsAPI.mjs.map +0 -1
  144. package/dist/esm/apis/integrations/IntegrationsAPI.mjs +0 -52
  145. package/dist/esm/apis/integrations/IntegrationsAPI.mjs.map +0 -1
  146. package/dist/esm/apis/invoices/InvoicesAPI.mjs +0 -161
  147. package/dist/esm/apis/invoices/InvoicesAPI.mjs.map +0 -1
  148. package/dist/esm/apis/loyalty/LoyaltyProgramAPI.mjs +0 -482
  149. package/dist/esm/apis/loyalty/LoyaltyProgramAPI.mjs.map +0 -1
  150. package/dist/esm/apis/notifications/NotificationAPI.mjs +0 -98
  151. package/dist/esm/apis/notifications/NotificationAPI.mjs.map +0 -1
  152. package/dist/esm/apis/payment-methods/PaymentMethodsAPI.mjs +0 -117
  153. package/dist/esm/apis/payment-methods/PaymentMethodsAPI.mjs.map +0 -1
  154. package/dist/esm/apis/receipts/ReceiptAPI.mjs +0 -129
  155. package/dist/esm/apis/receipts/ReceiptAPI.mjs.map +0 -1
  156. package/dist/esm/apis/user/UserAPI.mjs +0 -123
  157. package/dist/esm/apis/user/UserAPI.mjs.map +0 -1
  158. package/dist/esm/apis/vendors/VendorsAPI.mjs +0 -162
  159. package/dist/esm/apis/vendors/VendorsAPI.mjs.map +0 -1
  160. package/dist/esm/context/ApiContext.mjs +0 -86
  161. package/dist/esm/context/ApiContext.mjs.map +0 -1
  162. package/dist/umd/index.js +0 -5056
  163. package/dist/umd/index.js.map +0 -1
@@ -1,484 +0,0 @@
1
- 'use strict';
2
-
3
- // import {
4
- // useQuery,
5
- // useInfiniteQuery,
6
- // useMutation,
7
- // useQueryClient,
8
- // QueryKey,
9
- // } from "@tanstack/react-query";
10
- // import {
11
- // LoyaltyProgramCreateRequest,
12
- // LoyaltyProgramUpdateRequest,
13
- // LoyaltyProgramListRequest,
14
- // SBLoyaltyProgramResponse,
15
- // LoyaltyAccountCreateRequest,
16
- // LoyaltyAccountUpdateRequest,
17
- // SBLoyaltyProgramAccountResponse,
18
- // LoyaltyProgramPointsAccumulateRequest,
19
- // LoyaltyProgramPointsAdjustRequest,
20
- // SBLoyaltyProgramPointResponse,
21
- // LoyaltyRewardCreateRequest,
22
- // SBLoyaltyRewardResponse,
23
- // LoyaltyRewardRedeemRequest,
24
- // SBList,
25
- // SBRequestOptions,
26
- // SBApiException,
27
- // } from "@smartbills/sdk";
28
- // import { useApiClient } from "@/context";
29
- // import { AxiosRequestConfig } from "axios";
30
- // /**
31
- // * Hook for retrieving a loyalty program by ID
32
- // * @param programId - The ID of the loyalty program to retrieve
33
- // * @returns Query result containing the loyalty program data, loading state, and error information
34
- // */
35
- // export function useGetLoyaltyProgramByIdQuery(
36
- // programId: number,
37
- // options?: SBRequestOptions,
38
- // config?: AxiosRequestConfig,
39
- // ) {
40
- // const client = useApiClient();
41
- // const queryClient = useQueryClient();
42
- // return useQuery({
43
- // queryKey: ["loyaltyProgram", programId],
44
- // queryFn: async () => {
45
- // return client.loyaltyPrograms.getByIdAsync(programId, options, config);
46
- // },
47
- // });
48
- // }
49
- // /**
50
- // * Hook for listing loyalty programs with infinite pagination
51
- // * @param request - Request parameters for listing loyalty programs
52
- // * @returns Infinite query result for implementing infinite scrolling with loyalty programs data
53
- // */
54
- // export function useListLoyaltyProgramsInfiniteQuery(
55
- // request: LoyaltyProgramListRequest,
56
- // options?: SBRequestOptions,
57
- // config?: AxiosRequestConfig,
58
- // ) {
59
- // const client = useApiClient();
60
- // const queryClient = useQueryClient();
61
- // return useInfiniteQuery<
62
- // SBList<SBLoyaltyProgramResponse>,
63
- // SBApiException,
64
- // SBList<SBLoyaltyProgramResponse>,
65
- // QueryKey,
66
- // number
67
- // >({
68
- // initialPageParam: request.page || 1,
69
- // queryKey: ["loyaltyPrograms", request, options],
70
- // queryFn: async ({ pageParam = 1 }) => {
71
- // const paginatedRequest = { ...request, page: pageParam };
72
- // return client.loyaltyPrograms.listAsync(
73
- // paginatedRequest,
74
- // options,
75
- // config,
76
- // );
77
- // },
78
- // getNextPageParam: (lastPage) => {
79
- // if (
80
- // lastPage.pagination &&
81
- // lastPage.pagination.currentPage < lastPage.pagination.pageCount
82
- // ) {
83
- // return lastPage.pagination.currentPage + 1;
84
- // }
85
- // return undefined;
86
- // },
87
- // });
88
- // }
89
- // /**
90
- // * Hook for creating a new loyalty program
91
- // * @returns Mutation function and state for creating loyalty programs
92
- // */
93
- // export function useCreateLoyaltyProgramMutation() {
94
- // // const queryClient = useQueryClient();
95
- // const client = useApiClient();
96
- // const queryClient = useQueryClient();
97
- // return useMutation({
98
- // mutationFn: async ({
99
- // data,
100
- // options,
101
- // config,
102
- // }: {
103
- // data: LoyaltyProgramCreateRequest;
104
- // options?: SBRequestOptions;
105
- // config?: AxiosRequestConfig;
106
- // }) => {
107
- // return client.loyaltyPrograms.createAsync(data, options, config);
108
- // },
109
- // onSuccess: () => {
110
- // queryClient.invalidateQueries({ queryKey: ["loyaltyPrograms"] });
111
- // },
112
- // });
113
- // }
114
- // /**
115
- // * Hook for updating a loyalty program
116
- // * @returns Mutation function and state for updating loyalty programs
117
- // */
118
- // export function useUpdateLoyaltyProgramMutation() {
119
- // // const queryClient = useQueryClient();
120
- // const client = useApiClient();
121
- // const queryClient = useQueryClient();
122
- // return useMutation({
123
- // mutationFn: async ({
124
- // programId,
125
- // data,
126
- // options,
127
- // config,
128
- // }: {
129
- // programId: number;
130
- // data: LoyaltyProgramUpdateRequest;
131
- // options?: SBRequestOptions;
132
- // config?: AxiosRequestConfig;
133
- // }) => {
134
- // return client.loyaltyPrograms.updateAsync(
135
- // programId,
136
- // data,
137
- // options,
138
- // config,
139
- // );
140
- // },
141
- // onSuccess: (_, variables) => {
142
- // queryClient.invalidateQueries({ queryKey: ["loyaltyPrograms"] });
143
- // queryClient.invalidateQueries({
144
- // queryKey: ["loyaltyProgram", variables.programId],
145
- // });
146
- // },
147
- // });
148
- // }
149
- // /**
150
- // * Hook for deleting a loyalty program
151
- // * @returns Mutation function and state for deleting loyalty programs
152
- // */
153
- // export function useDeleteLoyaltyProgramMutation() {
154
- // // const queryClient = useQueryClient();
155
- // const client = useApiClient();
156
- // const queryClient = useQueryClient();
157
- // return useMutation({
158
- // mutationFn: async ({
159
- // programId,
160
- // options,
161
- // config,
162
- // }: {
163
- // programId: number;
164
- // options?: SBRequestOptions;
165
- // config?: AxiosRequestConfig;
166
- // }) => {
167
- // return client.loyaltyPrograms.deleteAsync(programId, options, config);
168
- // },
169
- // onSuccess: () => {
170
- // queryClient.invalidateQueries({ queryKey: ["loyaltyPrograms"] });
171
- // },
172
- // });
173
- // }
174
- // /**
175
- // * Hook for retrieving a loyalty program account
176
- // * @param programId - The ID of the loyalty program
177
- // * @param accountId - The ID of the account to retrieve
178
- // * @returns Query result containing the loyalty account data, loading state, and error information
179
- // */
180
- // export function useGetLoyaltyProgramAccountQuery(
181
- // programId: number,
182
- // accountId: number,
183
- // options?: SBRequestOptions,
184
- // config?: AxiosRequestConfig,
185
- // ) {
186
- // const client = useApiClient();
187
- // const queryClient = useQueryClient();
188
- // return useQuery({
189
- // queryKey: ["loyaltyProgramAccount", programId, accountId],
190
- // queryFn: async () => {
191
- // return client.loyaltyPrograms.getAccount(
192
- // programId,
193
- // accountId,
194
- // options,
195
- // config,
196
- // );
197
- // },
198
- // });
199
- // }
200
- // /**
201
- // * Hook for listing loyalty program accounts with infinite pagination
202
- // * @param programId - The ID of the loyalty program
203
- // * @param request - Request parameters for listing accounts
204
- // * @returns Infinite query result for implementing infinite scrolling with loyalty accounts data
205
- // */
206
- // export function useListLoyaltyProgramAccountsInfiniteQuery(
207
- // programId: number,
208
- // request: LoyaltyProgramListRequest,
209
- // options?: SBRequestOptions,
210
- // config?: AxiosRequestConfig,
211
- // ) {
212
- // const client = useApiClient();
213
- // const queryClient = useQueryClient();
214
- // return useInfiniteQuery<
215
- // SBList<SBLoyaltyProgramAccountResponse>,
216
- // SBApiException,
217
- // SBList<SBLoyaltyProgramAccountResponse>,
218
- // QueryKey,
219
- // number
220
- // >({
221
- // initialPageParam: request.page || 1,
222
- // queryKey: ["loyaltyProgramAccounts", programId, request, options],
223
- // queryFn: async ({ pageParam = 1 }) => {
224
- // const paginatedRequest = { ...request, page: pageParam };
225
- // return client.loyaltyPrograms.listAccounts(
226
- // programId,
227
- // paginatedRequest,
228
- // options,
229
- // config,
230
- // );
231
- // },
232
- // getNextPageParam: (lastPage) => {
233
- // if (
234
- // lastPage.pagination &&
235
- // lastPage.pagination.currentPage < lastPage.pagination.pageCount
236
- // ) {
237
- // return lastPage.pagination.currentPage + 1;
238
- // }
239
- // return undefined;
240
- // },
241
- // });
242
- // }
243
- // /**
244
- // * Hook for creating a loyalty program account
245
- // * @returns Mutation function and state for creating loyalty accounts
246
- // */
247
- // export function useCreateLoyaltyProgramAccountMutation() {
248
- // // const queryClient = useQueryClient();
249
- // const client = useApiClient();
250
- // const queryClient = useQueryClient();
251
- // return useMutation({
252
- // mutationFn: async ({
253
- // programId,
254
- // data,
255
- // options,
256
- // config,
257
- // }: {
258
- // programId: number;
259
- // data: LoyaltyAccountCreateRequest;
260
- // options?: SBRequestOptions;
261
- // config?: AxiosRequestConfig;
262
- // }) => {
263
- // return client.loyaltyPrograms.createAccount(
264
- // programId,
265
- // data,
266
- // options,
267
- // config,
268
- // );
269
- // },
270
- // onSuccess: (_, variables) => {
271
- // queryClient.invalidateQueries({
272
- // queryKey: ["loyaltyProgramAccounts", variables.programId],
273
- // });
274
- // },
275
- // });
276
- // }
277
- // /**
278
- // * Hook for deleting a loyalty program account
279
- // * @returns Mutation function and state for deleting loyalty accounts
280
- // */
281
- // export function useDeleteLoyaltyProgramAccountMutation() {
282
- // // const queryClient = useQueryClient();
283
- // const client = useApiClient();
284
- // const queryClient = useQueryClient();
285
- // return useMutation({
286
- // mutationFn: async ({
287
- // programId,
288
- // accountId,
289
- // options,
290
- // config,
291
- // }: {
292
- // programId: number;
293
- // accountId: number;
294
- // options?: SBRequestOptions;
295
- // config?: AxiosRequestConfig;
296
- // }) => {
297
- // return client.loyaltyPrograms.deleteAccount(
298
- // programId,
299
- // accountId,
300
- // options,
301
- // config,
302
- // );
303
- // },
304
- // onSuccess: (_, variables) => {
305
- // queryClient.invalidateQueries({
306
- // queryKey: ["loyaltyProgramAccounts", variables.programId],
307
- // });
308
- // queryClient.invalidateQueries({
309
- // queryKey: [
310
- // "loyaltyProgramAccount",
311
- // variables.programId,
312
- // variables.accountId,
313
- // ],
314
- // });
315
- // },
316
- // });
317
- // }
318
- // /**
319
- // * Hook for accumulating points in a loyalty program
320
- // * @returns Mutation function and state for accumulating loyalty points
321
- // */
322
- // export function useAccumulateLoyaltyPointsMutation() {
323
- // // const queryClient = useQueryClient();
324
- // const client = useApiClient();
325
- // const queryClient = useQueryClient();
326
- // return useMutation({
327
- // mutationFn: async ({
328
- // data,
329
- // options,
330
- // config,
331
- // }: {
332
- // data: LoyaltyProgramPointsAccumulateRequest;
333
- // options?: SBRequestOptions;
334
- // config?: AxiosRequestConfig;
335
- // }) => {
336
- // return client.loyaltyPrograms.accumulatePoints(
337
- // data,
338
- // options,
339
- // config,
340
- // );
341
- // },
342
- // onSuccess: () => {
343
- // queryClient.invalidateQueries({
344
- // queryKey: ["loyaltyProgramAccounts"],
345
- // });
346
- // },
347
- // });
348
- // }
349
- // /**
350
- // * Hook for adjusting points in a loyalty program
351
- // * @returns Mutation function and state for adjusting loyalty points
352
- // */
353
- // export function useAdjustLoyaltyPointsMutation() {
354
- // // const queryClient = useQueryClient();
355
- // const client = useApiClient();
356
- // const queryClient = useQueryClient();
357
- // return useMutation({
358
- // mutationFn: async ({
359
- // data,
360
- // options,
361
- // config,
362
- // }: {
363
- // data: LoyaltyProgramPointsAdjustRequest;
364
- // options?: SBRequestOptions;
365
- // config?: AxiosRequestConfig;
366
- // }) => {
367
- // return client.loyaltyPrograms.adjustPoints(data, options, config);
368
- // },
369
- // onSuccess: () => {
370
- // queryClient.invalidateQueries({
371
- // queryKey: ["loyaltyProgramAccounts"],
372
- // });
373
- // },
374
- // });
375
- // }
376
- // /**
377
- // * Hook for issuing points in a loyalty program
378
- // * @returns Mutation function and state for issuing loyalty points
379
- // */
380
- // export function useIssueLoyaltyPointsMutation() {
381
- // // const queryClient = useQueryClient();
382
- // const client = useApiClient();
383
- // const queryClient = useQueryClient();
384
- // return useMutation({
385
- // mutationFn: async ({
386
- // data,
387
- // options,
388
- // config,
389
- // }: {
390
- // data: LoyaltyProgramPointsAccumulateRequest;
391
- // options?: SBRequestOptions;
392
- // config?: AxiosRequestConfig;
393
- // }) => {
394
- // return client.loyaltyPrograms.issuePoints(data, options, config);
395
- // },
396
- // onSuccess: () => {
397
- // queryClient.invalidateQueries({
398
- // queryKey: ["loyaltyProgramAccounts"],
399
- // });
400
- // },
401
- // });
402
- // }
403
- // /**
404
- // * Hook for creating a loyalty reward
405
- // * @returns Mutation function and state for creating loyalty rewards
406
- // */
407
- // export function useCreateLoyaltyRewardMutation() {
408
- // // const queryClient = useQueryClient();
409
- // const client = useApiClient();
410
- // const queryClient = useQueryClient();
411
- // return useMutation({
412
- // mutationFn: async ({
413
- // data,
414
- // options,
415
- // config,
416
- // }: {
417
- // data: LoyaltyRewardCreateRequest;
418
- // options?: SBRequestOptions;
419
- // config?: AxiosRequestConfig;
420
- // }) => {
421
- // return client.loyaltyPrograms.createReward(data, options, config);
422
- // },
423
- // onSuccess: () => {
424
- // queryClient.invalidateQueries({ queryKey: ["loyaltyPrograms"] });
425
- // },
426
- // });
427
- // }
428
- // /**
429
- // * Hook for retrieving a loyalty reward
430
- // * @param rewardId - The ID of the reward to retrieve
431
- // * @returns Query result containing the loyalty reward data, loading state, and error information
432
- // */
433
- // export function useGetLoyaltyRewardQuery(
434
- // rewardId: number,
435
- // options?: SBRequestOptions,
436
- // config?: AxiosRequestConfig,
437
- // ) {
438
- // const client = useApiClient();
439
- // const queryClient = useQueryClient();
440
- // return useQuery({
441
- // queryKey: ["loyaltyReward", rewardId],
442
- // queryFn: async () => {
443
- // return client.loyaltyPrograms.getReward(rewardId, options, config);
444
- // },
445
- // });
446
- // }
447
- // /**
448
- // * Hook for redeeming a loyalty reward
449
- // * @returns Mutation function and state for redeeming loyalty rewards
450
- // */
451
- // export function useRedeemLoyaltyRewardMutation() {
452
- // // const queryClient = useQueryClient();
453
- // const client = useApiClient();
454
- // const queryClient = useQueryClient();
455
- // return useMutation({
456
- // mutationFn: async ({
457
- // rewardId,
458
- // data,
459
- // options,
460
- // config,
461
- // }: {
462
- // rewardId: number;
463
- // data: LoyaltyRewardRedeemRequest;
464
- // options?: SBRequestOptions;
465
- // config?: AxiosRequestConfig;
466
- // }) => {
467
- // return client.loyaltyPrograms.redeemReward(
468
- // rewardId,
469
- // data,
470
- // options,
471
- // config,
472
- // );
473
- // },
474
- // onSuccess: () => {
475
- // queryClient.invalidateQueries({
476
- // queryKey: ["loyaltyProgramAccounts"],
477
- // });
478
- // },
479
- // });
480
- // }
481
- const loyalty = "";
482
-
483
- exports.loyalty = loyalty;
484
- //# sourceMappingURL=LoyaltyProgramAPI.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoyaltyProgramAPI.cjs","sources":["../../../../src/apis/loyalty/LoyaltyProgramAPI.ts"],"sourcesContent":["// import {\n// \tuseQuery,\n// \tuseInfiniteQuery,\n// \tuseMutation,\n// \tuseQueryClient,\n// \tQueryKey,\n// } from \"@tanstack/react-query\";\n// import {\n// \tLoyaltyProgramCreateRequest,\n// \tLoyaltyProgramUpdateRequest,\n// \tLoyaltyProgramListRequest,\n// \tSBLoyaltyProgramResponse,\n// \tLoyaltyAccountCreateRequest,\n// \tLoyaltyAccountUpdateRequest,\n// \tSBLoyaltyProgramAccountResponse,\n// \tLoyaltyProgramPointsAccumulateRequest,\n// \tLoyaltyProgramPointsAdjustRequest,\n// \tSBLoyaltyProgramPointResponse,\n// \tLoyaltyRewardCreateRequest,\n// \tSBLoyaltyRewardResponse,\n// \tLoyaltyRewardRedeemRequest,\n// \tSBList,\n// \tSBRequestOptions,\n// \tSBApiException,\n// } from \"@smartbills/sdk\";\n// import { useApiClient } from \"@/context\";\n// import { AxiosRequestConfig } from \"axios\";\n\n// /**\n// * Hook for retrieving a loyalty program by ID\n// * @param programId - The ID of the loyalty program to retrieve\n// * @returns Query result containing the loyalty program data, loading state, and error information\n// */\n// export function useGetLoyaltyProgramByIdQuery(\n// \tprogramId: number,\n// \toptions?: SBRequestOptions,\n// \tconfig?: AxiosRequestConfig,\n// ) {\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n// \treturn useQuery({\n// \t\tqueryKey: [\"loyaltyProgram\", programId],\n// \t\tqueryFn: async () => {\n// \t\t\treturn client.loyaltyPrograms.getByIdAsync(programId, options, config);\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for listing loyalty programs with infinite pagination\n// * @param request - Request parameters for listing loyalty programs\n// * @returns Infinite query result for implementing infinite scrolling with loyalty programs data\n// */\n// export function useListLoyaltyProgramsInfiniteQuery(\n// \trequest: LoyaltyProgramListRequest,\n// \toptions?: SBRequestOptions,\n// \tconfig?: AxiosRequestConfig,\n// ) {\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n// \treturn useInfiniteQuery<\n// \t\tSBList<SBLoyaltyProgramResponse>,\n// \t\tSBApiException,\n// \t\tSBList<SBLoyaltyProgramResponse>,\n// \t\tQueryKey,\n// \t\tnumber\n// \t>({\n// \t\tinitialPageParam: request.page || 1,\n// \t\tqueryKey: [\"loyaltyPrograms\", request, options],\n// \t\tqueryFn: async ({ pageParam = 1 }) => {\n// \t\t\tconst paginatedRequest = { ...request, page: pageParam };\n// \t\t\treturn client.loyaltyPrograms.listAsync(\n// \t\t\t\tpaginatedRequest,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tgetNextPageParam: (lastPage) => {\n// \t\t\tif (\n// \t\t\t\tlastPage.pagination &&\n// \t\t\t\tlastPage.pagination.currentPage < lastPage.pagination.pageCount\n// \t\t\t) {\n// \t\t\t\treturn lastPage.pagination.currentPage + 1;\n// \t\t\t}\n// \t\t\treturn undefined;\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for creating a new loyalty program\n// * @returns Mutation function and state for creating loyalty programs\n// */\n// export function useCreateLoyaltyProgramMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tdata: LoyaltyProgramCreateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.createAsync(data, options, config);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({ queryKey: [\"loyaltyPrograms\"] });\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for updating a loyalty program\n// * @returns Mutation function and state for updating loyalty programs\n// */\n// export function useUpdateLoyaltyProgramMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tprogramId,\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tprogramId: number;\n// \t\t\tdata: LoyaltyProgramUpdateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.updateAsync(\n// \t\t\t\tprogramId,\n// \t\t\t\tdata,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tonSuccess: (_, variables) => {\n// \t\t\tqueryClient.invalidateQueries({ queryKey: [\"loyaltyPrograms\"] });\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgram\", variables.programId],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for deleting a loyalty program\n// * @returns Mutation function and state for deleting loyalty programs\n// */\n// export function useDeleteLoyaltyProgramMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tprogramId,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tprogramId: number;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.deleteAsync(programId, options, config);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({ queryKey: [\"loyaltyPrograms\"] });\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for retrieving a loyalty program account\n// * @param programId - The ID of the loyalty program\n// * @param accountId - The ID of the account to retrieve\n// * @returns Query result containing the loyalty account data, loading state, and error information\n// */\n// export function useGetLoyaltyProgramAccountQuery(\n// \tprogramId: number,\n// \taccountId: number,\n// \toptions?: SBRequestOptions,\n// \tconfig?: AxiosRequestConfig,\n// ) {\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n// \treturn useQuery({\n// \t\tqueryKey: [\"loyaltyProgramAccount\", programId, accountId],\n// \t\tqueryFn: async () => {\n// \t\t\treturn client.loyaltyPrograms.getAccount(\n// \t\t\t\tprogramId,\n// \t\t\t\taccountId,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for listing loyalty program accounts with infinite pagination\n// * @param programId - The ID of the loyalty program\n// * @param request - Request parameters for listing accounts\n// * @returns Infinite query result for implementing infinite scrolling with loyalty accounts data\n// */\n// export function useListLoyaltyProgramAccountsInfiniteQuery(\n// \tprogramId: number,\n// \trequest: LoyaltyProgramListRequest,\n// \toptions?: SBRequestOptions,\n// \tconfig?: AxiosRequestConfig,\n// ) {\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n// \treturn useInfiniteQuery<\n// \t\tSBList<SBLoyaltyProgramAccountResponse>,\n// \t\tSBApiException,\n// \t\tSBList<SBLoyaltyProgramAccountResponse>,\n// \t\tQueryKey,\n// \t\tnumber\n// \t>({\n// \t\tinitialPageParam: request.page || 1,\n// \t\tqueryKey: [\"loyaltyProgramAccounts\", programId, request, options],\n// \t\tqueryFn: async ({ pageParam = 1 }) => {\n// \t\t\tconst paginatedRequest = { ...request, page: pageParam };\n// \t\t\treturn client.loyaltyPrograms.listAccounts(\n// \t\t\t\tprogramId,\n// \t\t\t\tpaginatedRequest,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tgetNextPageParam: (lastPage) => {\n// \t\t\tif (\n// \t\t\t\tlastPage.pagination &&\n// \t\t\t\tlastPage.pagination.currentPage < lastPage.pagination.pageCount\n// \t\t\t) {\n// \t\t\t\treturn lastPage.pagination.currentPage + 1;\n// \t\t\t}\n// \t\t\treturn undefined;\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for creating a loyalty program account\n// * @returns Mutation function and state for creating loyalty accounts\n// */\n// export function useCreateLoyaltyProgramAccountMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tprogramId,\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tprogramId: number;\n// \t\t\tdata: LoyaltyAccountCreateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.createAccount(\n// \t\t\t\tprogramId,\n// \t\t\t\tdata,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tonSuccess: (_, variables) => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\", variables.programId],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for deleting a loyalty program account\n// * @returns Mutation function and state for deleting loyalty accounts\n// */\n// export function useDeleteLoyaltyProgramAccountMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tprogramId,\n// \t\t\taccountId,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tprogramId: number;\n// \t\t\taccountId: number;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.deleteAccount(\n// \t\t\t\tprogramId,\n// \t\t\t\taccountId,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tonSuccess: (_, variables) => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\", variables.programId],\n// \t\t\t});\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\n// \t\t\t\t\t\"loyaltyProgramAccount\",\n// \t\t\t\t\tvariables.programId,\n// \t\t\t\t\tvariables.accountId,\n// \t\t\t\t],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for accumulating points in a loyalty program\n// * @returns Mutation function and state for accumulating loyalty points\n// */\n// export function useAccumulateLoyaltyPointsMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tdata: LoyaltyProgramPointsAccumulateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.accumulatePoints(\n// \t\t\t\tdata,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\"],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for adjusting points in a loyalty program\n// * @returns Mutation function and state for adjusting loyalty points\n// */\n// export function useAdjustLoyaltyPointsMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tdata: LoyaltyProgramPointsAdjustRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.adjustPoints(data, options, config);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\"],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for issuing points in a loyalty program\n// * @returns Mutation function and state for issuing loyalty points\n// */\n// export function useIssueLoyaltyPointsMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tdata: LoyaltyProgramPointsAccumulateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.issuePoints(data, options, config);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\"],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for creating a loyalty reward\n// * @returns Mutation function and state for creating loyalty rewards\n// */\n// export function useCreateLoyaltyRewardMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\tdata: LoyaltyRewardCreateRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.createReward(data, options, config);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({ queryKey: [\"loyaltyPrograms\"] });\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for retrieving a loyalty reward\n// * @param rewardId - The ID of the reward to retrieve\n// * @returns Query result containing the loyalty reward data, loading state, and error information\n// */\n// export function useGetLoyaltyRewardQuery(\n// \trewardId: number,\n// \toptions?: SBRequestOptions,\n// \tconfig?: AxiosRequestConfig,\n// ) {\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n// \treturn useQuery({\n// \t\tqueryKey: [\"loyaltyReward\", rewardId],\n// \t\tqueryFn: async () => {\n// \t\t\treturn client.loyaltyPrograms.getReward(rewardId, options, config);\n// \t\t},\n// \t});\n// }\n\n// /**\n// * Hook for redeeming a loyalty reward\n// * @returns Mutation function and state for redeeming loyalty rewards\n// */\n// export function useRedeemLoyaltyRewardMutation() {\n// // \tconst queryClient = useQueryClient();\n// \tconst client = useApiClient();\n// const queryClient = useQueryClient();\n\n// \treturn useMutation({\n// \t\tmutationFn: async ({\n// \t\t\trewardId,\n// \t\t\tdata,\n// \t\t\toptions,\n// \t\t\tconfig,\n// \t\t}: {\n// \t\t\trewardId: number;\n// \t\t\tdata: LoyaltyRewardRedeemRequest;\n// \t\t\toptions?: SBRequestOptions;\n// \t\t\tconfig?: AxiosRequestConfig;\n// \t\t}) => {\n// \t\t\treturn client.loyaltyPrograms.redeemReward(\n// \t\t\t\trewardId,\n// \t\t\t\tdata,\n// \t\t\t\toptions,\n// \t\t\t\tconfig,\n// \t\t\t);\n// \t\t},\n// \t\tonSuccess: () => {\n// \t\t\tqueryClient.invalidateQueries({\n// \t\t\t\tqueryKey: [\"loyaltyProgramAccounts\"],\n// \t\t\t});\n// \t\t},\n// \t});\n// }\n\nexport const loyalty = \"\";\n"],"names":["loyalty"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAMA,OAAO,GAAG;;;;"}
@@ -1,103 +0,0 @@
1
- 'use strict';
2
-
3
- var reactQuery = require('@tanstack/react-query');
4
- var SBApiKeys = require('../SBApiKeys.cjs');
5
- var ApiContext = require('../../context/ApiContext.cjs');
6
-
7
- /**
8
- * Hook for retrieving a notification by ID
9
- * @param id - The ID of the notification to retrieve
10
- * @param options - Optional request options including businessId, businessId, and userId
11
- * @param config - Optional Axios request configuration
12
- * @returns Query result containing the notification data, loading state, and error information
13
- */
14
- function useGetNotificationByIdQuery(id, options, config) {
15
- const client = ApiContext.useApiClient();
16
- reactQuery.useQueryClient();
17
- return reactQuery.useQuery({
18
- queryKey: [SBApiKeys.SBApiKeys.Notifications, id, options],
19
- queryFn: async () => {
20
- return client.notifications.getByIdAsync(id, options, config);
21
- }
22
- });
23
- }
24
- /**
25
- * Hook for listing notifications with infinite pagination
26
- * @param options - Optional request options including businessId, businessId, and userId
27
- * @param limit - Number of items per page
28
- * @returns Infinite query result for implementing infinite scrolling with notification data
29
- */
30
- function useListNotificationsInfiniteQuery(request = {
31
- page: 1,
32
- pageSize: 25
33
- }, options, config) {
34
- const client = ApiContext.useApiClient();
35
- reactQuery.useQueryClient();
36
- return reactQuery.useInfiniteQuery({
37
- initialPageParam: request.page || 1,
38
- queryKey: [SBApiKeys.SBApiKeys.Notifications, request, options],
39
- queryFn: async ({
40
- pageParam = 1
41
- }) => {
42
- return client.notifications.listAsync({
43
- ...request,
44
- page: pageParam
45
- }, options, config);
46
- },
47
- getNextPageParam: lastPage => {
48
- if (lastPage.pagination && lastPage.pagination.currentPage < lastPage.pagination.pageCount) {
49
- return lastPage.pagination.currentPage + 1;
50
- }
51
- return undefined;
52
- }
53
- });
54
- }
55
- /**
56
- * Hook for marking notifications as read
57
- * @returns Mutation function and state for marking notifications as read
58
- */
59
- function useMarkNotificationsReadMutation() {
60
- const client = ApiContext.useApiClient();
61
- const queryClient = reactQuery.useQueryClient();
62
- return reactQuery.useMutation({
63
- mutationFn: async ({
64
- id,
65
- options,
66
- config
67
- }) => {
68
- await client.notifications.markAsRead(id, options, config);
69
- },
70
- onSuccess: () => {
71
- queryClient.invalidateQueries({
72
- queryKey: [SBApiKeys.SBApiKeys.Notifications]
73
- });
74
- }
75
- });
76
- }
77
- /**
78
- * Hook for marking all notifications as read
79
- * @returns Mutation function and state for marking all notifications as read
80
- */
81
- function useMarkAllNotificationsReadMutation() {
82
- const client = ApiContext.useApiClient();
83
- const queryClient = reactQuery.useQueryClient();
84
- return reactQuery.useMutation({
85
- mutationFn: async ({
86
- options,
87
- config
88
- }) => {
89
- await client.notifications.markAllAsRead(options, config);
90
- },
91
- onSuccess: () => {
92
- queryClient.invalidateQueries({
93
- queryKey: [SBApiKeys.SBApiKeys.Notifications]
94
- });
95
- }
96
- });
97
- }
98
-
99
- exports.useGetNotificationByIdQuery = useGetNotificationByIdQuery;
100
- exports.useListNotificationsInfiniteQuery = useListNotificationsInfiniteQuery;
101
- exports.useMarkAllNotificationsReadMutation = useMarkAllNotificationsReadMutation;
102
- exports.useMarkNotificationsReadMutation = useMarkNotificationsReadMutation;
103
- //# sourceMappingURL=NotificationAPI.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationAPI.cjs","sources":["../../../../src/apis/notifications/NotificationAPI.ts"],"sourcesContent":["import {\n\tuseQuery,\n\tuseInfiniteQuery,\n\tuseMutation,\n\tQueryKey,\n\tInfiniteData,\n} from \"@tanstack/react-query\";\nimport {\n\tSBList,\n\tSBNotification,\n\tSBRequestOptions,\n\tSBApiException,\n\tListRequest,\n} from \"@smartbills/sdk\";\nimport { AxiosRequestConfig } from \"axios\";\nimport { SBApiKeys } from \"@/apis/SBApiKeys\";\nimport { useApiClient } from \"@/context\";\nimport { useQueryClient } from \"@tanstack/react-query\";\n\n/**\n * Hook for retrieving a notification by ID\n * @param id - The ID of the notification to retrieve\n * @param options - Optional request options including businessId, businessId, and userId\n * @param config - Optional Axios request configuration\n * @returns Query result containing the notification data, loading state, and error information\n */\nexport function useGetNotificationByIdQuery(\n\tid: number,\n\toptions?: SBRequestOptions,\n\tconfig?: AxiosRequestConfig,\n) {\n\tconst client = useApiClient();\n\tconst queryClient = useQueryClient();\n\treturn useQuery<SBNotification, SBApiException>({\n\t\tqueryKey: [SBApiKeys.Notifications, id, options],\n\t\tqueryFn: async () => {\n\t\t\treturn client.notifications.getByIdAsync(id, options, config);\n\t\t},\n\t});\n}\n\n/**\n * Hook for listing notifications with infinite pagination\n * @param options - Optional request options including businessId, businessId, and userId\n * @param limit - Number of items per page\n * @returns Infinite query result for implementing infinite scrolling with notification data\n */\nexport function useListNotificationsInfiniteQuery(\n\trequest: ListRequest = { page: 1, pageSize: 25 },\n\toptions?: SBRequestOptions,\n\tconfig?: AxiosRequestConfig<ListRequest>,\n) {\n\tconst client = useApiClient();\n\tconst queryClient = useQueryClient();\n\treturn useInfiniteQuery<\n\t\tSBList<SBNotification>,\n\t\tSBApiException,\n\t\tInfiniteData<SBList<SBNotification>>,\n\t\tQueryKey,\n\t\tnumber\n\t>({\n\t\tinitialPageParam: request.page || 1,\n\t\tqueryKey: [SBApiKeys.Notifications, request, options],\n\t\tqueryFn: async ({ pageParam = 1 }) => {\n\t\t\treturn client.notifications.listAsync(\n\t\t\t\t{ ...request, page: pageParam },\n\t\t\t\toptions,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t},\n\t\tgetNextPageParam: (lastPage) => {\n\t\t\tif (\n\t\t\t\tlastPage.pagination &&\n\t\t\t\tlastPage.pagination.currentPage < lastPage.pagination.pageCount\n\t\t\t) {\n\t\t\t\treturn lastPage.pagination.currentPage + 1;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t});\n}\n\n/**\n * Hook for marking notifications as read\n * @returns Mutation function and state for marking notifications as read\n */\nexport function useMarkNotificationsReadMutation() {\n\tconst client = useApiClient();\n\tconst queryClient = useQueryClient();\n\n\treturn useMutation<\n\t\tvoid,\n\t\tSBApiException,\n\t\t{\n\t\t\tid: number;\n\t\t\toptions?: SBRequestOptions;\n\t\t\tconfig?: AxiosRequestConfig;\n\t\t}\n\t>({\n\t\tmutationFn: async ({ id, options, config }) => {\n\t\t\tawait client.notifications.markAsRead(id, options, config);\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({\n\t\t\t\tqueryKey: [SBApiKeys.Notifications],\n\t\t\t});\n\t\t},\n\t});\n}\n\n/**\n * Hook for marking all notifications as read\n * @returns Mutation function and state for marking all notifications as read\n */\nexport function useMarkAllNotificationsReadMutation() {\n\tconst client = useApiClient();\n\tconst queryClient = useQueryClient();\n\n\treturn useMutation<\n\t\tvoid,\n\t\tSBApiException,\n\t\t{\n\t\t\toptions?: SBRequestOptions;\n\t\t\tconfig?: AxiosRequestConfig;\n\t\t}\n\t>({\n\t\tmutationFn: async ({ options, config }) => {\n\t\t\tawait client.notifications.markAllAsRead(options, config);\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({\n\t\t\t\tqueryKey: [SBApiKeys.Notifications],\n\t\t\t});\n\t\t},\n\t});\n}\n"],"names":["useGetNotificationByIdQuery","id","options","config","client","useApiClient","useQueryClient","useQuery","queryKey","SBApiKeys","Notifications","queryFn","notifications","getByIdAsync","useListNotificationsInfiniteQuery","request","page","pageSize","useInfiniteQuery","initialPageParam","pageParam","listAsync","getNextPageParam","lastPage","pagination","currentPage","pageCount","undefined","useMarkNotificationsReadMutation","queryClient","useMutation","mutationFn","markAsRead","onSuccess","invalidateQueries","useMarkAllNotificationsReadMutation","markAllAsRead"],"mappings":";;;;;;AAmBA;;;;;;AAMG;SACaA,2BAA2BA,CAC1CC,EAAU,EACVC,OAA0B,EAC1BC,MAA2B,EAAA;AAE3B,EAAA,MAAMC,MAAM,GAAGC,uBAAY,EAAE;AAC7B,EAAoBC,yBAAc;AAClC,EAAA,OAAOC,mBAAQ,CAAiC;IAC/CC,QAAQ,EAAE,CAACC,mBAAS,CAACC,aAAa,EAAET,EAAE,EAAEC,OAAO,CAAC;IAChDS,OAAO,EAAE,YAAW;MACnB,OAAOP,MAAM,CAACQ,aAAa,CAACC,YAAY,CAACZ,EAAE,EAAEC,OAAO,EAAEC,MAAM,CAAC;AAC9D;AACA,GAAA,CAAC;AACH;AAEA;;;;;AAKG;SACaW,iCAAiCA,CAChDC,OAAuB,GAAA;AAAEC,EAAAA,IAAI,EAAE,CAAC;AAAEC,EAAAA,QAAQ,EAAE;AAAE,CAAE,EAChDf,OAA0B,EAC1BC,MAAwC,EAAA;AAExC,EAAA,MAAMC,MAAM,GAAGC,uBAAY,EAAE;AAC7B,EAAoBC,yBAAc;AAClC,EAAA,OAAOY,2BAAgB,CAMrB;AACDC,IAAAA,gBAAgB,EAAEJ,OAAO,CAACC,IAAI,IAAI,CAAC;IACnCR,QAAQ,EAAE,CAACC,mBAAS,CAACC,aAAa,EAAEK,OAAO,EAAEb,OAAO,CAAC;IACrDS,OAAO,EAAE,OAAO;AAAES,MAAAA,SAAS,GAAG;AAAG,KAAA,KAAI;AACpC,MAAA,OAAOhB,MAAM,CAACQ,aAAa,CAACS,SAAS,CACpC;AAAE,QAAA,GAAGN,OAAO;AAAEC,QAAAA,IAAI,EAAEI;AAAW,OAAA,EAC/BlB,OAAO,EACPC,MAAM,CACN;KACD;IACDmB,gBAAgB,EAAGC,QAAQ,IAAI;AAC9B,MAAA,IACCA,QAAQ,CAACC,UAAU,IACnBD,QAAQ,CAACC,UAAU,CAACC,WAAW,GAAGF,QAAQ,CAACC,UAAU,CAACE,SAAS,EAC9D;AACD,QAAA,OAAOH,QAAQ,CAACC,UAAU,CAACC,WAAW,GAAG,CAAC;AAC3C;AACA,MAAA,OAAOE,SAAS;AACjB;AACA,GAAA,CAAC;AACH;AAEA;;;AAGG;SACaC,gCAAgCA,GAAA;AAC/C,EAAA,MAAMxB,MAAM,GAAGC,uBAAY,EAAE;AAC7B,EAAA,MAAMwB,WAAW,GAAGvB,yBAAc,EAAE;AAEpC,EAAA,OAAOwB,sBAAW,CAQhB;IACDC,UAAU,EAAE,OAAO;MAAE9B,EAAE;MAAEC,OAAO;AAAEC,MAAAA;AAAQ,KAAA,KAAI;MAC7C,MAAMC,MAAM,CAACQ,aAAa,CAACoB,UAAU,CAAC/B,EAAE,EAAEC,OAAO,EAAEC,MAAM,CAAC;KAC1D;IACD8B,SAAS,EAAEA,MAAK;MACfJ,WAAW,CAACK,iBAAiB,CAAC;AAC7B1B,QAAAA,QAAQ,EAAE,CAACC,mBAAS,CAACC,aAAa;AAClC,OAAA,CAAC;AACH;AACA,GAAA,CAAC;AACH;AAEA;;;AAGG;SACayB,mCAAmCA,GAAA;AAClD,EAAA,MAAM/B,MAAM,GAAGC,uBAAY,EAAE;AAC7B,EAAA,MAAMwB,WAAW,GAAGvB,yBAAc,EAAE;AAEpC,EAAA,OAAOwB,sBAAW,CAOhB;IACDC,UAAU,EAAE,OAAO;MAAE7B,OAAO;AAAEC,MAAAA;AAAQ,KAAA,KAAI;MACzC,MAAMC,MAAM,CAACQ,aAAa,CAACwB,aAAa,CAAClC,OAAO,EAAEC,MAAM,CAAC;KACzD;IACD8B,SAAS,EAAEA,MAAK;MACfJ,WAAW,CAACK,iBAAiB,CAAC;AAC7B1B,QAAAA,QAAQ,EAAE,CAACC,mBAAS,CAACC,aAAa;AAClC,OAAA,CAAC;AACH;AACA,GAAA,CAAC;AACH;;;;;;;"}