@akinon/next 2.0.78-rc.0 → 2.0.78-rc.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.
- package/CHANGELOG.md +2 -0
- package/data/client/wishlist.ts +22 -0
- package/data/urls.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/data/client/wishlist.ts
CHANGED
|
@@ -26,6 +26,19 @@ interface GetFavoritesResponse {
|
|
|
26
26
|
results: FavoriteItem[];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface FavouriteProductIdItem {
|
|
30
|
+
product_id: number;
|
|
31
|
+
favourite_id: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface GetFavouriteProductIdsResponse {
|
|
35
|
+
favourite_products: FavouriteProductIdItem[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface GetFavouriteProductIdsParams {
|
|
39
|
+
productIds: Array<number | string>;
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
interface AddFavoriteResponse {
|
|
30
43
|
pk: number;
|
|
31
44
|
product: number;
|
|
@@ -83,6 +96,14 @@ export const wishlistApi = api.injectEndpoints({
|
|
|
83
96
|
buildClientRequestUrl(wishlist.getFavorites({ page, limit })),
|
|
84
97
|
providesTags: ['Favorite']
|
|
85
98
|
}),
|
|
99
|
+
getFavouriteProductIds: build.query<
|
|
100
|
+
GetFavouriteProductIdsResponse,
|
|
101
|
+
GetFavouriteProductIdsParams
|
|
102
|
+
>({
|
|
103
|
+
query: ({ productIds }) =>
|
|
104
|
+
buildClientRequestUrl(wishlist.getFavouriteProductIds(productIds)),
|
|
105
|
+
providesTags: ['Favorite']
|
|
106
|
+
}),
|
|
86
107
|
addFavorite: build.mutation<AddFavoriteResponse, number>({
|
|
87
108
|
query: (productPk: number) => ({
|
|
88
109
|
url: buildClientRequestUrl(wishlist.addFavorite, {
|
|
@@ -196,6 +217,7 @@ export const wishlistApi = api.injectEndpoints({
|
|
|
196
217
|
|
|
197
218
|
export const {
|
|
198
219
|
useGetFavoritesQuery,
|
|
220
|
+
useGetFavouriteProductIdsQuery,
|
|
199
221
|
useAddFavoriteMutation,
|
|
200
222
|
useRemoveFavoriteMutation,
|
|
201
223
|
useAddStockAlertMutation,
|
package/data/urls.ts
CHANGED
|
@@ -194,6 +194,10 @@ export const product = {
|
|
|
194
194
|
export const wishlist = {
|
|
195
195
|
getFavorites: ({ page, limit }: { page?: number; limit?: number }) =>
|
|
196
196
|
`/wishlists/favourite-products/?limit=${limit || 12}&page=${page || 1}`,
|
|
197
|
+
getFavouriteProductIds: (productIds: Array<number | string>) =>
|
|
198
|
+
`/wishlists/favourite-product-ids/?${productIds
|
|
199
|
+
.map((id) => `product_id=${id}`)
|
|
200
|
+
.join('&')}`,
|
|
197
201
|
addFavorite: '/wishlists/favourite-products/',
|
|
198
202
|
removeFavorite: (favPk: number) => `/wishlists/favourite-products/${favPk}/`,
|
|
199
203
|
addStockAlert: '/wishlists/product-alerts/',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "2.0.78-rc.
|
|
4
|
+
"version": "2.0.78-rc.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"set-cookie-parser": "2.6.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@akinon/eslint-plugin-projectzero": "2.0.78-rc.
|
|
39
|
+
"@akinon/eslint-plugin-projectzero": "2.0.78-rc.1",
|
|
40
40
|
"@babel/core": "7.26.10",
|
|
41
41
|
"@babel/preset-env": "7.26.9",
|
|
42
42
|
"@babel/preset-typescript": "7.27.0",
|