@akinon/next 1.50.0 → 1.51.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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.51.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 70279e7: ZERO-2817: Add metrics endpoint in default middleware
|
|
8
|
+
- 9d94f7e: ZERO-2820: update parent pk usage for menu generator
|
|
9
|
+
- 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
|
|
10
|
+
- 3d35f70: ZERO-2908: Add cookie to redirect url
|
|
11
|
+
|
|
3
12
|
## 1.50.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/middlewares/default.ts
CHANGED
|
@@ -69,6 +69,10 @@ const withPzDefault =
|
|
|
69
69
|
return NextResponse.json({ status: 'ok' });
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if (url.pathname.startsWith('/metrics')) {
|
|
73
|
+
return new NextResponse(null, { status: 200 });
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
if (req.nextUrl.pathname.startsWith('/.well-known')) {
|
|
73
77
|
const url = new URL(`${Settings.commerceUrl}${req.nextUrl.pathname}`);
|
|
74
78
|
const req_ = await fetch(url.toString());
|
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": "1.
|
|
4
|
+
"version": "1.51.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
35
35
|
"@typescript-eslint/parser": "6.7.4",
|
|
36
36
|
"eslint": "^8.14.0",
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.51.0",
|
|
38
38
|
"eslint-config-prettier": "8.5.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/utils/app-fetch.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Settings from 'settings';
|
|
2
2
|
import { ServerVariables } from './server-variables';
|
|
3
3
|
import logger from '../utils/log';
|
|
4
|
-
import { headers } from 'next/headers';
|
|
4
|
+
import { headers, cookies } from 'next/headers';
|
|
5
5
|
|
|
6
6
|
export enum FetchResponseType {
|
|
7
7
|
JSON = 'json',
|
|
@@ -19,6 +19,7 @@ const appFetch = async <T>(
|
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
21
|
const nextHeaders = headers();
|
|
22
|
+
const nextCookies = cookies();
|
|
22
23
|
ip = nextHeaders.get('x-forwarded-for') ?? '';
|
|
23
24
|
|
|
24
25
|
const commerceUrl = Settings.commerceUrl;
|
|
@@ -37,7 +38,8 @@ const appFetch = async <T>(
|
|
|
37
38
|
...(init.headers ?? {}),
|
|
38
39
|
'Accept-Language': currentLocale.apiValue,
|
|
39
40
|
'x-currency': ServerVariables.currency,
|
|
40
|
-
'x-forwarded-for': ip
|
|
41
|
+
'x-forwarded-for': ip,
|
|
42
|
+
cookie: nextCookies.toString()
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
init.next = {
|
package/utils/menu-generator.ts
CHANGED
|
@@ -13,8 +13,8 @@ export const menuGenerator = (arr: MenuItemType[]) => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
Object.values(data).forEach((item) => {
|
|
16
|
-
if (item.
|
|
17
|
-
data[item.
|
|
16
|
+
if (item.parent_pk) {
|
|
17
|
+
data[item.parent_pk].children.push(item);
|
|
18
18
|
} else {
|
|
19
19
|
tree.push(item);
|
|
20
20
|
}
|