@graphcommerce/algolia-products 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,17 @@
1
1
  # @graphcommerce/algolia-products
2
2
 
3
+ ## 10.0.1-canary.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2571](https://github.com/graphcommerce-org/graphcommerce/pull/2571) [`591fb82`](https://github.com/graphcommerce-org/graphcommerce/commit/591fb827b2db87dd138cf05e443089355e8883d1) - Make sure the default_display_currency_code is always fetched properly for Algolia ([@paales](https://github.com/paales))
8
+
9
+ ## 10.0.1-canary.0
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2568](https://github.com/graphcommerce-org/graphcommerce/pull/2568) [`f1b60ac`](https://github.com/graphcommerce-org/graphcommerce/commit/f1b60accf5e8fdbcba15b7567dce7ff68f37db88) - Solve issue where the cache wasn't available from the context anymore in @apollo/client@4 now uses the operation.client.cache ([@paales](https://github.com/paales))
14
+
3
15
  ## 10.0.0
4
16
 
5
17
  ### Major Changes
@@ -124,288 +136,6 @@
124
136
 
125
137
  - [`08f9883`](https://github.com/graphcommerce-org/graphcommerce/commit/08f98833019e726759194a3c1492052f2df052fa) - Correctly detect numeric values from the backend. ([@paales](https://github.com/paales))
126
138
 
127
- ## 10.0.0-canary.72
128
-
129
- ## 10.0.0-canary.71
130
-
131
- ## 10.0.0-canary.70
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
- ### Major Changes
148
-
149
- - [#2550](https://github.com/graphcommerce-org/graphcommerce/pull/2550) [`5d94c13`](https://github.com/graphcommerce-org/graphcommerce/commit/5d94c13c313546f00ee96c7b3db46e29bbe5185d) - Fix stock status mapping: use in_stock instead of is_stock in Algolia hit to Magento product conversion ([@davido-priority](https://github.com/davido-priority))
150
-
151
- ## 10.0.0-canary.62
152
-
153
- ## 10.0.0-canary.61
154
-
155
- ## 10.0.0-canary.60
156
-
157
- ## 10.0.0-canary.59
158
-
159
- ## 10.0.0-canary.58
160
-
161
- ## 10.0.0-canary.57
162
-
163
- ## 10.0.0-canary.56
164
-
165
- ### Major Changes
166
-
167
- - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
168
-
169
- This major release brings full Turbopack compatibility, dramatically improving development speed.
170
-
171
- ### 🚀 Turbopack-Compatible Interceptor System
172
-
173
- The entire plugin/interceptor system has been rewritten to work with Turbopack:
174
-
175
- - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
176
- - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
177
- - **Direct imports** - Interceptors import from `.original` files instead of embedding source
178
- - **New CLI commands**:
179
- - `graphcommerce codegen-interceptors` - Generate interceptor files
180
- - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
181
- - **Stable file hashing** - Deterministic interceptor generation for better caching
182
-
183
- ### ⚙️ Treeshakable Configuration System
184
-
185
- Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
186
-
187
- - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
188
- - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
189
- - **Fully treeshakable** - Unused config values are eliminated from the bundle
190
- - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
191
- - **Separate files for nested objects** - Optimal treeshaking for complex configurations
192
-
193
- ### 🔧 withGraphCommerce Changes
194
-
195
- - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
196
- - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
197
- - **Removed** `@mui/*` alias rewrites - No longer required
198
- - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
199
- - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
200
- - **Added** `optimizePackageImports` for better bundle optimization
201
- - **Added** `images.qualities: [52, 75]` for Next.js image optimization
202
-
203
- ### 📦 Lingui Configuration
204
-
205
- - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
206
- - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
207
- - **Simplified** formatter options
208
-
209
- ### ⚛️ React 19 & Next.js 16 Compatibility
210
-
211
- - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
212
- - Replaced deprecated `React.VFC` with `React.FC`
213
- - Fixed `useRef` calls to require explicit initial values
214
- - Updated `MutableRefObject` usage in `framer-scroller`
215
-
216
- ### 📋 ESLint 9 Flat Config
217
-
218
- - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
219
- - Updated `@typescript-eslint/*` packages to v8
220
- - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
221
-
222
- ### 🔄 Apollo Client
223
-
224
- - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
225
- - Updated error handling types to accept `ApolloError | null | undefined`
226
-
227
- ### ⚠️ Breaking Changes
228
-
229
- - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
230
- - **Interceptor files changed** - Original components now at `.original.tsx`
231
- - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
232
- - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
233
- - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
234
-
235
- ### 🗑️ Removed
236
-
237
- - `InterceptorPlugin` webpack plugin
238
- - `configToImportMeta` utility
239
- - Webpack `DefinePlugin` usage for config
240
- - `@mui/*` modern alias rewrites
241
- - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
242
-
243
- ## 9.1.0-canary.55
244
-
245
- ## 9.1.0-canary.54
246
-
247
- ## 9.1.0-canary.53
248
-
249
- ## 9.1.0-canary.52
250
-
251
- ## 9.1.0-canary.51
252
-
253
- ## 9.1.0-canary.50
254
-
255
- ## 9.1.0-canary.49
256
-
257
- ## 9.1.0-canary.48
258
-
259
- ## 9.1.0-canary.47
260
-
261
- ### Patch Changes
262
-
263
- - [`499b30c`](https://github.com/graphcommerce-org/graphcommerce/commit/499b30c275571a675b176e0c0397104b608ad0a0) - Updated used spec for API and expose the multi search endpoint. ([@paales](https://github.com/paales))
264
-
265
- ## 9.1.0-canary.46
266
-
267
- ## 9.1.0-canary.45
268
-
269
- ## 9.1.0-canary.44
270
-
271
- ## 9.1.0-canary.43
272
-
273
- ## 9.1.0-canary.42
274
-
275
- ## 9.1.0-canary.41
276
-
277
- ## 9.1.0-canary.40
278
-
279
- ## 9.1.0-canary.39
280
-
281
- ## 9.1.0-canary.38
282
-
283
- ### Patch Changes
284
-
285
- - [`a4de6ba`](https://github.com/graphcommerce-org/graphcommerce/commit/a4de6ba35d639fd6a7653463c2e26089d47842d0) - Solve issue where recommendations couldn't be retrieved ([@paales](https://github.com/paales))
286
-
287
- ## 9.1.0-canary.37
288
-
289
- ## 9.1.0-canary.36
290
-
291
- ### Patch Changes
292
-
293
- - [`90e8850`](https://github.com/graphcommerce-org/graphcommerce/commit/90e885059b0203a8802e5ab753ac061b079ebcd6) - Support multiple currency displays from algolia ([@paales](https://github.com/paales))
294
-
295
- ## 9.1.0-canary.35
296
-
297
- ## 9.1.0-canary.34
298
-
299
- ### Patch Changes
300
-
301
- - [`08f9883`](https://github.com/graphcommerce-org/graphcommerce/commit/08f98833019e726759194a3c1492052f2df052fa) - Correctly detect numeric values from the backend. ([@paales](https://github.com/paales))
302
-
303
- ## 9.1.0-canary.33
304
-
305
- ## 9.1.0-canary.32
306
-
307
- ### Patch Changes
308
-
309
- - [#2516](https://github.com/graphcommerce-org/graphcommerce/pull/2516) [`edd9be6`](https://github.com/graphcommerce-org/graphcommerce/commit/edd9be6cbb37e7da99cc2e74ac269f0b7ddfaaaa) - feat(GCOM-1585): normalize input values from Algolia to schema compliant values ([@FrankHarland](https://github.com/FrankHarland))
310
-
311
- ## 9.1.0-canary.31
312
-
313
- ## 9.1.0-canary.30
314
-
315
- ## 9.1.0-canary.29
316
-
317
- ### Minor Changes
318
-
319
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4981ada`](https://github.com/graphcommerce-org/graphcommerce/commit/4981ada47eae866a003d511f80296f79c9c8b343) - Added support for Algolia's facetOrdering which allows you to change the presented filters based on rules. ([@paales](https://github.com/paales))
320
-
321
- ### Patch Changes
322
-
323
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4f9ddb8`](https://github.com/graphcommerce-org/graphcommerce/commit/4f9ddb820494a89a6ae37df6e2befa59910330b4) - Updated Algolia to the latest version of the spec. ([@paales](https://github.com/paales))
324
-
325
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`75431c2`](https://github.com/graphcommerce-org/graphcommerce/commit/75431c22792bf7e4c95cd4c7c80aae5d0e77ee10) - Updated Algolia docs for search suggestions and used a different naming scheme where baseIndex+suggestionsSuffix is used (default that algolia suggests). ([@paales](https://github.com/paales))
326
-
327
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4f9ddb8`](https://github.com/graphcommerce-org/graphcommerce/commit/4f9ddb820494a89a6ae37df6e2befa59910330b4) - Fixed issue where if a value contains a `/` or a `,` the URL parsing would break. Those values are now replaced with `_AND_` and `_OR_` in the URL. ([@paales](https://github.com/paales))
328
-
329
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4f9ddb8`](https://github.com/graphcommerce-org/graphcommerce/commit/4f9ddb820494a89a6ae37df6e2befa59910330b4) - Moved Customer group_id resolver to magento-graphql-rest package where it should belong. ([@paales](https://github.com/paales))
330
-
331
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`0df56d8`](https://github.com/graphcommerce-org/graphcommerce/commit/0df56d8cbfdd2e6588946e5bd58b9a1c49a000aa) - Solve issue where the customer group specific price index wasn't used and added warnings to be able to debug the issue. ([@paales](https://github.com/paales))
332
-
333
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`c9ac114`](https://github.com/graphcommerce-org/graphcommerce/commit/c9ac1142cb92394eb32dc4a6d3944a1707b1b4e2) - Allow returning the algolia index name that is being searched ([@paales](https://github.com/paales))
334
-
335
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`a026714`](https://github.com/graphcommerce-org/graphcommerce/commit/a026714ac0373b666de2cee43c3c5dba58cd81e4) - Solve issue where used configurations might not be scoped to the correct store. Move caching to the mesh cache and scope per store. ([@paales](https://github.com/paales))
336
-
337
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`2933775`](https://github.com/graphcommerce-org/graphcommerce/commit/29337755dd75321e69fe96822b51da12d06fda3a) - Solve issue where algolia would return a full product URL instead of only the pathname of the given URL from Magento ([@paales](https://github.com/paales))
338
-
339
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4f9ddb8`](https://github.com/graphcommerce-org/graphcommerce/commit/4f9ddb820494a89a6ae37df6e2befa59910330b4) - Solve issue where the generated bucket for price aggregations didn’t contain the correct values. ([@paales](https://github.com/paales))
340
-
341
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4f9ddb8`](https://github.com/graphcommerce-org/graphcommerce/commit/4f9ddb820494a89a6ae37df6e2befa59910330b4) - Solve issue where some values wouldn’t be correctly flattened. ([@paales](https://github.com/paales))
342
-
343
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`4981ada`](https://github.com/graphcommerce-org/graphcommerce/commit/4981ada47eae866a003d511f80296f79c9c8b343) - Solve issue where Algolia didn't properly handle visibility as the attribute wasn't filterable, it automatically detects when there is a visibility attribute and uses that for filtering. ([@paales](https://github.com/paales))
344
-
345
- - [#2525](https://github.com/graphcommerce-org/graphcommerce/pull/2525) [`b266ec9`](https://github.com/graphcommerce-org/graphcommerce/commit/b266ec99e09a669a8e39478f8e4412cf1275e196) - Make sure the short_description and description can be properly returned when retrieved via an Algolia query ([@paales](https://github.com/paales))
346
-
347
- ## 9.1.0-canary.28
348
-
349
- ## 9.1.0-canary.27
350
-
351
- ## 9.1.0-canary.26
352
-
353
- ## 9.1.0-canary.25
354
-
355
- ## 9.1.0-canary.24
356
-
357
- ## 9.1.0-canary.23
358
-
359
- ## 9.1.0-canary.22
360
-
361
- ## 9.1.0-canary.21
362
-
363
- ## 9.1.0-canary.20
364
-
365
- ## 9.1.0-canary.19
366
-
367
- ## 9.1.0-canary.18
368
-
369
- ## 9.1.0-canary.17
370
-
371
- ## 9.1.0-canary.16
372
-
373
- ### Patch Changes
374
-
375
- - [#2494](https://github.com/graphcommerce-org/graphcommerce/pull/2494) [`fd824d4`](https://github.com/graphcommerce-org/graphcommerce/commit/fd824d41674d92a42bb7f354214d2b367a7beac2) - Solve issue when creating an account the group_id would be requested but there wansn't a token available to retrieve the group_id. ([@Renzovh](https://github.com/Renzovh))
376
-
377
- ## 9.1.0-canary.15
378
-
379
- ## 9.0.4-canary.14
380
-
381
- ## 9.0.4-canary.13
382
-
383
- ## 9.0.4-canary.12
384
-
385
- ## 9.0.4-canary.11
386
-
387
- ## 9.0.4-canary.10
388
-
389
- ## 9.0.4-canary.9
390
-
391
- ## 9.0.4-canary.8
392
-
393
- ## 9.0.4-canary.7
394
-
395
- ## 9.0.4-canary.6
396
-
397
- ## 9.0.4-canary.5
398
-
399
- ## 9.0.4-canary.4
400
-
401
- ## 9.0.4-canary.3
402
-
403
- ## 9.0.4-canary.2
404
-
405
- ## 9.0.4-canary.1
406
-
407
- ## 9.0.4-canary.0
408
-
409
139
  ## 9.0.0
410
140
 
411
141
  ### Major Changes
@@ -1,21 +1,20 @@
1
- import type { ApolloCache } from '@graphcommerce/graphql'
2
- import { setContext } from '@graphcommerce/graphql'
1
+ import { SetContextLink } from '@graphcommerce/graphql'
3
2
  import { CustomerDocument } from '@graphcommerce/magento-customer'
4
3
 
5
4
  declare module '@apollo/client' {
6
5
  interface DefaultContext {
7
- cache?: ApolloCache<unknown>
8
6
  headers?: Record<string, string>
9
7
  }
10
8
  }
11
9
 
12
- export const customerGroupIdLink = setContext((_, context) => {
13
- if (!context.headers) context.headers = {}
10
+ export const customerGroupIdLink = new SetContextLink((prevContext, operation) => {
11
+ const headers: Record<string, string> = { ...prevContext.headers }
14
12
  try {
15
- const group_id = context.cache?.readQuery({ query: CustomerDocument })?.customer?.group_id
16
- if (group_id) context.headers['x-magento-group-id'] = `${group_id}`
17
- return context
18
- } catch (error) {
19
- return context
13
+ const group_id = operation.client.cache.readQuery({ query: CustomerDocument })?.customer
14
+ ?.group_id
15
+ if (group_id) headers['x-magento-group-id'] = `${group_id}`
16
+ return { headers }
17
+ } catch {
18
+ return { headers }
20
19
  }
21
20
  })
@@ -81,7 +81,10 @@ export function algoliaFacetsToAggregations(
81
81
  categoryList?: null | CategoryResult,
82
82
  groupId?: number,
83
83
  ): Aggregation[] {
84
- if (!storeConfig?.default_display_currency_code) throw new Error('Currency is required')
84
+ if (!storeConfig?.default_display_currency_code)
85
+ throw new Error(
86
+ `Currency is required. StoreConfig default_display_currency_code is not set. This usually means the storeConfig query failed or the store doesn't have a default currency configured.`,
87
+ )
85
88
  const aggregations: Aggregation[] = []
86
89
 
87
90
  if (!assertAlgoliaFacets(algoliaFacets)) throw Error('these are not facets')
@@ -35,7 +35,10 @@ function mapPriceRange(
35
35
  customerGroup = 0,
36
36
  currencyHeader?: string,
37
37
  ): PriceRange {
38
- if (!storeConfig?.default_display_currency_code) throw new Error('Currency is required')
38
+ if (!storeConfig?.default_display_currency_code)
39
+ throw new Error(
40
+ `Currency is required. StoreConfig default_display_currency_code is not set. This usually means the storeConfig query failed or the store doesn't have a default currency configured.`,
41
+ )
39
42
 
40
43
  const curr = currencyHeader ?? storeConfig.default_display_currency_code
41
44
 
@@ -1,6 +1,11 @@
1
1
  import type { Maybe, MeshContext, StoreConfig } from '@graphcommerce/graphql-mesh'
2
+ import { storefrontConfigDefault } from '@graphcommerce/next-ui'
2
3
  import { getIndexName } from './getIndexName'
3
4
 
5
+ function getStoreHeader(context: MeshContext) {
6
+ return (context as MeshContext & { headers: Record<string, string | undefined> }).headers?.store
7
+ }
8
+
4
9
  export type GetStoreConfigReturn =
5
10
  | Maybe<
6
11
  Pick<
@@ -18,8 +23,13 @@ export async function getStoreConfig(context: MeshContext): Promise<StoreConfig>
18
23
  const configCached = context.cache.get(cacheKey)
19
24
  if (configCached) return configCached as StoreConfig
20
25
 
26
+ // Ensure we have a store header set for the storeConfig query
27
+ const storeCode = getStoreHeader(context) ?? storefrontConfigDefault().magentoStoreCode
28
+ const contextWithHeaders = context as MeshContext & { headers?: Record<string, string> }
29
+ const storeContext = { ...context, headers: { ...contextWithHeaders.headers, store: storeCode } }
30
+
21
31
  const configCache = await context.m2.Query.storeConfig({
22
- context,
32
+ context: storeContext,
23
33
  selectionSet: /* GraphQL */ `
24
34
  {
25
35
  root_category_uid
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/algolia-products",
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": {
@@ -15,14 +15,14 @@
15
15
  "generate": "tsx scripts/generate-spec.mts"
16
16
  },
17
17
  "peerDependencies": {
18
- "@graphcommerce/google-datalayer": "^10.0.0",
19
- "@graphcommerce/graphql": "^10.0.0",
20
- "@graphcommerce/graphql-mesh": "^10.0.0",
21
- "@graphcommerce/magento-customer": "^10.0.0",
22
- "@graphcommerce/magento-product": "^10.0.0",
23
- "@graphcommerce/magento-search": "^10.0.0",
24
- "@graphcommerce/next-config": "^10.0.0",
25
- "@graphcommerce/next-ui": "^10.0.0",
18
+ "@graphcommerce/google-datalayer": "^10.0.1-canary.1",
19
+ "@graphcommerce/graphql": "^10.0.1-canary.1",
20
+ "@graphcommerce/graphql-mesh": "^10.0.1-canary.1",
21
+ "@graphcommerce/magento-customer": "^10.0.1-canary.1",
22
+ "@graphcommerce/magento-product": "^10.0.1-canary.1",
23
+ "@graphcommerce/magento-search": "^10.0.1-canary.1",
24
+ "@graphcommerce/next-config": "^10.0.1-canary.1",
25
+ "@graphcommerce/next-ui": "^10.0.1-canary.1",
26
26
  "react": "^19.2.0"
27
27
  },
28
28
  "devDependencies": {