@faststore/core 4.11.2 → 4.11.3-dev.1

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.
@@ -56,7 +56,6 @@ export type Scalars = {
56
56
  */
57
57
  FormattedVariants: { input: any; output: any; }
58
58
  JSONObject: { input: any; output: any; }
59
- /** A string or the string representation of an object (a stringified object). */
60
59
  ObjectOrString: { input: any; output: any; }
61
60
  /**
62
61
  * Example:
@@ -691,9 +691,6 @@ type Mutation {
691
691
  startRecommendationSession: Boolean!
692
692
  }
693
693
 
694
- """
695
- A string or the string representation of an object (a stringified object).
696
- """
697
694
  scalar ObjectOrString
698
695
 
699
696
  """Newsletter information."""
package/AGENTS.md CHANGED
@@ -141,6 +141,13 @@ import { Icon } from '@faststore/ui'
141
141
 
142
142
  This project uses icons from [Phosphor Icons](https://phosphoricons.com/).
143
143
 
144
+ ## Discovery config merge
145
+
146
+ `discovery.config.js` merges the default config with the store's through `mergeDiscoveryConfig` (`src/utils/mergeDiscoveryConfig.js`), which works like `deepmerge`: arrays are concatenated. The one exception is `api.subDomainPrefix`:
147
+
148
+ - Not set, or any non-empty value: appended to the default `['www']`, so `www.` is always stripped from the host sent to Checkout.
149
+ - `[]`: replaces the default, so no prefix is stripped and Checkout cookies are set on the storefront host (e.g. `www.store.com`) instead of the root domain. A Checkout served from another host (`secureSubdomain`) does not receive them, and `next.config.js` warns about that setup.
150
+
144
151
  ## Tests
145
152
 
146
153
  `@faststore/core` separates tests by environment:
package/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
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.11.3-dev.1](https://github.com/vtex/faststore/compare/v4.11.3-dev.0...v4.11.3-dev.1) (2026-11-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **core:** fetch Content Platform list content inline and skip PDP slug lookup ([#3551](https://github.com/vtex/faststore/issues/3551)) ([75ce26d](https://github.com/vtex/faststore/commit/75ce26dfda99447db1672b54c89cc67e87c87121)), closes [#3550](https://github.com/vtex/faststore/issues/3550) [#3550](https://github.com/vtex/faststore/issues/3550)
11
+
12
+ ## [4.11.3-dev.0](https://github.com/vtex/faststore/compare/v4.11.2...v4.11.3-dev.0) (2026-11-09)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **core:** let the store config override api.subDomainPrefix ([e0eeb07](https://github.com/vtex/faststore/commit/e0eeb0754b5ad75e20b3fe1ef0e16d3acb5f5b3b))
17
+ - **core:** move the subDomainPrefix warning to its own module ([cad5c20](https://github.com/vtex/faststore/commit/cad5c2084e335e7ec1e3404c6a078bd875949f86))
18
+ - **core:** only let an empty subDomainPrefix replace the default ([e2c0c0d](https://github.com/vtex/faststore/commit/e2c0c0d1d5e5c81ed149da9adcc9b3d8cc8a2c30))
19
+ - **core:** scope the subDomainPrefix override to api and warn on invalid URLs ([2f0e027](https://github.com/vtex/faststore/commit/2f0e0276f8d2bcd61a5047652ea6529ef127bdb9))
20
+ - **core:** use a Set for the overridden discovery config keys ([1d74a1e](https://github.com/vtex/faststore/commit/1d74a1eb4bf42f5e1dc85b851fecb534498c060e))
21
+
22
+ ## [4.11.2-dev.1](https://github.com/vtex/faststore/compare/v4.11.2-dev.0...v4.11.2-dev.1) (2026-11-05)
23
+
24
+ ## [4.11.2-dev.0](https://github.com/vtex/faststore/compare/v4.11.1...v4.11.2-dev.0) (2026-11-05)
25
+
26
+ ## [4.11.1-dev.1](https://github.com/vtex/faststore/compare/v4.11.1-dev.0...v4.11.1-dev.1) (2026-11-04)
27
+
28
+ ### Bug Fixes
29
+
30
+ - **api:** apply [@auth](https://github.com/auth) and [@cache](https://github.com/cache)Control to store schema extensions ([#3524](https://github.com/vtex/faststore/issues/3524)) ([f6abd0d](https://github.com/vtex/faststore/commit/f6abd0d4f7312794a4195ce693526b539550275e)), closes [#3111](https://github.com/vtex/faststore/issues/3111) [/github.com/vtex/faststore/pull/3524#issuecomment-6258456970](https://github.com//github.com/vtex/faststore/pull/3524/issues/issuecomment-6258456970) [#3111](https://github.com/vtex/faststore/issues/3111) [#3063](https://github.com/vtex/faststore/issues/3063)
31
+
32
+ ## [4.11.1-dev.0](https://github.com/vtex/faststore/compare/v4.11.0...v4.11.1-dev.0) (2026-11-03)
33
+
34
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
35
+
36
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
37
+
38
+ ## [4.11.2-dev.1](https://github.com/vtex/faststore/compare/v4.11.2-dev.0...v4.11.2-dev.1) (2026-11-05)
39
+
6
40
  ## [4.11.2](https://github.com/vtex/faststore/compare/v4.11.1...v4.11.2) (2026-11-09)
7
41
 
8
42
  **Note:** Version bump only for package @faststore/core
@@ -11,6 +45,42 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
45
 
12
46
  **Note:** Version bump only for package @faststore/core
13
47
 
48
+ ## [4.11.2-dev.0](https://github.com/vtex/faststore/compare/v4.11.1...v4.11.2-dev.0) (2026-11-05)
49
+
50
+ ## [4.11.1-dev.1](https://github.com/vtex/faststore/compare/v4.11.1-dev.0...v4.11.1-dev.1) (2026-11-04)
51
+
52
+ ### Bug Fixes
53
+
54
+ - **api:** apply [@auth](https://github.com/auth) and [@cache](https://github.com/cache)Control to store schema extensions ([#3524](https://github.com/vtex/faststore/issues/3524)) ([f6abd0d](https://github.com/vtex/faststore/commit/f6abd0d4f7312794a4195ce693526b539550275e)), closes [#3111](https://github.com/vtex/faststore/issues/3111) [/github.com/vtex/faststore/pull/3524#issuecomment-6258456970](https://github.com//github.com/vtex/faststore/pull/3524/issues/issuecomment-6258456970) [#3111](https://github.com/vtex/faststore/issues/3111) [#3063](https://github.com/vtex/faststore/issues/3063)
55
+
56
+ ## [4.11.1-dev.0](https://github.com/vtex/faststore/compare/v4.11.0...v4.11.1-dev.0) (2026-11-03)
57
+
58
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
59
+
60
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
61
+
62
+ ## [4.11.1-dev.1](https://github.com/vtex/faststore/compare/v4.11.1-dev.0...v4.11.1-dev.1) (2026-11-04)
63
+
64
+ ### Bug Fixes
65
+
66
+ - **api:** apply [@auth](https://github.com/auth) and [@cache](https://github.com/cache)Control to store schema extensions ([#3524](https://github.com/vtex/faststore/issues/3524)) ([f6abd0d](https://github.com/vtex/faststore/commit/f6abd0d4f7312794a4195ce693526b539550275e)), closes [#3111](https://github.com/vtex/faststore/issues/3111) [/github.com/vtex/faststore/pull/3524#issuecomment-6258456970](https://github.com//github.com/vtex/faststore/pull/3524/issues/issuecomment-6258456970) [#3111](https://github.com/vtex/faststore/issues/3111) [#3063](https://github.com/vtex/faststore/issues/3063)
67
+
68
+ ## [4.11.1-dev.0](https://github.com/vtex/faststore/compare/v4.11.0...v4.11.1-dev.0) (2026-11-03)
69
+
70
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
71
+
72
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
73
+
74
+ **Note:** Version bump only for package @faststore/core
75
+
76
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
77
+
78
+ **Note:** Version bump only for package @faststore/core
79
+
80
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
81
+
82
+ ## [4.11.1](https://github.com/vtex/faststore/compare/v4.11.0...v4.11.1) (2026-11-05)
83
+
14
84
  # [4.11.0](https://github.com/vtex/faststore/compare/v4.10.3...v4.11.0) (2026-11-03)
15
85
 
16
86
  ### Features
@@ -1,15 +1,18 @@
1
1
  const defaultConfig = require('./discovery.config.default')
2
2
  const starterConfig = require('./src/customizations/discovery.config')
3
3
 
4
- const deepmerge = require('deepmerge')
4
+ const { mergeDiscoveryConfig } = require('./src/utils/mergeDiscoveryConfig')
5
5
 
6
6
  /**
7
7
  * @type {typeof defaultConfig & Record<string, any>}
8
8
  * */
9
- let finalConfig = deepmerge(defaultConfig, starterConfig)
9
+ let finalConfig = mergeDiscoveryConfig(defaultConfig, starterConfig)
10
10
 
11
11
  try {
12
- finalConfig = deepmerge(finalConfig, require('./discovery.config.local'))
12
+ finalConfig = mergeDiscoveryConfig(
13
+ finalConfig,
14
+ require('./discovery.config.local')
15
+ )
13
16
  } catch (error) {
14
17
  if (error?.code !== 'MODULE_NOT_FOUND') {
15
18
  throw error
package/next.config.js CHANGED
@@ -1,5 +1,8 @@
1
1
  const path = require('node:path')
2
2
  const storeConfig = require('./discovery.config')
3
+ const {
4
+ getSubDomainPrefixWarning,
5
+ } = require('./src/utils/subDomainPrefixWarning')
3
6
  const { buildI18nDomains } = require('./scripts/i18n')
4
7
 
5
8
  // Load locales settings (generated by CLI during build)
@@ -16,6 +19,9 @@ console.log(`
16
19
  AccountID: ${storeConfig.api?.storeId ?? 'Unknown'}
17
20
  `)
18
21
 
22
+ const subDomainPrefixWarning = getSubDomainPrefixWarning(storeConfig)
23
+ if (subDomainPrefixWarning) console.warn(subDomainPrefixWarning)
24
+
19
25
  /**
20
26
  * @type {import('next').NextConfig}
21
27
  * */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "4.11.2",
3
+ "version": "4.11.3-dev.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "./experimental/server": "./src/experimental/server/index.ts"
16
16
  },
17
17
  "engines": {
18
- "node": ">=20"
18
+ "node": ">=20.9.0"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"
@@ -60,22 +60,21 @@
60
60
  "isomorphic-unfetch": "^3.1.0",
61
61
  "jose": "^6.2.3",
62
62
  "lexical": "^0.34.0",
63
- "next": "^16.2.6",
63
+ "next": "^16.4.3",
64
64
  "next-seo": "^6.6.0",
65
65
  "postcss": "^8.4.4",
66
66
  "prettier": "^2.2.0",
67
67
  "react-intersection-observer": "^8.32.5",
68
68
  "sass": "^1.97.0",
69
69
  "sass-loader": "^12.6.0",
70
- "sharp": "^0.32.6",
71
70
  "style-loader": "^3.3.1",
72
71
  "swr": "^2.2.5",
73
72
  "use-sync-external-store": "^1.6.0",
74
- "@faststore/diagnostics": "4.11.2",
75
- "@faststore/lighthouse": "4.11.2",
76
- "@faststore/sdk": "4.11.2",
77
- "@faststore/ui": "4.11.2",
78
- "@faststore/api": "4.11.2"
73
+ "@faststore/api": "4.11.3-dev.1",
74
+ "@faststore/lighthouse": "4.11.3-dev.1",
75
+ "@faststore/sdk": "4.11.3-dev.1",
76
+ "@faststore/ui": "4.11.3-dev.1",
77
+ "@faststore/diagnostics": "4.11.3-dev.1"
79
78
  },
80
79
  "devDependencies": {
81
80
  "@cypress/code-coverage": "^3.12.1",
@@ -98,9 +98,15 @@ export class ContentService {
98
98
  const options = this.createContentOptions(pdpParams)
99
99
 
100
100
  if (isContentPlatformSource()) {
101
- const directMatch = await this.getSingleContent<PDPContentType>(pdpParams)
102
- if (directMatch) {
103
- return directMatch
101
+ // PDP entries are templates picked by findBestPDPTemplate, never by the
102
+ // product slug, so a slug lookup always misses. Only previews and an
103
+ // explicit documentId need the direct fetch.
104
+ if (options.isPreview || pdpParams.documentId) {
105
+ const directMatch =
106
+ await this.getSingleContent<PDPContentType>(pdpParams)
107
+ if (directMatch) {
108
+ return directMatch
109
+ }
104
110
  }
105
111
 
106
112
  const pages = (await this.getMultipleContent(pdpParams)).data
@@ -141,14 +147,46 @@ export class ContentService {
141
147
  serviceParams: EntryPathParams,
142
148
  isPreview: boolean
143
149
  ): Promise<{ data: PageContentType[] }> {
144
- // TODO: This should be temporary until the cp data-plane have a search engine.
150
+ // Previews read from the control plane, which cannot return the content
151
+ // inline, so they still fetch each entry.
152
+ if (isPreview) {
153
+ const entries = await this.listAllPages(
154
+ (scroll) => this.clientCP.listEntries(serviceParams, scroll),
155
+ serviceParams
156
+ )
157
+ return this.fillEntriesWithData(entries, serviceParams, isPreview)
158
+ }
159
+
160
+ const entries = await this.listAllPages(
161
+ (scroll) => this.clientCP.listEntriesWithContent(serviceParams, scroll),
162
+ serviceParams
163
+ )
164
+ return {
165
+ // client-cp's listEntriesWithContent always sets `content`: a row the
166
+ // data plane returns without inline content is fetched by the client
167
+ // itself. The `PageContentType | EntryData` union is narrowed here since
168
+ // parsing is enabled (disableParse is not set).
169
+ data: entries.map(({ content, ...entry }) =>
170
+ this.mergeEntryWithData(entry, content as PageContentType)
171
+ ),
172
+ }
173
+ }
174
+
175
+ private async listAllPages<T>(
176
+ fetchPage: (
177
+ scroll?: string
178
+ ) => Promise<{ entries: T[]; scroll?: string | null }>,
179
+ serviceParams: EntryPathParams
180
+ ): Promise<T[]> {
181
+ // The data plane has no search engine yet, so every entry is listed and
182
+ // the template is matched here.
145
183
  const MAX_PAGES = 25
146
- const allEntries: ContentEntry[] = []
184
+ const allEntries: T[] = []
147
185
  let scroll: string | undefined
148
186
  let pages = 0
149
187
 
150
188
  do {
151
- const result = await this.clientCP.listEntries(serviceParams, scroll)
189
+ const result = await fetchPage(scroll)
152
190
  allEntries.push(...result.entries)
153
191
  const next = result.scroll ?? undefined
154
192
  if (next && next === scroll) break
@@ -156,10 +194,11 @@ export class ContentService {
156
194
  } while (scroll && ++pages < MAX_PAGES)
157
195
 
158
196
  if (pages >= MAX_PAGES) {
159
- console.warn('listEntries pagination hit MAX_PAGES cap', serviceParams)
197
+ // `listEntries` and `listEntriesWithContent` both paginate here.
198
+ console.warn('list pagination hit MAX_PAGES cap', serviceParams)
160
199
  }
161
200
 
162
- return this.fillEntriesWithData(allEntries, serviceParams, isPreview)
201
+ return allEntries
163
202
  }
164
203
 
165
204
  private async fillEntriesWithData(
@@ -15,6 +15,7 @@ import {
15
15
  GraphqlVtexContextFactory,
16
16
  GraphqlVtexSchema,
17
17
  isFastStoreError,
18
+ platformTypeDefs,
18
19
  } from '@faststore/api'
19
20
  import { OTELAPI } from '@faststore/diagnostics'
20
21
  import { loadFilesSync } from '@graphql-tools/load-files'
@@ -57,10 +58,11 @@ function loadGeneratedSchema(): TypeSource {
57
58
  }
58
59
 
59
60
  export function getFinalAPISchema() {
60
- const finalTypeDefs = mergeTypeDefs([
61
- GraphqlVtexSchema(),
62
- loadGeneratedSchema(),
63
- ])
61
+ // `platformTypeDefs` is the native SDL plus the directive definitions.
62
+ // Building `GraphqlVtexSchema()` here would run the transformers and throw
63
+ // the result away: this value is only merged as type definitions, and the
64
+ // call below applies the transformers once.
65
+ const finalTypeDefs = mergeTypeDefs([platformTypeDefs, loadGeneratedSchema()])
64
66
 
65
67
  const schema = makeExecutableSchema({
66
68
  typeDefs: finalTypeDefs,
@@ -0,0 +1,23 @@
1
+ const deepmerge = require('deepmerge')
2
+
3
+ /**
4
+ * Merges discovery configs like `deepmerge`, except that an empty
5
+ * `api.subDomainPrefix` replaces the default instead of being appended to it.
6
+ *
7
+ * deepmerge concatenates arrays, so the default `['www']` is always kept. An
8
+ * empty array is how a store asks for no prefix to be stripped from the host
9
+ * sent to Checkout. Any other value is still appended to the default, as
10
+ * before, to keep the current behavior of existing stores.
11
+ */
12
+ function mergeDiscoveryConfig(target, source) {
13
+ const merged = deepmerge(target, source)
14
+ const subDomainPrefix = source?.api?.subDomainPrefix
15
+
16
+ if (Array.isArray(subDomainPrefix) && subDomainPrefix.length === 0) {
17
+ merged.api.subDomainPrefix = []
18
+ }
19
+
20
+ return merged
21
+ }
22
+
23
+ module.exports = { mergeDiscoveryConfig }
@@ -0,0 +1,46 @@
1
+ const getHostname = (url) => {
2
+ try {
3
+ return new URL(url).hostname
4
+ } catch {
5
+ return undefined
6
+ }
7
+ }
8
+
9
+ /**
10
+ * With `api.subDomainPrefix: []`, Checkout cookies are set on the storefront
11
+ * host only, so a checkout served from another host (`secureSubdomain`) does
12
+ * not receive them. Returns a warning for that setup, or `undefined`.
13
+ */
14
+ function getSubDomainPrefixWarning(config) {
15
+ const prefixes = config?.api?.subDomainPrefix
16
+
17
+ if (!Array.isArray(prefixes) || prefixes.length > 0) {
18
+ return undefined
19
+ }
20
+
21
+ const invalidUrls = ['storeUrl', 'secureSubdomain'].filter(
22
+ (key) => config[key] && !getHostname(config[key])
23
+ )
24
+
25
+ if (invalidUrls.length > 0) {
26
+ return (
27
+ `[FastStore] api.subDomainPrefix is [], but ${invalidUrls.join(' and ')} could not be parsed as a URL, ` +
28
+ `so it was not possible to check where Checkout cookies are sent. Use a full URL (e.g. https://www.store.com).`
29
+ )
30
+ }
31
+
32
+ const storeHost = getHostname(config.storeUrl)
33
+ const secureHost = getHostname(config.secureSubdomain)
34
+
35
+ if (!storeHost || !secureHost || storeHost === secureHost) {
36
+ return undefined
37
+ }
38
+
39
+ return (
40
+ `[FastStore] api.subDomainPrefix is [], so Checkout cookies are set on ${storeHost} only ` +
41
+ `and are not sent to the secureSubdomain (${secureHost}). If the checkout runs on ${secureHost}, ` +
42
+ `remove api.subDomainPrefix or set it to the prefixes to strip (e.g. ['www']).`
43
+ )
44
+ }
45
+
46
+ module.exports = { getSubDomainPrefixWarning }