@akinon/next 1.92.0-rc.26 → 1.92.0-rc.28
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 +4 -0
- package/api/similar-product-list.ts +21 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { cookies } from 'next/headers';
|
|
2
3
|
import Settings from 'settings';
|
|
4
|
+
import { ServerVariables } from '../utils/server-variables';
|
|
3
5
|
|
|
4
6
|
export async function GET(request: NextRequest) {
|
|
5
7
|
try {
|
|
@@ -7,6 +9,12 @@ export async function GET(request: NextRequest) {
|
|
|
7
9
|
const dynamicFilter = request.headers.get('x-search-dynamic-filter');
|
|
8
10
|
const dynamicExclude = request.headers.get('x-search-dynamic-exclude');
|
|
9
11
|
|
|
12
|
+
const nextCookies = cookies();
|
|
13
|
+
const currency =
|
|
14
|
+
nextCookies.get('pz-currency')?.value || ServerVariables.currency;
|
|
15
|
+
const locale =
|
|
16
|
+
nextCookies.get('pz-locale')?.value || ServerVariables.locale;
|
|
17
|
+
|
|
10
18
|
if (!dynamicFilter && !dynamicExclude) {
|
|
11
19
|
return NextResponse.json(
|
|
12
20
|
{
|
|
@@ -40,6 +48,19 @@ export async function GET(request: NextRequest) {
|
|
|
40
48
|
headers['x-search-dynamic-exclude'] = dynamicExclude;
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
if (currency) {
|
|
52
|
+
headers['x-currency'] = currency;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (locale) {
|
|
56
|
+
const currentLocale = Settings.localization.locales.find(
|
|
57
|
+
(l) => l.value === locale
|
|
58
|
+
);
|
|
59
|
+
if (currentLocale) {
|
|
60
|
+
headers['Accept-Language'] = currentLocale.apiValue;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
const response = await fetch(apiUrl, {
|
|
44
65
|
method: 'GET',
|
|
45
66
|
headers
|
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.92.0-rc.
|
|
4
|
+
"version": "1.92.0-rc.28",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"set-cookie-parser": "2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.28",
|
|
38
38
|
"@babel/core": "7.26.10",
|
|
39
39
|
"@babel/preset-env": "7.26.9",
|
|
40
40
|
"@babel/preset-typescript": "7.27.0",
|