@akinon/projectzero 1.34.0 → 1.36.0-rc.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/app-template/CHANGELOG.md +365 -7
  3. package/app-template/eslint.config.js +10 -0
  4. package/app-template/package.json +12 -11
  5. package/app-template/public/locales/en/account.json +4 -4
  6. package/app-template/public/locales/en/not_found.json +5 -0
  7. package/app-template/public/locales/tr/account.json +1 -1
  8. package/app-template/public/locales/tr/not_found.json +5 -0
  9. package/app-template/src/app/[commerce]/[locale]/[currency]/[...prettyurl]/page.tsx +8 -0
  10. package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-email/page.tsx +0 -2
  11. package/app-template/src/app/[commerce]/[locale]/[currency]/account/coupons/page.tsx +4 -4
  12. package/app-template/src/app/[commerce]/[locale]/[currency]/account/profile/page.tsx +1 -0
  13. package/app-template/src/app/[commerce]/[locale]/[currency]/address/stores/page.tsx +2 -2
  14. package/app-template/src/app/[commerce]/[locale]/[currency]/auth/page.tsx +1 -1
  15. package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +0 -2
  16. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/checkout/page.tsx +2 -2
  17. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +13 -9
  18. package/app-template/src/app/[commerce]/[locale]/[currency]/pz-not-found/page.tsx +24 -0
  19. package/app-template/src/app/api/form/[...id]/route.ts +3 -3
  20. package/app-template/src/components/carousel-core.tsx +1 -1
  21. package/app-template/src/components/checkbox.tsx +2 -1
  22. package/app-template/src/components/input.tsx +19 -7
  23. package/app-template/src/components/pagination.tsx +3 -3
  24. package/app-template/src/components/price.tsx +3 -3
  25. package/app-template/src/middleware.ts +13 -13
  26. package/app-template/src/redux/reducers/category.ts +23 -1
  27. package/app-template/src/redux/store.ts +1 -1
  28. package/app-template/src/settings.js +2 -1
  29. package/app-template/src/types/next-auth.d.ts +1 -0
  30. package/app-template/src/views/account/account-menu.tsx +0 -1
  31. package/app-template/src/views/account/address-form.tsx +4 -4
  32. package/app-template/src/views/account/favourite-products/favourite-products-list.tsx +5 -1
  33. package/app-template/src/views/account/orders/order-detail-header.tsx +0 -7
  34. package/app-template/src/views/category/category-active-filters.tsx +24 -35
  35. package/app-template/src/views/category/category-info.tsx +3 -3
  36. package/app-template/src/views/category/filters/index.tsx +23 -13
  37. package/app-template/src/views/checkout/auth.tsx +1 -1
  38. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -1
  39. package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +2 -3
  40. package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +2 -5
  41. package/app-template/src/views/find-in-store/index.tsx +2 -2
  42. package/app-template/src/views/header/mini-basket.tsx +2 -2
  43. package/app-template/src/views/product/product-info.tsx +9 -2
  44. package/app-template/src/views/product-item/index.tsx +1 -1
  45. package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +1 -1
  46. package/app-template/tsconfig.json +14 -4
  47. package/package.json +1 -1
  48. package/app-template/.eslintrc.js +0 -31
@@ -1,14 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  import { useCompleteRedirectionPaymentMutation } from '@akinon/next/data/client/checkout';
4
- import { useLocalization } from '@akinon/next/hooks';
5
4
  import { useAppSelector } from '@akinon/next/redux/hooks';
6
5
  import { yupResolver } from '@hookform/resolvers/yup';
7
6
  import { Button, Checkbox } from '@theme/components';
8
7
  import { useForm } from 'react-hook-form';
9
8
  import { twMerge } from 'tailwind-merge';
10
9
  import * as yup from 'yup';
11
- import PaymentOptionButtons from '../payment-option-buttons';
12
10
  import { useEffect, useState } from 'react';
13
11
  import { getPosError } from '@akinon/next/utils';
14
12
 
@@ -16,7 +14,7 @@ interface FormValues {
16
14
  agreement: boolean;
17
15
  }
18
16
 
19
- const formSchema = (t) =>
17
+ const formSchema = () =>
20
18
  yup.object().shape({
21
19
  agreement: yup
22
20
  .boolean()
@@ -28,13 +26,12 @@ export default function RedirectionPayment() {
28
26
  const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
29
27
  const [formError, setFormError] = useState(null);
30
28
 
31
- const { t } = useLocalization();
32
29
  const {
33
30
  register,
34
31
  handleSubmit,
35
32
  formState: { errors }
36
33
  } = useForm<FormValues>({
37
- resolver: yupResolver(formSchema(t))
34
+ resolver: yupResolver(formSchema())
38
35
  });
39
36
  const [completeRedirectionPayment] = useCompleteRedirectionPaymentMutation();
40
37
 
@@ -63,7 +63,7 @@ export const FindInStore = ({ productPk, productName, variants }) => {
63
63
  return options;
64
64
  }
65
65
  return [];
66
- }, [retailStore]);
66
+ }, [retailStore]); // eslint-disable-line react-hooks/exhaustive-deps
67
67
 
