@serik_lav/api-fe 0.47.0
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.
- package/CHANGELOG.md +906 -0
- package/README.md +1100 -0
- package/dist/entities/ad/api/adApi.d.ts +6 -0
- package/dist/entities/ad/api/adApi.d.ts.map +1 -0
- package/dist/entities/ad/api/adApi.js +29 -0
- package/dist/entities/ad/api/adApi.js.map +1 -0
- package/dist/entities/ad/index.d.ts +3 -0
- package/dist/entities/ad/index.d.ts.map +1 -0
- package/dist/entities/ad/index.js +3 -0
- package/dist/entities/ad/index.js.map +1 -0
- package/dist/entities/ad/model/types.d.ts +22 -0
- package/dist/entities/ad/model/types.d.ts.map +1 -0
- package/dist/entities/ad/model/types.js +1 -0
- package/dist/entities/ad/model/types.js.map +1 -0
- package/dist/entities/auth/api/authApi.d.ts +9 -0
- package/dist/entities/auth/api/authApi.d.ts.map +1 -0
- package/dist/entities/auth/api/authApi.js +46 -0
- package/dist/entities/auth/api/authApi.js.map +1 -0
- package/dist/entities/auth/index.d.ts +3 -0
- package/dist/entities/auth/index.d.ts.map +1 -0
- package/dist/entities/auth/index.js +3 -0
- package/dist/entities/auth/index.js.map +1 -0
- package/dist/entities/auth/model/types.d.ts +77 -0
- package/dist/entities/auth/model/types.d.ts.map +1 -0
- package/dist/entities/auth/model/types.js +1 -0
- package/dist/entities/auth/model/types.js.map +1 -0
- package/dist/entities/cart/api/cartApi.d.ts +12 -0
- package/dist/entities/cart/api/cartApi.d.ts.map +1 -0
- package/dist/entities/cart/api/cartApi.js +396 -0
- package/dist/entities/cart/api/cartApi.js.map +1 -0
- package/dist/entities/cart/index.d.ts +3 -0
- package/dist/entities/cart/index.d.ts.map +1 -0
- package/dist/entities/cart/index.js +4 -0
- package/dist/entities/cart/index.js.map +1 -0
- package/dist/entities/cart/model/types.d.ts +91 -0
- package/dist/entities/cart/model/types.d.ts.map +1 -0
- package/dist/entities/cart/model/types.js +1 -0
- package/dist/entities/cart/model/types.js.map +1 -0
- package/dist/entities/category/api/categoryApi.d.ts +8 -0
- package/dist/entities/category/api/categoryApi.d.ts.map +1 -0
- package/dist/entities/category/api/categoryApi.js +33 -0
- package/dist/entities/category/api/categoryApi.js.map +1 -0
- package/dist/entities/category/index.d.ts +4 -0
- package/dist/entities/category/index.d.ts.map +1 -0
- package/dist/entities/category/index.js +4 -0
- package/dist/entities/category/index.js.map +1 -0
- package/dist/entities/category/model/store-category.d.ts +88 -0
- package/dist/entities/category/model/store-category.d.ts.map +1 -0
- package/dist/entities/category/model/store-category.js +24 -0
- package/dist/entities/category/model/store-category.js.map +1 -0
- package/dist/entities/category/model/types.d.ts +155 -0
- package/dist/entities/category/model/types.d.ts.map +1 -0
- package/dist/entities/category/model/types.js +18 -0
- package/dist/entities/category/model/types.js.map +1 -0
- package/dist/entities/category/model/useCategoryBreadcrumbs.d.ts +30 -0
- package/dist/entities/category/model/useCategoryBreadcrumbs.d.ts.map +1 -0
- package/dist/entities/category/model/useCategoryBreadcrumbs.js +72 -0
- package/dist/entities/category/model/useCategoryBreadcrumbs.js.map +1 -0
- package/dist/entities/chat/api/chatApi.d.ts +15 -0
- package/dist/entities/chat/api/chatApi.d.ts.map +1 -0
- package/dist/entities/chat/api/chatApi.js +400 -0
- package/dist/entities/chat/api/chatApi.js.map +1 -0
- package/dist/entities/chat/index.d.ts +3 -0
- package/dist/entities/chat/index.d.ts.map +1 -0
- package/dist/entities/chat/index.js +3 -0
- package/dist/entities/chat/index.js.map +1 -0
- package/dist/entities/chat/model/types.d.ts +439 -0
- package/dist/entities/chat/model/types.d.ts.map +1 -0
- package/dist/entities/chat/model/types.js +1 -0
- package/dist/entities/chat/model/types.js.map +1 -0
- package/dist/entities/country/api/countryApi.d.ts +5 -0
- package/dist/entities/country/api/countryApi.d.ts.map +1 -0
- package/dist/entities/country/api/countryApi.js +21 -0
- package/dist/entities/country/api/countryApi.js.map +1 -0
- package/dist/entities/country/index.d.ts +3 -0
- package/dist/entities/country/index.d.ts.map +1 -0
- package/dist/entities/country/index.js +3 -0
- package/dist/entities/country/index.js.map +1 -0
- package/dist/entities/country/model/types.d.ts +19 -0
- package/dist/entities/country/model/types.d.ts.map +1 -0
- package/dist/entities/country/model/types.js +1 -0
- package/dist/entities/country/model/types.js.map +1 -0
- package/dist/entities/customer/api/customerApi.d.ts +6 -0
- package/dist/entities/customer/api/customerApi.d.ts.map +1 -0
- package/dist/entities/customer/api/customerApi.js +21 -0
- package/dist/entities/customer/api/customerApi.js.map +1 -0
- package/dist/entities/customer/index.d.ts +3 -0
- package/dist/entities/customer/index.d.ts.map +1 -0
- package/dist/entities/customer/index.js +3 -0
- package/dist/entities/customer/index.js.map +1 -0
- package/dist/entities/customer/model/types.d.ts +237 -0
- package/dist/entities/customer/model/types.d.ts.map +1 -0
- package/dist/entities/customer/model/types.js +1 -0
- package/dist/entities/customer/model/types.js.map +1 -0
- package/dist/entities/favorite/api/favoriteApi.d.ts +32 -0
- package/dist/entities/favorite/api/favoriteApi.d.ts.map +1 -0
- package/dist/entities/favorite/api/favoriteApi.js +344 -0
- package/dist/entities/favorite/api/favoriteApi.js.map +1 -0
- package/dist/entities/favorite/index.d.ts +3 -0
- package/dist/entities/favorite/index.d.ts.map +1 -0
- package/dist/entities/favorite/index.js +3 -0
- package/dist/entities/favorite/index.js.map +1 -0
- package/dist/entities/favorite/model/types.d.ts +39 -0
- package/dist/entities/favorite/model/types.d.ts.map +1 -0
- package/dist/entities/favorite/model/types.js +1 -0
- package/dist/entities/favorite/model/types.js.map +1 -0
- package/dist/entities/notification/api/notificationApi.d.ts +12 -0
- package/dist/entities/notification/api/notificationApi.d.ts.map +1 -0
- package/dist/entities/notification/api/notificationApi.js +109 -0
- package/dist/entities/notification/api/notificationApi.js.map +1 -0
- package/dist/entities/notification/index.d.ts +3 -0
- package/dist/entities/notification/index.d.ts.map +1 -0
- package/dist/entities/notification/index.js +3 -0
- package/dist/entities/notification/index.js.map +1 -0
- package/dist/entities/notification/model/types.d.ts +273 -0
- package/dist/entities/notification/model/types.d.ts.map +1 -0
- package/dist/entities/notification/model/types.js +1 -0
- package/dist/entities/notification/model/types.js.map +1 -0
- package/dist/entities/novaposhta/api/novaposhtaApi.d.ts +11 -0
- package/dist/entities/novaposhta/api/novaposhtaApi.d.ts.map +1 -0
- package/dist/entities/novaposhta/api/novaposhtaApi.js +69 -0
- package/dist/entities/novaposhta/api/novaposhtaApi.js.map +1 -0
- package/dist/entities/novaposhta/index.d.ts +6 -0
- package/dist/entities/novaposhta/index.d.ts.map +1 -0
- package/dist/entities/novaposhta/index.js +6 -0
- package/dist/entities/novaposhta/index.js.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaCity.d.ts +101 -0
- package/dist/entities/novaposhta/model/novaposhtaCity.d.ts.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaCity.js +16 -0
- package/dist/entities/novaposhta/model/novaposhtaCity.js.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaSettlement.d.ts +140 -0
- package/dist/entities/novaposhta/model/novaposhtaSettlement.d.ts.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaSettlement.js +23 -0
- package/dist/entities/novaposhta/model/novaposhtaSettlement.js.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaStreet.d.ts +123 -0
- package/dist/entities/novaposhta/model/novaposhtaStreet.d.ts.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaStreet.js +16 -0
- package/dist/entities/novaposhta/model/novaposhtaStreet.js.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaWarehouse.d.ts +131 -0
- package/dist/entities/novaposhta/model/novaposhtaWarehouse.d.ts.map +1 -0
- package/dist/entities/novaposhta/model/novaposhtaWarehouse.js +19 -0
- package/dist/entities/novaposhta/model/novaposhtaWarehouse.js.map +1 -0
- package/dist/entities/order/api/orderApi.d.ts +18 -0
- package/dist/entities/order/api/orderApi.d.ts.map +1 -0
- package/dist/entities/order/api/orderApi.js +105 -0
- package/dist/entities/order/api/orderApi.js.map +1 -0
- package/dist/entities/order/index.d.ts +3 -0
- package/dist/entities/order/index.d.ts.map +1 -0
- package/dist/entities/order/index.js +3 -0
- package/dist/entities/order/index.js.map +1 -0
- package/dist/entities/order/model/types.d.ts +630 -0
- package/dist/entities/order/model/types.d.ts.map +1 -0
- package/dist/entities/order/model/types.js +27 -0
- package/dist/entities/order/model/types.js.map +1 -0
- package/dist/entities/product/api/productApi.d.ts +27 -0
- package/dist/entities/product/api/productApi.d.ts.map +1 -0
- package/dist/entities/product/api/productApi.js +252 -0
- package/dist/entities/product/api/productApi.js.map +1 -0
- package/dist/entities/product/index.d.ts +3 -0
- package/dist/entities/product/index.d.ts.map +1 -0
- package/dist/entities/product/index.js +3 -0
- package/dist/entities/product/index.js.map +1 -0
- package/dist/entities/product/model/store-product.d.ts +138 -0
- package/dist/entities/product/model/store-product.d.ts.map +1 -0
- package/dist/entities/product/model/store-product.js +9 -0
- package/dist/entities/product/model/store-product.js.map +1 -0
- package/dist/entities/product/model/types.d.ts +898 -0
- package/dist/entities/product/model/types.d.ts.map +1 -0
- package/dist/entities/product/model/types.js +40 -0
- package/dist/entities/product/model/types.js.map +1 -0
- package/dist/entities/referral/api/referralApi.d.ts +7 -0
- package/dist/entities/referral/api/referralApi.d.ts.map +1 -0
- package/dist/entities/referral/api/referralApi.js +41 -0
- package/dist/entities/referral/api/referralApi.js.map +1 -0
- package/dist/entities/referral/index.d.ts +3 -0
- package/dist/entities/referral/index.d.ts.map +1 -0
- package/dist/entities/referral/index.js +3 -0
- package/dist/entities/referral/index.js.map +1 -0
- package/dist/entities/referral/model/types.d.ts +42 -0
- package/dist/entities/referral/model/types.d.ts.map +1 -0
- package/dist/entities/referral/model/types.js +1 -0
- package/dist/entities/referral/model/types.js.map +1 -0
- package/dist/entities/store/api/storeApi.d.ts +14 -0
- package/dist/entities/store/api/storeApi.d.ts.map +1 -0
- package/dist/entities/store/api/storeApi.js +134 -0
- package/dist/entities/store/api/storeApi.js.map +1 -0
- package/dist/entities/store/index.d.ts +3 -0
- package/dist/entities/store/index.d.ts.map +1 -0
- package/dist/entities/store/index.js +3 -0
- package/dist/entities/store/index.js.map +1 -0
- package/dist/entities/store/model/types.d.ts +853 -0
- package/dist/entities/store/model/types.d.ts.map +1 -0
- package/dist/entities/store/model/types.js +1 -0
- package/dist/entities/store/model/types.js.map +1 -0
- package/dist/entities/stories/api/storiesApi.d.ts +12 -0
- package/dist/entities/stories/api/storiesApi.d.ts.map +1 -0
- package/dist/entities/stories/api/storiesApi.js +225 -0
- package/dist/entities/stories/api/storiesApi.js.map +1 -0
- package/dist/entities/stories/index.d.ts +3 -0
- package/dist/entities/stories/index.d.ts.map +1 -0
- package/dist/entities/stories/index.js +3 -0
- package/dist/entities/stories/index.js.map +1 -0
- package/dist/entities/stories/model/types.d.ts +330 -0
- package/dist/entities/stories/model/types.d.ts.map +1 -0
- package/dist/entities/stories/model/types.js +1 -0
- package/dist/entities/stories/model/types.js.map +1 -0
- package/dist/entities/supplier/api/supplierApi.d.ts +20 -0
- package/dist/entities/supplier/api/supplierApi.d.ts.map +1 -0
- package/dist/entities/supplier/api/supplierApi.js +148 -0
- package/dist/entities/supplier/api/supplierApi.js.map +1 -0
- package/dist/entities/supplier/index.d.ts +3 -0
- package/dist/entities/supplier/index.d.ts.map +1 -0
- package/dist/entities/supplier/index.js +3 -0
- package/dist/entities/supplier/index.js.map +1 -0
- package/dist/entities/supplier/model/types.d.ts +295 -0
- package/dist/entities/supplier/model/types.d.ts.map +1 -0
- package/dist/entities/supplier/model/types.js +1 -0
- package/dist/entities/supplier/model/types.js.map +1 -0
- package/dist/entities/system/api/systemApi.d.ts +7 -0
- package/dist/entities/system/api/systemApi.d.ts.map +1 -0
- package/dist/entities/system/api/systemApi.js +60 -0
- package/dist/entities/system/api/systemApi.js.map +1 -0
- package/dist/entities/system/index.d.ts +3 -0
- package/dist/entities/system/index.d.ts.map +1 -0
- package/dist/entities/system/index.js +3 -0
- package/dist/entities/system/index.js.map +1 -0
- package/dist/entities/system/model/types.d.ts +55 -0
- package/dist/entities/system/model/types.d.ts.map +1 -0
- package/dist/entities/system/model/types.js +1 -0
- package/dist/entities/system/model/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/api/api.d.ts +18 -0
- package/dist/shared/api/api.d.ts.map +1 -0
- package/dist/shared/api/api.js +74 -0
- package/dist/shared/api/api.js.map +1 -0
- package/dist/shared/api/index.d.ts +3 -0
- package/dist/shared/api/index.d.ts.map +1 -0
- package/dist/shared/api/index.js +3 -0
- package/dist/shared/api/index.js.map +1 -0
- package/dist/shared/api/validation-error/ValidationError.d.ts +7 -0
- package/dist/shared/api/validation-error/ValidationError.d.ts.map +1 -0
- package/dist/shared/api/validation-error/ValidationError.js +1 -0
- package/dist/shared/api/validation-error/ValidationError.js.map +1 -0
- package/dist/shared/api/validation-error/handleValidationError.d.ts +2 -0
- package/dist/shared/api/validation-error/handleValidationError.d.ts.map +1 -0
- package/dist/shared/api/validation-error/handleValidationError.js +24 -0
- package/dist/shared/api/validation-error/handleValidationError.js.map +1 -0
- package/dist/shared/api/validation-error/index.d.ts +3 -0
- package/dist/shared/api/validation-error/index.d.ts.map +1 -0
- package/dist/shared/api/validation-error/index.js +3 -0
- package/dist/shared/api/validation-error/index.js.map +1 -0
- package/dist/shared/api/validation-error/isValidationError.d.ts +3 -0
- package/dist/shared/api/validation-error/isValidationError.d.ts.map +1 -0
- package/dist/shared/api/validation-error/isValidationError.js +11 -0
- package/dist/shared/api/validation-error/isValidationError.js.map +1 -0
- package/dist/shared/lib/getNextPageParam.d.ts +3 -0
- package/dist/shared/lib/getNextPageParam.d.ts.map +1 -0
- package/dist/shared/lib/getNextPageParam.js +4 -0
- package/dist/shared/lib/getNextPageParam.js.map +1 -0
- package/dist/shared/lib/index.d.ts +3 -0
- package/dist/shared/lib/index.d.ts.map +1 -0
- package/dist/shared/lib/index.js +3 -0
- package/dist/shared/lib/index.js.map +1 -0
- package/dist/shared/lib/objectToFormData.d.ts +2 -0
- package/dist/shared/lib/objectToFormData.d.ts.map +1 -0
- package/dist/shared/lib/objectToFormData.js +36 -0
- package/dist/shared/lib/objectToFormData.js.map +1 -0
- package/dist/shared/model/index.d.ts +2 -0
- package/dist/shared/model/index.d.ts.map +1 -0
- package/dist/shared/model/index.js +2 -0
- package/dist/shared/model/index.js.map +1 -0
- package/dist/shared/model/types.d.ts +75 -0
- package/dist/shared/model/types.d.ts.map +1 -0
- package/dist/shared/model/types.js +31 -0
- package/dist/shared/model/types.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Данные клиента / дроппера
|
|
3
|
+
*/
|
|
4
|
+
export interface Customer {
|
|
5
|
+
/**
|
|
6
|
+
* ID клиента
|
|
7
|
+
*
|
|
8
|
+
* @example 19794
|
|
9
|
+
*/
|
|
10
|
+
customer_id: number;
|
|
11
|
+
/**
|
|
12
|
+
* URL аватара клиента
|
|
13
|
+
*
|
|
14
|
+
* @example "https://cdn.buymeua.shop/storage/avatar/abc123.jpg"
|
|
15
|
+
*/
|
|
16
|
+
avatar_url: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* ID группы клиента
|
|
19
|
+
*
|
|
20
|
+
* @example 3
|
|
21
|
+
*/
|
|
22
|
+
customer_group_id: number;
|
|
23
|
+
/**
|
|
24
|
+
* Telegram ID клиента
|
|
25
|
+
*
|
|
26
|
+
* @example 123456789
|
|
27
|
+
*/
|
|
28
|
+
telegram_id: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Флаг гостевого аккаунта
|
|
31
|
+
*
|
|
32
|
+
* @example false
|
|
33
|
+
*/
|
|
34
|
+
guest: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Название группы клиента
|
|
37
|
+
*
|
|
38
|
+
* @example "Дропшипинг"
|
|
39
|
+
*/
|
|
40
|
+
customer_group: string;
|
|
41
|
+
/**
|
|
42
|
+
* Полное имя клиента
|
|
43
|
+
*
|
|
44
|
+
* @example "Maksym2 Kerus2"
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
/**
|
|
48
|
+
* Имя клиента
|
|
49
|
+
*
|
|
50
|
+
* @example "Maksym2"
|
|
51
|
+
*/
|
|
52
|
+
firstname: string;
|
|
53
|
+
/**
|
|
54
|
+
* Фамилия клиента
|
|
55
|
+
*
|
|
56
|
+
* @example "Kerus2"
|
|
57
|
+
*/
|
|
58
|
+
lastname: string;
|
|
59
|
+
/**
|
|
60
|
+
* Отчество клиента
|
|
61
|
+
*
|
|
62
|
+
* @example "Петрович"
|
|
63
|
+
*/
|
|
64
|
+
middlename: string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Email клиента
|
|
67
|
+
*
|
|
68
|
+
* @example "user@example.com"
|
|
69
|
+
*/
|
|
70
|
+
email: string;
|
|
71
|
+
/**
|
|
72
|
+
* Телефон клиента
|
|
73
|
+
*
|
|
74
|
+
* @example "+38(097)-160-22-22"
|
|
75
|
+
*/
|
|
76
|
+
telephone: string;
|
|
77
|
+
/**
|
|
78
|
+
* Количество товаров в списке желаний
|
|
79
|
+
*
|
|
80
|
+
* @example 0
|
|
81
|
+
*/
|
|
82
|
+
wishlist: number;
|
|
83
|
+
/**
|
|
84
|
+
* ФИО владельца карты для выплат
|
|
85
|
+
*
|
|
86
|
+
* @example "Іваненко Олександр Петрович"
|
|
87
|
+
*/
|
|
88
|
+
card_fio: string | null;
|
|
89
|
+
/**
|
|
90
|
+
* Номер карты для выплат
|
|
91
|
+
*
|
|
92
|
+
* @example "5168742012345678"
|
|
93
|
+
*/
|
|
94
|
+
card_number: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Телефон, привязанный к карте
|
|
97
|
+
*
|
|
98
|
+
* @example "+380991234567"
|
|
99
|
+
*/
|
|
100
|
+
card_phone: string | null;
|
|
101
|
+
/**
|
|
102
|
+
* Регистрационный номер плательщика НДС
|
|
103
|
+
*
|
|
104
|
+
* @example "1234567890"
|
|
105
|
+
*/
|
|
106
|
+
rr: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* Адрес криптокошелька
|
|
109
|
+
*
|
|
110
|
+
* @example 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
|
|
111
|
+
*/
|
|
112
|
+
crypto_wallet: string | null;
|
|
113
|
+
/**
|
|
114
|
+
* Флаг подтверждения телефона
|
|
115
|
+
*
|
|
116
|
+
* @example true
|
|
117
|
+
*/
|
|
118
|
+
is_confirm_telephone: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* ЄДРПОУ код организации (для юридических лиц)
|
|
121
|
+
*
|
|
122
|
+
* @example "234233432423"
|
|
123
|
+
*/
|
|
124
|
+
ederpou: string | null;
|
|
125
|
+
/**
|
|
126
|
+
* IBAN банковского счета
|
|
127
|
+
*
|
|
128
|
+
* @example "UA12313123"
|
|
129
|
+
*/
|
|
130
|
+
iban: string | null;
|
|
131
|
+
/**
|
|
132
|
+
* Telegram username менеджера
|
|
133
|
+
*
|
|
134
|
+
* @example "@manager_username"
|
|
135
|
+
*/
|
|
136
|
+
manager_telegram_username: string | null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Інформація про користувача
|
|
140
|
+
*/
|
|
141
|
+
export interface CustomerAccount {
|
|
142
|
+
/**
|
|
143
|
+
* @example 10045
|
|
144
|
+
*/
|
|
145
|
+
customer_id: number;
|
|
146
|
+
/**
|
|
147
|
+
* @example "https://cdn.buyme.ua/avatar/10045.jpg"
|
|
148
|
+
*/
|
|
149
|
+
avatar: string;
|
|
150
|
+
/**
|
|
151
|
+
* @example 2
|
|
152
|
+
*/
|
|
153
|
+
customer_group_id: number;
|
|
154
|
+
/**
|
|
155
|
+
* @example 856312345
|
|
156
|
+
*/
|
|
157
|
+
telegram_id: number | null;
|
|
158
|
+
/**
|
|
159
|
+
* @example false
|
|
160
|
+
*/
|
|
161
|
+
guest: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* @example "Оптовий покупець"
|
|
164
|
+
*/
|
|
165
|
+
customer_group: string | null;
|
|
166
|
+
/**
|
|
167
|
+
* @example "Олена Іваненко"
|
|
168
|
+
*/
|
|
169
|
+
name: string;
|
|
170
|
+
/**
|
|
171
|
+
* @example "Олена"
|
|
172
|
+
*/
|
|
173
|
+
firstname: string;
|
|
174
|
+
/**
|
|
175
|
+
* @example "Іваненко"
|
|
176
|
+
*/
|
|
177
|
+
lastname: string;
|
|
178
|
+
/**
|
|
179
|
+
* @example "Олексіївна"
|
|
180
|
+
*/
|
|
181
|
+
middlename: string;
|
|
182
|
+
/**
|
|
183
|
+
* @example "olena@example.com"
|
|
184
|
+
*/
|
|
185
|
+
email: string;
|
|
186
|
+
/**
|
|
187
|
+
* @example "+380931234567"
|
|
188
|
+
*/
|
|
189
|
+
telephone: string;
|
|
190
|
+
/**
|
|
191
|
+
* @example true
|
|
192
|
+
*/
|
|
193
|
+
is_confirm_telephone: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* @example "Іваненко Олена Олексіївна"
|
|
196
|
+
*/
|
|
197
|
+
card_fio: string;
|
|
198
|
+
/**
|
|
199
|
+
* @example "12345678"
|
|
200
|
+
*/
|
|
201
|
+
ederpou: string;
|
|
202
|
+
/**
|
|
203
|
+
* @example "UA123456789012345678901234567"
|
|
204
|
+
*/
|
|
205
|
+
iban: string;
|
|
206
|
+
/**
|
|
207
|
+
* @example "ЛАВРИНЮК АЛІНА ОЛЕКСІЇВНА"
|
|
208
|
+
*/
|
|
209
|
+
open_data_full_name: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Зберегти налаштування користувача
|
|
213
|
+
*/
|
|
214
|
+
export interface SaveCustomerSettingsRequest {
|
|
215
|
+
customer_group_id?: number;
|
|
216
|
+
firstname?: string;
|
|
217
|
+
lastname?: string;
|
|
218
|
+
middlename?: string;
|
|
219
|
+
email?: string;
|
|
220
|
+
iban?: string;
|
|
221
|
+
card_fio?: string;
|
|
222
|
+
ederpou?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Аватар користувача (jpeg, png, jpg, gif, max: 2048kb)
|
|
225
|
+
*/
|
|
226
|
+
avatar?: File;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Успішне збереження налаштувань
|
|
230
|
+
*/
|
|
231
|
+
export interface SaveCustomerSettingsResponse {
|
|
232
|
+
/**
|
|
233
|
+
* @see {@link CustomerAccount}
|
|
234
|
+
*/
|
|
235
|
+
data: CustomerAccount;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/entities/customer/model/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/entities/customer/model/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AddFavoriteMerchantItemRequest, AddFavoriteMerchantItemResponse, GetFavoriteCountResponse, GetFavoriteMerchantItemsRequest, GetFavoriteMerchantItemsResponse, GetFavoriteMerchantsRequest, GetFavoriteMerchantsResponse } from '../model/types';
|
|
2
|
+
export declare const favoriteApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, import("@reduxjs/toolkit/query").UpdateDefinitions<import("@reduxjs/toolkit/query").UpdateDefinitions<import("@reduxjs/toolkit/query").UpdateDefinitions<{
|
|
3
|
+
getCartCount: import("@reduxjs/toolkit/query").QueryDefinition<void, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").GetCartCountResponse, "buymeuaApi", unknown>;
|
|
4
|
+
getCartMerchants: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | import("../../cart").GetCartMerchantsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").GetCartMerchantsResponse, "buymeuaApi", unknown>;
|
|
5
|
+
getCartMerchantItems: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<import("../../cart").GetCartMerchantItemsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").GetCartMerchantItemsResponse, "buymeuaApi", unknown>;
|
|
6
|
+
addToCart: import("@reduxjs/toolkit/query").MutationDefinition<import("../../cart").AddToCartRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").AddToCartResponse, "buymeuaApi", unknown>;
|
|
7
|
+
removeItemFromCart: import("@reduxjs/toolkit/query").MutationDefinition<import("../../cart").RemoveItemFromCartRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, undefined, "buymeuaApi", unknown>;
|
|
8
|
+
removeMerchantFromCart: import("@reduxjs/toolkit/query").MutationDefinition<import("../../cart").RemoveMerchantFromCartRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, undefined, "buymeuaApi", unknown>;
|
|
9
|
+
updateCartItemQuantity: import("@reduxjs/toolkit/query").MutationDefinition<import("../../cart").UpdateCartItemQuantityRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").UpdateCartItemQuantityResponse, "buymeuaApi", unknown>;
|
|
10
|
+
toggleGiftPackage: import("@reduxjs/toolkit/query").MutationDefinition<import("../../cart").ToggleGiftPackageRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, never, import("../../cart").ToggleGiftPackageResponse, "buymeuaApi", unknown>;
|
|
11
|
+
}, "CartCount" | "CartMerchant" | "CartMerchantItem", never> & {
|
|
12
|
+
getProducts: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | import("../../product").GetProductsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductsResponse, "buymeuaApi", unknown>;
|
|
13
|
+
getPaginatedProducts: import("@reduxjs/toolkit/query").QueryDefinition<void | import("../../product").GetPaginatedProductsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductsResponse, "buymeuaApi", unknown>;
|
|
14
|
+
getProductsByQr: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | import("../../product").GetProductsByQrRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductsByQrResponse, "buymeuaApi", unknown>;
|
|
15
|
+
getProduct: import("@reduxjs/toolkit/query").QueryDefinition<import("../../product").GetProductRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductResponse, "buymeuaApi", unknown>;
|
|
16
|
+
getProductStatistics: import("@reduxjs/toolkit/query").QueryDefinition<import("../../product").GetProductStatisticsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductStatisticsResponse, "buymeuaApi", unknown>;
|
|
17
|
+
getProductDetails: import("@reduxjs/toolkit/query").QueryDefinition<import("../../product").GetProductDetailsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductDetailsResponse, "buymeuaApi", unknown>;
|
|
18
|
+
getProductAttributes: import("@reduxjs/toolkit/query").QueryDefinition<void | import("../../product").GetProductAttributesRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductAttributesResponse, "buymeuaApi", unknown>;
|
|
19
|
+
getProductOptions: import("@reduxjs/toolkit/query").QueryDefinition<void | import("../../product").GetProductOptionsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetProductOptionsResponse, "buymeuaApi", unknown>;
|
|
20
|
+
getSupplierProducts: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | import("../../product").GetSupplierProductsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetSupplierProductsResponse, "buymeuaApi", unknown>;
|
|
21
|
+
getPaginatedSupplierProducts: import("@reduxjs/toolkit/query").QueryDefinition<void | import("../../product").GetPaginatedSupplierProductsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetSupplierProductsResponse, "buymeuaApi", unknown>;
|
|
22
|
+
getSupplierProductDetails: import("@reduxjs/toolkit/query").QueryDefinition<import("../../product").GetSupplierProductDetailsRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GetSupplierProductDetailsResponse, "buymeuaApi", unknown>;
|
|
23
|
+
generateProductDescription: import("@reduxjs/toolkit/query").QueryDefinition<import("../../product").GenerateProductDescriptionRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product").GenerateProductDescriptionResponse, "buymeuaApi", unknown>;
|
|
24
|
+
getStoreProducts: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | import("../../product/model/store-product").GetStoreProductsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem", import("../../product/model/store-product").GetStoreProductsResponse, "buymeuaApi", unknown>;
|
|
25
|
+
}, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", never> & {
|
|
26
|
+
getFavoriteCount: import("@reduxjs/toolkit/query").QueryDefinition<void, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", GetFavoriteCountResponse, "buymeuaApi", unknown>;
|
|
27
|
+
getFavoriteMerchants: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<void | GetFavoriteMerchantsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", GetFavoriteMerchantsResponse, "buymeuaApi", unknown>;
|
|
28
|
+
getFavoriteMerchantItems: import("@reduxjs/toolkit/query").InfiniteQueryDefinition<GetFavoriteMerchantItemsRequest, number, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", GetFavoriteMerchantItemsResponse, "buymeuaApi", unknown>;
|
|
29
|
+
addFavoriteMerchantItem: import("@reduxjs/toolkit/query").MutationDefinition<AddFavoriteMerchantItemRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", AddFavoriteMerchantItemResponse, "buymeuaApi", unknown>;
|
|
30
|
+
deleteFavoriteMerchantItem: import("@reduxjs/toolkit/query").MutationDefinition<AddFavoriteMerchantItemRequest, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError>, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails", undefined, "buymeuaApi", unknown>;
|
|
31
|
+
}, "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails" | "FavoriteCount" | "FavoriteMerchant" | "FavoriteMerchantItem", never>, "buymeuaApi", "CartCount" | "CartMerchant" | "CartMerchantItem" | "Product" | "ProductDetails" | "SupplierProduct" | "SupplierProductDetails" | "FavoriteCount" | "FavoriteMerchant" | "FavoriteMerchantItem", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
|
32
|
+
//# sourceMappingURL=favoriteApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"favoriteApi.d.ts","sourceRoot":"","sources":["../../../../src/entities/favorite/api/favoriteApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAG/B,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uhBAugBpB,CAAC"}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { productApi } from '../../product';
|
|
2
|
+
import { getNextPageParam } from '../../../shared/lib';
|
|
3
|
+
export const favoriteApi = productApi
|
|
4
|
+
.injectEndpoints({
|
|
5
|
+
endpoints: (build) => ({
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
7
|
+
getFavoriteCount: build.query({
|
|
8
|
+
query: (_arg) => ({
|
|
9
|
+
url: 'v1/favorite/count',
|
|
10
|
+
}),
|
|
11
|
+
}),
|
|
12
|
+
getFavoriteMerchants: build.infiniteQuery({
|
|
13
|
+
infiniteQueryOptions: {
|
|
14
|
+
initialPageParam: 1,
|
|
15
|
+
getNextPageParam,
|
|
16
|
+
},
|
|
17
|
+
query: (arg) => ({
|
|
18
|
+
url: 'v1/favorite/merchants',
|
|
19
|
+
params: {
|
|
20
|
+
...arg.queryArg,
|
|
21
|
+
page: arg.pageParam,
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
getFavoriteMerchantItems: build.infiniteQuery({
|
|
26
|
+
infiniteQueryOptions: {
|
|
27
|
+
initialPageParam: 1,
|
|
28
|
+
getNextPageParam,
|
|
29
|
+
},
|
|
30
|
+
query: (arg) => ({
|
|
31
|
+
url: 'v1/favorite/merchant-items',
|
|
32
|
+
params: {
|
|
33
|
+
...arg.queryArg,
|
|
34
|
+
page: arg.pageParam,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
addFavoriteMerchantItem: build.mutation({
|
|
39
|
+
query: ({ optimisticUpdate, ...arg }) => ({
|
|
40
|
+
url: 'v1/favorite',
|
|
41
|
+
method: 'POST',
|
|
42
|
+
body: arg,
|
|
43
|
+
}),
|
|
44
|
+
// TODO: Review, refactor, standalone func to this and deleteFavoriteMerchantItem
|
|
45
|
+
onQueryStarted: async (queryArgument, mutationLifeCycleApi) => {
|
|
46
|
+
if (!queryArgument.optimisticUpdate)
|
|
47
|
+
return;
|
|
48
|
+
const patchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getFavoriteMerchantItems', {
|
|
49
|
+
merchant_id: queryArgument.optimisticUpdate.product.merchant_id,
|
|
50
|
+
}, (draft) => {
|
|
51
|
+
const firstPage = draft.pages[0];
|
|
52
|
+
if (!firstPage || !queryArgument.optimisticUpdate?.product)
|
|
53
|
+
return;
|
|
54
|
+
const favoriteItem = {
|
|
55
|
+
...queryArgument.optimisticUpdate.product,
|
|
56
|
+
favorite_item_id: performance.now() + Math.random() * 1000,
|
|
57
|
+
};
|
|
58
|
+
firstPage.data.unshift(favoriteItem);
|
|
59
|
+
}));
|
|
60
|
+
const favoriteCountPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getFavoriteCount', undefined, (draft) => {
|
|
61
|
+
draft.total_quantity += 1;
|
|
62
|
+
}));
|
|
63
|
+
let productPatchResult;
|
|
64
|
+
let supplierProductPatchResult;
|
|
65
|
+
let productDetailsPatchResult;
|
|
66
|
+
let supplierProductDetailsPatchResult;
|
|
67
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
68
|
+
{
|
|
69
|
+
type: 'Product',
|
|
70
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
71
|
+
},
|
|
72
|
+
])) {
|
|
73
|
+
if (endpointName !== 'getProducts')
|
|
74
|
+
continue;
|
|
75
|
+
productPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getProducts', originalArgs, (draft) => {
|
|
76
|
+
draft.pages.forEach((page) => {
|
|
77
|
+
page.data.forEach((product) => {
|
|
78
|
+
if (product.id ===
|
|
79
|
+
queryArgument.optimisticUpdate?.product.id) {
|
|
80
|
+
product.in_favorite = true;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
87
|
+
{
|
|
88
|
+
type: 'SupplierProduct',
|
|
89
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
90
|
+
},
|
|
91
|
+
])) {
|
|
92
|
+
if (endpointName !== 'getSupplierProducts')
|
|
93
|
+
continue;
|
|
94
|
+
supplierProductPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getSupplierProducts', originalArgs, (draft) => {
|
|
95
|
+
draft.pages.forEach((page) => {
|
|
96
|
+
page.data.forEach((product) => {
|
|
97
|
+
if (product.id ===
|
|
98
|
+
queryArgument.optimisticUpdate?.product.id) {
|
|
99
|
+
product.in_favorite = true;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
106
|
+
{
|
|
107
|
+
type: 'ProductDetails',
|
|
108
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
109
|
+
},
|
|
110
|
+
])) {
|
|
111
|
+
if (endpointName !== 'getProductDetails')
|
|
112
|
+
continue;
|
|
113
|
+
productDetailsPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getProductDetails', originalArgs, (draft) => {
|
|
114
|
+
draft.data.in_favorite = true;
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
118
|
+
{
|
|
119
|
+
type: 'SupplierProductDetails',
|
|
120
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
121
|
+
},
|
|
122
|
+
])) {
|
|
123
|
+
if (endpointName !== 'getSupplierProductDetails')
|
|
124
|
+
continue;
|
|
125
|
+
supplierProductDetailsPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getSupplierProductDetails', originalArgs, (draft) => {
|
|
126
|
+
draft.data.in_favorite = true;
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
await mutationLifeCycleApi.queryFulfilled;
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
patchResult.undo();
|
|
134
|
+
favoriteCountPatchResult.undo();
|
|
135
|
+
if (productPatchResult)
|
|
136
|
+
productPatchResult.undo();
|
|
137
|
+
if (supplierProductPatchResult)
|
|
138
|
+
supplierProductPatchResult.undo();
|
|
139
|
+
if (productDetailsPatchResult)
|
|
140
|
+
productDetailsPatchResult.undo();
|
|
141
|
+
if (supplierProductDetailsPatchResult)
|
|
142
|
+
supplierProductDetailsPatchResult.undo();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
}),
|
|
146
|
+
deleteFavoriteMerchantItem: build.mutation({
|
|
147
|
+
query: ({ optimisticUpdate, ...arg }) => ({
|
|
148
|
+
url: 'v1/favorite',
|
|
149
|
+
method: 'DELETE',
|
|
150
|
+
body: arg,
|
|
151
|
+
}),
|
|
152
|
+
onQueryStarted: async (queryArgument, mutationLifeCycleApi) => {
|
|
153
|
+
if (!queryArgument.optimisticUpdate)
|
|
154
|
+
return;
|
|
155
|
+
let patchResult;
|
|
156
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
157
|
+
{
|
|
158
|
+
type: 'FavoriteMerchantItem',
|
|
159
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
160
|
+
},
|
|
161
|
+
])) {
|
|
162
|
+
if (endpointName !== 'getFavoriteMerchantItems')
|
|
163
|
+
continue;
|
|
164
|
+
patchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getFavoriteMerchantItems', originalArgs, (draft) => {
|
|
165
|
+
draft.pages.forEach((favoriteMerchantItems) => {
|
|
166
|
+
favoriteMerchantItems.data.forEach((item, index) => {
|
|
167
|
+
if (item.id === queryArgument.optimisticUpdate?.product.id) {
|
|
168
|
+
favoriteMerchantItems.data.splice(index, 1);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
const favoriteCountPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getFavoriteCount', undefined, (draft) => {
|
|
175
|
+
draft.total_quantity -= 1;
|
|
176
|
+
}));
|
|
177
|
+
let productPatchResult;
|
|
178
|
+
let supplierProductPatchResult;
|
|
179
|
+
let productDetailsPatchResult;
|
|
180
|
+
let supplierProductDetailsPatchResult;
|
|
181
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
182
|
+
{
|
|
183
|
+
type: 'Product',
|
|
184
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
185
|
+
},
|
|
186
|
+
])) {
|
|
187
|
+
if (endpointName !== 'getProducts')
|
|
188
|
+
continue;
|
|
189
|
+
productPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getProducts', originalArgs, (draft) => {
|
|
190
|
+
draft.pages.forEach((page) => {
|
|
191
|
+
page.data.forEach((product) => {
|
|
192
|
+
if (product.id ===
|
|
193
|
+
queryArgument.optimisticUpdate?.product.id) {
|
|
194
|
+
product.in_favorite = false;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
201
|
+
{
|
|
202
|
+
type: 'SupplierProduct',
|
|
203
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
204
|
+
},
|
|
205
|
+
])) {
|
|
206
|
+
if (endpointName !== 'getSupplierProducts')
|
|
207
|
+
continue;
|
|
208
|
+
supplierProductPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getSupplierProducts', originalArgs, (draft) => {
|
|
209
|
+
draft.pages.forEach((page) => {
|
|
210
|
+
page.data.forEach((product) => {
|
|
211
|
+
if (product.id ===
|
|
212
|
+
queryArgument.optimisticUpdate?.product.id) {
|
|
213
|
+
product.in_favorite = false;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
220
|
+
{
|
|
221
|
+
type: 'ProductDetails',
|
|
222
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
223
|
+
},
|
|
224
|
+
])) {
|
|
225
|
+
if (endpointName !== 'getProductDetails')
|
|
226
|
+
continue;
|
|
227
|
+
productDetailsPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getProductDetails', originalArgs, (draft) => {
|
|
228
|
+
draft.data.in_favorite = false;
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
for (const { endpointName, originalArgs, } of favoriteApi.util.selectInvalidatedBy(mutationLifeCycleApi.getState(), [
|
|
232
|
+
{
|
|
233
|
+
type: 'SupplierProductDetails',
|
|
234
|
+
id: queryArgument.optimisticUpdate.product.id,
|
|
235
|
+
},
|
|
236
|
+
])) {
|
|
237
|
+
if (endpointName !== 'getSupplierProductDetails')
|
|
238
|
+
continue;
|
|
239
|
+
supplierProductDetailsPatchResult = mutationLifeCycleApi.dispatch(favoriteApi.util.updateQueryData('getSupplierProductDetails', originalArgs, (draft) => {
|
|
240
|
+
draft.data.in_favorite = false;
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
await mutationLifeCycleApi.queryFulfilled;
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
if (patchResult)
|
|
248
|
+
patchResult.undo();
|
|
249
|
+
favoriteCountPatchResult.undo();
|
|
250
|
+
if (productPatchResult)
|
|
251
|
+
productPatchResult.undo();
|
|
252
|
+
if (supplierProductPatchResult)
|
|
253
|
+
supplierProductPatchResult.undo();
|
|
254
|
+
if (productDetailsPatchResult)
|
|
255
|
+
productDetailsPatchResult.undo();
|
|
256
|
+
if (supplierProductDetailsPatchResult)
|
|
257
|
+
supplierProductDetailsPatchResult.undo();
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
}),
|
|
261
|
+
}),
|
|
262
|
+
overrideExisting: false,
|
|
263
|
+
})
|
|
264
|
+
.enhanceEndpoints({
|
|
265
|
+
// TODO: Refactor invalidation
|
|
266
|
+
addTagTypes: ['FavoriteCount', 'FavoriteMerchant', 'FavoriteMerchantItem'],
|
|
267
|
+
endpoints: {
|
|
268
|
+
getFavoriteCount: {
|
|
269
|
+
providesTags: (_result, _error, _arg, _meta) => {
|
|
270
|
+
return [{ type: 'FavoriteCount', id: 'LIST' }];
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
getFavoriteMerchants: {
|
|
274
|
+
providesTags: (result, _error, _arg, _meta) => {
|
|
275
|
+
return result
|
|
276
|
+
? [
|
|
277
|
+
...result.pages
|
|
278
|
+
.flatMap((page) => page.data)
|
|
279
|
+
.map((favoriteMerchant) => ({
|
|
280
|
+
type: 'FavoriteMerchant',
|
|
281
|
+
id: favoriteMerchant.store_id,
|
|
282
|
+
})),
|
|
283
|
+
{ type: 'FavoriteMerchant', id: 'LIST' },
|
|
284
|
+
]
|
|
285
|
+
: [{ type: 'FavoriteMerchant', id: 'LIST' }];
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
getFavoriteMerchantItems: {
|
|
289
|
+
providesTags: (result, _error, _arg, _meta) => {
|
|
290
|
+
return result
|
|
291
|
+
? [
|
|
292
|
+
...result.pages
|
|
293
|
+
.flatMap((page) => page.data)
|
|
294
|
+
.map((favoriteMerchantItem) => ({
|
|
295
|
+
type: 'FavoriteMerchantItem',
|
|
296
|
+
id: favoriteMerchantItem.favorite_item_id,
|
|
297
|
+
productId: favoriteMerchantItem.id,
|
|
298
|
+
})),
|
|
299
|
+
{ type: 'FavoriteMerchantItem', id: 'LIST' },
|
|
300
|
+
]
|
|
301
|
+
: [{ type: 'FavoriteMerchantItem', id: 'LIST' }];
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
addFavoriteMerchantItem: {
|
|
305
|
+
invalidatesTags: (_result, _error, arg, _meta) => {
|
|
306
|
+
return arg.optimisticUpdate
|
|
307
|
+
? [
|
|
308
|
+
{ type: 'FavoriteMerchant', id: 'LIST' },
|
|
309
|
+
{ type: 'FavoriteMerchantItem', id: 'LIST' },
|
|
310
|
+
]
|
|
311
|
+
: [
|
|
312
|
+
{ type: 'FavoriteMerchant', id: 'LIST' },
|
|
313
|
+
{ type: 'FavoriteMerchantItem', id: 'LIST' },
|
|
314
|
+
{ type: 'FavoriteCount', id: 'LIST' },
|
|
315
|
+
{ type: 'Product', id: arg.product_id },
|
|
316
|
+
{ type: 'ProductDetails', id: arg.product_id },
|
|
317
|
+
{ type: 'SupplierProduct', id: arg.product_id },
|
|
318
|
+
{ type: 'SupplierProductDetails', id: arg.product_id },
|
|
319
|
+
{ type: 'CartMerchantItem', productId: arg.product_id },
|
|
320
|
+
];
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
deleteFavoriteMerchantItem: {
|
|
324
|
+
invalidatesTags: (_result, _error, arg, _meta) => {
|
|
325
|
+
return arg.optimisticUpdate
|
|
326
|
+
? [
|
|
327
|
+
{ type: 'FavoriteMerchant', id: 'LIST' },
|
|
328
|
+
{ type: 'FavoriteMerchantItem', id: 'LIST' },
|
|
329
|
+
]
|
|
330
|
+
: [
|
|
331
|
+
{ type: 'FavoriteMerchant', id: 'LIST' },
|
|
332
|
+
{ type: 'FavoriteMerchantItem', id: 'LIST' },
|
|
333
|
+
{ type: 'FavoriteCount', id: 'LIST' },
|
|
334
|
+
{ type: 'Product', id: arg.product_id },
|
|
335
|
+
{ type: 'ProductDetails', id: arg.product_id },
|
|
336
|
+
{ type: 'SupplierProduct', id: arg.product_id },
|
|
337
|
+
{ type: 'SupplierProductDetails', id: arg.product_id },
|
|
338
|
+
{ type: 'CartMerchantItem', productId: arg.product_id },
|
|
339
|
+
];
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
//# sourceMappingURL=favoriteApi.js.map
|