@akinon/projectzero 1.34.0-rc.6 → 1.34.0-rc.8

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 (31) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/app-template/CHANGELOG.md +33 -0
  3. package/app-template/package.json +9 -9
  4. package/app-template/src/app/[commerce]/[locale]/[currency]/[...prettyurl]/page.tsx +8 -0
  5. package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-email/page.tsx +0 -2
  6. package/app-template/src/app/[commerce]/[locale]/[currency]/address/stores/page.tsx +2 -2
  7. package/app-template/src/app/[commerce]/[locale]/[currency]/auth/page.tsx +1 -1
  8. package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +0 -2
  9. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/checkout/page.tsx +2 -2
  10. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +1 -1
  11. package/app-template/src/app/api/form/[...id]/route.ts +3 -3
  12. package/app-template/src/components/carousel-core.tsx +1 -1
  13. package/app-template/src/components/pagination.tsx +2 -2
  14. package/app-template/src/middleware.ts +13 -13
  15. package/app-template/src/redux/store.ts +1 -1
  16. package/app-template/src/types/next-auth.d.ts +1 -0
  17. package/app-template/src/views/account/account-menu.tsx +0 -1
  18. package/app-template/src/views/account/address-form.tsx +4 -4
  19. package/app-template/src/views/account/orders/order-detail-header.tsx +0 -7
  20. package/app-template/src/views/category/category-info.tsx +1 -1
  21. package/app-template/src/views/checkout/auth.tsx +1 -1
  22. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -1
  23. package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +2 -3
  24. package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +2 -5
  25. package/app-template/src/views/find-in-store/index.tsx +2 -2
  26. package/app-template/src/views/header/mini-basket.tsx +2 -2
  27. package/app-template/src/views/product/product-info.tsx +1 -1
  28. package/app-template/src/views/product-item/index.tsx +1 -1
  29. package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +1 -1
  30. package/app-template/tsconfig.json +5 -4
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.34.0-rc.8
4
+
5
+ ## 1.34.0-rc.7
6
+
3
7
  ## 1.34.0-rc.6
4
8
 
5
9
  ## 1.33.2
@@ -1,5 +1,38 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.34.0-rc.8
4
+
5
+ ### Minor Changes
6
+
7
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [91265bb]
12
+ - @akinon/next@1.34.0-rc.8
13
+ - @akinon/pz-b2b@1.34.0-rc.8
14
+ - @akinon/pz-gpay@1.34.0-rc.8
15
+ - @akinon/pz-masterpass@1.34.0-rc.8
16
+ - @akinon/pz-one-click-checkout@1.34.0-rc.8
17
+ - @akinon/pz-otp@1.34.0-rc.8
18
+ - @akinon/pz-pay-on-delivery@1.34.0-rc.8
19
+
20
+ ## 1.34.0-rc.7
21
+
22
+ ### Minor Changes
23
+
24
+ - 0d0f36c: ZERO-2598: Fix eslint warnings and update dependencies
25
+
26
+ ### Patch Changes
27
+
28
+ - @akinon/next@1.34.0-rc.7
29
+ - @akinon/pz-b2b@1.34.0-rc.7
30
+ - @akinon/pz-gpay@1.34.0-rc.7
31
+ - @akinon/pz-masterpass@1.34.0-rc.7
32
+ - @akinon/pz-one-click-checkout@1.34.0-rc.7
33
+ - @akinon/pz-otp@1.34.0-rc.7
34
+ - @akinon/pz-pay-on-delivery@1.34.0-rc.7
35
+
3
36
  ## 1.34.0-rc.6
4
37
 
5
38
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.34.0-rc.6",
3
+ "version": "1.34.0-rc.8",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,13 +22,13 @@
22
22
  "prestart": "pz-prestart"
23
23
  },
24
24
  "dependencies": {
25
- "@akinon/next": "1.34.0-rc.6",
26
- "@akinon/pz-b2b": "1.34.0-rc.6",
27
- "@akinon/pz-gpay": "1.34.0-rc.6",
28
- "@akinon/pz-masterpass": "1.34.0-rc.6",
29
- "@akinon/pz-one-click-checkout": "1.34.0-rc.6",
30
- "@akinon/pz-otp": "1.34.0-rc.6",
31
- "@akinon/pz-pay-on-delivery": "1.34.0-rc.6",
25
+ "@akinon/next": "1.34.0-rc.8",
26
+ "@akinon/pz-b2b": "1.34.0-rc.8",
27
+ "@akinon/pz-gpay": "1.34.0-rc.8",
28
+ "@akinon/pz-masterpass": "1.34.0-rc.8",
29
+ "@akinon/pz-one-click-checkout": "1.34.0-rc.8",
30
+ "@akinon/pz-otp": "1.34.0-rc.8",
31
+ "@akinon/pz-pay-on-delivery": "1.34.0-rc.8",
32
32
  "@hookform/resolvers": "2.9.0",
33
33
  "@next/third-parties": "14.1.0",
34
34
  "@react-google-maps/api": "2.17.1",
@@ -52,7 +52,7 @@
52
52
  "yup": "0.32.11"
53
53
  },
