@akinon/next 1.47.0 → 1.48.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 (65) hide show
  1. package/CHANGELOG.md +375 -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 +9 -2
  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-payment-options.ts +2 -1
  39. package/lib/cache-handler.mjs +33 -0
  40. package/lib/cache.ts +8 -6
  41. package/middlewares/default.ts +91 -8
  42. package/middlewares/locale.ts +32 -30
  43. package/middlewares/pretty-url.ts +11 -1
  44. package/middlewares/url-redirection.ts +4 -0
  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,5 +1,67 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.48.0-rc.1
4
+
5
+ ### Minor Changes
6
+
7
+ - fdd0b41: ZERO-2706: Add optimized translation support
8
+
9
+ ## 1.48.0-rc.0
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
+ - d93a507: ZERO-2900: Fix pretty url rewrite
20
+ - 8d9ac9a: ZERO-2794: Add field to order type
21
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
22
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
23
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
24
+ - 3bf2dd9: ZERO-2551: Fix search page
25
+ - e9541a1: ZERO-2816: Add headers to url
26
+ - 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.
27
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
28
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
29
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
30
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
31
+ - 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
32
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
33
+ - d3474c6: ZERO-2655: Add data source shipping option
34
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
35
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
36
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
37
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
38
+ - bbe18b9f: ZERO-2575: Fix build error
39
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
40
+ - 4920742: Disable getCachedTranslations
41
+ - 12a873e: ZERO-2846:Edit the siteKey regex in the response from GetCaptcha
42
+ - 7e56d6b: ZERO-2841: Update api tagTypes
43
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
44
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
45
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
46
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
47
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
48
+ - fad2768: ZERO-2739: add gpay to payment plugin map
49
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
50
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
51
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
52
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
53
+ - beb499e6: ZERO-2551: Add new tsconfig paths
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
+ - f046f8e0: ZERO-2575: update version for react-number-format
60
+ - b9273fd: ZERO-2889: add host headers to requests
61
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
62
+ - c670bd4: ZERO-2900: Add middleware rewrite functionality
63
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
64
+
3
65
  ## 1.47.0
4
66
 
5
67
  ### Minor Changes
@@ -13,7 +75,126 @@
13
75
 
14
76
  ### Minor Changes
15
77
 
78
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
79
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
80
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
81
+ - fda5b92: ZERO-2725: fix invalid import
82
+ - 2d9b2b2: ZERO-2816: Add segment to headers
83
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
84
+ - 8d9ac9a: ZERO-2794: Add field to order type
85
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
86
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
87
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
88
+ - 3bf2dd9: ZERO-2551: Fix search page
89
+ - e9541a1: ZERO-2816: Add headers to url
90
+ - 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.
91
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
92
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
93
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
94
+ - 1448a96e: ZERO-2612: add errors type in CheckoutState
95
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
96
+ - d3474c6: ZERO-2655: Add data source shipping option
97
+ - 75080fd6: ZERO-2630: Add max limit to postcode area
98
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
99
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
100
+ - 91265bba: ZERO-2551: Improve pretty url and caching performance
101
+ - bbe18b9f: ZERO-2575: Fix build error
102
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
103
+ - 4920742: Disable getCachedTranslations
104
+ - 7e56d6b: ZERO-2841: Update api tagTypes
105
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
106
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
107
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
108
+ - dcc8a15: 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
+ - fad2768: ZERO-2739: add gpay to payment plugin map
111
+ - dff0d595: ZERO-2659: add formData support to proxy api requests
112
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
113
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
114
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
115
+ - beb499e6: ZERO-2551: Add new tsconfig paths
116
+ - 948eb42: ZERO-2852: Add out of stock endpoints
117
+ - 146ea39: ZERO-2774: Update imports
118
+ - f2c92d5: ZERO-2816: Update cookie name
119
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
120
+ - c47be30: ZERO-2744: Update Order and OrderItem types
121
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
122
+ - f046f8e0: ZERO-2575: update version for react-number-format
123
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
124
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
125
+
126
+ ## 1.45.0-rc.4
127
+
128
+ ### Minor Changes
129
+
130
+ - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
131
+
132
+ ## 1.45.0-rc.3
133
+
134
+ ### Minor Changes
135
+
136
+ - 948eb42: ZERO-2852: Add out of stock endpoints
137
+
138
+ ## 1.45.0-rc.2
139
+
140
+ ### Minor Changes
141
+
142
+ - c45b62c: ZERO-2818: Add upload and download support for b2b package
143
+ - f2c325c: ZERO-2838: Move file input component into @akinon/next
144
+
145
+ ## 1.45.0-rc.1
146
+
147
+ ### Minor Changes
148
+
149
+ - 7e56d6b: ZERO-2841: Update api tagTypes
150
+
151
+ ## 1.45.0-rc.0
152
+
153
+ ### Minor Changes
154
+
155
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
156
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
157
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
158
+ - fda5b92: ZERO-2725: fix invalid import
159
+ - 2d9b2b2: ZERO-2816: Add segment to headers
160
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
161
+ - 8d9ac9a: ZERO-2794: Add field to order type
162
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
163
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
164
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
165
+ - 3bf2dd9: ZERO-2551: Fix search page
166
+ - e9541a1: ZERO-2816: Add headers to url
167
+ - 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.
168
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
169
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
170
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
171
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
16
172
  - 2ab6e08: ZERO-2841: Update getBasketDetail query
173
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
174
+ - d3474c6: ZERO-2655: Add data source shipping option
175
+ - 75080fd: ZERO-2630: Add max limit to postcode area
176
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
177
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
178
+ - bbe18b9: ZERO-2575: Fix build error
179
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
180
+ - 4920742: Disable getCachedTranslations
181
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
182
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
183
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
184
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
185
+ - fad2768: ZERO-2739: add gpay to payment plugin map
186
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
187
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
188
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
189
+ - beb499e: ZERO-2551: Add new tsconfig paths
190
+ - 146ea39: ZERO-2774: Update imports
191
+ - f2c92d5: ZERO-2816: Update cookie name
192
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
193
+ - c47be30: ZERO-2744: Update Order and OrderItem types
194
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
195
+ - f046f8e0: ZERO-2575: update version for react-number-format
196
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
197
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
17
198
 
18
199
  ## 1.44.0
19
200
 
@@ -21,7 +202,201 @@
21
202
 
22
203
  ### Minor Changes
23
204
 
205
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
206
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
207
+ - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
208
+ - fda5b92: ZERO-2725: fix invalid import
209
+ - 2d9b2b2: ZERO-2816: Add segment to headers
210
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
211
+ - 8d9ac9a: ZERO-2794: Add field to order type
212
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
213
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
214
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
215
+ - 3bf2dd9: ZERO-2551: Fix search page
216
+ - e9541a1: ZERO-2816: Add headers to url
217
+ - 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.
218
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
219
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
220
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
221
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
222
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
223
+ - d3474c6: ZERO-2655: Add data source shipping option
224
+ - 75080fd: ZERO-2630: Add max limit to postcode area
225
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
226
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
227
+ - bbe18b9: ZERO-2575: Fix build error
228
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
229
+ - 4920742: Disable getCachedTranslations
230
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
231
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
232
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
233
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
234
+ - fad2768: ZERO-2739: add gpay to payment plugin map
235
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
236
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
237
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
238
+ - beb499e: ZERO-2551: Add new tsconfig paths
239
+ - 146ea39: ZERO-2774: Update imports
240
+ - f2c92d5: ZERO-2816: Update cookie name
241
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
242
+ - c47be30: ZERO-2744: Update Order and OrderItem types
243
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
244
+ - f046f8e0: ZERO-2575: update version for react-number-format
245
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
246
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
247
+
248
+ ## 1.43.0-rc.15
249
+
250
+ ## 1.43.0-rc.14
251
+
252
+ ### Minor Changes
253
+
254
+ - 3bf2dd9: ZERO-2551: Fix search page
255
+
256
+ ## 1.43.0-rc.13
257
+
258
+ ### Minor Changes
259
+
260
+ - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
261
+
262
+ ## 1.43.0-rc.12
263
+
264
+ ### Minor Changes
265
+
266
+ - 4920742: Disable getCachedTranslations
267
+
268
+ ## 1.43.0-rc.11
269
+
270
+ ### Minor Changes
271
+
272
+ - 6c25f66: ZERO-2551: Check CACHE_HOST variable
273
+
274
+ ## 1.43.0-rc.10
275
+
276
+ ### Minor Changes
277
+
278
+ - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
279
+
280
+ ## 1.43.0-rc.9
281
+
282
+ ### Minor Changes
283
+
284
+ - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
285
+
286
+ ## 1.43.0-rc.8
287
+
288
+ ### Minor Changes
289
+
290
+ - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
291
+ - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
292
+
293
+ ## 1.43.0-rc.7
294
+
295
+ ### Minor Changes
296
+
297
+ - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
298
+
299
+ ## 1.43.0-rc.6
300
+
301
+ ### Minor Changes
302
+
303
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
304
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
305
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
306
+ - fda5b92: ZERO-2725: fix invalid import
307
+ - 2d9b2b2: ZERO-2816: Add segment to headers
308
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
309
+ - 8d9ac9a: ZERO-2794: Add field to order type
310
+ - e9541a1: ZERO-2816: Add headers to url
311
+ - 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.
312
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
313
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
314
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
315
+ - d3474c6: ZERO-2655: Add data source shipping option
316
+ - 75080fd: ZERO-2630: Add max limit to postcode area
317
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
318
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
319
+ - bbe18b9: ZERO-2575: Fix build error
320
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
321
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
322
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
323
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
324
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
325
+ - fad2768: ZERO-2739: add gpay to payment plugin map
326
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
327
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
24
328
  - 4a163f2: ZERO-2761: Add condition for basket summary
