@akinon/next 1.45.0-rc.5 → 1.46.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 (53) hide show
  1. package/CHANGELOG.md +5 -316
  2. package/api/client.ts +9 -39
  3. package/assets/styles/index.scss +26 -50
  4. package/components/index.ts +0 -1
  5. package/components/input.tsx +7 -21
  6. package/components/link.tsx +13 -17
  7. package/components/pagination.tsx +2 -1
  8. package/components/price.tsx +4 -11
  9. package/components/selected-payment-option-view.tsx +38 -26
  10. package/data/client/account.ts +9 -10
  11. package/data/client/address.ts +8 -32
  12. package/data/client/api.ts +2 -2
  13. package/data/client/b2b.ts +2 -35
  14. package/data/client/basket.ts +5 -6
  15. package/data/client/checkout.ts +4 -47
  16. package/data/client/wishlist.ts +2 -70
  17. package/data/server/category.ts +2 -2
  18. package/data/server/list.ts +2 -2
  19. package/data/server/product.ts +13 -15
  20. package/data/server/special-page.ts +2 -2
  21. package/data/urls.ts +3 -17
  22. package/hooks/index.ts +1 -2
  23. package/hooks/use-payment-options.ts +1 -2
  24. package/lib/cache.ts +6 -18
  25. package/middlewares/default.ts +2 -50
  26. package/middlewares/locale.ts +30 -32
  27. package/middlewares/pretty-url.ts +0 -4
  28. package/middlewares/url-redirection.ts +0 -4
  29. package/package.json +4 -5
  30. package/plugins.d.ts +0 -1
  31. package/redux/middlewares/checkout.ts +11 -70
  32. package/redux/reducers/checkout.ts +5 -24
  33. package/redux/reducers/config.ts +0 -2
  34. package/types/commerce/account.ts +0 -1
  35. package/types/commerce/address.ts +1 -1
  36. package/types/commerce/b2b.ts +2 -12
  37. package/types/commerce/checkout.ts +0 -30
  38. package/types/commerce/misc.ts +0 -2
  39. package/types/commerce/order.ts +0 -12
  40. package/types/index.ts +2 -30
  41. package/utils/app-fetch.ts +1 -1
  42. package/utils/generate-commerce-search-params.ts +2 -6
  43. package/utils/index.ts +6 -27
  44. package/utils/menu-generator.ts +2 -2
  45. package/utils/server-translation.ts +1 -5
  46. package/with-pz-config.js +1 -11
  47. package/assets/styles/index.css +0 -49
  48. package/assets/styles/index.css.map +0 -1
  49. package/components/file-input.tsx +0 -8
  50. package/hooks/use-message-listener.ts +0 -24
  51. package/lib/cache-handler.mjs +0 -33
  52. package/routes/pretty-url.tsx +0 -194
  53. package/utils/redirection-iframe.ts +0 -85
