@akinon/next 2.0.78-rc.0 → 2.0.78-rc.2
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 +8 -0
- package/data/client/wishlist.ts +22 -0
- package/data/server/category.ts +1 -1
- package/data/server/list.ts +1 -1
- package/data/server/special-page.ts +1 -1
- package/data/urls.ts +4 -0
- package/middlewares/default.ts +0 -40
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 2.0.78-rc.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 86187b1c: ZERO-4879: Repair sync-merge corruption in default middleware and server data loaders — remove a duplicated block that left an unbalanced brace, and restore the awaited `result` binding the payload optimization reads
|
|
8
|
+
|
|
9
|
+
## 2.0.78-rc.1
|
|
10
|
+
|
|
3
11
|
## 2.0.78-rc.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
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/server/category.ts
CHANGED
|
@@ -98,7 +98,7 @@ export const getCategoryData = async ({
|
|
|
98
98
|
}) => {
|
|
99
99
|
searchParams = normalizeSearchParams(searchParams);
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
const result = await Cache.wrap(
|
|
102
102
|
CacheKey.Category(pk, searchParams, headers),
|
|
103
103
|
locale,
|
|
104
104
|
getCategoryDataHandler(pk, locale, currency, searchParams, headers),
|
package/data/server/list.ts
CHANGED
|
@@ -71,7 +71,7 @@ export const getListData = async ({
|
|
|
71
71
|
}) => {
|
|
72
72
|
searchParams = normalizeSearchParams(searchParams);
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const result = await Cache.wrap(
|
|
75
75
|
CacheKey.List(searchParams, headers),
|
|
76
76
|
locale,
|
|
77
77
|
getListDataHandler(locale, currency, searchParams, headers),
|
|
@@ -51,7 +51,7 @@ export const getSpecialPageData = async ({
|
|
|
51
51
|
}) => {
|
|
52
52
|
searchParams = normalizeSearchParams(searchParams);
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
const result = await Cache.wrap(
|
|
55
55
|
CacheKey.SpecialPage(pk, searchParams, headers),
|
|
56
56
|
locale,
|
|
57
57
|
getSpecialPageDataHandler(pk, locale, currency, searchParams, headers),
|
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/middlewares/default.ts
CHANGED
|
@@ -561,46 +561,6 @@ const withPzDefault =
|
|
|
561
561
|
}
|
|
562
562
|
);
|
|
563
563
|
|
|
564
|
-
middlewareResult.cookies.set(
|
|
565
|
-
'pz-currency',
|
|
566
|
-
currency,
|
|
567
|
-
{
|
|
568
|
-
domain: rootHostname,
|
|
569
|
-
sameSite: 'none',
|
|
570
|
-
secure: true,
|
|
571
|
-
expires: new Date(
|
|
572
|
-
Date.now() + 1000 * 60 * 60 * 24 * 7
|
|
573
|
-
) // 7 days
|
|
574
|
-
}
|
|
575
|
-
);
|
|
576
|
-
|
|
577
|
-
if (
|
|
578
|
-
req.cookies.get('pz-locale') &&
|
|
579
|
-
req.cookies.get('pz-locale').value !==
|
|
580
|
-
locale
|
|
581
|
-
) {
|
|
582
|
-
logger.debug('Locale changed', {
|
|
583
|
-
locale,
|
|
584
|
-
oldLocale:
|
|
585
|
-
req.cookies.get('pz-locale')?.value,
|
|
586
|
-
ip
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
middlewareResult.headers.set(
|
|
591
|
-
'pz-url',
|
|
592
|
-
req.nextUrl.toString()
|
|
593
|
-
);
|
|
594
|
-
|
|
595
|
-
if (req.cookies.get('pz-set-currency')) {
|
|
596
|
-
middlewareResult.cookies.delete(
|
|
597
|
-
'pz-set-currency'
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
if (
|
|
602
|
-
req.cookies.get('pz-post-checkout-flow')
|
|
603
|
-
) {
|
|
604
564
|
if (
|
|
605
565
|
req.cookies.get('pz-locale') &&
|
|
606
566
|
req.cookies.get('pz-locale').value !==
|
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.2",
|
|
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.2",
|
|
40
40
|
"@babel/core": "7.26.10",
|
|
41
41
|
"@babel/preset-env": "7.26.9",
|
|
42
42
|
"@babel/preset-typescript": "7.27.0",
|