@akinon/projectzero 1.104.0 → 1.105.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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.105.0
4
+
3
5
  ## 1.104.0
4
6
 
5
7
  ## 1.103.0
@@ -1,5 +1,34 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.105.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c39c700: ZERO-3420: Refactor Modal component
8
+ - 3b255fe: ZERO-3629 :edit warnings in build
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [c39c700]
13
+ - Updated dependencies [d512ea2]
14
+ - Updated dependencies [3b255fe]
15
+ - @akinon/next@1.105.0
16
+ - @akinon/pz-akifast@1.105.0
17
+ - @akinon/pz-b2b@1.105.0
18
+ - @akinon/pz-basket-gift-pack@1.105.0
19
+ - @akinon/pz-bkm@1.105.0
20
+ - @akinon/pz-checkout-gift-pack@1.105.0
21
+ - @akinon/pz-click-collect@1.105.0
22
+ - @akinon/pz-credit-payment@1.105.0
23
+ - @akinon/pz-gpay@1.105.0
24
+ - @akinon/pz-masterpass@1.105.0
25
+ - @akinon/pz-one-click-checkout@1.105.0
26
+ - @akinon/pz-otp@1.105.0
27
+ - @akinon/pz-pay-on-delivery@1.105.0
28
+ - @akinon/pz-saved-card@1.105.0
29
+ - @akinon/pz-tabby-extension@1.105.0
30
+ - @akinon/pz-tamara-extension@1.105.0
31
+
3
32
  ## 1.104.0
4
33
 
5
34
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.104.0",
3
+ "version": "1.105.0",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -24,22 +24,22 @@
24
24
  "test:middleware": "jest middleware-matcher.test.ts --bail"
25
25
  },
26
26
  "dependencies": {
27
- "@akinon/next": "1.104.0",
28
- "@akinon/pz-akifast": "1.104.0",
29
- "@akinon/pz-b2b": "1.104.0",
30
- "@akinon/pz-basket-gift-pack": "1.104.0",
31
- "@akinon/pz-bkm": "1.104.0",
32
- "@akinon/pz-checkout-gift-pack": "1.104.0",
33
- "@akinon/pz-click-collect": "1.104.0",
34
- "@akinon/pz-credit-payment": "1.104.0",
35
- "@akinon/pz-gpay": "1.104.0",
36
- "@akinon/pz-masterpass": "1.104.0",
37
- "@akinon/pz-one-click-checkout": "1.104.0",
38
- "@akinon/pz-otp": "1.104.0",
39
- "@akinon/pz-pay-on-delivery": "1.104.0",
40
- "@akinon/pz-saved-card": "1.104.0",
41
- "@akinon/pz-tabby-extension": "1.104.0",
42
- "@akinon/pz-tamara-extension": "1.104.0",
27
+ "@akinon/next": "1.105.0",
28
+ "@akinon/pz-akifast": "1.105.0",
29
+ "@akinon/pz-b2b": "1.105.0",
30
+ "@akinon/pz-basket-gift-pack": "1.105.0",
31
+ "@akinon/pz-bkm": "1.105.0",
32
+ "@akinon/pz-checkout-gift-pack": "1.105.0",
33
+ "@akinon/pz-click-collect": "1.105.0",
34
+ "@akinon/pz-credit-payment": "1.105.0",
35
+ "@akinon/pz-gpay": "1.105.0",
36
+ "@akinon/pz-masterpass": "1.105.0",
37
+ "@akinon/pz-one-click-checkout": "1.105.0",
38
+ "@akinon/pz-otp": "1.105.0",
39
+ "@akinon/pz-pay-on-delivery": "1.105.0",
40
+ "@akinon/pz-saved-card": "1.105.0",
41
+ "@akinon/pz-tabby-extension": "1.105.0",
42
+ "@akinon/pz-tamara-extension": "1.105.0",
43
43
  "@hookform/resolvers": "2.9.0",
44
44
  "@next/third-parties": "14.1.0",
45
45
  "@react-google-maps/api": "2.17.1",
@@ -62,7 +62,7 @@
62
62
  "yup": "0.32.11"
63
63
  },
