@akinon/next 1.50.0 → 1.52.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 +18 -0
- package/components/pagination.tsx +1 -2
- package/data/client/api.ts +1 -1
- package/middlewares/default.ts +4 -0
- package/middlewares/url-redirection.ts +2 -1
- package/package.json +3 -3
- package/types/commerce/order.ts +7 -0
- package/types/index.ts +19 -1
- package/utils/app-fetch.ts +4 -2
- package/utils/menu-generator.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.52.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d8dd8dc: ZERO-2729: Audit packages for yarn and npm and also update app-template
|
|
8
|
+
- 8d9ac9a: ZERO-2794: Add field to order type
|
|
9
|
+
- 016d379: ZERO-2729: Update packages and force update dependencies using resolutions
|
|
10
|
+
- 146ea39: ZERO-2774: Update imports
|
|
11
|
+
|
|
12
|
+
## 1.51.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 70279e7: ZERO-2817: Add metrics endpoint in default middleware
|
|
17
|
+
- 9d94f7e: ZERO-2820: update parent pk usage for menu generator
|
|
18
|
+
- 1ec2e9d: ZERO-2895: Update app-fetch to include cookies in headers
|
|
19
|
+
- 3d35f70: ZERO-2908: Add cookie to redirect url
|
|
20
|
+
|
|
3
21
|
## 1.50.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { MouseEvent, useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { PaginationProps } from '
|
|
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';
|
package/data/client/api.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@reduxjs/toolkit/query/react';
|
|
10
10
|
import settings from 'settings';
|
|
11
11
|
import { getCookie } from '../../utils';
|
|
12
|
-
import { RootState } from '
|
|
12
|
+
import { RootState } from 'redux/store';
|
|
13
13
|
|
|
14
14
|
interface CustomBaseQueryApi extends BaseQueryApi {
|
|
15
15
|
getState: () => RootState;
|
package/middlewares/default.ts
CHANGED
|
@@ -69,6 +69,10 @@ const withPzDefault =
|
|
|
69
69
|
return NextResponse.json({ status: 'ok' });
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if (url.pathname.startsWith('/metrics')) {
|
|
73
|
+
return new NextResponse(null, { status: 200 });
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
if (req.nextUrl.pathname.startsWith('/.well-known')) {
|
|
73
77
|
const url = new URL(`${Settings.commerceUrl}${req.nextUrl.pathname}`);
|
|
74
78
|
const req_ = await fetch(url.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.
|
|
4
|
+
"version": "1.52.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"react-redux": "8.1.3",
|
|
26
26
|
"react-string-replace": "1.1.1",
|
|
27
27
|
"redis": "4.5.1",
|
|
28
|
-
"semver": "7.
|
|
28
|
+
"semver": "7.6.2",
|
|
29
29
|
"set-cookie-parser": "2.6.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@akinon/eslint-plugin-projectzero": "1.52.0",
|
|
32
33
|
"@types/react-redux": "7.1.30",
|
|
33
34
|
"@types/set-cookie-parser": "2.4.7",
|
|
34
35
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
35
36
|
"@typescript-eslint/parser": "6.7.4",
|
|
36
37
|
"eslint": "^8.14.0",
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.50.0",
|
|
38
38
|
"eslint-config-prettier": "8.5.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/types/commerce/order.ts
CHANGED
|
@@ -105,6 +105,13 @@ export interface Order {
|
|
|
105
105
|
shipping_option: number;
|
|
106
106
|
tracking_number: string;
|
|
107
107
|
tracking_url: string;
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
bank: {
|
|
110
|
+
pk: number;
|
|
111
|
+
name: string;
|
|
112
|
+
slug: string;
|
|
113
|
+
[key: string]: any;
|
|
114
|
+
};
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
export interface Quotations {
|
package/types/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LocaleUrlStrategy } from '../localization';
|
|
|
2
2
|
import { PzNextRequest } from '../middlewares';
|
|
3
3
|
import { Control, FieldError } from 'react-hook-form';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
|
|
5
|
+
import { UsePaginationType } from '../hooks/use-pagination';
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
// we did it like this because declare types needs to be identical, if not it will fail
|
|
@@ -283,3 +283,21 @@ export interface AccordionProps {
|
|
|
283
283
|
export interface PluginModuleComponentProps {
|
|
284
284
|
settings?: Record<string, any>;
|
|
285
285
|
}
|
|
286
|
+
|
|
287
|
+
export interface PaginationProps {
|
|
288
|
+
total: number | undefined;
|
|
289
|
+
limit?: number | undefined;
|
|
290
|
+
currentPage: number | undefined;
|
|
291
|
+
numberOfPages?: number | undefined;
|
|
292
|
+
containerClassName?: string;
|
|
293
|
+
moreButtonClassName?: string;
|
|
294
|
+
prevClassName?: string;
|
|
295
|
+
nextClassName?: string;
|
|
296
|
+
pageClassName?: string;
|
|
297
|
+
threshold?: number | undefined;
|
|
298
|
+
delta?: number | undefined;
|
|
299
|
+
render?: (pagination: UsePaginationType) => ReactNode;
|
|
300
|
+
type?: 'infinite' | 'list' | 'more';
|
|
301
|
+
onPageChange?: (page: number) => void;
|
|
302
|
+
direction?: 'next' | 'prev';
|
|
303
|
+
}
|
package/utils/app-fetch.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Settings from 'settings';
|
|
2
2
|
import { ServerVariables } from './server-variables';
|
|
3
3
|
import logger from '../utils/log';
|
|
4
|
-
import { headers } from 'next/headers';
|
|
4
|
+
import { headers, cookies } from 'next/headers';
|
|
5
5
|
|
|
6
6
|
export enum FetchResponseType {
|
|
7
7
|
JSON = 'json',
|
|
@@ -19,6 +19,7 @@ const appFetch = async <T>(
|
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
21
|
const nextHeaders = headers();
|
|
22
|
+
const nextCookies = cookies();
|
|
22
23
|
ip = nextHeaders.get('x-forwarded-for') ?? '';
|
|
23
24
|
|
|
24
25
|
const commerceUrl = Settings.commerceUrl;
|
|
@@ -37,7 +38,8 @@ const appFetch = async <T>(
|
|
|
37
38
|
...(init.headers ?? {}),
|
|
38
39
|
'Accept-Language': currentLocale.apiValue,
|
|
39
40
|
'x-currency': ServerVariables.currency,
|
|
40
|
-
'x-forwarded-for': ip
|
|
41
|
+
'x-forwarded-for': ip,
|
|
42
|
+
cookie: nextCookies.toString()
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
init.next = {
|
package/utils/menu-generator.ts
CHANGED
|
@@ -13,8 +13,8 @@ export const menuGenerator = (arr: MenuItemType[]) => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
Object.values(data).forEach((item) => {
|
|
16
|
-
if (item.
|
|
17
|
-
data[item.
|
|
16
|
+
if (item.parent_pk) {
|
|
17
|
+
data[item.parent_pk].children.push(item);
|
|
18
18
|
} else {
|
|
19
19
|
tree.push(item);
|
|
20
20
|
}
|