package/CHANGELOG.md CHANGED
@@ -1,331 +1,20 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.45.0-rc.5
4
-
5
- ### Minor Changes
6
-
7
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
8
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
9
- - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
10
- - fda5b92: ZERO-2725: fix invalid import
11
- - 2d9b2b2: ZERO-2816: Add segment to headers
12
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
13
- - 8d9ac9a: ZERO-2794: Add field to order type
14
- - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
15
- - 6c25f66: ZERO-2551: Check CACHE_HOST variable
16
- - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
17
- - 3bf2dd9: ZERO-2551: Fix search page
18
- - e9541a1: ZERO-2816: Add headers to url
19
- - 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.
20
- - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
21
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
22
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
23
- - 1448a96e: ZERO-2612: add errors type in CheckoutState
24
- - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
25
- - d3474c6: ZERO-2655: Add data source shipping option
26
- - 75080fd6: ZERO-2630: Add max limit to postcode area
27
- - 17f8752: ZERO-2816: Make the incoming currency lowercase
28
- - c45b62c: ZERO-2818: Add upload and download support for b2b package
29
- - 91265bba: ZERO-2551: Improve pretty url and caching performance
30
- - bbe18b9f: ZERO-2575: Fix build error
31
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
32
- - 4920742: Disable getCachedTranslations
33
- - 7e56d6b: ZERO-2841: Update api tagTypes
34
- - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
35
- - 98bb8dc: ZERO-2706: Cache getTranlations method
36
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
37
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
38
- - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
39
- - fad2768: ZERO-2739: add gpay to payment plugin map
40
- - dff0d595: ZERO-2659: add formData support to proxy api requests
41
- - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
42
- - f2c325c: ZERO-2838: Move file input component into @akinon/next
43
- - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
44
- - beb499e6: ZERO-2551: Add new tsconfig paths
45
- - 948eb42: ZERO-2852: Add out of stock endpoints
46
- - 146ea39: ZERO-2774: Update imports
47
- - f2c92d5: ZERO-2816: Update cookie name
48
- - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
49
- - c47be30: ZERO-2744: Update Order and OrderItem types
50
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
51
- - f046f8e0: ZERO-2575: update version for react-number-format
52
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
53
- - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
54
-
55
- ## 1.45.0-rc.4
56
-
57
- ### Minor Changes
58
-
59
- - 8f47cca: ZERO-2829: fix and add nested JSON support for useFormData in api/client route
60
-
61
- ## 1.45.0-rc.3
62
-
63
- ### Minor Changes
64
-
65
- - 948eb42: ZERO-2852: Add out of stock endpoints
66
-
67
- ## 1.45.0-rc.2
68
-
69
- ### Minor Changes
70
-
71
- - c45b62c: ZERO-2818: Add upload and download support for b2b package
72
- - f2c325c: ZERO-2838: Move file input component into @akinon/next
73
-
74
- ## 1.45.0-rc.1
75
-
76
- ### Minor Changes
77
-
78
- - 7e56d6b: ZERO-2841: Update api tagTypes
79
-
80
- ## 1.45.0-rc.0
81
-
82
- ### Minor Changes
83
-
84
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
85
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
86
- - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
87
- - fda5b92: ZERO-2725: fix invalid import
88
- - 2d9b2b2: ZERO-2816: Add segment to headers
89
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
90
- - 8d9ac9a: ZERO-2794: Add field to order type
91
- - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
92
- - 6c25f66: ZERO-2551: Check CACHE_HOST variable
93
- - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
94
- - 3bf2dd9: ZERO-2551: Fix search page
95
- - e9541a1: ZERO-2816: Add headers to url
96
- - 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.
97
- - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
98
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
99
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
100
- - 1448a96: ZERO-2612: add errors type in CheckoutState
101
- - 2ab6e08: ZERO-2841: Update getBasketDetail query
102
- - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
103
- - d3474c6: ZERO-2655: Add data source shipping option
104
- - 75080fd: ZERO-2630: Add max limit to postcode area
105
- - 17f8752: ZERO-2816: Make the incoming currency lowercase
106
- - 91265bb: ZERO-2551: Improve pretty url and caching performance
107
- - bbe18b9: ZERO-2575: Fix build error
108
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
109
- - 4920742: Disable getCachedTranslations
110
- - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
111
- - 98bb8dc: ZERO-2706: Cache getTranlations method
112
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
113
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
114
- - fad2768: ZERO-2739: add gpay to payment plugin map
115
- - dff0d59: ZERO-2659: add formData support to proxy api requests
116
- - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
117
- - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
118
- - beb499e: ZERO-2551: Add new tsconfig paths
119
- - 146ea39: ZERO-2774: Update imports
120
- - f2c92d5: ZERO-2816: Update cookie name
121
- - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
122
- - c47be30: ZERO-2744: Update Order and OrderItem types
123
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
124
- - f046f8e0: ZERO-2575: update version for react-number-format
125
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
126
- - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
127
-
128
- ## 1.44.0
129
-
130
- ## 1.43.0
131
-
132
- ### Minor Changes
133
-
134
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
135
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
136
- - a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
137
- - fda5b92: ZERO-2725: fix invalid import
138
- - 2d9b2b2: ZERO-2816: Add segment to headers
139
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
140
- - 8d9ac9a: ZERO-2794: Add field to order type
141
- - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
142
- - 6c25f66: ZERO-2551: Check CACHE_HOST variable
143
- - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
144
- - 3bf2dd9: ZERO-2551: Fix search page
145
- - e9541a1: ZERO-2816: Add headers to url
146
- - 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.
147
- - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
148
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
149
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
150
- - 1448a96: ZERO-2612: add errors type in CheckoutState
151
- - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
152
- - d3474c6: ZERO-2655: Add data source shipping option
153
- - 75080fd: ZERO-2630: Add max limit to postcode area
154
- - 17f8752: ZERO-2816: Make the incoming currency lowercase
155
- - 91265bb: ZERO-2551: Improve pretty url and caching performance
156
- - bbe18b9: ZERO-2575: Fix build error
157
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
158
- - 4920742: Disable getCachedTranslations
159
- - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
160
- - 98bb8dc: ZERO-2706: Cache getTranlations method
161
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
162
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
163
- - fad2768: ZERO-2739: add gpay to payment plugin map
164
- - dff0d59: ZERO-2659: add formData support to proxy api requests
165
- - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
166
- - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
167
- - beb499e: ZERO-2551: Add new tsconfig paths
168
- - 146ea39: ZERO-2774: Update imports
169
- - f2c92d5: ZERO-2816: Update cookie name
170
- - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
171
- - c47be30: ZERO-2744: Update Order and OrderItem types
172
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
173
- - f046f8e0: ZERO-2575: update version for react-number-format
174
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
175
- - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
176
-
177
- ## 1.43.0-rc.15
178
-
179
- ## 1.43.0-rc.14
180
-
181
- ### Minor Changes
182
-
183
- - 3bf2dd9: ZERO-2551: Fix search page
184
-
185
- ## 1.43.0-rc.13
186
-
187
- ### Minor Changes
3
+ ## 1.46.0
188
4
 
