@graphcommerce/magento-store 10.0.0 → 10.0.1-canary.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.1-canary.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2571](https://github.com/graphcommerce-org/graphcommerce/pull/2571) [`d9c7545`](https://github.com/graphcommerce-org/graphcommerce/commit/d9c754570cd04da61ee3282bde465cc33395c8d9) - When switching stores unset the currency when there is no selection available for a given store. ([@paales](https://github.com/paales))
8
+
9
+ - [#2571](https://github.com/graphcommerce-org/graphcommerce/pull/2571) [`6d5ff59`](https://github.com/graphcommerce-org/graphcommerce/commit/6d5ff59090b5fe37bf053a2540fcf13150331a27) - Do not send an unacceptable store currency due to a configuration error and make sure the correct currency is stored. Show a StoreSwitcherFab on mobile. ([@paales](https://github.com/paales))
10
+
11
+ ## 10.0.1-canary.0
12
+
3
13
  ## 10.0.0
4
14
 
5
15
  ### Major Changes
@@ -120,288 +130,6 @@
120
130
 
121
131
  - [#2485](https://github.com/graphcommerce-org/graphcommerce/pull/2485) [`b0ec078`](https://github.com/graphcommerce-org/graphcommerce/commit/b0ec0784a0b3ca977598ded3777d23bc929072b0) - Added a CurrencySymbol component that renders the current currency symbol ([@paales](https://github.com/paales))
122
132
 
123
- ## 10.0.0-canary.72
124
-
125
- ## 10.0.0-canary.71
126
-
127
- ## 10.0.0-canary.70
128
-
129
- ### Major Changes
130
-
131
- - [#2565](https://github.com/graphcommerce-org/graphcommerce/pull/2565) [`c96dfcd`](https://github.com/graphcommerce-org/graphcommerce/commit/c96dfcdca981baca387c270ad9e2b9515cdd00cc) - Updated to Apollo Client 4 ([@paales](https://github.com/paales))
132
-
133
- ## 10.0.0-canary.69
134
-
135
- ## 10.0.0-canary.68
136
-
137
- ## 10.0.0-canary.67
138
-
139
- ## 10.0.0-canary.66
140
-
141
- ## 10.0.0-canary.65
142
-
143
- ## 10.0.0-canary.64
144
-
145
- ## 10.0.0-canary.63
146
-
147
- ## 10.0.0-canary.62
148
-
149
- ## 10.0.0-canary.61
150
-
151
- ## 10.0.0-canary.60
152
-
153
- ## 10.0.0-canary.59
154
-
155
- ## 10.0.0-canary.58
156
-
157
- ## 10.0.0-canary.57
158
-
159
- ## 10.0.0-canary.56
160
-
161
- ### Major Changes
162
-
163
- - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
164
-
165
- This major release brings full Turbopack compatibility, dramatically improving development speed.
166
-
167
- ### 🚀 Turbopack-Compatible Interceptor System
168
-
169
- The entire plugin/interceptor system has been rewritten to work with Turbopack:
170
-
171
- - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
172
- - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
173
- - **Direct imports** - Interceptors import from `.original` files instead of embedding source
174
- - **New CLI commands**:
175
- - `graphcommerce codegen-interceptors` - Generate interceptor files
176
- - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
177
- - **Stable file hashing** - Deterministic interceptor generation for better caching
178
-
179
- ### ⚙️ Treeshakable Configuration System
180
-
181
- Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
182
-
183
- - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
184
- - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
185
- - **Fully treeshakable** - Unused config values are eliminated from the bundle
186
- - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
187
- - **Separate files for nested objects** - Optimal treeshaking for complex configurations
188
-
189
- ### 🔧 withGraphCommerce Changes
190
-
191
- - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
192
- - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
193
- - **Removed** `@mui/*` alias rewrites - No longer required
194
- - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
195
- - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
196
- - **Added** `optimizePackageImports` for better bundle optimization
197
- - **Added** `images.qualities: [52, 75]` for Next.js image optimization
198
-
199
- ### 📦 Lingui Configuration
200
-
201
- - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
202
- - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
203
- - **Simplified** formatter options
204
-
205
- ### ⚛️ React 19 & Next.js 16 Compatibility
206
-
207
- - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
208
- - Replaced deprecated `React.VFC` with `React.FC`
209
- - Fixed `useRef` calls to require explicit initial values
210
- - Updated `MutableRefObject` usage in `framer-scroller`
211
-
212
- ### 📋 ESLint 9 Flat Config
213
-
214
- - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
215
- - Updated `@typescript-eslint/*` packages to v8
216
- - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
217
-
218
- ### 🔄 Apollo Client
219
-
220
- - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
221
- - Updated error handling types to accept `ApolloError | null | undefined`
222
-
223
- ### ⚠️ Breaking Changes
224
-
225
- - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
226
- - **Interceptor files changed** - Original components now at `.original.tsx`
227
- - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
228
- - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
229
- - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
230
-
231
- ### 🗑️ Removed
232
-
233
- - `InterceptorPlugin` webpack plugin
234
- - `configToImportMeta` utility
235
- - Webpack `DefinePlugin` usage for config
236
- - `@mui/*` modern alias rewrites
237
- - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
238
-
239
- ## 9.1.0-canary.55
240
-
241
- ## 9.1.0-canary.54
242
-
243
- ## 9.1.0-canary.53
244
-
245
- ## 9.1.0-canary.52
246
-
247
- ## 9.1.0-canary.51
248
-
249
- ### Minor Changes
250
-
251
- - [#2537](https://github.com/graphcommerce-org/graphcommerce/pull/2537) [`958dcb6`](https://github.com/graphcommerce-org/graphcommerce/commit/958dcb62d5abb3427a38e2a4583897f3e2043cc4) - Intoduce a new Product-`uid` to solve an issue where cache normalization was not working properly on the frontend when viewing products with a differen curreny, etc.
252
-
253
- Products now have a more detailed `uid` which will include the scope the product is retrieved from. For example: `NDg5MDM=?store=nl_NL&currencyCode=EUR`. This results in a better cache normalization in Apollo Client and allows for switching between scopes (store/currency/price views/accounts) without creating a broken cache state.
254
-
255
- We have implemented this with a new resolver that rewrites the `uid` passed from Magento to the Mesh Resolver, and additing additonal data to the `uid` based on the headers passed from the client. This also requires each package to implement the `getPrivateQueryContextMesh` method to retrieve the current PrivateQuery context from the GraphQL request headers. ([@paales](https://github.com/paales))
256
-
257
- ### Patch Changes
258
-
259
- - [#2537](https://github.com/graphcommerce-org/graphcommerce/pull/2537) [`31397f9`](https://github.com/graphcommerce-org/graphcommerce/commit/31397f9c5b2d85895d6e00732b2e3d7a99ffee53) - Solve issue where a magento store reference was added to the graphql-mesh package. ([@paales](https://github.com/paales))
260
-
261
- ## 9.1.0-canary.50
262
-
263
- ## 9.1.0-canary.49
264
-
265
- ## 9.1.0-canary.48
266
-
267
- ## 9.1.0-canary.47
268
-
269
- ## 9.1.0-canary.46
270
-
271
- ## 9.1.0-canary.45
272
-
273
- ## 9.1.0-canary.44
274
-
275
- ## 9.1.0-canary.43
276
-
277
- ## 9.1.0-canary.42
278
-
279
- ## 9.1.0-canary.41
280
-
281
- ### Patch Changes
282
-
283
- - [#2530](https://github.com/graphcommerce-org/graphcommerce/pull/2530) [`2075f33`](https://github.com/graphcommerce-org/graphcommerce/commit/2075f331eec38e894722d8ba4539d865f2db5507) - Support asNumber for Money component to easily render all prices as number ([@paales](https://github.com/paales))
284
-
285
- ## 9.1.0-canary.40
286
-
287
- ## 9.1.0-canary.39
288
-
289
- ## 9.1.0-canary.38
290
-
291
- ## 9.1.0-canary.37
292
-
293
- ## 9.1.0-canary.36
294
-
295
- ### Patch Changes
296
-
297
- - [`4c92400`](https://github.com/graphcommerce-org/graphcommerce/commit/4c92400733bb3764494298122771d5bd9bacd5a2) - Render prices with a narrowSymbol so users just see $ instead of US$ ([@paales](https://github.com/paales))
298
-
299
- - [`f0d244e`](https://github.com/graphcommerce-org/graphcommerce/commit/f0d244ef8625e9cd2fc08d8518f8afa1edb3d688) - Solve issue where the currency switcher would result in an additional query ([@paales](https://github.com/paales))
300
-
301
- ## 9.1.0-canary.35
302
-
303
- ### Patch Changes
304
-
305
- - [#2528](https://github.com/graphcommerce-org/graphcommerce/pull/2528) [`5a41fff`](https://github.com/graphcommerce-org/graphcommerce/commit/5a41fff74c38ed1f9793e48ec42cba71d1d539d1) - Use the default display currency instead of the base currency in case they differ from one another. ([@paales](https://github.com/paales))
306
-
307
- - [#2528](https://github.com/graphcommerce-org/graphcommerce/pull/2528) [`5a41fff`](https://github.com/graphcommerce-org/graphcommerce/commit/5a41fff74c38ed1f9793e48ec42cba71d1d539d1) - Store switcher now allows switching between currencies without navigating and just switches the @privateContext. ([@paales](https://github.com/paales))
308
-
309
- - [#2528](https://github.com/graphcommerce-org/graphcommerce/pull/2528) [`5a41fff`](https://github.com/graphcommerce-org/graphcommerce/commit/5a41fff74c38ed1f9793e48ec42cba71d1d539d1) - Added store switcher to the header and mobile navigation ([@paales](https://github.com/paales))
310
-
311
- ## 9.1.0-canary.34
312
-
313
- ## 9.1.0-canary.33
314
-
315
- ## 9.1.0-canary.32
316
-
317
- ## 9.1.0-canary.31
318
-
319
- ## 9.1.0-canary.30
320
-
321
- ## 9.1.0-canary.29
322
-
323
- ## 9.1.0-canary.28
324
-
325
- ## 9.1.0-canary.27
326
-
327
- ## 9.1.0-canary.26
328
-
329
- ## 9.1.0-canary.25
330
-
331
- ## 9.1.0-canary.24
332
-
333
- ## 9.1.0-canary.23
334
-
335
- ## 9.1.0-canary.22
336
-
337
- ### Patch Changes
338
-
339
- - [#2510](https://github.com/graphcommerce-org/graphcommerce/pull/2510) [`61a2e16`](https://github.com/graphcommerce-org/graphcommerce/commit/61a2e1641c75a0497406e70f2ab96c8e3f5bdd96) - Allow setting alternate store switcher URL ([@bramvanderholst](https://github.com/bramvanderholst))
340
-
341
- ## 9.1.0-canary.21
342
-
343
- ## 9.1.0-canary.20
344
-
345
- ## 9.1.0-canary.19
346
-
347
- ### Minor Changes
348
-
349
- - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`9f040a4`](https://github.com/graphcommerce-org/graphcommerce/commit/9f040a4c0947f05f2f27e4c5078a684b04e711e1) - Implemented the `query { attributesForm }` to be able to dynamically render forms with useAttributesForm/preloadAttributesForm and AttributesFormAutoLayout, and additional utilities to handle form submissions. ([@paales](https://github.com/paales))
350
-
351
- ### Patch Changes
352
-
353
- - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`798c122`](https://github.com/graphcommerce-org/graphcommerce/commit/798c12271e90cf0e02f021e7ad4aa088b4c7c2a3) - Use the `storeConfig.head_shortcut_icon` when configured, if not configured it will use the favicon.ico and favicon.svg from the public folder. ([@paales](https://github.com/paales))
354
-
355
- - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`6b2b44c`](https://github.com/graphcommerce-org/graphcommerce/commit/6b2b44ca853279144d7768067f3462d4d4bf0af1) - Created a new PriceModifiers component that is implemented on CartItems, allowing different product types to render their options in a consistent manner and allow rendering a base price so that the sum in the cart is correct. ([@paales](https://github.com/paales))
356
-
357
- ## 9.1.0-canary.18
358
-
359
- ## 9.1.0-canary.17
360
-
361
- ### Minor Changes
362
-
363
- - [#2496](https://github.com/graphcommerce-org/graphcommerce/pull/2496) [`4b6a65d`](https://github.com/graphcommerce-org/graphcommerce/commit/4b6a65db089d92492e7fde28a8e32bc41f5b9103) - Added support for multiple display currencies in the frontend. Multiple currencies were already supported, but this introduces Display Currencies for viewing the cart in different currencies. ([@paales](https://github.com/paales))
364
-
365
- - [#2496](https://github.com/graphcommerce-org/graphcommerce/pull/2496) [`4b6a65d`](https://github.com/graphcommerce-org/graphcommerce/commit/4b6a65db089d92492e7fde28a8e32bc41f5b9103) - Refactored the Store Selector to be more of a form and have multiple nested toggles to switch groups, then stores and then currencies. It automatically hides features that aren't used: If only a single group is used with multiple stores only the store selector is shown. If multiple groups are used with each a single store is used, only the group selector is shown. If only a single currency is used, there is no currency selector. If multiple currencies are used, the currency selector is shown. This makes the selector more user-friendly and less cluttered. ([@paales](https://github.com/paales))
366
-
367
- ## 9.1.0-canary.16
368
-
369
- ## 9.1.0-canary.15
370
-
371
- ## 9.0.4-canary.14
372
-
373
- ## 9.0.4-canary.13
374
-
375
- ## 9.0.4-canary.12
376
-
377
- ## 9.0.4-canary.11
378
-
379
- ### Patch Changes
380
-
381
- - [#2485](https://github.com/graphcommerce-org/graphcommerce/pull/2485) [`b0ec078`](https://github.com/graphcommerce-org/graphcommerce/commit/b0ec0784a0b3ca977598ded3777d23bc929072b0) - Added a CurrencySymbol component that renders the current currency symbol ([@paales](https://github.com/paales))
382
-
383
- ## 9.0.4-canary.10
384
-
385
- ## 9.0.4-canary.9
386
-
387
- ## 9.0.4-canary.8
388
-
389
- ## 9.0.4-canary.7
390
-
391
- ## 9.0.4-canary.6
392
-
393
- ## 9.0.4-canary.5
394
-
395
- ## 9.0.4-canary.4
396
-
397
- ## 9.0.4-canary.3
398
-
399
- ## 9.0.4-canary.2
400
-
401
- ## 9.0.4-canary.1
402
-
403
- ## 9.0.4-canary.0
404
-
405
133
  ## 9.0.1
406
134
 
407
135
  ### Patch Changes
@@ -52,10 +52,6 @@ export function StoreSwitcherStoreSelector(props: StoreSwitcherSelectorProps) {
52
52
  ),
53
53
  value: store.store_code,
54
54
  disabled: store.disabled,
55
- slotProps: {
56
- title: { sx: { typography: 'subtitle1' } },
57
- details: { sx: { typography: 'body1', color: 'text.secondary' } },
58
- },
59
55
  }))}
60
56
  {...actionCardProps}
61
57
  />
@@ -190,8 +190,12 @@ export function StoreSwitcherFormProvider(props: StoreSwitcherFormProviderProps)
190
190
  const formStore = context.stores.find((s) => s.store_code === formValues.storeCode)
191
191
  const isDefaultDisplayCurrency =
192
192
  formValues.currency === formStore?.default_display_currency_code
193
+ const isCurrencyAvailable = formStore?.currency?.available_currency_codes?.includes(
194
+ formValues.currency,
195
+ )
193
196
 
194
- if (isDefaultDisplayCurrency) cookie('Magento-Content-Currency', null)
197
+ // Clear cookie if using default currency or if the currency is not available for the target store
198
+ if (isDefaultDisplayCurrency || !isCurrencyAvailable) cookie('Magento-Content-Currency', null)
195
199
  else cookie('Magento-Content-Currency', formValues.currency)
196
200
 
197
201
  await onSubmit?.(formValues, event)
@@ -1,20 +1,24 @@
1
- import { iconLanguage, IconSvg, sxx } from '@graphcommerce/next-ui'
2
- import { Fab, type FabProps } from '@mui/material'
3
- import { StoreSwitcherText } from './StoreSwitcherText'
1
+ import type { FabProps } from '@graphcommerce/next-ui'
2
+ import { Fab, iconLanguage } from '@graphcommerce/next-ui'
4
3
  import { useShowStoreSwitcherButton } from './useStoreSwitcherButton'
5
4
 
6
- export function StoreSwitcherFab(props: FabProps) {
5
+ export type StoreSwitcherFabProps = Omit<FabProps, 'icon' | 'onClick'>
6
+
7
+ export function StoreSwitcherFab(props: StoreSwitcherFabProps) {
8
+ const { sx, ...fabProps } = props
7
9
  const { show, onClick } = useShowStoreSwitcherButton()
10
+
8
11
  if (!show) return null
9
12
 
10
13
  return (
11
14
  <Fab
12
- variant='extended'
15
+ color='inherit'
16
+ size='medium'
17
+ sx={sx}
18
+ icon={iconLanguage}
13
19
  onClick={onClick}
14
- sx={sxx({ width: 'max-content', columnGap: '3px', typography: 'body1' })}
15
- {...props}
16
- >
17
- <IconSvg src={iconLanguage} /> <StoreSwitcherText />
18
- </Fab>
20
+ slotProps={{ icon: { size: 'default' } }}
21
+ {...fabProps}
22
+ />
19
23
  )
20
24
  }
@@ -8,17 +8,23 @@ export function useShowStoreSwitcherButton(options?: Record<string, never>) {
8
8
  const country = config.data?.storeConfig?.locale?.split('_')?.[1]?.toLowerCase() ?? ''
9
9
  const router = useRouter()
10
10
  const multiLocale = (router.locales?.length ?? 0) > 1
11
- const multiCurrency =
12
- new Set(config.data?.storeConfig?.currency?.available_currency_codes ?? []).size > 1
11
+ const availableCurrencies = config.data?.storeConfig?.currency?.available_currency_codes ?? []
12
+ const multiCurrency = new Set(availableCurrencies).size > 1
13
13
 
14
- const [currency] = useCookie('Magento-Content-Currency')
14
+ const [cookieCurrency] = useCookie('Magento-Content-Currency')
15
+
16
+ // Validate cookie currency against available currencies
17
+ const currency =
18
+ cookieCurrency && availableCurrencies.includes(cookieCurrency)
19
+ ? cookieCurrency
20
+ : config.data?.storeConfig?.default_display_currency_code
15
21
 
16
22
  return {
17
23
  show: multiLocale || multiCurrency,
18
24
  multiCurrency,
19
25
  country,
20
26
  multiLocale,
21
- currency: currency ?? config.data?.storeConfig?.default_display_currency_code,
27
+ currency,
22
28
  storeName: config.data?.storeConfig?.store_name,
23
29
  onClick: () => router.push('/switch-stores'),
24
30
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-store",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.0.0",
5
+ "version": "10.0.1-canary.1",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,15 +19,15 @@
19
19
  "./mesh/resolvers.ts": "./mesh/resolvers.ts"
20
20
  },
21
21
  "peerDependencies": {
22
- "@graphcommerce/ecommerce-ui": "^10.0.0",
23
- "@graphcommerce/eslint-config-pwa": "^10.0.0",
24
- "@graphcommerce/framer-utils": "^10.0.0",
25
- "@graphcommerce/graphql": "^10.0.0",
26
- "@graphcommerce/graphql-mesh": "^10.0.0",
27
- "@graphcommerce/image": "^10.0.0",
28
- "@graphcommerce/next-ui": "^10.0.0",
29
- "@graphcommerce/prettier-config-pwa": "^10.0.0",
30
- "@graphcommerce/typescript-config-pwa": "^10.0.0",
22
+ "@graphcommerce/ecommerce-ui": "^10.0.1-canary.1",
23
+ "@graphcommerce/eslint-config-pwa": "^10.0.1-canary.1",
24
+ "@graphcommerce/framer-utils": "^10.0.1-canary.1",
25
+ "@graphcommerce/graphql": "^10.0.1-canary.1",
26
+ "@graphcommerce/graphql-mesh": "^10.0.1-canary.1",
27
+ "@graphcommerce/image": "^10.0.1-canary.1",
28
+ "@graphcommerce/next-ui": "^10.0.1-canary.1",
29
+ "@graphcommerce/prettier-config-pwa": "^10.0.1-canary.1",
30
+ "@graphcommerce/typescript-config-pwa": "^10.0.1-canary.1",
31
31
  "@lingui/core": "^5",
32
32
  "@lingui/macro": "^5",
33
33
  "@lingui/react": "^5",
@@ -1,6 +1,7 @@
1
1
  import { SetContextLink, type graphqlConfig as graphqlConfigType } from '@graphcommerce/graphql'
2
2
  import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
3
3
  import { cookie } from '@graphcommerce/next-ui'
4
+ import { StoreConfigDocument } from '../graphql/queries/StoreConfig.gql'
4
5
 
5
6
  export const config: PluginConfig = {
6
7
  type: 'function',
@@ -14,7 +15,7 @@ export const graphqlConfig: FunctionPlugin<typeof graphqlConfigType> = (prev, co
14
15
  ...results,
15
16
  links: [
16
17
  ...results.links,
17
- new SetContextLink((prevContext) => {
18
+ new SetContextLink((prevContext, operation) => {
18
19
  const headers: Record<string, string> = { ...prevContext.headers }
19
20
 
20
21
  if (!headers.store) {
@@ -22,8 +23,16 @@ export const graphqlConfig: FunctionPlugin<typeof graphqlConfigType> = (prev, co
22
23
  }
23
24
 
24
25
  const contentCurrency = cookie('Magento-Content-Currency')
25
- if (contentCurrency && typeof headers['content-currency'] === 'undefined')
26
- headers['content-currency'] = contentCurrency
26
+ if (contentCurrency && typeof headers['content-currency'] === 'undefined') {
27
+ // Validate currency against available currencies from StoreConfig cache
28
+ const storeConfig = operation.client.cache.readQuery({ query: StoreConfigDocument })
29
+ const availableCurrencies = storeConfig?.storeConfig?.currency?.available_currency_codes
30
+
31
+ if (!availableCurrencies || availableCurrencies.includes(contentCurrency)) {
32
+ headers['content-currency'] = contentCurrency
33
+ }
34
+ // If currency is not valid, don't set the header - backend will use default
35
+ }
27
36
 
28
37
  if (conf.preview) {
29
38
  // To disable caching from the backend, we provide a bogus cache ID.