@akinon/projectzero 1.118.0-rc.9 → 1.118.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 -24
- package/app-template/.env.example +0 -3
- package/app-template/CHANGELOG.md +29 -360
- package/app-template/README.md +1 -25
- package/app-template/akinon.json +1 -1
- package/app-template/docs/advanced-usage.md +0 -10
- package/app-template/package.json +28 -28
- package/app-template/public/locales/en/account.json +1 -3
- package/app-template/public/locales/en/product.json +0 -18
- package/app-template/public/locales/tr/account.json +1 -3
- package/app-template/public/locales/tr/product.json +0 -18
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +1 -20
- package/app-template/src/app/[commerce]/[locale]/[currency]/users/reset/[[...id]]/page.tsx +3 -45
- package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/[node]/route.ts +4 -6
- package/app-template/src/components/modal.tsx +0 -2
- package/app-template/src/components/select.tsx +1 -1
- package/app-template/src/hooks/index.ts +0 -2
- package/app-template/src/middleware.ts +1 -2
- package/app-template/src/plugins.js +0 -1
- package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +5 -21
- package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +5 -25
- package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +2 -21
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +4 -22
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +17 -30
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
- package/app-template/src/views/header/search/index.tsx +5 -13
- package/app-template/src/views/product/slider.tsx +38 -85
- package/commands/plugins.ts +0 -4
- package/dist/commands/plugins.js +0 -4
- package/package.json +1 -1
- package/app-template/src/app/api/barcode-search/route.ts +0 -1
|
@@ -88,8 +88,6 @@
|
|
|
88
88
|
"multiple_results_subtitle": "{{count}} ürün için deneme tamamlandı",
|
|
89
89
|
"error_incompatible": "Görüntü Uyumlu Değil",
|
|
90
90
|
"error_auto_reported": "Hata otomatik olarak bildirildi",
|
|
91
|
-
"error_aspect_ratio_too_tall": "Görsel çok uzun. Dikey görseller için izin verilen maksimum oran 9:16'dır. Lütfen kırpın veya farklı bir görsel seçin.",
|
|
92
|
-
"error_aspect_ratio_too_wide": "Görsel çok geniş. Yatay görseller için izin verilen maksimum oran 21:9'dur. Lütfen kırpın veya farklı bir görsel seçin.",
|
|
93
91
|
"feedback_question": "Sonuç nasıldı?",
|
|
94
92
|
"feedback_success": "Başarılı",
|
|
95
93
|
"feedback_failed": "Başarısız",
|
|
@@ -100,21 +98,5 @@
|
|
|
100
98
|
"starting": "Başlatılıyor...",
|
|
101
99
|
"will_start": "için sanal deneme başlatılacak",
|
|
102
100
|
"products_count": "ürün"
|
|
103
|
-
},
|
|
104
|
-
"barcode_scanner": {
|
|
105
|
-
"title": "Barkodu Okut",
|
|
106
|
-
"button_label": "Barkod Tarayıcı",
|
|
107
|
-
"button_text": "Mağazadaki ürünü üstünde dene",
|
|
108
|
-
"help_text": "Ürün barkodunu kameraya yaklaştırın",
|
|
109
|
-
"scan_more_help": "Bir ürün daha okutmak isterseniz, yeni barkodu da kameranıza yaklaştırın.",
|
|
110
|
-
"searching": "Ürün aranıyor...",
|
|
111
|
-
"continue_to_vto": "Sanal Kabine Devam Et",
|
|
112
|
-
"permission_denied_title": "Kamera İzni Gerekli",
|
|
113
|
-
"permission_denied_message": "Barkod okuyucu için kamera erişimine izin vermeniz gerekmektedir.",
|
|
114
|
-
"try_again": "Tekrar Dene",
|
|
115
|
-
"errors": {
|
|
116
|
-
"product_not_found": "Bu barkoda ait ürün bulunamadı.",
|
|
117
|
-
"search_failed": "Arama başarısız oldu. Lütfen tekrar deneyin."
|
|
118
|
-
}
|
|
119
101
|
}
|
|
120
102
|
}
|
|
@@ -61,26 +61,7 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
61
61
|
}, [order, isSuccess, localeValue]);
|
|
62
62
|
|
|
63
63
|
if (isLoading && isFetching) {
|
|
64
|
-
return
|
|
65
|
-
<div className="flex flex-col items-center justify-center h-96">
|
|
66
|
-
<LoaderSpinner />
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!order) {
|
|
72
|
-
return (
|
|
73
|
-
<div className="flex flex-col items-center justify-center h-96">
|
|
74
|
-
<p className="mt-5 text-start text-lg mb-4">
|
|
75
|
-
{t('account.my_orders.detail.no_orders_found')}
|
|
76
|
-
</p>
|
|
77
|
-
<Link href={`/account/orders/`}>
|
|
78
|
-
<Button className="px-4" appearance="filled">
|
|
79
|
-
{t('account.my_orders.detail.back_to_orders')}
|
|
80
|
-
</Button>
|
|
81
|
-
</Link>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
64
|
+
return <LoaderSpinner />;
|
|
84
65
|
}
|
|
85
66
|
|
|
86
67
|
return (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Button, Input, Link
|
|
3
|
+
import { Button, Input, Link } from '@theme/components';
|
|
4
4
|
import { useForm, SubmitHandler } from 'react-hook-form';
|
|
5
5
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
6
|
import * as yup from 'yup';
|
|
7
7
|
import {
|
|
8
8
|
usePasswordResetMutation,
|
|
9
|
-
useGetValidatePasswordResetTokenQuery,
|
|
10
9
|
PasswordResetType
|
|
11
10
|
} from '@akinon/next/data/client/account';
|
|
12
11
|
import { useLocalization } from '@akinon/next/hooks';
|
|
@@ -16,16 +15,6 @@ export default function NewPassword({ params: { id } }) {
|
|
|
16
15
|
const { t } = useLocalization();
|
|
17
16
|
const [newPassword, { isSuccess: formSuccess }] = usePasswordResetMutation();
|
|
18
17
|
|
|
19
|
-
const token = id?.join('/');
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
data: validationData,
|
|
23
|
-
isLoading: isValidating,
|
|
24
|
-
error: validationError
|
|
25
|
-
} = useGetValidatePasswordResetTokenQuery(token, {
|
|
26
|
-
skip: !token
|
|
27
|
-
});
|
|
28
|
-
|
|
29
18
|
const newPasswordFormSchema = (t) =>
|
|
30
19
|
yup.object().shape({
|
|
31
20
|
password: yup
|
|
@@ -35,10 +24,7 @@ export default function NewPassword({ params: { id } }) {
|
|
|
35
24
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{6,}$/,
|
|
36
25
|
t('forgot_password.create_new_password.form.error.password_rule')
|
|
37
26
|
)
|
|
38
|
-
.max(
|
|
39
|
-
50,
|
|
40
|
-
t('forgot_password.create_new_password.form.error.password_max')
|
|
41
|
-
),
|
|
27
|
+
.max(50, t('forgot_password.create_new_password.form.error.password_max')),
|
|
42
28
|
repeatPassword: yup
|
|
43
29
|
.string()
|
|
44
30
|
.required(t('forgot_password.create_new_password.form.error.required'))
|
|
@@ -59,31 +45,6 @@ export default function NewPassword({ params: { id } }) {
|
|
|
59
45
|
newPassword(data);
|
|
60
46
|
};
|
|
61
47
|
|
|
62
|
-
if (isValidating) {
|
|
63
|
-
return (
|
|
64
|
-
<div className="container my-12 flex flex-col items-center px-4">
|
|
65
|
-
<div className="w-full xl:w-5/12 text-center">
|
|
66
|
-
<LoaderSpinner />
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (validationError || !validationData?.validlink) {
|
|
73
|
-
return (
|
|
74
|
-
<div className="container my-12 flex flex-col items-center px-4">
|
|
75
|
-
<div className="w-full xl:w-5/12 text-center">
|
|
76
|
-
<div className="text-2xl mb-4 text-error">
|
|
77
|
-
{t('account.password_reset.expired_link_message')}
|
|
78
|
-
</div>
|
|
79
|
-
<Link href="/users/password/reset" className="underline text-primary">
|
|
80
|
-
{t('account.password_reset.continue_password_reset')}
|
|
81
|
-
</Link>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
48
|
return (
|
|
88
49
|
<div className="container my-12 flex flex-col items-center px-4">
|
|
89
50
|
<div className="w-full xl:w-5/12 text-center">
|
|
@@ -118,10 +79,7 @@ export default function NewPassword({ params: { id } }) {
|
|
|
118
79
|
required
|
|
119
80
|
/>
|
|
120
81
|
|
|
121
|
-
<PasswordRulesFeedback
|
|
122
|
-
password={passwordValue}
|
|
123
|
-
isVisible={errors?.password ? true : false}
|
|
124
|
-
/>
|
|
82
|
+
<PasswordRulesFeedback password={passwordValue} isVisible={errors?.password ? true : false}/>
|
|
125
83
|
</div>
|
|
126
84
|
|
|
127
85
|
<div className="mb-2 text-left">
|
|
@@ -58,12 +58,10 @@ export async function GET(request: Request, context: { params }) {
|
|
|
58
58
|
|
|
59
59
|
let sitemapContent = await sitemap.text();
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
sitemapContent = sitemapContent.replace(domainRegex, `$&${localeSuffix}`);
|
|
66
|
-
}
|
|
61
|
+
sitemapContent = sitemapContent.replace(
|
|
62
|
+
/\.com/g,
|
|
63
|
+
`.com${matchedLocale?.[0] ?? ''}`
|
|
64
|
+
);
|
|
67
65
|
|
|
68
66
|
return new Response(sitemapContent, {
|
|
69
67
|
headers: {
|
|
@@ -41,14 +41,12 @@ export const Modal = (props: ModalProps) => {
|
|
|
41
41
|
'fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50',
|
|
42
42
|
overlayClassName
|
|
43
43
|
)}
|
|
44
|
-
onClick={(e) => e.stopPropagation()}
|
|
45
44
|
/>
|
|
46
45
|
<section
|
|
47
46
|
className={twMerge(
|
|
48
47
|
'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
|
|
49
48
|
className
|
|
50
49
|
)}
|
|
51
|
-
onClick={(e) => e.stopPropagation()}
|
|
52
50
|
>
|
|
53
51
|
{(showCloseButton || title) && (
|
|
54
52
|
<div
|
|
@@ -48,7 +48,7 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
|
|
|
48
48
|
clsx(
|
|
49
49
|
'cursor-pointer truncate h-10 w-40 px-2.5 shrink-0 outline-none',
|
|
50
50
|
!borderless &&
|
|
51
|
-
'border border-gray-200 transition-all duration-150 hover:border-primary
|
|
51
|
+
'border border-gray-200 transition-all duration-150 hover:border-primary',
|
|
52
52
|
'appearance-none bg-transparent'
|
|
53
53
|
),
|
|
54
54
|
className
|
|
@@ -14,8 +14,7 @@ export const config = {
|
|
|
14
14
|
'/((?!api|_next|[\\w-\\/*]+\\.\\w+).*)',
|
|
15
15
|
'/(.*sitemap\\.xml)',
|
|
16
16
|
'/(.+\\.)(html|htm|aspx|asp|php)',
|
|
17
|
-
'/(.*orders\\/checkout-with-token.*)'
|
|
18
|
-
'/(.*orders\\/post-checkout.*)'
|
|
17
|
+
'/(.*orders\\/checkout-with-token.*)'
|
|
19
18
|
]
|
|
20
19
|
};
|
|
21
20
|
|
|
@@ -21,7 +21,7 @@ export const OrderDetailHeader = ({ title, order, children }: Props) => {
|
|
|
21
21
|
<div>
|
|
22
22
|
<span>{t('account.my_orders.detail.order_number')}</span>:{' '}
|
|
23
23
|
<span data-testid="account-orders-return-order-id">
|
|
24
|
-
{order
|
|
24
|
+
{order.number}
|
|
25
25
|
</span>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
@@ -16,7 +16,7 @@ import PaymentHeader from '../../payment-header';
|
|
|
16
16
|
import CreditCardInstallments from './installments';
|
|
17
17
|
import { useLocalization } from '@akinon/next/hooks';
|
|
18
18
|
import { Image } from '@akinon/next/components/image';
|
|
19
|
-
import { getPosError
|
|
19
|
+
import { getPosError } from '@akinon/next/utils';
|
|
20
20
|
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
21
21
|
import { PaymentOption } from '@akinon/next/types';
|
|
22
22
|
|
|
@@ -101,7 +101,7 @@ const CheckoutCreditCard = () => {
|
|
|
101
101
|
setValue: setFormValue,
|
|
102
102
|
trigger: validateInput,
|
|
103
103
|
control,
|
|
104
|
-
formState: { errors
|
|
104
|
+
formState: { errors },
|
|
105
105
|
setError,
|
|
106
106
|
getValues,
|
|
107
107
|
clearErrors
|
|
@@ -119,12 +119,8 @@ const CheckoutCreditCard = () => {
|
|
|
119
119
|
const [years, setYears] = useState([]);
|
|
120
120
|
const [formError, setFormError] = useState(null);
|
|
121
121
|
const [cardBinNumber, setCardBinNumber] = useState(null);
|
|
122
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
123
122
|
const [setBinNumber] = useSetBinNumberMutation();
|
|
124
|
-
const [completeCreditCardPayment
|
|
125
|
-
useCompleteCreditCardPaymentMutation();
|
|
126
|
-
|
|
127
|
-
const isButtonDisabled = isSubmitting || isCompletingPayment || isProcessing;
|
|
123
|
+
const [completeCreditCardPayment] = useCompleteCreditCardPaymentMutation();
|
|
128
124
|
|
|
129
125
|
const handleCardNumberChange = (value) => {
|
|
130
126
|
const binNumber = value.replace(/\D/g, '').substring(0, 6);
|
|
@@ -140,20 +136,9 @@ const CheckoutCreditCard = () => {
|
|
|
140
136
|
};
|
|
141
137
|
|
|
142
138
|
const onSubmit: SubmitHandler<CreditCardForm> = async (data) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
setIsProcessing(true);
|
|
146
|
-
|
|
147
|
-
try {
|
|
148
|
-
const response = await completeCreditCardPayment(data).unwrap();
|
|
149
|
-
setFormError(response?.errors);
|
|
139
|
+
const response = await completeCreditCardPayment(data).unwrap();
|
|
150
140
|
|
|
151
|
-
|
|
152
|
-
setIsProcessing(false);
|
|
153
|
-
}
|
|
154
|
-
} catch (error) {
|
|
155
|
-
setIsProcessing(false);
|
|
156
|
-
}
|
|
141
|
+
setFormError(response?.errors);
|
|
157
142
|
};
|
|
158
143
|
|
|
159
144
|
useEffect(() => {
|
|
@@ -407,7 +392,6 @@ const CheckoutCreditCard = () => {
|
|
|
407
392
|
<Button
|
|
408
393
|
className="group uppercase mt-4 inline-flex items-center justify-center"
|
|
409
394
|
type="submit"
|
|
410
|
-
disabled={isButtonDisabled}
|
|
411
395
|
data-testid="checkout-credit-card-place-order"
|
|
412
396
|
>
|
|
413
397
|
<span>{t('checkout.payment.credit_card.form.button')}</span>
|
|
@@ -12,7 +12,6 @@ import * as yup from 'yup';
|
|
|
12
12
|
import CheckoutAgreements from '../agreements';
|
|
13
13
|
import PaymentHeader from '../payment-header';
|
|
14
14
|
import { useLocalization } from '@akinon/next/hooks';
|
|
15
|
-
import { checkPaymentWillRedirect } from '@akinon/next/utils';
|
|
16
15
|
import { Image } from '@akinon/next/components/image';
|
|
17
16
|
import { Trans } from '@akinon/next/components/trans';
|
|
18
17
|
|
|
@@ -26,39 +25,21 @@ const CheckoutFundsTransfer = () => {
|
|
|
26
25
|
const {
|
|
27
26
|
handleSubmit,
|
|
28
27
|
control,
|
|
29
|
-
formState: { errors
|
|
28
|
+
formState: { errors }
|
|
30
29
|
} = useForm({
|
|
31
30
|
resolver: yupResolver(fundsTransferFormSchema())
|
|
32
31
|
});
|
|
33
32
|
const [formError, setFormError] = useState(null);
|
|
34
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
35
33
|
const { bankAccounts, selectedBankAccountPk, preOrder } = useAppSelector(
|
|
36
34
|
(state: RootState) => state.checkout
|
|
37
35
|
);
|
|
38
36
|
const [setFundsTransferOption] = useSetFundsTransferOptionMutation();
|
|
39
|
-
const [completeFundsTransfer
|
|
40
|
-
useCompleteFundsTransferMutation();
|
|
41
|
-
|
|
42
|
-
const isButtonDisabled = isSubmitting || isCompletingPayment || isProcessing;
|
|
37
|
+
const [completeFundsTransfer] = useCompleteFundsTransferMutation();
|
|
43
38
|
|
|
44
39
|
const onSubmit: SubmitHandler<null> = async () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
const response = await completeFundsTransfer().unwrap();
|
|
51
|
-
setFormError(response?.errors?.non_field_errors);
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
response?.errors?.non_field_errors ||
|
|
55
|
-
!checkPaymentWillRedirect(response)
|
|
56
|
-
) {
|
|
57
|
-
setIsProcessing(false);
|
|
58
|
-
}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
setIsProcessing(false);
|
|
61
|
-
}
|
|
40
|
+
const response = await completeFundsTransfer().unwrap();
|
|
41
|
+
|
|
42
|
+
setFormError(response?.errors?.non_field_errors);
|
|
62
43
|
};
|
|
63
44
|
|
|
64
45
|
useEffect(() => {
|
|
@@ -174,7 +155,6 @@ const CheckoutFundsTransfer = () => {
|
|
|
174
155
|
<Button
|
|
175
156
|
className="group uppercase mt-4 inline-flex items-center justify-center w-full"
|
|
176
157
|
type="submit"
|
|
177
|
-
disabled={isButtonDisabled}
|
|
178
158
|
data-testid="checkout-bank-account-place-order"
|
|
179
159
|
>
|
|
180
160
|
<span> {t('checkout.payment.fund_transfer.button')}</span>
|
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useState } from 'react';
|
|
4
3
|
import { useCompleteLoyaltyPaymentMutation } from '@akinon/next/data/client/checkout';
|
|
5
4
|
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
6
5
|
import { useForm } from 'react-hook-form';
|
|
7
|
-
import { checkPaymentWillRedirect } from '@akinon/next/utils';
|
|
8
6
|
|
|
9
7
|
export default function LoyaltyPayment() {
|
|
10
8
|
const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
|
|
11
9
|
const { handleSubmit } = useForm();
|
|
12
|
-
const [completeLoyaltyPayment
|
|
13
|
-
useCompleteLoyaltyPaymentMutation();
|
|
14
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
15
|
-
|
|
16
|
-
const isButtonDisabled = isCompletingPayment || isProcessing;
|
|
10
|
+
const [completeLoyaltyPayment] = useCompleteLoyaltyPaymentMutation();
|
|
17
11
|
|
|
18
12
|
const onSubmit = async () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
setIsProcessing(true);
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const response = await completeLoyaltyPayment().unwrap();
|
|
25
|
-
|
|
26
|
-
if (response?.errors || !checkPaymentWillRedirect(response)) {
|
|
27
|
-
setIsProcessing(false);
|
|
28
|
-
}
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error('Error completing loyalty payment:', error);
|
|
31
|
-
setIsProcessing(false);
|
|
32
|
-
}
|
|
13
|
+
completeLoyaltyPayment();
|
|
33
14
|
};
|
|
34
15
|
|
|
35
16
|
return (
|
|
@@ -8,7 +8,7 @@ import { useForm } from 'react-hook-form';
|
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import * as yup from 'yup';
|
|
10
10
|
import { useEffect, useState } from 'react';
|
|
11
|
-
import { getPosError
|
|
11
|
+
import { getPosError } from '@akinon/next/utils';
|
|
12
12
|
import { useMessageListener } from '@akinon/next/hooks';
|
|
13
13
|
|
|
14
14
|
interface FormValues {
|
|
@@ -26,33 +26,16 @@ const formSchema = () =>
|
|
|
26
26
|
export default function RedirectionPayment() {
|
|
27
27
|
const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
|
|
28
28
|
const [formError, setFormError] = useState(null);
|
|
29
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
30
29
|
const {
|
|
31
30
|
register,
|
|
32
31
|
handleSubmit,
|
|
33
|
-
formState: { errors
|
|
32
|
+
formState: { errors }
|
|
34
33
|
} = useForm<FormValues>({
|
|
35
34
|
resolver: yupResolver(formSchema())
|
|
36
35
|
});
|
|
37
|
-
const [completeRedirectionPayment
|
|
38
|
-
useCompleteRedirectionPaymentMutation();
|
|
39
|
-
|
|
40
|
-
const isButtonDisabled = isSubmitting || isCompletingPayment || isProcessing;
|
|
41
|
-
|
|
36
|
+
const [completeRedirectionPayment] = useCompleteRedirectionPaymentMutation();
|
|
42
37
|
const onSubmit = async () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setIsProcessing(true);
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const response = await completeRedirectionPayment().unwrap();
|
|
49
|
-
|
|
50
|
-
if (response?.errors || !checkPaymentWillRedirect(response)) {
|
|
51
|
-
setIsProcessing(false);
|
|
52
|
-
}
|
|
53
|
-
} catch (error) {
|
|
54
|
-
setIsProcessing(false);
|
|
55
|
-
}
|
|
38
|
+
completeRedirectionPayment();
|
|
56
39
|
};
|
|
57
40
|
|
|
58
41
|
useMessageListener();
|
|
@@ -108,7 +91,6 @@ export default function RedirectionPayment() {
|
|
|
108
91
|
|
|
109
92
|
<Button
|
|
110
93
|
data-testid="checkout-submit-button"
|
|
111
|
-
disabled={isButtonDisabled}
|
|
112
94
|
className={twMerge('w-full md:w-36 px-4 md:px-0')}
|
|
113
95
|
>
|
|
114
96
|
{payment_option.name}
|
|
@@ -85,7 +85,7 @@ const AddressBox = ({
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
const onSubmit = (data) => {
|
|
88
|
-
editAddress({ ...data, invalidateTag: '
|
|
88
|
+
editAddress({ ...data, invalidateTag: 'Addresses' })
|
|
89
89
|
.unwrap()
|
|
90
90
|
.then((editAddressResponse) => {
|
|
91
91
|
handleAddressClick(addressType, editAddressResponse);
|
|
@@ -96,7 +96,7 @@ const AddressBox = ({
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const handleRemoveAddress = async (addressPk: number) => {
|
|
99
|
-
await removeAddress({ id: addressPk, invalidateTag: '
|
|
99
|
+
await removeAddress({ id: addressPk, invalidateTag: 'Addresses' });
|
|
100
100
|
setRemoveAddressModalOpen(false);
|
|
101
101
|
dispatch(resetCheckoutState());
|
|
102
102
|
|
|
@@ -168,10 +168,7 @@ const AddressBox = ({
|
|
|
168
168
|
<Button
|
|
169
169
|
appearance="ghost"
|
|
170
170
|
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
171
|
-
onClick={(
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
setIsEditAddressModalOpen(true);
|
|
174
|
-
}}
|
|
171
|
+
onClick={() => setIsEditAddressModalOpen(true)}
|
|
175
172
|
data-testid="checkout-address-edit"
|
|
176
173
|
>
|
|
177
174
|
{t('checkout.address.box.edit')}
|
|
@@ -183,26 +180,21 @@ const AddressBox = ({
|
|
|
183
180
|
setOpen={setIsEditAddressModalOpen}
|
|
184
181
|
className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
|
|
185
182
|
>
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/>
|
|
197
|
-
</div>
|
|
183
|
+
<AddressForm
|
|
184
|
+
data={{
|
|
185
|
+
...address,
|
|
186
|
+
country: address.country?.pk,
|
|
187
|
+
city: address.city?.pk,
|
|
188
|
+
township: address.township?.pk,
|
|
189
|
+
district: address.district?.pk
|
|
190
|
+
}}
|
|
191
|
+
onSubmit={onSubmit}
|
|
192
|
+
/>
|
|
198
193
|
</Modal>
|
|
199
194
|
<Button
|
|
200
195
|
appearance="ghost"
|
|
201
196
|
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
202
|
-
onClick={(
|
|
203
|
-
e.stopPropagation();
|
|
204
|
-
setRemoveAddressModalOpen(true);
|
|
205
|
-
}}
|
|
197
|
+
onClick={() => setRemoveAddressModalOpen(true)}
|
|
206
198
|
data-testid="checkout-address-remove"
|
|
207
199
|
>
|
|
208
200
|
{t('checkout.address.box.remove')}
|
|
@@ -215,18 +207,14 @@ const AddressBox = ({
|
|
|
215
207
|
setOpen={setRemoveAddressModalOpen}
|
|
216
208
|
showCloseButton={false}
|
|
217
209
|
>
|
|
218
|
-
<div
|
|
219
|
-
className="text-center px-6 py-10"
|
|
220
|
-
onClick={(e) => e.stopPropagation()}
|
|
221
|
-
>
|
|
210
|
+
<div className="text-center px-6 py-10">
|
|
222
211
|
<p className="mb-4">
|
|
223
212
|
{t('account.address_book.modal.delete_description')}
|
|
224
213
|
</p>
|
|
225
214
|
<div className="space-x-3 flex justify-center">
|
|
226
215
|
<Button
|
|
227
216
|
appearance="outlined"
|
|
228
|
-
onClick={(
|
|
229
|
-
e.stopPropagation();
|
|
217
|
+
onClick={() => {
|
|
230
218
|
setRemoveAddressModalOpen(false);
|
|
231
219
|
}}
|
|
232
220
|
data-testid="remove-address-modal-cancel"
|
|
@@ -236,8 +224,7 @@ const AddressBox = ({
|
|
|
236
224
|
<Button
|
|
237
225
|
appearance="filled"
|
|
238
226
|
disabled={removeAddressLoading}
|
|
239
|
-
onClick={(
|
|
240
|
-
e.stopPropagation();
|
|
227
|
+
onClick={() => {
|
|
241
228
|
handleRemoveAddress(address.pk);
|
|
242
229
|
}}
|
|
243
230
|
className={
|
|
@@ -77,7 +77,7 @@ const Addresses = () => {
|
|
|
77
77
|
}, [billing_and_shipping_same]);
|
|
78
78
|
|
|
79
79
|
const onSubmit = (data) => {
|
|
80
|
-
addAddress({ ...data, invalidateTag: '
|
|
80
|
+
addAddress({ ...data, invalidateTag: 'Addresses' })
|
|
81
81
|
.unwrap()
|
|
82
82
|
.then((addAddressResponse) => {
|
|
83
83
|
if (addressList.length === 0) {
|
|
@@ -4,7 +4,8 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
4
4
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
5
5
|
import { closeSearch } from '@akinon/next/redux/reducers/header';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { Icon } from '@theme/components';
|
|
8
9
|
import Results from './results';
|
|
9
10
|
import { ROUTES } from '@theme/routes';
|
|
10
11
|
import { useLocalization, useRouter } from '@akinon/next/hooks';
|
|
@@ -41,14 +42,6 @@ export default function Search() {
|
|
|
41
42
|
};
|
|
42
43
|
}, [isSearchOpen, dispatch]);
|
|
43
44
|
|
|
44
|
-
const handleSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
45
|
-
setSearchText(e.target.value);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const handleCloseSearch = () => {
|
|
49
|
-
dispatch(closeSearch());
|
|
50
|
-
};
|
|
51
|
-
|
|
52
45
|
return (
|
|
53
46
|
<>
|
|
54
47
|
<div
|
|
@@ -74,9 +67,9 @@ export default function Search() {
|
|
|
74
67
|
{t('common.search.results_for')}
|
|
75
68
|
</span>
|
|
76
69
|
<div className="flex items-center">
|
|
77
|
-
<
|
|
70
|
+
<input
|
|
78
71
|
value={searchText}
|
|
79
|
-
onChange={
|
|
72
|
+
onChange={(e) => setSearchText(e.target.value)}
|
|
80
73
|
onKeyDown={(e) => {
|
|
81
74
|
if (e.key === 'Enter' && searchText.trim() !== '') {
|
|
82
75
|
router.push(`${ROUTES.LIST}/?search_text=${searchText}`);
|
|
@@ -98,12 +91,11 @@ export default function Search() {
|
|
|
98
91
|
<Icon
|
|
99
92
|
name="close"
|
|
100
93
|
size={14}
|
|
101
|
-
onClick={
|
|
94
|
+
onClick={() => dispatch(closeSearch())}
|
|
102
95
|
className="cursor-pointer"
|
|
103
96
|
/>
|
|
104
97
|
</div>
|
|
105
98
|
</div>
|
|
106
|
-
|
|
107
99
|
<Results searchText={searchText} />
|
|
108
100
|
</div>
|
|
109
101
|
</div>
|