@akinon/next 1.47.0-rc.6 → 1.47.0-rc.8

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,68 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.47.0-rc.8
4
+
5
+ ### Minor Changes
6
+
7
+ - d93a507: ZERO-2900: Fix pretty url rewrite
8
+
9
+ ## 1.47.0-rc.7
10
+
11
+ ### Minor Changes
12
+
13
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
14
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
15
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
16
+ - fda5b92: ZERO-2725: fix invalid import
17
+ - 2d9b2b2: ZERO-2816: Add segment to headers
18
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
19
+ - 8d9ac9a: ZERO-2794: Add field to order type
20
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
21
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
22
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
23
+ - 3bf2dd9: ZERO-2551: Fix search page
24
+ - e9541a1: ZERO-2816: Add headers to url
25
+ - c53ef7b9: ZERO-2668: The Link component has been updated to improve the logic for handling href values. Previously, if the href was not a string or started with 'http', it would return the href as is. Now, if the href is not provided, it will default to '#' to prevent any potential errors. Additionally, if the href is a string and does not start with 'http', it will be formatted with the locale and pathname, based on the localeUrlStrategy and defaultLocaleValue. This ensures that the correct href is generated based on the localization settings.
26
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
27
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
28
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
29
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
30
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
31
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
32
+ - d3474c6: ZERO-2655: Add data source shipping option
33
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
34
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
35
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
36
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
37
+ - bbe18b9f: ZERO-2575: Fix build error
38
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
39
+ - 4920742: Disable getCachedTranslations
40
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
41
+ - 7e56d6b: ZERO-2841: Update api tagTypes
42
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
43
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
44
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
45
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
46
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
47
+ - fad2768: ZERO-2739: add gpay to payment plugin map
48
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
49
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
50
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
51
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
52
+ - beb499e6: ZERO-2551: Add new tsconfig paths
53
+ - 948eb42: ZERO-2852: Add out of stock endpoints
54
+ - 146ea39: ZERO-2774: Update imports
55
+ - f2c92d5: ZERO-2816: Update cookie name
56
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
57
+ - c47be30: ZERO-2744: Update Order and OrderItem types
58
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
59
+ - 040ec95: ZERO-2875: Add edit collection endpoints
60
+ - f046f8e0: ZERO-2575: update version for react-number-format
61
+ - b9273fd: ZERO-2889: add host headers to requests
62
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
63
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
64
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
65
+
3
66
  ## 1.47.0-rc.6
4
67
 
5
68
  ### Minor Changes
@@ -219,10 +219,41 @@ const withPzDefault =
219
219
  ''
220
220
  );
221
221
 
222
+ middlewareResult = (await middleware(
223
+ req,
224
+ event
225
+ )) as NextResponse | void;
226
+
227
+ let customRewriteUrlDiff = '';
228
+
229
+ if (
230
+ middlewareResult instanceof NextResponse &&
231
+ middlewareResult.headers.get(
232
+ 'pz-override-response'
233
+ ) &&
234
+ middlewareResult.headers.get(
235
+ 'x-middleware-rewrite'
236
+ )
237
+ ) {
238
+ const rewriteUrl = new URL(
239
+ middlewareResult.headers.get(
240
+ 'x-middleware-rewrite'
241
+ )
242
+ );
243
+ const originalUrl = new URL(req.url);
244
+ customRewriteUrlDiff =
245
+ rewriteUrl.pathname.replace(
246
+ originalUrl.pathname,
247
+ ''
248
+ );
249
+ }
250
+
222
251
  url.basePath = `/${commerceUrl}`;
223
252
  url.pathname = `/${
224
253
  locale.length ? `${locale}/` : ''
225
- }${currency}${prettyUrl ?? pathnameWithoutLocale}`;
254
+ }${currency}/${customRewriteUrlDiff}${
255
+ prettyUrl ?? pathnameWithoutLocale
256
+ }`.replace(/\/+/g, '/');
226
257
 
227
258
  if (
228
259
  !req.middlewareParams.found &&
@@ -258,41 +289,27 @@ const withPzDefault =
258
289
  );
259
290
  });
260
291
 
261
- middlewareResult = (await middleware(
262
- req,
263
- event
264
- )) as NextResponse | void;
265
-
266
292
  // if middleware.ts has a return value for current url
267
293
  if (middlewareResult instanceof NextResponse) {
268
294
  // pz-override-response header is used to prevent 404 page for custom responses.
269
295
  if (
270
296
  middlewareResult.headers.get(
271
297
  'pz-override-response'
272
- ) === 'true'
298
+ ) !== 'true'
273
299
  ) {
274
- if (
275
- middlewareResult.headers.get(
276
- 'x-middleware-rewrite'
277
- )
278
- ) {
279
- const rewriteUrl = new URL(
280
- middlewareResult.headers.get(
281
- 'x-middleware-rewrite'
282
- )
283
- );
284
-
285
- url.pathname = (
286
- url.pathname + rewriteUrl.pathname
287
- ).replace(/\/\//g, '/');
288
-
289
- return NextResponse.rewrite(url);
290
- }
291
- } else {
292
300
  middlewareResult.headers.set(
293
301
  'x-middleware-rewrite',
294
302
  url.href
295
303
  );
304
+ } else if (
305
+ middlewareResult.headers.get(
306
+ 'x-middleware-rewrite'
307
+ ) &&
308
+ middlewareResult.headers.get(
309
+ 'pz-override-response'
310
+ ) === 'true'
311
+ ) {
312
+ middlewareResult = NextResponse.rewrite(url);
296
313
  }
297
314
  } else {
298
315
  // if middleware.ts doesn't have a return 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": "1.47.0-rc.6",
4
+ "version": "1.47.0-rc.8",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "set-cookie-parser": "2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@akinon/eslint-plugin-projectzero": "1.47.0-rc.6",
33
+ "@akinon/eslint-plugin-projectzero": "1.47.0-rc.8",
34
34
  "@types/react-redux": "7.1.30",
35
35
  "@types/set-cookie-parser": "2.4.7",
36
36
  "@typescript-eslint/eslint-plugin": "6.7.4",