@akinon/next 1.50.0 → 1.52.0-rc.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/api/client.ts +50 -17
  3. package/assets/styles/index.css +49 -0
  4. package/assets/styles/index.css.map +1 -0
  5. package/assets/styles/index.scss +50 -26
  6. package/bin/pz-generate-translations.js +41 -0
  7. package/bin/pz-prebuild.js +1 -0
  8. package/bin/pz-predev.js +1 -0
  9. package/components/file-input.tsx +8 -0
  10. package/components/index.ts +1 -0
  11. package/components/input.tsx +21 -7
  12. package/components/link.tsx +17 -13
  13. package/components/pagination.tsx +1 -2
  14. package/components/price.tsx +11 -4
  15. package/components/pz-root.tsx +15 -3
  16. package/components/selected-payment-option-view.tsx +26 -38
  17. package/data/client/account.ts +10 -9
  18. package/data/client/address.ts +32 -8
  19. package/data/client/api.ts +2 -2
  20. package/data/client/b2b.ts +35 -2
  21. package/data/client/basket.ts +6 -5
  22. package/data/client/checkout.ts +47 -4
  23. package/data/client/user.ts +3 -2
  24. package/data/server/category.ts +43 -19
  25. package/data/server/flatpage.ts +29 -7
  26. package/data/server/form.ts +29 -11
  27. package/data/server/landingpage.ts +26 -7
  28. package/data/server/list.ts +16 -6
  29. package/data/server/menu.ts +15 -2
  30. package/data/server/product.ts +46 -21
  31. package/data/server/seo.ts +17 -24
  32. package/data/server/special-page.ts +15 -5
  33. package/data/server/widget.ts +14 -7
  34. package/data/urls.ts +8 -1
  35. package/hocs/server/with-segment-defaults.tsx +4 -1
  36. package/hooks/index.ts +2 -1
  37. package/hooks/use-message-listener.ts +24 -0
  38. package/hooks/use-pagination.ts +2 -2
  39. package/hooks/use-payment-options.ts +2 -1
  40. package/lib/cache-handler.mjs +33 -0
  41. package/lib/cache.ts +8 -6
  42. package/middlewares/default.ts +91 -8
  43. package/middlewares/pretty-url.ts +11 -1
  44. package/middlewares/url-redirection.ts +6 -1
  45. package/package.json +5 -4
  46. package/plugins.d.ts +1 -0
  47. package/redux/middlewares/checkout.ts +70 -11
  48. package/redux/reducers/checkout.ts +24 -5
  49. package/redux/reducers/config.ts +2 -0
  50. package/routes/pretty-url.tsx +192 -0
  51. package/types/commerce/account.ts +1 -0
  52. package/types/commerce/address.ts +1 -1
  53. package/types/commerce/b2b.ts +12 -2
  54. package/types/commerce/checkout.ts +30 -0
  55. package/types/commerce/misc.ts +2 -0
  56. package/types/commerce/order.ts +12 -0
  57. package/types/index.ts +37 -3
  58. package/utils/app-fetch.ts +21 -10
  59. package/utils/generate-commerce-search-params.ts +3 -1
  60. package/utils/index.ts +27 -6
  61. package/utils/menu-generator.ts +2 -2
  62. package/utils/redirection-iframe.ts +85 -0
  63. package/utils/server-translation.ts +11 -1
  64. package/utils/server-variables.ts +2 -1
  65. package/with-pz-config.js +13 -2