54
54
  "devDependencies": {
55
- "@akinon/eslint-plugin-projectzero": "1.34.0-rc.6",
55
+ "@akinon/eslint-plugin-projectzero": "1.34.0-rc.8",
56
56
  "@semantic-release/changelog": "6.0.2",
57
57
  "@semantic-release/exec": "6.0.3",
58
58
  "@semantic-release/git": "10.0.1",
@@ -0,0 +1,8 @@
1
+ import Page, {
2
+ dynamic,
3
+ revalidate,
4
+ generateMetadata
5
+ } from '@akinon/next/routes/pretty-url';
6
+
7
+ export { dynamic, revalidate, generateMetadata };
8
+ export default Page;
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useSession } from 'next-auth/react';
4
3
  import { useForm, SubmitHandler } from 'react-hook-form';
5
4
  import { yupResolver } from '@hookform/resolvers/yup';
6
5
  import * as yup from 'yup';
@@ -34,7 +33,6 @@ const accountChangeEmailSchema = (t) =>
34
33
  });
35
34
 
36
35
  export default function Page() {
37
- const { data } = useSession();
38
36
  const { data: profileInfo } = useGetProfileInfoQuery();
39
37
 
40
38
  const { t } = useLocalization();
@@ -60,7 +60,7 @@ export default function Stores() {
60
60
  return options;
61
61
  }
62
62
  return [];
63
- }, [country]);
63
+ }, [country]); // eslint-disable-line react-hooks/exhaustive-deps
64
64
 
65
65
  const cityOptions = useMemo(() => {
66
66
  if (city) {
@@ -73,7 +73,7 @@ export default function Stores() {
73
73
  return options;
74
74
  }
75
75
  return [];
76
- }, [city]);
76
+ }, [city]); // eslint-disable-line react-hooks/exhaustive-deps
77
77
 
78
78
  const handleBackButtonClick = () => {
79
79
  setSelectedCityPk(null);
@@ -33,7 +33,7 @@ export default function Auth() {
33
33
  if (session?.user) {
34
34
  router.push(searchParams.get('callbackUrl') ?? '/');
35
35
  }
36
- }, [session?.user]);
36
+ }, [session?.user]); // eslint-disable-line react-hooks/exhaustive-deps
37
37
 
38
38
  return (
39
39
  <section className="container px-4 my-7 md:mt-20 lg:px-0 lg:mx-auto">
@@ -1,8 +1,6 @@
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 logger from '@akinon/next/utils/log';
5
- import * as console from 'console';
6
4
 
7
5
  async function Page({ params }: PageProps<{ pk: number }>) {
8
6
  const data = await getLandingPageData({ pk: params.pk });
@@ -51,7 +51,7 @@ const Checkout = () => {
51
51
  dispatch(setCurrentStep(CheckoutStep.Payment));
52
52
  initialStepChanged.current = true;
53
53
  }
54
- }, [steps.shipping.completed]);
54
+ }, [steps.shipping.completed]); // eslint-disable-line react-hooks/exhaustive-deps
55
55
 
56
56
  useEffect(() => {
57
57
  if (preOrder && !preOrder.shipping_option) {
@@ -63,7 +63,7 @@ const Checkout = () => {
63
63
  return () => {
64
64
  dispatch(resetCheckoutState());
65
65
  };
66
- }, []);
66
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
67
67
 
68
68
  useEffect(() => {
69
69
  if (isSuccess) {
@@ -40,7 +40,7 @@ const CheckoutCompleted = ({
40
40
  return () => {
41
41
  dispatch(setCurrentStep(CheckoutStep.Shipping));
42
42
  };
43
- }, []);
43
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
44
44
 
45
45
  useEffect(() => {
46
46
  if (data?.order) {
@@ -1,7 +1,7 @@
1
- import { NextRequest, NextResponse } from 'next/server';
1
+ import { NextResponse } from 'next/server';
2
2
 
3
- export async function POST(req: NextRequest) {
3
+ export async function POST() {
4
4
  // TODO: Handle Form Data
5
5
 
6
- return NextResponse.json({message: 'ok'});
6
+ return NextResponse.json({ message: 'ok' });
7
7
  }
@@ -28,7 +28,7 @@ const CarouselCore = forwardRef<Carousel, CarouselProps>((props, ref) => {
28
28
  } else {
29
29
  setAspectRatio(containerAspectRatio.mobile);
30
30
  }
31
- }, [matches]);
31
+ }, [matches, containerAspectRatio]);
32
32
 
33
33
  return (
34
34
  <div className="w-full" style={{ aspectRatio }}>
@@ -123,13 +123,13 @@ export const Pagination = (props: PaginationProps) => {
123
123
  if (inView) {
124
124
  handlePageChange();
125
125
  }
126
- }, [inView]);
126
+ }, [inView]); // eslint-disable-line react-hooks/exhaustive-deps
127
127
 
128
128
  useEffect(() => {
129
129
  if (type === 'list') {
130
130
  createListItems();
131
131
  }
132
- }, []);
132
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
133
133
 
134
134
  useEffect(() => {
135
135
  if (total && total !== paginationTotal) {
@@ -1,5 +1,5 @@
1
- import { PzNextRequest, withPzDefault } from '@akinon/next/middlewares';
2
- import { NextFetchEvent, NextMiddleware, NextResponse } from 'next/server';
1
+ import { withPzDefault } from '@akinon/next/middlewares';
2
+ import { NextMiddleware, NextResponse } from 'next/server';
3
3
 
4
4
  /**
5
5
  * !IMPORTANT
@@ -16,18 +16,18 @@ export const config = {
16
16
  ]
17
17
  };
18
18
 
19
- const middleware: NextMiddleware = (
20
- req: PzNextRequest,
21
- event: NextFetchEvent
22
- ) => {
23
- // If you use a custom response such as NextResponse.json(),
24
- // you should set pz-override-response header to true as shown below.
25
- // Otherwise, you'll get a 404 error.
19
+ const middleware: NextMiddleware = () =>
20
+ // req: PzNextRequest,
21
+ // event: NextFetchEvent
22
+ {
23
+ // If you use a custom response such as NextResponse.json(),
24
+ // you should set pz-override-response header to true as shown below.
25
+ // Otherwise, you'll get a 404 error.
26
26
 
27
- // Example:
28
- // return NextResponse.json({ status: 'ok' }, { headers: { 'pz-override-response': 'true' } });
27
+ // Example:
28
+ // return NextResponse.json({ status: 'ok' }, { headers: { 'pz-override-response': 'true' } });
29
29
 
30
- return NextResponse.next();
31
- };
30
+ return NextResponse.next();
31
+ };
32
32
 
33
33
  export default withPzDefault(middleware);
@@ -33,7 +33,7 @@ export type AppStore = ReturnType<typeof makeStore>;
33
33
 
34
34
  export type RootState = ReturnType<AppStore['getState']>;
35
35
 
36
- export type TypedDispatch = ThunkDispatch<RootState, any, AnyAction>;
36
+ export type TypedDispatch = ThunkDispatch<RootState, void, AnyAction>;
37
37
 
38
38
  export type AppDispatch = AppStore['dispatch'];
39
39
 
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1
2
  import NextAuth from 'next-auth';
2
3
 
3
4
  declare module 'next-auth' {
@@ -63,7 +63,6 @@ export default function AccountMenu() {
63
63
  const [logout] = useLogoutMutation();
64
64
  const pathname = usePathname();
65
65
  const accountMenuRegex = new RegExp(`^${ROUTES.ACCOUNT}/?$`).test(pathname);
66
-
67
66
  const handleLogout = async () => {
68
67
  logout()
69
68
  .unwrap()
@@ -121,7 +121,7 @@ export const AddressForm = (props: Props) => {
121
121
  return options;
122
122
  }
123
123
  return [];
124
- }, [country]);
124
+ }, [country]); // eslint-disable-line react-hooks/exhaustive-deps
125
125
 
126
126
  const cityOptions = useMemo(() => {
127
127
  if (city) {
@@ -137,7 +137,7 @@ export const AddressForm = (props: Props) => {
137
137
  return options;
138
138
  }
139
139
  return [];
140
- }, [city]);
140
+ }, [city]); // eslint-disable-line react-hooks/exhaustive-deps
141
141
 
142
142
  const townshipOptions = useMemo(() => {
143
143
  if (township) {
@@ -156,7 +156,7 @@ export const AddressForm = (props: Props) => {
156
156
  return options;
157
157
  }
158
158
  return [];
159
- }, [township]);
159
+ }, [township]); // eslint-disable-line react-hooks/exhaustive-deps
160
160
 
161
161
  const districtOptions = useMemo(() => {
162
162
  if (district) {
@@ -175,7 +175,7 @@ export const AddressForm = (props: Props) => {
175
175
  return options;
176
176
  }
177
177
  return [];
178
- }, [district]);
178
+ }, [district]); // eslint-disable-line react-hooks/exhaustive-deps
179
179
 
180
180
  useEffect(() => {
181
181
  if (data && country) {
@@ -14,13 +14,6 @@ export interface Props {
14
14
  export const OrderDetailHeader = ({ title, order, children }: Props) => {
15
15
  const { t } = useLocalization();
16
16
 
17
- const orderDate = new Date(order.created_date)
18
- .toJSON()
19
- .slice(0, 10)
20
- .split('-')
21
- .reverse()
22
- .join(' ');
23
-
24
17
  return (
25
18
  <div className="bg-gray-150 flex flex-col items-center justify-center p-6 w-full mb-8 md:flex-row">
26
19
  <div className="flex flex-col items-center text-center gap-2">
@@ -44,7 +44,7 @@ export default function ListPage(props: ListPageProps) {
44
44
  newUrl.searchParams.delete('page');
45
45
  router.push(newUrl.pathname + newUrl.search, undefined);
46
46
  }
47
- }, [searchParams, data.products, page]);
47
+ }, [searchParams, data.products, page]); // eslint-disable-line react-hooks/exhaustive-deps
48
48
 
49
49
  const dispatch = useAppDispatch();
50
50
  const { t } = useLocalization();
@@ -20,7 +20,7 @@ const CheckoutAuth = () => {
20
20
  } else if (status === 'unauthenticated') {
21
21
  router.replace(ROUTES.CHECKOUT + `?callbackUrl=${ROUTES.CHECKOUT}`);
22
22
  }
23
- }, [status]);
23
+ }, [status]); // eslint-disable-line react-hooks/exhaustive-deps
24
24
 
25
25
  return (
26
26
  <div className="flex flex-col w-full my-5 lg:flex-row">
@@ -151,7 +151,7 @@ const CheckoutCreditCard = () => {
151
151
 
152
152
  setMonths(months);
153
153
  setYears(years);
154
- }, []);
154
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
155
155
 
156
156
  useEffect(() => {
157
157
  if (installment?.pk) {
@@ -13,10 +13,9 @@ import CheckoutAgreements from '../agreements';
13
13
  import PaymentHeader from '../payment-header';
14
14
  import { useLocalization } from '@akinon/next/hooks';
15
15
  import { Image } from '@akinon/next/components/image';
16
- import PaymentOptionButtons from '../payment-option-buttons';
17
16
  import { Trans } from '@akinon/next/components/trans';
18
17
 
19
- const fundsTransferFormSchema = (t) =>
18
+ const fundsTransferFormSchema = () =>
20
19
  yup.object().shape({
21
20
  agreement: yup.boolean().oneOf([true], 'This field is required.')
22
21
  });
@@ -28,7 +27,7 @@ const CheckoutFundsTransfer = () => {
28
27
  control,
29
28
  formState: { errors }
30
29
  } = useForm({
31
- resolver: yupResolver(fundsTransferFormSchema(t))
30
+ resolver: yupResolver(fundsTransferFormSchema())
32
31
  });
33
32
  const [formError, setFormError] = useState(null);
34
33
  const { bankAccounts, selectedBankAccountPk, preOrder } = useAppSelector(
@@ -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()) {
@@ -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,10 @@
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
+ },
7
10
  "allowSyntheticDefaultImports": true,
8
11
  "composite": false,
9
12
  "declaration": true,
@@ -40,7 +43,5 @@
40
43
  ".next/types/**/*.ts",
41
44
  "../../packages/**/*"
42
45
  ],
43
- "exclude": ["node_modules",
44
- "../../packages/projectzero/app-template"
45
- ]
46
+ "exclude": ["node_modules", "../../packages/projectzero/app-template"]
46
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.34.0-rc.6",
3
+ "version": "1.34.0-rc.8",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {