@akinon/next 1.55.0 → 1.56.0-rc.1

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 (59) hide show
  1. package/CHANGELOG.md +488 -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/price.tsx +11 -4
  14. package/components/pz-root.tsx +15 -3
  15. package/components/selected-payment-option-view.tsx +26 -38
  16. package/data/client/account.ts +10 -9
  17. package/data/client/api.ts +1 -1
  18. package/data/client/b2b.ts +35 -2
  19. package/data/client/basket.ts +6 -5
  20. package/data/client/checkout.ts +54 -1
  21. package/data/client/user.ts +3 -2
  22. package/data/server/category.ts +43 -19
  23. package/data/server/flatpage.ts +29 -7
  24. package/data/server/form.ts +29 -11
  25. package/data/server/landingpage.ts +26 -7
  26. package/data/server/list.ts +16 -6
  27. package/data/server/menu.ts +15 -2
  28. package/data/server/product.ts +33 -13
  29. package/data/server/seo.ts +17 -24
  30. package/data/server/special-page.ts +15 -5
  31. package/data/server/widget.ts +14 -7
  32. package/data/urls.ts +10 -2
  33. package/hocs/server/with-segment-defaults.tsx +4 -1
  34. package/hooks/index.ts +2 -1
  35. package/hooks/use-message-listener.ts +24 -0
  36. package/hooks/use-pagination.ts +2 -2
  37. package/hooks/use-payment-options.ts +2 -1
  38. package/lib/cache-handler.mjs +33 -0
  39. package/lib/cache.ts +8 -6
  40. package/middlewares/default.ts +87 -8
  41. package/middlewares/pretty-url.ts +11 -1
  42. package/middlewares/url-redirection.ts +4 -0
  43. package/package.json +4 -3
  44. package/redux/middlewares/checkout.ts +69 -10
  45. package/redux/reducers/checkout.ts +23 -3
  46. package/routes/pretty-url.tsx +192 -0
  47. package/types/commerce/account.ts +1 -0
  48. package/types/commerce/address.ts +1 -1
  49. package/types/commerce/b2b.ts +12 -2
  50. package/types/commerce/checkout.ts +33 -0
  51. package/types/commerce/order.ts +1 -0
  52. package/types/index.ts +18 -2
  53. package/utils/app-fetch.ts +17 -8
  54. package/utils/generate-commerce-search-params.ts +3 -1
  55. package/utils/index.ts +27 -6
  56. package/utils/redirection-iframe.ts +85 -0
  57. package/utils/server-translation.ts +11 -1
  58. package/utils/server-variables.ts +2 -1
  59. package/with-pz-config.js +13 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.56.0-rc.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 207ac6e: ZERO-2917: Add OrderSelectionPage endpoint
8
+
9
+ ## 1.56.0-rc.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
14
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
15
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
16
+ - fda5b927: ZERO-2725: fix invalid import
17
+ - 2d9b2b2c: ZERO-2816: Add segment to headers
18
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
19
+ - d93a507: ZERO-2900: Fix pretty url rewrite
20
+ - 6c25f666: ZERO-2551: Check CACHE_HOST variable
21
+ - bc2b4117: ZERO-2825: Add attribute-based shipping options to checkout page
22
+ - 3bf2dd94: ZERO-2551: Fix search page
23
+ - e9541a13: ZERO-2816: Add headers to url
24
+ - 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.
25
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
26
+ - 64699d3f: ZERO-2761: Fix invalid import for plugin module
27
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
28
+ - d6edb1d0: ZERO-2551: Fix searchparams handling for list and other routes
29
+ - d3474c64: ZERO-2655: Add data source shipping option
30
+ - 17f87524: ZERO-2816: Make the incoming currency lowercase
31
+ - c45b62c9: ZERO-2818: Add upload and download support for b2b package
32
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
33
+ - bbe18b9f: ZERO-2575: Fix build error
34
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
35
+ - 4920742c: Disable getCachedTranslations
36
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
37
+ - 7e56d6b6: ZERO-2841: Update api tagTypes
38
+ - 94b69285: ZERO-2551: Add cache handler check in url-redirection middleware
39
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
40
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
41
+ - 8f47ccae: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
42
+ - fad27689: ZERO-2739: add gpay to payment plugin map
43
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
44
+ - fdd0b41: ZERO-2706: Add optimized translation support
45
+ - f2c325c1: ZERO-2838: Move file input component into @akinon/next
46
+ - 9e25a64b: ZERO-2835: Update category page layout with breadcrumb
47
+ - beb499e6: ZERO-2551: Add new tsconfig paths
48
+ - f2c92d5c: ZERO-2816: Update cookie name
49
+ - 7bd3d992: ZERO-2801: Refactor locale middleware to handle single locale configuration
50
+ - f046f8e0: ZERO-2575: update version for react-number-format
51
+ - b9273fd3: ZERO-2889: add host headers to requests
52
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
53
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
54
+ - c670bd48: ZERO-2900: Add middleware rewrite functionality
55
+ - 3f9b8d7e: ZERO-2761: Update plugins.js for akinon-next
56
+
3
57
  ## 1.55.0
