buymeua-api-fe 0.0.1

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 (182) hide show
  1. package/README.md +592 -0
  2. package/dist/entities/ad/api/adApi.d.ts +1146 -0
  3. package/dist/entities/ad/api/adApi.d.ts.map +1 -0
  4. package/dist/entities/ad/api/adApi.js +31 -0
  5. package/dist/entities/ad/api/adApi.js.map +1 -0
  6. package/dist/entities/ad/index.d.ts +3 -0
  7. package/dist/entities/ad/index.d.ts.map +1 -0
  8. package/dist/entities/ad/index.js +3 -0
  9. package/dist/entities/ad/index.js.map +1 -0
  10. package/dist/entities/ad/model/types.d.ts +26 -0
  11. package/dist/entities/ad/model/types.d.ts.map +1 -0
  12. package/dist/entities/ad/model/types.js +1 -0
  13. package/dist/entities/ad/model/types.js.map +1 -0
  14. package/dist/entities/auth/api/authApi.d.ts +488 -0
  15. package/dist/entities/auth/api/authApi.d.ts.map +1 -0
  16. package/dist/entities/auth/api/authApi.js +33 -0
  17. package/dist/entities/auth/api/authApi.js.map +1 -0
  18. package/dist/entities/auth/index.d.ts +3 -0
  19. package/dist/entities/auth/index.d.ts.map +1 -0
  20. package/dist/entities/auth/index.js +3 -0
  21. package/dist/entities/auth/index.js.map +1 -0
  22. package/dist/entities/auth/model/types.d.ts +43 -0
  23. package/dist/entities/auth/model/types.d.ts.map +1 -0
  24. package/dist/entities/auth/model/types.js +1 -0
  25. package/dist/entities/auth/model/types.js.map +1 -0
  26. package/dist/entities/cart/api/cartApi.d.ts +2787 -0
  27. package/dist/entities/cart/api/cartApi.d.ts.map +1 -0
  28. package/dist/entities/cart/api/cartApi.js +382 -0
  29. package/dist/entities/cart/api/cartApi.js.map +1 -0
  30. package/dist/entities/cart/index.d.ts +3 -0
  31. package/dist/entities/cart/index.d.ts.map +1 -0
  32. package/dist/entities/cart/index.js +4 -0
  33. package/dist/entities/cart/index.js.map +1 -0
  34. package/dist/entities/cart/model/types.d.ts +118 -0
  35. package/dist/entities/cart/model/types.d.ts.map +1 -0
  36. package/dist/entities/cart/model/types.js +1 -0
  37. package/dist/entities/cart/model/types.js.map +1 -0
  38. package/dist/entities/category/api/categoryApi.d.ts +2513 -0
  39. package/dist/entities/category/api/categoryApi.d.ts.map +1 -0
  40. package/dist/entities/category/api/categoryApi.js +54 -0
  41. package/dist/entities/category/api/categoryApi.js.map +1 -0
  42. package/dist/entities/category/index.d.ts +3 -0
  43. package/dist/entities/category/index.d.ts.map +1 -0
  44. package/dist/entities/category/index.js +3 -0
  45. package/dist/entities/category/index.js.map +1 -0
  46. package/dist/entities/category/model/types.d.ts +50 -0
  47. package/dist/entities/category/model/types.d.ts.map +1 -0
  48. package/dist/entities/category/model/types.js +1 -0
  49. package/dist/entities/category/model/types.js.map +1 -0
  50. package/dist/entities/chat/api/chatApi.d.ts +3174 -0
  51. package/dist/entities/chat/api/chatApi.d.ts.map +1 -0
  52. package/dist/entities/chat/api/chatApi.js +195 -0
  53. package/dist/entities/chat/api/chatApi.js.map +1 -0
  54. package/dist/entities/chat/index.d.ts +3 -0
  55. package/dist/entities/chat/index.d.ts.map +1 -0
  56. package/dist/entities/chat/index.js +3 -0
  57. package/dist/entities/chat/index.js.map +1 -0
  58. package/dist/entities/chat/model/types.d.ts +115 -0
  59. package/dist/entities/chat/model/types.d.ts.map +1 -0
  60. package/dist/entities/chat/model/types.js +1 -0
  61. package/dist/entities/chat/model/types.js.map +1 -0
  62. package/dist/entities/customer/index.d.ts +2 -0
  63. package/dist/entities/customer/index.d.ts.map +1 -0
  64. package/dist/entities/customer/index.js +2 -0
  65. package/dist/entities/customer/index.js.map +1 -0
  66. package/dist/entities/customer/model/types.d.ts +25 -0
  67. package/dist/entities/customer/model/types.d.ts.map +1 -0
  68. package/dist/entities/customer/model/types.js +1 -0
  69. package/dist/entities/customer/model/types.js.map +1 -0
  70. package/dist/entities/favorite/api/favoriteApi.d.ts +2219 -0
  71. package/dist/entities/favorite/api/favoriteApi.d.ts.map +1 -0
  72. package/dist/entities/favorite/api/favoriteApi.js +367 -0
  73. package/dist/entities/favorite/api/favoriteApi.js.map +1 -0
  74. package/dist/entities/favorite/index.d.ts +3 -0
  75. package/dist/entities/favorite/index.d.ts.map +1 -0
  76. package/dist/entities/favorite/index.js +3 -0
  77. package/dist/entities/favorite/index.js.map +1 -0
  78. package/dist/entities/favorite/model/types.d.ts +56 -0
  79. package/dist/entities/favorite/model/types.d.ts.map +1 -0
  80. package/dist/entities/favorite/model/types.js +1 -0
  81. package/dist/entities/favorite/model/types.js.map +1 -0
  82. package/dist/entities/notification/api/notificationApi.d.ts +2040 -0
  83. package/dist/entities/notification/api/notificationApi.d.ts.map +1 -0
  84. package/dist/entities/notification/api/notificationApi.js +111 -0
  85. package/dist/entities/notification/api/notificationApi.js.map +1 -0
  86. package/dist/entities/notification/index.d.ts +3 -0
  87. package/dist/entities/notification/index.d.ts.map +1 -0
  88. package/dist/entities/notification/index.js +3 -0
  89. package/dist/entities/notification/index.js.map +1 -0
  90. package/dist/entities/notification/model/types.d.ts +79 -0
  91. package/dist/entities/notification/model/types.d.ts.map +1 -0
  92. package/dist/entities/notification/model/types.js +1 -0
  93. package/dist/entities/notification/model/types.js.map +1 -0
  94. package/dist/entities/novaposhta/api/novaposhtaApi.d.ts +3473 -0
  95. package/dist/entities/novaposhta/api/novaposhtaApi.d.ts.map +1 -0
  96. package/dist/entities/novaposhta/api/novaposhtaApi.js +54 -0
  97. package/dist/entities/novaposhta/api/novaposhtaApi.js.map +1 -0
  98. package/dist/entities/novaposhta/index.d.ts +3 -0
  99. package/dist/entities/novaposhta/index.d.ts.map +1 -0
  100. package/dist/entities/novaposhta/index.js +3 -0
  101. package/dist/entities/novaposhta/index.js.map +1 -0
  102. package/dist/entities/novaposhta/model/types.d.ts +65 -0
  103. package/dist/entities/novaposhta/model/types.d.ts.map +1 -0
  104. package/dist/entities/novaposhta/model/types.js +1 -0
  105. package/dist/entities/novaposhta/model/types.js.map +1 -0
  106. package/dist/entities/product/api/productApi.d.ts +4007 -0
  107. package/dist/entities/product/api/productApi.d.ts.map +1 -0
  108. package/dist/entities/product/api/productApi.js +88 -0
  109. package/dist/entities/product/api/productApi.js.map +1 -0
  110. package/dist/entities/product/index.d.ts +3 -0
  111. package/dist/entities/product/index.d.ts.map +1 -0
  112. package/dist/entities/product/index.js +3 -0
  113. package/dist/entities/product/index.js.map +1 -0
  114. package/dist/entities/product/model/types.d.ts +243 -0
  115. package/dist/entities/product/model/types.d.ts.map +1 -0
  116. package/dist/entities/product/model/types.js +1 -0
  117. package/dist/entities/product/model/types.js.map +1 -0
  118. package/dist/entities/referral/api/referralApi.d.ts +1838 -0
  119. package/dist/entities/referral/api/referralApi.d.ts.map +1 -0
  120. package/dist/entities/referral/api/referralApi.js +44 -0
  121. package/dist/entities/referral/api/referralApi.js.map +1 -0
  122. package/dist/entities/referral/index.d.ts +3 -0
  123. package/dist/entities/referral/index.d.ts.map +1 -0
  124. package/dist/entities/referral/index.js +3 -0
  125. package/dist/entities/referral/index.js.map +1 -0
  126. package/dist/entities/referral/model/types.d.ts +46 -0
  127. package/dist/entities/referral/model/types.d.ts.map +1 -0
  128. package/dist/entities/referral/model/types.js +1 -0
  129. package/dist/entities/referral/model/types.js.map +1 -0
  130. package/dist/entities/store/index.d.ts +2 -0
  131. package/dist/entities/store/index.d.ts.map +1 -0
  132. package/dist/entities/store/index.js +2 -0
  133. package/dist/entities/store/index.js.map +1 -0
  134. package/dist/entities/store/model/types.d.ts +18 -0
  135. package/dist/entities/store/model/types.d.ts.map +1 -0
  136. package/dist/entities/store/model/types.js +1 -0
  137. package/dist/entities/store/model/types.js.map +1 -0
  138. package/dist/entities/stories/api/storiesApi.d.ts +1242 -0
  139. package/dist/entities/stories/api/storiesApi.d.ts.map +1 -0
  140. package/dist/entities/stories/api/storiesApi.js +52 -0
  141. package/dist/entities/stories/api/storiesApi.js.map +1 -0
  142. package/dist/entities/stories/index.d.ts +3 -0
  143. package/dist/entities/stories/index.d.ts.map +1 -0
  144. package/dist/entities/stories/index.js +3 -0
  145. package/dist/entities/stories/index.js.map +1 -0
  146. package/dist/entities/stories/model/types.d.ts +46 -0
  147. package/dist/entities/stories/model/types.d.ts.map +1 -0
  148. package/dist/entities/stories/model/types.js +1 -0
  149. package/dist/entities/stories/model/types.js.map +1 -0
  150. package/dist/entities/supplier/api/supplierApi.d.ts +3375 -0
  151. package/dist/entities/supplier/api/supplierApi.d.ts.map +1 -0
  152. package/dist/entities/supplier/api/supplierApi.js +159 -0
  153. package/dist/entities/supplier/api/supplierApi.js.map +1 -0
  154. package/dist/entities/supplier/index.d.ts +3 -0
  155. package/dist/entities/supplier/index.d.ts.map +1 -0
  156. package/dist/entities/supplier/index.js +3 -0
  157. package/dist/entities/supplier/index.js.map +1 -0
  158. package/dist/entities/supplier/model/types.d.ts +114 -0
  159. package/dist/entities/supplier/model/types.d.ts.map +1 -0
  160. package/dist/entities/supplier/model/types.js +1 -0
  161. package/dist/entities/supplier/model/types.js.map +1 -0
  162. package/dist/index.d.ts +17 -0
  163. package/dist/index.d.ts.map +1 -0
  164. package/dist/index.js +17 -0
  165. package/dist/index.js.map +1 -0
  166. package/dist/shared/api/api.d.ts +13 -0
  167. package/dist/shared/api/api.d.ts.map +1 -0
  168. package/dist/shared/api/api.js +35 -0
  169. package/dist/shared/api/api.js.map +1 -0
  170. package/dist/shared/api/index.d.ts +2 -0
  171. package/dist/shared/api/index.d.ts.map +1 -0
  172. package/dist/shared/api/index.js +2 -0
  173. package/dist/shared/api/index.js.map +1 -0
  174. package/dist/shared/model/index.d.ts +2 -0
  175. package/dist/shared/model/index.d.ts.map +1 -0
  176. package/dist/shared/model/index.js +2 -0
  177. package/dist/shared/model/index.js.map +1 -0
  178. package/dist/shared/model/types.d.ts +47 -0
  179. package/dist/shared/model/types.d.ts.map +1 -0
  180. package/dist/shared/model/types.js +6 -0
  181. package/dist/shared/model/types.js.map +1 -0
  182. package/package.json +34 -0
package/README.md ADDED
@@ -0,0 +1,592 @@
1
+ # Buymeua API Frontend
2
+
3
+ ## 🚀 Installation
4
+
5
+ ```bash
6
+ npm install buymeua-api-fe @reduxjs/toolkit react-redux
7
+ ```
8
+
9
+ ## 📖 Quick Start
10
+
11
+ ### 1. Configure API and Setup Redux Store
12
+
13
+ ```typescript
14
+ import { configureStore } from '@reduxjs/toolkit';
15
+ import { configureBuymeuaApi, getBuymeuaApi, Session } from 'buymeua-api-fe';
16
+
17
+ // Configure API before store setup
18
+ const buymeuaApi = configureBuymeuaApi({
19
+ baseUrl: 'https://api.buymeua.com/',
20
+ prepareHeaders: (headers) => {
21
+ headers.set('Accept', 'application/json');
22
+ headers.set('X-SESSION', Session.Dropshipper);
23
+
24
+ const token = localStorage.getItem('auth-token');
25
+ if (token) {
26
+ headers.set('Authorization', `Bearer ${token}`);
27
+ }
28
+ },
29
+ onUnauthorized: () => {
30
+ // Handle 401 errors
31
+ localStorage.removeItem('auth-token');
32
+ window.location.href = '/login';
33
+ },
34
+ });
35
+
36
+ // Setup Redux store
37
+ export const store = configureStore({
38
+ reducer: {
39
+ [buymeuaApi.reducerPath]: buymeuaApi.reducer,
40
+ },
41
+ middleware: (getDefaultMiddleware) =>
42
+ getDefaultMiddleware().concat(buymeuaApi.middleware),
43
+ });
44
+ ```
45
+
46
+ ### 2. Usage in React Components
47
+
48
+ ```typescript
49
+ import React from 'react';
50
+ import { useGetProductsQuery } from 'buymeua-api-fe';
51
+
52
+ function ProductList() {
53
+ const { data: products, isLoading, error } = useGetProductsQuery({
54
+ page: 1,
55
+ per_page: 20,
56
+ search: 'phone'
57
+ });
58
+
59
+ if (isLoading) return <div>Loading...</div>;
60
+ if (error) return <div>Error loading products</div>;
61
+
62
+ return (
63
+ <div>
64
+ {products?.data.map(product => (
65
+ <div key={product.id}>{product.name}</div>
66
+ ))}
67
+ </div>
68
+ );
69
+ }
70
+ ```
71
+
72
+ ## 📚 API Reference
73
+
74
+ ### Configuration
75
+
76
+ #### `configureBuymeuaApi(config: ApiConfig)`
77
+
78
+ Configures the global API client.
79
+
80
+ **Parameters:**
81
+
82
+ - `config.baseUrl` - Base API URL
83
+ - `config.prepareHeaders` - Function to prepare headers
84
+ - `config.onUnauthorized` - Callback for handling 401 errors
85
+
86
+ #### `getBuymeuaApi()`
87
+
88
+ Returns the configured API instance.
89
+
90
+ ### Products
91
+
92
+ ```typescript
93
+ // Get products list with infinite scroll
94
+ const { data, fetchNextPage, hasNextPage } = useGetProductsInfiniteQuery({
95
+ queryArg: {
96
+ per_page?: number;
97
+ core_filter?: string;
98
+ filter_has_special?: boolean | null;
99
+ order_by?: string;
100
+ category_filter?: number[];
101
+ option_value_filter?: {
102
+ option_value_ids: number[];
103
+ warehouse_ids: number[];
104
+ };
105
+ filter_customer_id?: number;
106
+ filter_has_customer_id?: boolean;
107
+ filter_advertised?: boolean;
108
+ price_from?: number;
109
+ price_to?: number;
110
+ only_in_root_category?: boolean;
111
+ price_type?: string;
112
+ }
113
+ });
114
+
115
+ // Get products by QR code
116
+ const { data, fetchNextPage, hasNextPage } = useGetProductsByQrInfiniteQuery({
117
+ queryArg: {
118
+ 'filter[barcode]'?: string;
119
+ 'filter[product_id]'?: number;
120
+ core_filter?: string;
121
+ per_page?: number;
122
+ }
123
+ });
124
+
125
+ // Get single product by ID
126
+ const { data } = useGetProductByIdQuery({ product: number });
127
+
128
+ // Get product (alternative endpoint)
129
+ const { data } = useGetProductQuery({ product: number });
130
+
131
+ // Get product statistics
132
+ const { data } = useGetProductStatisticsQuery({ product: number });
133
+
134
+ // Get bestsellers
135
+ const { data } = useGetBestSellersQuery({
136
+ best_seller_days_filter?: number;
137
+ filter_customer_id?: number;
138
+ filter_has_suppliers?: boolean;
139
+ category_filter?: number[];
140
+ });
141
+
142
+ // Get product details
143
+ const { data } = useGetProductDetailsQuery({ product: number });
144
+ ```
145
+
146
+ ### Cart
147
+
148
+ ```typescript
149
+ // Get cart count
150
+ const { data } = useGetCartCountQuery();
151
+
152
+ // Get cart merchants
153
+ const { data, fetchNextPage, hasNextPage } = useGetCartMerchantsInfiniteQuery({
154
+ queryArg: {
155
+ per_page?: number;
156
+ }
157
+ });
158
+
159
+ // Get cart merchant items
160
+ const { data, fetchNextPage, hasNextPage } = useGetCartMerchantItemsInfiniteQuery({
161
+ queryArg: {
162
+ merchant_id: number;
163
+ per_page?: number;
164
+ }
165
+ });
166
+
167
+ // Add item to cart
168
+ const [addToCart] = useAddToCartMutation();
169
+ await addToCart({
170
+ product_type: string;
171
+ product_id: number;
172
+ product_option_value_id: number;
173
+ quantity: number;
174
+ warehouse_id: number | null; // only for buyme products
175
+ });
176
+
177
+ // Remove item from cart
178
+ const [removeFromCart] = useRemoveItemFromCartMutation();
179
+ await removeFromCart({
180
+ cart_item_id: number;
181
+ merchantId: number;
182
+ quantity: number;
183
+ });
184
+
185
+ // Remove entire merchant from cart
186
+ const [removeMerchant] = useRemoveMerchantFromCartMutation();
187
+ await removeMerchant({ merchant_id: number });
188
+
189
+ // Update cart item quantity
190
+ const [updateQuantity] = useUpdateCartItemQuantityMutation();
191
+ await updateQuantity({
192
+ cart_item_option_value_id: number;
193
+ quantity: number;
194
+ type: 'increase' | 'decrease';
195
+ merchantId: number;
196
+ optionIndex: number;
197
+ });
198
+
199
+ // Toggle gift package
200
+ const [toggleGift] = useToggleGiftPackageMutation();
201
+ await toggleGift({
202
+ gift_package: boolean;
203
+ merchantId: number;
204
+ });
205
+ ```
206
+
207
+ ### Authentication
208
+
209
+ ```typescript
210
+ // Sign in with phone number
211
+ const [signIn] = useSignInMutation();
212
+ await signIn({
213
+ telephone: string;
214
+ });
215
+
216
+ // Confirm verification code
217
+ const [confirmCode] = useConfirmCodeMutation();
218
+ await confirmCode({
219
+ telephone: string;
220
+ code: string;
221
+ });
222
+
223
+ // Sign up
224
+ const [signUp] = useSignUpMutation();
225
+ await signUp({
226
+ telephone: string;
227
+ firstname: string;
228
+ lastname: string;
229
+ term: 1;
230
+ });
231
+ ```
232
+
233
+ ### Categories
234
+
235
+ ```typescript
236
+ // Get categories
237
+ const { data, fetchNextPage, hasNextPage } = useGetCategoriesInfiniteQuery({
238
+ queryArg: {
239
+ search: string;
240
+ filter_parent_id?: number;
241
+ filter_with_products?: boolean;
242
+ per_page?: number;
243
+ }
244
+ });
245
+
246
+ // Get supplier categories
247
+ const { data, fetchNextPage, hasNextPage } = useGetSupplierCategoriesInfiniteQuery({
248
+ queryArg: {
249
+ customer: number;
250
+ parent_id?: number;
251
+ per_page?: number;
252
+ }
253
+ });
254
+
255
+ // Get Buyme categories
256
+ const { data, fetchNextPage, hasNextPage } = useGetBuymeCategoriesInfiniteQuery({
257
+ queryArg: {
258
+ search?: string;
259
+ parent_id?: number;
260
+ customer_id?: number;
261
+ per_page?: number;
262
+ }
263
+ });
264
+ ```
265
+
266
+ ### Favorites
267
+
268
+ ```typescript
269
+ // Get favorite count
270
+ const { data } = useGetFavoriteCountQuery();
271
+
272
+ // Get favorite merchants
273
+ const { data, fetchNextPage, hasNextPage } = useGetFavoriteMerchantsInfiniteQuery({
274
+ queryArg: {
275
+ per_page?: number;
276
+ }
277
+ });
278
+
279
+ // Get favorite merchant items
280
+ const { data, fetchNextPage, hasNextPage } = useGetFavoriteMerchantItemsInfiniteQuery({
281
+ queryArg: {
282
+ merchant_id: number;
283
+ }
284
+ });
285
+
286
+ // Add to favorites
287
+ const [addToFavorite] = useAddFavoriteMerchantItemMutation();
288
+ await addToFavorite({
289
+ product_type: string;
290
+ product_id: number;
291
+ });
292
+
293
+ // Remove from favorites
294
+ const [removeFromFavorite] = useDeleteFavoriteMerchantItemMutation();
295
+ await removeFromFavorite({
296
+ product_type: string;
297
+ product_id: number;
298
+ });
299
+ ```
300
+
301
+ ### Chat
302
+
303
+ ```typescript
304
+ // Get chat list
305
+ const { data, fetchNextPage, hasNextPage } = useGetChatsInfiniteQuery({
306
+ queryArg: {
307
+ per_page?: number;
308
+ }
309
+ });
310
+
311
+ // Get chat info
312
+ const { data } = useGetChatInfoQuery({
313
+ customerChatThread: number;
314
+ });
315
+
316
+ // Get chat messages
317
+ const { data, fetchNextPage, hasNextPage } = useGetChatInfiniteQuery({
318
+ queryArg: {
319
+ customerChatThreadId: number;
320
+ per_page?: number;
321
+ }
322
+ });
323
+
324
+ // Get single chat message
325
+ const { data } = useGetChatMessageQuery({
326
+ customerChatThreadId: number;
327
+ customerChatId: number;
328
+ });
329
+
330
+ // Create chat
331
+ const [createChat] = useCreateChatMutation();
332
+ await createChat({
333
+ customer_id: number;
334
+ supplier_id: number | null;
335
+ admin_id: number | null;
336
+ });
337
+
338
+ // Send message
339
+ const [sendMessage] = useSendChatMessageMutation();
340
+ await sendMessage({
341
+ customerChatThreadId: number;
342
+ message: string;
343
+ medias: File[];
344
+ });
345
+
346
+ // Update message
347
+ const [updateMessage] = useUpdateChatMessageMutation();
348
+ await updateMessage({
349
+ customerChatThreadId: number;
350
+ customerChatId: number;
351
+ message: string;
352
+ medias: File[];
353
+ });
354
+
355
+ // Mark messages as read
356
+ const [markAsRead] = useMarkChatMessagesAsReadMutation();
357
+ await markAsRead({
358
+ customerChatThreadId: number;
359
+ chats: number[]; // Message IDs
360
+ });
361
+
362
+ // Delete chat
363
+ const [deleteChat] = useDeleteChatMutation();
364
+ await deleteChat({
365
+ customerChatThread: number;
366
+ customer_id: number;
367
+ });
368
+
369
+ // Delete message
370
+ const [deleteMessage] = useDeleteChatMessageMutation();
371
+ await deleteMessage({
372
+ customerChatThread: number;
373
+ chat: number; // Message ID
374
+ });
375
+
376
+ // Resend message
377
+ const [resendMessage] = useResendChatMessageMutation();
378
+ await resendMessage({
379
+ customerChatThreadId: number;
380
+ customerChatId: number;
381
+ message: string;
382
+ medias: File[];
383
+ });
384
+ ```
385
+
386
+ ### Notifications
387
+
388
+ ```typescript
389
+ // Get notifications
390
+ const { data, fetchNextPage, hasNextPage } = useGetNotificationsInfiniteQuery({
391
+ queryArg: {
392
+ per_page?: number;
393
+ 'filter[type]'?: string;
394
+ 'filter[event]'?: string;
395
+ 'filter[date_from]'?: string;
396
+ 'filter[date_to]'?: string;
397
+ }
398
+ });
399
+
400
+ // Get single notification
401
+ const { data } = useGetNotificationQuery({
402
+ notification: number;
403
+ });
404
+
405
+ // Get notifications count
406
+ const { data } = useGetNotificationsCountQuery();
407
+
408
+ // Get new suppliers count
409
+ const { data } = useGetNewSuppliersCountQuery();
410
+
411
+ // Mark all as read
412
+ const [markAllAsRead] = useMarkAllNotificationsAsReadMutation();
413
+ await markAllAsRead();
414
+
415
+ // Mark single notification as read
416
+ const [markAsRead] = useMarkNotificationAsReadMutation();
417
+ await markAsRead({ notification: number });
418
+
419
+ // Delete all notifications
420
+ const [deleteAll] = useDeleteAllNotificationsMutation();
421
+ await deleteAll();
422
+
423
+ // Delete single notification
424
+ const [deleteNotification] = useDeleteNotificationMutation();
425
+ await deleteNotification({ notification: number });
426
+ ```
427
+
428
+ ### Stories
429
+
430
+ ```typescript
431
+ // Get stories
432
+ const { data, fetchNextPage, hasNextPage } = useGetStoriesInfiniteQuery({
433
+ queryArg?: {
434
+ sort_type?: 'created_at' | 'views_count' | 'sort_order' | 'viewed_order';
435
+ sort_direction?: 'asc' | 'desc';
436
+ per_page?: number;
437
+ }
438
+ });
439
+
440
+ // Increase story views
441
+ const [increaseViews] = useIncreaseStoryViewsMutation();
442
+ await increaseViews({ story: number });
443
+ ```
444
+
445
+ ### Suppliers
446
+
447
+ ```typescript
448
+ // Get suppliers list
449
+ const { data, fetchNextPage, hasNextPage } = useGetSuppliersInfiniteQuery({
450
+ queryArg: {
451
+ per_page?: number;
452
+ search?: string;
453
+ filter_buyme_category_ids?: number[];
454
+ }
455
+ });
456
+
457
+ // Get supplier info
458
+ const { data } = useGetSupplierInfoQuery({
459
+ customer: number;
460
+ });
461
+
462
+ // Get supplier articles
463
+ const { data, fetchNextPage, hasNextPage } = useGetSupplierArticlesInfiniteQuery({
464
+ queryArg: {
465
+ customer: number;
466
+ per_page?: number;
467
+ 'filter[id]'?: number;
468
+ 'filter[translations.title]'?: string;
469
+ 'filter[translations.content]'?: string;
470
+ 'filter[date_from]'?: string;
471
+ 'filter[date_to]'?: string;
472
+ }
473
+ });
474
+
475
+ // Get supplier reviews
476
+ const { data, fetchNextPage, hasNextPage } = useGetSupplierReviewsInfiniteQuery({
477
+ queryArg: {
478
+ supplier_id: number;
479
+ per_page?: number;
480
+ rating?: number;
481
+ has_reply?: boolean;
482
+ date_from?: string;
483
+ date_to?: string;
484
+ sort_by?: 'rating' | 'created_at';
485
+ sort_direction?: 'asc' | 'desc';
486
+ }
487
+ });
488
+
489
+ // Get supplier rating
490
+ const { data } = useGetSupplierRatingQuery({
491
+ supplier_id: number;
492
+ });
493
+
494
+ // Add supplier review
495
+ const [addReview] = useAddSupplierReviewMutation();
496
+ await addReview({
497
+ supplier_id: number;
498
+ rating: number;
499
+ text: string;
500
+ });
501
+
502
+ // Reply to supplier review
503
+ const [replyToReview] = useReplyToSupplierReviewMutation();
504
+ await replyToReview({
505
+ review_id: number;
506
+ reply_text: string;
507
+ });
508
+
509
+ // Mark supplier as old
510
+ const [markAsOld] = useMarkSupplierAsOldMutation();
511
+ await markAsOld({ supplier: number });
512
+ ```
513
+
514
+ ### Nova Poshta
515
+
516
+ ```typescript
517
+ // Get Nova Poshta cities
518
+ const { data, fetchNextPage, hasNextPage } = useGetNovaposhtaCitiesInfiniteQuery({
519
+ queryArg: {
520
+ search?: string;
521
+ area?: string;
522
+ settlement_type?: string;
523
+ is_branch?: boolean;
524
+ per_page?: number;
525
+ }
526
+ });
527
+
528
+ // Get Nova Poshta streets
529
+ const { data, fetchNextPage, hasNextPage } = useGetNovaposhtaStreetsInfiniteQuery({
530
+ queryArg: {
531
+ search?: string;
532
+ city_ref: string;
533
+ streets_type?: string;
534
+ per_page?: number;
535
+ }
536
+ });
537
+
538
+ // Get Nova Poshta warehouses
539
+ const { data, fetchNextPage, hasNextPage } = useGetNovaposhtaWarehousesInfiniteQuery({
540
+ queryArg: {
541
+ search?: string;
542
+ city_ref: string;
543
+ type?: string;
544
+ per_page?: number;
545
+ }
546
+ });
547
+ ```
548
+
549
+ ### Referrals
550
+
551
+ ```typescript
552
+ // Get referral statistics
553
+ const { data, fetchNextPage, hasNextPage } = useGetReferralStatisticsInfiniteQuery({
554
+ queryArg?: {
555
+ date_from?: string;
556
+ date_to?: string;
557
+ per_page?: number;
558
+ }
559
+ });
560
+
561
+ // Get referral transactions
562
+ const { data, fetchNextPage, hasNextPage } = useGetReferralTransactionsInfiniteQuery({
563
+ queryArg: {
564
+ referral_id: number;
565
+ date_from?: string;
566
+ date_to?: string;
567
+ per_page?: number;
568
+ }
569
+ });
570
+
571
+ // Track referral visit
572
+ const [trackVisit] = useTrackReferralVisitMutation();
573
+ await trackVisit({
574
+ referral_id: number;
575
+ });
576
+ ```
577
+
578
+ ### Ads
579
+
580
+ ```typescript
581
+ // Get ad pages
582
+ const { data } = useGetAdPagesQuery({
583
+ platform_id: number;
584
+ });
585
+
586
+ // Get ad platforms
587
+ const { data, fetchNextPage, hasNextPage } = useGetAdPlatformsInfiniteQuery({
588
+ queryArg?: {
589
+ per_page?: number;
590
+ }
591
+ });
592
+ ```