@akinon/projectzero 1.108.0-rc.87 → 1.108.0-rc.9

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +24 -228
  2. package/app-template/.env.example +1 -0
  3. package/app-template/CHANGELOG.md +576 -4915
  4. package/app-template/package.json +26 -21
  5. package/app-template/public/locales/en/account.json +3 -1
  6. package/app-template/public/locales/en/product.json +23 -1
  7. package/app-template/public/locales/tr/account.json +3 -1
  8. package/app-template/public/locales/tr/product.json +22 -0
  9. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +20 -1
  10. package/app-template/src/app/[commerce]/[locale]/[currency]/basket/page.tsx +82 -9
  11. package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +1 -12
  12. package/app-template/src/app/api/virtual-try-on/limited-categories/route.ts +1 -0
  13. package/app-template/src/app/api/virtual-try-on/route.ts +1 -0
  14. package/app-template/src/assets/fonts/pz-icon.css +0 -3
  15. package/app-template/src/components/input.tsx +1 -2
  16. package/app-template/src/components/modal.tsx +2 -0
  17. package/app-template/src/components/select.tsx +1 -1
  18. package/app-template/src/plugins.js +6 -1
  19. package/app-template/src/settings.js +1 -6
  20. package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
  21. package/app-template/src/views/basket/basket-item.tsx +13 -16
  22. package/app-template/src/views/basket/summary.tsx +7 -10
  23. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +30 -17
  24. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
  25. package/app-template/src/views/guest-login/index.tsx +1 -6
  26. package/app-template/src/views/header/search/index.tsx +10 -1
  27. package/app-template/src/views/product/layout.tsx +15 -1
  28. package/app-template/src/views/product/product-info.tsx +8 -0
  29. package/commands/plugins.ts +14 -29
  30. package/dist/commands/plugins.js +14 -23
  31. package/package.json +1 -1
  32. package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/loading.tsx +0 -67
  33. package/app-template/src/views/basket/basket-content.tsx +0 -106
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.108.0-rc.87",
3
+ "version": "1.108.0-rc.9",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -24,24 +24,29 @@
24
24
  "test:middleware": "jest middleware-matcher.test.ts --bail"
25
25
  },
26
26
  "dependencies": {
27
- "@akinon/next": "1.108.0-rc.87",
28
- "@akinon/pz-akifast": "1.108.0-rc.87",
29
- "@akinon/pz-b2b": "1.108.0-rc.87",
30
- "@akinon/pz-basket-gift-pack": "1.108.0-rc.87",
31
- "@akinon/pz-bkm": "1.108.0-rc.87",
32
- "@akinon/pz-checkout-gift-pack": "1.108.0-rc.87",
33
- "@akinon/pz-click-collect": "1.108.0-rc.87",
34
- "@akinon/pz-credit-payment": "1.108.0-rc.87",
35
- "@akinon/pz-cybersource-uc": "1.108.0-rc.87",
36
- "@akinon/pz-gpay": "1.108.0-rc.87",
37
- "@akinon/pz-hepsipay": "1.108.0-rc.87",
38
- "@akinon/pz-masterpass": "1.108.0-rc.87",
39
- "@akinon/pz-one-click-checkout": "1.108.0-rc.87",
40
- "@akinon/pz-otp": "1.108.0-rc.87",
41
- "@akinon/pz-pay-on-delivery": "1.108.0-rc.87",
42
- "@akinon/pz-saved-card": "1.108.0-rc.87",
43
- "@akinon/pz-tabby-extension": "1.108.0-rc.87",
44
- "@akinon/pz-tamara-extension": "1.108.0-rc.87",
27
+ "@akinon/next": "1.108.0-rc.9",
28
+ "@akinon/pz-akifast": "1.108.0-rc.9",
29
+ "@akinon/pz-apple-pay": "1.108.0-rc.9",
30
+ "@akinon/pz-b2b": "1.108.0-rc.9",
31
+ "@akinon/pz-basket-gift-pack": "1.108.0-rc.9",
32
+ "@akinon/pz-bkm": "1.108.0-rc.9",
33
+ "@akinon/pz-checkout-gift-pack": "1.108.0-rc.9",
34
+ "@akinon/pz-click-collect": "1.108.0-rc.9",
35
+ "@akinon/pz-credit-payment": "1.108.0-rc.9",
36
+ "@akinon/pz-cybersource-uc": "1.108.0-rc.9",
37
+ "@akinon/pz-flow-payment": "1.108.0-rc.9",
38
+ "@akinon/pz-gpay": "1.108.0-rc.9",
39
+ "@akinon/pz-hepsipay": "1.108.0-rc.9",
40
+ "@akinon/pz-masterpass": "1.108.0-rc.9",
41
+ "@akinon/pz-multi-basket": "1.108.0-rc.9",
42
+ "@akinon/pz-one-click-checkout": "1.108.0-rc.9",
43
+ "@akinon/pz-otp": "1.108.0-rc.9",
44
+ "@akinon/pz-pay-on-delivery": "1.108.0-rc.9",
45
+ "@akinon/pz-saved-card": "1.108.0-rc.9",
46
+ "@akinon/pz-similar-products": "1.108.0-rc.9",
47
+ "@akinon/pz-tabby-extension": "1.108.0-rc.9",
48
+ "@akinon/pz-tamara-extension": "1.108.0-rc.9",
49
+ "@akinon/pz-virtual-try-on": "1.108.0-rc.9",
45
50
  "@hookform/resolvers": "2.9.0",
46
51
  "@next/third-parties": "14.1.0",
47
52
  "@react-google-maps/api": "2.17.1",
@@ -64,7 +69,7 @@
64
69
  "yup": "0.32.11"
65
70
  },
