@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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.1.0
|
|
2
|
+
> @faststore/core@4.1.0 generate /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> pnpm run gen-types && pnpm run cache-graphql
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@4.1.0
|
|
6
|
+
> @faststore/core@4.1.0 gen-types /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> node ../cli/bin/run generate-types .
|
|
8
8
|
|
|
9
9
|
[33m[STARTED][39m Parse Configuration
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
[32m[COMPLETED][39m Generate to /home/runner/work/faststore/faststore/packages/core/@generated/
|
|
20
20
|
[32m[COMPLETED][39m Generate outputs
|
|
21
21
|
|
|
22
|
-
> @faststore/core@4.1.0
|
|
22
|
+
> @faststore/core@4.1.0 cache-graphql /home/runner/work/faststore/faststore/packages/core
|
|
23
23
|
> node ../cli/bin/run cache-graphql --config=./discovery.config.default.js --queries=./@generated/persisted-documents.json
|
|
24
24
|
|
|
25
25
|
[Info] - Config file location: /home/runner/work/faststore/faststore/packages/core/discovery.config.default.js
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.1.0
|
|
2
|
+
> @faststore/core@4.1.0 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[46m RUN [49m[22m [36mv4.0.7 [39m[90m/home/runner/work/faststore/faststore/packages/core[39m
|
|
7
7
|
|
|
8
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 75[2mms[22m[39m
|
|
9
8
|
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
10
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
9
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 135[2mms[22m[39m
|
|
10
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
11
11
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
12
12
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
13
13
|
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:119:27[90m)[39m
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:353:23)
|
|
16
16
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
17
17
|
|
|
18
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 56[2mms[22m[39m
|
|
19
18
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
20
19
|
[22m[39mError in optimistic validation: ReferenceError: Cannot access '__vite_ssr_import_4__' before initialization
|
|
21
20
|
at getSettings [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/localization/useLocalizationConfig.tsx:126:45[90m)[39m
|
|
@@ -24,25 +23,26 @@
|
|
|
24
23
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:353:23)
|
|
25
24
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
26
25
|
|
|
27
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
28
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
29
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m
|
|
30
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
31
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
32
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
33
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/
|
|
34
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
35
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
36
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
37
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
38
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
39
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[
|
|
40
|
-
|
|
41
|
-
[33m[2m✓[22m[39m should
|
|
42
|
-
[33m[2m✓[22m[39m should
|
|
26
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
27
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
28
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
29
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 143[2mms[22m[39m
|
|
30
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
31
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/clearCookies.test.ts [2m([22m[2m20 tests[22m[2m)[22m[32m 122[2mms[22m[39m
|
|
32
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
33
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
34
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
35
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getRequestHostname.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 24[2mms[22m[39m
|
|
36
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
37
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/preview.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 23[2mms[22m[39m
|
|
38
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/index.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
39
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 2005[2mms[22m[39m
|
|
40
|
+
[33m[2m✓[22m[39m should return a valid merged GraphQL schema [33m 454[2mms[22m[39m
|
|
41
|
+
[33m[2m✓[22m[39m should exist with its plugins [33m 661[2mms[22m[39m
|
|
42
|
+
[33m[2m✓[22m[39m should handle options and execute [33m 873[2mms[22m[39m
|
|
43
43
|
|
|
44
44
|
[2m Test Files [22m [1m[32m17 passed[39m[22m[90m (17)[39m
|
|
45
45
|
[2m Tests [22m [1m[32m203 passed[39m[22m[90m (203)[39m
|
|
46
|
-
[2m Start at [22m
|
|
47
|
-
[2m Duration [22m
|
|
46
|
+
[2m Start at [22m 20:15:35
|
|
47
|
+
[2m Duration [22m 15.13s[2m (transform 6.49s, setup 0ms, collect 17.30s, tests 2.69s, environment 9.54s, prepare 716ms)[22m
|
|
48
48
|
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# AGENTS.md — `@faststore/core`
|
|
2
|
+
|
|
3
|
+
> Inherits from [`/AGENTS.md`](../../AGENTS.md) (root). This file adds context specific to `@faststore/core`.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
`@faststore/core` is the **integration layer** that orchestrates all packages. It is a Next.js application acting as the reference implementation and starter template for FastStore stores.
|
|
8
|
+
|
|
9
|
+
## Tech
|
|
10
|
+
|
|
11
|
+
- Next.js 16 (SSR/SSG)
|
|
12
|
+
- React 18.2
|
|
13
|
+
- GraphQL via `@faststore/api`
|
|
14
|
+
- SCSS Modules for component styles
|
|
15
|
+
|
|
16
|
+
## Key Directories
|
|
17
|
+
|
|
18
|
+
- `src/components/` — application components grouped by domain (`account`, `cart`, `cms`, `localization`, `navigation`, `product`, `region`, `search`, `sections`, `templates`, `ui`)
|
|
19
|
+
- `src/pages/` — Next.js file-based routing
|
|
20
|
+
- `src/sdk/` — store-level SDK logic and hooks
|
|
21
|
+
- `src/server/` — server-side utilities
|
|
22
|
+
- `src/customizations/` — store-specific overrides
|
|
23
|
+
- `src/experimental/` — experimental features
|
|
24
|
+
- `cms/faststore/` — CMS configuration (`sections.json`, `base.jsonc`, `content-types.json`)
|
|
25
|
+
- `@generated/` — auto-generated GraphQL types (DO NOT edit)
|
|
26
|
+
- `api/` — GraphQL handler setup
|
|
27
|
+
- `cypress/` — E2E tests
|
|
28
|
+
|
|
29
|
+
## Key Files
|
|
30
|
+
|
|
31
|
+
- `next.config.js` — Next.js configuration
|
|
32
|
+
- `discovery.config.default.js` / `discovery.config.js` — store routing/discovery
|
|
33
|
+
- `codegen.ts` — GraphQL code generation config
|
|
34
|
+
- `cms/faststore/sections.json` — CMS sections definition (~2700 lines)
|
|
35
|
+
- `src/Layout.tsx` — main layout
|
|
36
|
+
- `src/constants.ts` — app constants
|
|
37
|
+
- `vtex.env` — platform env file
|
|
38
|
+
- `lighthouserc.js` — Lighthouse CI config
|
|
39
|
+
- `next-seo.config.ts` — SEO defaults
|
|
40
|
+
|
|
41
|
+
## Common Patterns
|
|
42
|
+
|
|
43
|
+
### Section/Page component with SCSS Modules
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
// src/components/sections/MySection/MySection.tsx
|
|
47
|
+
import styles from './my-section.module.scss'
|
|
48
|
+
|
|
49
|
+
export interface MySectionProps {
|
|
50
|
+
title: string
|
|
51
|
+
buyButton: { label: string }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function MySection({ title, buyButton }: MySectionProps) {
|
|
55
|
+
return (
|
|
56
|
+
<Section className={styles.section}>
|
|
57
|
+
{/* JSX using library components */}
|
|
58
|
+
</Section>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default MySection
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Composing with library components
|
|
66
|
+
|
|
67
|
+
Import from `@faststore/ui` and alias with `UI` prefix to avoid local name collisions:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import {
|
|
71
|
+
Accordion as UIAccordion,
|
|
72
|
+
AccordionButton as UIAccordionButton,
|
|
73
|
+
AccordionItem as UIAccordionItem,
|
|
74
|
+
AccordionPanel as UIAccordionPanel,
|
|
75
|
+
} from '@faststore/ui'
|
|
76
|
+
|
|
77
|
+
function ProductDescription({ descriptionData }: Props) {
|
|
78
|
+
return (
|
|
79
|
+
<UIAccordion>
|
|
80
|
+
<UIAccordionItem>
|
|
81
|
+
<UIAccordionButton>Title</UIAccordionButton>
|
|
82
|
+
<UIAccordionPanel>Content</UIAccordionPanel>
|
|
83
|
+
</UIAccordionItem>
|
|
84
|
+
</UIAccordion>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Analytics events
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { sendAnalyticsEvent } from '@faststore/sdk'
|
|
93
|
+
|
|
94
|
+
sendAnalyticsEvent({
|
|
95
|
+
name: 'event_name',
|
|
96
|
+
params: {
|
|
97
|
+
/* event data */
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Common Tasks
|
|
103
|
+
|
|
104
|
+
### Adding a section
|
|
105
|
+
|
|
106
|
+
1. Create component under `src/components/sections/MySection/` (SCSS Modules).
|
|
107
|
+
2. Compose with `@faststore/ui` components.
|
|
108
|
+
3. Add the section definition to `cms/faststore/sections.json` (props, schema, defaults).
|
|
109
|
+
4. Export from the section folder's `index.ts`.
|
|
110
|
+
|
|
111
|
+
### Adding a page
|
|
112
|
+
|
|
113
|
+
1. Create file under `src/pages/` (e.g. `product/[slug].tsx`).
|
|
114
|
+
2. Use Next.js conventions (`getStaticProps`, `getServerSideProps`).
|
|
115
|
+
3. Compose with sections and components.
|
|
116
|
+
|
|
117
|
+
### Adding a store-specific UI component
|
|
118
|
+
|
|
119
|
+
1. Place under `src/components/ui/` or `src/components/sections/`.
|
|
120
|
+
2. Create `*.module.scss` alongside the component.
|
|
121
|
+
3. Compose library components from `@faststore/ui`.
|
|
122
|
+
|
|
123
|
+
### Updating styles
|
|
124
|
+
|
|
125
|
+
- For core/sections: edit the `.module.scss` next to the component.
|
|
126
|
+
- For library tokens: edit `packages/ui/src/styles/`.
|
|
127
|
+
|
|
128
|
+
### Managing SVG icons
|
|
129
|
+
|
|
130
|
+
Icons are loaded from a single sprite at `public/icons.svg` via the `Icon` component from `@faststore/ui`.
|
|
131
|
+
|
|
132
|
+
1. Open `public/icons.svg` and add a new `<symbol>` with a unique `id`
|
|
133
|
+
2. Remove `fill`, `stroke-width`, `width`, `height`, and `color` attributes from the symbol so it can be styled via CSS
|
|
134
|
+
3. Use the icon in any component:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { Icon } from '@faststore/ui'
|
|
138
|
+
|
|
139
|
+
;<Icon name="Bell" weight="thin" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
This project uses icons from [Phosphor Icons](https://phosphoricons.com/).
|
|
143
|
+
|
|
144
|
+
## Tests
|
|
145
|
+
|
|
146
|
+
`@faststore/core` separates tests by environment:
|
|
147
|
+
|
|
148
|
+
- **Node tests:** `*.test.{ts,tsx}` run in Node.
|
|
149
|
+
- **Browser tests:** `*.browser.test.{ts,tsx}` run in a browser-like environment.
|
|
150
|
+
|
|
151
|
+
Run:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cd packages/core
|
|
155
|
+
pnpm test # unit + integration
|
|
156
|
+
pnpm test:e2e # Cypress E2E
|
|
157
|
+
pnpm lhci # Lighthouse performance audit
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Generated Files (DO NOT EDIT)
|
|
161
|
+
|
|
162
|
+
- `@generated/` — GraphQL types
|
|
163
|
+
- `dist/` — build outputs
|
|
164
|
+
|
|
165
|
+
## Performance
|
|
166
|
+
|
|
167
|
+
`@faststore/core` MUST generate static pages using Jamstack principles for optimal TTFB and Core Web Vitals. Lighthouse CI gates apply. See root [Architectural Principles §II](../../AGENTS.md).
|
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,48 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.1.1-dev.0](https://github.com/vtex/faststore/compare/v4.1.0...v4.1.1-dev.0) (2026-05-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/core
|
|
9
|
+
|
|
6
10
|
# 4.1.0 (2026-05-11)
|
|
7
11
|
|
|
8
12
|
### Features
|
|
9
13
|
|
|
10
14
|
- version bump 4.1.0 ([#3310](https://github.com/vtex/faststore/issues/3310)) ([1ea7bac](https://github.com/vtex/faststore/commit/1ea7bac649d783e50a9e79f8fe412009ae4a87f7)), closes [#3309](https://github.com/vtex/faststore/issues/3309) [#3308](https://github.com/vtex/faststore/issues/3308) [#3306](https://github.com/vtex/faststore/issues/3306) [#3304](https://github.com/vtex/faststore/issues/3304) [#3301](https://github.com/vtex/faststore/issues/3301)
|
|
11
15
|
|
|
16
|
+
# [4.1.0-dev.8](https://github.com/vtex/faststore/compare/v4.1.0-dev.7...v4.1.0-dev.8) (2026-05-15)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @faststore/core
|
|
19
|
+
|
|
20
|
+
# [4.1.0-dev.7](https://github.com/vtex/faststore/compare/v4.1.0-dev.6...v4.1.0-dev.7) (2026-05-15)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @faststore/core
|
|
23
|
+
|
|
24
|
+
# [4.1.0-dev.6](https://github.com/vtex/faststore/compare/v4.1.0-dev.5...v4.1.0-dev.6) (2026-05-14)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @faststore/core
|
|
27
|
+
|
|
28
|
+
# [4.1.0-dev.5](https://github.com/vtex/faststore/compare/v4.1.0-dev.4...v4.1.0-dev.5) (2026-05-14)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
- region slider section render ([#3318](https://github.com/vtex/faststore/issues/3318)) ([f9f5e0d](https://github.com/vtex/faststore/commit/f9f5e0dbd6c3e92b24a3fb1e21a95bfb1c6744f1)), closes [#2887](https://github.com/vtex/faststore/issues/2887) [#2961](https://github.com/vtex/faststore/issues/2961) [#3071](https://github.com/vtex/faststore/issues/3071)
|
|
33
|
+
|
|
34
|
+
# [4.1.0-dev.4](https://github.com/vtex/faststore/compare/v4.1.0-dev.3...v4.1.0-dev.4) (2026-05-13)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @faststore/core
|
|
37
|
+
|
|
38
|
+
# [4.1.0-dev.3](https://github.com/vtex/faststore/compare/v4.1.0-dev.2...v4.1.0-dev.3) (2026-05-13)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @faststore/core
|
|
41
|
+
|
|
42
|
+
# [4.1.0-dev.2](https://github.com/vtex/faststore/compare/v4.1.0-dev.1...v4.1.0-dev.2) (2026-05-12)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- allow_all_components for CMS ([#3312](https://github.com/vtex/faststore/issues/3312)) ([eadeaa3](https://github.com/vtex/faststore/commit/eadeaa36782b40be0fe7fb16604f7a5bc3da2b79))
|
|
47
|
+
|
|
12
48
|
# [4.1.0-dev.1](https://github.com/vtex/faststore/compare/v4.1.0-dev.0...v4.1.0-dev.1) (2026-05-11)
|
|
13
49
|
|
|
14
50
|
**Note:** Version bump only for package @faststore/core
|