@faststore/core 4.1.0 → 4.1.1-dev.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/.turbo/turbo-generate.log +3 -3
- package/.turbo/turbo-test.log +22 -22
- package/AGENTS.md +167 -0
- package/CHANGELOG.md +36 -0
- package/README.md +108 -167
- package/cms/faststore/pages/cms_content_type__globalfootersections.jsonc +1 -59
- package/cms/faststore/pages/cms_content_type__globalheadersections.jsonc +1 -59
- package/cms/faststore/pages/cms_content_type__globalsections.jsonc +1 -59
- package/cms/faststore/pages/cms_content_type__home.jsonc +1 -59
- package/cms/faststore/pages/cms_content_type__landingpage.jsonc +1 -62
- package/cms/faststore/pages/cms_content_type__pdp.jsonc +1 -68
- package/cms/faststore/pages/cms_content_type__plp.jsonc +1 -68
- package/cms/faststore/pages/cms_content_type__search.jsonc +1 -68
- package/cms/faststore/schema.json +124 -644
- package/package.json +7 -7
- package/src/components/cms/RenderSections.tsx +38 -3
- package/vitest.config.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "4.1.0",
|
|
3
|
+
"version": "4.1.1-dev.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"idb-keyval": "^5.1.3",
|
|
60
60
|
"isomorphic-unfetch": "^3.1.0",
|
|
61
61
|
"lexical": "^0.34.0",
|
|
62
|
-
"next": "^16",
|
|
62
|
+
"next": "^16.2.6",
|
|
63
63
|
"next-seo": "^6.6.0",
|
|
64
64
|
"postcss": "^8.4.4",
|
|
65
65
|
"prettier": "^2.2.0",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"style-loader": "^3.3.1",
|
|
71
71
|
"swr": "^2.2.5",
|
|
72
72
|
"use-sync-external-store": "^1.6.0",
|
|
73
|
-
"@faststore/
|
|
74
|
-
"@faststore/
|
|
75
|
-
"@faststore/
|
|
76
|
-
"@faststore/
|
|
77
|
-
"@faststore/
|
|
73
|
+
"@faststore/lighthouse": "4.1.1-dev.0",
|
|
74
|
+
"@faststore/api": "4.1.1-dev.0",
|
|
75
|
+
"@faststore/diagnostics": "4.1.1-dev.0",
|
|
76
|
+
"@faststore/sdk": "4.1.1-dev.0",
|
|
77
|
+
"@faststore/ui": "4.1.1-dev.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@cypress/code-coverage": "^3.12.1",
|
|
@@ -23,7 +23,13 @@ interface Props {
|
|
|
23
23
|
isInteractive?: boolean
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const REGION_SLIDER_SECTION_NAME = 'RegionSlider'
|
|
27
|
+
|
|
28
|
+
const SECTIONS_OUT_OF_VIEWPORT = [
|
|
29
|
+
'CartSidebar',
|
|
30
|
+
'RegionModal',
|
|
31
|
+
REGION_SLIDER_SECTION_NAME,
|
|
32
|
+
]
|
|
27
33
|
|
|
28
34
|
/** Filter CMS metadata props so they are not passed to section components (and thus to the DOM). */
|
|
29
35
|
function getSectionProps(data: Record<string, unknown>) {
|
|
@@ -31,6 +37,30 @@ function getSectionProps(data: Record<string, unknown>) {
|
|
|
31
37
|
return sectionProps
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Ensure a RegionSlider section exists in the iteration. After PR #2961 the
|
|
42
|
+
* section was removed from `sections.json`, so CP-based stores (whose CP
|
|
43
|
+
* schemas were generated in PR #3071) and fresh hCMS stores no longer have it
|
|
44
|
+
* in their CMS content. The runtime still expects the section to flow through
|
|
45
|
+
* `RenderSections` so that `LazyLoadingSection` can gate the lazy import on
|
|
46
|
+
* `regionSlider.isOpen`. Inject the entry only if it is not already present in
|
|
47
|
+
* `sections` or `globalSections` to avoid double-rendering for legacy hCMS
|
|
48
|
+
* stores that have it persisted in their CMS.
|
|
49
|
+
*/
|
|
50
|
+
function withRegionSliderSection(
|
|
51
|
+
sections: Section[] | undefined,
|
|
52
|
+
globalSections: Section[] | undefined
|
|
53
|
+
): Section[] {
|
|
54
|
+
const base = sections ?? []
|
|
55
|
+
const isPresent =
|
|
56
|
+
base.some(({ name }) => name === REGION_SLIDER_SECTION_NAME) ||
|
|
57
|
+
globalSections?.some(({ name }) => name === REGION_SLIDER_SECTION_NAME)
|
|
58
|
+
|
|
59
|
+
if (isPresent) return base
|
|
60
|
+
|
|
61
|
+
return [...base, { name: REGION_SLIDER_SECTION_NAME, data: {} }]
|
|
62
|
+
}
|
|
63
|
+
|
|
34
64
|
const Toast = dynamic(
|
|
35
65
|
() => import(/* webpackChunkName: "Toast" */ '../common/Toast'),
|
|
36
66
|
{ ssr: false }
|
|
@@ -156,6 +186,11 @@ function RenderSections({
|
|
|
156
186
|
globalSections ?? sections
|
|
157
187
|
)
|
|
158
188
|
|
|
189
|
+
const augmentedSections = useMemo(
|
|
190
|
+
() => withRegionSliderSection(sections, globalSections),
|
|
191
|
+
[sections, globalSections]
|
|
192
|
+
)
|
|
193
|
+
|
|
159
194
|
const { isInteractive } = useTTI()
|
|
160
195
|
const router = useRouter()
|
|
161
196
|
|
|
@@ -178,9 +213,9 @@ function RenderSections({
|
|
|
178
213
|
isInteractive={isInteractive}
|
|
179
214
|
/>
|
|
180
215
|
)}
|
|
181
|
-
{
|
|
216
|
+
{augmentedSections.length > 0 && (
|
|
182
217
|
<RenderSectionsBase
|
|
183
|
-
sections={
|
|
218
|
+
sections={augmentedSections}
|
|
184
219
|
components={components}
|
|
185
220
|
isInteractive={isInteractive}
|
|
186
221
|
/>
|
package/vitest.config.ts
CHANGED
|
@@ -6,6 +6,21 @@ import { defineConfig } from 'vitest/config'
|
|
|
6
6
|
export default defineConfig({
|
|
7
7
|
test: {
|
|
8
8
|
globals: true,
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: 'v8',
|
|
11
|
+
reporter: ['text', 'lcov'],
|
|
12
|
+
reportsDirectory: './coverage',
|
|
13
|
+
include: ['src/**'],
|
|
14
|
+
exclude: [
|
|
15
|
+
'src/**/*.{test,spec}.{ts,tsx}',
|
|
16
|
+
'src/**/__tests__/**',
|
|
17
|
+
'src/**/*.d.ts',
|
|
18
|
+
'@generated/**',
|
|
19
|
+
'cypress/**',
|
|
20
|
+
'.next/**',
|
|
21
|
+
'dist/**',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
9
24
|
projects: [
|
|
10
25
|
{
|
|
11
26
|
extends: true,
|