66
71
  "devDependencies": {
67
- "@akinon/eslint-plugin-projectzero": "1.108.0-rc.87",
72
+ "@akinon/eslint-plugin-projectzero": "1.108.0-rc.9",
68
73
  "@semantic-release/changelog": "6.0.2",
69
74
  "@semantic-release/exec": "6.0.3",
70
75
  "@semantic-release/git": "10.0.1",
@@ -92,7 +97,7 @@
92
97
  "jest-environment-jsdom": "29.7.0",
93
98
  "lint-staged": "13.1.0",
94
99
  "prettier": "2.6.2",
95
- "react-number-format": "5.4.3",
100
+ "react-number-format": "5.3.4",
96
101
  "sass": "1.49.9",
97
102
  "semantic-release": "19.0.5",
98
103
  "server-only": "0.0.1",
@@ -242,7 +242,9 @@
242
242
  "total": "Total",
243
243
  "items": "items",
244
244
  "packages": "Packages",
245
- "package_no": "Package no"
245
+ "package_no": "Package no",
246
+ "back_to_orders": "Back to Orders",
247
+ "no_orders_found": "No orders found"
246
248
  },
247
249
  "return": {
248
250
  "title": "Return Items",
@@ -32,8 +32,30 @@
32
32
  "installment": "Installment",
33
33
  "stock_alert": {
34
34
  "title": "Stock Alert",
35
- "success_description": "When your size is back in stock well send an email to: <Email/>",
35
+ "success_description": "When your size is back in stock we'll send an email to: <Email/>",
36
36
  "error_description": "An unexpected error has occured. Please try again later.",
37
37
  "close_button": "CLOSE"
38
+ },
39
+ "virtual_try_on": {
40
+ "title": "Virtual Try On",
41
+ "button_text": "Virtual Try On",
42
+ "loading": "Loading...",
43
+ "upload_title": "Upload Your Photo",
44
+ "upload_prompt": "Click to upload image",
45
+ "upload_requirements": "Max 1MB, JPEG/PNG/WebP only",
46
+ "instructions": "Upload a clear photo of yourself for the best virtual try-on experience. Make sure you are facing the camera directly.",
47
+ "try_on": "Try On",
48
+ "processing": "Processing...",
49
+ "processing_message": "Creating your virtual try-on...",
50
+ "result_title": "Virtual Try-On Result",
51
+ "result_placeholder": "Upload your photo to see the result",
52
+ "error": "Virtual try-on failed. Please try again.",
53
+ "feedback_prompt": "How did the virtual try-on work for you?",
54
+ "reset_crop": "Reset Crop",
55
+ "legal": {
56
+ "title": "Terms & Conditions",
57
+ "text": "By using this virtual try-on feature, you agree to our terms and conditions. Your image will be processed securely and not stored permanently. We use your photo only to generate the virtual try-on result.",
58
+ "accept": "I Accept & Continue"
59
+ }
38
60
  }
39
61
  }
@@ -242,7 +242,9 @@
242
242
  "total": "Toplam",
243
243
  "items": "adet",
244
244
  "packages": "paket",
245
- "package_no": "Paket no"
245
+ "package_no": "Paket no",
246
+ "back_to_orders": "Siparişlere geri dön",
247
+ "no_orders_found": "Sipariş bulunamadı"
246
248
  },
247
249
  "return": {
248
250
  "title": "İade Ürünleri",
@@ -35,5 +35,27 @@
35
35
  "success_description": "Bedeniniz stoklara tekrar girdiğinde şu adrese bir e-posta göndereceğiz: <Email/>",
36
36
  "error_description": "Beklenmeyen bir hata oluştu. Lütfen daha sonra tekrar deneyiniz.",
37
37
  "close_button": "KAPAT"
38
+ },
39
+ "virtual_try_on": {
40
+ "title": "Sanal Deneme",
41
+ "button_text": "Sanal Deneme",
42
+ "loading": "Yükleniyor...",
43
+ "upload_title": "Fotoğrafınızı Yükleyin",
44
+ "upload_prompt": "Resim yüklemek için tıklayın",
45
+ "upload_requirements": "Maks 1MB, sadece JPEG/PNG/WebP",
46
+ "instructions": "En iyi sanal deneme deneyimi için net bir fotoğrafınızı yükleyin. Kameraya doğrudan baktığınızdan emin olun.",
47
+ "try_on": "Dene",
48
+ "processing": "İşleniyor...",
49
+ "processing_message": "Sanal denemeniz oluşturuluyor...",
50
+ "result_title": "Sanal Deneme Sonucu",
51
+ "result_placeholder": "Sonucu görmek için fotoğrafınızı yükleyin",
52
+ "error": "Sanal deneme başarısız oldu. Lütfen tekrar deneyin.",
53
+ "feedback_prompt": "Sanal deneme sizin için nasıldı?",
54
+ "reset_crop": "Kırpma Sıfırla",
55
+ "legal": {
56
+ "title": "Şartlar ve Koşullar",
57
+ "text": "Bu sanal deneme özelliğini kullanarak şartlar ve koşullarımızı kabul etmiş olursunuz. Fotoğrafınız güvenli bir şekilde işlenecek ve kalıcı olarak saklanmayacaktır. Fotoğrafınızı yalnızca sanal deneme sonucunu oluşturmak için kullanırız.",
58
+ "accept": "Kabul Ediyorum & Devam Et"
59
+ }
38
60
  }
39
61
  }
@@ -61,7 +61,26 @@ const AccountOrderDetail = ({ params: { id } }) => {
61
61
  }, [order, isSuccess, localeValue]);
62
62
 
63
63
  if (isLoading && isFetching) {
64
- return <LoaderSpinner />;
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
+ );
65
84
  }
66
85
 
