@akinon/next 1.110.0-snapshot-ZERO-3792-20251106153436 → 1.110.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,10 +1,11 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.110.0-snapshot-ZERO-3792-20251106153436
3
+ ## 1.110.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - 888fdec: ZERO-3792: Virtual Try On new features are implemented and also basket support implemented.
7
+ - fc752c9: ZERO-3795: Remove unnecessary redirection logic from payment middleware
8
+ - 757af4a: ZERO-3783: Update image remote patterns for security compliance
8
9
 
9
10
  ## 1.109.0
10
11
 
@@ -122,55 +122,6 @@ export async function GET(request: NextRequest) {
122
122
  'X-Virtual-Try-On-Cache-Status': 'MISS'
123
123
  }
124
124
  });
125
- } else if (endpoint === 'job-status') {
126
- const referenceUrl = searchParams.get('reference_url');
127
- if (!referenceUrl) {
128
- return NextResponse.json(
129
- { error: 'reference_url is required' },
130
- { status: 400 }
131
- );
132
- }
133
-
134
- const externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/async/v1/job-status?reference_url=${encodeURIComponent(referenceUrl)}`;
135
- const clientIP = getClientIP(request);
136
- const locale = getLocaleFromRequest(request);
137
-
138
- const headersToSend = {
139
- Accept: 'application/json',
140
- ...(locale && { 'Accept-Language': locale }),
141
- ...(request.headers.get('authorization') && {
142
- Authorization: request.headers.get('authorization')!
143
- }),
144
- ...(clientIP && {
145
- 'X-Forwarded-For': clientIP
146
- })
147
- };
148
-
149
- const response = await fetch(externalUrl, {
150
- method: 'GET',
151
- headers: headersToSend
152
- });
153
-
154
- let responseData: any;
155
- const responseText = await response.text();
156
-
157
- try {
158
- responseData = responseText ? JSON.parse(responseText) : {};
159
- } catch (parseError) {
160
- return NextResponse.json(
161
- { error: 'Invalid JSON response from job status API' },
162
- { status: 500 }
163
- );
164
- }
165
-
166
- return NextResponse.json(responseData, {
167
- status: response.status,
168
- headers: {
169
- 'Access-Control-Allow-Origin': '*',
170
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, OPTIONS',
171
- 'Access-Control-Allow-Headers': 'Content-Type, Accept, Authorization'
172
- }
173
- });
174
125
  }
175
126
 
176
127
  return NextResponse.json(
@@ -190,32 +141,13 @@ export async function POST(request: NextRequest) {
190
141
  const body = await request.json();
191
142
 
192
143
  let externalUrl: string;
193
- let httpMethod = 'POST';
194
-
195
144
  if (endpoint === 'feedback') {
196
- if (!body.url || typeof body.url !== 'string' || !body.url.trim()) {
197
- return NextResponse.json(
198
- { status: 'error', message: 'URL is required for feedback' },
199
- { status: 400 }
200
- );
201
- }
202
- if (typeof body.feedback !== 'boolean') {
203
- return NextResponse.json(
204
- { status: 'error', message: 'Feedback must be a boolean value' },
205
- { status: 400 }
206
- );
207
- }
208
145
  externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/v1/feedback`;
209
- httpMethod = 'PUT';
210
- } else if (endpoint === 'async-multiple-try-on') {
211
- externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/async/v1/multiple-virtual-try-on`;
212
146
  } else {
213
- return NextResponse.json(
214
- { error: 'Invalid endpoint specified' },
215
- { status: 400 }
216
- );
147
+ externalUrl = `${VIRTUAL_TRY_ON_API_URL}/api/v1/virtual-try-on`;
217
148
  }
218
149
 
150
+ const httpMethod = endpoint === 'feedback' ? 'PUT' : 'POST';
219
151
  const clientIP = getClientIP(request);
220
152
  const locale = getLocaleFromRequest(request);
221
153
 
@@ -231,18 +163,13 @@ export async function POST(request: NextRequest) {
231
163
  })
232
164
  };
233
165
 
234
- const fetchOptions: RequestInit = {
166
+ const response = await fetch(externalUrl, {
235
167
  method: httpMethod,
236
- headers: headersToSend
237
- };
238
-
239
- if (httpMethod !== 'GET') {
240
- fetchOptions.body = JSON.stringify(body);
241
- }
242
-
243
- const response = await fetch(externalUrl, fetchOptions);
168
+ headers: headersToSend,
169
+ body: JSON.stringify(body)
170
+ });
244
171
 
245
- let responseData: Record<string, any>;
172
+ let responseData: any;
246
173
  const responseText = await response.text();
247
174
 
248
175
  if (endpoint === 'feedback') {
@@ -346,7 +273,7 @@ export async function PUT(request: NextRequest) {
346
273
  body: JSON.stringify(body)
347
274
  });
348
275
 
349
- const responseData = response?.json() || {};
276
+ const responseData = await response.json();
350
277
 
351
278
  return NextResponse.json(responseData, {
352
279
  status: response.status,
@@ -360,8 +287,7 @@ export async function PUT(request: NextRequest) {
360
287
  return NextResponse.json(
361
288
  {
362
289
  status: 'error',
363
- message: 'Internal server error occurred during feedback submission',
364
- error: (error as Error).message
290
+ message: 'Internal server error occurred during feedback submission'
365
291
  },
366
292
  { status: 500 }
367
293
  );
@@ -50,7 +50,6 @@ export enum Component {
50
50
  MultiBasket = 'MultiBasket',
51
51
  SavedCard = 'SavedCardOption',
52
52
  VirtualTryOnPlugin = 'VirtualTryOnPlugin',
53
- BasketVirtualTryOn = 'BasketVirtualTryOn',
54
53
  IyzicoSavedCard = 'IyzicoSavedCardOption',
55
54
  Hepsipay = 'Hepsipay',
56
55
  FlowPayment = 'FlowPayment'
@@ -89,10 +88,7 @@ const PluginComponents = new Map([
89
88
  [Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
90
89
  [Plugin.SavedCard, [Component.SavedCard]],
91
90
  [Plugin.FlowPayment, [Component.FlowPayment]],
92
- [
93
- Plugin.VirtualTryOn,
94
- [Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn]
95
- ],
91
+ [Plugin.VirtualTryOn, [Component.VirtualTryOnPlugin]],
96
92
  [Plugin.Hepsipay, [Component.Hepsipay]]
97
93
  ]);
98
94
 
@@ -62,14 +62,6 @@ const withCompleteGpay =
62
62
  ip
63
63
  }
64
64
  );
65
-
66
- return NextResponse.redirect(
67
- `${url.origin}${getUrlPathWithLocale(
68
- '/orders/checkout/',
69
- req.cookies.get('pz-locale')?.value
70
- )}`,
71
- 303
72
- );
73
65
  }
74
66
 
75
67
  const request = await fetch(requestUrl, {
@@ -63,14 +63,6 @@ const withCompleteMasterpass =
63
63
  ip
64
64
  }
65
65
  );
66
-
67
- return NextResponse.redirect(
68
- `${url.origin}${getUrlPathWithLocale(
69
- '/orders/checkout/',
70
- req.cookies.get('pz-locale')?.value
71
- )}`,
72
- 303
73
- );
74
66
  }
75
67
 
76
68
  const request = await fetch(requestUrl, {
@@ -59,14 +59,6 @@ const withCompleteWallet =
59
59
  ip
60
60
  }
61
61
  );
62
-
63
- return NextResponse.redirect(
64
- `${url.origin}${getUrlPathWithLocale(
65
- '/orders/checkout/',
66
- req.cookies.get('pz-locale')?.value
67
- )}`,
68
- 303
69
- );
70
62
  }
71
63
 
72
64
  const request = await fetch(requestUrl, {
@@ -63,14 +63,6 @@ const withRedirectionPayment =
63
63
  ip
64
64
  }
65
65
  );
66
-
67
- return NextResponse.redirect(
68
- `${url.origin}${getUrlPathWithLocale(
69
- '/orders/checkout/',
70
- req.cookies.get('pz-locale')?.value
71
- )}`,
72
- 303
73
- );
74
66
  }
75
67
 
76
68
  const request = await fetch(requestUrl, {
@@ -63,14 +63,6 @@ const withSavedCardRedirection =
63
63
  ip
64
64
  }
65
65
  );
66
-
67
- return NextResponse.redirect(
68
- `${url.origin}${getUrlPathWithLocale(
69
- '/orders/checkout/',
70
- req.cookies.get('pz-locale')?.value
71
- )}`,
72
- 303
73
- );
74
66
  }
75
67
 
76
68
  const request = await fetch(requestUrl, {
@@ -62,14 +62,6 @@ const withThreeDRedirection =
62
62
  ip
63
63
  }
64
64
  );
65
-
66
- return NextResponse.redirect(
67
- `${url.origin}${getUrlPathWithLocale(
68
- '/orders/checkout/',
69
- req.cookies.get('pz-locale')?.value
70
- )}`,
71
- 303
72
- );
73
65
  }
74
66
 
75
67
  const request = await fetch(requestUrl, {
@@ -83,14 +83,6 @@ const withWalletCompleteRedirection =
83
83
  ip
84
84
  }
85
85
  );
86
-
87
- return NextResponse.redirect(
88
- `${url.origin}${getUrlPathWithLocale(
89
- '/orders/checkout/',
90
- req.cookies.get('pz-locale')?.value
91
- )}`,
92
- 303
93
- );
94
86
  }
95
87
 
96
88
  const request = await fetch(requestUrl, {
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.110.0-snapshot-ZERO-3792-20251106153436",
4
+ "version": "1.110.0",
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.110.0-snapshot-ZERO-3792-20251106153436",
38
+ "@akinon/eslint-plugin-projectzero": "1.110.0",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/with-pz-config.js CHANGED
@@ -14,10 +14,15 @@ const defaultConfig = {
14
14
  },
15
15
  images: {
16
16
  remotePatterns: [
17
+ //It has to be like this for security reasons
17
18
  {
18
19
  protocol: 'https',
19
- hostname: '**'
20
+ hostname: '**.akinoncloud.com'
20
21
  },
22
+ {
23
+ protocol: 'https',
24
+ hostname: '**.akinoncdn.com'
25
+ }
21
26
  ]
22
27
  },
23
28
  modularizeImports: {