@faststore/core 2.2.50 → 2.2.52
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +44 -45
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/350.js +1 -1
- package/.next/server/chunks/390.js +393 -453
- package/.next/server/chunks/732.js +24 -10
- package/.next/server/chunks/74.js +329 -187
- package/.next/server/chunks/773.js +550 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/[...slug].js +5 -5
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js +3 -3
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/static/Vfb6D5MSONBW7u11rKVhf/_buildManifest.js +1 -0
- package/.next/static/chunks/158-85b4b978d0a1cf1b.js +1 -0
- package/.next/static/chunks/497-f3f10b00c609f0c2.js +1 -0
- package/.next/static/chunks/pages/{404-2240f0b22db2d370.js → 404-7710903c2a59fa6e.js} +1 -1
- package/.next/static/chunks/pages/{500-c0580e3299329874.js → 500-88a231e61179db83.js} +1 -1
- package/.next/static/chunks/pages/[...slug]-e87fa1c381512f10.js +1 -0
- package/.next/static/chunks/pages/[slug]/{p-e1df08570f34a0d8.js → p-c4c65f184eaa6c98.js} +1 -1
- package/.next/static/chunks/pages/{account-b35bcbef719765f3.js → account-f163e14670372c05.js} +1 -1
- package/.next/static/chunks/pages/{checkout-55bd56ade4408cbe.js → checkout-cf498a32e110bde8.js} +1 -1
- package/.next/static/chunks/pages/index-098f2e020e698003.js +1 -0
- package/.next/static/chunks/pages/{login-3f94bff1503b4fdc.js → login-707636c85f23cac6.js} +1 -1
- package/.next/static/chunks/pages/{s-8575d9c5780684d0.js → s-0bfcfd0d40841dcf.js} +1 -1
- package/.next/static/chunks/webpack-590d458bd6727c5b.js +1 -0
- package/.next/static/css/14238403d5139812.css +1 -0
- package/.next/static/css/4e42cc999ad62b57.css +1 -0
- package/.next/static/css/d456bfc64bc489a2.css +1 -0
- package/.next/trace +80 -80
- package/.turbo/turbo-build.log +10 -9
- package/.turbo/turbo-test.log +10 -10
- package/cms/faststore/sections.json +53 -0
- package/package.json +9 -9
- package/src/components/sections/Hero/DefaultComponents.ts +11 -0
- package/src/components/sections/Hero/Hero.tsx +12 -9
- package/src/components/sections/Hero/OverriddenDefaultHero.ts +12 -0
- package/src/components/sections/ProductGallery/EmptyGallery.tsx +27 -8
- package/src/components/sections/ProductGallery/ProductGallery.tsx +7 -2
- package/src/components/templates/LandingPage/LandingPage.tsx +1 -1
- package/src/components/templates/ProductListingPage/ProductListing.tsx +1 -1
- package/src/pages/index.tsx +1 -1
- package/src/sdk/overrides/getOverriddenSection.tsx +5 -3
- package/src/sdk/overrides/sections.tsx +4 -0
- package/src/typings/overrides.ts +1 -1
- package/.next/server/chunks/398.js +0 -611
- package/.next/static/2x1XIwoqXcK0trpOG0glK/_buildManifest.js +0 -1
- package/.next/static/chunks/469-1925f9bd1c82e92b.js +0 -1
- package/.next/static/chunks/497-5f7bf41345a56013.js +0 -1
- package/.next/static/chunks/pages/[...slug]-92810abb37fa7bda.js +0 -1
- package/.next/static/chunks/pages/index-2506749e45c335bf.js +0 -1
- package/.next/static/chunks/webpack-86d49ac4b093b8cf.js +0 -1
- package/.next/static/css/29868543c76bc6fd.css +0 -1
- package/.next/static/css/527e334fa69cf40a.css +0 -1
- package/.next/static/css/a2eefb25a4608343.css +0 -1
- package/src/components/sections/Hero/Overrides.tsx +0 -20
- /package/.next/static/{2x1XIwoqXcK0trpOG0glK → Vfb6D5MSONBW7u11rKVhf}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -38,27 +38,28 @@ info - Generating static pages (7/7)
|
|
|
38
38
|
info - Finalizing page optimization...
|
|
39
39
|
|
|
40
40
|
Route (pages) Size First Load JS
|
|
41
|
-
┌ ● /
|
|
41
|
+
┌ ● / 2.43 kB 128 kB
|
|
42
|
+
├ └ css/d456bfc64bc489a2.css 5.47 kB
|
|
42
43
|
├ /_app 0 B 83.8 kB
|
|
43
|
-
├ ● /[...slug]
|
|
44
|
-
├ └ css/
|
|
44
|
+
├ ● /[...slug] 3.57 kB 140 kB
|
|
45
|
+
├ └ css/4e42cc999ad62b57.css 5.9 kB
|
|
45
46
|
├ ● /[slug]/p 10.9 kB 136 kB
|
|
46
47
|
├ └ css/d7bbfbd552f407e9.css 11.3 kB
|
|
47
|
-
├ ○ /404 1.19 kB
|
|
48
|
-
├ ● /500 1.21 kB
|
|
49
|
-
├ ● /account
|
|
48
|
+
├ ○ /404 1.19 kB 113 kB
|
|
49
|
+
├ ● /500 1.21 kB 113 kB
|
|
50
|
+
├ ● /account 677 B 112 kB
|
|
50
51
|
├ λ /api/graphql 0 B 83.8 kB
|
|
51
52
|
├ λ /api/health/live 0 B 83.8 kB
|
|
52
53
|
├ λ /api/health/ready 0 B 83.8 kB
|
|
53
54
|
├ λ /api/preview 0 B 83.8 kB
|
|
54
|
-
├ ● /checkout 661 B
|
|
55
|
+
├ ● /checkout 661 B 112 kB
|
|
55
56
|
├ ● /login 1.14 kB 112 kB
|
|
56
|
-
└ ● /s 4.57 kB
|
|
57
|
+
└ ● /s 4.57 kB 127 kB
|
|
57
58
|
+ First Load JS shared by all 86.8 kB
|
|
58
59
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
59
60
|
├ chunks/main-e4e873ee741162eb.js 24.2 kB
|
|
60
61
|
├ chunks/pages/_app-30b9666307e4b3b1.js 12.1 kB
|
|
61
|
-
├ chunks/webpack-
|
|
62
|
+
├ chunks/webpack-590d458bd6727c5b.js 2.25 kB
|
|
62
63
|
└ css/5d1f64b61ea581f4.css 3.05 kB
|
|
63
64
|
|
|
64
65
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
$ jest
|
|
2
|
-
PASS test/server/index.test.ts (21.
|
|
2
|
+
PASS test/server/index.test.ts (21.475 s)
|
|
3
3
|
FastStore GraphQL Layer
|
|
4
4
|
@faststore/api
|
|
5
|
-
✓ should return a valid GraphQL schema (
|
|
6
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
5
|
+
✓ should return a valid GraphQL schema (5 ms)
|
|
6
|
+
✓ should return a valid GraphQL schema contain all expected types (5 ms)
|
|
7
7
|
✓ should return a valid GraphQL schema contain all expected queries (1 ms)
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected mutations
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected mutations
|
|
9
9
|
VTEX API Extension
|
|
10
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
10
|
+
✓ getTypeDefsFromFolder function should return an Array (5 ms)
|
|
11
11
|
Third Party API Extension
|
|
12
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
12
|
+
✓ getTypeDefsFromFolder function should return an Array (9 ms)
|
|
13
13
|
Final Schema after merging
|
|
14
|
-
✓ should return a valid merged GraphQL schema (
|
|
14
|
+
✓ should return a valid merged GraphQL schema (34 ms)
|
|
15
15
|
Envelop
|
|
16
|
-
✓ should exist with its plugins (
|
|
17
|
-
✓ should handle options and execute (
|
|
16
|
+
✓ should exist with its plugins (41 ms)
|
|
17
|
+
✓ should handle options and execute (567 ms)
|
|
18
18
|
|
|
19
19
|
Test Suites: 1 passed, 1 total
|
|
20
20
|
Tests: 9 passed, 9 total
|
|
21
21
|
Snapshots: 0 total
|
|
22
|
-
Time: 21.
|
|
22
|
+
Time: 21.585 s
|
|
23
23
|
Ran all test suites.
|
|
@@ -1607,6 +1607,59 @@
|
|
|
1607
1607
|
"default": true
|
|
1608
1608
|
}
|
|
1609
1609
|
}
|
|
1610
|
+
},
|
|
1611
|
+
"emptyGallery": {
|
|
1612
|
+
"title": "Empty Gallery",
|
|
1613
|
+
"type": "object",
|
|
1614
|
+
"properties": {
|
|
1615
|
+
"title": {
|
|
1616
|
+
"title": "Title",
|
|
1617
|
+
"type": "string",
|
|
1618
|
+
"default": "Nothing matches with your search"
|
|
1619
|
+
},
|
|
1620
|
+
"firstButton": {
|
|
1621
|
+
"title": "First Button",
|
|
1622
|
+
"type": "object",
|
|
1623
|
+
"properties": {
|
|
1624
|
+
"label": {
|
|
1625
|
+
"type": "string",
|
|
1626
|
+
"title": "Label",
|
|
1627
|
+
"default": "Browse Offers"
|
|
1628
|
+
},
|
|
1629
|
+
"url": {
|
|
1630
|
+
"type": "string",
|
|
1631
|
+
"title": "URL",
|
|
1632
|
+
"default": "/office"
|
|
1633
|
+
},
|
|
1634
|
+
"icon": {
|
|
1635
|
+
"title": "Icon",
|
|
1636
|
+
"type": "string",
|
|
1637
|
+
"default": "CircleWavyWarning"
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
"secondButton": {
|
|
1642
|
+
"title": "Second Button",
|
|
1643
|
+
"type": "object",
|
|
1644
|
+
"properties": {
|
|
1645
|
+
"label": {
|
|
1646
|
+
"type": "string",
|
|
1647
|
+
"title": "Label",
|
|
1648
|
+
"default": "Just Arrived"
|
|
1649
|
+
},
|
|
1650
|
+
"url": {
|
|
1651
|
+
"type": "string",
|
|
1652
|
+
"title": "URL",
|
|
1653
|
+
"default": "/technology"
|
|
1654
|
+
},
|
|
1655
|
+
"icon": {
|
|
1656
|
+
"title": "Icon",
|
|
1657
|
+
"type": "string",
|
|
1658
|
+
"default": "RocketLaunch"
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1610
1663
|
}
|
|
1611
1664
|
}
|
|
1612
1665
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.52",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@envelop/graphql-jit": "^1.1.1",
|
|
38
38
|
"@envelop/parser-cache": "^2.2.0",
|
|
39
39
|
"@envelop/validation-cache": "^2.2.0",
|
|
40
|
-
"@faststore/api": "^2.2.
|
|
41
|
-
"@faststore/components": "^2.2.
|
|
42
|
-
"@faststore/graphql-utils": "^2.2.
|
|
43
|
-
"@faststore/sdk": "^2.2.
|
|
44
|
-
"@faststore/ui": "^2.2.
|
|
40
|
+
"@faststore/api": "^2.2.52",
|
|
41
|
+
"@faststore/components": "^2.2.52",
|
|
42
|
+
"@faststore/graphql-utils": "^2.2.52",
|
|
43
|
+
"@faststore/sdk": "^2.2.52",
|
|
44
|
+
"@faststore/ui": "^2.2.52",
|
|
45
45
|
"@graphql-codegen/cli": "^3.3.1",
|
|
46
46
|
"@graphql-codegen/typescript": "^3.0.4",
|
|
47
47
|
"@graphql-codegen/typescript-operations": "^3.0.4",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@cypress/code-coverage": "^3.12.1",
|
|
80
80
|
"@envelop/testing": "^6.0.0",
|
|
81
|
-
"@faststore/cli": "^2.2.
|
|
82
|
-
"@faststore/eslint-config": "^2.2.
|
|
81
|
+
"@faststore/cli": "^2.2.52",
|
|
82
|
+
"@faststore/eslint-config": "^2.2.52",
|
|
83
83
|
"@faststore/lighthouse": "^1.12.32",
|
|
84
84
|
"@lhci/cli": "^0.9.0",
|
|
85
85
|
"@testing-library/cypress": "^10.0.1",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"node": "18.19.0",
|
|
124
124
|
"yarn": "1.19.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "ac3400c44c5088f570681217c224a596b0db3e39"
|
|
127
127
|
}
|
|
@@ -4,11 +4,8 @@ import {
|
|
|
4
4
|
} from '@faststore/ui'
|
|
5
5
|
import { ReactNode } from 'react'
|
|
6
6
|
import { Image } from 'src/components/ui/Image'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
HeroImage,
|
|
10
|
-
HeroHeader,
|
|
11
|
-
} from 'src/components/sections/Hero/Overrides'
|
|
7
|
+
|
|
8
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
12
9
|
|
|
13
10
|
import Section from '../Section'
|
|
14
11
|
|
|
@@ -36,16 +33,22 @@ const Hero = ({
|
|
|
36
33
|
title,
|
|
37
34
|
subtitle,
|
|
38
35
|
image,
|
|
39
|
-
variant
|
|
40
|
-
colorVariant
|
|
36
|
+
variant,
|
|
37
|
+
colorVariant,
|
|
41
38
|
icon,
|
|
42
39
|
}: HeroProps) => {
|
|
40
|
+
const {
|
|
41
|
+
Hero: HeroWrapper,
|
|
42
|
+
HeroImage,
|
|
43
|
+
HeroHeader,
|
|
44
|
+
} = useOverrideComponents<'Hero'>()
|
|
45
|
+
|
|
43
46
|
return (
|
|
44
47
|
<Section className={`${styles.section} section-hero`}>
|
|
45
48
|
<HeroWrapper.Component
|
|
46
49
|
{...HeroWrapper.props}
|
|
47
|
-
variant={variant}
|
|
48
|
-
colorVariant={colorVariant}
|
|
50
|
+
variant={variant ?? HeroWrapper.props.variant ?? 'primary'}
|
|
51
|
+
colorVariant={colorVariant ?? HeroWrapper.props.colorVariant ?? 'main'}
|
|
49
52
|
>
|
|
50
53
|
<HeroImage.Component {...HeroImage.props}>
|
|
51
54
|
<Image
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { override } from 'src/customizations/src/components/overrides/Hero'
|
|
2
|
+
import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
|
|
3
|
+
import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This component exists to support overrides 1.0
|
|
7
|
+
*
|
|
8
|
+
* This allows users to override the default Hero section present in the Headless CMS
|
|
9
|
+
*/
|
|
10
|
+
export const OverriddenDefaultHero = getOverriddenSection(
|
|
11
|
+
override as SectionOverrideDefinition<'Hero'>
|
|
12
|
+
)
|
|
@@ -4,21 +4,35 @@ import {
|
|
|
4
4
|
EmptyState as UIEmptyState,
|
|
5
5
|
} from '@faststore/ui'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export interface EmptyGalleryProps {
|
|
8
|
+
title?: string
|
|
9
|
+
firstButton?: {
|
|
10
|
+
label: string
|
|
11
|
+
url: string
|
|
12
|
+
icon: string
|
|
13
|
+
}
|
|
14
|
+
secondButton?: {
|
|
15
|
+
label: string
|
|
16
|
+
url: string
|
|
17
|
+
icon: string
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function EmptyGallery({ title, firstButton, secondButton }: EmptyGalleryProps) {
|
|
8
22
|
return (
|
|
9
23
|
<UIEmptyState
|
|
10
24
|
variant="rounded"
|
|
11
|
-
title=
|
|
25
|
+
title={title ?? 'Nothing matches with your search'}
|
|
12
26
|
titleIcon={
|
|
13
27
|
<UIIcon name="CircleWavyWarning" width={56} height={56} weight="thin" />
|
|
14
28
|
}
|
|
15
29
|
>
|
|
16
30
|
<UILinkButton
|
|
17
|
-
href=
|
|
31
|
+
href={firstButton?.url ?? '/office'}
|
|
18
32
|
variant="secondary"
|
|
19
33
|
icon={
|
|
20
34
|
<UIIcon
|
|
21
|
-
name=
|
|
35
|
+
name={firstButton?.icon ?? 'CircleWavyWarning'}
|
|
22
36
|
width={18}
|
|
23
37
|
height={18}
|
|
24
38
|
weight="bold"
|
|
@@ -26,17 +40,22 @@ function EmptyGallery() {
|
|
|
26
40
|
}
|
|
27
41
|
iconPosition="left"
|
|
28
42
|
>
|
|
29
|
-
Browse Offers
|
|
43
|
+
{firstButton?.label ?? 'Browse Offers'}
|
|
30
44
|
</UILinkButton>
|
|
31
45
|
<UILinkButton
|
|
32
|
-
href=
|
|
46
|
+
href={secondButton?.url ?? '/technology'}
|
|
33
47
|
variant="secondary"
|
|
34
48
|
icon={
|
|
35
|
-
<UIIcon
|
|
49
|
+
<UIIcon
|
|
50
|
+
name={secondButton?.icon ?? 'RocketLaunch'}
|
|
51
|
+
width={18}
|
|
52
|
+
height={18}
|
|
53
|
+
weight="bold"
|
|
54
|
+
/>
|
|
36
55
|
}
|
|
37
56
|
iconPosition="left"
|
|
38
57
|
>
|
|
39
|
-
Just Arrived
|
|
58
|
+
{secondButton?.label ?? 'Just Arrived'}
|
|
40
59
|
</UILinkButton>
|
|
41
60
|
</UIEmptyState>
|
|
42
61
|
)
|
|
@@ -4,6 +4,7 @@ import ProductGallery, {
|
|
|
4
4
|
ProductGalleryProps,
|
|
5
5
|
} from 'src/components/ui/ProductGallery/ProductGallery'
|
|
6
6
|
import Section from '../Section'
|
|
7
|
+
import type { EmptyGalleryProps } from './EmptyGallery'
|
|
7
8
|
|
|
8
9
|
import { __experimentalEmptyGallery as EmptyGallery } from 'src/components/sections/ProductGallery/Overrides'
|
|
9
10
|
|
|
@@ -25,9 +26,13 @@ export interface ProductGallerySectionProps {
|
|
|
25
26
|
loadMorePageButton?: ProductGalleryProps['loadMorePageButton']
|
|
26
27
|
sortBySelector?: ProductGalleryProps['sortBySelector']
|
|
27
28
|
productCard?: ProductGalleryProps['productCard']
|
|
29
|
+
emptyGallery?: EmptyGalleryProps
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
function ProductGallerySection({
|
|
32
|
+
function ProductGallerySection({
|
|
33
|
+
emptyGallery,
|
|
34
|
+
...otherProps
|
|
35
|
+
}: ProductGallerySectionProps) {
|
|
31
36
|
const context = usePage<SearchPageContext | PLPContext>()
|
|
32
37
|
const [title, searchTerm] = isSearchPage(context)
|
|
33
38
|
? [context?.data?.title, context?.data?.searchTerm]
|
|
@@ -41,7 +46,7 @@ function ProductGallerySection({ ...otherProps }: ProductGallerySectionProps) {
|
|
|
41
46
|
return (
|
|
42
47
|
<Section className={`${styles.section} section-product-gallery`}>
|
|
43
48
|
<section data-testid="product-gallery" data-fs-product-listing>
|
|
44
|
-
<EmptyGallery.Component />
|
|
49
|
+
<EmptyGallery.Component {...emptyGallery} />
|
|
45
50
|
</section>
|
|
46
51
|
</Section>
|
|
47
52
|
)
|
|
@@ -4,7 +4,7 @@ import type { Locator } from '@vtex/client-cms'
|
|
|
4
4
|
|
|
5
5
|
import MissingContentError from 'src/sdk/error/MissingContentError/MissingContentError'
|
|
6
6
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
7
|
-
import Hero from 'src/components/sections/Hero'
|
|
7
|
+
import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
|
|
8
8
|
import Incentives from 'src/components/sections/Incentives'
|
|
9
9
|
import ProductShelf from 'src/components/sections/ProductShelf'
|
|
10
10
|
import ProductTiles from 'src/components/sections/ProductTiles'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ServerCollectionPageQueryQuery } from '@generated/graphql'
|
|
2
2
|
import Breadcrumb from 'src/components/sections/Breadcrumb'
|
|
3
|
-
import Hero from 'src/components/sections/Hero'
|
|
3
|
+
import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
|
|
4
4
|
import ProductGallery from 'src/components/sections/ProductGallery'
|
|
5
5
|
import ProductShelf from 'src/components/sections/ProductShelf'
|
|
6
6
|
import ScrollToTopButton from 'src/components/sections/ScrollToTopButton'
|
package/src/pages/index.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import type { ComponentType } from 'react'
|
|
|
5
5
|
|
|
6
6
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
7
7
|
import BannerText from 'src/components/sections/BannerText'
|
|
8
|
-
import Hero from 'src/components/sections/Hero'
|
|
8
|
+
import { OverriddenDefaultHero as Hero } from 'src/components/sections/Hero/OverriddenDefaultHero'
|
|
9
9
|
import Incentives from 'src/components/sections/Incentives'
|
|
10
10
|
import Newsletter from 'src/components/sections/Newsletter'
|
|
11
11
|
import ProductShelf from 'src/components/sections/ProductShelf'
|
|
@@ -21,8 +21,7 @@ function createOverriddenSection<
|
|
|
21
21
|
sectionOverrides,
|
|
22
22
|
className,
|
|
23
23
|
}: {
|
|
24
|
-
|
|
25
|
-
Section: ComponentType<ComponentProps<(typeof Sections)[SectionName]>>
|
|
24
|
+
Section: (typeof Sections)[SectionName]
|
|
26
25
|
sectionOverrides: OverriddenComponents<SectionName>
|
|
27
26
|
className?: string
|
|
28
27
|
}) {
|
|
@@ -31,9 +30,12 @@ function createOverriddenSection<
|
|
|
31
30
|
return function OverriddenSection(
|
|
32
31
|
props: React.ComponentProps<typeof Section>
|
|
33
32
|
) {
|
|
33
|
+
/** This type wizardry is here because the props won't behave correctly if nothing is done */
|
|
34
|
+
const SectionComponent = Section as ComponentType<typeof props>
|
|
35
|
+
|
|
34
36
|
return (
|
|
35
37
|
<OverrideProvider value={overrideContextValue}>
|
|
36
|
-
<
|
|
38
|
+
<SectionComponent {...props} />
|
|
37
39
|
</OverrideProvider>
|
|
38
40
|
)
|
|
39
41
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import Alert from '../../components/sections/Alert'
|
|
2
|
+
import Hero from '../../components/sections/Hero'
|
|
2
3
|
|
|
3
4
|
import type { DefaultSectionComponentsDefinitions } from '../../typings/overridesDefinition'
|
|
4
5
|
import type { SectionsOverrides } from '../../typings/overrides'
|
|
5
6
|
import { AlertDefaultComponents } from '../../components/sections/Alert/DefaultComponents'
|
|
7
|
+
import { HeroDefaultComponents } from '../../components/sections/Hero/DefaultComponents'
|
|
6
8
|
|
|
7
9
|
export const Sections = {
|
|
8
10
|
Alert,
|
|
11
|
+
Hero,
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export const DefaultComponents: Partial<
|
|
@@ -15,4 +18,5 @@ export const DefaultComponents: Partial<
|
|
|
15
18
|
>
|
|
16
19
|
> = {
|
|
17
20
|
Alert: AlertDefaultComponents,
|
|
21
|
+
Hero: HeroDefaultComponents,
|
|
18
22
|
}
|
package/src/typings/overrides.ts
CHANGED
|
@@ -47,7 +47,7 @@ export type SectionOverride = {
|
|
|
47
47
|
}[keyof SectionsOverrides]
|
|
48
48
|
|
|
49
49
|
/** TODO: every use of this type should be replaced by SectionsOverrides after all sections are supported */
|
|
50
|
-
export type SupportedSectionsOverridesV2 = Pick<SectionsOverrides, 'Alert'>
|
|
50
|
+
export type SupportedSectionsOverridesV2 = Pick<SectionsOverrides, 'Alert' | 'Hero'>
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Originally, these types were defined in their respective Overrides file
|