@akinon/next 1.45.0-rc.0 → 1.45.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.
- package/CHANGELOG.md +4 -240
- package/api/client.ts +9 -33
- package/assets/styles/index.scss +26 -50
- package/components/input.tsx +7 -21
- package/components/link.tsx +13 -17
- package/components/pagination.tsx +2 -1
- package/components/price.tsx +4 -11
- package/components/selected-payment-option-view.tsx +38 -26
- package/data/client/account.ts +9 -10
- package/data/client/address.ts +8 -32
- package/data/client/api.ts +1 -1
- package/data/client/checkout.ts +4 -47
- package/data/server/category.ts +2 -2
- package/data/server/list.ts +2 -2
- package/data/server/product.ts +13 -15
- package/data/server/special-page.ts +2 -2
- package/data/urls.ts +1 -5
- package/hooks/index.ts +1 -2
- package/hooks/use-payment-options.ts +1 -2
- package/lib/cache.ts +6 -18
- package/middlewares/default.ts +2 -50
- package/middlewares/locale.ts +30 -32
- package/middlewares/pretty-url.ts +0 -4
- package/middlewares/url-redirection.ts +0 -4
- package/package.json +4 -5
- package/plugins.d.ts +0 -1
- package/redux/middlewares/checkout.ts +11 -70
- package/redux/reducers/checkout.ts +5 -24
- package/redux/reducers/config.ts +0 -2
- package/types/commerce/account.ts +0 -1
- package/types/commerce/address.ts +1 -1
- package/types/commerce/checkout.ts +0 -30
- package/types/commerce/misc.ts +0 -2
- package/types/commerce/order.ts +0 -12
- package/types/index.ts +2 -28
- package/utils/app-fetch.ts +1 -1
- package/utils/generate-commerce-search-params.ts +2 -6
- package/utils/index.ts +6 -27
- package/utils/menu-generator.ts +2 -2
- package/utils/server-translation.ts +1 -5
- package/with-pz-config.js +1 -11
- package/assets/styles/index.css +0 -49
- package/assets/styles/index.css.map +0 -1
- package/hooks/use-message-listener.ts +0 -24
- package/lib/cache-handler.mjs +0 -33
- package/routes/pretty-url.tsx +0 -194
- package/utils/redirection-iframe.ts +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -1,254 +1,18 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.45.0
|
|
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
|
-
- 1448a96: ZERO-2612: add errors type in CheckoutState
|
|
24
|
-
- 2ab6e08: ZERO-2841: Update getBasketDetail query
|
|
25
|
-
- d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
|
|
26
|
-
- d3474c6: ZERO-2655: Add data source shipping option
|
|
27
|
-
- 75080fd: ZERO-2630: Add max limit to postcode area
|
|
28
|
-
- 17f8752: ZERO-2816: Make the incoming currency lowercase
|
|
29
|
-
- 91265bb: ZERO-2551: Improve pretty url and caching performance
|
|
30
|
-
- bbe18b9: ZERO-2575: Fix build error
|
|
31
|
-
- d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
|
|
32
|
-
- 4920742: Disable getCachedTranslations
|
|
33
|
-
- 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
|
|
34
|
-
- 98bb8dc: ZERO-2706: Cache getTranlations method
|
|
35
|
-
- 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
|
|
36
|
-
- dcc8a15: ZERO-2694: added build step to RC branch pipeline
|
|
37
|
-
- fad2768: ZERO-2739: add gpay to payment plugin map
|
|
38
|
-
- dff0d59: ZERO-2659: add formData support to proxy api requests
|
|
39
|
-
- eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
|
|
40
|
-
- 9e25a64: ZERO-2835: Update category page layout with breadcrumb
|
|
41
|
-
- beb499e: ZERO-2551: Add new tsconfig paths
|
|
42
|
-
- 146ea39: ZERO-2774: Update imports
|
|
43
|
-
- f2c92d5: ZERO-2816: Update cookie name
|
|
44
|
-
- 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
|
|
45
|
-
- c47be30: ZERO-2744: Update Order and OrderItem types
|
|
46
|
-
- e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
|
|
47
|
-
- f046f8e0: ZERO-2575: update version for react-number-format
|
|
48
|
-
- 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
|
|
49
|
-
- 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
|
|
50
|
-
|
|
51
|
-
## 1.44.0
|
|
52
|
-
|
|
53
|
-
## 1.43.0
|
|
54
|
-
|
|
55
|
-
### Minor Changes
|
|
56
|
-
|
|
57
|
-
- 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
|
|
58
|
-
- 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
|
|
59
|
-
- a4c8d6a9: ZERO-2663: Fix the image url for gif and svgs and return them without options
|
|
60
|
-
- fda5b92: ZERO-2725: fix invalid import
|
|
61
|
-
- 2d9b2b2: ZERO-2816: Add segment to headers
|
|
62
|
-
- c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
|
|
63
|
-
- 8d9ac9a: ZERO-2794: Add field to order type
|
|
64
|
-
- 70279e7: ZERO-2817: Add metrics endpoint in default middleware
|
|
65
|
-
- 6c25f66: ZERO-2551: Check CACHE_HOST variable
|
|
66
|
-
- bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
|
|
67
|
-
- 3bf2dd9: ZERO-2551: Fix search page
|
|
68
|
-
- e9541a1: ZERO-2816: Add headers to url
|
|
69
|
-
- 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.
|
|
70
|
-
- 9d94f7e: ZERO-2820: update parent pk usage for menu generator
|
|
71
|
-
- 64699d3: ZERO-2761: Fix invalid import for plugin module
|
|
72
|
-
- 0d3a913: ZERO-2725: Update decimal scale in Price component
|
|
73
|
-
- 1448a96: ZERO-2612: add errors type in CheckoutState
|
|
74
|
-
- d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
|
|
75
|
-
- d3474c6: ZERO-2655: Add data source shipping option
|
|
76
|
-
- 75080fd: ZERO-2630: Add max limit to postcode area
|
|
77
|
-
- 17f8752: ZERO-2816: Make the incoming currency lowercase
|
|
78
|
-
- 91265bb: ZERO-2551: Improve pretty url and caching performance
|
|
79
|
-
- bbe18b9: ZERO-2575: Fix build error
|
|
80
|
-
- d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
|
|
81
|
-
- 4920742: Disable getCachedTranslations
|
|
82
|
-
- 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
|
|
83
|
-
- 98bb8dc: ZERO-2706: Cache getTranlations method
|
|
84
|
-
- 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
|
|
85
|
-
- dcc8a15: ZERO-2694: added build step to RC branch pipeline
|
|
86
|
-
- fad2768: ZERO-2739: add gpay to payment plugin map
|
|
87
|
-
- dff0d59: ZERO-2659: add formData support to proxy api requests
|
|
88
|
-
- eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
|
|
89
|
-
- 9e25a64: ZERO-2835: Update category page layout with breadcrumb
|
|
90
|
-
- beb499e: ZERO-2551: Add new tsconfig paths
|
|
91
|
-
- 146ea39: ZERO-2774: Update imports
|
|
92
|
-
- f2c92d5: ZERO-2816: Update cookie name
|
|
93
|
-
- 7bd3d99: ZERO-2801: Refactor locale middleware to handle single locale configuration
|
|
94
|
-
- c47be30: ZERO-2744: Update Order and OrderItem types
|
|
95
|
-
- e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
|
|
96
|
-
- f046f8e0: ZERO-2575: update version for react-number-format
|
|
97
|
-
- 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
|
|
98
|
-
- 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
|
|
99
|
-
|
|
100
|
-
## 1.43.0-rc.15
|
|
101
|
-
|
|
102
|
-
## 1.43.0-rc.14
|
|
103
|
-
|
|
104
|
-
### Minor Changes
|
|
105
|
-
|
|
106
|
-
- 3bf2dd9: ZERO-2551: Fix search page
|
|
107
|
-
|
|
108
|
-
## 1.43.0-rc.13
|
|
109
|
-
|
|
110
|
-
### Minor Changes
|
|
111
|
-
|
|
112
|
-
- 9e25a64: ZERO-2835: Update category page layout with breadcrumb
|
|
113
|
-
|
|
114
|
-
## 1.43.0-rc.12
|
|
115
|
-
|
|
116
|
-
### Minor Changes
|
|
117
|
-
|
|
118
|
-
- 4920742: Disable getCachedTranslations
|
|
119
|
-
|
|
120
|
-
## 1.43.0-rc.11
|
|
121
|
-
|
|
122
|
-
### Minor Changes
|
|
123
|
-
|
|
124
|
-
- 6c25f66: ZERO-2551: Check CACHE_HOST variable
|
|
125
|
-
|
|
126
|
-
## 1.43.0-rc.10
|
|
127
|
-
|
|
128
|
-
### Minor Changes
|
|
129
|
-
|
|
130
|
-
- d6edb1d: ZERO-2551: Fix searchparams handling for list and other routes
|
|
131
|
-
|
|
132
|
-
## 1.43.0-rc.9
|
|
133
|
-
|
|
134
|
-
### Minor Changes
|
|
135
|
-
|
|
136
|
-
- bc2b411: ZERO-2825: Add attribute-based shipping options to checkout page
|
|
137
|
-
|
|
138
|
-
## 1.43.0-rc.8
|
|
3
|
+
## 1.45.0
|
|
139
4
|
|
|
140
5
|
### Minor Changes
|
|
141
6
|
|
|
142
|
-
-
|
|
143
|
-
- 9d94f7e: ZERO-2820: update parent pk usage for menu generator
|
|
144
|
-
|
|
145
|
-
## 1.43.0-rc.7
|
|
146
|
-
|
|
147
|
-
### Minor Changes
|
|
7
|
+
- 2ab6e08: ZERO-2841: Update getBasketDetail query
|
|
148
8
|
|
|
149
|
-
|
|
9
|
+
## 1.44.0
|
|
150
10
|
|
|
151
|
-
## 1.43.0
|
|
11
|
+
## 1.43.0
|
|
152
12
|
|
|
153
13
|
### Minor Changes
|
|
154
14
|
|
|
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
|
-
- a4c8d6a: 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
|
-
- e9541a1: ZERO-2816: Add headers to url
|
|
163
|
-
- 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.
|
|
164
|
-
- 64699d3: ZERO-2761: Fix invalid import for plugin module
|
|
165
|
-
- 0d3a913: ZERO-2725: Update decimal scale in Price component
|
|
166
|
-
- 1448a96: ZERO-2612: add errors type in CheckoutState
|
|
167
|
-
- d3474c6: ZERO-2655: Add data source shipping option
|
|
168
|
-
- 75080fd: ZERO-2630: Add max limit to postcode area
|
|
169
|
-
- 17f8752: ZERO-2816: Make the incoming currency lowercase
|
|
170
|
-
- 91265bb: ZERO-2551: Improve pretty url and caching performance
|
|
171
|
-
- bbe18b9: ZERO-2575: Fix build error
|
|
172
|
-
- d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
|
|
173
|
-
- 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
|
|
174
|
-
- 98bb8dc: ZERO-2706: Cache getTranlations method
|
|
175
|
-
- 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
|
|
176
|
-
- dcc8a15: ZERO-2694: added build step to RC branch pipeline
|
|
177
|
-
- fad2768: ZERO-2739: add gpay to payment plugin map
|
|
178
|
-
- dff0d59: ZERO-2659: add formData support to proxy api requests
|
|
179
|
-
- eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
|
|
180
15
|
- 4a163f2: ZERO-2761: Add condition for basket summary
|
|
181
|
-
- beb499e: ZERO-2551: Add new tsconfig paths
|
|
182
|
-
- 146ea39: ZERO-2774: Update imports
|
|
183
|
-
- f2c92d5: ZERO-2816: Update cookie name
|
|
184
|
-
- c47be30: ZERO-2744: Update Order and OrderItem types
|
|
185
|
-
- e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
|
|
186
|
-
- f046f8e: ZERO-2575: update version for react-number-format
|
|
187
|
-
- 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
|
|
188
|
-
- 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
|
|
189
|
-
|
|
190
|
-
## 1.43.0-rc.5
|
|
191
|
-
|
|
192
|
-
### Minor Changes
|
|
193
|
-
|
|
194
|
-
- 17f8752: ZERO-2816: Make the incoming currency lowercase
|
|
195
|
-
|
|
196
|
-
## 1.43.0-rc.4
|
|
197
|
-
|
|
198
|
-
### Minor Changes
|
|
199
|
-
|
|
200
|
-
- 3f9b8d7: ZERO-2761: Update plugins.js for akinon-next
|
|
201
|
-
|
|
202
|
-
## 1.43.0-rc.3
|
|
203
|
-
|
|
204
|
-
### Minor Changes
|
|
205
|
-
|
|
206
|
-
- 64699d3: ZERO-2761: Fix invalid import for plugin module
|
|
207
|
-
|
|
208
|
-
## 1.43.0-rc.2
|
|
209
|
-
|
|
210
|
-
### Minor Changes
|
|
211
|
-
|
|
212
|
-
- f2c92d5: ZERO-2816: Update cookie name
|
|
213
|
-
|
|
214
|
-
## 1.43.0-rc.1
|
|
215
|
-
|
|
216
|
-
### Minor Changes
|
|
217
|
-
|
|
218
|
-
- eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
|
|
219
|
-
|
|
220
|
-
## 1.43.0-rc.0
|
|
221
|
-
|
|
222
|
-
### Minor Changes
|
|
223
|
-
|
|
224
|
-
- 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
|
|
225
|
-
- 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
|
|
226
|
-
- a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
|
|
227
|
-
- fda5b92: ZERO-2725: fix invalid import
|
|
228
|
-
- 2d9b2b2: ZERO-2816: Add segment to headers
|
|
229
|
-
- c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
|
|
230
|
-
- 8d9ac9a: ZERO-2794: Add field to order type
|
|
231
|
-
- e9541a1: ZERO-2816: Add headers to url
|
|
232
|
-
- 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.
|
|
233
|
-
- 0d3a913: ZERO-2725: Update decimal scale in Price component
|
|
234
|
-
- 1448a96: ZERO-2612: add errors type in CheckoutState
|
|
235
|
-
- d3474c6: ZERO-2655: Add data source shipping option
|
|
236
|
-
- 75080fd: ZERO-2630: Add max limit to postcode area
|
|
237
|
-
- 91265bb: ZERO-2551: Improve pretty url and caching performance
|
|
238
|
-
- bbe18b9: ZERO-2575: Fix build error
|
|
239
|
-
- d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
|
|
240
|
-
- 94b6928: ZERO-2551: Add cache handler check in url-redirection middleware
|
|
241
|
-
- 98bb8dc: ZERO-2706: Cache getTranlations method
|
|
242
|
-
- 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
|
|
243
|
-
- dcc8a15: ZERO-2694: added build step to RC branch pipeline
|
|
244
|
-
- fad2768: ZERO-2739: add gpay to payment plugin map
|
|
245
|
-
- dff0d59: ZERO-2659: add formData support to proxy api requests
|
|
246
|
-
- beb499e: ZERO-2551: Add new tsconfig paths
|
|
247
|
-
- 146ea39: ZERO-2774: Update imports
|
|
248
|
-
- c47be30: ZERO-2744: Update Order and OrderItem types
|
|
249
|
-
- e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
|
|
250
|
-
- f046f8e: ZERO-2575: update version for react-number-format
|
|
251
|
-
- 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
|
|
252
16
|
|
|
253
17
|
## 1.42.0
|
|
254
18
|
|
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,31 +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.get('content-type')?.includes('multipart/form-data;');
|
|
97
|
-
|
|
98
81
|
if (req.method !== 'GET') {
|
|
99
|
-
|
|
82
|
+
const formData = new URLSearchParams();
|
|
83
|
+
let body = {};
|
|
100
84
|
|
|
101
85
|
try {
|
|
102
|
-
body =
|
|
86
|
+
body = await req.json();
|
|
103
87
|
} catch (error) {
|
|
104
88
|
logger.error(
|
|
105
89
|
`Client Proxy Request - Error while parsing request body to JSON`,
|
|
@@ -110,21 +94,13 @@ async function proxyRequest(...args) {
|
|
|
110
94
|
);
|
|
111
95
|
}
|
|
112
96
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Object.keys(body ?? {}).forEach((key) => {
|
|
119
|
-
if (body[key]) {
|
|
120
|
-
formData.append(key, body[key]);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
97
|
+
Object.keys(body ?? {}).forEach((key) => {
|
|
98
|
+
if (body[key]) {
|
|
99
|
+
formData.append(key, body[key]);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
123
102
|
|
|
124
|
-
|
|
125
|
-
? JSON.stringify(body)
|
|
126
|
-
: formData;
|
|
127
|
-
}
|
|
103
|
+
fetchOptions.body = !options.useFormData ? JSON.stringify(body) : formData;
|
|
128
104
|
}
|
|
129
105
|
|
|
130
106
|
let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
|
package/assets/styles/index.scss
CHANGED
|
@@ -1,53 +1,29 @@
|
|
|
1
1
|
.checkout-payment-iframe-wrapper {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
iframe {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
border: none;
|
|
15
|
+
background-color: white;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
}
|
package/components/input.tsx
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import { forwardRef, FocusEvent, useState
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
/>
|
package/components/link.tsx
CHANGED
|
@@ -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 (
|
|
21
|
-
return
|
|
18
|
+
if (typeof href !== 'string' || href.startsWith('http')) {
|
|
19
|
+
return href;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
|
|
22
|
+
const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
|
|
23
|
+
const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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 '
|
|
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';
|
package/components/price.tsx
CHANGED
|
@@ -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:
|
|
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
|
-
<
|
|
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={
|
|
49
|
+
decimalScale={decimalScale}
|
|
57
50
|
decimalSeparator={decimalSeparator}
|
|
58
51
|
fixedDecimalScale={fixedDecimalScale}
|
|
59
52
|
{...rest}
|
|
@@ -6,21 +6,6 @@ import dynamic from 'next/dynamic';
|
|
|
6
6
|
import { PaymentOptionViews } from 'views/checkout/steps/payment';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
const fallbackView = () => <div />;
|
|
10
|
-
|
|
11
|
-
const paymentTypeToView = {
|
|
12
|
-
bkm_express: 'bkm',
|
|
13
|
-
credit_card: 'credit-card',
|
|
14
|
-
credit_payment: 'credit-payment',
|
|
15
|
-
funds_transfer: 'funds-transfer',
|
|
16
|
-
gpay: 'gpay',
|
|
17
|
-
loyalty_money: 'loyalty',
|
|
18
|
-
masterpass: 'credit-card',
|
|
19
|
-
pay_on_delivery: 'pay-on-delivery',
|
|
20
|
-
redirection: 'redirection'
|
|
21
|
-
// Add other mappings as needed
|
|
22
|
-
};
|
|
23
|
-
|
|
24
9
|
export default function SelectedPaymentOptionView() {
|
|
25
10
|
const { payment_option } = useAppSelector(
|
|
26
11
|
(state: RootState) => state.checkout.preOrder
|
|
@@ -29,7 +14,7 @@ export default function SelectedPaymentOptionView() {
|
|
|
29
14
|
const Component = useMemo(
|
|
30
15
|
() =>
|
|
31
16
|
dynamic(
|
|
32
|
-
|
|
17
|
+
() => {
|
|
33
18
|
const customOption = PaymentOptionViews.find(
|
|
34
19
|
(opt) => opt.slug === payment_option.slug
|
|
35
20
|
);
|
|
@@ -44,19 +29,46 @@ export default function SelectedPaymentOptionView() {
|
|
|
44
29
|
});
|
|
45
30
|
}
|
|
46
31
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
let promise: any;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
if (payment_option.payment_type === 'credit_card') {
|
|
36
|
+
promise = import(
|
|
37
|
+
`views/checkout/steps/payment/options/credit-card`
|
|
38
|
+
);
|
|
39
|
+
} else if (payment_option.payment_type === 'funds_transfer') {
|
|
40
|
+
promise = import(
|
|
41
|
+
`views/checkout/steps/payment/options/funds-transfer`
|
|
42
|
+
);
|
|
43
|
+
} else if (payment_option.payment_type === 'redirection') {
|
|
44
|
+
promise = import(
|
|
45
|
+
`views/checkout/steps/payment/options/redirection`
|
|
46
|
+
);
|
|
47
|
+
} else if (payment_option.payment_type === 'pay_on_delivery') {
|
|
48
|
+
promise = import(
|
|
49
|
+
`views/checkout/steps/payment/options/pay-on-delivery`
|
|
50
|
+
);
|
|
51
|
+
} else if (payment_option.payment_type === 'loyalty_money') {
|
|
52
|
+
promise = import(`views/checkout/steps/payment/options/loyalty`);
|
|
53
|
+
} else if (payment_option.payment_type === 'masterpass') {
|
|
54
|
+
promise = import(
|
|
55
|
+
`views/checkout/steps/payment/options/credit-card`
|
|
52
56
|
);
|
|
53
|
-
return mod.default || fallbackView;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
return fallbackView;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
// else if (payment_option.payment_type === 'credit_payment') {
|
|
59
|
+
// promise = import(`views/checkout/steps/payment/options/credit-payment`);
|
|
60
|
+
// }
|
|
61
|
+
// else if (payment_option.payment_type === 'gpay') {
|
|
62
|
+
// promise = import(`views/checkout/steps/payment/options/gpay`);
|
|
63
|
+
// }
|
|
64
|
+
// else if (payment_option.payment_type === 'bkm_express') {
|
|
65
|
+
// promise = import(`views/checkout/steps/payment/options/bkm`);
|
|
66
|
+
// }
|
|
67
|
+
} catch (error) {}
|
|
58
68
|
|
|
59
|
-
return
|
|
69
|
+
return promise
|
|
70
|
+
? promise.then((mod) => mod.default).catch(() => () => null)
|
|
71
|
+
: new Promise<any>((resolve) => resolve(() => null));
|
|
60
72
|
},
|
|
61
73
|
{ ssr: false }
|
|
62
74
|
),
|