@graphcommerce/algolia-insights 10.0.0-canary.72 → 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 +4 -144
- package/hooks/useSendAlgoliaEvent.ts +17 -12
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
1
|
# @graphcommerce/algolia-personalization
|
|
2
2
|
|
|
3
|
-
## 10.0.
|
|
3
|
+
## 10.0.1-canary.0
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## 10.0.0-canary.70
|
|
8
|
-
|
|
9
|
-
## 10.0.0-canary.69
|
|
10
|
-
|
|
11
|
-
## 10.0.0-canary.68
|
|
12
|
-
|
|
13
|
-
## 10.0.0-canary.67
|
|
14
|
-
|
|
15
|
-
## 10.0.0-canary.66
|
|
16
|
-
|
|
17
|
-
## 10.0.0-canary.65
|
|
18
|
-
|
|
19
|
-
## 10.0.0-canary.64
|
|
20
|
-
|
|
21
|
-
## 10.0.0-canary.63
|
|
22
|
-
|
|
23
|
-
## 10.0.0-canary.62
|
|
24
|
-
|
|
25
|
-
## 10.0.0-canary.61
|
|
26
|
-
|
|
27
|
-
## 10.0.0-canary.60
|
|
28
|
-
|
|
29
|
-
## 10.0.0-canary.59
|
|
30
|
-
|
|
31
|
-
## 10.0.0-canary.58
|
|
5
|
+
### Patch Changes
|
|
32
6
|
|
|
33
|
-
|
|
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))
|
|
34
8
|
|
|
35
|
-
## 10.0.0
|
|
9
|
+
## 10.0.0
|
|
36
10
|
|
|
37
11
|
### Major Changes
|
|
38
12
|
|
|
@@ -112,126 +86,12 @@
|
|
|
112
86
|
- `@mui/*` modern alias rewrites
|
|
113
87
|
- Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
|
|
114
88
|
|
|
115
|
-
## 9.1.0-canary.55
|
|
116
|
-
|
|
117
|
-
## 9.1.0-canary.54
|
|
118
|
-
|
|
119
|
-
## 9.1.0-canary.53
|
|
120
|
-
|
|
121
|
-
## 9.1.0-canary.52
|
|
122
|
-
|
|
123
|
-
## 9.1.0-canary.51
|
|
124
|
-
|
|
125
|
-
## 9.1.0-canary.50
|
|
126
|
-
|
|
127
|
-
## 9.1.0-canary.49
|
|
128
|
-
|
|
129
|
-
## 9.1.0-canary.48
|
|
130
|
-
|
|
131
|
-
## 9.1.0-canary.47
|
|
132
|
-
|
|
133
|
-
## 9.1.0-canary.46
|
|
134
|
-
|
|
135
|
-
## 9.1.0-canary.45
|
|
136
|
-
|
|
137
|
-
## 9.1.0-canary.44
|
|
138
|
-
|
|
139
|
-
## 9.1.0-canary.43
|
|
140
|
-
|
|
141
|
-
## 9.1.0-canary.42
|
|
142
|
-
|
|
143
|
-
## 9.1.0-canary.41
|
|
144
|
-
|
|
145
|
-
## 9.1.0-canary.40
|
|
146
|
-
|
|
147
|
-
## 9.1.0-canary.39
|
|
148
|
-
|
|
149
|
-
## 9.1.0-canary.38
|
|
150
|
-
|
|
151
|
-
## 9.1.0-canary.37
|
|
152
|
-
|
|
153
|
-
## 9.1.0-canary.36
|
|
154
|
-
|
|
155
|
-
## 9.1.0-canary.35
|
|
156
|
-
|
|
157
|
-
## 9.1.0-canary.34
|
|
158
|
-
|
|
159
|
-
## 9.1.0-canary.33
|
|
160
|
-
|
|
161
|
-
## 9.1.0-canary.32
|
|
162
|
-
|
|
163
|
-
## 9.1.0-canary.31
|
|
164
|
-
|
|
165
|
-
## 9.1.0-canary.30
|
|
166
|
-
|
|
167
|
-
## 9.1.0-canary.29
|
|
168
|
-
|
|
169
|
-
## 9.1.0-canary.28
|
|
170
|
-
|
|
171
89
|
### Patch Changes
|
|
172
90
|
|
|
173
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))
|
|
174
92
|
|
|
175
|
-
## 9.1.0-canary.27
|
|
176
|
-
|
|
177
|
-
## 9.1.0-canary.26
|
|
178
|
-
|
|
179
|
-
## 9.1.0-canary.25
|
|
180
|
-
|
|
181
|
-
## 9.1.0-canary.24
|
|
182
|
-
|
|
183
|
-
## 9.1.0-canary.23
|
|
184
|
-
|
|
185
|
-
## 9.1.0-canary.22
|
|
186
|
-
|
|
187
|
-
## 9.1.0-canary.21
|
|
188
|
-
|
|
189
|
-
## 9.1.0-canary.20
|
|
190
|
-
|
|
191
|
-
## 9.1.0-canary.19
|
|
192
|
-
|
|
193
|
-
## 9.1.0-canary.18
|
|
194
|
-
|
|
195
|
-
## 9.1.0-canary.17
|
|
196
|
-
|
|
197
|
-
## 9.1.0-canary.16
|
|
198
|
-
|
|
199
|
-
## 9.1.0-canary.15
|
|
200
|
-
|
|
201
|
-
## 9.0.4-canary.14
|
|
202
|
-
|
|
203
|
-
### Patch Changes
|
|
204
|
-
|
|
205
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))
|
|
206
94
|
|
|
207
|
-
## 9.0.4-canary.13
|
|
208
|
-
|
|
209
|
-
## 9.0.4-canary.12
|
|
210
|
-
|
|
211
|
-
## 9.0.4-canary.11
|
|
212
|
-
|
|
213
|
-
## 9.0.4-canary.10
|
|
214
|
-
|
|
215
|
-
## 9.0.4-canary.9
|
|
216
|
-
|
|
217
|
-
## 9.0.4-canary.8
|
|
218
|
-
|
|
219
|
-
## 9.0.4-canary.7
|
|
220
|
-
|
|
221
|
-
## 9.0.4-canary.6
|
|
222
|
-
|
|
223
|
-
## 9.0.4-canary.5
|
|
224
|
-
|
|
225
|
-
## 9.0.4-canary.4
|
|
226
|
-
|
|
227
|
-
## 9.0.4-canary.3
|
|
228
|
-
|
|
229
|
-
## 9.0.4-canary.2
|
|
230
|
-
|
|
231
|
-
## 9.0.4-canary.1
|
|
232
|
-
|
|
233
|
-
## 9.0.4-canary.0
|
|
234
|
-
|
|
235
95
|
## 9.0.1
|
|
236
96
|
|
|
237
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:${
|
|
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) =>
|
|
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) =>
|
|
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) =>
|
|
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) =>
|
|
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) =>
|
|
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) =>
|
|
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(
|
|
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) =>
|
|
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) =>
|
|
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[
|
|
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) =>
|
|
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.
|
|
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.
|
|
19
|
-
"@graphcommerce/google-datalayer": "^10.0.
|
|
20
|
-
"@graphcommerce/graphql": "^10.0.
|
|
21
|
-
"@graphcommerce/graphql-mesh": "^10.0.
|
|
22
|
-
"@graphcommerce/magento-customer": "^10.0.
|
|
23
|
-
"@graphcommerce/magento-product": "^10.0.
|
|
24
|
-
"@graphcommerce/next-config": "^10.0.
|
|
25
|
-
"@graphcommerce/next-ui": "^10.0.
|
|
26
|
-
"@graphcommerce/react-hook-form": "^10.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
|
},
|