68
68
  const sizeOptions = useMemo(() => {
69
69
  if (variants) {
@@ -80,7 +80,7 @@ export const FindInStore = ({ productPk, productName, variants }) => {
80
80
  return options;
81
81
  }
82
82
  return [];
83
- }, [variants]);
83
+ }, [variants, sizeKey]); // eslint-disable-line react-hooks/exhaustive-deps
84
84
 
85
85
  const createStockStatus = (stock) => {
86
86
  const status = {
@@ -46,7 +46,7 @@ function MiniBasketItem(props: MiniBasketItemProps) {
46
46
  miniBasketList.scrollTop = 0;
47
47
  }
48
48
  }
49
- }, [highlightedItem, basketItem.product.pk]);
49
+ }, [highlightedItem, basketItem.product.pk, miniBasketListRef]);
50
50
 
51
51
  const removeItem = () => {
52
52
  updateQuantityMutation({
@@ -183,7 +183,7 @@ export default function MiniBasket() {
183
183
  setSortedBasket(basket.basketitem_set);
184
184
  }
185
185
  }
186
- }, [isSuccess, highlightedItem, basket]);
186
+ }, [isSuccess, highlightedItem, basket, highlightedItemPk]);
187
187
 
188
188
  return (
189
189
  <>
@@ -36,7 +36,7 @@ export default function ProductInfo({ data }: ProductPageProps) {
36
36
 
37
37
  useEffect(() => {
38
38
  pushProductViewed(data?.product);
39
- }, []);
39
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
40
40
 
41
41
  const addProductToCart = async () => {
42
42
  if (!variantsSelectionCheck()) {
@@ -206,7 +206,14 @@ export default function ProductInfo({ data }: ProductPageProps) {
206
206
  'after:bg-[#d02c2f]',
207
207
  'after:rounded-xl',
208
208
  'after:left-1'
209
- ])
209
+ ]),
210
+ onError: (error) =>
211
+ setProductError(
212
+ error?.data?.non_field_errors ||
213
+ Object.keys(error?.data).map(
214
+ (key) => `${key}: ${error?.data[key].join(', ')}`
215
+ )
216
+ )
210
217
  }}
211
218
  />
212
219
 
@@ -36,7 +36,7 @@ export const ProductItem = (props: Props) => {
36
36
  setViewed(true);
37
37
  pushProductListProductViewed(product);
38
38
  }
39
- }, [inView]);
39
+ }, [inView, viewed, product]);
40
40
 
41
41
  return (
42
42
  <div
@@ -10,7 +10,7 @@ import { useGetWidgetQuery } from '@akinon/next/data/client/misc';
10
10
  import { Input, Button, Checkbox, Modal } from '@theme/components';
11
11
  import { useLocalization } from '@akinon/next/hooks';
12
12
 
13
- const subscriptionFormSchema = (t: any) =>
13
+ const subscriptionFormSchema = (t: (key: string) => string) =>
14
14
  yup.object().shape({
15
15
  email: yup
16
16
  .string()
@@ -3,7 +3,19 @@
3
3
  "display": "Default",
4
4
  "compilerOptions": {
5
5
  "baseUrl": "./src",
6
- "paths": { "@theme/*": ["./*"] },
6
+ "paths": {
7
+ "@theme/*": ["./*"],
8
+ "@root/*": ["./app/[commerce]/[locale]/[currency]/*"],
9
+ "@product/*": ["./app/[commerce]/[locale]/[currency]/product/*"],
10
+ "@group-product/*": [
11
+ "./app/[commerce]/[locale]/[currency]/group-product/*"
12
+ ],
13
+ "@category/*": ["./app/[commerce]/[locale]/[currency]/category/*"],
14
+ "@special-page/*": [
15
+ "./app/[commerce]/[locale]/[currency]/special-page/*"
16
+ ],
17
+ "@flat-page/*": ["./app/[commerce]/[locale]/[currency]/flat-page/*"]
18
+ },
7
19
  "allowSyntheticDefaultImports": true,
8
20
  "composite": false,
9
21
  "declaration": true,
@@ -40,7 +52,5 @@
40
52
  ".next/types/**/*.ts",
41
53
  "../../packages/**/*"
42
54
  ],
43
- "exclude": ["node_modules",
44
- "../../packages/projectzero/app-template"
45
- ]
55
+ "exclude": ["node_modules", "../../packages/projectzero/app-template"]
46
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.34.0",
3
+ "version": "1.36.0-rc.0",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {
@@ -1,31 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es6: true,
5
- node: true,
6
- jest: true
7
- },
8
- extends: [
9
- 'next/core-web-vitals',
10
- 'eslint:recommended',
11
- 'plugin:@typescript-eslint/recommended',
12
- 'prettier',
13
- 'plugin:@akinon/projectzero/core', // DO NOT remove this config for stability
14
- 'plugin:@akinon/projectzero/recommended' // Optional
15
- ],
16
- plugins: ['@typescript-eslint', '@akinon/projectzero'],
17
- parser: '@typescript-eslint/parser',
18
- parserOptions: {
19
- ecmaVersion: 2021,
20
- sourceType: 'module'
21
- },
22
- settings: {
23
- next: {
24
- rootDir: ['src/*/']
25
- }
26
- },
27
- rules: {
28
- '@typescript-eslint/no-unused-vars': 'warn',
29
- '@typescript-eslint/no-explicit-any': 'warn'
30
- }
31
- };