67
86
  return (
@@ -1,14 +1,87 @@
1
- import { BasketContent } from '@theme/views/basket/basket-content';
2
- import { getBasketData } from '@akinon/next/data/server/basket';
1
+ 'use client';
2
+
3
+ import { useEffect } from 'react';
4
+ import { ROUTES } from '@theme/routes';
5
+ import { useGetBasketQuery } from '@akinon/next/data/client/basket';
6
+ import { pushCartView } from '@theme/utils/gtm';
7
+ import { Button, LoaderSpinner, Link } from '@theme/components';
8
+ import { BasketItem, Summary } from '@theme/views/basket';
9
+ import { useLocalization } from '@akinon/next/hooks';
10
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
3
11
  import settings from '@theme/settings';
4
12
 
5
- export default async function Page() {
6
- const { basket } = await getBasketData();
13
+ export default function Page() {
14
+ const { data: basket, isLoading, isSuccess } = useGetBasketQuery();
15
+ const { t } = useLocalization();
16
+ const multiBasket = settings.plugins?.multiBasket ?? false;
17
+
18
+ useEffect(() => {
19
+ if (isSuccess) {
20
+ const products = basket.basketitem_set.map((basketItem) => ({
21
+ ...basketItem.product
22
+ }));
23
+ pushCartView(products);
24
+ }
25
+ }, [basket, isSuccess]);
26
+
27
+ return (
28
+ <div className="max-w-screen-xl p-4 flex flex-col text-primary-800 lg:p-8 xl:flex-row xl:mx-auto">
29
+ {isLoading && (
30
+ <div className="flex justify-center w-full">
31
+ <LoaderSpinner />
32
+ </div>
33
+ )}
34
+ {isSuccess &&
35
+ (basket && basket.basketitem_set && basket.basketitem_set.length > 0 ? (
36
+ <>
37
+ <div className="flex-1 xl:mr-16">
38
+ <div className="flex items-center justify-between py-2 border-b border-gray-200 lg:py-3">
39
+ <h2 className="text-xl lg:text-2xl font-light">
40
+ {t('basket.my_cart')}
41
+ </h2>
42
+ <Link
43
+ href={ROUTES.HOME}
44
+ className="text-xs hover:text-secondary-500"
45
+ >
46
+ {t('basket.back_to_shopping')}
47
+ </Link>
48
+ </div>
49
+ <ul>
50
+ {multiBasket ? (
51
+ <PluginModule
52
+ component={Component.MultiBasket}
53
+ props={{ BasketItem }}
54
+ />
55
+ ) : (
56
+ basket.basketitem_set.map((basketItem, index) => (
57
+ <BasketItem basketItem={basketItem} key={index} />
58
+ ))
59
+ )}
60
+ </ul>
61
+ </div>
62
+ <Summary basket={basket} />
63
+ </>
64
+ ) : (
65
+ <div className="flex flex-col items-center container max-w-screen-sm py-4 px-4 xs:py-6 xs:px-6 sm:py-8 sm:px-8 lg:max-w-screen-xl">
66
+ <h1
67
+ className="w-full text-xl font-light text-secondary text-center sm:text-2xl"
68
+ data-testid="basket-empty"
69
+ >
70
+ {t('basket.empty.title')}
71
+ </h1>
7
72
 
8
- const multiBasket: boolean =
9
- typeof settings.plugins?.multiBasket === 'boolean'
10
- ? settings.plugins.multiBasket
11
- : false;
73
+ <div className="w-full text-sm text-black-800 text-center my-4 mb-2 sm:text-base">
74
+ <p>{t('basket.empty.content_first')}</p>
75
+ <p>{t('basket.empty.content_second')}.</p>
76
+ </div>
12
77
 
13
- return <BasketContent initialBasket={basket} multiBasket={multiBasket} />;
78
+ <Link href={ROUTES.HOME} passHref>
79
+ <Button className="px-10 mt-2" appearance="filled">
80
+ {t('basket.empty.button')}
81
+ </Button>
82
+ </Link>
83
+ </div>
84
+ ))}
85
+ </div>
86
+ );
14
87
  }
@@ -1,20 +1,9 @@
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 { notFound } from 'next/navigation';
5
4
 
6
5
  async function Page({ params }: PageProps<{ pk: number }>) {
7
- let data;
8
-
9
- try {
10
- data = await getLandingPageData({ pk: params.pk });
11
- } catch (error) {
12
- return notFound();
13
- }
14
-
15
- if (!data || !data.landing_page) {
16
- return notFound();
17
- }
6
+ const data = await getLandingPageData({ pk: params.pk });
18
7
 
19
8
  const content = data.landing_page;
20
9
 
@@ -0,0 +1 @@
1
+ export * from '@akinon/next/api/virtual-try-on';
@@ -0,0 +1 @@
1
+ export * from '@akinon/next/api/virtual-try-on';
@@ -152,6 +152,3 @@ url("./pz-icon.svg?db4ba799c4ca72f4bb855458e0cd19ee#pz-icon") format("svg");
152
152
  .pz-icon-whatsapp:before {
153
153
  content: "\f12c";
154
154
  }
155
- .pz-icon-camera:before {
156
- content: "\f12d";
157
- }
@@ -78,8 +78,7 @@ export const Input = forwardRef<
78
78
  hasFloatingLabel,
79
79
  'mb-2': !hasFloatingLabel,
80
80
  '-translate-y-2 bg-white inline-flex h-auto':
81
- hasFloatingLabel &&
82
- (focused || hasValue || props.value || props.format)
81
+ hasFloatingLabel && (focused || hasValue)
83
82
  })
84
83
  )}
