@akinon/next 1.103.0-snapshot-ZERO-3648-20251002182439 → 1.103.0-snapshot-ZERO-3648-20251002191321
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 +1 -1
- package/api/virtual-try-on.ts +14 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/api/virtual-try-on.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import Settings from 'settings';
|
|
2
3
|
|
|
3
4
|
const VIRTUAL_TRY_ON_API_URL = process.env.NEXT_PUBLIC_VIRTUAL_TRY_ON_API_URL;
|
|
4
5
|
|
|
@@ -34,14 +35,17 @@ function getClientIP(request: NextRequest): string | null {
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
function getLocaleFromRequest(request: NextRequest): string {
|
|
38
|
-
const
|
|
39
|
-
const localeMatch = referer.match(/\/(\w{2})[-/]/);
|
|
40
|
-
return localeMatch ? localeMatch[1] : 'en';
|
|
41
|
-
}
|
|
38
|
+
function getLocaleFromRequest(request: NextRequest): string | null {
|
|
39
|
+
const cookieLocale = request.cookies.get('pz-locale')?.value;
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
if (cookieLocale) {
|
|
42
|
+
const currentLocale = Settings.localization.locales.find(
|
|
43
|
+
(l) => l.value === cookieLocale
|
|
44
|
+
);
|
|
45
|
+
return currentLocale?.apiValue || null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return null;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export async function GET(request: NextRequest) {
|
|
@@ -73,11 +77,10 @@ export async function GET(request: NextRequest) {
|
|
|
73
77
|
const externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/v1/limited-categories`;
|
|
74
78
|
const clientIP = getClientIP(request);
|
|
75
79
|
const locale = getLocaleFromRequest(request);
|
|
76
|
-
const acceptLanguage = getAcceptLanguageHeader(locale);
|
|
77
80
|
|
|
78
81
|
const headersToSend = {
|
|
79
82
|
Accept: 'application/json',
|
|
80
|
-
'Accept-Language':
|
|
83
|
+
...(locale && { 'Accept-Language': locale }),
|
|
81
84
|
...(request.headers.get('authorization') && {
|
|
82
85
|
Authorization: request.headers.get('authorization')!
|
|
83
86
|
}),
|
|
@@ -147,11 +150,10 @@ export async function POST(request: NextRequest) {
|
|
|
147
150
|
const httpMethod = endpoint === 'feedback' ? 'PUT' : 'POST';
|
|
148
151
|
const clientIP = getClientIP(request);
|
|
149
152
|
const locale = getLocaleFromRequest(request);
|
|
150
|
-
const acceptLanguage = getAcceptLanguageHeader(locale);
|
|
151
153
|
|
|
152
154
|
const headersToSend = {
|
|
153
155
|
'Content-Type': 'application/json',
|
|
154
|
-
'Accept-Language':
|
|
156
|
+
...(locale && { 'Accept-Language': locale }),
|
|
155
157
|
...(httpMethod === 'POST' && { Accept: 'application/json' }),
|
|
156
158
|
...(request.headers.get('authorization') && {
|
|
157
159
|
Authorization: request.headers.get('authorization')!
|
|
@@ -253,11 +255,10 @@ export async function PUT(request: NextRequest) {
|
|
|
253
255
|
const externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/v1/feedback`;
|
|
254
256
|
const clientIP = getClientIP(request);
|
|
255
257
|
const locale = getLocaleFromRequest(request);
|
|
256
|
-
const acceptLanguage = getAcceptLanguageHeader(locale);
|
|
257
258
|
|
|
258
259
|
const headersToSend = {
|
|
259
260
|
'Content-Type': 'application/json',
|
|
260
|
-
'Accept-Language':
|
|
261
|
+
...(locale && { 'Accept-Language': locale }),
|
|
261
262
|
...(request.headers.get('authorization') && {
|
|
262
263
|
Authorization: request.headers.get('authorization')!
|
|
263
264
|
}),
|
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.103.0-snapshot-ZERO-3648-
|
|
4
|
+
"version": "1.103.0-snapshot-ZERO-3648-20251002191321",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"set-cookie-parser": "2.6.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@akinon/eslint-plugin-projectzero": "1.103.0-snapshot-ZERO-3648-
|
|
38
|
+
"@akinon/eslint-plugin-projectzero": "1.103.0-snapshot-ZERO-3648-20251002191321",
|
|
39
39
|
"@babel/core": "7.26.10",
|
|
40
40
|
"@babel/preset-env": "7.26.9",
|
|
41
41
|
"@babel/preset-typescript": "7.27.0",
|