4
58
 
5
59
  ### Minor Changes
@@ -44,7 +98,128 @@
44
98
 
45
99
  ### Minor Changes
46
100
 
101
+ - 90282b53: ZERO-2729: Audit packages for yarn and npm and also update app-template
102
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
103
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
104
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
105
+ - fda5b927: ZERO-2725: fix invalid import
106
+ - 2d9b2b2: ZERO-2816: Add segment to headers
107
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
108
+ - d93a507: ZERO-2900: Fix pretty url rewrite
109
+ - 8d9ac9a: ZERO-2794: Add field to order type
110
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
111
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
112
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
113
+ - 3bf2dd9: ZERO-2551: Fix search page
114
+ - e9541a1: ZERO-2816: Add headers to url
115
+ - 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.
116
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
117
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
118
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
119
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
120
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
121
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
122
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
123
+ - d3474c64: ZERO-2655: Add data source shipping option
124
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
125
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
126
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
127
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
128
+ - bbe18b9f: ZERO-2575: Fix build error
129
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
130
+ - 4920742: Disable getCachedTranslations
131
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
132
+ - 7e56d6b: ZERO-2841: Update api tagTypes
133
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
134
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
135
+ - 46b7aad7: ZERO-2775: Add condition and logger for menuitemmodel data
136
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
137
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
138
+ - fad27689: ZERO-2739: add gpay to payment plugin map
139
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
140
+ - fdd0b41: ZERO-2706: Add optimized translation support
141
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
142
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
143
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
144
+ - beb499e6: ZERO-2551: Add new tsconfig paths
145
+ - 146ea391: ZERO-2774: Update imports
146
+ - f2c92d5: ZERO-2816: Update cookie name
147
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
148
+ - c47be30d: ZERO-2744: Update Order and OrderItem types
149
+ - e9a46acb: ZERO-2738: add CVC input to registered cards in Masterpass
150
+ - f046f8e0: ZERO-2575: update version for react-number-format
151
+ - b9273fd: ZERO-2889: add host headers to requests
152
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
153
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
154
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
155
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
156
+ - 3d35f70: ZERO-2908: Add cookie to redirect url
157
+
158
+ ## 1.50.0-rc.1
159
+
160
+ ### Minor Changes
161
+
162
+ - 49eeebf: ZERO-2909: Add deleteCollectionItem query to wishlistApi
163
+
164
+ ## 1.50.0-rc.0
165
+
166
+ ### Minor Changes
167
+
168
+ - 90282b53: ZERO-2729: Audit packages for yarn and npm and also update app-template
169
+ - 572d2e84: ZERO-2667: Add iframe support for redirection payment methods
170
+ - 5dfeea0: ZERO-2801: Revert ZERO-2801
171
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
172
+ - fda5b927: ZERO-2725: fix invalid import
173
+ - 2d9b2b2: ZERO-2816: Add segment to headers
174
+ - c53ea3e6: ZERO-2609: Reset additional form fields when selectedFormType is not company
175
+ - d93a507: ZERO-2900: Fix pretty url rewrite
176
+ - 8d9ac9a: ZERO-2794: Add field to order type
47
177
  - eaf97d6: ZERO-2909: Add deleteCollectionItem query to wishlistApi
