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