189
- - 9e25a64: ZERO-2835: Update category page layout with breadcrumb
190
-
191
- ## 1.43.0-rc.12
192
-
193
- ### Minor Changes
194
-
195
- - 4920742: Disable getCachedTranslations
196
-
197
- ## 1.43.0-rc.11
198
-
199
- ### Minor Changes
200
-
201
- - 6c25f66: ZERO-2551: Check CACHE_HOST variable
202
-
203
- ## 1.43.0-rc.10
204
-
205
- ### Minor Changes
206
-
207
- - d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
208
-
209
- ## 1.43.0-rc.9
5
+ ## 1.45.0
210
6
 
211
7
  ### Minor Changes
212
8
 
213
- - bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
214
-
215
- ## 1.43.0-rc.8
216
-
217
- ### Minor Changes
218
-
219
- - 70279e7: ZERO-2817: Add metrics endpoint in default middleware
220
- - 9d94f7e: ZERO-2820: update parent pk usage for menu generator
221
-
222
- ## 1.43.0-rc.7
223
-
224
- ### Minor Changes
9
+ - 2ab6e08: ZERO-2841: Update getBasketDetail query
225
10
 
226
- - 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
11
+ ## 1.44.0
227
12
 
228
- ## 1.43.0-rc.6
13
+ ## 1.43.0
229
14
 
230
15
  ### Minor Changes
231
16
 
