@graphcommerce/google-datalayer 9.0.0-canary.100 → 9.0.0-canary.103
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 +3 -226
- package/api/googleEventNames.ts +1 -1
- package/api/sendEvent.ts +3 -1
- package/components/DatalayerViewItemList.tsx +4 -3
- package/mapping/cartItemToDatalayerItem/cartItemToDatalayerItem.ts +3 -5
- package/mapping/cartItemToRemoveFromCart/cartToRemoveFromCart.ts +1 -1
- package/mapping/cartToAddPaymentInfo/cartToAddPaymentInfo.ts +3 -2
- package/mapping/cartToAddShippingInfo/cartToAddShippingInfo.ts +3 -2
- package/mapping/cartToBeginCheckout/cartToBeginCheckout.ts +3 -2
- package/mapping/cartToPurchase/cartToPurchase.ts +3 -2
- package/mapping/cartToViewCart/cartToViewCart.ts +4 -6
- package/mapping/datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue.ts +1 -1
- package/mapping/productItemsToViewItemList/productItemsToViewItemList.ts +3 -5
- package/mapping/productToDatalayerItem/productToDatalayerItem.ts +1 -1
- package/mapping/productToViewItem/productToViewItem.ts +5 -9
- package/package.json +11 -10
- package/plugins/GoogleDatalayerAddProductsToCartForm.tsx +2 -5
- package/plugins/GoogleDatalayerCartStartCheckout.tsx +1 -1
- package/plugins/GoogleDatalayerCartStartCheckoutLinkOrButton.tsx +1 -1
- package/plugins/GoogleDatalayerPaymentMethodButton.tsx +1 -1
- package/plugins/GoogleDatalayerProductListItem.tsx +1 -1
- package/plugins/GoogleDatalayerShippingMethodForm.tsx +1 -1
- package/plugins/GoogleDatalayerWebVitals.tsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,10 @@
|
|
|
1
1
|
# @graphcommerce/google-datalayer
|
|
2
2
|
|
|
3
|
-
## 9.0.0-canary.
|
|
3
|
+
## 9.0.0-canary.103
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## 9.0.0-canary.98
|
|
8
|
-
|
|
9
|
-
## 9.0.0-canary.97
|
|
10
|
-
|
|
11
|
-
## 9.0.0-canary.96
|
|
12
|
-
|
|
13
|
-
## 9.0.0-canary.95
|
|
14
|
-
|
|
15
|
-
## 9.0.0-canary.94
|
|
16
|
-
|
|
17
|
-
## 9.0.0-canary.93
|
|
18
|
-
|
|
19
|
-
## 9.0.0-canary.92
|
|
20
|
-
|
|
21
|
-
## 9.0.0-canary.91
|
|
22
|
-
|
|
23
|
-
## 9.0.0-canary.90
|
|
24
|
-
|
|
25
|
-
## 9.0.0-canary.89
|
|
26
|
-
|
|
27
|
-
## 9.0.0-canary.88
|
|
28
|
-
|
|
29
|
-
## 9.0.0-canary.87
|
|
30
|
-
|
|
31
|
-
## 9.0.0-canary.86
|
|
32
|
-
|
|
33
|
-
## 9.0.0-canary.85
|
|
34
|
-
|
|
35
|
-
## 9.0.0-canary.84
|
|
36
|
-
|
|
37
|
-
## 9.0.0-canary.83
|
|
38
|
-
|
|
39
|
-
## 9.0.0-canary.82
|
|
5
|
+
### Patch Changes
|
|
40
6
|
|
|
41
|
-
|
|
7
|
+
- [#2421](https://github.com/graphcommerce-org/graphcommerce/pull/2421) [`d500643`](https://github.com/graphcommerce-org/graphcommerce/commit/d500643138799b6db1610cb10a1d065d6219d8ea) - Resolve peer dependency issues so we get a clean install ([@paales](https://github.com/paales))
|
|
42
8
|
|
|
43
9
|
## 9.0.0-canary.80
|
|
44
10
|
|
|
@@ -46,182 +12,30 @@
|
|
|
46
12
|
|
|
47
13
|
- [#2341](https://github.com/graphcommerce-org/graphcommerce/pull/2341) [`e3fe4f7`](https://github.com/graphcommerce-org/graphcommerce/commit/e3fe4f73c8c3e3c6a5ec68cdc7a32820e8f69e07) - Solve an issue where the BillingPage query would be re-queried after setting the payment method. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
48
14
|
|
|
49
|
-
## 9.0.0-canary.79
|
|
50
|
-
|
|
51
|
-
## 9.0.0-canary.78
|
|
52
|
-
|
|
53
|
-
## 9.0.0-canary.77
|
|
54
|
-
|
|
55
|
-
## 9.0.0-canary.76
|
|
56
|
-
|
|
57
|
-
## 9.0.0-canary.75
|
|
58
|
-
|
|
59
|
-
## 9.0.0-canary.74
|
|
60
|
-
|
|
61
15
|
## 9.0.0-canary.73
|
|
62
16
|
|
|
63
17
|
### Minor Changes
|
|
64
18
|
|
|
65
19
|
- [#2337](https://github.com/graphcommerce-org/graphcommerce/pull/2337) [`18898df`](https://github.com/graphcommerce-org/graphcommerce/commit/18898df44b786dd68d8e6fec538e3db947c157e4) - All sendEvent calls are now the return type of useSendEvent, to allow plugins to use hooks themselves ([@Renzovh](https://github.com/Renzovh))
|
|
66
20
|
|
|
67
|
-
## 9.0.0-canary.72
|
|
68
|
-
|
|
69
|
-
## 9.0.0-canary.71
|
|
70
|
-
|
|
71
|
-
## 9.0.0-canary.70
|
|
72
|
-
|
|
73
|
-
## 9.0.0-canary.69
|
|
74
|
-
|
|
75
|
-
## 9.0.0-canary.68
|
|
76
|
-
|
|
77
|
-
## 9.0.0-canary.67
|
|
78
|
-
|
|
79
|
-
## 9.0.0-canary.66
|
|
80
|
-
|
|
81
|
-
## 9.0.0-canary.65
|
|
82
|
-
|
|
83
|
-
## 9.0.0-canary.64
|
|
84
|
-
|
|
85
|
-
## 9.0.0-canary.63
|
|
86
|
-
|
|
87
|
-
## 9.0.0-canary.62
|
|
88
|
-
|
|
89
|
-
## 9.0.0-canary.61
|
|
90
|
-
|
|
91
21
|
## 9.0.0-canary.60
|
|
92
22
|
|
|
93
23
|
### Patch Changes
|
|
94
24
|
|
|
95
25
|
- [#2331](https://github.com/graphcommerce-org/graphcommerce/pull/2331) [`702bfc9`](https://github.com/graphcommerce-org/graphcommerce/commit/702bfc93566c9745546988e57988431d5d4d8cb0) - Moved plugins to new format ([@paales](https://github.com/paales))
|
|
96
26
|
|
|
97
|
-
## 9.0.0-canary.59
|
|
98
|
-
|
|
99
|
-
## 9.0.0-canary.58
|
|
100
|
-
|
|
101
|
-
## 9.0.0-canary.57
|
|
102
|
-
|
|
103
|
-
## 9.0.0-canary.56
|
|
104
|
-
|
|
105
|
-
## 9.0.0-canary.55
|
|
106
|
-
|
|
107
|
-
## 9.0.0-canary.54
|
|
108
|
-
|
|
109
|
-
## 8.1.0-canary.53
|
|
110
|
-
|
|
111
|
-
## 8.1.0-canary.52
|
|
112
|
-
|
|
113
|
-
## 8.1.0-canary.51
|
|
114
|
-
|
|
115
|
-
## 8.1.0-canary.50
|
|
116
|
-
|
|
117
|
-
## 8.1.0-canary.49
|
|
118
|
-
|
|
119
|
-
## 8.1.0-canary.48
|
|
120
|
-
|
|
121
|
-
## 8.1.0-canary.47
|
|
122
|
-
|
|
123
|
-
## 8.1.0-canary.46
|
|
124
|
-
|
|
125
|
-
## 8.1.0-canary.45
|
|
126
|
-
|
|
127
|
-
## 8.1.0-canary.44
|
|
128
|
-
|
|
129
|
-
## 8.1.0-canary.43
|
|
130
|
-
|
|
131
|
-
## 8.1.0-canary.42
|
|
132
|
-
|
|
133
|
-
## 8.1.0-canary.41
|
|
134
|
-
|
|
135
|
-
## 8.1.0-canary.40
|
|
136
|
-
|
|
137
|
-
## 8.1.0-canary.39
|
|
138
|
-
|
|
139
|
-
## 8.1.0-canary.38
|
|
140
|
-
|
|
141
|
-
## 8.1.0-canary.37
|
|
142
|
-
|
|
143
|
-
## 8.1.0-canary.36
|
|
144
|
-
|
|
145
|
-
## 8.1.0-canary.35
|
|
146
|
-
|
|
147
|
-
## 8.1.0-canary.34
|
|
148
|
-
|
|
149
|
-
## 8.1.0-canary.33
|
|
150
|
-
|
|
151
|
-
## 8.1.0-canary.32
|
|
152
|
-
|
|
153
|
-
## 8.1.0-canary.31
|
|
154
|
-
|
|
155
|
-
## 8.1.0-canary.30
|
|
156
|
-
|
|
157
|
-
## 8.1.0-canary.29
|
|
158
|
-
|
|
159
|
-
## 8.1.0-canary.28
|
|
160
|
-
|
|
161
|
-
## 8.1.0-canary.27
|
|
162
|
-
|
|
163
|
-
## 8.1.0-canary.26
|
|
164
|
-
|
|
165
|
-
## 8.1.0-canary.25
|
|
166
|
-
|
|
167
|
-
## 8.1.0-canary.24
|
|
168
|
-
|
|
169
|
-
## 8.1.0-canary.23
|
|
170
|
-
|
|
171
|
-
## 8.1.0-canary.22
|
|
172
|
-
|
|
173
|
-
## 8.1.0-canary.21
|
|
174
|
-
|
|
175
27
|
## 8.1.0-canary.20
|
|
176
28
|
|
|
177
29
|
### Patch Changes
|
|
178
30
|
|
|
179
31
|
- [#2246](https://github.com/graphcommerce-org/graphcommerce/pull/2246) [`fc5c04d`](https://github.com/graphcommerce-org/graphcommerce/commit/fc5c04d4a2c0301be7d3cc983d9b31f6fcaf6fe6) - Create useRemoveItemFromCart hook to allow for reuse while keeping compatibility with plugins. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
180
32
|
|
|
181
|
-
## 8.1.0-canary.19
|
|
182
|
-
|
|
183
|
-
## 8.1.0-canary.18
|
|
184
|
-
|
|
185
|
-
## 8.1.0-canary.17
|
|
186
|
-
|
|
187
|
-
## 8.1.0-canary.16
|
|
188
|
-
|
|
189
|
-
## 8.1.0-canary.15
|
|
190
|
-
|
|
191
|
-
## 8.1.0-canary.14
|
|
192
|
-
|
|
193
|
-
## 8.1.0-canary.13
|
|
194
|
-
|
|
195
|
-
## 8.1.0-canary.12
|
|
196
|
-
|
|
197
|
-
## 8.1.0-canary.11
|
|
198
|
-
|
|
199
|
-
## 8.1.0-canary.10
|
|
200
|
-
|
|
201
|
-
## 8.1.0-canary.9
|
|
202
|
-
|
|
203
|
-
## 8.1.0-canary.8
|
|
204
|
-
|
|
205
|
-
## 8.1.0-canary.7
|
|
206
|
-
|
|
207
|
-
## 8.1.0-canary.6
|
|
208
|
-
|
|
209
|
-
## 8.1.0-canary.5
|
|
210
|
-
|
|
211
|
-
## 8.0.6-canary.4
|
|
212
|
-
|
|
213
|
-
## 8.0.6-canary.3
|
|
214
|
-
|
|
215
33
|
## 8.0.6-canary.2
|
|
216
34
|
|
|
217
35
|
### Patch Changes
|
|
218
36
|
|
|
219
37
|
- [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Prevent BillingPage query from rerunning on each mutation ([@FrankHarland](https://github.com/FrankHarland))
|
|
220
38
|
|
|
221
|
-
## 8.0.6-canary.1
|
|
222
|
-
|
|
223
|
-
## 8.0.6-canary.0
|
|
224
|
-
|
|
225
39
|
## 8.0.5
|
|
226
40
|
|
|
227
41
|
### Patch Changes
|
|
@@ -233,45 +47,8 @@
|
|
|
233
47
|
|
|
234
48
|
- [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer. ([@paales](https://github.com/paales))
|
|
235
49
|
|
|
236
|
-
## 8.0.5-canary.10
|
|
237
|
-
|
|
238
|
-
## 8.0.5-canary.9
|
|
239
|
-
|
|
240
|
-
## 8.0.5-canary.8
|
|
241
|
-
|
|
242
|
-
## 8.0.5-canary.7
|
|
243
|
-
|
|
244
|
-
## 8.0.5-canary.6
|
|
245
|
-
|
|
246
|
-
## 8.0.5-canary.5
|
|
247
|
-
|
|
248
|
-
## 8.0.5-canary.4
|
|
249
|
-
|
|
250
|
-
## 8.0.5-canary.3
|
|
251
|
-
|
|
252
|
-
## 8.0.5-canary.2
|
|
253
|
-
|
|
254
|
-
## 8.0.5-canary.1
|
|
255
|
-
|
|
256
|
-
### Patch Changes
|
|
257
|
-
|
|
258
|
-
- [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`f120bce`](https://github.com/graphcommerce-org/graphcommerce/commit/f120bce617808d756aebb7c500aa1deb9e4cf487) - Google Datalayer, Analytics and Tagmanager improvements.
|
|
259
|
-
|
|
260
|
-
- Removed `eventFormat` as we could automatically detec the correct event format and it is now the responsibility of GTM or the GTAG to handle the event format.
|
|
261
|
-
- Created cartItemToGoogleDatalayerItem and productToGoogleDatalayerItem for easier modifications. ([@paales](https://github.com/paales))
|
|
262
|
-
|
|
263
|
-
- [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer. ([@paales](https://github.com/paales))
|
|
264
|
-
|
|
265
|
-
## 8.0.5-canary.0
|
|
266
|
-
|
|
267
50
|
## 8.0.4
|
|
268
51
|
|
|
269
52
|
### Patch Changes
|
|
270
53
|
|
|
271
54
|
- [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events. ([@mikekeehnen](https://github.com/mikekeehnen))
|
|
272
|
-
|
|
273
|
-
## 8.0.4-canary.1
|
|
274
|
-
|
|
275
|
-
### Patch Changes
|
|
276
|
-
|
|
277
|
-
- [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events. ([@mikekeehnen](https://github.com/mikekeehnen))
|
package/api/googleEventNames.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Metric } from 'web-vitals'
|
|
1
|
+
import type { Metric } from 'web-vitals'
|
|
2
2
|
import type { AddPaymentInfo } from '../mapping/cartToAddPaymentInfo/cartToAddPaymentInfo'
|
|
3
3
|
import type { AddShippingInfo } from '../mapping/cartToAddShippingInfo/cartToAddShippingInfo'
|
|
4
4
|
import type { BeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
|
package/api/sendEvent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GoogleEventTypes } from './googleEventNames'
|
|
1
|
+
import type { GoogleEventTypes } from './googleEventNames'
|
|
2
2
|
|
|
3
3
|
export type SendEvent = (
|
|
4
4
|
eventName: Event | (string & Record<never, never>),
|
|
@@ -6,7 +6,9 @@ export type SendEvent = (
|
|
|
6
6
|
) => void
|
|
7
7
|
|
|
8
8
|
export function sendEvent<Event extends keyof GoogleEventTypes>(
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
10
|
eventName: Event,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
12
|
eventData: GoogleEventTypes[Event],
|
|
11
13
|
) {
|
|
12
14
|
// This is a generic event handler and is plugins from google-analytics and google datalayer
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ProductItemsGridProps
|
|
1
|
+
import type { ProductItemsGridProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import { useProductFiltersPro } from '@graphcommerce/magento-product'
|
|
2
3
|
import { useMemoObject } from '@graphcommerce/next-ui'
|
|
4
|
+
import { useDebounce } from '@graphcommerce/react-hook-form'
|
|
3
5
|
import { useEventCallback } from '@mui/material'
|
|
4
6
|
import React, { useContext, useEffect, useRef } from 'react'
|
|
5
7
|
import { useSendEvent } from '../api/sendEvent'
|
|
@@ -7,7 +9,6 @@ import {
|
|
|
7
9
|
productItemsToViewItemList,
|
|
8
10
|
viewItemListToSelectItem,
|
|
9
11
|
} from '../mapping/productItemsToViewItemList/productItemsToViewItemList'
|
|
10
|
-
import { useDebounce } from '@graphcommerce/react-hook-form'
|
|
11
12
|
|
|
12
13
|
const DatalayerSelectItemContext = React.createContext<((itemId: string) => void) | undefined>(
|
|
13
14
|
undefined,
|
|
@@ -17,7 +18,7 @@ export function useViewItemList() {
|
|
|
17
18
|
const context = useContext(DatalayerSelectItemContext)
|
|
18
19
|
if (!context) {
|
|
19
20
|
return (itemId: string) => {
|
|
20
|
-
console.
|
|
21
|
+
console.warn(`No DatalayerSelectItemContext provider found, trying to select item ${itemId}`)
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return context
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '../productToDatalayerItem/productToDatalayerItem'
|
|
5
|
-
import { CartItem_DatalayerItemFragment } from './CartItem_DatalayerItem.gql'
|
|
1
|
+
import type { GoogleDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
2
|
+
import { productToDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
3
|
+
import type { CartItem_DatalayerItemFragment } from './CartItem_DatalayerItem.gql'
|
|
6
4
|
|
|
7
5
|
export function cartItemToDatalayerItem<P extends CartItem_DatalayerItemFragment>(
|
|
8
6
|
item: P,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cartItemToDatalayerItem } from '../cartItemToDatalayerItem/cartItemToDatalayerItem'
|
|
2
2
|
import { datalayerItemsToCurrencyValue } from '../datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
3
|
-
import { CartItem_RemoveFromCartFragment } from './CartItem_RemoveFromCart.gql'
|
|
3
|
+
import type { CartItem_RemoveFromCartFragment } from './CartItem_RemoveFromCart.gql'
|
|
4
4
|
|
|
5
5
|
export const cartItemToRemoveFromCart = <C extends CartItem_RemoveFromCartFragment>(
|
|
6
6
|
cartItem: C,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ViewCart } from '../cartToViewCart/cartToViewCart'
|
|
2
|
+
import { cartToViewCart } from '../cartToViewCart/cartToViewCart'
|
|
3
|
+
import type { Cart_AddPaymentInfoFragment } from './Cart_AddPaymentInfo.gql'
|
|
3
4
|
|
|
4
5
|
export type AddPaymentInfo = ViewCart & {
|
|
5
6
|
coupon?: string
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ViewCart } from '../cartToViewCart/cartToViewCart'
|
|
3
|
+
import { cartToViewCart } from '../cartToViewCart/cartToViewCart'
|
|
4
|
+
import type { Cart_AddShippingInfoFragment } from './Cart_AddShippingInfo.gql'
|
|
4
5
|
|
|
5
6
|
export type AddShippingInfo = ViewCart & {
|
|
6
7
|
coupon?: string
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ViewCart } from '../cartToViewCart/cartToViewCart'
|
|
2
|
+
import { cartToViewCart } from '../cartToViewCart/cartToViewCart'
|
|
3
|
+
import type { Cart_BeginCheckoutFragment } from './Cart_BeginCheckout.gql'
|
|
3
4
|
|
|
4
5
|
export type BeginCheckout = ViewCart & {
|
|
5
6
|
coupon?: string
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ViewCart } from '../cartToViewCart/cartToViewCart'
|
|
2
|
+
import { cartToViewCart } from '../cartToViewCart/cartToViewCart'
|
|
3
|
+
import type { Cart_PurchaseEventFragment } from './Cart_PurchaseEvent.gql'
|
|
3
4
|
|
|
4
5
|
export type PurchaseOrRefund = ViewCart & {
|
|
5
6
|
transaction_id: string
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { nonNullable } from '@graphcommerce/next-ui'
|
|
2
2
|
import { cartItemToDatalayerItem } from '../cartItemToDatalayerItem/cartItemToDatalayerItem'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
import { GoogleDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
8
|
-
import { Cart_ViewCartFragment } from './Cart_ViewCart.gql'
|
|
3
|
+
import type { DataLayerCurrencyValue } from '../datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
4
|
+
import { datalayerItemsToCurrencyValue } from '../datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
5
|
+
import type { GoogleDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
6
|
+
import type { Cart_ViewCartFragment } from './Cart_ViewCart.gql'
|
|
9
7
|
|
|
10
8
|
export type ViewCart = DataLayerCurrencyValue & { items: GoogleDatalayerItem[] }
|
|
11
9
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ProductFilterParams, ProductListItemFragment } from '@graphcommerce/magento-product'
|
|
1
|
+
import type { ProductFilterParams, ProductListItemFragment } from '@graphcommerce/magento-product'
|
|
2
2
|
import { nonNullable } from '@graphcommerce/next-ui'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
productToDatalayerItem,
|
|
6
|
-
} from '../productToDatalayerItem/productToDatalayerItem'
|
|
3
|
+
import type { GoogleDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
4
|
+
import { productToDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
7
5
|
|
|
8
6
|
export type ViewItemList = {
|
|
9
7
|
item_list_id: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { productPageCategory } from '@graphcommerce/magento-product'
|
|
2
2
|
import { nonNullable } from '@graphcommerce/next-ui'
|
|
3
|
-
import { Product_DatalayerItemFragment } from './Product_DatalayerItem.gql'
|
|
3
|
+
import type { Product_DatalayerItemFragment } from './Product_DatalayerItem.gql'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* https://developers.google.com/tag-platform/gtagjs/reference/events#add_to_cart_item
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '../
|
|
5
|
-
import {
|
|
6
|
-
GoogleDatalayerItem,
|
|
7
|
-
productToDatalayerItem,
|
|
8
|
-
} from '../productToDatalayerItem/productToDatalayerItem'
|
|
9
|
-
import { Product_ViewItemFragment } from './Product_ViewItem.gql'
|
|
1
|
+
import type { DataLayerCurrencyValue } from '../datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
2
|
+
import { datalayerItemsToCurrencyValue } from '../datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
3
|
+
import type { GoogleDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
4
|
+
import { productToDatalayerItem } from '../productToDatalayerItem/productToDatalayerItem'
|
|
5
|
+
import type { Product_ViewItemFragment } from './Product_ViewItem.gql'
|
|
10
6
|
|
|
11
7
|
export type ViewItem = { items: GoogleDatalayerItem[] } & DataLayerCurrencyValue
|
|
12
8
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/google-datalayer",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.103",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,14 +12,15 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
16
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
|
17
|
-
"@graphcommerce/magento-cart-payment-method": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/magento-cart-shipping-method": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/magento-product": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
22
|
-
"@graphcommerce/
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.103",
|
|
16
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.103",
|
|
17
|
+
"@graphcommerce/magento-cart-payment-method": "^9.0.0-canary.103",
|
|
18
|
+
"@graphcommerce/magento-cart-shipping-method": "^9.0.0-canary.103",
|
|
19
|
+
"@graphcommerce/magento-product": "^9.0.0-canary.103",
|
|
20
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.103",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.103",
|
|
22
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.103",
|
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.103",
|
|
23
24
|
"@mui/material": "^5.14.20",
|
|
24
25
|
"next": "^14",
|
|
25
26
|
"react": "^18.2.0",
|
|
@@ -43,6 +44,6 @@
|
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"web-vitals": "^
|
|
47
|
+
"web-vitals": "^4.2.3"
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
findAddedItems,
|
|
4
|
-
toUserErrors,
|
|
5
|
-
} from '@graphcommerce/magento-product'
|
|
1
|
+
import type { AddProductsToCartFormProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import { findAddedItems, toUserErrors } from '@graphcommerce/magento-product'
|
|
6
3
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
7
4
|
import { nonNullable } from '@graphcommerce/next-ui'
|
|
8
5
|
import { useSendEvent } from '../api/sendEvent'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartStartCheckoutProps } from '@graphcommerce/magento-cart'
|
|
1
|
+
import type { CartStartCheckoutProps } from '@graphcommerce/magento-cart'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useMemoObject } from '@graphcommerce/next-ui'
|
|
4
4
|
import { useEffect, useRef } from 'react'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartStartCheckoutLinkOrButtonProps } from '@graphcommerce/magento-cart'
|
|
1
|
+
import type { CartStartCheckoutLinkOrButtonProps } from '@graphcommerce/magento-cart'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useSendEvent } from '../api/sendEvent'
|
|
4
4
|
import { cartToBeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCartQuery } from '@graphcommerce/magento-cart'
|
|
2
|
-
import { PaymentMethodButtonProps } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
+
import type { PaymentMethodButtonProps } from '@graphcommerce/magento-cart-payment-method'
|
|
3
3
|
import { GetPaymentMethodContextDocument } from '@graphcommerce/magento-cart-payment-method/PaymentMethodContext/GetPaymentMethodContext.gql'
|
|
4
4
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
5
5
|
import { useSendEvent } from '../api/sendEvent'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductListItemProps } from '@graphcommerce/magento-product'
|
|
1
|
+
import type { ProductListItemProps } from '@graphcommerce/magento-product'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useEventCallback } from '@mui/material'
|
|
4
4
|
import { useViewItemList } from '../components/DatalayerViewItemList'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShippingMethodFormProps } from '@graphcommerce/magento-cart-shipping-method'
|
|
1
|
+
import type { ShippingMethodFormProps } from '@graphcommerce/magento-cart-shipping-method'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useSendEvent } from '../api/sendEvent'
|
|
4
4
|
import { cartToAddShippingInfo } from '../mapping/cartToAddShippingInfo/cartToAddShippingInfo'
|
|
@@ -2,7 +2,8 @@ import type { PagesProps } from '@graphcommerce/framer-next-pages'
|
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useEventCallback } from '@mui/material'
|
|
4
4
|
import { useEffect } from 'react'
|
|
5
|
-
import {
|
|
5
|
+
import type { Metric } from 'web-vitals/attribution'
|
|
6
|
+
import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals/attribution'
|
|
6
7
|
import { useSendEvent } from '../api/sendEvent'
|
|
7
8
|
|
|
8
9
|
export const config: PluginConfig = {
|
|
@@ -32,8 +33,7 @@ export function FramerNextPages(props: PluginProps<PagesProps>) {
|
|
|
32
33
|
const opts = { reportAllChanges: true }
|
|
33
34
|
onCLS((m) => sendCoreWebVitals(m, m.attribution.largestShiftTarget))
|
|
34
35
|
onFCP((m) => sendCoreWebVitals(m), opts)
|
|
35
|
-
|
|
36
|
-
onINP((m) => sendCoreWebVitals(m, m.attribution.eventTarget), opts)
|
|
36
|
+
onINP((m) => sendCoreWebVitals(m, m.attribution.interactionTarget), opts)
|
|
37
37
|
onLCP((m) => sendCoreWebVitals(m, m.attribution.element), opts)
|
|
38
38
|
onTTFB((m) => sendCoreWebVitals(m), opts)
|
|
39
39
|
}, [sendCoreWebVitals])
|