329
+ - beb499e: ZERO-2551: Add new tsconfig paths
330
+ - 146ea39: ZERO-2774: Update imports
331
+ - f2c92d5: ZERO-2816: Update cookie name
332
+ - c47be30: ZERO-2744: Update Order and OrderItem types
333
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
334
+ - f046f8e: ZERO-2575: update version for react-number-format
335
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
336
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
337
+
338
+ ## 1.43.0-rc.5
339
+
340
+ ### Minor Changes
341
+
342
+ - 17f8752: ZERO-2816: Make the incoming currency lowercase
343
+
344
+ ## 1.43.0-rc.4
345
+
346
+ ### Minor Changes
347
+
348
+ - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
349
+
350
+ ## 1.43.0-rc.3
351
+
352
+ ### Minor Changes
353
+
354
+ - 64699d3: ZERO-2761: Fix invalid import for plugin module
355
+
356
+ ## 1.43.0-rc.2
357
+
358
+ ### Minor Changes
359
+
360
+ - f2c92d5: ZERO-2816: Update cookie name
361
+
362
+ ## 1.43.0-rc.1
363
+
364
+ ### Minor Changes
365
+
366
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
367
+
368
+ ## 1.43.0-rc.0
369
+
370
+ ### Minor Changes
371
+
372
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
373
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
374
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
375
+ - fda5b92: ZERO-2725: fix invalid import
376
+ - 2d9b2b2: ZERO-2816: Add segment to headers
377
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
378
+ - 8d9ac9a: ZERO-2794: Add field to order type
379
+ - e9541a1: ZERO-2816: Add headers to url
380
+ - 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.
381
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
382
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
383
+ - d3474c6: ZERO-2655: Add data source shipping option
384
+ - 75080fd: ZERO-2630: Add max limit to postcode area
385
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
386
+ - bbe18b9: ZERO-2575: Fix build error
387
+ - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
388
+ - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
389
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
390
+ - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
391
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
392
+ - fad2768: ZERO-2739: add gpay to payment plugin map
393
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
394
+ - beb499e: ZERO-2551: Add new tsconfig paths
395
+ - 146ea39: ZERO-2774: Update imports
396
+ - c47be30: ZERO-2744: Update Order and OrderItem types
397
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
398
+ - f046f8e: ZERO-2575: update version for react-number-format
399
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
25
400
 
26
401
  ## 1.42.0
27
402
 
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 */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.scss","index.css"],"names":[],"mappings":"AAAA;EACE,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,YAAA;EACA,aAAA;EACA,uBAAA;ACCF;ADCE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACCJ;ADEE;EACE,eAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACAJ;;ADIA;EACE,WAAA;EACA,kBAAA;ACDF;ADGE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACDJ;ADIE;EACE,kBAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACFJ","file":"index.css"}
@@ -1,29 +1,53 @@
1
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;
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
10
 
11
- iframe {
12
- width: 100%;
13
- height: 100%;
14
- border: none;
15
- background-color: white;
16
- }
11
+ iframe {
12
+ width: 100%;
13
+ height: 100%;
14
+ border: none;
15
+ background-color: white;
16
+ }
17
17
 
18
- .close-button {
19
- position: fixed;
20
- top: 16px;
21
- right: 16px;
22
- width: 32px;
23
- height: 32px;
24
- display: flex;
25
- align-items: center;
26
- justify-content: center;
27
- z-index: 1001;
28
- }
29
- }
18
+ .close-button {
19
+ position: fixed;
20
+ top: 16px;
21
+ right: 16px;
22
+ width: 32px;
23
+ height: 32px;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ z-index: 1001;
28
+ }
29
+ }
30
+
31
+ .checkout-payment-redirection-iframe-wrapper {
32
+ width: 100%;
33
+ position: relative;
34
+
35
+ iframe {
36
+ width: 100%;
37
+ height: 100%;
38
+ border: none;
39
+ background-color: white;
40
+ }
41
+
42
+ .close-button {
43
+ position: absolute;
44
+ top: 16px;
45
+ right: 16px;
46
+ width: 32px;
47
+ height: 32px;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ z-index: 1001;
52
+ }
53
+ }
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const localesPath = path.resolve(`public/locales/`);
6
+
7
+ async function generateTranslationIndex(locale_) {
8
+ let translations = {};
9
+
10
+ try {
11
+ const localeDirPath = path.resolve(`public/locales/${locale_}`);
12
+ const fileNames = fs.readdirSync(localeDirPath);
13
+
14
+ for await (const fileName of fileNames) {
15
+ if (fileName === 'index.json') {
16
+ continue;
17
+ }
18
+
19
+ const data = fs.readFileSync(
20
+ path.join(localeDirPath, `/${fileName}`),
21
+ 'utf-8'
22
+ );
23
+
24
+ translations[fileName.substring(0, fileName.lastIndexOf('.'))] =
25
+ JSON.parse(data);
26
+ }
27
+
28
+ fs.writeFileSync(
29
+ path.resolve(`public/locales/${locale_}/index.json`),
30
+ JSON.stringify(translations)
31
+ );
32
+ } catch (error) {
33
+ console.error(error);
34
+ }
35
+ }
36
+
37
+ const localePaths = fs.readdirSync(localesPath);
38
+
39
+ localePaths.forEach((localePath) => {
40
+ generateTranslationIndex(localePath);
41
+ });