package/CHANGELOG.md CHANGED
@@ -1,10 +1,197 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.52.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 90282b53: ZERO-2729: Audit packages for yarn and npm and also update app-template
8
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
9
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
10
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
11
+ - fda5b927: ZERO-2725: fix invalid import
12
+ - 2d9b2b2: ZERO-2816: Add segment to headers
13
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
14
+ - d93a507: ZERO-2900: Fix pretty url rewrite
15
+ - 8d9ac9a: ZERO-2794: Add field to order type
16
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
17
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
18
+ - 3bf2dd9: ZERO-2551: Fix search page
19
+ - e9541a1: ZERO-2816: Add headers to url
20
+ - 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.
21
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
22
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
23
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
24
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
25
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
26
+ - d3474c64: ZERO-2655: Add data source shipping option
27
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
28
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
29
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
30
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
31
+ - bbe18b9f: ZERO-2575: Fix build error
32
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
33
+ - 4920742: Disable getCachedTranslations
34
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
35
+ - 7e56d6b: ZERO-2841: Update api tagTypes
36
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
37
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
38
+ - 46b7aad7: ZERO-2775: Add condition and logger for menuitemmodel data
39
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
40
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
41
+ - fad27689: ZERO-2739: add gpay to payment plugin map
42
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
43
+ - fdd0b41: ZERO-2706: Add optimized translation support
44
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
45
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
46
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
47
+ - beb499e6: ZERO-2551: Add new tsconfig paths
48
+ - 146ea391: ZERO-2774: Update imports
49
+ - f2c92d5: ZERO-2816: Update cookie name
50
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
51
+ - c47be30d: ZERO-2744: Update Order and OrderItem types
52
+ - e9a46acb: ZERO-2738: add CVC input to registered cards in Masterpass
53
+ - f046f8e0: ZERO-2575: update version for react-number-format
54
+ - b9273fd: ZERO-2889: add host headers to requests
55
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
56
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
57
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
58
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
59
+
60
+ ## 1.51.0
61
+
62
+ ### Minor Changes
63
+
64
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
65
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
66
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
67
+ - 3d35f70: ZERO-2908: Add cookie to redirect url
68
+
3
69
  ## 1.50.0
4
70
 
5
71
  ### Minor Changes
6
72
 
73
+ - 90282b53: ZERO-2729: Audit packages for yarn and npm and also update app-template
74
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
75
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
76
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
77
+ - fda5b927: ZERO-2725: fix invalid import
78
+ - 2d9b2b2: ZERO-2816: Add segment to headers
79
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
80
+ - d93a507: ZERO-2900: Fix pretty url rewrite
81
+ - 8d9ac9a: ZERO-2794: Add field to order type
82
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
83
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
84
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
85
+ - 3bf2dd9: ZERO-2551: Fix search page
86
+ - e9541a1: ZERO-2816: Add headers to url
87
+ - 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.
88
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
89
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
90
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
91
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
92
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
93
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
94
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
95
+ - d3474c64: ZERO-2655: Add data source shipping option
96
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
97
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
98
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
99
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
100
+ - bbe18b9f: ZERO-2575: Fix build error
101
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
102
+ - 4920742: Disable getCachedTranslations
103
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
104
+ - 7e56d6b: ZERO-2841: Update api tagTypes
105
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
106
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
107
+ - 46b7aad7: ZERO-2775: Add condition and logger for menuitemmodel data
108
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
109
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
110
+ - fad27689: ZERO-2739: add gpay to payment plugin map
111
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
112
+ - fdd0b41: ZERO-2706: Add optimized translation support
113
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
114
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
115
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
116
+ - beb499e6: ZERO-2551: Add new tsconfig paths
117
+ - 146ea391: ZERO-2774: Update imports
118
+ - f2c92d5: ZERO-2816: Update cookie name
119
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
120
+ - c47be30d: ZERO-2744: Update Order and OrderItem types
121
+ - e9a46acb: ZERO-2738: add CVC input to registered cards in Masterpass
122
+ - f046f8e0: ZERO-2575: update version for react-number-format
123
+ - b9273fd: ZERO-2889: add host headers to requests
124
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
125
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
126
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
127
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
128
+ - 3d35f70: ZERO-2908: Add cookie to redirect url
129
+
130
+ ## 1.50.0-rc.1
131
+
132
+ ### Minor Changes
133
+
134
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
135
+
136
+ ## 1.50.0-rc.0
137
+
138
+ ### Minor Changes
139
+
140
+ - 90282b53: ZERO-2729: Audit packages for yarn and npm and also update app-template
141
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
142
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
143
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
144
+ - fda5b927: ZERO-2725: fix invalid import
145
+ - 2d9b2b2: ZERO-2816: Add segment to headers
146
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
147
+ - d93a507: ZERO-2900: Fix pretty url rewrite
148
+ - 8d9ac9a: ZERO-2794: Add field to order type
7
149
  - eaf97d6: ZERO-2909: Add deleteCollectionItem query to wishlistApi
150
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
151
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
152
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
153
+ - 3bf2dd9: ZERO-2551: Fix search page
154
+ - e9541a1: ZERO-2816: Add headers to url
155
+ - 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.
156
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
157
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
158
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
159
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
160
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
161
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
162
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
163
+ - d3474c64: ZERO-2655: Add data source shipping option
164
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
165
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
166
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
167
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
168
+ - bbe18b9f: ZERO-2575: Fix build error
169
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
170
+ - 4920742: Disable getCachedTranslations
171
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
172
+ - 7e56d6b: ZERO-2841: Update api tagTypes
173
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
174
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
175
+ - 46b7aad7: ZERO-2775: Add condition and logger for menuitemmodel data
176
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
177
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
178
+ - fad27689: ZERO-2739: add gpay to payment plugin map
179
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
180
+ - fdd0b41: ZERO-2706: Add optimized translation support
181
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
182
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
183
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
184
+ - beb499e6: ZERO-2551: Add new tsconfig paths
185
+ - 146ea391: ZERO-2774: Update imports
186
+ - f2c92d5: ZERO-2816: Update cookie name
187
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
188
+ - c47be30d: ZERO-2744: Update Order and OrderItem types
189
+ - e9a46acb: ZERO-2738: add CVC input to registered cards in Masterpass
190
+ - f046f8e0: ZERO-2575: update version for react-number-format
191
+ - b9273fd: ZERO-2889: add host headers to requests
192
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
193
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
194
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
8
195
 
9
196
  ## 1.49.0
10
197
 
@@ -30,7 +217,126 @@
30
217
 
31
218
  ### Minor Changes
32
219
 
220
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
221
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
222
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
223
+ - fda5b92: ZERO-2725: fix invalid import
224
+ - 2d9b2b2: ZERO-2816: Add segment to headers
225
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
226
+ - 8d9ac9a: ZERO-2794: Add field to order type
227
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
228
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
229
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
230
+ - 3bf2dd9: ZERO-2551: Fix search page
231
+ - e9541a1: ZERO-2816: Add headers to url
232
+ - 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.
233
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
234
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
235
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
236
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
237
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
238
+ - d3474c6: ZERO-2655: Add data source shipping option
239
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
240
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
241
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
242
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
243
+ - bbe18b9f: ZERO-2575: Fix build error
244
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
245
+ - 4920742: Disable getCachedTranslations
246
+ - 7e56d6b: ZERO-2841: Update api tagTypes
247
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
248
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
249
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
250
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
251
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
252
+ - fad2768: ZERO-2739: add gpay to payment plugin map
253
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
254
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
255
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
256
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
257
+ - beb499e6: ZERO-2551: Add new tsconfig paths
258
+ - 948eb42: ZERO-2852: Add out of stock endpoints
259
+ - 146ea39: ZERO-2774: Update imports
260
+ - f2c92d5: ZERO-2816: Update cookie name
261
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
262
+ - c47be30: ZERO-2744: Update Order and OrderItem types
263
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
264
+ - f046f8e0: ZERO-2575: update version for react-number-format
265
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
266
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
267
+
268
+ ## 1.45.0-rc.4
269
+
270
+ ### Minor Changes
271
+
272
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
273
+
274
+ ## 1.45.0-rc.3
275
+
276
+ ### Minor Changes
277
+
278
+ - 948eb42: ZERO-2852: Add out of stock endpoints
279
+
280
+ ## 1.45.0-rc.2
281
+
282
+ ### Minor Changes
283
+
284
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
285
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
286
+
287
+ ## 1.45.0-rc.1
288
+
289
+ ### Minor Changes
290
+
291
+ - 7e56d6b: ZERO-2841: Update api tagTypes
292
+
293
+ ## 1.45.0-rc.0
294
+
295
+ ### Minor Changes
296
+
297
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
298
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
299
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
300
+ - fda5b92: ZERO-2725: fix invalid import
301
+ - 2d9b2b2: ZERO-2816: Add segment to headers
302
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
303
+ - 8d9ac9a: ZERO-2794: Add field to order type
304
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
305
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
306
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
307
+ - 3bf2dd9: ZERO-2551: Fix search page
308
+ - e9541a1: ZERO-2816: Add headers to url
309
+ - 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.
310
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
311
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
312
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
313
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
33
314
  - 2ab6e08: ZERO-2841: Update getBasketDetail query
315
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
316
+ - d3474c6: ZERO-2655: Add data source shipping option
317
+ - 75080fd: ZERO-2630: Add max limit to postcode area
318
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
319
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
320
+ - bbe18b9: ZERO-2575: Fix build error
321
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
322
+ - 4920742: Disable getCachedTranslations
323
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
324
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
325
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
326
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
327
+ - fad2768: ZERO-2739: add gpay to payment plugin map
328
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
329
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
330
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
331
+ - beb499e: ZERO-2551: Add new tsconfig paths
332
+ - 146ea39: ZERO-2774: Update imports
333
+ - f2c92d5: ZERO-2816: Update cookie name
334
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
335
+ - c47be30: ZERO-2744: Update Order and OrderItem types
336
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
337
+ - f046f8e0: ZERO-2575: update version for react-number-format
338
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
339
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
34
340
 
35
341
  ## 1.44.0
36
342
 
@@ -38,7 +344,201 @@
38
344
 
39
345
  ### Minor Changes
40
346
 
347
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
348
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
349
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
350
+ - fda5b92: ZERO-2725: fix invalid import
351
+ - 2d9b2b2: ZERO-2816: Add segment to headers
352
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
353
+ - 8d9ac9a: ZERO-2794: Add field to order type
354
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
355
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
356
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
357
+ - 3bf2dd9: ZERO-2551: Fix search page
358
+ - e9541a1: ZERO-2816: Add headers to url
359
+ - 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.
360
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
361
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
362
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
363
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
364
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
365
+ - d3474c6: ZERO-2655: Add data source shipping option
366
+ - 75080fd: ZERO-2630: Add max limit to postcode area
367
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
368
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
369
+ - bbe18b9: ZERO-2575: Fix build error
370
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
371
+ - 4920742: Disable getCachedTranslations
372
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
373
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
374
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
375
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
376
+ - fad2768: ZERO-2739: add gpay to payment plugin map
377
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
378
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
379
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
380
+ - beb499e: ZERO-2551: Add new tsconfig paths
381
+ - 146ea39: ZERO-2774: Update imports
382
+ - f2c92d5: ZERO-2816: Update cookie name
383
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
384
+ - c47be30: ZERO-2744: Update Order and OrderItem types
385
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
386
+ - f046f8e0: ZERO-2575: update version for react-number-format
387
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
388
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
389
+
390
+ ## 1.43.0-rc.15
391
+
392
+ ## 1.43.0-rc.14
393
+
394
+ ### Minor Changes
395
+
396
+ - 3bf2dd9: ZERO-2551: Fix search page
397
+
398
+ ## 1.43.0-rc.13
399
+
400
+ ### Minor Changes
401
+
402
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
403
+
404
+ ## 1.43.0-rc.12
405
+
406
+ ### Minor Changes
407
+
408
+ - 4920742: Disable getCachedTranslations
409
+
410
+ ## 1.43.0-rc.11
411
+
412
+ ### Minor Changes
413
+
414
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
415
+
416
+ ## 1.43.0-rc.10
417
+
418
+ ### Minor Changes
419
+
420
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
421
+
422
+ ## 1.43.0-rc.9
423
+
424
+ ### Minor Changes
425
+
426
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
427
+
428
+ ## 1.43.0-rc.8
429
+
430
+ ### Minor Changes
431
+
432
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
433
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
434
+
435
+ ## 1.43.0-rc.7
436
+
437
+ ### Minor Changes
438
+
439
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
440
+
441
+ ## 1.43.0-rc.6
442
+
443
+ ### Minor Changes
444
+
445
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
446
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
447
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
448
+ - fda5b92: ZERO-2725: fix invalid import
449
+ - 2d9b2b2: ZERO-2816: Add segment to headers
450
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
451
+ - 8d9ac9a: ZERO-2794: Add field to order type
452
+ - e9541a1: ZERO-2816: Add headers to url
453
+ - c53ef7b: 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.
454
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
455
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
456
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
457
+ - d3474c6: ZERO-2655: Add data source shipping option
458
+ - 75080fd: ZERO-2630: Add max limit to postcode area
459
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
460
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
461
+ - bbe18b9: ZERO-2575: Fix build error
462
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
463
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
464
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
465
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
466
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
467
+ - fad2768: ZERO-2739: add gpay to payment plugin map
468
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
469
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
41
470
  - 4a163f2: ZERO-2761: Add condition for basket summary
471
+ - beb499e: ZERO-2551: Add new tsconfig paths
472
+ - 146ea39: ZERO-2774: Update imports
473
+ - f2c92d5: ZERO-2816: Update cookie name
474
+ - c47be30: ZERO-2744: Update Order and OrderItem types
475
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
476
+ - f046f8e: ZERO-2575: update version for react-number-format
477
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
478
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
479
+
480
+ ## 1.43.0-rc.5
481
+
482
+ ### Minor Changes
483
+
484
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
485
+
486
+ ## 1.43.0-rc.4
487
+
488
+ ### Minor Changes
489
+
490
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
491
+
492
+ ## 1.43.0-rc.3
493
+
494
+ ### Minor Changes
495
+
496
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
497
+
498
+ ## 1.43.0-rc.2
499
+
500
+ ### Minor Changes
501
+
502
+ - f2c92d5: ZERO-2816: Update cookie name
503
+
504
+ ## 1.43.0-rc.1
505
+
506
+ ### Minor Changes
507
+
508
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
509
+
510
+ ## 1.43.0-rc.0
511
+
512
+ ### Minor Changes
513
+
514
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
515
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
516
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
517
+ - fda5b92: ZERO-2725: fix invalid import
518
+ - 2d9b2b2: ZERO-2816: Add segment to headers
519
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
520
+ - 8d9ac9a: ZERO-2794: Add field to order type
521
+ - e9541a1: ZERO-2816: Add headers to url
522
+ - c53ef7b: 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.
523
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
524
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
525
+ - d3474c6: ZERO-2655: Add data source shipping option
526
+ - 75080fd: ZERO-2630: Add max limit to postcode area
527
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
528
+ - bbe18b9: ZERO-2575: Fix build error
529
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
530
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
531
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
532
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
533
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
534
+ - fad2768: ZERO-2739: add gpay to payment plugin map
535
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
536
+ - beb499e: ZERO-2551: Add new tsconfig paths
537
+ - 146ea39: ZERO-2774: Update imports
538
+ - c47be30: ZERO-2744: Update Order and OrderItem types
539
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
540
+ - f046f8e: ZERO-2575: update version for react-number-format
541
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
42
542
 
43
543
  ## 1.42.0
44
544
 
package/api/client.ts CHANGED
@@ -4,6 +4,7 @@ import settings from 'settings';
4
4
  import logger from '../utils/log';
5
5
  import formatCookieString from '../utils/format-cookie-string';
6
6
  import cookieParser from 'set-cookie-parser';
