@akinon/projectzero 1.34.0-rc.8 → 1.34.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 -3
- package/app-template/.eslintrc.js +31 -0
- package/app-template/.gitignore +64 -0
- package/app-template/CHANGELOG.md +8 -69
- package/app-template/package.json +10 -10
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-email/page.tsx +2 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/profile/page.tsx +0 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/address/stores/page.tsx +2 -2
- package/app-template/src/app/[commerce]/[locale]/[currency]/auth/page.tsx +1 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +2 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/checkout/page.tsx +2 -2
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +1 -1
- package/app-template/src/app/api/form/[...id]/route.ts +3 -3
- package/app-template/src/components/carousel-core.tsx +1 -1
- package/app-template/src/components/checkbox.tsx +1 -2
- package/app-template/src/components/input.tsx +7 -19
- package/app-template/src/components/pagination.tsx +3 -3
- package/app-template/src/components/price.tsx +3 -3
- package/app-template/src/middleware.ts +13 -13
- package/app-template/src/redux/reducers/category.ts +1 -23
- package/app-template/src/redux/store.ts +1 -1
- package/app-template/src/settings.js +1 -2
- package/app-template/src/types/next-auth.d.ts +0 -1
- package/app-template/src/views/account/account-menu.tsx +1 -0
- package/app-template/src/views/account/address-form.tsx +4 -4
- package/app-template/src/views/account/orders/order-detail-header.tsx +7 -0
- package/app-template/src/views/category/category-active-filters.tsx +35 -24
- package/app-template/src/views/category/category-info.tsx +3 -3
- package/app-template/src/views/category/filters/index.tsx +13 -32
- package/app-template/src/views/checkout/auth.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +3 -2
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +5 -2
- package/app-template/src/views/find-in-store/index.tsx +2 -2
- package/app-template/src/views/header/mini-basket.tsx +2 -2
- package/app-template/src/views/product/product-info.tsx +2 -9
- package/app-template/src/views/product-item/index.tsx +1 -1
- package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +1 -1
- package/app-template/tsconfig.json +4 -5
- package/commands/create.ts +12 -0
- package/dist/commands/create.js +8 -0
- package/package.json +1 -1
- package/app-template/eslint.config.js +0 -10
- package/app-template/public/locales/en/not_found.json +0 -5
- package/app-template/public/locales/tr/not_found.json +0 -5
- package/app-template/src/app/[commerce]/[locale]/[currency]/[...prettyurl]/page.tsx +0 -8
- package/app-template/src/app/[commerce]/[locale]/[currency]/pz-not-found/page.tsx +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# @akinon/projectzero
|
|
2
2
|
|
|
3
|
-
## 1.34.0
|
|
3
|
+
## 1.34.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- cd78ddc: ZERO-2661: rename .npmignore to .gitignore during project creation
|
|
8
|
+
- 735f4f0: ZERO-2661: create .npmignore in app-template
|
|
8
9
|
|
|
9
10
|
## 1.33.2
|
|
10
11
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
node: true,
|
|
6
|
+
jest: true
|
|
7
|
+
},
|
|
8
|
+
extends: [
|
|
9
|
+
'next/core-web-vitals',
|
|
10
|
+
'eslint:recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended',
|
|
12
|
+
'prettier',
|
|
13
|
+
'plugin:@akinon/projectzero/core', // DO NOT remove this config for stability
|
|
14
|
+
'plugin:@akinon/projectzero/recommended' // Optional
|
|
15
|
+
],
|
|
16
|
+
plugins: ['@typescript-eslint', '@akinon/projectzero'],
|
|
17
|
+
parser: '@typescript-eslint/parser',
|
|
18
|
+
parserOptions: {
|
|
19
|
+
ecmaVersion: 2021,
|
|
20
|
+
sourceType: 'module'
|
|
21
|
+
},
|
|
22
|
+
settings: {
|
|
23
|
+
next: {
|
|
24
|
+
rootDir: ['src/*/']
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
29
|
+
'@typescript-eslint/no-explicit-any': 'warn'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
node_modules
|
|
5
|
+
.pnp
|
|
6
|
+
.pnp.js
|
|
7
|
+
|
|
8
|
+
# testing
|
|
9
|
+
/coverage
|
|
10
|
+
|
|
11
|
+
# next.js
|
|
12
|
+
.next/
|
|
13
|
+
out/
|
|
14
|
+
|
|
15
|
+
# production
|
|
16
|
+
**/build/**
|
|
17
|
+
**/dist/**
|
|
18
|
+
|
|
19
|
+
# misc
|
|
20
|
+
.DS_Store
|
|
21
|
+
*.pem
|
|
22
|
+
*.tsbuildinfo
|
|
23
|
+
|
|
24
|
+
# debug
|
|
25
|
+
npm-debug.log*
|
|
26
|
+
yarn-debug.log*
|
|
27
|
+
yarn-error.log*
|
|
28
|
+
|
|
29
|
+
# local env files
|
|
30
|
+
.env.local
|
|
31
|
+
.env.development.local
|
|
32
|
+
.env.test.local
|
|
33
|
+
.env.production.local
|
|
34
|
+
.env
|
|
35
|
+
|
|
36
|
+
# vercel
|
|
37
|
+
.vercel
|
|
38
|
+
|
|
39
|
+
.idea
|
|
40
|
+
|
|
41
|
+
# do not track .vscode folder except some files
|
|
42
|
+
.vscode/*
|
|
43
|
+
!.vscode/extensions.json
|
|
44
|
+
!.vscode/launch.json
|
|
45
|
+
|
|
46
|
+
# turbo
|
|
47
|
+
.turbo
|
|
48
|
+
|
|
49
|
+
# cypress artifacts
|
|
50
|
+
cypress/videos/*
|
|
51
|
+
cypress/screenshots/*
|
|
52
|
+
|
|
53
|
+
# pwa
|
|
54
|
+
public/sw.js
|
|
55
|
+
public/workbox-*.js
|
|
56
|
+
public/worker-*.js
|
|
57
|
+
public/sw.js.map
|
|
58
|
+
public/workbox-*.js.map
|
|
59
|
+
public/worker-*.js.map
|
|
60
|
+
|
|
61
|
+
# Sentry
|
|
62
|
+
.sentryclirc
|
|
63
|
+
next.config.original.js
|
|
64
|
+
next.config.wizardcopy.js
|
|
@@ -1,77 +1,16 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
-
## 1.34.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 91265bb: ZERO-2551: Improve pretty url and caching performance
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- Updated dependencies [91265bb]
|
|
12
|
-
- @akinon/next@1.34.0-rc.8
|
|
13
|
-
- @akinon/pz-b2b@1.34.0-rc.8
|
|
14
|
-
- @akinon/pz-gpay@1.34.0-rc.8
|
|
15
|
-
- @akinon/pz-masterpass@1.34.0-rc.8
|
|
16
|
-
- @akinon/pz-one-click-checkout@1.34.0-rc.8
|
|
17
|
-
- @akinon/pz-otp@1.34.0-rc.8
|
|
18
|
-
- @akinon/pz-pay-on-delivery@1.34.0-rc.8
|
|
19
|
-
|
|
20
|
-
## 1.34.0-rc.7
|
|
21
|
-
|
|
22
|
-
### Minor Changes
|
|
23
|
-
|
|
24
|
-
- 0d0f36c: ZERO-2598: Fix eslint warnings and update dependencies
|
|
3
|
+
## 1.34.0
|
|
25
4
|
|
|
26
5
|
### Patch Changes
|
|
27
6
|
|
|
28
|
-
- @akinon/next@1.34.0
|
|
29
|
-
- @akinon/pz-b2b@1.34.0
|
|
30
|
-
- @akinon/pz-gpay@1.34.0
|
|
31
|
-
- @akinon/pz-masterpass@1.34.0
|
|
32
|
-
- @akinon/pz-one-click-checkout@1.34.0
|
|
33
|
-
- @akinon/pz-otp@1.34.0
|
|
34
|
-
- @akinon/pz-pay-on-delivery@1.34.0
|
|
35
|
-
|
|
36
|
-
## 1.34.0-rc.6
|
|
37
|
-
|
|
38
|
-
### Minor Changes
|
|
39
|
-
|
|
40
|
-
- 567e4c1: ZERO-2580:Add checked attribute from props to checkbox
|
|
41
|
-
- d09b677: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
42
|
-
- 27a5296: ZERO-2631:Fix Checkbox Click
|
|
43
|
-
- ebb63ce: ZERO-2525: Fix category facet removal bug and add close icon to active filters
|
|
44
|
-
- f0c23bc: ZERO-2135: add custom not found page
|
|
45
|
-
- 3420416: ZERO-2533: extend eslint config from @akinon/next
|
|
46
|
-
- 6c18543: ZERO-2542:Refactor and show error in OneClickCheckoutButtons
|
|
47
|
-
- 202f84e: ZERO-2569: Fix static keys
|
|
48
|
-
- f046f8e: ZERO-2575: update version for react-number-format
|
|
49
|
-
- 12c10a4: ZERO-2570: Category filters routes to absolute url
|
|
50
|
-
|
|
51
|
-
### Patch Changes
|
|
52
|
-
|
|
53
|
-
- Updated dependencies [d09b677]
|
|
54
|
-
- Updated dependencies [6d4aadb]
|
|
55
|
-
- Updated dependencies [ebb63ce]
|
|
56
|
-
- Updated dependencies [7cebe87]
|
|
57
|
-
- Updated dependencies [f3b595e]
|
|
58
|
-
- Updated dependencies [59fb7c3]
|
|
59
|
-
- Updated dependencies [f0c23bc]
|
|
60
|
-
- Updated dependencies [3420416]
|
|
61
|
-
- Updated dependencies [495d155]
|
|
62
|
-
- Updated dependencies [6c18543]
|
|
63
|
-
- Updated dependencies [40ad73e]
|
|
64
|
-
- Updated dependencies [495d155]
|
|
65
|
-
- Updated dependencies [f046f8e]
|
|
66
|
-
- Updated dependencies [6b2972b]
|
|
67
|
-
- Updated dependencies [3e68768]
|
|
68
|
-
- @akinon/next@1.34.0-rc.6
|
|
69
|
-
- @akinon/pz-masterpass@1.34.0-rc.6
|
|
70
|
-
- @akinon/pz-one-click-checkout@1.34.0-rc.6
|
|
71
|
-
- @akinon/pz-b2b@1.34.0-rc.6
|
|
72
|
-
- @akinon/pz-gpay@1.34.0-rc.6
|
|
73
|
-
- @akinon/pz-otp@1.34.0-rc.6
|
|
74
|
-
- @akinon/pz-pay-on-delivery@1.34.0-rc.6
|
|
7
|
+
- @akinon/next@1.34.0
|
|
8
|
+
- @akinon/pz-b2b@1.34.0
|
|
9
|
+
- @akinon/pz-gpay@1.34.0
|
|
10
|
+
- @akinon/pz-masterpass@1.34.0
|
|
11
|
+
- @akinon/pz-one-click-checkout@1.34.0
|
|
12
|
+
- @akinon/pz-otp@1.34.0
|
|
13
|
+
- @akinon/pz-pay-on-delivery@1.34.0
|
|
75
14
|
|
|
76
15
|
## 1.33.2
|
|
77
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.34.0
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"prestart": "pz-prestart"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@akinon/next": "1.34.0
|
|
26
|
-
"@akinon/pz-b2b": "1.34.0
|
|
27
|
-
"@akinon/pz-gpay": "1.34.0
|
|
28
|
-
"@akinon/pz-masterpass": "1.34.0
|
|
29
|
-
"@akinon/pz-one-click-checkout": "1.34.0
|
|
30
|
-
"@akinon/pz-otp": "1.34.0
|
|
31
|
-
"@akinon/pz-pay-on-delivery": "1.34.0
|
|
25
|
+
"@akinon/next": "1.34.0",
|
|
26
|
+
"@akinon/pz-b2b": "1.34.0",
|
|
27
|
+
"@akinon/pz-gpay": "1.34.0",
|
|
28
|
+
"@akinon/pz-masterpass": "1.34.0",
|
|
29
|
+
"@akinon/pz-one-click-checkout": "1.34.0",
|
|
30
|
+
"@akinon/pz-otp": "1.34.0",
|
|
31
|
+
"@akinon/pz-pay-on-delivery": "1.34.0",
|
|
32
32
|
"@hookform/resolvers": "2.9.0",
|
|
33
33
|
"@next/third-parties": "14.1.0",
|
|
34
34
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"yup": "0.32.11"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@akinon/eslint-plugin-projectzero": "1.34.0
|
|
55
|
+
"@akinon/eslint-plugin-projectzero": "1.34.0",
|
|
56
56
|
"@semantic-release/changelog": "6.0.2",
|
|
57
57
|
"@semantic-release/exec": "6.0.3",
|
|
58
58
|
"@semantic-release/git": "10.0.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"jest-css-modules-transform": "4.3.0",
|
|
80
80
|
"lint-staged": "13.1.0",
|
|
81
81
|
"prettier": "2.6.2",
|
|
82
|
-
"react-number-format": "
|
|
82
|
+
"react-number-format": "4.9.3",
|
|
83
83
|
"sass": "1.49.9",
|
|
84
84
|
"semantic-release": "19.0.5",
|
|
85
85
|
"server-only": "0.0.1",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useSession } from 'next-auth/react';
|
|
3
4
|
import { useForm, SubmitHandler } from 'react-hook-form';
|
|
4
5
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
5
6
|
import * as yup from 'yup';
|
|
@@ -33,6 +34,7 @@ const accountChangeEmailSchema = (t) =>
|
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
export default function Page() {
|
|
37
|
+
const { data } = useSession();
|
|
36
38
|
const { data: profileInfo } = useGetProfileInfoQuery();
|
|
37
39
|
|
|
38
40
|
const { t } = useLocalization();
|
|
@@ -60,7 +60,7 @@ export default function Stores() {
|
|
|
60
60
|
return options;
|
|
61
61
|
}
|
|
62
62
|
return [];
|
|
63
|
-
}, [country]);
|
|
63
|
+
}, [country]);
|
|
64
64
|
|
|
65
65
|
const cityOptions = useMemo(() => {
|
|
66
66
|
if (city) {
|
|
@@ -73,7 +73,7 @@ export default function Stores() {
|
|
|
73
73
|
return options;
|
|
74
74
|
}
|
|
75
75
|
return [];
|
|
76
|
-
}, [city]);
|
|
76
|
+
}, [city]);
|
|
77
77
|
|
|
78
78
|
const handleBackButtonClick = () => {
|
|
79
79
|
setSelectedCityPk(null);
|
|
@@ -33,7 +33,7 @@ export default function Auth() {
|
|
|
33
33
|
if (session?.user) {
|
|
34
34
|
router.push(searchParams.get('callbackUrl') ?? '/');
|
|
35
35
|
}
|
|
36
|
-
}, [session?.user]);
|
|
36
|
+
}, [session?.user]);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<section className="container px-4 my-7 md:mt-20 lg:px-0 lg:mx-auto">
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getLandingPageData } from '@akinon/next/data/server';
|
|
2
2
|
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
3
3
|
import { PageProps } from '@akinon/next/types';
|
|
4
|
+
import logger from '@akinon/next/utils/log';
|
|
5
|
+
import * as console from 'console';
|
|
4
6
|
|
|
5
7
|
async function Page({ params }: PageProps<{ pk: number }>) {
|
|
6
8
|
const data = await getLandingPageData({ pk: params.pk });
|
|
@@ -51,7 +51,7 @@ const Checkout = () => {
|
|
|
51
51
|
dispatch(setCurrentStep(CheckoutStep.Payment));
|
|
52
52
|
initialStepChanged.current = true;
|
|
53
53
|
}
|
|
54
|
-
}, [steps.shipping.completed]);
|
|
54
|
+
}, [steps.shipping.completed]);
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
if (preOrder && !preOrder.shipping_option) {
|
|
@@ -63,7 +63,7 @@ const Checkout = () => {
|
|
|
63
63
|
return () => {
|
|
64
64
|
dispatch(resetCheckoutState());
|
|
65
65
|
};
|
|
66
|
-
}, []);
|
|
66
|
+
}, []);
|
|
67
67
|
|
|
68
68
|
useEffect(() => {
|
|
69
69
|
if (isSuccess) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
|
|
3
|
-
export async function POST() {
|
|
3
|
+
export async function POST(req: NextRequest) {
|
|
4
4
|
// TODO: Handle Form Data
|
|
5
5
|
|
|
6
|
-
return NextResponse.json({
|
|
6
|
+
return NextResponse.json({message: 'ok'});
|
|
7
7
|
}
|
|
@@ -28,7 +28,7 @@ const CarouselCore = forwardRef<Carousel, CarouselProps>((props, ref) => {
|
|
|
28
28
|
} else {
|
|
29
29
|
setAspectRatio(containerAspectRatio.mobile);
|
|
30
30
|
}
|
|
31
|
-
}, [matches
|
|
31
|
+
}, [matches]);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<div className="w-full" style={{ aspectRatio }}>
|
|
@@ -3,7 +3,7 @@ import { CheckboxProps } from '@theme/components/types';
|
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
|
|
5
5
|
const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
6
|
-
const { children,
|
|
6
|
+
const { children, error, ...rest } = props;
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<label className={twMerge('flex flex-col text-xs', props.className)}>
|
|
@@ -12,7 +12,6 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
12
12
|
type="checkbox"
|
|
13
13
|
{...rest}
|
|
14
14
|
ref={ref}
|
|
15
|
-
defaultChecked={checked}
|
|
16
15
|
className="w-4 h-4 shrink-0"
|
|
17
16
|
/>
|
|
18
17
|
{children && <span className="ml-2">{children}</span>}
|
|
@@ -1,28 +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
|
-
import {
|
|
4
|
+
import NumberFormat, { NumberFormatProps } from 'react-number-format';
|
|
5
5
|
import { InputProps } from '@theme/components/types';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
|
|
8
|
-
const PatternFormatWithRef = forwardRef(
|
|
9
|
-
(props: PatternFormatProps, ref: Ref<HTMLInputElement>) => {
|
|
10
|
-
return <PatternFormat {...props} getInputRef={ref} />;
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
PatternFormatWithRef.displayName = 'PatternFormatWithRef';
|
|
14
|
-
|
|
15
8
|
export const Input = forwardRef<
|
|
16
9
|
HTMLInputElement,
|
|
17
10
|
InputProps &
|
|
18
11
|
Pick<
|
|
19
|
-
|
|
20
|
-
'mask' | 'allowEmptyFormatting' | 'onValueChange'
|
|
21
|
-
>
|
|
22
|
-
format?: string;
|
|
23
|
-
defaultValue?: string;
|
|
24
|
-
type?: string;
|
|
25
|
-
}
|
|
12
|
+
NumberFormatProps,
|
|
13
|
+
'format' | 'mask' | 'allowEmptyFormatting' | 'onValueChange'
|
|
14
|
+
>
|
|
26
15
|
>((props, ref) => {
|
|
27
16
|
const [focused, setFocused] = useState(false);
|
|
28
17
|
const [hasValue, setHasValue] = useState(false);
|
|
@@ -48,7 +37,6 @@ export const Input = forwardRef<
|
|
|
48
37
|
),
|
|
49
38
|
props.className
|
|
50
39
|
);
|
|
51
|
-
|
|
52
40
|
const inputProps: any = {
|
|
53
41
|
id,
|
|
54
42
|
ref,
|
|
@@ -91,14 +79,14 @@ export const Input = forwardRef<
|
|
|
91
79
|
<Controller
|
|
92
80
|
name={props.name ?? ''}
|
|
93
81
|
control={props.control}
|
|
82
|
+
defaultValue={false}
|
|
94
83
|
render={({ field }) => (
|
|
95
|
-
<
|
|
84
|
+
<NumberFormat
|
|
96
85
|
format={format}
|
|
97
86
|
mask={mask ?? ''}
|
|
98
87
|
{...rest}
|
|
99
88
|
{...field}
|
|
100
89
|
{...inputProps}
|
|
101
|
-
type={props.type as 'text' | 'password' | 'tel'}
|
|
102
90
|
/>
|
|
103
91
|
)}
|
|
104
92
|
/>
|
|
@@ -123,13 +123,13 @@ export const Pagination = (props: PaginationProps) => {
|
|
|
123
123
|
if (inView) {
|
|
124
124
|
handlePageChange();
|
|
125
125
|
}
|
|
126
|
-
}, [inView]);
|
|
126
|
+
}, [inView]);
|
|
127
127
|
|
|
128
128
|
useEffect(() => {
|
|
129
129
|
if (type === 'list') {
|
|
130
130
|
createListItems();
|
|
131
131
|
}
|
|
132
|
-
}, []);
|
|
132
|
+
}, []);
|
|
133
133
|
|
|
134
134
|
useEffect(() => {
|
|
135
135
|
if (total && total !== paginationTotal) {
|
|
@@ -198,7 +198,7 @@ export const Pagination = (props: PaginationProps) => {
|
|
|
198
198
|
containerClassName
|
|
199
199
|
)}
|
|
200
200
|
>
|
|
201
|
-
{prev &&
|
|
201
|
+
{prev && (
|
|
202
202
|
<li>
|
|
203
203
|
<Link
|
|
204
204
|
onClick={(e) => handleClick(e, prev)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import NumberFormat, { NumberFormatProps } from 'react-number-format';
|
|
3
3
|
import { getCurrency } from '@akinon/next/utils';
|
|
4
4
|
import { PriceProps } from '@theme/types';
|
|
5
5
|
import { useLocalization } from '@akinon/next/hooks';
|
|
6
6
|
|
|
7
|
-
export const Price = (props:
|
|
7
|
+
export const Price = (props: NumberFormatProps & PriceProps) => {
|
|
8
8
|
const {
|
|
9
9
|
value,
|
|
10
10
|
currencyCode,
|
|
@@ -38,7 +38,7 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
|
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
|
-
<
|
|
41
|
+
<NumberFormat
|
|
42
42
|
value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
|
|
43
43
|
{...{
|
|
44
44
|
[useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { withPzDefault } from '@akinon/next/middlewares';
|
|
2
|
-
import { NextMiddleware, NextResponse } from 'next/server';
|
|
1
|
+
import { PzNextRequest, withPzDefault } from '@akinon/next/middlewares';
|
|
2
|
+
import { NextFetchEvent, NextMiddleware, NextResponse } from 'next/server';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* !IMPORTANT
|
|
@@ -16,18 +16,18 @@ export const config = {
|
|
|
16
16
|
]
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const middleware: NextMiddleware = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const middleware: NextMiddleware = (
|
|
20
|
+
req: PzNextRequest,
|
|
21
|
+
event: NextFetchEvent
|
|
22
|
+
) => {
|
|
23
|
+
// If you use a custom response such as NextResponse.json(),
|
|
24
|
+
// you should set pz-override-response header to true as shown below.
|
|
25
|
+
// Otherwise, you'll get a 404 error.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// Example:
|
|
28
|
+
// return NextResponse.json({ status: 'ok' }, { headers: { 'pz-override-response': 'true' } });
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
return NextResponse.next();
|
|
31
|
+
};
|
|
32
32
|
|
|
33
33
|
export default withPzDefault(middleware);
|
|
@@ -31,10 +31,7 @@ const categorySlice = createSlice({
|
|
|
31
31
|
if (facet.key === action.payload.facet.key) {
|
|
32
32
|
facet.data.choices = facet.data.choices
|
|
33
33
|
.map((choice) => {
|
|
34
|
-
if (
|
|
35
|
-
action.payload.facet.widget_type === WIDGET_TYPE.category &&
|
|
36
|
-
choice.is_selected
|
|
37
|
-
) {
|
|
34
|
+
if (action.payload.facet.widget_type === WIDGET_TYPE.category) {
|
|
38
35
|
choice.is_selected = false;
|
|
39
36
|
}
|
|
40
37
|
return choice;
|
|
@@ -51,24 +48,6 @@ const categorySlice = createSlice({
|
|
|
51
48
|
return facet;
|
|
52
49
|
});
|
|
53
50
|
},
|
|
54
|
-
removeCategoryFacet(state, action) {
|
|
55
|
-
state.selectedFacets = state.selectedFacets.map((facet) => {
|
|
56
|
-
if (facet.key === action.payload.facet.key) {
|
|
57
|
-
facet.data.choices = facet.data.choices.map((choice) => {
|
|
58
|
-
if (choice.value === action.payload.choice.value) {
|
|
59
|
-
choice.is_selected = false;
|
|
60
|
-
}
|
|
61
|
-
return choice;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return facet;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
state.selectedFacets = state.selectedFacets.filter(
|
|
69
|
-
(facet) => facet.key !== action.payload.facet.key
|
|
70
|
-
);
|
|
71
|
-
},
|
|
72
51
|
resetSelectedFacets(state) {
|
|
73
52
|
return {
|
|
74
53
|
...state,
|
|
@@ -82,7 +61,6 @@ export const {
|
|
|
82
61
|
setFacets,
|
|
83
62
|
setSelectedFacets,
|
|
84
63
|
toggleFacet,
|
|
85
|
-
removeCategoryFacet,
|
|
86
64
|
resetSelectedFacets
|
|
87
65
|
} = categorySlice.actions;
|
|
88
66
|
|
|
@@ -33,7 +33,7 @@ export type AppStore = ReturnType<typeof makeStore>;
|
|
|
33
33
|
|
|
34
34
|
export type RootState = ReturnType<AppStore['getState']>;
|
|
35
35
|
|
|
36
|
-
export type TypedDispatch = ThunkDispatch<RootState,
|
|
36
|
+
export type TypedDispatch = ThunkDispatch<RootState, any, AnyAction>;
|
|
37
37
|
|
|
38
38
|
export type AppDispatch = AppStore['dispatch'];
|
|
39
39
|
|
|
@@ -121,7 +121,7 @@ export const AddressForm = (props: Props) => {
|
|
|
121
121
|
return options;
|
|
122
122
|
}
|
|
123
123
|
return [];
|
|
124
|
-
}, [country]);
|
|
124
|
+
}, [country]);
|
|
125
125
|
|
|
126
126
|
const cityOptions = useMemo(() => {
|
|
127
127
|
if (city) {
|
|
@@ -137,7 +137,7 @@ export const AddressForm = (props: Props) => {
|
|
|
137
137
|
return options;
|
|
138
138
|
}
|
|
139
139
|
return [];
|
|
140
|
-
}, [city]);
|
|
140
|
+
}, [city]);
|
|
141
141
|
|
|
142
142
|
const townshipOptions = useMemo(() => {
|
|
143
143
|
if (township) {
|
|
@@ -156,7 +156,7 @@ export const AddressForm = (props: Props) => {
|
|
|
156
156
|
return options;
|
|
157
157
|
}
|
|
158
158
|
return [];
|
|
159
|
-
}, [township]);
|
|
159
|
+
}, [township]);
|
|
160
160
|
|
|
161
161
|
const districtOptions = useMemo(() => {
|
|
162
162
|
if (district) {
|
|
@@ -175,7 +175,7 @@ export const AddressForm = (props: Props) => {
|
|
|
175
175
|
return options;
|
|
176
176
|
}
|
|
177
177
|
return [];
|
|
178
|
-
}, [district]);
|
|
178
|
+
}, [district]);
|
|
179
179
|
|
|
180
180
|
useEffect(() => {
|
|
181
181
|
if (data && country) {
|
|
@@ -14,6 +14,13 @@ export interface Props {
|
|
|
14
14
|
export const OrderDetailHeader = ({ title, order, children }: Props) => {
|
|
15
15
|
const { t } = useLocalization();
|
|
16
16
|
|
|
17
|
+
const orderDate = new Date(order.created_date)
|
|
18
|
+
.toJSON()
|
|
19
|
+
.slice(0, 10)
|
|
20
|
+
.split('-')
|
|
21
|
+
.reverse()
|
|
22
|
+
.join(' ');
|
|
23
|
+
|
|
17
24
|
return (
|
|
18
25
|
<div className="bg-gray-150 flex flex-col items-center justify-center p-6 w-full mb-8 md:flex-row">
|
|
19
26
|
<div className="flex flex-col items-center text-center gap-2">
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
2
2
|
import React, { useEffect, useMemo } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
removeCategoryFacet,
|
|
5
|
-
toggleFacet
|
|
6
|
-
} from '@theme/redux/reducers/category';
|
|
3
|
+
import { toggleFacet } from '@theme/redux/reducers/category';
|
|
7
4
|
import { useRouter } from '@akinon/next/hooks';
|
|
8
5
|
import convertFacetSearchParams from '@theme/utils/convert-facet-search-params';
|
|
9
6
|
import { usePathname } from 'next/navigation';
|
|
10
7
|
import { WIDGET_TYPE } from '@theme/types';
|
|
11
8
|
import { useSearchParams } from 'next/dist/client/components/navigation';
|
|
12
|
-
import { Icon } from '@theme/components';
|
|
13
9
|
|
|
14
10
|
const CategoryActiveFilters = () => {
|
|
15
11
|
const dispatch = useAppDispatch();
|
|
@@ -20,11 +16,6 @@ const CategoryActiveFilters = () => {
|
|
|
20
16
|
const { facets, selectedFacets } = useAppSelector((state) => state.category);
|
|
21
17
|
|
|
22
18
|
const handleRemoveFilter = ({ facet, choice }) => {
|
|
23
|
-
if (facet.widget_type === WIDGET_TYPE.category) {
|
|
24
|
-
dispatch(removeCategoryFacet({ facet, choice }));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
19
|
dispatch(toggleFacet({ facet, choice }));
|
|
29
20
|
};
|
|
30
21
|
|
|
@@ -62,23 +53,43 @@ const CategoryActiveFilters = () => {
|
|
|
62
53
|
{facets.map((facet) =>
|
|
63
54
|
facet.data.choices
|
|
64
55
|
.filter((choice) => choice.is_selected)
|
|
65
|
-
.map(
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
.map((choice) => (
|
|
57
|
+
<div
|
|
58
|
+
className="flex justify-between text-xs text-black-800 py-3.5 px-4 border border-gray-400 hover:bg-gray-300 cursor-default items-center"
|
|
59
|
+
key={`${facet.key}-${choice.label}`}
|
|
60
|
+
>
|
|
61
|
+
<div>
|
|
62
|
+
{facet.widget_type !== WIDGET_TYPE.category && (
|
|
63
|
+
<span>{facet.name}: </span>
|
|
64
|
+
)}
|
|
65
|
+
<span>{choice.label}</span>
|
|
66
|
+
</div>
|
|
67
|
+
{facet.widget_type !== WIDGET_TYPE.category && (
|
|
68
68
|
<div
|
|
69
|
-
className="
|
|
70
|
-
|
|
69
|
+
className="cursor-pointer ml-4"
|
|
70
|
+
onClick={() => handleRemoveFilter({ facet, choice })}
|
|
71
71
|
>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
<svg
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
viewBox="0 0 13.5 13.5"
|
|
75
|
+
width="1em"
|
|
76
|
+
height="1em"
|
|
77
|
+
>
|
|
78
|
+
<path
|
|
79
|
+
d="m.75 12.75 12-12m-12 0 12 12"
|
|
80
|
+
style={{
|
|
81
|
+
fill: 'none',
|
|
82
|
+
stroke: '#000',
|
|
83
|
+
strokeLinecap: 'round',
|
|
84
|
+
strokeLinejoin: 'round',
|
|
85
|
+
strokeWidth: '1.5px'
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</svg>
|
|
79
89
|
</div>
|
|
80
|
-
)
|
|
81
|
-
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
))
|
|
82
93
|
)}
|
|
83
94
|
</div>
|
|
84
95
|
);
|
|
@@ -44,7 +44,7 @@ export default function ListPage(props: ListPageProps) {
|
|
|
44
44
|
newUrl.searchParams.delete('page');
|
|
45
45
|
router.push(newUrl.pathname + newUrl.search, undefined);
|
|
46
46
|
}
|
|
47
|
-
}, [searchParams, data.products, page]);
|
|
47
|
+
}, [searchParams, data.products, page]);
|
|
48
48
|
|
|
49
49
|
const dispatch = useAppDispatch();
|
|
50
50
|
const { t } = useLocalization();
|
|
@@ -70,7 +70,7 @@ export default function ListPage(props: ListPageProps) {
|
|
|
70
70
|
></div>
|
|
71
71
|
<div className="flex flex-col items-center lg:items-stretch col-span-2 lg:col-span-1">
|
|
72
72
|
<CategoryHeader
|
|
73
|
-
totalCount={data.pagination
|
|
73
|
+
totalCount={data.pagination.total_count}
|
|
74
74
|
setMenuStatus={() => setIsMenuOpen(true)}
|
|
75
75
|
sortOptions={data.sorters}
|
|
76
76
|
/>
|
|
@@ -78,7 +78,7 @@ export default function ListPage(props: ListPageProps) {
|
|
|
78
78
|
<CategoryActiveFilters />
|
|
79
79
|
</div>
|
|
80
80
|
|
|
81
|
-
{data.products
|
|
81
|
+
{data.products.length === 0 && page === 1 && (
|
|
82
82
|
<div className="text-center bg-gray-200 px-5 py-20">
|
|
83
83
|
<p className="pb-4">{t('category.search.not_found')}</p>
|
|
84
84
|
<Link className="underline" href={ROUTES.HOME}>
|
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { Accordion, Button, Checkbox, Icon, Radio } from '@theme/components';
|
|
7
7
|
import { SizeFilter } from './size-filter';
|
|
8
8
|
|
|
9
|
-
import { useLocalization
|
|
9
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
10
10
|
import { Facet, FacetChoice } from '@akinon/next/types';
|
|
11
11
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
12
12
|
import {
|
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
toggleFacet
|
|
15
15
|
} from '@theme/redux/reducers/category';
|
|
16
16
|
import CategoryActiveFilters from '@theme/views/category/category-active-filters';
|
|
17
|
-
import {
|
|
18
|
-
import { commonProductAttributes } from '@theme/settings';
|
|
17
|
+
import { useMemo } from 'react';
|
|
19
18
|
|
|
20
19
|
const COMPONENT_TYPES = {
|
|
21
20
|
[WIDGET_TYPE.category]: Radio,
|
|
@@ -28,7 +27,6 @@ interface Props {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export const Filters = (props: Props) => {
|
|
31
|
-
const router = useRouter();
|
|
32
30
|
const facets = useAppSelector((state) => state.category.facets);
|
|
33
31
|
const dispatch = useAppDispatch();
|
|
34
32
|
const { t } = useLocalization();
|
|
@@ -41,16 +39,12 @@ export const Filters = (props: Props) => {
|
|
|
41
39
|
facet: Facet;
|
|
42
40
|
choice: FacetChoice;
|
|
43
41
|
}) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
choice
|
|
51
|
-
})
|
|
52
|
-
);
|
|
53
|
-
}
|
|
42
|
+
dispatch(
|
|
43
|
+
toggleFacet({
|
|
44
|
+
facet,
|
|
45
|
+
choice
|
|
46
|
+
})
|
|
47
|
+
);
|
|
54
48
|
};
|
|
55
49
|
|
|
56
50
|
const haveFilter = useMemo(() => {
|
|
@@ -66,19 +60,6 @@ export const Filters = (props: Props) => {
|
|
|
66
60
|
dispatch(resetSelectedFacets());
|
|
67
61
|
};
|
|
68
62
|
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const url = new URL(window.location.href);
|
|
71
|
-
if (url.searchParams.has('category_ids')) {
|
|
72
|
-
url.searchParams.delete('category_ids');
|
|
73
|
-
const newHref = url.pathname + url.search;
|
|
74
|
-
window.history.replaceState({}, '', newHref);
|
|
75
|
-
}
|
|
76
|
-
}, [router]);
|
|
77
|
-
|
|
78
|
-
const sizeKey = commonProductAttributes.find(
|
|
79
|
-
(item) => item.translationKey === 'size'
|
|
80
|
-
).key;
|
|
81
|
-
|
|
82
63
|
return (
|
|
83
64
|
<div
|
|
84
65
|
className={clsx(
|
|
@@ -100,7 +81,7 @@ export const Filters = (props: Props) => {
|
|
|
100
81
|
let Component = null;
|
|
101
82
|
const choices = [...facet.data.choices];
|
|
102
83
|
|
|
103
|
-
if (facet.key ===
|
|
84
|
+
if (facet.key === 'integration_SizeId') {
|
|
104
85
|
// If it's a size facet, use the custom size filter component
|
|
105
86
|
Component = SizeFilter;
|
|
106
87
|
|
|
@@ -126,8 +107,8 @@ export const Filters = (props: Props) => {
|
|
|
126
107
|
>
|
|
127
108
|
<div
|
|
128
109
|
className={clsx(
|
|
129
|
-
'flex gap-4
|
|
130
|
-
facet.key ===
|
|
110
|
+
'flex gap-4',
|
|
111
|
+
facet.key === 'integration_SizeId' ? 'flex-row' : 'flex-col' // TODO: This condition must be refactor to a better way
|
|
131
112
|
)}
|
|
132
113
|
>
|
|
133
114
|
{choices.map((choice, index) => (
|
|
@@ -136,13 +117,13 @@ export const Filters = (props: Props) => {
|
|
|
136
117
|
data={choice}
|
|
137
118
|
name={facet.key}
|
|
138
119
|
onChange={() => {
|
|
139
|
-
if (facet.key !==
|
|
120
|
+
if (facet.key !== 'integration_SizeId') {
|
|
140
121
|
// TODO: This condition must be refactor to a better way
|
|
141
122
|
handleSelectFilter({ facet, choice });
|
|
142
123
|
}
|
|
143
124
|
}}
|
|
144
125
|
onClick={() => {
|
|
145
|
-
if (facet.key ===
|
|
126
|
+
if (facet.key === 'integration_SizeId') {
|
|
146
127
|
// TODO: This condition must be refactor to a better way
|
|
147
128
|
handleSelectFilter({ facet, choice });
|
|
148
129
|
}
|
|
@@ -20,7 +20,7 @@ const CheckoutAuth = () => {
|
|
|
20
20
|
} else if (status === 'unauthenticated') {
|
|
21
21
|
router.replace(ROUTES.CHECKOUT + `?callbackUrl=${ROUTES.CHECKOUT}`);
|
|
22
22
|
}
|
|
23
|
-
}, [status]);
|
|
23
|
+
}, [status]);
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<div className="flex flex-col w-full my-5 lg:flex-row">
|
|
@@ -13,9 +13,10 @@ import CheckoutAgreements from '../agreements';
|
|
|
13
13
|
import PaymentHeader from '../payment-header';
|
|
14
14
|
import { useLocalization } from '@akinon/next/hooks';
|
|
15
15
|
import { Image } from '@akinon/next/components/image';
|
|
16
|
+
import PaymentOptionButtons from '../payment-option-buttons';
|
|
16
17
|
import { Trans } from '@akinon/next/components/trans';
|
|
17
18
|
|
|
18
|
-
const fundsTransferFormSchema = () =>
|
|
19
|
+
const fundsTransferFormSchema = (t) =>
|
|
19
20
|
yup.object().shape({
|
|
20
21
|
agreement: yup.boolean().oneOf([true], 'This field is required.')
|
|
21
22
|
});
|
|
@@ -27,7 +28,7 @@ const CheckoutFundsTransfer = () => {
|
|
|
27
28
|
control,
|
|
28
29
|
formState: { errors }
|
|
29
30
|
} = useForm({
|
|
30
|
-
resolver: yupResolver(fundsTransferFormSchema())
|
|
31
|
+
resolver: yupResolver(fundsTransferFormSchema(t))
|
|
31
32
|
});
|
|
32
33
|
const [formError, setFormError] = useState(null);
|
|
33
34
|
const { bankAccounts, selectedBankAccountPk, preOrder } = useAppSelector(
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useCompleteRedirectionPaymentMutation } from '@akinon/next/data/client/checkout';
|
|
4
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
4
5
|
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
5
6
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
7
|
import { Button, Checkbox } from '@theme/components';
|
|
7
8
|
import { useForm } from 'react-hook-form';
|
|
8
9
|
import { twMerge } from 'tailwind-merge';
|
|
9
10
|
import * as yup from 'yup';
|
|
11
|
+
import PaymentOptionButtons from '../payment-option-buttons';
|
|
10
12
|
import { useEffect, useState } from 'react';
|
|
11
13
|
import { getPosError } from '@akinon/next/utils';
|
|
12
14
|
|
|
@@ -14,7 +16,7 @@ interface FormValues {
|
|
|
14
16
|
agreement: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
const formSchema = () =>
|
|
19
|
+
const formSchema = (t) =>
|
|
18
20
|
yup.object().shape({
|
|
19
21
|
agreement: yup
|
|
20
22
|
.boolean()
|
|
@@ -26,12 +28,13 @@ export default function RedirectionPayment() {
|
|
|
26
28
|
const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
|
|
27
29
|
const [formError, setFormError] = useState(null);
|
|
28
30
|
|
|
31
|
+
const { t } = useLocalization();
|
|
29
32
|
const {
|
|
30
33
|
register,
|
|
31
34
|
handleSubmit,
|
|
32
35
|
formState: { errors }
|
|
33
36
|
} = useForm<FormValues>({
|
|
34
|
-
resolver: yupResolver(formSchema())
|
|
37
|
+
resolver: yupResolver(formSchema(t))
|
|
35
38
|
});
|
|
36
39
|
const [completeRedirectionPayment] = useCompleteRedirectionPaymentMutation();
|
|
37
40
|
|
|
@@ -63,7 +63,7 @@ export const FindInStore = ({ productPk, productName, variants }) => {
|
|
|
63
63
|
return options;
|
|
64
64
|
}
|
|
65
65
|
return [];
|
|
66
|
-
}, [retailStore]);
|
|
66
|
+
}, [retailStore]);
|
|
67
67
|
|
|
68
68
|
const sizeOptions = useMemo(() => {
|
|
69
69
|
if (variants) {
|
|
@@ -80,7 +80,7 @@ export const FindInStore = ({ productPk, productName, variants }) => {
|
|
|
80
80
|
return options;
|
|
81
81
|
}
|
|
82
82
|
return [];
|
|
83
|
-
}, [variants
|
|
83
|
+
}, [variants]);
|
|
84
84
|
|
|
85
85
|
const createStockStatus = (stock) => {
|
|
86
86
|
const status = {
|
|
@@ -46,7 +46,7 @@ function MiniBasketItem(props: MiniBasketItemProps) {
|
|
|
46
46
|
miniBasketList.scrollTop = 0;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
}, [highlightedItem, basketItem.product.pk
|
|
49
|
+
}, [highlightedItem, basketItem.product.pk]);
|
|
50
50
|
|
|
51
51
|
const removeItem = () => {
|
|
52
52
|
updateQuantityMutation({
|
|
@@ -183,7 +183,7 @@ export default function MiniBasket() {
|
|
|
183
183
|
setSortedBasket(basket.basketitem_set);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
}, [isSuccess, highlightedItem, basket
|
|
186
|
+
}, [isSuccess, highlightedItem, basket]);
|
|
187
187
|
|
|
188
188
|
return (
|
|
189
189
|
<>
|
|
@@ -36,7 +36,7 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
36
36
|
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
pushProductViewed(data?.product);
|
|
39
|
-
}, []);
|
|
39
|
+
}, []);
|
|
40
40
|
|
|
41
41
|
const addProductToCart = async () => {
|
|
42
42
|
if (!variantsSelectionCheck()) {
|
|
@@ -206,14 +206,7 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
206
206
|
'after:bg-[#d02c2f]',
|
|
207
207
|
'after:rounded-xl',
|
|
208
208
|
'after:left-1'
|
|
209
|
-
])
|
|
210
|
-
onError: (error) =>
|
|
211
|
-
setProductError(
|
|
212
|
-
error?.data?.non_field_errors ||
|
|
213
|
-
Object.keys(error?.data).map(
|
|
214
|
-
(key) => `${key}: ${error?.data[key].join(', ')}`
|
|
215
|
-
)
|
|
216
|
-
)
|
|
209
|
+
])
|
|
217
210
|
}}
|
|
218
211
|
/>
|
|
219
212
|
|
|
@@ -10,7 +10,7 @@ import { useGetWidgetQuery } from '@akinon/next/data/client/misc';
|
|
|
10
10
|
import { Input, Button, Checkbox, Modal } from '@theme/components';
|
|
11
11
|
import { useLocalization } from '@akinon/next/hooks';
|
|
12
12
|
|
|
13
|
-
const subscriptionFormSchema = (t:
|
|
13
|
+
const subscriptionFormSchema = (t: any) =>
|
|
14
14
|
yup.object().shape({
|
|
15
15
|
email: yup
|
|
16
16
|
.string()
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
"display": "Default",
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"baseUrl": "./src",
|
|
6
|
-
"paths": {
|
|
7
|
-
"@theme/*": ["./*"],
|
|
8
|
-
"@root/*": ["./app/[commerce]/[locale]/[currency]/*"]
|
|
9
|
-
},
|
|
6
|
+
"paths": { "@theme/*": ["./*"] },
|
|
10
7
|
"allowSyntheticDefaultImports": true,
|
|
11
8
|
"composite": false,
|
|
12
9
|
"declaration": true,
|
|
@@ -43,5 +40,7 @@
|
|
|
43
40
|
".next/types/**/*.ts",
|
|
44
41
|
"../../packages/**/*"
|
|
45
42
|
],
|
|
46
|
-
"exclude": ["node_modules",
|
|
43
|
+
"exclude": ["node_modules",
|
|
44
|
+
"../../packages/projectzero/app-template"
|
|
45
|
+
]
|
|
47
46
|
}
|
package/commands/create.ts
CHANGED
|
@@ -108,6 +108,17 @@ function createEnvironmentFile(projectDir: string) {
|
|
|
108
108
|
fs.copyFileSync(`${projectDir}/.env.example`, `${projectDir}/.env`);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
function checkGitignore(projectDir: string) {
|
|
112
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
113
|
+
const npmignorePath = path.join(projectDir, '.npmignore');
|
|
114
|
+
|
|
115
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
116
|
+
fs.renameSync(npmignorePath, gitignorePath);
|
|
117
|
+
} else if (fs.existsSync(npmignorePath)) {
|
|
118
|
+
fs.rmSync(npmignorePath);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
111
122
|
export default async (): Promise<void> => {
|
|
112
123
|
const minNodeVersion = 18;
|
|
113
124
|
const currentNodeVersion = parseInt(
|
|
@@ -143,6 +154,7 @@ export default async (): Promise<void> => {
|
|
|
143
154
|
|
|
144
155
|
updatePluginsFile(projectDir);
|
|
145
156
|
createEnvironmentFile(projectDir);
|
|
157
|
+
checkGitignore(projectDir);
|
|
146
158
|
|
|
147
159
|
if (answers.projectDescription) {
|
|
148
160
|
updateFileContents(path.join(projectDir, 'akinon.json'), {
|
package/dist/commands/create.js
CHANGED
|
@@ -112,6 +112,13 @@ function updatePluginsFile(projectDir) {
|
|
|
112
112
|
function createEnvironmentFile(projectDir) {
|
|
113
113
|
fs.copyFileSync(`${projectDir}/.env.example`, `${projectDir}/.env`);
|
|
114
114
|
}
|
|
115
|
+
function checkGitignore(projectDir) {
|
|
116
|
+
const gitignorePath = path_1.default.join(projectDir, '.gitignore');
|
|
117
|
+
const npmignorePath = path_1.default.join(projectDir, '.npmignore');
|
|
118
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
119
|
+
fs.renameSync(npmignorePath, gitignorePath);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
115
122
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
123
|
const minNodeVersion = 18;
|
|
117
124
|
const currentNodeVersion = parseInt(process.version.replace('v', '').split('.')[0]);
|
|
@@ -129,6 +136,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
129
136
|
fs.cpSync(templatesDir, projectDir, { recursive: true });
|
|
130
137
|
updatePluginsFile(projectDir);
|
|
131
138
|
createEnvironmentFile(projectDir);
|
|
139
|
+
checkGitignore(projectDir);
|
|
132
140
|
if (answers.projectDescription) {
|
|
133
141
|
updateFileContents(path_1.default.join(projectDir, 'akinon.json'), {
|
|
134
142
|
description: answers.projectDescription
|
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Button, Link } from '@theme/components';
|
|
5
|
-
import { useLocalization } from '@akinon/next/hooks';
|
|
6
|
-
|
|
7
|
-
const NotFound = () => {
|
|
8
|
-
const { t } = useLocalization();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="py-6 flex flex-col items-center justify-center">
|
|
12
|
-
<div className="text-8xl font-bold">404</div>
|
|
13
|
-
<h1 className="text-4xl font-bold mb-4">{t('not_found.title')}</h1>
|
|
14
|
-
<p className="text-lg mb-6">{t('not_found.sub_title')}</p>
|
|
15
|
-
<Link href={'/'}>
|
|
16
|
-
<Button className="h-auto mt-4 text-base py-3 px-6">
|
|
17
|
-
{t('not_found.button')}
|
|
18
|
-
</Button>
|
|
19
|
-
</Link>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default NotFound;
|