@akinon/next 1.101.0-rc.75 → 1.101.0-snapshot-ZERO-3615-20250924121313
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 +46 -1325
- package/__tests__/next-config.test.ts +10 -1
- package/bin/pz-prebuild.js +0 -1
- package/components/accordion.tsx +5 -20
- package/components/file-input.tsx +3 -65
- package/components/input.tsx +0 -2
- package/components/link.tsx +12 -16
- package/components/modal.tsx +16 -32
- package/components/plugin-module.tsx +4 -32
- package/data/client/checkout.ts +2 -4
- package/data/server/category.ts +24 -44
- package/data/server/flatpage.ts +12 -16
- package/data/server/landingpage.ts +12 -16
- package/data/server/list.ts +13 -23
- package/data/server/product.ts +55 -38
- package/data/server/special-page.ts +12 -16
- package/data/urls.ts +2 -6
- package/hocs/server/with-segment-defaults.tsx +2 -5
- package/hooks/use-localization.ts +3 -2
- package/middlewares/complete-gpay.ts +1 -2
- package/middlewares/complete-masterpass.ts +1 -2
- package/middlewares/default.ts +0 -50
- package/middlewares/index.ts +0 -1
- package/middlewares/locale.ts +1 -9
- package/middlewares/pretty-url.ts +0 -2
- package/middlewares/redirection-payment.ts +1 -2
- package/middlewares/saved-card-redirection.ts +1 -2
- package/middlewares/three-d-redirection.ts +2 -2
- package/middlewares/url-redirection.ts +14 -8
- package/package.json +2 -2
- package/plugins.d.ts +5 -8
- package/plugins.js +1 -3
- package/redux/middlewares/checkout.ts +2 -6
- package/types/commerce/order.ts +0 -1
- package/types/index.ts +1 -34
- package/utils/app-fetch.ts +2 -7
- package/utils/redirect.ts +3 -22
- package/with-pz-config.js +5 -1
- package/__tests__/redirect.test.ts +0 -319
- package/api/form.ts +0 -84
- package/api/image-proxy.ts +0 -75
- package/api/similar-product-list.ts +0 -84
- package/api/similar-products.ts +0 -120
- package/data/server/basket.ts +0 -72
- package/utils/redirect-ignore.ts +0 -35
package/data/server/product.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ServerVariables } from '../../utils/server-variables';
|
|
|
6
6
|
import logger from '../../utils/log';
|
|
7
7
|
|
|
8
8
|
type GetProduct = {
|
|
9
|
-
pk: number;
|
|
9
|
+
pk: number | string;
|
|
10
10
|
locale?: string;
|
|
11
11
|
currency?: string;
|
|
12
12
|
searchParams?: URLSearchParams;
|
|
@@ -23,9 +23,21 @@ const getProductDataHandler = ({
|
|
|
23
23
|
headers
|
|
24
24
|
}: GetProduct) => {
|
|
25
25
|
return async function () {
|
|
26
|
+
// Convert pk to number if it's a string and validate
|
|
27
|
+
const numericPk = typeof pk === 'string' ? parseInt(pk, 10) : pk;
|
|
28
|
+
|
|
29
|
+
if (isNaN(numericPk)) {
|
|
30
|
+
logger.warn('Invalid product pk provided', {
|
|
31
|
+
handler: 'getProductDataHandler',
|
|
32
|
+
pk,
|
|
33
|
+
numericPk
|
|
34
|
+
});
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
let url = groupProduct
|
|
27
|
-
? product.getGroupProductByPk(
|
|
28
|
-
: product.getProductByPk(
|
|
39
|
+
? product.getGroupProductByPk(numericPk)
|
|
40
|
+
: product.getProductByPk(numericPk);
|
|
29
41
|
|
|
30
42
|
if (searchParams) {
|
|
31
43
|
url +=
|
|
@@ -35,10 +47,8 @@ const getProductDataHandler = ({
|
|
|
35
47
|
.join('&');
|
|
36
48
|
}
|
|
37
49
|
|
|
38
|
-
let data: ProductResult;
|
|
39
|
-
|
|
40
50
|
try {
|
|
41
|
-
data = await appFetch<ProductResult>({
|
|
51
|
+
const data = await appFetch<ProductResult>({
|
|
42
52
|
url,
|
|
43
53
|
locale,
|
|
44
54
|
currency,
|
|
@@ -50,23 +60,21 @@ const getProductDataHandler = ({
|
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
});
|
|
53
|
-
} catch (error) {
|
|
54
|
-
logger.error('Failed to fetch product data', {
|
|
55
|
-
handler: 'getProductDataHandler',
|
|
56
|
-
pk,
|
|
57
|
-
error: error.message,
|
|
58
|
-
url
|
|
59
|
-
});
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
// If product data is not found, return null to trigger 404
|
|
65
|
+
if (!data?.product?.pk) {
|
|
66
|
+
logger.warn('Product not found', {
|
|
67
|
+
handler: 'getProductDataHandler',
|
|
68
|
+
pk: numericPk,
|
|
69
|
+
hasData: !!data,
|
|
70
|
+
hasProduct: !!data?.product
|
|
71
|
+
});
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
let breadcrumbData: { menu?: unknown } = {};
|
|
75
|
+
const categoryUrl = product.categoryUrl(data.product.pk);
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
productCategoryData = await appFetch<ProductCategoryResult>({
|
|
77
|
+
const productCategoryData = await appFetch<ProductCategoryResult>({
|
|
70
78
|
url: categoryUrl,
|
|
71
79
|
locale,
|
|
72
80
|
currency,
|
|
@@ -81,19 +89,16 @@ const getProductDataHandler = ({
|
|
|
81
89
|
const menuItemModel = productCategoryData?.results[0]?.menuitemmodel;
|
|
82
90
|
|
|
83
91
|
if (!menuItemModel) {
|
|
84
|
-
logger.warn(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
pk
|
|
89
|
-
}
|
|
90
|
-
);
|
|
92
|
+
logger.warn('menuItemModel is undefined, skipping breadcrumbData fetch', {
|
|
93
|
+
handler: 'getProductDataHandler',
|
|
94
|
+
pk: numericPk
|
|
95
|
+
});
|
|
91
96
|
return { data, breadcrumbData: undefined };
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
const breadcrumbUrl = product.breadcrumbUrl(menuItemModel);
|
|
95
100
|
|
|
96
|
-
breadcrumbData = await appFetch<
|
|
101
|
+
const breadcrumbData = await appFetch<any>({
|
|
97
102
|
url: breadcrumbUrl,
|
|
98
103
|
locale,
|
|
99
104
|
currency,
|
|
@@ -104,19 +109,19 @@ const getProductDataHandler = ({
|
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
});
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
data,
|
|
115
|
+
breadcrumbData: breadcrumbData?.menu
|
|
116
|
+
};
|
|
107
117
|
} catch (error) {
|
|
108
|
-
logger.
|
|
118
|
+
logger.error('Error in getProductDataHandler', {
|
|
109
119
|
handler: 'getProductDataHandler',
|
|
110
|
-
pk,
|
|
120
|
+
pk: numericPk,
|
|
111
121
|
error: error.message
|
|
112
122
|
});
|
|
113
|
-
|
|
123
|
+
return null;
|
|
114
124
|
}
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
data,
|
|
118
|
-
breadcrumbData: breadcrumbData?.menu
|
|
119
|
-
};
|
|
120
125
|
};
|
|
121
126
|
};
|
|
122
127
|
|
|
@@ -128,9 +133,12 @@ export const getProductData = async ({
|
|
|
128
133
|
groupProduct,
|
|
129
134
|
headers
|
|
130
135
|
}: GetProduct) => {
|
|
131
|
-
|
|
136
|
+
// Convert pk to number for cache key if it's a string
|
|
137
|
+
const numericPkForCache = typeof pk === 'string' ? parseInt(pk, 10) : pk;
|
|
138
|
+
|
|
139
|
+
const result = await Cache.wrap(
|
|
132
140
|
CacheKey[groupProduct ? 'GroupProduct' : 'Product'](
|
|
133
|
-
|
|
141
|
+
numericPkForCache,
|
|
134
142
|
searchParams ?? new URLSearchParams()
|
|
135
143
|
),
|
|
136
144
|
locale,
|
|
@@ -147,4 +155,13 @@ export const getProductData = async ({
|
|
|
147
155
|
compressed: true
|
|
148
156
|
}
|
|
149
157
|
);
|
|
158
|
+
|
|
159
|
+
// If product data is not found, throw 404 error
|
|
160
|
+
if (!result) {
|
|
161
|
+
const error = new Error('Product not found') as Error & { status: number };
|
|
162
|
+
error.status = 404;
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return result;
|
|
150
167
|
};
|
|
@@ -15,24 +15,20 @@ const getSpecialPageDataHandler = (
|
|
|
15
15
|
return async function () {
|
|
16
16
|
const params = generateCommerceSearchParams(searchParams);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...(headers ?? {})
|
|
28
|
-
}
|
|
18
|
+
const data: GetCategoryResponse = await appFetch({
|
|
19
|
+
url: `${category.getSpecialPageByPk(pk)}${params}`,
|
|
20
|
+
locale,
|
|
21
|
+
currency,
|
|
22
|
+
init: {
|
|
23
|
+
headers: {
|
|
24
|
+
Accept: 'application/json',
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
...(headers ?? {})
|
|
29
27
|
}
|
|
30
|
-
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
} catch (error) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
31
|
+
return data;
|
|
36
32
|
};
|
|
37
33
|
};
|
|
38
34
|
|
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 = {
|
|
@@ -251,7 +247,7 @@ export const widgets = {
|
|
|
251
247
|
};
|
|
252
248
|
|
|
253
249
|
export const form = {
|
|
254
|
-
getForm: (pk: number) => `/forms/${pk}/generate
|
|
250
|
+
getForm: (pk: number) => `/forms/${pk}/generate/`
|
|
255
251
|
};
|
|
256
252
|
|
|
257
253
|
const URLS = {
|
|
@@ -72,13 +72,10 @@ const addRootLayoutProps = async (componentProps: RootLayoutProps) => {
|
|
|
72
72
|
const checkRedisVariables = () => {
|
|
73
73
|
const requiredVariableValues = [
|
|
74
74
|
process.env.CACHE_HOST,
|
|
75
|
-
process.env.CACHE_PORT
|
|
75
|
+
process.env.CACHE_PORT,
|
|
76
|
+
process.env.CACHE_SECRET
|
|
76
77
|
];
|
|
77
78
|
|
|
78
|
-
if (!settings.usePrettyUrlRoute) {
|
|
79
|
-
requiredVariableValues.push(process.env.CACHE_SECRET);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
79
|
if (
|
|
83
80
|
!requiredVariableValues.every((v) => v) &&
|
|
84
81
|
process.env.NODE_ENV === 'production'
|
|
@@ -4,6 +4,7 @@ import { LocalizationContext } from '../localization/provider';
|
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import { setCookie, urlLocaleMatcherRegex } from '../utils';
|
|
6
6
|
import { LocaleUrlStrategy } from '../localization';
|
|
7
|
+
import { useRouter } from 'next/navigation';
|
|
7
8
|
|
|
8
9
|
export const useLocalization = () => {
|
|
9
10
|
const {
|
|
@@ -17,6 +18,8 @@ export const useLocalization = () => {
|
|
|
17
18
|
localeUrlStrategy
|
|
18
19
|
} = useContext(LocalizationContext);
|
|
19
20
|
|
|
21
|
+
const router = useRouter();
|
|
22
|
+
|
|
20
23
|
/**
|
|
21
24
|
* Sets the locale in the URL.
|
|
22
25
|
* @param locale Locale value defined in the settings.
|
|
@@ -27,8 +30,6 @@ export const useLocalization = () => {
|
|
|
27
30
|
|
|
28
31
|
let targetUrl;
|
|
29
32
|
|
|
30
|
-
setCookie('pz-locale', locale);
|
|
31
|
-
|
|
32
33
|
if (localeUrlStrategy === LocaleUrlStrategy.Subdomain) {
|
|
33
34
|
const hostParts = hostname.split('.');
|
|
34
35
|
const subDomain = hostParts[0];
|
|
@@ -148,8 +148,7 @@ const withCompleteGpay =
|
|
|
148
148
|
logger.info('Redirecting to order success page', {
|
|
149
149
|
middleware: 'complete-gpay',
|
|
150
150
|
redirectUrlWithLocale,
|
|
151
|
-
ip
|
|
152
|
-
setCookie: request.headers.get('set-cookie')
|
|
151
|
+
ip
|
|
153
152
|
});
|
|
154
153
|
|
|
155
154
|
// Using POST method while redirecting causes an error,
|
|
@@ -149,8 +149,7 @@ const withCompleteMasterpass =
|
|
|
149
149
|
logger.info('Redirecting to order success page', {
|
|
150
150
|
middleware: 'complete-masterpass',
|
|
151
151
|
redirectUrlWithLocale,
|
|
152
|
-
ip
|
|
153
|
-
setCookie: request.headers.get('set-cookie')
|
|
152
|
+
ip
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
// Using POST method while redirecting causes an error,
|
package/middlewares/default.ts
CHANGED
|
@@ -339,24 +339,6 @@ const withPzDefault =
|
|
|
339
339
|
middlewareResult = NextResponse.rewrite(url);
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
if (
|
|
343
|
-
!req.middlewareParams.found &&
|
|
344
|
-
Settings.customNotFoundEnabled
|
|
345
|
-
) {
|
|
346
|
-
const pathSegments = url.pathname
|
|
347
|
-
.replace(/\/+$/, '')
|
|
348
|
-
.split('/');
|
|
349
|
-
if (pathSegments.length >= 3) {
|
|
350
|
-
url.pathname = `/${pathSegments[1]}/${pathSegments[2]}/pz-not-found`;
|
|
351
|
-
} else {
|
|
352
|
-
url.pathname = '/pz-not-found';
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
middlewareResult = NextResponse.rewrite(url, {
|
|
356
|
-
status: 404
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
342
|
const { localeUrlStrategy } =
|
|
361
343
|
Settings.localization;
|
|
362
344
|
|
|
@@ -406,38 +388,6 @@ const withPzDefault =
|
|
|
406
388
|
}
|
|
407
389
|
);
|
|
408
390
|
|
|
409
|
-
if (
|
|
410
|
-
!url.pathname.startsWith(
|
|
411
|
-
`/${currency}/orders`
|
|
412
|
-
)
|
|
413
|
-
) {
|
|
414
|
-
const currentCookieLocale =
|
|
415
|
-
req.cookies.get('pz-locale')?.value;
|
|
416
|
-
|
|
417
|
-
const urlHasExplicitLocale =
|
|
418
|
-
url.pathname.match(urlLocaleMatcherRegex);
|
|
419
|
-
const shouldUpdateCookie =
|
|
420
|
-
!currentCookieLocale ||
|
|
421
|
-
urlHasExplicitLocale;
|
|
422
|
-
|
|
423
|
-
if (shouldUpdateCookie) {
|
|
424
|
-
middlewareResult.cookies.set(
|
|
425
|
-
'pz-locale',
|
|
426
|
-
locale?.length > 0
|
|
427
|
-
? locale
|
|
428
|
-
: defaultLocaleValue,
|
|
429
|
-
{
|
|
430
|
-
domain: rootHostname,
|
|
431
|
-
sameSite: 'none',
|
|
432
|
-
secure: true,
|
|
433
|
-
expires: new Date(
|
|
434
|
-
Date.now() + 1000 * 60 * 60 * 24 * 7
|
|
435
|
-
) // 7 days
|
|
436
|
-
}
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
391
|
if (
|
|
442
392
|
req.cookies.get('pz-locale') &&
|
|
443
393
|
req.cookies.get('pz-locale').value !== locale
|
package/middlewares/index.ts
CHANGED
package/middlewares/locale.ts
CHANGED
|
@@ -23,15 +23,7 @@ const getMatchedLocale = (pathname: string, req: PzNextRequest) => {
|
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
if (subDomainLocaleMatched && subDomainLocaleMatched[0]) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const isValidSubdomainLocale = settings.localization.locales.find(
|
|
29
|
-
(l) => l.value === subdomainLocale
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
if (isValidSubdomainLocale) {
|
|
33
|
-
matchedLocale = subdomainLocale;
|
|
34
|
-
}
|
|
26
|
+
matchedLocale = subDomainLocaleMatched[0].slice(1);
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
}
|
|
@@ -149,8 +149,7 @@ const withRedirectionPayment =
|
|
|
149
149
|
logger.info('Redirecting to order success page', {
|
|
150
150
|
middleware: 'redirection-payment',
|
|
151
151
|
redirectUrlWithLocale,
|
|
152
|
-
ip
|
|
153
|
-
setCookie: request.headers.get('set-cookie')
|
|
152
|
+
ip
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
// Using POST method while redirecting causes an error,
|
|
@@ -149,8 +149,7 @@ const withSavedCardRedirection =
|
|
|
149
149
|
logger.info('Redirecting to order success page', {
|
|
150
150
|
middleware: 'saved-card-redirection',
|
|
151
151
|
redirectUrlWithLocale,
|
|
152
|
-
ip
|
|
153
|
-
setCookie: request.headers.get('set-cookie')
|
|
152
|
+
ip
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
// Using POST method while redirecting causes an error,
|
|
@@ -4,6 +4,7 @@ import { Buffer } from 'buffer';
|
|
|
4
4
|
import logger from '../utils/log';
|
|
5
5
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
6
6
|
import { PzNextRequest } from '.';
|
|
7
|
+
import { ServerVariables } from '../utils/server-variables';
|
|
7
8
|
|
|
8
9
|
const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
|
|
9
10
|
if (stream) {
|
|
@@ -148,8 +149,7 @@ const withThreeDRedirection =
|
|
|
148
149
|
logger.info('Redirecting to order success page', {
|
|
149
150
|
middleware: 'three-d-redirection',
|
|
150
151
|
redirectUrlWithLocale,
|
|
151
|
-
ip
|
|
152
|
-
setCookie: request.headers.get('set-cookie')
|
|
152
|
+
ip
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
// Using POST method while redirecting causes an error,
|
|
@@ -4,7 +4,6 @@ import { PzNextRequest } from '.';
|
|
|
4
4
|
import logger from '../utils/log';
|
|
5
5
|
import { urlLocaleMatcherRegex } from '../utils';
|
|
6
6
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
7
|
-
import { shouldIgnoreRedirect } from '../utils/redirect-ignore';
|
|
8
7
|
import { ROUTES } from 'routes';
|
|
9
8
|
|
|
10
9
|
// This middleware is used to handle url redirections set in Omnitron
|
|
@@ -61,13 +60,20 @@ const withUrlRedirection =
|
|
|
61
60
|
|
|
62
61
|
const setCookies = request.headers.getSetCookie();
|
|
63
62
|
|
|
64
|
-
if (
|
|
65
|
-
shouldIgnoreRedirect
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
if (settings.commerceRedirectionIgnoreList) {
|
|
64
|
+
const shouldIgnoreRedirect =
|
|
65
|
+
settings.commerceRedirectionIgnoreList.some((ignorePath) =>
|
|
66
|
+
redirectUrl.pathname.startsWith(
|
|
67
|
+
getUrlPathWithLocale(
|
|
68
|
+
ignorePath,
|
|
69
|
+
req.middlewareParams.rewrites.locale
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
if (shouldIgnoreRedirect) {
|
|
75
|
+
return middleware(req, event);
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
const response = NextResponse.redirect(redirectUrl.toString(), {
|
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.101.0-
|
|
4
|
+
"version": "1.101.0-snapshot-ZERO-3615-20250924121313",
|
|
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.101.0-
|
|
38
|
+
"@akinon/eslint-plugin-projectzero": "1.101.0-snapshot-ZERO-3615-20250924121313",
|
|
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
|
@@ -31,14 +31,11 @@ declare module '@akinon/pz-saved-card' {
|
|
|
31
31
|
export const SavedCardOption: any;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
declare module '@akinon/pz-iyzico-saved-card' {
|
|
35
|
+
export const iyzicoSavedCardReducer: any;
|
|
36
|
+
export const iyzicoSavedCardMiddleware: any;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
declare module '@akinon/pz-apple-pay' {}
|
|
35
40
|
|
|
36
41
|
declare module '@akinon/pz-flow-payment' {}
|
|
37
|
-
|
|
38
|
-
declare module '@akinon/pz-similar-products' {
|
|
39
|
-
export const SimilarProductsModal: any;
|
|
40
|
-
export const SimilarProductsFilterSidebar: any;
|
|
41
|
-
export const SimilarProductsResultsGrid: any;
|
|
42
|
-
export const SimilarProductsPlugin: any;
|
|
43
|
-
export const SimilarProductsButtonPlugin: any;
|
|
44
|
-
}
|
package/plugins.js
CHANGED
|
@@ -51,11 +51,7 @@ export const errorMiddleware: Middleware = ({ dispatch }: MiddlewareParams) => {
|
|
|
51
51
|
const result: CheckoutResult = next(action);
|
|
52
52
|
const errors = result?.payload?.errors;
|
|
53
53
|
|
|
54
|
-
if (
|
|
55
|
-
!!errors &&
|
|
56
|
-
((typeof errors === 'object' && Object.keys(errors).length > 0) ||
|
|
57
|
-
(Array.isArray(errors) && errors.length > 0))
|
|
58
|
-
) {
|
|
54
|
+
if (errors) {
|
|
59
55
|
dispatch(setErrors(errors));
|
|
60
56
|
}
|
|
61
57
|
|
|
@@ -102,7 +98,7 @@ export const contextListMiddleware: Middleware = ({
|
|
|
102
98
|
if (result?.payload?.context_list) {
|
|
103
99
|
result.payload.context_list.forEach((context) => {
|
|
104
100
|
const redirectUrl = context.page_context.redirect_url;
|
|
105
|
-
const isIframe = context.page_context.
|
|
101
|
+
const isIframe = context.page_context.is_frame ?? false;
|
|
106
102
|
|
|
107
103
|
if (redirectUrl) {
|
|
108
104
|
const currentLocale = getCookie('pz-locale');
|
package/types/commerce/order.ts
CHANGED
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
|
};
|
|
@@ -298,13 +292,7 @@ export interface ButtonProps
|
|
|
298
292
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
299
293
|
}
|
|
300
294
|
|
|
301
|
-
export
|
|
302
|
-
fileClassName?: string;
|
|
303
|
-
fileNameWrapperClassName?: string;
|
|
304
|
-
fileInputClassName?: string;
|
|
305
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
306
|
-
buttonClassName?: string;
|
|
307
|
-
}
|
|
295
|
+
export type FileInputProps = React.HTMLProps<HTMLInputElement>;
|
|
308
296
|
|
|
309
297
|
export interface PriceProps {
|
|
310
298
|
currencyCode?: string;
|
|
@@ -325,19 +313,15 @@ export interface InputProps extends React.HTMLProps<HTMLInputElement> {
|
|
|
325
313
|
|
|
326
314
|
export interface AccordionProps {
|
|
327
315
|
isCollapse?: boolean;
|
|
328
|
-
collapseClassName?: string;
|
|
329
316
|
title?: string;
|
|
330
317
|
subTitle?: string;
|
|
331
318
|
icons?: string[];
|
|
332
319
|
iconSize?: number;
|
|
333
320
|
iconColor?: string;
|
|
334
321
|
children?: ReactNode;
|
|
335
|
-
headerClassName?: string;
|
|
336
322
|
className?: string;
|
|
337
323
|
titleClassName?: string;
|
|
338
|
-
subTitleClassName?: string;
|
|
339
324
|
dataTestId?: string;
|
|
340
|
-
contentClassName?: string;
|
|
341
325
|
}
|
|
342
326
|
|
|
343
327
|
export interface PluginModuleComponentProps {
|
|
@@ -362,20 +346,3 @@ export interface PaginationProps {
|
|
|
362
346
|
direction?: 'next' | 'prev';
|
|
363
347
|
isLoading?: boolean;
|
|
364
348
|
}
|
|
365
|
-
|
|
366
|
-
export interface ModalProps {
|
|
367
|
-
portalId: string;
|
|
368
|
-
children?: React.ReactNode;
|
|
369
|
-
open?: boolean;
|
|
370
|
-
setOpen?: (open: boolean) => void;
|
|
371
|
-
title?: React.ReactNode;
|
|
372
|
-
showCloseButton?: React.ReactNode;
|
|
373
|
-
className?: string;
|
|
374
|
-
overlayClassName?: string;
|
|
375
|
-
headerWrapperClassName?: string;
|
|
376
|
-
titleClassName?: string;
|
|
377
|
-
closeButtonClassName?: string;
|
|
378
|
-
iconName?: string;
|
|
379
|
-
iconSize?: number;
|
|
380
|
-
iconClassName?: string;
|
|
381
|
-
}
|
package/utils/app-fetch.ts
CHANGED
|
@@ -43,12 +43,12 @@ const appFetch = async <T>({
|
|
|
43
43
|
const requestURL = `${decodeURIComponent(commerceUrl)}${url}`;
|
|
44
44
|
|
|
45
45
|
init.headers = {
|
|
46
|
-
cookie: nextCookies.toString(),
|
|
47
46
|
...(init.headers ?? {}),
|
|
48
47
|
...(ServerVariables.globalHeaders ?? {}),
|
|
49
48
|
'Accept-Language': currentLocale.apiValue,
|
|
50
49
|
'x-currency': currency,
|
|
51
|
-
'x-forwarded-for': ip
|
|
50
|
+
'x-forwarded-for': ip,
|
|
51
|
+
cookie: nextCookies.toString()
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
init.next = {
|
|
@@ -60,11 +60,6 @@ const appFetch = async <T>({
|
|
|
60
60
|
status = req.status;
|
|
61
61
|
logger.debug(`FETCH END ${url}`, { status: req.status, ip });
|
|
62
62
|
|
|
63
|
-
if (!req.ok) {
|
|
64
|
-
const errorMessage = `HTTP ${req.status}: ${req.statusText}`;
|
|
65
|
-
throw new Error(errorMessage);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
63
|
if (responseType === FetchResponseType.JSON) {
|
|
69
64
|
response = (await req.json()) as T;
|
|
70
65
|
} else {
|