@akinon/projectzero 1.102.0-rc.79 → 1.103.0-rc.80
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 +3 -5
- package/app-template/CHANGELOG.md +48 -67
- package/app-template/package.json +18 -20
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +11 -16
- package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +11 -17
- package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +38 -36
- package/app-template/src/app/[commerce]/[locale]/[currency]/{pz-not-found/page.tsx → not-found.tsx} +5 -7
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +48 -46
- package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +20 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# @akinon/projectzero
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
4
|
-
|
|
5
|
-
## 1.102.0-rc.78
|
|
6
|
-
|
|
7
|
-
## 1.102.0-rc.77
|
|
3
|
+
## 1.103.0-rc.80
|
|
8
4
|
|
|
9
5
|
### Minor Changes
|
|
10
6
|
|
|
@@ -21,6 +17,8 @@
|
|
|
21
17
|
- d99a6a7d: ZERO-3457: Fixed the settings prop and made sure everything is customizable.
|
|
22
18
|
- 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
|
|
23
19
|
|
|
20
|
+
## 1.102.0
|
|
21
|
+
|
|
24
22
|
## 1.101.0
|
|
25
23
|
|
|
26
24
|
## 1.100.0
|
|
@@ -1,54 +1,6 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [9a3885b]
|
|
8
|
-
- @akinon/next@1.102.0-rc.79
|
|
9
|
-
- @akinon/pz-akifast@1.102.0-rc.79
|
|
10
|
-
- @akinon/pz-b2b@1.102.0-rc.79
|
|
11
|
-
- @akinon/pz-basket-gift-pack@1.102.0-rc.79
|
|
12
|
-
- @akinon/pz-bkm@1.102.0-rc.79
|
|
13
|
-
- @akinon/pz-checkout-gift-pack@1.102.0-rc.79
|
|
14
|
-
- @akinon/pz-click-collect@1.102.0-rc.79
|
|
15
|
-
- @akinon/pz-credit-payment@1.102.0-rc.79
|
|
16
|
-
- @akinon/pz-gpay@1.102.0-rc.79
|
|
17
|
-
- @akinon/pz-hepsipay@1.102.0-rc.79
|
|
18
|
-
- @akinon/pz-masterpass@1.102.0-rc.79
|
|
19
|
-
- @akinon/pz-one-click-checkout@1.102.0-rc.79
|
|
20
|
-
- @akinon/pz-otp@1.102.0-rc.79
|
|
21
|
-
- @akinon/pz-pay-on-delivery@1.102.0-rc.79
|
|
22
|
-
- @akinon/pz-saved-card@1.102.0-rc.79
|
|
23
|
-
- @akinon/pz-similar-products@1.102.0-rc.79
|
|
24
|
-
- @akinon/pz-tabby-extension@1.102.0-rc.79
|
|
25
|
-
- @akinon/pz-tamara-extension@1.102.0-rc.79
|
|
26
|
-
|
|
27
|
-
## 1.102.0-rc.78
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Updated dependencies [d512ea2]
|
|
32
|
-
- @akinon/next@1.102.0-rc.78
|
|
33
|
-
- @akinon/pz-akifast@1.102.0-rc.78
|
|
34
|
-
- @akinon/pz-b2b@1.102.0-rc.78
|
|
35
|
-
- @akinon/pz-basket-gift-pack@1.102.0-rc.78
|
|
36
|
-
- @akinon/pz-bkm@1.102.0-rc.78
|
|
37
|
-
- @akinon/pz-checkout-gift-pack@1.102.0-rc.78
|
|
38
|
-
- @akinon/pz-click-collect@1.102.0-rc.78
|
|
39
|
-
- @akinon/pz-credit-payment@1.102.0-rc.78
|
|
40
|
-
- @akinon/pz-gpay@1.102.0-rc.78
|
|
41
|
-
- @akinon/pz-hepsipay@1.102.0-rc.78
|
|
42
|
-
- @akinon/pz-masterpass@1.102.0-rc.78
|
|
43
|
-
- @akinon/pz-one-click-checkout@1.102.0-rc.78
|
|
44
|
-
- @akinon/pz-otp@1.102.0-rc.78
|
|
45
|
-
- @akinon/pz-pay-on-delivery@1.102.0-rc.78
|
|
46
|
-
- @akinon/pz-saved-card@1.102.0-rc.78
|
|
47
|
-
- @akinon/pz-similar-products@1.102.0-rc.78
|
|
48
|
-
- @akinon/pz-tabby-extension@1.102.0-rc.78
|
|
49
|
-
- @akinon/pz-tamara-extension@1.102.0-rc.78
|
|
50
|
-
|
|
51
|
-
## 1.102.0-rc.77
|
|
3
|
+
## 1.103.0-rc.80
|
|
52
4
|
|
|
53
5
|
### Minor Changes
|
|
54
6
|
|
|
@@ -83,7 +35,7 @@
|
|
|
83
35
|
|
|
84
36
|
### Patch Changes
|
|
85
37
|
|
|
86
|
-
- Updated dependencies [
|
|
38
|
+
- Updated dependencies [4c238479]
|
|
87
39
|
- Updated dependencies [4ca44c7]
|
|
88
40
|
- Updated dependencies [5dfeea04a]
|
|
89
41
|
- Updated dependencies [823d82f9]
|
|
@@ -140,6 +92,7 @@
|
|
|
140
92
|
- Updated dependencies [33377cfd]
|
|
141
93
|
- Updated dependencies [6bfbdc2]
|
|
142
94
|
- Updated dependencies [43c182eef]
|
|
95
|
+
- Updated dependencies [d512ea2]
|
|
143
96
|
- Updated dependencies [c480272c]
|
|
144
97
|
- Updated dependencies [08c3caec]
|
|
145
98
|
- Updated dependencies [facf1ada]
|
|
@@ -162,23 +115,51 @@
|
|
|
162
115
|
- Updated dependencies [49eeebfaa]
|
|
163
116
|
- Updated dependencies [3f9b8d7e7]
|
|
164
117
|
- Updated dependencies [0e823010]
|
|
165
|
-
- Updated dependencies [
|
|
166
|
-
- @akinon/pz-gpay@1.
|
|
167
|
-
- @akinon/pz-saved-card@1.
|
|
168
|
-
- @akinon/next@1.
|
|
169
|
-
- @akinon/pz-pay-on-delivery@1.
|
|
170
|
-
- @akinon/pz-basket-gift-pack@1.
|
|
171
|
-
- @akinon/pz-bkm@1.
|
|
172
|
-
- @akinon/pz-checkout-gift-pack@1.
|
|
173
|
-
- @akinon/pz-one-click-checkout@1.
|
|
174
|
-
- @akinon/pz-tamara-extension@1.
|
|
175
|
-
- @akinon/pz-tabby-extension@1.
|
|
176
|
-
- @akinon/pz-credit-payment@1.
|
|
177
|
-
- @akinon/pz-click-collect@1.
|
|
178
|
-
- @akinon/pz-masterpass@1.
|
|
179
|
-
- @akinon/pz-akifast@1.
|
|
180
|
-
- @akinon/pz-b2b@1.
|
|
181
|
-
- @akinon/pz-otp@1.
|
|
118
|
+
- Updated dependencies [e9af4e24]
|
|
119
|
+
- @akinon/pz-gpay@1.103.0-rc.80
|
|
120
|
+
- @akinon/pz-saved-card@1.103.0-rc.80
|
|
121
|
+
- @akinon/next@1.103.0-rc.80
|
|
122
|
+
- @akinon/pz-pay-on-delivery@1.103.0-rc.80
|
|
123
|
+
- @akinon/pz-basket-gift-pack@1.103.0-rc.80
|
|
124
|
+
- @akinon/pz-bkm@1.103.0-rc.80
|
|
125
|
+
- @akinon/pz-checkout-gift-pack@1.103.0-rc.80
|
|
126
|
+
- @akinon/pz-one-click-checkout@1.103.0-rc.80
|
|
127
|
+
- @akinon/pz-tamara-extension@1.103.0-rc.80
|
|
128
|
+
- @akinon/pz-tabby-extension@1.103.0-rc.80
|
|
129
|
+
- @akinon/pz-credit-payment@1.103.0-rc.80
|
|
130
|
+
- @akinon/pz-click-collect@1.103.0-rc.80
|
|
131
|
+
- @akinon/pz-masterpass@1.103.0-rc.80
|
|
132
|
+
- @akinon/pz-akifast@1.103.0-rc.80
|
|
133
|
+
- @akinon/pz-b2b@1.103.0-rc.80
|
|
134
|
+
- @akinon/pz-otp@1.103.0-rc.80
|
|
135
|
+
|
|
136
|
+
## 1.102.0
|
|
137
|
+
|
|
138
|
+
### Minor Changes
|
|
139
|
+
|
|
140
|
+
- 6b949cb: ZERO-3615: Refactor product data handling and improve 404 error handling
|
|
141
|
+
- 7302f5e: ZERO-3615: Add error handling for 404 status in page components and create NotFound component
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- Updated dependencies [6b949cb]
|
|
146
|
+
- Updated dependencies [9a3885b]
|
|
147
|
+
- @akinon/next@1.102.0
|
|
148
|
+
- @akinon/pz-akifast@1.102.0
|
|
149
|
+
- @akinon/pz-b2b@1.102.0
|
|
150
|
+
- @akinon/pz-basket-gift-pack@1.102.0
|
|
151
|
+
- @akinon/pz-bkm@1.102.0
|
|
152
|
+
- @akinon/pz-checkout-gift-pack@1.102.0
|
|
153
|
+
- @akinon/pz-click-collect@1.102.0
|
|
154
|
+
- @akinon/pz-credit-payment@1.102.0
|
|
155
|
+
- @akinon/pz-gpay@1.102.0
|
|
156
|
+
- @akinon/pz-masterpass@1.102.0
|
|
157
|
+
- @akinon/pz-one-click-checkout@1.102.0
|
|
158
|
+
- @akinon/pz-otp@1.102.0
|
|
159
|
+
- @akinon/pz-pay-on-delivery@1.102.0
|
|
160
|
+
- @akinon/pz-saved-card@1.102.0
|
|
161
|
+
- @akinon/pz-tabby-extension@1.102.0
|
|
162
|
+
- @akinon/pz-tamara-extension@1.102.0
|
|
182
163
|
|
|
183
164
|
## 1.101.0
|
|
184
165
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.103.0-rc.80",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,24 +24,22 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "1.
|
|
28
|
-
"@akinon/pz-akifast": "1.
|
|
29
|
-
"@akinon/pz-b2b": "1.
|
|
30
|
-
"@akinon/pz-basket-gift-pack": "1.
|
|
31
|
-
"@akinon/pz-bkm": "1.
|
|
32
|
-
"@akinon/pz-checkout-gift-pack": "1.
|
|
33
|
-
"@akinon/pz-click-collect": "1.
|
|
34
|
-
"@akinon/pz-credit-payment": "1.
|
|
35
|
-
"@akinon/pz-gpay": "1.
|
|
36
|
-
"@akinon/pz-
|
|
37
|
-
"@akinon/pz-
|
|
38
|
-
"@akinon/pz-
|
|
39
|
-
"@akinon/pz-
|
|
40
|
-
"@akinon/pz-
|
|
41
|
-
"@akinon/pz-
|
|
42
|
-
"@akinon/pz-
|
|
43
|
-
"@akinon/pz-tabby-extension": "1.102.0-rc.79",
|
|
44
|
-
"@akinon/pz-tamara-extension": "1.102.0-rc.79",
|
|
27
|
+
"@akinon/next": "1.103.0-rc.80",
|
|
28
|
+
"@akinon/pz-akifast": "1.103.0-rc.80",
|
|
29
|
+
"@akinon/pz-b2b": "1.103.0-rc.80",
|
|
30
|
+
"@akinon/pz-basket-gift-pack": "1.103.0-rc.80",
|
|
31
|
+
"@akinon/pz-bkm": "1.103.0-rc.80",
|
|
32
|
+
"@akinon/pz-checkout-gift-pack": "1.103.0-rc.80",
|
|
33
|
+
"@akinon/pz-click-collect": "1.103.0-rc.80",
|
|
34
|
+
"@akinon/pz-credit-payment": "1.103.0-rc.80",
|
|
35
|
+
"@akinon/pz-gpay": "1.103.0-rc.80",
|
|
36
|
+
"@akinon/pz-masterpass": "1.103.0-rc.80",
|
|
37
|
+
"@akinon/pz-one-click-checkout": "1.103.0-rc.80",
|
|
38
|
+
"@akinon/pz-otp": "1.103.0-rc.80",
|
|
39
|
+
"@akinon/pz-pay-on-delivery": "1.103.0-rc.80",
|
|
40
|
+
"@akinon/pz-saved-card": "1.103.0-rc.80",
|
|
41
|
+
"@akinon/pz-tabby-extension": "1.103.0-rc.80",
|
|
42
|
+
"@akinon/pz-tamara-extension": "1.103.0-rc.80",
|
|
45
43
|
"@hookform/resolvers": "2.9.0",
|
|
46
44
|
"@next/third-parties": "14.1.0",
|
|
47
45
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -64,7 +62,7 @@
|
|
|
64
62
|
"yup": "0.32.11"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
|
-
"@akinon/eslint-plugin-projectzero": "1.
|
|
65
|
+
"@akinon/eslint-plugin-projectzero": "1.103.0-rc.80",
|
|
68
66
|
"@semantic-release/changelog": "6.0.2",
|
|
69
67
|
"@semantic-release/exec": "6.0.3",
|
|
70
68
|
"@semantic-release/git": "10.0.1",
|
|
@@ -5,28 +5,23 @@ import CategoryLayout from '@theme/views/category/layout';
|
|
|
5
5
|
import { notFound } from 'next/navigation';
|
|
6
6
|
|
|
7
7
|
async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
8
|
-
let categoryData;
|
|
9
|
-
|
|
10
8
|
try {
|
|
11
|
-
|
|
9
|
+
const { data, breadcrumbData } = await getCategoryData({
|
|
12
10
|
pk: params.pk,
|
|
13
11
|
searchParams
|
|
14
12
|
});
|
|
15
|
-
} catch (error) {
|
|
16
|
-
return notFound();
|
|
17
|
-
}
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<CategoryLayout data={data} breadcrumbData={breadcrumbData} />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
} catch (error: unknown) {
|
|
20
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
21
|
+
notFound();
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
const { data, breadcrumbData } = categoryData;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<CategoryLayout data={data} breadcrumbData={breadcrumbData} />
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -4,26 +4,20 @@ import { PageProps } from '@akinon/next/types';
|
|
|
4
4
|
import { notFound } from 'next/navigation';
|
|
5
5
|
|
|
6
6
|
async function Page({ params }: PageProps<{ pk: number }>) {
|
|
7
|
-
let data;
|
|
8
|
-
|
|
9
7
|
try {
|
|
10
|
-
data = await getFlatPageData({ pk: params.pk });
|
|
11
|
-
} catch (error) {
|
|
12
|
-
return notFound();
|
|
13
|
-
}
|
|
8
|
+
const data = await getFlatPageData({ pk: params.pk });
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
return (
|
|
11
|
+
<div className="container mx-auto py-6">
|
|
12
|
+
<div
|
|
13
|
+
className="mx-auto prose prose-headings:text-primary"
|
|
14
|
+
dangerouslySetInnerHTML={{ __html: data.flat_page.content }}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
notFound();
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className="container mx-auto py-6">
|
|
21
|
-
<div
|
|
22
|
-
className="mx-auto prose prose-headings:text-primary"
|
|
23
|
-
dangerouslySetInnerHTML={{ __html: data.flat_page.content }}
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -13,46 +13,50 @@ export async function generateMetadata({
|
|
|
13
13
|
let result: Metadata = {};
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
16
|
+
const { data } = await getProductData({
|
|
17
17
|
pk: params.pk,
|
|
18
18
|
searchParams,
|
|
19
19
|
groupProduct: true
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
if (!productData || !productData.data || !productData.data.product) {
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
22
|
+
const product = data?.product;
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
if (!product) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
28
27
|
|
|
29
28
|
result = {
|
|
30
29
|
title: product.name,
|
|
31
|
-
description: String(product.attributes
|
|
30
|
+
description: String(product.attributes?.description),
|
|
32
31
|
twitter: {
|
|
33
32
|
title: product.name,
|
|
34
|
-
description: String(product.attributes
|
|
33
|
+
description: String(product.attributes?.description)
|
|
35
34
|
},
|
|
36
35
|
openGraph: {
|
|
37
36
|
title: product.name,
|
|
38
|
-
description: String(product.attributes
|
|
37
|
+
description: String(product.attributes?.description),
|
|
39
38
|
images: product.productimage_set?.map((item) => ({
|
|
40
39
|
url: item.image
|
|
41
40
|
}))
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
} catch (error: unknown) {
|
|
44
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
45
|
+
notFound();
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
46
49
|
|
|
47
50
|
return result;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
if (params.pk === undefined || isNaN(Number(params.pk))) {
|
|
55
|
+
notFound();
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
try {
|
|
55
|
-
[
|
|
59
|
+
const [{ data, breadcrumbData }, deliveryReturn] = await Promise.all([
|
|
56
60
|
getProductData({
|
|
57
61
|
pk: params.pk,
|
|
58
62
|
searchParams,
|
|
@@ -60,31 +64,29 @@ async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
|
60
64
|
}),
|
|
61
65
|
getWidgetData({ slug: 'product-delivery-returns' })
|
|
62
66
|
]);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
return notFound();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!productData || !productData.data || !productData.data.product) {
|
|
68
|
-
return notFound();
|
|
69
|
-
}
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
const jsonLd = generateJsonLd(data.product);
|
|
68
|
+
const jsonLd = generateJsonLd(data.product);
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<ProductLayout data={data} breadcrumbData={breadcrumbData}>
|
|
73
|
+
<ProductGroupInfo
|
|
74
|
+
data={data}
|
|
75
|
+
deliveryReturn={deliveryReturn?.attributes}
|
|
76
|
+
/>
|
|
77
|
+
</ProductLayout>
|
|
78
|
+
<script
|
|
79
|
+
type="application/ld+json"
|
|
80
|
+
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
|
80
81
|
/>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
} catch (error: unknown) {
|
|
85
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
86
|
+
notFound();
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
package/app-template/src/app/[commerce]/[locale]/[currency]/{pz-not-found/page.tsx → not-found.tsx}
RENAMED
|
@@ -4,14 +4,14 @@ import React from 'react';
|
|
|
4
4
|
import { Button, Link } from '@theme/components';
|
|
5
5
|
import { useLocalization } from '@akinon/next/hooks';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export default function NotFound() {
|
|
8
8
|
const { t } = useLocalization();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<div className="py-
|
|
12
|
-
<div className="text-8xl font-bold">404</div>
|
|
11
|
+
<div className="py-10 flex flex-col items-center justify-center">
|
|
12
|
+
<div className="text-8xl font-bold text-gray-400">404</div>
|
|
13
13
|
<h1 className="text-4xl font-bold mb-4">{t('not_found.title')}</h1>
|
|
14
|
-
<p className="text-lg mb-6">{t('not_found.sub_title')}</p>
|
|
14
|
+
<p className="text-lg mb-6 text-gray-600">{t('not_found.sub_title')}</p>
|
|
15
15
|
<Link href={'/'}>
|
|
16
16
|
<Button className="h-auto mt-4 text-base py-3 px-6">
|
|
17
17
|
{t('not_found.button')}
|
|
@@ -19,6 +19,4 @@ const NotFound = () => {
|
|
|
19
19
|
</Link>
|
|
20
20
|
</div>
|
|
21
21
|
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default NotFound;
|
|
22
|
+
}
|
|
@@ -13,87 +13,89 @@ export async function generateMetadata({
|
|
|
13
13
|
let result: Metadata = {};
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
16
|
+
const { data } = await getProductData({
|
|
17
17
|
pk: params.pk,
|
|
18
18
|
searchParams
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
21
|
+
const product = data?.product;
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
if (!product) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
result = {
|
|
28
28
|
title: product.name,
|
|
29
|
-
description: String(product.attributes
|
|
29
|
+
description: String(product.attributes?.description),
|
|
30
30
|
twitter: {
|
|
31
31
|
title: product.name,
|
|
32
|
-
description: String(product.attributes
|
|
32
|
+
description: String(product.attributes?.description)
|
|
33
33
|
},
|
|
34
34
|
openGraph: {
|
|
35
35
|
title: product.name,
|
|
36
|
-
description: String(product.attributes
|
|
36
|
+
description: String(product.attributes?.description),
|
|
37
37
|
images: product.productimage_set?.map((item) => ({
|
|
38
38
|
url: item.image
|
|
39
39
|
}))
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
} catch (error: unknown) {
|
|
43
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
44
|
+
notFound();
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
44
48
|
|
|
45
49
|
return result;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
if (params.pk === undefined || isNaN(Number(params.pk))) {
|
|
54
|
+
notFound();
|
|
55
|
+
}
|
|
51
56
|
|
|
52
57
|
try {
|
|
53
|
-
[
|
|
58
|
+
const [{ data, breadcrumbData }, deliveryReturn] = await Promise.all([
|
|
54
59
|
getProductData({
|
|
55
60
|
pk: params.pk,
|
|
56
61
|
searchParams
|
|
57
62
|
}),
|
|
58
63
|
getWidgetData({ slug: 'product-delivery-returns' })
|
|
59
64
|
]);
|
|
60
|
-
} catch (error) {
|
|
61
|
-
return notFound();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// If product data is not found, return 404
|
|
65
|
-
if (!productData || !productData.data || !productData.data.product) {
|
|
66
|
-
return notFound();
|
|
67
|
-
}
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
const jsonLd = generateJsonLd(data.product);
|
|
66
|
+
const jsonLd = generateJsonLd(data.product);
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<ProductLayout data={data} breadcrumbData={breadcrumbData}>
|
|
71
|
+
<div className="flex flex-col items-center">
|
|
72
|
+
<h1
|
|
73
|
+
className="mt-4 text-2xl text-center md:mt-0"
|
|
74
|
+
data-testid="product-name"
|
|
75
|
+
>
|
|
76
|
+
{data.product.name}
|
|
77
|
+
</h1>
|
|
82
78
|
|
|
83
|
-
|
|
79
|
+
<ProductInfo data={data} />
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
<AccordionWrapper
|
|
82
|
+
data={data}
|
|
83
|
+
deliveryReturn={deliveryReturn?.attributes}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
</ProductLayout>
|
|
87
|
+
<script
|
|
88
|
+
type="application/ld+json"
|
|
89
|
+
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
} catch (error: unknown) {
|
|
94
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
95
|
+
notFound();
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -7,30 +7,29 @@ import SpecialPageCarousel from '@theme/widgets/special-page-carousel';
|
|
|
7
7
|
import { notFound } from 'next/navigation';
|
|
8
8
|
|
|
9
9
|
async function Page({ params, searchParams }: PageProps<{ pk: number }>) {
|
|
10
|
-
let data;
|
|
11
|
-
|
|
12
10
|
try {
|
|
13
|
-
data = await getSpecialPageData({ pk: params.pk, searchParams });
|
|
14
|
-
} catch (error) {
|
|
15
|
-
return notFound();
|
|
16
|
-
}
|
|
11
|
+
const data = await getSpecialPageData({ pk: params.pk, searchParams });
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<CategoryLayout data={data}>
|
|
16
|
+
{data.special_page && (
|
|
17
|
+
<>
|
|
18
|
+
<SpecialPageBanner data={data.special_page} />
|
|
19
|
+
<SpecialPageCarousel
|
|
20
|
+
slug={data.special_page.video_embedded_code}
|
|
21
|
+
/>
|
|
22
|
+
</>
|
|
23
|
+
)}
|
|
24
|
+
</CategoryLayout>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
} catch (error: unknown) {
|
|
28
|
+
if ((error as Error & { status?: number })?.status === 404) {
|
|
29
|
+
notFound();
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
20
32
|
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<CategoryLayout data={data}>
|
|
25
|
-
{data.special_page && (
|
|
26
|
-
<>
|
|
27
|
-
<SpecialPageBanner data={data.special_page} />
|
|
28
|
-
<SpecialPageCarousel slug={data.special_page.video_embedded_code} />
|
|
29
|
-
</>
|
|
30
|
-
)}
|
|
31
|
-
</CategoryLayout>
|
|
32
|
-
</>
|
|
33
|
-
);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
export default withSegmentDefaults(Page, { segmentType: 'page' });
|