64
64
  "devDependencies": {
65
- "@akinon/eslint-plugin-projectzero": "1.104.0",
65
+ "@akinon/eslint-plugin-projectzero": "1.105.0",
66
66
  "@semantic-release/changelog": "6.0.2",
67
67
  "@semantic-release/exec": "6.0.3",
68
68
  "@semantic-release/git": "10.0.1",
@@ -30,6 +30,8 @@ describe('Link Component', () => {
30
30
  wrapper = container;
31
31
  });
32
32
 
33
+ wrapper;
34
+
33
35
  it('should render without error', () => {
34
36
  const link = screen.getByRole('link');
35
37
 
@@ -48,7 +48,13 @@ export const Input = forwardRef<
48
48
  props.className
49
49
  );
50
50
 
51
- const inputProps: any = {
51
+ const inputProps: {
52
+ id?: string;
53
+ ref?: Ref<HTMLInputElement>;
54
+ className?: string;
55
+ onFocus?: () => void;
56
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
57
+ } = {
52
58
  id,
53
59
  ref,
54
60
  className: inputClass,
@@ -4,16 +4,7 @@ import ReactPortal from './react-portal';
4
4
  import { Icon } from './icon';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { useEffect } from 'react';
7
-
8
- export interface ModalProps {
9
- portalId: string;
10
- children?: React.ReactNode;
11
- open?: boolean;
12
- setOpen?: (open: boolean) => void;
13
- title?: React.ReactNode;
14
- showCloseButton?: React.ReactNode;
15
- className?: string;
16
- }
7
+ import { ModalProps } from '@theme/types';
17
8
 
18
9
  export const Modal = (props: ModalProps) => {
19
10
  const {
@@ -23,7 +14,14 @@ export const Modal = (props: ModalProps) => {
23
14
  setOpen,
24
15
  title = '',
25
16
  showCloseButton = true,
26
- className
17
+ className,
18
+ overlayClassName,
19
+ headerWrapperClassName,
20
+ titleClassName,
21
+ closeButtonClassName,
22
+ iconName = 'close',
23
+ iconSize = 16,
24
+ iconClassName
27
25
  } = props;
28
26
 
29
27
  useEffect(() => {
@@ -38,7 +36,12 @@ export const Modal = (props: ModalProps) => {
38
36
 
39
37
  return (
40
38
  <ReactPortal wrapperId={portalId}>
41
- <div className="fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50" />
39
+ <div
40
+ className={twMerge(
41
+ 'fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50',
42
+ overlayClassName
43
+ )}
44
+ />
42
45
  <section
43
46
  className={twMerge(
44
47
  'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
@@ -46,15 +49,28 @@ export const Modal = (props: ModalProps) => {
46
49
  )}
47
50
  >
48
51
  {(showCloseButton || title) && (
49
- <div className="flex px-6 py-4 border-b border-gray-400">
50
- {title && <h3 className="text-lg font-light">{title}</h3>}
52
+ <div
53
+ className={twMerge(
54
+ 'flex px-6 py-4 border-b border-gray-400',
55
+ headerWrapperClassName
56
+ )}
57
+ >
58
+ {title && (
59
+ <h3 className={twMerge('text-lg font-light', titleClassName)}>
60
+ {title}
61
+ </h3>
62
+ )}
51
63
  {showCloseButton && (
52
64
  <button
53
65
  type="button"
54
66
  onClick={() => setOpen(false)}
55
- className="ml-auto"
67
+ className={twMerge('ml-auto', closeButtonClassName)}
56
68
  >
57
- <Icon name="close" size={16} />
69
+ <Icon
70
+ name={iconName}
71
+ size={iconSize}
72
+ className={iconClassName}
73
+ />
58
74
  </button>
59
75
  )}
60
76
  </div>
@@ -125,6 +125,7 @@ export const Pagination = (props: PaginationProps) => {
125
125
  setPrevPage(1);
126
126
  setNextPage(1);
127
127
  }
128
+ // eslint-disable-next-line react-hooks/exhaustive-deps
128
129
  }, [page]);
129
130
 
130
131
  useEffect(() => {
@@ -14,14 +14,18 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
14
14
  error,
15
15
  label,
16
16
  required = false,
17
+ labelClassName,
17
18
  ...rest
18
19
  } = props;
19
20
 
20
21
  return (
21
22
  <label
22
- className={clsx('flex flex-col relative text-xs text-gray-800', {
23
- 'pl-7': icon
24
- })}
23
+ className={twMerge(
24
+ clsx('flex flex-col relative text-xs text-gray-800', {
25
+ 'pl-7': icon
26
+ }),
27
+ labelClassName
28
+ )}
25
29
  >
26
30
  {icon && (
27
31
  <Icon
@@ -32,32 +36,40 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
32
36
  )}
33
37
 
34
38
  {label && (
35
- <span className="mb-1">
39
+ <span className={twMerge('mb-1', labelClassName)}>
36
40
  {label} {required && <span className="text-secondary">*</span>}
37
41
  </span>
38
42
  )}
39
- <select
40
- {...rest}
41
- ref={ref}
42
- className={twMerge(
43
- clsx(
44
- 'cursor-pointer truncate h-10 w-40 px-2.5 shrink-0 outline-none',
45
- !borderless &&
46
- 'border border-gray-200 transition-all duration-150 hover:border-primary'
47
- ),
48
- className
49
- )}
50
- >
51
- {options?.map((option) => (
52
- <option
53
- key={option.value}
54
- value={option.value}
55
- className={option.class}
56
- >
57
- {option.label}
58
- </option>
59
- ))}
60
- </select>
43
+ <div className="relative">
44
+ <select
45
+ {...rest}
46
+ ref={ref}
47
+ className={twMerge(
48
+ clsx(
49
+ 'cursor-pointer truncate h-10 w-40 px-2.5 shrink-0 outline-none',
50
+ !borderless &&
51
+ 'border border-gray-200 transition-all duration-150 hover:border-primary',
52
+ 'appearance-none bg-transparent'
53
+ ),
54
+ className
55
+ )}
56
+ >
57
+ {options?.map((option) => (
58
+ <option
59
+ key={option.value}
60
+ value={option.value}
61
+ className={option.class}
62
+ >
63
+ {option.label}
64
+ </option>
65
+ ))}
66
+ </select>
67
+ <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
68
+ <svg className="h-4 w-4 fill-current" viewBox="0 0 20 20">
69
+ <path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
70
+ </svg>
71
+ </div>
72
+ </div>
61
73
  {error && (
62
74
  <span className="mt-1 text-sm text-error">{error.message}</span>
63
75
  )}
@@ -58,6 +58,7 @@ export interface SelectProps extends React.HTMLProps<HTMLSelectElement> {
58
58
  iconSize?: number;
59
59
  error?: FieldError | undefined;
60
60
  required?: boolean;
61
+ labelClassName?: string;
61
62
  }
62
63
  export interface IconProps extends React.ComponentPropsWithRef<'i'> {
63
64
  name: string;
@@ -14,5 +14,6 @@ module.exports = [
14
14
  'pz-akifast',
15
15
  'pz-saved-card',
16
16
  'pz-tabby-extension',
17
- 'pz-tamara-extension'
17
+ 'pz-tamara-extension',
18
+ 'pz-hepsipay'
18
19
  ];
@@ -125,3 +125,20 @@ export interface SeoProps {
125
125
  ogPriceAmount?: string;
126
126
  ogPriceCurrency?: string;
127
127
  }
128
+
129
+ export interface ModalProps {
130
+ portalId: string;
131
+ children?: React.ReactNode;
132
+ open?: boolean;
133
+ setOpen?: (open: boolean) => void;
134
+ title?: React.ReactNode;
135
+ showCloseButton?: React.ReactNode;
136
+ className?: string;
137
+ overlayClassName?: string;
138
+ headerWrapperClassName?: string;
139
+ titleClassName?: string;
140
+ closeButtonClassName?: string;
141
+ iconName?: string;
142
+ iconSize?: number;
143
+ iconClassName?: string;
144
+ }
@@ -259,23 +259,25 @@ export const AddressForm = (props: Props) => {
259
259
  {/* TODO: Fix select and textarea components */}
260
260
 
261
261
  <Select
262
- className="w-full border-gray-500 text-sm mt-2"
262
+ className="w-full border-gray-500 text-sm"
263
263
  options={countryOptions}
264
264
  {...register('country')}
265
265
  error={errors.country}
266
266
  data-testid="address-form-country"
267
267
  label={t('account.address_book.form.country.title')}
268
+ labelClassName="mb-3"
268
269
  required
269
270
  />
270
271
 
271
272
  {city && (
272
273
  <Select
273
- className="w-full border-gray-500 text-sm mt-2"
274
+ className="w-full border-gray-500 text-sm"
274
275
  options={cityOptions}
275
276
  {...register('city')}
276
277
  error={errors.city}
277
278
  data-testid="address-form-city"
278
279
  label={t('account.address_book.form.province.title')}
280
+ labelClassName="mb-3"
279
281
  required
280
282
  />
281
283
  )}
@@ -283,24 +285,26 @@ export const AddressForm = (props: Props) => {
283
285
  <div className="flex gap-4">
284
286
  <div className="flex-1">
285
287
  <Select
286
- className="w-full border-gray-500 text-sm mt-2"
288
+ className="w-full border-gray-500 text-sm"
287
289
  options={townshipOptions}
288
290
  {...register('township')}
289
291
  error={errors.township}
290
292
  data-testid="address-form-township"
291
293
  label={t('account.address_book.form.township.title')}
294
+ labelClassName="mb-3"
292
295
  required
293
296
  />
294
297
  </div>
295
298
  {district && (
296
299
  <div className="flex-1">
297
300
  <Select
298
- className="w-full border-gray-500 text-sm mt-2"
301
+ className="w-full border-gray-500 text-sm"
299
302
  options={districtOptions}
300
303
  {...register('district')}
301
304
  error={errors.district}
302
305
  data-testid="address-form-district"
303
306
  label={t('account.address_book.form.district.title')}
307
+ labelClassName="mb-3"
304
308
  required
305
309
  />
306
310
  </div>
@@ -111,7 +111,7 @@ const ContactForm = () => {
111
111
  resolver: yupResolver(contactFormSchema(t))
112
112
  });
113
113
 
114
- const onSubmit: SubmitHandler<ContactFormType> = (data, event) => {
114
+ const onSubmit: SubmitHandler<ContactFormType> = (data) => {
115
115
  const formData = new FormData();
116
116
 
117
117
  Object.keys(data ?? {}).forEach((key) => {
@@ -31,13 +31,13 @@ export const ContentHeader = (props: Props) => {
31
31
  </h3>
32
32
  <Select
33
33
  onChange={handleChange}
34
- className="w-full mb-4 md:mb-0 md:w-56 md:mr-4 text-xs"
34
+ className="w-full mb-4 md:mb-0 md:w-56 text-xs"
35
35
  options={orders}
36
36
  data-testid="account-orders-header-select"
37
37
  ></Select>
38
38
  <Button
39
39
  className={clsx(
40
- 'w-full md:w-56',
40
+ 'w-full md:w-56 md:ms-4',
41
41
  isButtonDisabled &&
42
42
  'hover:bg-black hover:text-white disabled:opacity-75'
43
43
  )}
@@ -3,6 +3,7 @@
3
3
  import { Accordion, LoaderSpinner, TabPanel, Tabs } from '@theme/components';
4
4
  import React from 'react';
5
5
  import { useGetWidgetQuery } from '@akinon/next/data/client/misc';
6
+ import { useLocalization } from '@akinon/next/hooks';
6
7
 
7
8
  interface Props {
8
9
  searchKey?: string;
@@ -11,6 +12,7 @@ interface Props {
11
12
  export function FaqTabs(props: Props) {
12
13
  const { searchKey } = props;
13
14
  const { data, isLoading } = useGetWidgetQuery('faq');
15
+ const { locale } = useLocalization();
14
16
 
15
17
  if (isLoading) {
16
18
  return <LoaderSpinner className="mt-4" />;
@@ -29,8 +31,12 @@ export function FaqTabs(props: Props) {
29
31
  {data?.attributes?.faq_contents
30
32
  ?.filter(
31
33
  (faq) =>
32
- faq.value.content.toLocaleLowerCase().includes(searchKey) ||
33
- faq.value.title.toLocaleLowerCase().includes(searchKey)
34
+ faq.value.content
35
+ .toLocaleLowerCase(locale)
36
+ .includes(searchKey) ||
37
+ faq.value.title
38
+ .toLocaleLowerCase(locale)
39
+ .includes(searchKey)
34
40
  )
35
41
  .map((faq, index) => {
36
42
  if (faq.value.category == item.value.category_id) {
@@ -39,7 +39,12 @@ export const BasketItem = (props: Props) => {
39
39
  quantity: number,
40
40
  attributes: object = {}
41
41
  ) => {
42
- const requestParams: any = {
42
+ const requestParams: {
43
+ product: number;
44
+ quantity: number;
45
+ attributes: object;
46
+ namespace?: string;
47
+ } = {
43
48
  product: productPk,
44
49
  quantity,
45
50
  attributes
@@ -12,7 +12,7 @@ export interface BreadcrumbProps {
12
12
  }
13
13
 
14
14
  export default function Breadcrumb(props: BreadcrumbProps) {
15
- const { t } = useLocalization();
15
+ const { t, locale } = useLocalization();
16
16
  const { breadcrumbList = [] } = props;
17
17
 
18
18
  const list = [
@@ -28,7 +28,7 @@ export default function Breadcrumb(props: BreadcrumbProps) {
28
28
  {list.map((item, index) => (
29
29
  <Fragment key={index}>
30
30
  <Link href={item.url}>
31
- {capitalize(item.text.toLocaleLowerCase())}
31
+ {capitalize(item.text.toLocaleLowerCase(locale))}
32
32
  </Link>
33
33
  {index !== list.length - 1 && <Icon name="chevron-end" size={8} />}
34
34
  </Fragment>
@@ -57,6 +57,7 @@ export default function ListPage(props: ListPageProps) {
57
57
  newUrl.searchParams.delete('page');
58
58
  router.push(newUrl.pathname + newUrl.search, undefined);
59
59
  }
60
+ // eslint-disable-next-line react-hooks/exhaustive-deps
60
61
  }, [searchParams, data.products, page]);
61
62
 
62
63
  const { t } = useLocalization();
@@ -6,7 +6,7 @@ import { useLocalization } from '@akinon/next/hooks';
6
6
  import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
7
7
  import { resetSelectedFacets } from '@theme/redux/reducers/category';
8
8
  import CategoryActiveFilters from '@theme/views/category/category-active-filters';
9
- import { useMemo, useState, useTransition } from 'react';
9
+ import { useMemo, useTransition } from 'react';
10
10
  import { FilterItem } from './filter-item';
11
11
 
12
12
  interface Props {
@@ -41,6 +41,7 @@ export default function ProductInfo({ data }: ProductPageProps) {
41
41
  if (isVariantLoading) {
42
42
  setProductError(null);
43
43
  }
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44
45
  }, [isVariantLoading]);
45
46
 
46
47
  useEffect(() => {
@@ -2,6 +2,7 @@ import 'server-only';
2
2
 
3
3
  import { Link, Accordion } from '@theme/components';
4
4
  import { getWidgetData } from '@akinon/next/data/server';
5
+ import { ServerVariables } from '@akinon/next/utils/server-variables';
5
6
 
6
7
  type SideItem = {
7
8
  value: string;
@@ -47,6 +48,7 @@ type FooterMenuType = {
47
48
 
48
49
  export default async function FooterMenu() {
49
50
  const data = await getWidgetData<FooterMenuType>({ slug: 'footer-menu' });
51
+ const { locale } = ServerVariables;
50
52
 
51
53
  return (
52
54
  <div className="flex-1">
@@ -72,7 +74,7 @@ export default async function FooterMenu() {
72
74
  : '_self'
73
75
  }
74
76
  data-testid={`footer-categories-${item?.value?.name
75
- ?.toLocaleLowerCase()
77
+ ?.toLocaleLowerCase(locale)
76
78
  .split(' ')
77
79
  .join('')}`}
78
80
  >
@@ -96,7 +98,9 @@ export default async function FooterMenu() {
96
98
  ? '_blank'
97
99
  : '_self'
98
100
  }
99
- data-testid={`footer-categories-${item?.value?.name?.toLocaleLowerCase()}`}
101
+ data-testid={`footer-categories-${item?.value?.name?.toLocaleLowerCase(
102
+ locale
103
+ )}`}
100
104
  >
101
105
  {item?.value?.name}
102
106
  </Link>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.104.0",
3
+ "version": "1.105.0",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {