@smartbills/react-hooks-sdk 0.0.2-alpha.44 → 0.0.2-alpha.45

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