@akinon/projectzero 1.64.0 → 1.66.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,9 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.66.0
4
+
5
+ ## 1.65.0
6
+
3
7
  ## 1.64.0
4
8
 
5
9
  ## 1.63.0
@@ -1,5 +1,67 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.66.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
8
+ - 2e6104d: ZERO-2888:Edit the numbering in the pagination and the visibility of the prev and next buttons
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [572d2e8]
13
+ - Updated dependencies [2e6104d]
14
+ - Updated dependencies [7b05522]
15
+ - Updated dependencies [29ead87]
16
+ - Updated dependencies [12a873e]
17
+ - Updated dependencies [f2c325c]
18
+ - @akinon/next@1.66.0
19
+ - @akinon/pz-otp@1.66.0
20
+ - @akinon/pz-akifast@1.66.0
21
+ - @akinon/pz-b2b@1.66.0
22
+ - @akinon/pz-basket-gift-pack@1.66.0
23
+ - @akinon/pz-bkm@1.66.0
24
+ - @akinon/pz-checkout-gift-pack@1.66.0
25
+ - @akinon/pz-click-collect@1.66.0
26
+ - @akinon/pz-credit-payment@1.66.0
27
+ - @akinon/pz-gpay@1.66.0
28
+ - @akinon/pz-masterpass@1.66.0
29
+ - @akinon/pz-one-click-checkout@1.66.0
30
+ - @akinon/pz-pay-on-delivery@1.66.0
31
+ - @akinon/pz-saved-card@1.66.0
32
+ - @akinon/pz-tabby-extension@1.66.0
33
+
34
+ ## 1.65.0
35
+
36
+ ### Minor Changes
37
+
38
+ - 5a4c607: ZERO-2764: Add case-warning rule to eslint-plugin-projectzero
39
+ - 74a1269: ZERO-2658:Edit product name clickability on completed order page
40
+ - d13fd36: ZERO-2614: Refactor Price component to remove unnecessary code and improve readability also fix the decimal scale
41
+ - 902d828: ZERO-2621:edit position of loaderSpinner in favorites page
42
+ - 4614eee: ZERO-2602: The script that checks the build for standalone projects
43
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [d13fd36]
48
+ - Updated dependencies [86d2531]
49
+ - @akinon/next@1.65.0
50
+ - @akinon/pz-akifast@1.65.0
51
+ - @akinon/pz-b2b@1.65.0
52
+ - @akinon/pz-basket-gift-pack@1.65.0
53
+ - @akinon/pz-bkm@1.65.0
54
+ - @akinon/pz-checkout-gift-pack@1.65.0
55
+ - @akinon/pz-click-collect@1.65.0
56
+ - @akinon/pz-credit-payment@1.65.0
57
+ - @akinon/pz-gpay@1.65.0
58
+ - @akinon/pz-masterpass@1.65.0
59
+ - @akinon/pz-one-click-checkout@1.65.0
60
+ - @akinon/pz-otp@1.65.0
61
+ - @akinon/pz-pay-on-delivery@1.65.0
62
+ - @akinon/pz-saved-card@1.65.0
63
+ - @akinon/pz-tabby-extension@1.65.0
64
+
3
65
  ## 1.64.0
4
66
 
5
67
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.64.0",
3
+ "version": "1.66.0",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,27 +22,26 @@
22
22
  "prestart": "pz-prestart"
23
23
  },
24
24
  "dependencies": {
25
- "@akinon/next": "1.64.0",
26
- "@akinon/pz-akifast": "1.64.0",
27
- "@akinon/pz-b2b": "1.64.0",
28
- "@akinon/pz-basket-gift-pack": "1.64.0",
29
- "@akinon/pz-bkm": "1.64.0",
30
- "@akinon/pz-checkout-gift-pack": "1.64.0",
31
- "@akinon/pz-click-collect": "1.64.0",
32
- "@akinon/pz-credit-payment": "1.64.0",
33
- "@akinon/pz-gpay": "1.64.0",
34
- "@akinon/pz-masterpass": "1.64.0",
35
- "@akinon/pz-one-click-checkout": "1.64.0",
36
- "@akinon/pz-otp": "1.64.0",
37
- "@akinon/pz-pay-on-delivery": "1.64.0",
38
- "@akinon/pz-saved-card": "1.64.0",
39
- "@akinon/pz-tabby-extension": "1.64.0",
25
+ "@akinon/next": "1.66.0",
26
+ "@akinon/pz-akifast": "1.66.0",
27
+ "@akinon/pz-b2b": "1.66.0",
28
+ "@akinon/pz-basket-gift-pack": "1.66.0",
29
+ "@akinon/pz-bkm": "1.66.0",
30
+ "@akinon/pz-checkout-gift-pack": "1.66.0",
31
+ "@akinon/pz-click-collect": "1.66.0",
32
+ "@akinon/pz-credit-payment": "1.66.0",
33
+ "@akinon/pz-gpay": "1.66.0",
34
+ "@akinon/pz-masterpass": "1.66.0",
35
+ "@akinon/pz-one-click-checkout": "1.66.0",
36
+ "@akinon/pz-otp": "1.66.0",
37
+ "@akinon/pz-pay-on-delivery": "1.66.0",
38
+ "@akinon/pz-saved-card": "1.66.0",
39
+ "@akinon/pz-tabby-extension": "1.66.0",
40
40
  "@hookform/resolvers": "2.9.0",
41
41
  "@next/third-parties": "14.1.0",
42
42
  "@react-google-maps/api": "2.17.1",
43
43
  "@sentry/nextjs": "7.116.0",
44
44
  "dayjs": "1.11.5",
45
- "eslint-config-next": "14.2.2",
46
45
  "lossless-json": "2.0.5",
47
46
  "next": "14.2.5",
48
47
  "next-auth": "4.24.5",
@@ -61,7 +60,7 @@
61
60
  "yup": "0.32.11"
62
61
  },