178
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
179
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
180
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
181
+ - 3bf2dd9: ZERO-2551: Fix search page
182
+ - e9541a1: ZERO-2816: Add headers to url
183
+ - 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.
184
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
185
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
186
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
187
+ - 0d3a913e: ZERO-2725: Update decimal scale in Price component
188
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
189
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
190
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
191
+ - d3474c64: ZERO-2655: Add data source shipping option
192
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
193
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
194
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
195
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
196
+ - bbe18b9f: ZERO-2575: Fix build error
197
+ - d4099960: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
198
+ - 4920742: Disable getCachedTranslations
199
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
200
+ - 7e56d6b: ZERO-2841: Update api tagTypes
201
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
202
+ - 98bb8dcd: ZERO-2706: Cache getTranlations method
203
+ - 46b7aad7: ZERO-2775: Add condition and logger for menuitemmodel data
204
+ - dcc8a150: ZERO-2694: added build step to RC branch pipeline
205
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
206
+ - fad27689: ZERO-2739: add gpay to payment plugin map
207
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
208
+ - fdd0b41: ZERO-2706: Add optimized translation support
209
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
210
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
211
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
212
+ - beb499e6: ZERO-2551: Add new tsconfig paths
213
+ - 146ea391: ZERO-2774: Update imports
214
+ - f2c92d5: ZERO-2816: Update cookie name
215
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
216
+ - c47be30d: ZERO-2744: Update Order and OrderItem types
217
+ - e9a46acb: ZERO-2738: add CVC input to registered cards in Masterpass
218
+ - f046f8e0: ZERO-2575: update version for react-number-format
219
+ - b9273fd: ZERO-2889: add host headers to requests
220
+ - 86d25315: ZERO-2693: resolve dependency collision warning for eslint-config-next
221
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
222
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
48
223
 
49
224
  ## 1.49.0
50
225
 
@@ -70,7 +245,126 @@
70
245
 
71
246
  ### Minor Changes
72
247
 
248
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
249
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
250
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
251
+ - fda5b92: ZERO-2725: fix invalid import
252
+ - 2d9b2b2: ZERO-2816: Add segment to headers
253
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
254
+ - 8d9ac9a: ZERO-2794: Add field to order type
255
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
256
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
257
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
258
+ - 3bf2dd9: ZERO-2551: Fix search page
259
+ - e9541a1: ZERO-2816: Add headers to url
260
+ - 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.
261
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
262
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
263
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
264
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
265
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
266
+ - d3474c6: ZERO-2655: Add data source shipping option
267
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
268
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
269
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
270
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
271
+ - bbe18b9f: ZERO-2575: Fix build error
272
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
273
+ - 4920742: Disable getCachedTranslations
274
+ - 7e56d6b: ZERO-2841: Update api tagTypes
275
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
276
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
277
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
278
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
279
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
280
+ - fad2768: ZERO-2739: add gpay to payment plugin map
281
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
282
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
283
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
284
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
285
+ - beb499e6: ZERO-2551: Add new tsconfig paths
286
+ - 948eb42: ZERO-2852: Add out of stock endpoints
287
+ - 146ea39: ZERO-2774: Update imports
288
+ - f2c92d5: ZERO-2816: Update cookie name
289
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
290
+ - c47be30: ZERO-2744: Update Order and OrderItem types
291
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
292
+ - f046f8e0: ZERO-2575: update version for react-number-format
293
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
294
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
295
+
296
+ ## 1.45.0-rc.4
297
+
298
+ ### Minor Changes
299
+
300
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
301
+
302
+ ## 1.45.0-rc.3
303
+
304
+ ### Minor Changes
305
+
306
+ - 948eb42: ZERO-2852: Add out of stock endpoints
307
+
308
+ ## 1.45.0-rc.2
309
+
310
+ ### Minor Changes
311
+
312
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
313
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
314
+
315
+ ## 1.45.0-rc.1
316
+
317
+ ### Minor Changes
318
+
319
+ - 7e56d6b: ZERO-2841: Update api tagTypes
320
+
321
+ ## 1.45.0-rc.0
322
+
323
+ ### Minor Changes
324
+
325
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
326
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
327
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
328
+ - fda5b92: ZERO-2725: fix invalid import
329
+ - 2d9b2b2: ZERO-2816: Add segment to headers
330
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
331
+ - 8d9ac9a: ZERO-2794: Add field to order type
332
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
333
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
334
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
335
+ - 3bf2dd9: ZERO-2551: Fix search page
336
+ - e9541a1: ZERO-2816: Add headers to url
337
+ - 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.
338
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
339
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
340
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
341
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
73
342
  - 2ab6e08: ZERO-2841: Update getBasketDetail query