232
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
233
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
234
- - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
235
- - fda5b92: ZERO-2725: fix invalid import
236
- - 2d9b2b2: ZERO-2816: Add segment to headers
237
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
238
- - 8d9ac9a: ZERO-2794: Add field to order type
239
- - e9541a1: ZERO-2816: Add headers to url
240
- - 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.
241
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
242
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
243
- - 1448a96: ZERO-2612: add errors type in CheckoutState
244
- - d3474c6: ZERO-2655: Add data source shipping option
245
- - 75080fd: ZERO-2630: Add max limit to postcode area
246
- - 17f8752: ZERO-2816: Make the incoming currency lowercase
247
- - 91265bb: ZERO-2551: Improve pretty url and caching performance
248
- - bbe18b9: ZERO-2575: Fix build error
249
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
250
- - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
251
- - 98bb8dc: ZERO-2706: Cache getTranlations method
252
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
253
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
254
- - fad2768: ZERO-2739: add gpay to payment plugin map
255
- - dff0d59: ZERO-2659: add formData support to proxy api requests
256
- - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
257
17
  - 4a163f2: ZERO-2761: Add condition for basket summary
258
- - beb499e: ZERO-2551: Add new tsconfig paths
259
- - 146ea39: ZERO-2774: Update imports
260
- - f2c92d5: ZERO-2816: Update cookie name
261
- - c47be30: ZERO-2744: Update Order and OrderItem types
262
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
263
- - f046f8e: ZERO-2575: update version for react-number-format
264
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
265
- - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
266
-
267
- ## 1.43.0-rc.5
268
-
269
- ### Minor Changes
270
-
271
- - 17f8752: ZERO-2816: Make the incoming currency lowercase
272
-
273
- ## 1.43.0-rc.4
274
-
275
- ### Minor Changes
276
-
277
- - 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
278
-
279
- ## 1.43.0-rc.3
280
-
281
- ### Minor Changes
282
-
283
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
284
-
285
- ## 1.43.0-rc.2
286
-
287
- ### Minor Changes
288
-
289
- - f2c92d5: ZERO-2816: Update cookie name
290
-
291
- ## 1.43.0-rc.1
292
-
293
- ### Minor Changes
294
-
295
- - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
296
-
297
- ## 1.43.0-rc.0
298
-
299
- ### Minor Changes
300
-
301
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
302
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
303
- - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
304
- - fda5b92: ZERO-2725: fix invalid import
305
- - 2d9b2b2: ZERO-2816: Add segment to headers
306
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
307
- - 8d9ac9a: ZERO-2794: Add field to order type
308
- - e9541a1: ZERO-2816: Add headers to url
309
- - 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.
310
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
311
- - 1448a96: ZERO-2612: add errors type in CheckoutState
312
- - d3474c6: ZERO-2655: Add data source shipping option
313
- - 75080fd: ZERO-2630: Add max limit to postcode area
314
- - 91265bb: ZERO-2551: Improve pretty url and caching performance
315
- - bbe18b9: ZERO-2575: Fix build error
316
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
317
- - 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
318
- - 98bb8dc: ZERO-2706: Cache getTranlations method
319
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
320
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
321
- - fad2768: ZERO-2739: add gpay to payment plugin map
322
- - dff0d59: ZERO-2659: add formData support to proxy api requests
323
- - beb499e: ZERO-2551: Add new tsconfig paths
324
- - 146ea39: ZERO-2774: Update imports
325
- - c47be30: ZERO-2744: Update Order and OrderItem types
326
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
327
- - f046f8e: ZERO-2575: update version for react-number-format
328
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
329
18
 
330
19
  ## 1.42.0
331
20
 
package/api/client.ts CHANGED
@@ -4,7 +4,6 @@ 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';
8
7
 
9
8
  interface RouteParams {
10
9
  params: {
@@ -75,33 +74,16 @@ async function proxyRequest(...args) {
75
74
  }
76
75
  } as RequestInit;
77
76
 
78
- const nextCookies = cookies();
79
- const segment = nextCookies.get('pz-segment')?.value;
80
- const currency = nextCookies.get('pz-external-currency')?.value;
81
-
82
- if (segment) {
83
- fetchOptions.headers['X-Segment-Id'] = segment;
84
- }
85
-
86
- if (currency) {
87
- fetchOptions.headers = Object.assign({}, fetchOptions.headers, {
88
- 'x-currency': currency
89
- });
90
- }
91
-
92
77
  if (options.contentType) {
93
78
  fetchOptions.headers['Content-Type'] = options.contentType;
94
79
  }
95
80
 
96
- const isMultipartFormData = req.headers
97
- .get('content-type')
98
- ?.includes('multipart/form-data;');
99
-
100
81
  if (req.method !== 'GET') {
101
- let body: Record<string, any> | FormData = {};
82
+ const formData = new URLSearchParams();
83
+ let body = {};
102
84
 
103
85
  try {
104
- body = isMultipartFormData ? await req.formData() : await req.json();
86
+ body = await req.json();
105
87
  } catch (error) {
106
88
  logger.error(
107
89
  `Client Proxy Request - Error while parsing request body to JSON`,
@@ -112,25 +94,13 @@ async function proxyRequest(...args) {
112
94
  );
113
95
  }
114
96
 
115
- if (isMultipartFormData) {
116
- fetchOptions.body = body as FormData;
117
- } else {
118
- const formData = new FormData();
119
-
120
- Object.keys(body ?? {}).forEach((key) => {
121
- if (body[key]) {
122
- if (typeof body[key] === 'object' && body[key] !== null) {
123
- formData.append(key, JSON.stringify(body[key]));
124
- } else {
125
- formData.append(key, body[key]);
126
- }
127
- }
128
- });
97
+ Object.keys(body ?? {}).forEach((key) => {
98
+ if (body[key]) {
99
+ formData.append(key, body[key]);
100
+ }
101
+ });
129
102
 
130
- fetchOptions.body = !options.useFormData
131
- ? JSON.stringify(body)
132
- : formData;
133
- }
103
+ fetchOptions.body = !options.useFormData ? JSON.stringify(body) : formData;
134
104
  }
135
105
 
136
106
  let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
@@ -1,53 +1,29 @@
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
- }
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
- }
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
+ }
@@ -19,4 +19,3 @@ export * from './trans';
19
19
  export * from './link';
20
20
  export * from './pagination';
21
21
  export * from './live-commerce';
22
- export * from './file-input';
@@ -1,30 +1,17 @@
1
1
  import clsx from 'clsx';
2
- import { forwardRef, FocusEvent, useState, Ref } from 'react';
2
+ import { forwardRef, FocusEvent, useState } from 'react';
3
3
  import { Controller } from 'react-hook-form';
4
-
5
- // @ts-ignore
6
- import { PatternFormat, PatternFormatProps } from 'react-number-format';
4
+ import NumberFormat, { NumberFormatProps } from 'react-number-format';
7
5
  import { InputProps } from '../types';
8
6
  import { twMerge } from 'tailwind-merge';
9
7
 
10
- const PatternFormatWithRef = forwardRef(
11
- (props: PatternFormatProps, ref: Ref<HTMLInputElement>) => {
12
- return <PatternFormat {...props} getInputRef={ref} />;
13
- }
14
- );
15
- PatternFormatWithRef.displayName = 'PatternFormatWithRef';
16
-
17
8
  export const Input = forwardRef<
18
9
  HTMLInputElement,
19
10
  InputProps &
20
11
  Pick<
21
- PatternFormatProps,
22
- 'mask' | 'allowEmptyFormatting' | 'onValueChange'
23
- > & {
24
- format?: string;
25
- defaultValue?: string;
26
- type?: string;
27
- }
12
+ NumberFormatProps,
13
+ 'format' | 'mask' | 'allowEmptyFormatting' | 'onValueChange'
14
+ >
28
15
  >((props, ref) => {
29
16
  const [focused, setFocused] = useState(false);
30
17
  const [hasValue, setHasValue] = useState(false);
@@ -50,7 +37,6 @@ export const Input = forwardRef<
50
37
  ),
51
38
  props.className
52
39
  );