85
84
  >
@@ -41,12 +41,14 @@ 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()}
44
45
  />
45
46
  <section
46
47
  className={twMerge(
47
48
  'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
48
49
  className
49
50
  )}
51
+ onClick={(e) => e.stopPropagation()}
50
52
  >
51
53
  {(showCloseButton || title) && (
52
54
  <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 focus:border-primary',
52
52
  'appearance-none bg-transparent'
53
53
  ),
54
54
  className
@@ -1,4 +1,3 @@
1
- // we are holding all of the plugins because of the development enviroment.
2
1
  module.exports = [
3
2
  'pz-basket-gift-pack',
4
3
  'pz-click-collect',
@@ -12,9 +11,15 @@ module.exports = [
12
11
  'pz-masterpass',
13
12
  'pz-b2b',
14
13
  'pz-akifast',
14
+ 'pz-multi-basket',
15
15
  'pz-saved-card',
16
16
  'pz-tabby-extension',
17
+ 'pz-apple-pay',
17
18
  'pz-tamara-extension',
19
+ 'pz-hepsipay',
20
+ 'pz-flow-payment',
21
+ 'pz-virtual-try-on',
22
+ 'pz-similar-products',
18
23
  'pz-cybersource-uc',
19
24
  'pz-hepsipay'
20
25
  ];
@@ -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} */
@@ -18,7 +14,6 @@ module.exports = {
18
14
  { translationKey: 'size', key: 'size' }
19
15
  ],
20
16
  localization: {
21
- // If there is one locale in the locales array, the default locale will be hidden in the URL.
22
17
  locales: [
23
18
  {
24
19
  label: 'EN',
@@ -46,7 +41,7 @@ module.exports = {
46
41
  }
47
42
  ],
48
43
  defaultLocaleValue: 'en',
49
- localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale, // If there is one locale in the locales array, the default locale will be hidden in the URL and localeUrlStrategy should be set to LocaleUrlStrategy.ShowAllLocales.
44
+ localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale,
50
45
  redirectToDefaultLocale: true,
51
46
  defaultCurrencyCode: 'usd'
52
47
  },
@@ -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.number}
24
+ {order?.number}
25
25
  </span>
26
26
  </div>
27
27
 
@@ -3,7 +3,7 @@ import {
3
3
  useUpdateQuantityMutation
4
4
  } from '@akinon/next/data/client/basket';
5
5
  import { useAppDispatch } from '@akinon/next/redux/hooks';
6
- import { Basket, BasketItem as BasketItemType } from '@akinon/next/types';
6
+ import { BasketItem as BasketItemType } from '@akinon/next/types';
7
7
  import { Price, Button, Icon, Modal, Select, Link } from '@theme/components';
8
8
  import { useState } from 'react';
9
9
  import { useAddFavoriteMutation } from '@akinon/next/data/client/wishlist';
@@ -19,12 +19,11 @@ import { pushRemoveFromCart } from '@theme/utils/gtm';
19
19
  interface Props {
20
20
  basketItem?: BasketItemType;
21
21
  namespace?: string;
22
- onBasketUpdate?: (basket: Basket) => void;
23
22
  }
24
23
 
25
24
  export const BasketItem = (props: Props) => {
26
25
  const { t } = useLocalization();
27
- const { basketItem, namespace, onBasketUpdate } = props;
26
+ const { basketItem, namespace } = props;
28
27
  const [updateQuantityMutation] = useUpdateQuantityMutation();
29
28
  const dispatch = useAppDispatch();
30
29
  const [isRemoveBasketModalOpen, setRemoveBasketModalOpen] = useState(false);
@@ -55,21 +54,19 @@ export const BasketItem = (props: Props) => {
55
54
  requestParams.namespace = namespace;
56
55
  }
57
56
 
58
- try {
59
- const response = await updateQuantityMutation(requestParams).unwrap();
60
- dispatch(
61
- basketApi.util.updateQueryData(
62
- 'getBasket',
63
- undefined,
64
- (draftBasket) => {
65
- Object.assign(draftBasket, response.basket);
66
- }
57
+ await updateQuantityMutation(requestParams)
58
+ .unwrap()
59
+ .then((data) =>
60
+ dispatch(
61
+ basketApi.util.updateQueryData(
62
+ 'getBasket',
63
+ undefined,
64
+ (draftBasket) => {
65
+ Object.assign(draftBasket, data.basket);
66
+ }
67
+ )
67
68
  )
68
69
  );
69
- onBasketUpdate?.(response.basket);
70
- } catch (error) {
71
- console.error('Error updating quantity:', error);
72
- }
73
70
  };
74
71
 
75
72
  const deleteProduct = async (productPk?: number) => {
@@ -18,7 +18,6 @@ import clsx from 'clsx';
18
18
 
19
19
  interface Props {
20
20
  basket: Basket;
21
- onBasketUpdate?: (basket: Basket) => void;
22
21
  }
23
22
 
24
23
  const voucherCodeFormSchema = (t) =>
@@ -28,7 +27,7 @@ const voucherCodeFormSchema = (t) =>
28
27
 
29
28
  export const Summary = (props: Props) => {
30
29
  const { t } = useLocalization();
31
- const { basket, onBasketUpdate } = props;
30
+ const { basket } = props;
32
31
  const router = useRouter();
33
32
  const {
34
33
  register,
@@ -54,7 +53,7 @@ export const Summary = (props: Props) => {
54
53
  const removeVoucherCode = () => {
55
54
  removeVoucherCodeMutation()
56
55
  .unwrap()
57
- .then((basket) => {
56
+ .then((basket) =>
58
57
  dispatch(
59
58
  basketApi.util.updateQueryData(
60
59
  'getBasket',
@@ -63,9 +62,8 @@ export const Summary = (props: Props) => {
63
62
  Object.assign(draftBasket, basket);
64
63
  }
65
64
  )
66
- );
67
- onBasketUpdate?.(basket);
68
- })
65
+ )
66
+ )
69
67
  .catch((error: Error) => {
70
68
  setError('voucherCode', { message: error.data.non_field_errors });
71
69
  });
@@ -76,7 +74,7 @@ export const Summary = (props: Props) => {
76
74
  voucher_code: data.voucherCode
77
75
  })
78
76
  .unwrap()
79
- .then((basket) => {
77
+ .then((basket) =>
80
78
  dispatch(
81
79
  basketApi.util.updateQueryData(
82
80
  'getBasket',
@@ -85,9 +83,8 @@ export const Summary = (props: Props) => {
85
83
  Object.assign(draftBasket, basket);
86
84
  }
87
85
  )
88
- );
89
- onBasketUpdate?.(basket);
90
- })
86
+ )
87
+ )
91
88
  .catch((error: Error) => {
92
89
  setError('voucherCode', { message: error.data.non_field_errors });
93
90
  });
@@ -85,7 +85,7 @@ const AddressBox = ({
85
85
  };
86
86
 
87
87
  const onSubmit = (data) => {
88
- editAddress({ ...data, invalidateTag: 'Addresses' })
88
+ editAddress({ ...data, invalidateTag: 'Checkout' })
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: 'Addresses' });
99
+ await removeAddress({ id: addressPk, invalidateTag: 'Checkout' });
100
100
  setRemoveAddressModalOpen(false);
101
101
  dispatch(resetCheckoutState());
102
102
 
@@ -168,7 +168,10 @@ 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={() => setIsEditAddressModalOpen(true)}
171
+ onClick={(e) => {
172
+ e.stopPropagation();
173
+ setIsEditAddressModalOpen(true);
174
+ }}
172
175
  data-testid="checkout-address-edit"
173
176
  >
174
177
  {t('checkout.address.box.edit')}
@@ -180,21 +183,26 @@ const AddressBox = ({
180
183
  setOpen={setIsEditAddressModalOpen}
181
184
  className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
182
185
  >
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
- />
186
+ <div onClick={(e) => e.stopPropagation()}>
187
+ <AddressForm
188
+ data={{
189
+ ...address,
190
+ country: address.country?.pk,
191
+ city: address.city?.pk,
192
+ township: address.township?.pk,
193
+ district: address.district?.pk
194
+ }}
195
+ onSubmit={onSubmit}
196
+ />
197
+ </div>
193
198
  </Modal>
194
199
  <Button
195
200
  appearance="ghost"
196
201
  className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
197
- onClick={() => setRemoveAddressModalOpen(true)}
202
+ onClick={(e) => {
203
+ e.stopPropagation();
204
+ setRemoveAddressModalOpen(true);
205
+ }}
198
206
  data-testid="checkout-address-remove"
199
207
  >
200
208
  {t('checkout.address.box.remove')}
@@ -207,14 +215,18 @@ const AddressBox = ({
207
215
  setOpen={setRemoveAddressModalOpen}
208
216
  showCloseButton={false}
209
217
  >
210
- <div className="text-center px-6 py-10">
218
+ <div
219
+ className="text-center px-6 py-10"
220
+ onClick={(e) => e.stopPropagation()}
221
+ >
211
222
  <p className="mb-4">
212
223
  {t('account.address_book.modal.delete_description')}
213
224
  </p>
214
225
  <div className="space-x-3 flex justify-center">
215
226
  <Button
216
227
  appearance="outlined"
217
- onClick={() => {
228
+ onClick={(e) => {
229
+ e.stopPropagation();
218
230
  setRemoveAddressModalOpen(false);
219
231
  }}
220
232
  data-testid="remove-address-modal-cancel"
@@ -224,7 +236,8 @@ const AddressBox = ({
224
236
  <Button
225
237
  appearance="filled"
226
238
  disabled={removeAddressLoading}
227
- onClick={() => {
239
+ onClick={(e) => {
240
+ e.stopPropagation();
228
241
  handleRemoveAddress(address.pk);
229
242
  }}
230
243
  className={
@@ -77,7 +77,7 @@ const Addresses = () => {
77
77
  }, [billing_and_shipping_same]);
78
78
 
79
79
  const onSubmit = (data) => {
80
- addAddress({ ...data, invalidateTag: 'Addresses' })
80
+ addAddress({ ...data, invalidateTag: 'Checkout' })
81
81
  .unwrap()
82
82
  .then((addAddressResponse) => {
83
83
  if (addressList.length === 0) {
@@ -51,14 +51,9 @@ const GuestLogin = () => {
51
51
  ).unwrap();
52
52
 
53
53
  Object.keys(response?.errors || {}).forEach((key) => {
54
- const errorValue = response?.errors[key];
55
- const message = Array.isArray(errorValue)
56
- ? errorValue.join(', ')
57
- : errorValue || '';
58
-
59
54
  setError(key as keyof GuestLoginFormParams, {
60
55
  type: 'custom',
61
- message
56
+ message: response?.errors[key]?.join(', ')
62
57
  });
63
58
  });
64
59
  } catch (error) {