7
+ import { cookies } from 'next/headers';
7
8
 
8
9
  interface RouteParams {
9
10
  params: {
@@ -51,18 +52,24 @@ async function proxyRequest(...args) {
51
52
  extraHeaders[key.toLowerCase()] = value;
52
53
  }
53
54
 
54
- [
55
+ const excludedHeaders = [
55
56
  'x-forwarded-host',
56
57
  'x-forwarded-proto',
57
58
  'x-forwarded-port',
58
59
  'x-requested-with',
59
60
  'origin',
60
- 'host',
61
61
  'referer',
62
62
  'accept',
63
63
  'content-length',
64
- 'content-type'
65
- ].forEach((header) => delete extraHeaders[header]);
64
+ 'content-type',
65
+ 'host'
66
+ ];
67
+
68
+ excludedHeaders.forEach((header) => {
69
+ if (!settings.includedProxyHeaders?.includes(header)) {
70
+ delete extraHeaders[header];
71
+ }
72
+ });
66
73
 
67
74
  const fetchOptions = {
68
75
  method: req.method,
@@ -74,16 +81,33 @@ async function proxyRequest(...args) {
74
81
  }
75
82
  } as RequestInit;
76
83
 
84
+ const nextCookies = cookies();
85
+ const segment = nextCookies.get('pz-segment')?.value;
86
+ const currency = nextCookies.get('pz-external-currency')?.value;
87
+
88
+ if (segment) {
89
+ fetchOptions.headers['X-Segment-Id'] = segment;
90
+ }
91
+
92
+ if (currency) {
93
+ fetchOptions.headers = Object.assign({}, fetchOptions.headers, {
94
+ 'x-currency': currency
95
+ });
96
+ }
97
+
77
98
  if (options.contentType) {
78
99
  fetchOptions.headers['Content-Type'] = options.contentType;
79
100
  }
80
101
 
102
+ const isMultipartFormData = req.headers
103
+ .get('content-type')
104
+ ?.includes('multipart/form-data;');
105
+
81
106
  if (req.method !== 'GET') {
82
- const formData = new URLSearchParams();
83
- let body = {};
107
+ let body: Record<string, any> | FormData = {};
84
108
 
85
109
  try {
86
- body = await req.json();
110
+ body = isMultipartFormData ? await req.formData() : await req.json();
87
111
  } catch (error) {
88
112
  logger.error(
89
113
  `Client Proxy Request - Error while parsing request body to JSON`,
@@ -94,13 +118,25 @@ async function proxyRequest(...args) {
94
118
  );
95
119
  }
96
120
 
97
- Object.keys(body ?? {}).forEach((key) => {
98
- if (body[key]) {
99
- formData.append(key, body[key]);
100
- }
101
- });
121
+ if (isMultipartFormData) {
122
+ fetchOptions.body = body as FormData;
123
+ } else {
124
+ const formData = new FormData();
125
+
126
+ Object.keys(body ?? {}).forEach((key) => {
127
+ if (body[key]) {
128
+ if (typeof body[key] === 'object' && body[key] !== null) {
129
+ formData.append(key, JSON.stringify(body[key]));
130
+ } else {
131
+ formData.append(key, body[key]);
132
+ }
133
+ }
134
+ });
102
135
 
103
- fetchOptions.body = !options.useFormData ? JSON.stringify(body) : formData;
136
+ fetchOptions.body = !options.useFormData
137
+ ? JSON.stringify(body)
138
+ : formData;
139
+ }
104
140
  }
105
141
 
106
142
  let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
@@ -116,11 +152,8 @@ async function proxyRequest(...args) {
116
152
  try {
117
153
  const request = await fetch(url, fetchOptions);
118
154
 
119
- // Using NextResponse.json with status 204 will cause an error
120
155
  if (request.status === 204) {
121
- return new Response(null, {
122
- status: 204
123
- });
156
+ return new Response(null, { status: 204 });
124
157
  }
125
158
 
126
159
  let response = {} as any;