53
-
54
40
  const inputProps: any = {
55
41
  id,
56
42
  ref,
@@ -93,14 +79,14 @@ export const Input = forwardRef<
93
79
  <Controller
94
80
  name={props.name ?? ''}
95
81
  control={props.control}
82
+ defaultValue={false}
96
83
  render={({ field }) => (
97
- <PatternFormatWithRef
84
+ <NumberFormat
98
85
  format={format}
99
86
  mask={mask ?? ''}
100
87
  {...rest}
101
88
  {...field}
102
89
  {...inputProps}
103
- type={props.type as 'text' | 'password' | 'tel'}
104
90
  />
105
91
  )}
106
92
  />
@@ -10,32 +10,28 @@ type LinkProps = Omit<
10
10
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
11
11
  keyof NextLinkProps
12
12
  > &
13
- NextLinkProps & {
14
- href: string;
15
- };
13
+ NextLinkProps;
16
14
 
17
15
  export const Link = ({ children, href, ...rest }: LinkProps) => {
18
16
  const { locale, defaultLocaleValue, localeUrlStrategy } = useLocalization();
19
17
  const formattedHref = useMemo(() => {
20
- if (!href) {
21
- return '#';
18
+ if (typeof href !== 'string' || href.startsWith('http')) {
19
+ return href;
22
20
  }
23
21
 
24
- if (typeof href === 'string' && !href.startsWith('http')) {
25
- const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
26
- const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
22
+ const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
23
+ const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
27
24
 
28
- if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
29
- return hrefWithLocale;
30
- } else if (
31
- localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
32
- locale !== defaultLocaleValue
33
- ) {
34
- return hrefWithLocale;
35
- }
25
+ if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
26
+ return hrefWithLocale;
27
+ } else if (
28
+ localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
29
+ locale !== defaultLocaleValue
30
+ ) {
31
+ return hrefWithLocale;
36
32
  }
37
33
 
38
- return href;
34
+ return href || '#';
39
35
  }, [href, defaultLocaleValue, locale, localeUrlStrategy]);
40
36
 
41
37
  return (
@@ -1,9 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { MouseEvent, useCallback, useEffect, useState } from 'react';
4
- import { PaginationProps } from '../types';
4
+ import { PaginationProps } from '@theme/components/types';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import clsx from 'clsx';
7
+
7
8
  import usePagination from '@akinon/next/hooks/use-pagination';
8
9
  import { useLocalization } from '@akinon/next/hooks';
9
10
  import { useRouter } from '@akinon/next/hooks';
@@ -1,14 +1,11 @@
1
1
  import { useMemo } from 'react';
2
-
3
- // @ts-ignore
4
- import { NumericFormat, NumericFormatProps } from 'react-number-format';
2
+ import NumberFormat, { NumberFormatProps } from 'react-number-format';
5
3
  import { getCurrency } from '@akinon/next/utils';
6
4
 
7
5
  import { useLocalization } from '@akinon/next/hooks';
8
6
  import { PriceProps } from '../types';
9
- import Settings from 'settings';
10
7
 
11
- export const Price = (props: NumericFormatProps & PriceProps) => {
8
+ export const Price = (props: NumberFormatProps & PriceProps) => {
12
9
  const {
13
10
  value,
14
11
  currencyCode,
@@ -30,10 +27,6 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
30
27
  // TODO: This is very bad practice. It broke decimalScale.
31
28
  const _value = value?.toString().replace('.', ',');
32
29
 
33
- const currentCurrencyDecimalScale = Settings.localization.currencies.find(
34
- (currency) => currency.code === currencyCode_
35
- ).decimalScale;
36
-
37
30
  const currency = useMemo(
38
31
  () =>
39
32
  getCurrency({
@@ -46,14 +39,14 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
46
39
  );
47
40
 
48
41
  return (
49
- <NumericFormat
42
+ <NumberFormat
50
43
  value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
51
44
  {...{
52
45
  [useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
53
46
  }}
54
47
  displayType={displayType}
55
48
  thousandSeparator={thousandSeparator}
56
- decimalScale={currentCurrencyDecimalScale ?? decimalScale}
49
+ decimalScale={decimalScale}
57
50
  decimalSeparator={decimalSeparator}
58
51
  fixedDecimalScale={fixedDecimalScale}
59
52
  {...rest}