@akinon/projectzero 1.45.0-rc.0 → 1.45.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 -40
- package/README.md +2 -3
- package/app-template/.lintstagedrc.js +4 -5
- package/app-template/CHANGELOG.md +34 -948
- package/app-template/docs/basic-setup.md +1 -1
- package/app-template/docs/plugins.md +7 -7
- package/app-template/package.json +21 -23
- package/app-template/public/locales/en/account.json +4 -4
- package/app-template/public/locales/tr/account.json +1 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/address/page.tsx +1 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/coupons/page.tsx +4 -4
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/profile/page.tsx +0 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +2 -5
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +8 -12
- package/app-template/src/components/checkbox.tsx +2 -2
- package/app-template/src/components/input.tsx +7 -19
- package/app-template/src/components/price.tsx +4 -9
- package/app-template/src/redux/reducers/category.ts +1 -7
- package/app-template/src/settings.js +1 -6
- package/app-template/src/views/account/address-card.tsx +2 -2
- package/app-template/src/views/account/address-form.tsx +7 -22
- package/app-template/src/views/account/contact-form.tsx +6 -23
- package/app-template/src/views/account/favorite-item.tsx +2 -2
- package/app-template/src/views/account/favourite-products/favourite-products-list.tsx +1 -5
- package/app-template/src/views/breadcrumb.tsx +1 -4
- package/app-template/src/views/category/category-info.tsx +17 -31
- package/app-template/src/views/category/filters/index.tsx +105 -5
- package/app-template/src/views/category/layout.tsx +3 -5
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +4 -33
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +37 -43
- package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +3 -19
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +2 -2
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
- package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +37 -230
- package/app-template/src/views/find-in-store/index.tsx +3 -2
- package/app-template/src/views/header/mobile-menu.tsx +8 -25
- package/app-template/tsconfig.json +4 -14
- package/app-template/yarn.lock +1953 -1824
- package/commands/create.ts +5 -29
- package/dist/commands/create.js +2 -25
- package/package.json +2 -2
- package/app-template/package-lock.json +0 -29303
- package/app-template/src/app/[commerce]/[locale]/[currency]/[...prettyurl]/page.tsx +0 -8
- package/app-template/src/views/category/filters/filter-item.tsx +0 -131
|
@@ -24,7 +24,7 @@ The setup process for a Headless Akinon Commerce Cloud Storefront will be guided
|
|
|
24
24
|
2. Next, the storefront needs to be installed by using the `projectzero` CLI.
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
npx @akinon/projectzero
|
|
27
|
+
npx @akinon/projectzero --create
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
3. Provide the following information:
|
|
@@ -7,9 +7,9 @@ custom_edit_url: null
|
|
|
7
7
|
|
|
8
8
|
To access and manage plugins for your Project Zero CLI, run the following command:
|
|
9
9
|
|
|
10
|
-
```
|
|
11
|
-
npx
|
|
12
|
-
```
|
|
10
|
+
```css
|
|
11
|
+
npx projectzero --plugins
|
|
12
|
+
```
|
|
13
13
|
|
|
14
14
|
The plugins selected from this list will be added to the project and ready for use. The plugins can be removed from the project by unchecking it from the same list.
|
|
15
15
|
|
|
@@ -27,9 +27,9 @@ The plugins selected from this list will be added to the project and ready for u
|
|
|
27
27
|
|
|
28
28
|
1. To install plugins, run the following command in the console:
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
```css
|
|
31
|
+
npx projectzero --plugins
|
|
32
|
+
```
|
|
33
33
|
|
|
34
34
|
2. Select the plugins desire to install from the list provided.
|
|
35
35
|
|
|
@@ -73,4 +73,4 @@ Used to enable any payment option with a redirection type on the payment page.
|
|
|
73
73
|
|
|
74
74
|
This plugin enables the "Click & Collect" in-store pickup option.
|
|
75
75
|
|
|
76
|
-
[Click here for details](https://bitbucket.org/akinonteam/pz-click-collect/src/main/)
|
|
76
|
+
[Click here for details](https://bitbucket.org/akinonteam/pz-click-collect/src/main/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.45.0
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -22,26 +22,27 @@
|
|
|
22
22
|
"prestart": "pz-prestart"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@akinon/next": "1.45.0
|
|
26
|
-
"@akinon/pz-akifast": "1.45.0
|
|
27
|
-
"@akinon/pz-b2b": "1.45.0
|
|
28
|
-
"@akinon/pz-basket-gift-pack": "1.45.0
|
|
29
|
-
"@akinon/pz-bkm": "1.45.0
|
|
30
|
-
"@akinon/pz-checkout-gift-pack": "1.45.0
|
|
31
|
-
"@akinon/pz-click-collect": "1.45.0
|
|
32
|
-
"@akinon/pz-credit-payment": "1.45.0
|
|
33
|
-
"@akinon/pz-gpay": "1.45.0
|
|
34
|
-
"@akinon/pz-masterpass": "1.45.0
|
|
35
|
-
"@akinon/pz-one-click-checkout": "1.45.0
|
|
36
|
-
"@akinon/pz-otp": "1.45.0
|
|
37
|
-
"@akinon/pz-pay-on-delivery": "1.45.0
|
|
25
|
+
"@akinon/next": "1.45.0",
|
|
26
|
+
"@akinon/pz-akifast": "1.45.0",
|
|
27
|
+
"@akinon/pz-b2b": "1.45.0",
|
|
28
|
+
"@akinon/pz-basket-gift-pack": "1.45.0",
|
|
29
|
+
"@akinon/pz-bkm": "1.45.0",
|
|
30
|
+
"@akinon/pz-checkout-gift-pack": "1.45.0",
|
|
31
|
+
"@akinon/pz-click-collect": "1.45.0",
|
|
32
|
+
"@akinon/pz-credit-payment": "1.45.0",
|
|
33
|
+
"@akinon/pz-gpay": "1.45.0",
|
|
34
|
+
"@akinon/pz-masterpass": "1.45.0",
|
|
35
|
+
"@akinon/pz-one-click-checkout": "1.45.0",
|
|
36
|
+
"@akinon/pz-otp": "1.45.0",
|
|
37
|
+
"@akinon/pz-pay-on-delivery": "1.45.0",
|
|
38
38
|
"@hookform/resolvers": "2.9.0",
|
|
39
39
|
"@next/third-parties": "14.1.0",
|
|
40
40
|
"@react-google-maps/api": "2.17.1",
|
|
41
|
-
"@sentry/nextjs": "7.
|
|
41
|
+
"@sentry/nextjs": "7.105.0",
|
|
42
42
|
"dayjs": "1.11.5",
|
|
43
|
+
"eslint-config-next": "14.2.2",
|
|
43
44
|
"lossless-json": "2.0.5",
|
|
44
|
-
"next": "14.2.
|
|
45
|
+
"next": "14.2.2",
|
|
45
46
|
"next-auth": "4.24.5",
|
|
46
47
|
"next-pwa": "5.6.0",
|
|
47
48
|
"pino": "8.11.0",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"yup": "0.32.11"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@akinon/eslint-plugin-projectzero": "1.45.0
|
|
62
|
+
"@akinon/eslint-plugin-projectzero": "1.45.0",
|
|
62
63
|
"@semantic-release/changelog": "6.0.2",
|
|
63
64
|
"@semantic-release/exec": "6.0.3",
|
|
64
65
|
"@semantic-release/git": "10.0.1",
|
|
@@ -78,14 +79,14 @@
|
|
|
78
79
|
"clsx": "1.1.1",
|
|
79
80
|
"currency-symbol-map": "5.1.0",
|
|
80
81
|
"eslint": "8.14.0",
|
|
81
|
-
"eslint-config-next": "14.
|
|
82
|
+
"eslint-config-next": "14.0.3",
|
|
82
83
|
"eslint-config-prettier": "8.5.0",
|
|
83
84
|
"husky": "8.0.0",
|
|
84
85
|
"jest": "29.7.0",
|
|
85
86
|
"jest-css-modules-transform": "4.3.0",
|
|
86
87
|
"lint-staged": "13.1.0",
|
|
87
88
|
"prettier": "2.6.2",
|
|
88
|
-
"react-number-format": "
|
|
89
|
+
"react-number-format": "4.9.3",
|
|
89
90
|
"sass": "1.49.9",
|
|
90
91
|
"semantic-release": "19.0.5",
|
|
91
92
|
"server-only": "0.0.1",
|
|
@@ -94,13 +95,10 @@
|
|
|
94
95
|
"stylelint-config-standard": "25.0.0",
|
|
95
96
|
"stylelint-scss": "4.2.0",
|
|
96
97
|
"stylelint-selector-bem-pattern": "2.1.1",
|
|
97
|
-
"tailwindcss": "3.4.
|
|
98
|
+
"tailwindcss": "3.4.0",
|
|
98
99
|
"ts-jest": "29.1.1",
|
|
99
100
|
"ts-node": "10.7.0",
|
|
100
101
|
"typescript": "5.2.2"
|
|
101
102
|
},
|
|
102
|
-
"resolutions": {
|
|
103
|
-
"**/postcss": "8.4.31"
|
|
104
|
-
},
|
|
105
103
|
"packageManager": "yarn@1.22.17"
|
|
106
104
|
}
|
|
@@ -286,11 +286,11 @@
|
|
|
286
286
|
"empty_coupon": "You don't have any coupons"
|
|
287
287
|
},
|
|
288
288
|
"title": {
|
|
289
|
-
"
|
|
289
|
+
"campaings": {
|
|
290
290
|
"active": "Active Campaigns",
|
|
291
|
-
"to_be_active": "
|
|
292
|
-
"expired": "Expired
|
|
293
|
-
"used": "Used
|
|
291
|
+
"to_be_active": "Campaings to be Active",
|
|
292
|
+
"expired": "Expired Campaings",
|
|
293
|
+
"used": "Used Campaings"
|
|
294
294
|
},
|
|
295
295
|
"coupons": {
|
|
296
296
|
"active": "Active Coupons",
|
|
@@ -51,7 +51,7 @@ export default function Page() {
|
|
|
51
51
|
{basketOffersLoading && <LoaderSpinner className="mb-8" />}
|
|
52
52
|
{basketOffersSuccess && (
|
|
53
53
|
<CouponItem
|
|
54
|
-
mainTitle={t('account.my_vouchers.title.
|
|
54
|
+
mainTitle={t('account.my_vouchers.title.campaings.active')}
|
|
55
55
|
subTitles={[
|
|
56
56
|
t('account.my_vouchers.card.campaign_name'),
|
|
57
57
|
t('account.my_vouchers.card.starting_date'),
|
|
@@ -68,7 +68,7 @@ export default function Page() {
|
|
|
68
68
|
{futureBasketOffersLoading && <LoaderSpinner className="mb-8" />}
|
|
69
69
|
{futureBasketOffersSuccess && (
|
|
70
70
|
<CouponItem
|
|
71
|
-
mainTitle={t('account.my_vouchers.title.
|
|
71
|
+
mainTitle={t('account.my_vouchers.title.campaings.to_be_active')}
|
|
72
72
|
subTitles={[
|
|
73
73
|
t('account.my_vouchers.card.campaign_name'),
|
|
74
74
|
t('account.my_vouchers.card.starting_date'),
|
|
@@ -85,7 +85,7 @@ export default function Page() {
|
|
|
85
85
|
{expiredBasketOffersLoading && <LoaderSpinner className="mb-8" />}
|
|
86
86
|
{expiredBasketOffersSuccess && (
|
|
87
87
|
<CouponItem
|
|
88
|
-
mainTitle={t('account.my_vouchers.title.
|
|
88
|
+
mainTitle={t('account.my_vouchers.title.campaings.expired')}
|
|
89
89
|
subTitles={[
|
|
90
90
|
t('account.my_vouchers.card.campaign_name'),
|
|
91
91
|
t('account.my_vouchers.card.starting_date'),
|
|
@@ -102,7 +102,7 @@ export default function Page() {
|
|
|
102
102
|
{discountItemsLoading && <LoaderSpinner className="mb-8" />}
|
|
103
103
|
{discountItemsSuccess && (
|
|
104
104
|
<CouponItem
|
|
105
|
-
mainTitle={t('account.my_vouchers.title.
|
|
105
|
+
mainTitle={t('account.my_vouchers.title.campaings.used')}
|
|
106
106
|
subTitles={[
|
|
107
107
|
t('account.my_vouchers.card.campaign_name'),
|
|
108
108
|
t('account.my_vouchers.card.starting_date'),
|
|
@@ -4,14 +4,11 @@ import { PageProps } from '@akinon/next/types';
|
|
|
4
4
|
import CategoryLayout from '@theme/views/category/layout';
|
|
5
5
|
|
|
6
6
|
async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
7
|
-
const { data
|
|
8
|
-
pk: params.pk,
|
|
9
|
-
searchParams
|
|
10
|
-
});
|
|
7
|
+
const { data } = await getCategoryData({ pk: params.pk, searchParams });
|
|
11
8
|
|
|
12
9
|
return (
|
|
13
10
|
<>
|
|
14
|
-
<CategoryLayout data={data}
|
|
11
|
+
<CategoryLayout data={data} />
|
|
15
12
|
</>
|
|
16
13
|
);
|
|
17
14
|
}
|
package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx
CHANGED
|
@@ -182,25 +182,21 @@ const CheckoutCompleted = ({
|
|
|
182
182
|
}}
|
|
183
183
|
>
|
|
184
184
|
{data.order.orderitem_set.map((item) => (
|
|
185
|
-
<div
|
|
186
|
-
|
|
187
|
-
className="flex justify-between gap-x-4 w-full"
|
|
188
|
-
>
|
|
189
|
-
<Link
|
|
190
|
-
className="flex justify-between gap-x-4 flex-1 items-center transition-all text-xs text-black-800 hover:text-secondary"
|
|
191
|
-
href={item.product.absolute_url}
|
|
192
|
-
passHref
|
|
193
|
-
>
|
|
185
|
+
<div key={`order-item-${item.id}`} className="flex">
|
|
186
|
+
<Link href={item.product.absolute_url} passHref>
|
|
194
187
|
<Image
|
|
195
188
|
src={item.product.image}
|
|
196
189
|
alt={item.product.name}
|
|
197
190
|
width={64}
|
|
198
191
|
height={96}
|
|
199
192
|
/>
|
|
200
|
-
|
|
201
|
-
<span>{item.product.name}</span>
|
|
202
193
|
</Link>
|
|
203
|
-
<div className="flex justify-
|
|
194
|
+
<div className="flex justify-between flex-1 items-center ml-4">
|
|
195
|
+
<>
|
|
196
|
+
<div className="text-xs text-black-800 transition-all w-full hover:text-secondary">
|
|
197
|
+
{item.product.name}
|
|
198
|
+
</div>
|
|
199
|
+
</>
|
|
204
200
|
<div>
|
|
205
201
|
{item.retail_price !== item.price && (
|
|
206
202
|
<div className="text-black-800 line-through text-xs min-w-max sm:text-sm">
|
|
@@ -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, checked
|
|
6
|
+
const { children, checked, error, ...rest } = props;
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<label className={twMerge('flex flex-col text-xs', props.className)}>
|
|
@@ -12,7 +12,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
12
12
|
type="checkbox"
|
|
13
13
|
{...rest}
|
|
14
14
|
ref={ref}
|
|
15
|
-
|
|
15
|
+
checked={checked ?? false}
|
|
16
16
|
className="w-4 h-4 shrink-0"
|
|
17
17
|
/>
|
|
18
18
|
{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
|
/>
|
|
@@ -1,11 +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
|
-
import Settings from '@theme/settings';
|
|
7
6
|
|
|
8
|
-
export const Price = (props:
|
|
7
|
+
export const Price = (props: NumberFormatProps & PriceProps) => {
|
|
9
8
|
const {
|
|
10
9
|
value,
|
|
11
10
|
currencyCode,
|
|
@@ -38,19 +37,15 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
|
|
|
38
37
|
[currencyCode_, useCurrencySymbol, useCurrencyAfterPrice, useCurrencySpace]
|
|
39
38
|
);
|
|
40
39
|
|
|
41
|
-
const currentCurrencyDecimalScale = Settings.localization.currencies.find(
|
|
42
|
-
(currency) => currency.code === currencyCode_
|
|
43
|
-
).decimalScale;
|
|
44
|
-
|
|
45
40
|
return (
|
|
46
|
-
<
|
|
41
|
+
<NumberFormat
|
|
47
42
|
value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
|
|
48
43
|
{...{
|
|
49
44
|
[useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
|
|
50
45
|
}}
|
|
51
46
|
displayType={displayType}
|
|
52
47
|
thousandSeparator={thousandSeparator}
|
|
53
|
-
decimalScale={
|
|
48
|
+
decimalScale={decimalScale}
|
|
54
49
|
decimalSeparator={decimalSeparator}
|
|
55
50
|
fixedDecimalScale={fixedDecimalScale}
|
|
56
51
|
{...rest}
|
|
@@ -7,13 +7,11 @@ import { WIDGET_TYPE } from '@theme/types';
|
|
|
7
7
|
export interface CategoryState {
|
|
8
8
|
facets: Facet[];
|
|
9
9
|
selectedFacets: Facet[];
|
|
10
|
-
isMenuOpen: boolean;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
const initialState: CategoryState = {
|
|
14
13
|
facets: [],
|
|
15
|
-
selectedFacets: []
|
|
16
|
-
isMenuOpen: false
|
|
14
|
+
selectedFacets: []
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
const categorySlice = createSlice({
|
|
@@ -26,9 +24,6 @@ const categorySlice = createSlice({
|
|
|
26
24
|
setSelectedFacets(state, action) {
|
|
27
25
|
state.selectedFacets = action.payload;
|
|
28
26
|
},
|
|
29
|
-
setMenuOpen(state, action) {
|
|
30
|
-
state.isMenuOpen = action.payload;
|
|
31
|
-
},
|
|
32
27
|
toggleFacet(state, action) {
|
|
33
28
|
const facets = JSON.parse(JSON.stringify(state.facets));
|
|
34
29
|
|
|
@@ -86,7 +81,6 @@ const categorySlice = createSlice({
|
|
|
86
81
|
export const {
|
|
87
82
|
setFacets,
|
|
88
83
|
setSelectedFacets,
|
|
89
|
-
setMenuOpen,
|
|
90
84
|
toggleFacet,
|
|
91
85
|
removeCategoryFacet,
|
|
92
86
|
resetSelectedFacets
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
const { LocaleUrlStrategy } = require('@akinon/next/localization');
|
|
2
2
|
const { ROUTES } = require('@theme/routes');
|
|
3
3
|
|
|
4
|
-
/* IMPORTANT *
|
|
5
|
-
* In order to use one locale in the locales array and hide the default locale in the URL, you need to set the localeUrlStrategy to LocaleUrlStrategy.ShowAllLocales.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
4
|
const commerceUrl = encodeURI(process.env.SERVICE_BACKEND_URL ?? 'default');
|
|
9
5
|
|
|
10
6
|
/** @type {import('@akinon/next/types').Settings} */
|
|
@@ -15,7 +11,6 @@ module.exports = {
|
|
|
15
11
|
{ translationKey: 'size', key: 'size' }
|
|
16
12
|
],
|
|
17
13
|
localization: {
|
|
18
|
-
// If there is one locale in the locales array, the default locale will be hidden in the URL.
|
|
19
14
|
locales: [
|
|
20
15
|
{
|
|
21
16
|
label: 'EN',
|
|
@@ -43,7 +38,7 @@ module.exports = {
|
|
|
43
38
|
}
|
|
44
39
|
],
|
|
45
40
|
defaultLocaleValue: 'en',
|
|
46
|
-
localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale,
|
|
41
|
+
localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale,
|
|
47
42
|
redirectToDefaultLocale: true,
|
|
48
43
|
defaultCurrencyCode: 'usd'
|
|
49
44
|
},
|
|
@@ -27,13 +27,13 @@ export const AddressCard = (props: Props) => {
|
|
|
27
27
|
const [isRemoveAddressModalOpen, setRemoveAddressModalOpen] = useState(false);
|
|
28
28
|
|
|
29
29
|
const onSubmit = async (data) => {
|
|
30
|
-
await editAddress(
|
|
30
|
+
await editAddress(data);
|
|
31
31
|
setIsEditAddressModalOpen(false);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const handleRemoveAddress = async (pk: number) => {
|
|
35
35
|
try {
|
|
36
|
-
await removeAddress(
|
|
36
|
+
await removeAddress(pk)
|
|
37
37
|
.unwrap()
|
|
38
38
|
.then(() => setRemoveAddressModalOpen(false))
|
|
39
39
|
.catch((err) => console.error(err));
|
|
@@ -31,7 +31,7 @@ interface Props {
|
|
|
31
31
|
onSubmit: (data: any) => void;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const makeAddressFormSchema = (t, { phoneNumberLength
|
|
34
|
+
const makeAddressFormSchema = (t, { phoneNumberLength }) =>
|
|
35
35
|
yup.object().shape({
|
|
36
36
|
title: yup.string().required(t('account.address_book.form.error.required')),
|
|
37
37
|
first_name: yup
|
|
@@ -65,9 +65,8 @@ const makeAddressFormSchema = (t, { phoneNumberLength, postCodeLength }) =>
|
|
|
65
65
|
.max(255, t('account.address_book.form.error.line_max')),
|
|
66
66
|
postcode: yup
|
|
67
67
|
.string()
|
|
68
|
-
.
|
|
69
|
-
.
|
|
70
|
-
.max(postCodeLength, t('account.address_book.form.error.postcode_max'))
|
|
68
|
+
.min(5, t('account.address_book.form.error.postcode_min'))
|
|
69
|
+
.max(5, t('account.address_book.form.error.postcode_max'))
|
|
71
70
|
.required(t('account.address_book.form.error.required')),
|
|
72
71
|
company_name: yup.string().nullable(),
|
|
73
72
|
tax_no: yup.string().nullable(),
|
|
@@ -81,8 +80,7 @@ export const AddressForm = (props: Props) => {
|
|
|
81
80
|
const { data, onSubmit } = props;
|
|
82
81
|
const config = useAppSelector((state) => state.config);
|
|
83
82
|
const addressFormSchema = makeAddressFormSchema(t, {
|
|
84
|
-
phoneNumberLength: config.user_phone_format.length
|
|
85
|
-
postCodeLength: config.user_post_code_format.length
|
|
83
|
+
phoneNumberLength: config.user_phone_format.length
|
|
86
84
|
});
|
|
87
85
|
const {
|
|
88
86
|
register,
|
|
@@ -183,22 +181,12 @@ export const AddressForm = (props: Props) => {
|
|
|
183
181
|
if (data && country) {
|
|
184
182
|
reset({
|
|
185
183
|
...data,
|
|
186
|
-
is_corporate:
|
|
184
|
+
is_corporate:
|
|
185
|
+
String(data.is_corporate) === AddressType.company ? 'true' : 'false' // TODO: Fix this! This hack for radio buttons can't be set to boolean value
|
|
187
186
|
});
|
|
188
187
|
}
|
|
189
188
|
}, [data, country, reset]);
|
|
190
189
|
|
|
191
|
-
useEffect(() => {
|
|
192
|
-
if (selectedFormType !== AddressType.company) {
|
|
193
|
-
reset({
|
|
194
|
-
...watch(),
|
|
195
|
-
company_name: '',
|
|
196
|
-
tax_office: '',
|
|
197
|
-
tax_no: ''
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}, [selectedFormType, reset, watch]);
|
|
201
|
-
|
|
202
190
|
return (
|
|
203
191
|
<form
|
|
204
192
|
onSubmit={handleSubmit(onSubmit)}
|
|
@@ -334,15 +322,12 @@ export const AddressForm = (props: Props) => {
|
|
|
334
322
|
)}
|
|
335
323
|
</label>
|
|
336
324
|
<Input
|
|
325
|
+
type="number"
|
|
337
326
|
label={t('account.address_book.form.post_code.placeholder')}
|
|
338
327
|
{...register('postcode')}
|
|
339
328
|
error={errors.postcode}
|
|
340
329
|
data-testid="address-form-post-code"
|
|
341
330
|
required
|
|
342
|
-
format={config.user_post_code_format.replaceAll(/\9/g, '#')}
|
|
343
|
-
control={control}
|
|
344
|
-
mask="_"
|
|
345
|
-
allowEmptyFormatting
|
|
346
331
|
/>
|
|
347
332
|
{selectedFormType === AddressType.company && (
|
|
348
333
|
<>
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
Button,
|
|
4
4
|
FileInput,
|
|
5
5
|
Input,
|
|
6
|
-
Link,
|
|
7
6
|
LoaderSpinner,
|
|
8
|
-
Select
|
|
7
|
+
Select,
|
|
8
|
+
Link
|
|
9
9
|
} from '@theme/components';
|
|
10
10
|
import { useSession } from 'next-auth/react';
|
|
11
11
|
import { useEffect, useState } from 'react';
|
|
@@ -45,8 +45,7 @@ const contactFormSchema = (t) =>
|
|
|
45
45
|
.when('subject', {
|
|
46
46
|
is: (value) => value === '2',
|
|
47
47
|
then: yup.string().required(t('account.contact.form.error.required'))
|
|
48
|
-
})
|
|
49
|
-
file: yup.mixed()
|
|
48
|
+
})
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
const ContactForm = () => {
|
|
@@ -111,18 +110,8 @@ const ContactForm = () => {
|
|
|
111
110
|
resolver: yupResolver(contactFormSchema(t))
|
|
112
111
|
});
|
|
113
112
|
|
|
114
|
-
const onSubmit: SubmitHandler<ContactFormType> = (data
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Object.keys(data ?? {}).forEach((key) => {
|
|
118
|
-
if (key === 'file' && data[key]) {
|
|
119
|
-
formData.append(key, data[key][0]);
|
|
120
|
-
} else if (data[key]) {
|
|
121
|
-
formData.append(key, data[key]);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
sendContact(formData);
|
|
113
|
+
const onSubmit: SubmitHandler<ContactFormType> = (data) => {
|
|
114
|
+
sendContact(data);
|
|
126
115
|
};
|
|
127
116
|
|
|
128
117
|
const handleChange = (e) => {
|
|
@@ -245,7 +234,6 @@ const ContactForm = () => {
|
|
|
245
234
|
className="border-gray-500 border w-full text-xs p-2.5 focus-visible:outline-none focus:border-black hover:border-black"
|
|
246
235
|
rows={7}
|
|
247
236
|
name="message"
|
|
248
|
-
// @ts-expect-error -- awaiting fix:
|
|
249
237
|
{...register('message')}
|
|
250
238
|
/>
|
|
251
239
|
{errors.message && (
|
|
@@ -254,12 +242,7 @@ const ContactForm = () => {
|
|
|
254
242
|
<label className="text-xs text-gray-800 mb-2 block">
|
|
255
243
|
{t('account.contact.form.file.title')}
|
|
256
244
|
</label>
|
|
257
|
-
<FileInput
|
|
258
|
-
name="file"
|
|
259
|
-
title="file"
|
|
260
|
-
className="w-full mb-5"
|
|
261
|
-
{...register('file')}
|
|
262
|
-
/>
|
|
245
|
+
<FileInput className="w-full mb-5" title="test" />
|
|
263
246
|
<Button type="submit" className="w-full font-medium">
|
|
264
247
|
{t('account.contact.form.submit_button')}
|
|
265
248
|
</Button>
|
|
@@ -93,8 +93,8 @@ export const FavoriteItem = (props: Props) => {
|
|
|
93
93
|
className={clsx(
|
|
94
94
|
'absolute top-4 right-4 cursor-pointer',
|
|
95
95
|
isRemoveFavoriteLoading
|
|
96
|
-
? 'hover:cursor-wait'
|
|
97
|
-
: '
|
|
96
|
+
? 'pointer-events-none hover:cursor-wait' // TODO: Cursors not working fix!
|
|
97
|
+
: 'hove:cursor-pointer'
|
|
98
98
|
)}
|
|
99
99
|
data-testid="favorites-remove"
|
|
100
100
|
/>
|
|
@@ -30,11 +30,7 @@ const FavoriteProductsList = () => {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (isLoading || isFetching) {
|
|
33
|
-
return
|
|
34
|
-
<div className="flex items-center justify-center h-80">
|
|
35
|
-
<LoaderSpinner />
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
33
|
+
return <LoaderSpinner />; // TODO: Fix loader spinner position
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
return (
|
|
@@ -5,7 +5,6 @@ import { Icon, Link } from '@theme/components';
|
|
|
5
5
|
import { ROUTES } from '@theme/routes';
|
|
6
6
|
import { useLocalization } from '@akinon/next/hooks';
|
|
7
7
|
import { BreadcrumbResultType } from '@akinon/next/types';
|
|
8
|
-
import { capitalize } from '@akinon/next/utils';
|
|
9
8
|
|
|
10
9
|
export interface BreadcrumbProps {
|
|
11
10
|
breadcrumbList?: BreadcrumbResultType[];
|
|
@@ -27,9 +26,7 @@ export default function Breadcrumb(props: BreadcrumbProps) {
|
|
|
27
26
|
<div className="flex items-center gap-3 text-xs leading-4 text-gray-950">
|
|
28
27
|
{list.map((item, index) => (
|
|
29
28
|
<Fragment key={index}>
|
|
30
|
-
<Link href={item.url}>
|
|
31
|
-
{capitalize(item.text.toLocaleLowerCase())}
|
|
32
|
-
</Link>
|
|
29
|
+
<Link href={item.url}>{item.text}</Link>
|
|
33
30
|
{index !== list.length - 1 && <Icon name="chevron-end" size={8} />}
|
|
34
31
|
</Fragment>
|
|
35
32
|
))}
|