343
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
344
+ - d3474c6: ZERO-2655: Add data source shipping option
345
+ - 75080fd: ZERO-2630: Add max limit to postcode area
346
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
347
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
348
+ - bbe18b9: ZERO-2575: Fix build error
349
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
350
+ - 4920742: Disable getCachedTranslations
351
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
352
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
353
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
354
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
355
+ - fad2768: ZERO-2739: add gpay to payment plugin map
356
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
357
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
358
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
359
+ - beb499e: ZERO-2551: Add new tsconfig paths
360
+ - 146ea39: ZERO-2774: Update imports
361
+ - f2c92d5: ZERO-2816: Update cookie name
362
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
363
+ - c47be30: ZERO-2744: Update Order and OrderItem types
364
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
365
+ - f046f8e0: ZERO-2575: update version for react-number-format
366
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
367
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
74
368
 
75
369
  ## 1.44.0
76
370
 
@@ -78,7 +372,201 @@
78
372
 
79
373
  ### Minor Changes
80
374
 
375
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
376
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
377
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
378
+ - fda5b92: ZERO-2725: fix invalid import
379
+ - 2d9b2b2: ZERO-2816: Add segment to headers
380
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
381
+ - 8d9ac9a: ZERO-2794: Add field to order type
382
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
383
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
384
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
385
+ - 3bf2dd9: ZERO-2551: Fix search page
386
+ - e9541a1: ZERO-2816: Add headers to url
387
+ - 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.
388
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
389
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
390
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
391
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
392
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
393
+ - d3474c6: ZERO-2655: Add data source shipping option
394
+ - 75080fd: ZERO-2630: Add max limit to postcode area
395
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
396
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
397
+ - bbe18b9: ZERO-2575: Fix build error
398
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
399
+ - 4920742: Disable getCachedTranslations
400
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
401
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
402
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
403
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
404
+ - fad2768: ZERO-2739: add gpay to payment plugin map
405
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
406
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
407
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
408
+ - beb499e: ZERO-2551: Add new tsconfig paths
409
+ - 146ea39: ZERO-2774: Update imports
410
+ - f2c92d5: ZERO-2816: Update cookie name
411
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
412
+ - c47be30: ZERO-2744: Update Order and OrderItem types
413
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
414
+ - f046f8e0: ZERO-2575: update version for react-number-format
415
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
416
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
417
+
418
+ ## 1.43.0-rc.15
419
+
420
+ ## 1.43.0-rc.14
421
+
422
+ ### Minor Changes
423
+
424
+ - 3bf2dd9: ZERO-2551: Fix search page
425
+
426
+ ## 1.43.0-rc.13
427
+
428
+ ### Minor Changes
429
+
430
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
431
+
432
+ ## 1.43.0-rc.12
433
+
434
+ ### Minor Changes
435
+
436
+ - 4920742: Disable getCachedTranslations
437
+
438
+ ## 1.43.0-rc.11
439
+
440
+ ### Minor Changes
441
+
442
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
443
+
444
+ ## 1.43.0-rc.10
445
+
446
+ ### Minor Changes
447
+
448
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
449
+
450
+ ## 1.43.0-rc.9
451
+
452
+ ### Minor Changes
453
+
454
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
455
+
456
+ ## 1.43.0-rc.8
457
+
458
+ ### Minor Changes
459
+
460
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
461
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
462
+
463
+ ## 1.43.0-rc.7
464
+
465
+ ### Minor Changes
466
+
467
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
468
+
469
+ ## 1.43.0-rc.6
470
+
471
+ ### Minor Changes
472
+
473
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
474
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
475
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
476
+ - fda5b92: ZERO-2725: fix invalid import
477
+ - 2d9b2b2: ZERO-2816: Add segment to headers
478
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
479
+ - 8d9ac9a: ZERO-2794: Add field to order type
480
+ - e9541a1: ZERO-2816: Add headers to url
481
+ - 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.
482
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
483
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
484
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
485
+ - d3474c6: ZERO-2655: Add data source shipping option
486
+ - 75080fd: ZERO-2630: Add max limit to postcode area
487
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
488
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
489
+ - bbe18b9: ZERO-2575: Fix build error
490
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
491
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
492
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
493
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
494
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
495
+ - fad2768: ZERO-2739: add gpay to payment plugin map
496
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
497
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
81
498
  - 4a163f2: ZERO-2761: Add condition for basket summary