63
62
  "devDependencies": {
64
- "@akinon/eslint-plugin-projectzero": "1.64.0",
63
+ "@akinon/eslint-plugin-projectzero": "1.66.0",
65
64
  "@semantic-release/changelog": "6.0.2",
66
65
  "@semantic-release/exec": "6.0.3",
67
66
  "@semantic-release/git": "10.0.1",
@@ -81,7 +80,7 @@
81
80
  "clsx": "1.1.1",
82
81
  "currency-symbol-map": "5.1.0",
83
82
  "eslint": "8.14.0",
84
- "eslint-config-next": "14.0.3",
83
+ "eslint-config-next": "14.2.3",
85
84
  "eslint-config-prettier": "8.5.0",
86
85
  "husky": "8.0.0",
87
86
  "jest": "29.7.0",
@@ -182,21 +182,25 @@ const CheckoutCompleted = ({
182
182
  }}
183
183
  >
184
184
  {data.order.orderitem_set.map((item) => (
185
- <div key={`order-item-${item.id}`} className="flex">
186
- <Link href={item.product.absolute_url} passHref>
185
+ <div
186
+ key={`order-item-${item.id}`}
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
+ >
187
194
  <Image
188
195
  src={item.product.image}
189
196
  alt={item.product.name}
190
197
  width={64}
191
198
  height={96}
192
199
  />
200
+
201
+ <span>{item.product.name}</span>
193
202
  </Link>
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
- </>
203
+ <div className="flex justify-end items-center">
200
204
  <div>
201
205
  {item.retail_price !== item.price && (
202
206
  <div className="text-black-800 line-through text-xs min-w-max sm:text-sm">
@@ -1,8 +1,8 @@
1
- import { MouseEvent, useCallback, useEffect, useState } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  import { PaginationProps } from '@theme/components/types';
3
3
  import { twMerge } from 'tailwind-merge';
4
4
  import clsx from 'clsx';
5
- import { Link, Button } from '@theme/components';
5
+ import { Button } from '@theme/components';
6
6
  import usePagination from '@akinon/next/hooks/use-pagination';
7
7
  import { useLocalization } from '@akinon/next/hooks';
8
8
  import { useRouter } from '@akinon/next/hooks';
@@ -92,9 +92,7 @@ export const Pagination = (props: PaginationProps) => {
92
92
  }
93
93
  }, [numberOfPages, page, pageList, threshold]);
94
94
 
95
- const handleClick = (e: MouseEvent<HTMLAnchorElement>, url: string) => {
96
- e.preventDefault();
97
-
95
+ const handleClick = (url: string) => {
98
96
  const newUrl = new URL(url, window.location.origin);
99
97
  const page = newUrl.searchParams.get('page');
100
98
 
@@ -129,7 +127,7 @@ export const Pagination = (props: PaginationProps) => {
129
127
  if (type === 'list') {
130
128
  createListItems();
131
129
  }
132
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
130
+ }, [createListItems, type]);
133
131
 
134
132
  useEffect(() => {
135
133
  if (total && total !== paginationTotal) {
@@ -200,9 +198,8 @@ export const Pagination = (props: PaginationProps) => {
200
198
  >
201
199
  {prev && currentPage !== 1 && (
202
200
  <li>
203
- <Link
204
- onClick={(e) => handleClick(e, prev)}
205
- href={prev}
201
+ <button
202
+ onClick={() => handleClick(prev)}
206
203
  className={twMerge(
207
204
  'flex cursor-pointer text-sm px-2',
208
205
  prevClassName
@@ -212,16 +209,15 @@ export const Pagination = (props: PaginationProps) => {
212
209
  <span className="hidden lg:inline-block ms-4">
213
210
  {t('category.pagination.previous')}
214
211
  </span>
215
- </Link>
212
+ </button>
216
213
  </li>
217
214
  )}
218
215
 
219
216
  {paginationItems.map((item, i) => (
220
217
  <li key={i}>
221
218
  {item?.url != '#' ? (
222
- <Link
223
- onClick={(e) => handleClick(e, item.url)}
224
- href={item.url}
219
+ <button
220
+ onClick={() => handleClick(item.url)}
225
221
  className={twMerge(
226
222
  clsx(
227
223
  'text-xs px-2 cursor-pointer',
@@ -234,7 +230,7 @@ export const Pagination = (props: PaginationProps) => {
234
230
  )}
235
231
  >
236
232
  {item?.page}
237
- </Link>
233
+ </button>
238
234
  ) : (
239
235
  <span className="cursor-default text-xs flex items-center justify-center">
240
236
  {item?.page}
@@ -245,9 +241,8 @@ export const Pagination = (props: PaginationProps) => {
245
241
 
246
242
  {showNext && (
247
243
  <li>
248
- <Link
249
- onClick={(e) => handleClick(e, next)}
250
- href={next}
244
+ <button
245
+ onClick={() => handleClick(next)}
251
246
  className={twMerge(
252
247
  'flex cursor-pointer text-xs px-2',
253
248
  nextClassName
@@ -257,7 +252,7 @@ export const Pagination = (props: PaginationProps) => {
257
252
  {t('category.pagination.next')}
258
253
  </span>
259
254
  <span>&gt;</span>
260
- </Link>
255
+ </button>
261
256
  </li>
262
257
  )}
263
258
  </ul>
@@ -1,8 +1,8 @@
1
1
  import { useMemo } from 'react';
2
2
  import NumberFormat, { NumberFormatProps } from 'react-number-format';
3
3
  import { getCurrency } from '@akinon/next/utils';
4
- import { PriceProps } from '@theme/types';
5
4
  import { useLocalization } from '@akinon/next/hooks';
5
+ import { PriceProps } from '../types';
6
6
  import Settings from '@theme/settings';
7
7
 
8
8
  export const Price = (props: NumberFormatProps & PriceProps) => {
@@ -21,12 +21,10 @@ export const Price = (props: NumberFormatProps & PriceProps) => {
21
21
  fixedDecimalScale = true,
22
22
  ...rest
23
23
  } = props;
24
+
24
25
  const { currency: selectedCurrencyCode } = useLocalization();
25
26
  const currencyCode_ = currencyCode || selectedCurrencyCode;
26
27
 
27
- // TODO: This is very bad practice. It broke decimalScale.
28
- const _value = value?.toString().replace('.', ',');
29
-
30
28
  const currency = useMemo(
31
29
  () =>
32
30
  getCurrency({
@@ -38,21 +36,39 @@ export const Price = (props: NumberFormatProps & PriceProps) => {
38
36
  [currencyCode_, useCurrencySymbol, useCurrencyAfterPrice, useCurrencySpace]
39
37
  );
40
38
 
39
+ const numericValue =
40
+ typeof value === 'string'
41
+ ? parseFloat(value)
42
+ : typeof value === 'number'
43
+ ? value
44
+ : 0;
45
+
46
+ const formattedValue = Number.isFinite(numericValue)
47
+ ? numericValue.toFixed(decimalScale)
48
+ : '0';
49
+
50
+ const displayValue =
51
+ useNegative && numericValue < 0
52
+ ? `-${useNegativeSpace ? ' ' : ''}${Math.abs(numericValue).toFixed(
53
+ decimalScale
54
+ )}`
55
+ : formattedValue;
56
+
41
57
  const currentCurrencyDecimalScale = Settings.localization.currencies.find(
42
58
  (currency) => currency.code === currencyCode_
43
59
  ).decimalScale;
44
60
 
45
61
  return (
46
62
  <NumberFormat
47
- value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
48
- {...{
49
- [useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
50
- }}
63
+ value={displayValue}
51
64
  displayType={displayType}
52
65
  thousandSeparator={thousandSeparator}
53
66
  decimalScale={currentCurrencyDecimalScale ?? decimalScale}
54
67
  decimalSeparator={decimalSeparator}
55
68
  fixedDecimalScale={fixedDecimalScale}
69
+ prefix={!useCurrencyAfterPrice ? currency : undefined}
70
+ suffix={useCurrencyAfterPrice ? currency : undefined}
71
+ isNumericString={true}
56
72
  {...rest}
57
73
  />
58
74
  );
@@ -30,7 +30,11 @@ const FavoriteProductsList = () => {
30
30
  }
31
31
 
32
32
  if (isLoading || isFetching) {
33
- return <LoaderSpinner />; // TODO: Fix loader spinner position
33
+ return (
34
+ <div className="flex items-center justify-center h-80">
35
+ <LoaderSpinner />
36
+ </div>
37
+ );
34
38
  }
35
39
 
36
40
  return (
@@ -9,6 +9,7 @@ import { twMerge } from 'tailwind-merge';
9
9
  import * as yup from 'yup';
10
10
  import { useEffect, useState } from 'react';
11
11
  import { getPosError } from '@akinon/next/utils';
12
+ import { useMessageListener } from '@akinon/next/hooks';
12
13
 
13
14
  interface FormValues {
14
15
  agreement: boolean;
@@ -25,7 +26,6 @@ const formSchema = () =>
25
26
  export default function RedirectionPayment() {
26
27
  const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
27
28
  const [formError, setFormError] = useState(null);
28
-
29
29
  const {
30
30
  register,
31
31
  handleSubmit,
@@ -34,11 +34,12 @@ export default function RedirectionPayment() {
34
34
  resolver: yupResolver(formSchema())
35
35
  });
36
36
  const [completeRedirectionPayment] = useCompleteRedirectionPaymentMutation();
37
-
38
37
  const onSubmit = async () => {
39
38
  completeRedirectionPayment();
40
39
  };
41
40
 
41
+ useMessageListener();
42
+
42
43
  useEffect(() => {
43
44
  const posErrors = getPosError();
44
45
 
@@ -48,44 +49,49 @@ export default function RedirectionPayment() {
48
49
  }, []);
49
50
 
50
51
  return (
51
- <form onSubmit={handleSubmit(onSubmit)} className="lg-5 space-y-5 lg:p-10">
52
- <h1 className="text-2xl font-bold px-4 md:px-0">
53
- Pay With {payment_option.name}
54
- </h1>
55
-
56
- <p className="px-4 md:px-0">
57
- You can quickly and easily pay and complete your order with{' '}
58
- {payment_option.name}.
59
- </p>
60
-
61
- <Checkbox
62
- className="px-4 md:px-0"
63
- {...register('agreement')}
64
- error={errors.agreement}
52
+ <div className="checkout-redirection-payment-wrapper">
53
+ <form
54
+ onSubmit={handleSubmit(onSubmit)}
55
+ className="lg-5 space-y-5 lg:p-10"
65
56
  >
66
- Check here to indicate that you have read and agree to the all terms.
67
- </Checkbox>
57
+ <h1 className="text-2xl font-bold px-4 md:px-0">
58
+ Pay With {payment_option.name}
59
+ </h1>
68
60
 
69
- {formError?.non_field_errors && (
70
- <div
71
- className="w-full text-xs text-start px-1 mt-3 text-error"
72
- data-testid="checkout-form-error"
73
- >
74
- {formError.non_field_errors}
75
- </div>
76
- )}
77
- {formError?.status && (
78
- <div
79
- className="w-full text-xs text-start px-1 mt-3 text-error"
80
- data-testid="checkout-form-error"
61
+ <p className="px-4 md:px-0">
62
+ You can quickly and easily pay and complete your order with{' '}
63
+ {payment_option.name}.
64
+ </p>
65
+
66
+ <Checkbox
67
+ className="px-4 md:px-0"
68
+ {...register('agreement')}
69
+ error={errors.agreement}
81
70
  >
82
- {formError.status}
83
- </div>
84
- )}
71
+ Check here to indicate that you have read and agree to the all terms.
72
+ </Checkbox>
73
+
74
+ {formError?.non_field_errors && (
75
+ <div
76
+ className="w-full text-xs text-start px-1 mt-3 text-error"
77
+ data-testid="checkout-form-error"
78
+ >
79
+ {formError.non_field_errors}
80
+ </div>
81
+ )}
82
+ {formError?.status && (
83
+ <div
84
+ className="w-full text-xs text-start px-1 mt-3 text-error"
85
+ data-testid="checkout-form-error"
86
+ >
87
+ {formError.status}
88
+ </div>
89
+ )}
85
90
 
86
- <Button className={twMerge('w-full md:w-36 px-4 md:px-0')}>
87
- {payment_option.name}
88
- </Button>
89
- </form>
91
+ <Button className={twMerge('w-full md:w-36 px-4 md:px-0')}>
92
+ {payment_option.name}
93
+ </Button>
94
+ </form>
95
+ </div>
90
96
  );
91
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.64.0",
3
+ "version": "1.66.0",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {