@graphcommerce/algolia-insights 10.0.0 → 10.0.1-canary.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/CHANGELOG.md CHANGED
@@ -1,124 +1,12 @@
1
1
  # @graphcommerce/algolia-personalization
2
2
 
3
- ## 10.0.0
4
-
5
- ### Major Changes
6
-
7
- - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
8
-
9
- This major release brings full Turbopack compatibility, dramatically improving development speed.
10
-
11
- ### 🚀 Turbopack-Compatible Interceptor System
12
-
13
- The entire plugin/interceptor system has been rewritten to work with Turbopack:
14
-
15
- - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
16
- - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
17
- - **Direct imports** - Interceptors import from `.original` files instead of embedding source
18
- - **New CLI commands**:
19
- - `graphcommerce codegen-interceptors` - Generate interceptor files
20
- - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
21
- - **Stable file hashing** - Deterministic interceptor generation for better caching
22
-
23
- ### ⚙️ Treeshakable Configuration System
24
-
25
- Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
26
-
27
- - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
28
- - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
29
- - **Fully treeshakable** - Unused config values are eliminated from the bundle
30
- - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
31
- - **Separate files for nested objects** - Optimal treeshaking for complex configurations
32
-
33
- ### 🔧 withGraphCommerce Changes
34
-
35
- - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
36
- - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
37
- - **Removed** `@mui/*` alias rewrites - No longer required
38
- - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
39
- - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
40
- - **Added** `optimizePackageImports` for better bundle optimization
41
- - **Added** `images.qualities: [52, 75]` for Next.js image optimization
42
-
43
- ### 📦 Lingui Configuration
44
-
45
- - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
46
- - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
47
- - **Simplified** formatter options
48
-
49
- ### ⚛️ React 19 & Next.js 16 Compatibility
50
-
51
- - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
52
- - Replaced deprecated `React.VFC` with `React.FC`
53
- - Fixed `useRef` calls to require explicit initial values
54
- - Updated `MutableRefObject` usage in `framer-scroller`
55
-
56
- ### 📋 ESLint 9 Flat Config
57
-
58
- - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
59
- - Updated `@typescript-eslint/*` packages to v8
60
- - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
61
-
62
- ### 🔄 Apollo Client
63
-
64
- - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
65
- - Updated error handling types to accept `ApolloError | null | undefined`
66
-
67
- ### ⚠️ Breaking Changes
68
-
69
- - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
70
- - **Interceptor files changed** - Original components now at `.original.tsx`
71
- - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
72
- - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
73
- - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
74
-
75
- ### 🗑️ Removed
76
-
77
- - `InterceptorPlugin` webpack plugin
78
- - `configToImportMeta` utility
79
- - Webpack `DefinePlugin` usage for config
80
- - `@mui/*` modern alias rewrites
81
- - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
3
+ ## 10.0.1-canary.0
82
4
 
83
5
  ### Patch Changes
84
6
 
85
- - [#2505](https://github.com/graphcommerce-org/graphcommerce/pull/2505) [`59c8877`](https://github.com/graphcommerce-org/graphcommerce/commit/59c8877db343450547da3e200d904c15f5b8e94f) - Update useSendAlgoliaEvent.ts ([@FrankHarland](https://github.com/FrankHarland))
86
-
87
- - [#2495](https://github.com/graphcommerce-org/graphcommerce/pull/2495) [`d90f7f5`](https://github.com/graphcommerce-org/graphcommerce/commit/d90f7f5889c58fbd982581a13b398a0978f901a8) - Solve issue where the useSendEventAlgolia hook would sometimes throw an error during purchase ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
88
-
89
- ## 10.0.0-canary.72
90
-
91
- ## 10.0.0-canary.71
92
-
93
- ## 10.0.0-canary.70
94
-
95
- ## 10.0.0-canary.69
96
-
97
- ## 10.0.0-canary.68
98
-
99
- ## 10.0.0-canary.67
100
-
101
- ## 10.0.0-canary.66
7
+ - [#2569](https://github.com/graphcommerce-org/graphcommerce/pull/2569) [`1ba54d4`](https://github.com/graphcommerce-org/graphcommerce/commit/1ba54d4e1af20514c1ef25a2feadbbbe5497e7e0) - Properly handle the new uid stuff ([@paales](https://github.com/paales))
102
8
 
103
- ## 10.0.0-canary.65
104
-
105
- ## 10.0.0-canary.64
106
-
107
- ## 10.0.0-canary.63
108
-
109
- ## 10.0.0-canary.62
110
-
111
- ## 10.0.0-canary.61
112
-
113
- ## 10.0.0-canary.60
114
-
115
- ## 10.0.0-canary.59
116
-
117
- ## 10.0.0-canary.58
118
-
119
- ## 10.0.0-canary.57
120
-
121
- ## 10.0.0-canary.56
9
+ ## 10.0.0
122
10
 
123
11
  ### Major Changes
124
12
 
@@ -198,126 +86,12 @@
198
86
  - `@mui/*` modern alias rewrites
199
87
  - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
200
88
 
201
- ## 9.1.0-canary.55
202
-
203
- ## 9.1.0-canary.54
204
-
205
- ## 9.1.0-canary.53
206
-
207
- ## 9.1.0-canary.52
208
-
209
- ## 9.1.0-canary.51
210
-
211
- ## 9.1.0-canary.50
212
-
213
- ## 9.1.0-canary.49
214
-
215
- ## 9.1.0-canary.48
216
-
217
- ## 9.1.0-canary.47
218
-
219
- ## 9.1.0-canary.46
220
-
221
- ## 9.1.0-canary.45
222
-
223
- ## 9.1.0-canary.44
224
-
225
- ## 9.1.0-canary.43
226
-
227
- ## 9.1.0-canary.42
228
-
229
- ## 9.1.0-canary.41
230
-
231
- ## 9.1.0-canary.40
232
-
233
- ## 9.1.0-canary.39
234
-
235
- ## 9.1.0-canary.38
236
-
237
- ## 9.1.0-canary.37
238
-
239
- ## 9.1.0-canary.36
240
-
241
- ## 9.1.0-canary.35
242
-
243
- ## 9.1.0-canary.34
244
-
245
- ## 9.1.0-canary.33
246
-
247
- ## 9.1.0-canary.32
248
-
249
- ## 9.1.0-canary.31
250
-
251
- ## 9.1.0-canary.30
252
-
253
- ## 9.1.0-canary.29
254
-
255
- ## 9.1.0-canary.28
256
-
257
89
  ### Patch Changes
258
90
 
259
91
  - [#2505](https://github.com/graphcommerce-org/graphcommerce/pull/2505) [`59c8877`](https://github.com/graphcommerce-org/graphcommerce/commit/59c8877db343450547da3e200d904c15f5b8e94f) - Update useSendAlgoliaEvent.ts ([@FrankHarland](https://github.com/FrankHarland))
260
92
 
261
- ## 9.1.0-canary.27
262
-
263
- ## 9.1.0-canary.26
264
-
265
- ## 9.1.0-canary.25
266
-
267
- ## 9.1.0-canary.24
268
-
269
- ## 9.1.0-canary.23
270
-
271
- ## 9.1.0-canary.22
272
-
273
- ## 9.1.0-canary.21
274
-
275
- ## 9.1.0-canary.20
276
-
277
- ## 9.1.0-canary.19
278
-
279
- ## 9.1.0-canary.18
280
-
281
- ## 9.1.0-canary.17
282
-
283
- ## 9.1.0-canary.16
284
-
285
- ## 9.1.0-canary.15
286
-
287
- ## 9.0.4-canary.14
288
-
289
- ### Patch Changes
290
-
291
93
  - [#2495](https://github.com/graphcommerce-org/graphcommerce/pull/2495) [`d90f7f5`](https://github.com/graphcommerce-org/graphcommerce/commit/d90f7f5889c58fbd982581a13b398a0978f901a8) - Solve issue where the useSendEventAlgolia hook would sometimes throw an error during purchase ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
292
94
 
293
- ## 9.0.4-canary.13
294
-
295
- ## 9.0.4-canary.12
296
-
297
- ## 9.0.4-canary.11
298
-
299
- ## 9.0.4-canary.10
300
-
301
- ## 9.0.4-canary.9
302
-
303
- ## 9.0.4-canary.8
304
-
305
- ## 9.0.4-canary.7
306
-
307
- ## 9.0.4-canary.6
308
-
309
- ## 9.0.4-canary.5
310
-
311
- ## 9.0.4-canary.4
312
-
313
- ## 9.0.4-canary.3
314
-
315
- ## 9.0.4-canary.2
316
-
317
- ## 9.0.4-canary.1
318
-
319
- ## 9.0.4-canary.0
320
-
321
95
  ## 9.0.1
322
96
 
323
97
  ### Patch Changes
@@ -12,6 +12,9 @@ import { useEventCallback } from '@mui/material'
12
12
  import { useRef } from 'react'
13
13
  import { AlgoliaSendEventDocument } from '../graphql/AlgoliaSendEvent.gql'
14
14
 
15
+ /** Decodes a base64 UID, stripping any query parameters that may be appended (e.g. ?store_name=...) */
16
+ const decodeUid = (uid: string) => atob(uid.split('?')[0])
17
+
15
18
  const getSHA256Hash = async (input: string) => {
16
19
  const textAsBuffer = new TextEncoder().encode(input)
17
20
  const hashBuffer = await window.crypto.subtle.digest('SHA-256', textAsBuffer)
@@ -30,7 +33,7 @@ function mapSelectedFiltersToAlgoliaEvent(filters: ProductFilterParams['filters'
30
33
  const valueArray = (filter.eq ? [filter.eq] : (filter.in ?? [])) as string[]
31
34
  valueArray.forEach((value) => {
32
35
  if (key === 'category_uid') {
33
- flattenedFilters.push(`categoryIds:${atob(value)}`)
36
+ flattenedFilters.push(`categoryIds:${decodeUid(value)}`)
34
37
  } else {
35
38
  flattenedFilters.push(`${key}:${encodeURIComponent(value)}`)
36
39
  }
@@ -87,7 +90,7 @@ const dataLayerToAlgoliaMap: {
87
90
  } = {
88
91
  // todo should we use view_item or view_item_list?
89
92
  view_item_list: (eventName, eventData, { queryID, ...common }) => {
90
- const objectIDs = eventData.items.map((item) => atob(item.item_uid))
93
+ const objectIDs = eventData.items.map((item) => decodeUid(item.item_uid))
91
94
 
92
95
  const events: AlgoliaEventsItems_Input[] = []
93
96
 
@@ -146,7 +149,7 @@ const dataLayerToAlgoliaMap: {
146
149
  },
147
150
 
148
151
  select_item: (eventName, eventData, { queryID, ...common }) => {
149
- const objectIDs = eventData.items.map((item) => atob(item.item_uid))
152
+ const objectIDs = eventData.items.map((item) => decodeUid(item.item_uid))
150
153
  if (queryID) saveAlgoliaIdToQuery(objectIDs, queryID, eventData.filter_params?.filters ?? {})
151
154
 
152
155
  return queryID
@@ -167,7 +170,7 @@ const dataLayerToAlgoliaMap: {
167
170
  Clicked_object_IDs_Input: {
168
171
  eventName,
169
172
  eventType: 'click',
170
- objectIDs: eventData.items.map((item) => atob(item.item_uid)),
173
+ objectIDs: eventData.items.map((item) => decodeUid(item.item_uid)),
171
174
  ...common,
172
175
  },
173
176
  } satisfies AlgoliaEventsItems_Input,
@@ -181,7 +184,7 @@ const dataLayerToAlgoliaMap: {
181
184
  const events: AlgoliaEventsItems_Input[] = []
182
185
 
183
186
  const mapping = getObjectIDToQuery()
184
- const objectIDs = eventData.items.map((item) => atob(item.item_uid))
187
+ const objectIDs = eventData.items.map((item) => decodeUid(item.item_uid))
185
188
 
186
189
  const relevant = objectIDs.map((objectID) => mapping[objectID]).filter(Boolean)
187
190
  const queryID = relevant?.[0]?.queryID
@@ -209,7 +212,7 @@ const dataLayerToAlgoliaMap: {
209
212
  eventName,
210
213
  eventType: 'conversion',
211
214
  eventSubtype: 'addToCart',
212
- objectIDs: eventData.items.map((item) => atob(item.item_uid)),
215
+ objectIDs: eventData.items.map((item) => decodeUid(item.item_uid)),
213
216
  objectData: eventData.items.map((item) => ({
214
217
  discount: { Float: Number(item.discount?.toFixed(14)) ?? 0 },
215
218
  price: { Float: Number(item.price.toFixed(14)) },
@@ -226,7 +229,7 @@ const dataLayerToAlgoliaMap: {
226
229
  eventName,
227
230
  eventType: 'conversion',
228
231
  eventSubtype: 'addToCart',
229
- objectIDs: eventData.items.map((item) => atob(item.item_uid)),
232
+ objectIDs: eventData.items.map((item) => decodeUid(item.item_uid)),
230
233
  objectData: eventData.items.map((item) => ({
231
234
  discount: { Float: item.discount ?? 0 },
232
235
  price: { Float: Number(item.price.toFixed(14)) },
@@ -244,11 +247,13 @@ const dataLayerToAlgoliaMap: {
244
247
 
245
248
  purchase: (eventName, eventData, common) => {
246
249
  const mapping = getObjectIDToQuery()
247
- const isAfterSearch = !!eventData.items.find((item) => mapping[atob(item.item_uid)]?.queryID)
250
+ const isAfterSearch = !!eventData.items.find(
251
+ (item) => mapping[decodeUid(item.item_uid)]?.queryID,
252
+ )
248
253
 
249
254
  const events: AlgoliaEventsItems_Input[] = []
250
255
 
251
- const objectIDs = eventData.items.map((item) => atob(item.item_uid))
256
+ const objectIDs = eventData.items.map((item) => decodeUid(item.item_uid))
252
257
  const relevant = objectIDs.map((objectID) => mapping[objectID]).filter(Boolean)
253
258
  const filters = [...new Set(...relevant.map((item) => item?.filters ?? []))]
254
259
 
@@ -273,12 +278,12 @@ const dataLayerToAlgoliaMap: {
273
278
  eventName,
274
279
  eventType: 'conversion',
275
280
  eventSubtype: 'purchase',
276
- objectIDs: eventData.items.map((item) => atob(item.item_uid)),
281
+ objectIDs: eventData.items.map((item) => decodeUid(item.item_uid)),
277
282
  objectData: eventData.items.map((item) => ({
278
283
  discount: { Float: Number(item.discount?.toFixed(14)) ?? 0 },
279
284
  price: { Float: Number(item.price.toFixed(14)) },
280
285
  quantity: item.quantity,
281
- queryID: mapping[atob(item.item_uid)]?.queryID,
286
+ queryID: mapping[decodeUid(item.item_uid)]?.queryID,
282
287
  })),
283
288
  currency: eventData.currency,
284
289
  value: { Float: Number(eventData.value.toFixed(13)) },
@@ -291,7 +296,7 @@ const dataLayerToAlgoliaMap: {
291
296
  eventName,
292
297
  eventType: 'conversion',
293
298
  eventSubtype: 'purchase',
294
- objectIDs: eventData.items.map((item) => atob(item.item_uid)),
299
+ objectIDs: eventData.items.map((item) => decodeUid(item.item_uid)),
295
300
  objectData: eventData.items.map((item) => ({
296
301
  discount: { Float: Number(item.discount?.toFixed(14)) ?? 0 },
297
302
  price: { Float: Number(item.price.toFixed(14)) },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/algolia-insights",
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.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -15,15 +15,15 @@
15
15
  "generate": "tsx scripts/generate-insights-spec.mts"
16
16
  },
17
17
  "peerDependencies": {
18
- "@graphcommerce/algolia-products": "^10.0.0",
19
- "@graphcommerce/google-datalayer": "^10.0.0",
20
- "@graphcommerce/graphql": "^10.0.0",
21
- "@graphcommerce/graphql-mesh": "^10.0.0",
22
- "@graphcommerce/magento-customer": "^10.0.0",
23
- "@graphcommerce/magento-product": "^10.0.0",
24
- "@graphcommerce/next-config": "^10.0.0",
25
- "@graphcommerce/next-ui": "^10.0.0",
26
- "@graphcommerce/react-hook-form": "^10.0.0",
18
+ "@graphcommerce/algolia-products": "^10.0.1-canary.0",
19
+ "@graphcommerce/google-datalayer": "^10.0.1-canary.0",
20
+ "@graphcommerce/graphql": "^10.0.1-canary.0",
21
+ "@graphcommerce/graphql-mesh": "^10.0.1-canary.0",
22
+ "@graphcommerce/magento-customer": "^10.0.1-canary.0",
23
+ "@graphcommerce/magento-product": "^10.0.1-canary.0",
24
+ "@graphcommerce/next-config": "^10.0.1-canary.0",
25
+ "@graphcommerce/next-ui": "^10.0.1-canary.0",
26
+ "@graphcommerce/react-hook-form": "^10.0.1-canary.0",
27
27
  "@mui/material": "*",
28
28
  "react": "^19.2.0"
29
29
  },