499
+ - beb499e: ZERO-2551: Add new tsconfig paths
500
+ - 146ea39: ZERO-2774: Update imports
501
+ - f2c92d5: ZERO-2816: Update cookie name
502
+ - c47be30: ZERO-2744: Update Order and OrderItem types
503
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
504
+ - f046f8e: ZERO-2575: update version for react-number-format
505
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
506
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
507
+
508
+ ## 1.43.0-rc.5
509
+
510
+ ### Minor Changes
511
+
512
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
513
+
514
+ ## 1.43.0-rc.4
515
+
516
+ ### Minor Changes
517
+
518
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
519
+
520
+ ## 1.43.0-rc.3
521
+
522
+ ### Minor Changes
523
+
524
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
525
+
526
+ ## 1.43.0-rc.2
527
+
528
+ ### Minor Changes
529
+
530
+ - f2c92d5: ZERO-2816: Update cookie name
531
+
532
+ ## 1.43.0-rc.1
533
+
534
+ ### Minor Changes
535
+
536
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
537
+
538
+ ## 1.43.0-rc.0
539
+
540
+ ### Minor Changes
541
+
542
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
543
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
544
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
545
+ - fda5b92: ZERO-2725: fix invalid import
546
+ - 2d9b2b2: ZERO-2816: Add segment to headers
547
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
548
+ - 8d9ac9a: ZERO-2794: Add field to order type
549
+ - e9541a1: ZERO-2816: Add headers to url
550
+ - 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.
551
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
552
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
553
+ - d3474c6: ZERO-2655: Add data source shipping option
554
+ - 75080fd: ZERO-2630: Add max limit to postcode area
555
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
556
+ - bbe18b9: ZERO-2575: Fix build error
557
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
558
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
559
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
560
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
561
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
562
+ - fad2768: ZERO-2739: add gpay to payment plugin map
563
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
564
+ - beb499e: ZERO-2551: Add new tsconfig paths
565
+ - 146ea39: ZERO-2774: Update imports
566
+ - c47be30: ZERO-2744: Update Order and OrderItem types
567
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
568
+ - f046f8e: ZERO-2575: update version for react-number-format
569
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
82
570
 
83
571
  ## 1.42.0
84
572
 
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;
@@ -0,0 +1,49 @@
1
+ .checkout-payment-iframe-wrapper {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ border: none;
8
+ z-index: 1000;
9
+ background-color: white;
10
+ }
11
+ .checkout-payment-iframe-wrapper iframe {
12
+ width: 100%;
13
+ height: 100%;
14
+ border: none;
15
+ background-color: white;
16
+ }
17
+ .checkout-payment-iframe-wrapper .close-button {
18
+ position: fixed;
19
+ top: 16px;
20
+ right: 16px;
21
+ width: 32px;
22
+ height: 32px;
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ z-index: 1001;
27
+ }
28
+
29
+ .checkout-payment-redirection-iframe-wrapper {
30
+ width: 100%;
31
+ position: relative;
32
+ }
33
+ .checkout-payment-redirection-iframe-wrapper iframe {
34
+ width: 100%;
35
+ height: 100%;
36
+ border: none;
37
+ background-color: white;
38
+ }
39
+ .checkout-payment-redirection-iframe-wrapper .close-button {
40
+ position: absolute;
41
+ top: 16px;
42
+ right: 16px;
43
+ width: 32px;
44
+ height: 32px;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ z-index: 1001;
49
+ }/*# sourceMappingURL=index.css.map */