@akinon/next 1.96.0-rc.60 → 1.96.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 +37 -1252
- package/__tests__/next-config.test.ts +10 -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 +3 -30
- package/data/client/checkout.ts +4 -5
- 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 +39 -66
- package/data/server/special-page.ts +12 -16
- package/data/urls.ts +1 -5
- package/hocs/server/with-segment-defaults.tsx +2 -5
- package/hooks/use-localization.ts +3 -2
- package/jest.config.js +1 -7
- package/lib/cache.ts +0 -2
- package/middlewares/complete-gpay.ts +1 -2
- package/middlewares/complete-masterpass.ts +1 -2
- package/middlewares/default.ts +13 -50
- package/middlewares/locale.ts +1 -9
- package/middlewares/redirection-payment.ts +1 -2
- package/middlewares/saved-card-redirection.ts +1 -2
- package/middlewares/three-d-redirection.ts +1 -2
- package/middlewares/url-redirection.ts +14 -8
- package/package.json +3 -3
- package/plugins.d.ts +0 -8
- package/plugins.js +1 -3
- package/redux/middlewares/checkout.ts +1 -5
- package/types/commerce/order.ts +0 -1
- package/types/index.ts +1 -34
- package/utils/app-fetch.ts +2 -7
- package/utils/redirect.ts +6 -31
- package/with-pz-config.js +5 -1
- package/__tests__/redirect.test.ts +0 -319
- 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/basket.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Cache, CacheKey } from '../../lib/cache';
|
|
2
|
-
import { basket } from '../../data/urls';
|
|
3
|
-
import { Basket } from '../../types';
|
|
4
|
-
import appFetch from '../../utils/app-fetch';
|
|
5
|
-
import { ServerVariables } from '../../utils/server-variables';
|
|
6
|
-
import logger from '../../utils/log';
|
|
7
|
-
|
|
8
|
-
type GetBasketParams = {
|
|
9
|
-
locale?: string;
|
|
10
|
-
currency?: string;
|
|
11
|
-
namespace?: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getBasketDataHandler = ({
|
|
15
|
-
locale,
|
|
16
|
-
currency,
|
|
17
|
-
namespace
|
|
18
|
-
}: GetBasketParams) => {
|
|
19
|
-
return async function () {
|
|
20
|
-
try {
|
|
21
|
-
const url = namespace
|
|
22
|
-
? basket.getBasketDetail(namespace)
|
|
23
|
-
: basket.getBasket;
|
|
24
|
-
|
|
25
|
-
const basketData = await appFetch<{ basket: Basket }>({
|
|
26
|
-
url,
|
|
27
|
-
locale,
|
|
28
|
-
currency,
|
|
29
|
-
init: {
|
|
30
|
-
headers: {
|
|
31
|
-
Accept: 'application/json',
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (!basketData?.basket) {
|
|
38
|
-
logger.warn('Basket data is undefined', {
|
|
39
|
-
handler: 'getBasketDataHandler',
|
|
40
|
-
namespace
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return basketData;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
logger.error('Error fetching basket data', {
|
|
47
|
-
handler: 'getBasketDataHandler',
|
|
48
|
-
error,
|
|
49
|
-
namespace
|
|
50
|
-
});
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const getBasketData = async ({
|
|
57
|
-
locale = ServerVariables.locale,
|
|
58
|
-
currency = ServerVariables.currency,
|
|
59
|
-
namespace
|
|
60
|
-
}: GetBasketParams = {}) => {
|
|
61
|
-
return Cache.wrap(
|
|
62
|
-
CacheKey.Basket(namespace),
|
|
63
|
-
locale,
|
|
64
|
-
getBasketDataHandler({ locale, currency, namespace }),
|
|
65
|
-
{
|
|
66
|
-
expire: 0,
|
|
67
|
-
cache: false
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
|
package/utils/redirect-ignore.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import settings from 'settings';
|
|
2
|
-
import { getUrlPathWithLocale } from './localization';
|
|
3
|
-
|
|
4
|
-
type IgnorePath = string | RegExp;
|
|
5
|
-
|
|
6
|
-
const defaultIgnoreList: string[] = [];
|
|
7
|
-
|
|
8
|
-
const extraIgnores: IgnorePath[] = Array.isArray(
|
|
9
|
-
settings.commerceRedirectionIgnoreList
|
|
10
|
-
)
|
|
11
|
-
? settings.commerceRedirectionIgnoreList.map((path) => {
|
|
12
|
-
if (path === '/users/reset') {
|
|
13
|
-
return /^\/users\/reset\/[^/]+\/[^/]+\/$/;
|
|
14
|
-
}
|
|
15
|
-
return path;
|
|
16
|
-
})
|
|
17
|
-
: [];
|
|
18
|
-
|
|
19
|
-
export function shouldIgnoreRedirect(
|
|
20
|
-
pathname: string,
|
|
21
|
-
locale: string
|
|
22
|
-
): boolean {
|
|
23
|
-
if (!pathname) return false;
|
|
24
|
-
|
|
25
|
-
const rawIgnoreList: IgnorePath[] = [...defaultIgnoreList, ...extraIgnores];
|
|
26
|
-
|
|
27
|
-
return rawIgnoreList.some((ignorePath) => {
|
|
28
|
-
if (ignorePath instanceof RegExp) {
|
|
29
|
-
return ignorePath.test(pathname);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const localized = getUrlPathWithLocale(ignorePath, locale);
|
|
33
|
-
return localized === pathname;
|
|
34
|
-
});
|
|
35
|
-
}
|