@akinon/next 1.118.0-rc.8 → 1.118.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 +1 -51
- package/bin/pz-generate-routes.js +1 -10
- package/components/plugin-module.tsx +2 -2
- package/data/client/account.ts +1 -12
- package/data/client/checkout.ts +24 -42
- package/data/urls.ts +1 -5
- package/lib/cache-handler.mjs +2 -8
- package/lib/cache.ts +3 -8
- package/middlewares/default.ts +7 -15
- package/middlewares/index.ts +1 -3
- package/package.json +2 -2
- package/plugins.d.ts +0 -10
- package/plugins.js +0 -1
- package/redux/middlewares/checkout.ts +1 -11
- package/redux/middlewares/pre-order/installment-option.ts +1 -9
- package/types/index.ts +0 -6
- package/utils/index.ts +0 -17
- package/utils/mobile-3d-iframe.ts +2 -8
- package/utils/redirection-iframe.ts +2 -8
- package/with-pz-config.js +4 -1
- package/api/barcode-search.ts +0 -59
- package/middlewares/bfcache-headers.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,60 +1,10 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.118.0
|
|
3
|
+
## 1.118.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- 31b4a266: ZERO-4102: Add support for post-checkout redirect in middleware
|
|
8
|
-
|
|
9
|
-
## 1.118.0-rc.7
|
|
10
|
-
|
|
11
|
-
## 1.118.0-rc.6
|
|
12
|
-
|
|
13
|
-
## 1.118.0-rc.5
|
|
14
|
-
|
|
15
|
-
### Minor Changes
|
|
16
|
-
|
|
17
|
-
- aef81c5d: ZERO-4034: Refactor checkout API to use dynamic store imports for improved performance
|
|
18
|
-
- 49c82e1a: ZERO-4047: Remove Sentry configuration from default Next.js config
|
|
19
|
-
|
|
20
|
-
## 1.118.0-rc.4
|
|
21
|
-
|
|
22
|
-
### Minor Changes
|
|
23
|
-
|
|
24
|
-
- 0754c835: ZERO-4063: Add support for optional Redis password in cache handlers
|
|
25
|
-
|
|
26
|
-
## 1.118.0-rc.3
|
|
27
|
-
|
|
28
|
-
### Minor Changes
|
|
29
|
-
|
|
30
|
-
- 94a86fcc: ZERO-4065: Expand skipSegments array to include additional segments for route generation
|
|
31
|
-
|
|
32
|
-
## 1.118.0-rc.2
|
|
33
|
-
|
|
34
|
-
### Minor Changes
|
|
35
|
-
|
|
36
|
-
- 8a7fd0f4: ZERO-4065: Add '[segment]' to skipSegments in route generation
|
|
37
|
-
|
|
38
|
-
## 1.118.0-rc.1
|
|
39
|
-
|
|
40
|
-
## 1.118.0-rc.0
|
|
41
|
-
|
|
42
|
-
### Minor Changes
|
|
43
|
-
|
|
44
|
-
- d2c0e759: ZERO-3684: Handle cross-origin iframe access in iframeURLChange function
|
|
45
|
-
- b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
46
|
-
- 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
|
|
47
|
-
- f7e0f646: ZERO-4032: Add bfcache-headers middleware, integrate it into the default chain, and introduce a new environment variable for control.
|
|
48
|
-
- 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
|
|
49
|
-
- 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
|
|
50
7
|
- 729fe756: ZERO-3895: improve non-3D payment handling and error display
|
|
51
|
-
- d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
|
|
52
|
-
- d7e5178b: ZERO-3985: Add query string handling for orders redirection in middleware
|
|
53
|
-
- 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
|
|
54
|
-
- 4de5303c: ZERO-2504: add cookie filter to api client request
|
|
55
|
-
- b59fdd1c: ZERO-4009: Add password reset token validation
|
|
56
|
-
- 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
|
|
57
|
-
- 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
|
|
58
8
|
|
|
59
9
|
## 1.117.0
|
|
60
10
|
|
|
@@ -25,16 +25,7 @@ const generateRoutes = () => {
|
|
|
25
25
|
const routes = [];
|
|
26
26
|
const excludedDirs = ['api', 'pz-not-found'];
|
|
27
27
|
|
|
28
|
-
const skipSegments = [
|
|
29
|
-
'[commerce]',
|
|
30
|
-
'[locale]',
|
|
31
|
-
'[currency]',
|
|
32
|
-
'[session]',
|
|
33
|
-
'[segment]',
|
|
34
|
-
'[url]',
|
|
35
|
-
'[theme]',
|
|
36
|
-
'[member_type]'
|
|
37
|
-
];
|
|
28
|
+
const skipSegments = ['[commerce]', '[locale]', '[currency]'];
|
|
38
29
|
const skipCatchAllRoutes = ['[...prettyurl]', '[...not_found]'];
|
|
39
30
|
|
|
40
31
|
const walkDirectory = (dir, basePath = '') => {
|
|
@@ -55,7 +55,6 @@ export enum Component {
|
|
|
55
55
|
SavedCard = 'SavedCardOption',
|
|
56
56
|
VirtualTryOnPlugin = 'VirtualTryOnPlugin',
|
|
57
57
|
BasketVirtualTryOn = 'BasketVirtualTryOn',
|
|
58
|
-
BarcodeScannerPlugin = 'BarcodeScannerPlugin',
|
|
59
58
|
IyzicoSavedCard = 'IyzicoSavedCardOption',
|
|
60
59
|
Hepsipay = 'Hepsipay',
|
|
61
60
|
FlowPayment = 'FlowPayment',
|
|
@@ -114,10 +113,11 @@ const PluginComponents = new Map([
|
|
|
114
113
|
]
|
|
115
114
|
],
|
|
116
115
|
[Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
|
|
116
|
+
[Plugin.SavedCard, [Component.SavedCard]],
|
|
117
117
|
[Plugin.FlowPayment, [Component.FlowPayment]],
|
|
118
118
|
[
|
|
119
119
|
Plugin.VirtualTryOn,
|
|
120
|
-
[Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn
|
|
120
|
+
[Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn]
|
|
121
121
|
],
|
|
122
122
|
[Plugin.Hepsipay, [Component.Hepsipay]],
|
|
123
123
|
[Plugin.MasterpassRest, [Component.MasterpassRest]],
|
package/data/client/account.ts
CHANGED
|
@@ -77,10 +77,6 @@ interface LoyaltyTransactions {
|
|
|
77
77
|
}[];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
interface PasswordResetValidateResponse {
|
|
81
|
-
validlink: boolean;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
80
|
const accountApi = api.injectEndpoints({
|
|
85
81
|
endpoints: (builder) => ({
|
|
86
82
|
updatePassword: builder.mutation<void, AccountChangePasswordFormType>({
|
|
@@ -225,12 +221,6 @@ const accountApi = api.injectEndpoints({
|
|
|
225
221
|
}),
|
|
226
222
|
getLoyaltyTransactions: builder.query<LoyaltyTransactions, void>({
|
|
227
223
|
query: () => buildClientRequestUrl(account.loyaltyTransactions)
|
|
228
|
-
}),
|
|
229
|
-
getValidatePasswordResetToken: builder.query<
|
|
230
|
-
PasswordResetValidateResponse,
|
|
231
|
-
string
|
|
232
|
-
>({
|
|
233
|
-
query: (slug) => buildClientRequestUrl(account.passwordReset(slug))
|
|
234
224
|
})
|
|
235
225
|
}),
|
|
236
226
|
overrideExisting: true
|
|
@@ -257,6 +247,5 @@ export const {
|
|
|
257
247
|
usePasswordResetMutation,
|
|
258
248
|
useAnonymizeMutation,
|
|
259
249
|
useGetLoyaltyBalanceQuery,
|
|
260
|
-
useGetLoyaltyTransactionsQuery
|
|
261
|
-
useGetValidatePasswordResetTokenQuery
|
|
250
|
+
useGetLoyaltyTransactionsQuery
|
|
262
251
|
} = accountApi;
|
package/data/client/checkout.ts
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { buildClientRequestUrl } from '../../utils';
|
|
21
21
|
import { api } from './api';
|
|
22
22
|
import { checkout } from '../urls';
|
|
23
|
-
import
|
|
23
|
+
import { AppDispatch, AppStore, store } from 'redux/store';
|
|
24
24
|
import settings from 'settings';
|
|
25
25
|
import { showMobile3dIframe } from '../../utils/mobile-3d-iframe';
|
|
26
26
|
import {
|
|
@@ -33,11 +33,6 @@ import {
|
|
|
33
33
|
buildPurchaseForm
|
|
34
34
|
} from '@akinon/pz-masterpass/src/utils';
|
|
35
35
|
|
|
36
|
-
const getStore = async (): Promise<AppStore> => {
|
|
37
|
-
const { store } = await import('redux/store');
|
|
38
|
-
return store;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
interface CheckoutResponse {
|
|
42
37
|
pre_order?: PreOrder;
|
|
43
38
|
errors: {
|
|
@@ -236,32 +231,25 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
236
231
|
CheckoutResponse,
|
|
237
232
|
CompleteCreditCardParams
|
|
238
233
|
>({
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
_queryApi,
|
|
250
|
-
_extraOptions,
|
|
251
|
-
baseQuery
|
|
252
|
-
) {
|
|
253
|
-
const reduxStore = await getStore();
|
|
234
|
+
query: ({
|
|
235
|
+
card_holder,
|
|
236
|
+
card_cvv,
|
|
237
|
+
card_number,
|
|
238
|
+
card_month,
|
|
239
|
+
card_year,
|
|
240
|
+
use_three_d = true,
|
|
241
|
+
save = undefined
|
|
242
|
+
}) => {
|
|
254
243
|
const paymentOption =
|
|
255
|
-
|
|
244
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
256
245
|
|
|
257
246
|
if (paymentOption?.payment_type === 'masterpass') {
|
|
258
|
-
|
|
247
|
+
return {
|
|
259
248
|
url: buildClientRequestUrl(checkout.getMasterpassOrderNo, {
|
|
260
249
|
useFormData: true
|
|
261
250
|
}),
|
|
262
251
|
method: 'POST'
|
|
263
|
-
}
|
|
264
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
252
|
+
};
|
|
265
253
|
}
|
|
266
254
|
|
|
267
255
|
const body: Record<string, string> = {
|
|
@@ -278,19 +266,18 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
278
266
|
body.save = save ? '1' : '0';
|
|
279
267
|
}
|
|
280
268
|
|
|
281
|
-
|
|
269
|
+
return {
|
|
282
270
|
url: buildClientRequestUrl(checkout.completeCreditCardPayment, {
|
|
283
271
|
useFormData: true
|
|
284
272
|
}),
|
|
285
273
|
method: 'POST',
|
|
286
274
|
body
|
|
287
|
-
}
|
|
288
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
275
|
+
};
|
|
289
276
|
},
|
|
290
277
|
async onQueryStarted(args, { dispatch, queryFulfilled }) {
|
|
291
278
|
dispatch(setPaymentStepBusy(true));
|
|
292
279
|
const { data } = await queryFulfilled;
|
|
293
|
-
const reduxStore = await
|
|
280
|
+
const reduxStore = (await import('redux/store')).store;
|
|
294
281
|
const completePaymentContext = data?.context_list?.find(
|
|
295
282
|
(context) => context?.page_name === 'MasterpassCompletePage'
|
|
296
283
|
);
|
|
@@ -535,16 +522,15 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
535
522
|
}
|
|
536
523
|
}),
|
|
537
524
|
setBinNumber: build.mutation<CheckoutResponse, string>({
|
|
538
|
-
|
|
539
|
-
const reduxStore = await getStore();
|
|
525
|
+
query: (binNumber: string) => {
|
|
540
526
|
const paymentOption =
|
|
541
|
-
|
|
527
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
542
528
|
const binNumberUrl =
|
|
543
529
|
paymentOption?.payment_type === 'masterpass'
|
|
544
530
|
? checkout.setMasterpassBinNumber
|
|
545
531
|
: checkout.setBinNumber;
|
|
546
532
|
|
|
547
|
-
|
|
533
|
+
return {
|
|
548
534
|
url: buildClientRequestUrl(binNumberUrl, {
|
|
549
535
|
useFormData: true
|
|
550
536
|
}),
|
|
@@ -552,8 +538,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
552
538
|
body: {
|
|
553
539
|
bin_number: binNumber
|
|
554
540
|
}
|
|
555
|
-
}
|
|
556
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
541
|
+
};
|
|
557
542
|
},
|
|
558
543
|
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
559
544
|
dispatch(setPaymentStepBusy(true));
|
|
@@ -563,16 +548,14 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
563
548
|
}
|
|
564
549
|
}),
|
|
565
550
|
setInstallmentOption: build.mutation<CheckoutResponse, number>({
|
|
566
|
-
|
|
567
|
-
const reduxStore = await getStore();
|
|
551
|
+
query: (pk: number) => {
|
|
568
552
|
const paymentOption =
|
|
569
|
-
|
|
553
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
570
554
|
const installmentOption =
|
|
571
555
|
paymentOption?.payment_type === 'masterpass'
|
|
572
556
|
? checkout.setMasterPassInstallmentOption
|
|
573
557
|
: checkout.setInstallmentOption;
|
|
574
|
-
|
|
575
|
-
const result = await baseQuery({
|
|
558
|
+
return {
|
|
576
559
|
url: buildClientRequestUrl(installmentOption, {
|
|
577
560
|
useFormData: true
|
|
578
561
|
}),
|
|
@@ -580,8 +563,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
580
563
|
body: {
|
|
581
564
|
installment: String(pk)
|
|
582
565
|
}
|
|
583
|
-
}
|
|
584
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
566
|
+
};
|
|
585
567
|
},
|
|
586
568
|
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
587
569
|
dispatch(setPaymentStepBusy(true));
|
package/data/urls.ts
CHANGED
|
@@ -183,11 +183,7 @@ export const product = {
|
|
|
183
183
|
breadcrumbUrl: (menuitemmodel: string) =>
|
|
184
184
|
`/menus/generate_breadcrumb/?item=${menuitemmodel}&generator_name=menu_item`,
|
|
185
185
|
bundleProduct: (productPk: string, queryString: string) =>
|
|
186
|
-
`/bundle-product/${productPk}/?${queryString}
|
|
187
|
-
similarProducts: (params?: string) =>
|
|
188
|
-
`/similar-products${params ? `?${params}` : ''}`,
|
|
189
|
-
similarProductsList: (params?: string) =>
|
|
190
|
-
`/similar-product-list${params ? `?${params}` : ''}`
|
|
186
|
+
`/bundle-product/${productPk}/?${queryString}`
|
|
191
187
|
};
|
|
192
188
|
|
|
193
189
|
export const wishlist = {
|
package/lib/cache-handler.mjs
CHANGED
|
@@ -364,17 +364,11 @@ CacheHandler.onCreation(async () => {
|
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
const
|
|
367
|
+
const redisHandler = createRedisHandler({
|
|
368
368
|
client,
|
|
369
369
|
timeoutMs: CACHE_CONFIG.redis.timeoutMs,
|
|
370
370
|
keyExpirationStrategy: 'EXPIREAT'
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
if (process.env.CACHE_PASSWORD) {
|
|
374
|
-
redisOptions.password = process.env.CACHE_PASSWORD;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
const redisHandler = createRedisHandler(redisOptions);
|
|
371
|
+
});
|
|
378
372
|
|
|
379
373
|
const localHandler = createLruHandler(CACHE_CONFIG.lru);
|
|
380
374
|
|
package/lib/cache.ts
CHANGED
|
@@ -155,14 +155,9 @@ export class Cache {
|
|
|
155
155
|
process.env.CACHE_PORT
|
|
156
156
|
}/${process.env.CACHE_BUCKET ?? '0'}`;
|
|
157
157
|
|
|
158
|
-
const
|
|
159
|
-
url: redisUrl
|
|
160
|
-
|
|
161
|
-
password: process.env.CACHE_PASSWORD
|
|
162
|
-
})
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const client: RedisClientType = createClient(options);
|
|
158
|
+
const client: RedisClientType = createClient({
|
|
159
|
+
url: redisUrl
|
|
160
|
+
});
|
|
166
161
|
|
|
167
162
|
client.on('error', (error) => {
|
|
168
163
|
logger.error('Redis client error', { redisUrl, error });
|
package/middlewares/default.ts
CHANGED
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
withUrlRedirection,
|
|
15
15
|
withCompleteWallet,
|
|
16
16
|
withWalletCompleteRedirection,
|
|
17
|
-
withMasterpassRestCallback
|
|
18
|
-
withBfcacheHeaders
|
|
17
|
+
withMasterpassRestCallback
|
|
19
18
|
} from '.';
|
|
20
19
|
import { urlLocaleMatcherRegex } from '../utils';
|
|
21
20
|
import withCurrency from './currency';
|
|
@@ -102,7 +101,6 @@ const withPzDefault =
|
|
|
102
101
|
if (
|
|
103
102
|
req.nextUrl.pathname.includes('/orders/hooks/') ||
|
|
104
103
|
req.nextUrl.pathname.includes('/orders/checkout-with-token/') ||
|
|
105
|
-
req.nextUrl.pathname.includes('/orders/post-checkout') ||
|
|
106
104
|
req.nextUrl.pathname.includes('/hooks/cash_register/complete/') ||
|
|
107
105
|
req.nextUrl.pathname.includes('/hooks/cash_register/pre_order/')
|
|
108
106
|
) {
|
|
@@ -130,13 +128,8 @@ const withPzDefault =
|
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
if (req.nextUrl.pathname.startsWith('/orders/redirection/')) {
|
|
133
|
-
const queryString = searchParams.toString();
|
|
134
131
|
return NextResponse.rewrite(
|
|
135
|
-
new URL(
|
|
136
|
-
`${encodeURI(Settings.commerceUrl)}/orders/redirection/${
|
|
137
|
-
queryString ? `?${queryString}` : ''
|
|
138
|
-
}`
|
|
139
|
-
)
|
|
132
|
+
new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirection/`)
|
|
140
133
|
);
|
|
141
134
|
}
|
|
142
135
|
|
|
@@ -240,11 +233,10 @@ const withPzDefault =
|
|
|
240
233
|
withCompleteWallet(
|
|
241
234
|
withWalletCompleteRedirection(
|
|
242
235
|
withMasterpassRestCallback(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
) => {
|
|
236
|
+
async (
|
|
237
|
+
req: PzNextRequest,
|
|
238
|
+
event: NextFetchEvent
|
|
239
|
+
) => {
|
|
248
240
|
let middlewareResult: NextResponse | void =
|
|
249
241
|
NextResponse.next();
|
|
250
242
|
|
|
@@ -465,7 +457,7 @@ const withPzDefault =
|
|
|
465
457
|
}
|
|
466
458
|
|
|
467
459
|
return middlewareResult;
|
|
468
|
-
}
|
|
460
|
+
}
|
|
469
461
|
)
|
|
470
462
|
)
|
|
471
463
|
)
|
package/middlewares/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ import withSavedCardRedirection from './saved-card-redirection';
|
|
|
12
12
|
import withCompleteWallet from './complete-wallet';
|
|
13
13
|
import withWalletCompleteRedirection from './wallet-complete-redirection';
|
|
14
14
|
import withMasterpassRestCallback from './masterpass-rest-callback';
|
|
15
|
-
import withBfcacheHeaders from './bfcache-headers';
|
|
16
15
|
import { NextRequest } from 'next/server';
|
|
17
16
|
|
|
18
17
|
export {
|
|
@@ -29,8 +28,7 @@ export {
|
|
|
29
28
|
withSavedCardRedirection,
|
|
30
29
|
withCompleteWallet,
|
|
31
30
|
withWalletCompleteRedirection,
|
|
32
|
-
withMasterpassRestCallback
|
|
33
|
-
withBfcacheHeaders
|
|
31
|
+
withMasterpassRestCallback
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
export interface PzNextRequest extends NextRequest {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.118.0
|
|
4
|
+
"version": "1.118.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"set-cookie-parser": "2.6.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@akinon/eslint-plugin-projectzero": "1.118.0
|
|
38
|
+
"@akinon/eslint-plugin-projectzero": "1.118.0",
|
|
39
39
|
"@babel/core": "7.26.10",
|
|
40
40
|
"@babel/preset-env": "7.26.9",
|
|
41
41
|
"@babel/preset-typescript": "7.27.0",
|
package/plugins.d.ts
CHANGED
|
@@ -37,16 +37,6 @@ declare module '@akinon/pz-cybersource-uc/src/redux/middleware' {
|
|
|
37
37
|
export default middleware as any;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
declare module '@akinon/pz-apple-pay' {}
|
|
41
|
-
|
|
42
|
-
declare module '@akinon/pz-similar-products' {
|
|
43
|
-
export const SimilarProductsModal: any;
|
|
44
|
-
export const SimilarProductsFilterSidebar: any;
|
|
45
|
-
export const SimilarProductsResultsGrid: any;
|
|
46
|
-
export const SimilarProductsPlugin: any;
|
|
47
|
-
export const SimilarProductsButtonPlugin: any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
40
|
declare module '@akinon/pz-cybersource-uc/src/redux/reducer' {
|
|
51
41
|
export default reducer as any;
|
|
52
42
|
}
|
package/plugins.js
CHANGED
|
@@ -204,25 +204,15 @@ export const contextListMiddleware: Middleware = ({
|
|
|
204
204
|
(ctx) => ctx.page_name === 'DeliveryOptionSelectionPage'
|
|
205
205
|
)
|
|
206
206
|
) {
|
|
207
|
-
const isCreditCardPayment =
|
|
208
|
-
preOrder?.payment_option?.payment_type === 'credit_card' ||
|
|
209
|
-
preOrder?.payment_option?.payment_type === 'masterpass';
|
|
210
|
-
|
|
211
207
|
if (context.page_context.card_type) {
|
|
212
208
|
dispatch(setCardType(context.page_context.card_type));
|
|
213
|
-
} else if (isCreditCardPayment) {
|
|
214
|
-
dispatch(setCardType(null));
|
|
215
209
|
}
|
|
216
210
|
|
|
217
211
|
if (
|
|
218
212
|
context.page_context.installments &&
|
|
219
213
|
preOrder?.payment_option?.payment_type !== 'masterpass_rest'
|
|
220
214
|
) {
|
|
221
|
-
|
|
222
|
-
dispatch(
|
|
223
|
-
setInstallmentOptions(context.page_context.installments)
|
|
224
|
-
);
|
|
225
|
-
}
|
|
215
|
+
dispatch(setInstallmentOptions(context.page_context.installments));
|
|
226
216
|
}
|
|
227
217
|
}
|
|
228
218
|
|
|
@@ -14,17 +14,9 @@ export const installmentOptionMiddleware: Middleware = ({
|
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const { installmentOptions
|
|
17
|
+
const { installmentOptions } = getState().checkout;
|
|
18
18
|
const { endpoints: apiEndpoints } = checkoutApi;
|
|
19
19
|
|
|
20
|
-
const isCreditCardPayment =
|
|
21
|
-
preOrder?.payment_option?.payment_type === 'credit_card' ||
|
|
22
|
-
preOrder?.payment_option?.payment_type === 'masterpass';
|
|
23
|
-
|
|
24
|
-
if (isCreditCardPayment && !cardType) {
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
20
|
if (
|
|
29
21
|
!preOrder?.installment &&
|
|
30
22
|
preOrder?.payment_option?.payment_type !== 'saved_card' &&
|
package/types/index.ts
CHANGED
|
@@ -83,12 +83,6 @@ export interface Settings {
|
|
|
83
83
|
};
|
|
84
84
|
usePrettyUrlRoute?: boolean;
|
|
85
85
|
commerceUrl: string;
|
|
86
|
-
/**
|
|
87
|
-
* This option allows you to track Sentry events on the client side, in addition to server and edge environments.
|
|
88
|
-
*
|
|
89
|
-
* It overrides process.env.NEXT_PUBLIC_SENTRY_DSN and process.env.SENTRY_DSN.
|
|
90
|
-
*/
|
|
91
|
-
sentryDsn?: string;
|
|
92
86
|
redis: {
|
|
93
87
|
defaultExpirationTime: number;
|
|
94
88
|
};
|
package/utils/index.ts
CHANGED
|
@@ -204,23 +204,6 @@ export const getPosError = () => {
|
|
|
204
204
|
return error;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
export const checkPaymentWillRedirect = (response: {
|
|
208
|
-
context_list?: Array<{
|
|
209
|
-
page_name: string;
|
|
210
|
-
page_context?: { context_data?: { redirect_url?: string } };
|
|
211
|
-
}>;
|
|
212
|
-
redirect_url?: string;
|
|
213
|
-
errors?: unknown;
|
|
214
|
-
}): boolean => {
|
|
215
|
-
if (!response) return false;
|
|
216
|
-
|
|
217
|
-
const hasThankYouPage = response.context_list?.some(
|
|
218
|
-
(c) => c.page_name === 'ThankYouPage'
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
return Boolean(hasThankYouPage || response.redirect_url);
|
|
222
|
-
};
|
|
223
|
-
|
|
224
207
|
export const urlSchemes = [
|
|
225
208
|
'http',
|
|
226
209
|
'tel:',
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
const iframeURLChange = (iframe, callback) => {
|
|
2
2
|
iframe.addEventListener('load', () => {
|
|
3
3
|
setTimeout(() => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const iframeLocation = iframe.contentWindow.location;
|
|
7
|
-
|
|
8
|
-
callback(iframeLocation);
|
|
9
|
-
}
|
|
10
|
-
} catch (error) {
|
|
11
|
-
// Expected: browser blocks cross-origin iframe access for security
|
|
4
|
+
if (iframe?.contentWindow?.location) {
|
|
5
|
+
callback(iframe.contentWindow.location);
|
|
12
6
|
}
|
|
13
7
|
}, 0);
|
|
14
8
|
});
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
const iframeURLChange = (iframe, callback) => {
|
|
2
2
|
iframe.addEventListener('load', () => {
|
|
3
3
|
setTimeout(() => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const iframeLocation = iframe.contentWindow.location;
|
|
7
|
-
|
|
8
|
-
callback(iframeLocation);
|
|
9
|
-
}
|
|
10
|
-
} catch (error) {
|
|
11
|
-
// Expected: browser blocks cross-origin iframe access for security
|
|
4
|
+
if (iframe?.contentWindow?.location) {
|
|
5
|
+
callback(iframe.contentWindow.location);
|
|
12
6
|
}
|
|
13
7
|
}, 0);
|
|
14
8
|
});
|
package/with-pz-config.js
CHANGED
package/api/barcode-search.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import Settings from 'settings';
|
|
3
|
-
|
|
4
|
-
export async function GET(request: NextRequest) {
|
|
5
|
-
try {
|
|
6
|
-
const { searchParams } = new URL(request.url);
|
|
7
|
-
const barcode = searchParams.get('search_text');
|
|
8
|
-
|
|
9
|
-
if (!barcode) {
|
|
10
|
-
return NextResponse.json(
|
|
11
|
-
{ error: 'Missing search_text parameter (barcode)' },
|
|
12
|
-
{ status: 400 }
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (Settings.commerceUrl === 'default') {
|
|
17
|
-
return NextResponse.json(
|
|
18
|
-
{ error: 'Commerce URL is not configured' },
|
|
19
|
-
{ status: 500 }
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const queryParams = new URLSearchParams();
|
|
24
|
-
queryParams.append('search_text', barcode);
|
|
25
|
-
|
|
26
|
-
searchParams.forEach((value, key) => {
|
|
27
|
-
if (key !== 'search_text') {
|
|
28
|
-
queryParams.append(key, value);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const apiUrl = `${Settings.commerceUrl}/list/?${queryParams.toString()}`;
|
|
33
|
-
|
|
34
|
-
const headers: Record<string, string> = {
|
|
35
|
-
Accept: 'application/json',
|
|
36
|
-
'Content-Type': 'application/json'
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const response = await fetch(apiUrl, {
|
|
40
|
-
method: 'GET',
|
|
41
|
-
headers
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (!response.ok) {
|
|
45
|
-
return NextResponse.json(
|
|
46
|
-
{ error: `API request failed with status: ${response.status}` },
|
|
47
|
-
{ status: response.status }
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const data = await response.json();
|
|
52
|
-
return NextResponse.json(data);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
return NextResponse.json(
|
|
55
|
-
{ error: (error as Error).message },
|
|
56
|
-
{ status: 500 }
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NextMiddleware } from 'next/server';
|
|
2
|
-
|
|
3
|
-
const withBfcacheHeaders = (middleware: NextMiddleware): NextMiddleware => {
|
|
4
|
-
return async (req, event) => {
|
|
5
|
-
const response = await middleware(req, event);
|
|
6
|
-
|
|
7
|
-
if (process.env.BF_CACHE === 'true' && response) {
|
|
8
|
-
response.headers.set(
|
|
9
|
-
'Cache-Control',
|
|
10
|
-
'private, no-cache, max-age=0, must-revalidate'
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return response;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default withBfcacheHeaders;
|