@graphcommerce/google-datalayer 9.0.0-canary.99 → 9.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 +34 -205
- 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 +12 -11
- 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,90 +1,72 @@
|
|
|
1
1
|
# @graphcommerce/google-datalayer
|
|
2
2
|
|
|
3
|
-
## 9.0.
|
|
3
|
+
## 9.0.1-canary.0
|
|
4
4
|
|
|
5
|
-
## 9.0.0
|
|
5
|
+
## 9.0.0
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## 9.0.0-canary.96
|
|
10
|
-
|
|
11
|
-
## 9.0.0-canary.95
|
|
12
|
-
|
|
13
|
-
## 9.0.0-canary.94
|
|
14
|
-
|
|
15
|
-
## 9.0.0-canary.93
|
|
16
|
-
|
|
17
|
-
## 9.0.0-canary.92
|
|
7
|
+
### Minor Changes
|
|
18
8
|
|
|
19
|
-
|
|
9
|
+
- [#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))
|
|
20
10
|
|
|
21
|
-
|
|
11
|
+
### Patch Changes
|
|
22
12
|
|
|
23
|
-
|
|
13
|
+
- [#2341](https://github.com/graphcommerce-org/graphcommerce/pull/2341) [`e3fe4f7`](https://github.com/graphcommerce-org/graphcommerce/commit/e3fe4f73c8c3e3c6a5ec68cdc7a32820e8f69e07) - Solved an issue where the `BillingPage` query would be re-queried after setting the payment method. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
- [#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))
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
- [#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))
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
- [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Prevent the `<BillingPage />` query from rerunning on each mutation. ([@FrankHarland](https://github.com/FrankHarland))
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
- [#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))
|
|
32
22
|
|
|
33
|
-
## 9.0.0-canary.
|
|
23
|
+
## 9.0.0-canary.118
|
|
34
24
|
|
|
35
|
-
## 9.0.0-canary.
|
|
25
|
+
## 9.0.0-canary.117
|
|
36
26
|
|
|
37
|
-
## 9.0.0-canary.
|
|
27
|
+
## 9.0.0-canary.116
|
|
38
28
|
|
|
39
|
-
## 9.0.0-canary.
|
|
29
|
+
## 9.0.0-canary.115
|
|
40
30
|
|
|
41
|
-
## 9.0.0-canary.
|
|
31
|
+
## 9.0.0-canary.114
|
|
42
32
|
|
|
43
|
-
|
|
33
|
+
## 9.0.0-canary.113
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
## 9.0.0-canary.112
|
|
46
36
|
|
|
47
|
-
## 9.0.0-canary.
|
|
37
|
+
## 9.0.0-canary.111
|
|
48
38
|
|
|
49
|
-
## 9.0.0-canary.
|
|
39
|
+
## 9.0.0-canary.110
|
|
50
40
|
|
|
51
|
-
## 9.0.0-canary.
|
|
41
|
+
## 9.0.0-canary.109
|
|
52
42
|
|
|
53
|
-
## 9.0.0-canary.
|
|
43
|
+
## 9.0.0-canary.108
|
|
54
44
|
|
|
55
|
-
## 9.0.0-canary.
|
|
45
|
+
## 9.0.0-canary.107
|
|
56
46
|
|
|
57
|
-
## 9.0.0-canary.
|
|
47
|
+
## 9.0.0-canary.106
|
|
58
48
|
|
|
59
|
-
## 9.0.0-canary.
|
|
49
|
+
## 9.0.0-canary.105
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
## 9.0.0-canary.104
|
|
62
52
|
|
|
63
|
-
|
|
53
|
+
## 9.0.0-canary.103
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## 9.0.0-canary.71
|
|
68
|
-
|
|
69
|
-
## 9.0.0-canary.70
|
|
70
|
-
|
|
71
|
-
## 9.0.0-canary.69
|
|
72
|
-
|
|
73
|
-
## 9.0.0-canary.68
|
|
55
|
+
### Patch Changes
|
|
74
56
|
|
|
75
|
-
|
|
57
|
+
- [#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))
|
|
76
58
|
|
|
77
|
-
## 9.0.0-canary.
|
|
59
|
+
## 9.0.0-canary.80
|
|
78
60
|
|
|
79
|
-
|
|
61
|
+
### Patch Changes
|
|
80
62
|
|
|
81
|
-
|
|
63
|
+
- [#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))
|
|
82
64
|
|
|
83
|
-
## 9.0.0-canary.
|
|
65
|
+
## 9.0.0-canary.73
|
|
84
66
|
|
|
85
|
-
|
|
67
|
+
### Minor Changes
|
|
86
68
|
|
|
87
|
-
|
|
69
|
+
- [#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))
|
|
88
70
|
|
|
89
71
|
## 9.0.0-canary.60
|
|
90
72
|
|
|
@@ -92,134 +74,18 @@
|
|
|
92
74
|
|
|
93
75
|
- [#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))
|
|
94
76
|
|
|
95
|
-
## 9.0.0-canary.59
|
|
96
|
-
|
|
97
|
-
## 9.0.0-canary.58
|
|
98
|
-
|
|
99
|
-
## 9.0.0-canary.57
|
|
100
|
-
|
|
101
|
-
## 9.0.0-canary.56
|
|
102
|
-
|
|
103
|
-
## 9.0.0-canary.55
|
|
104
|
-
|
|
105
|
-
## 9.0.0-canary.54
|
|
106
|
-
|
|
107
|
-
## 8.1.0-canary.53
|
|
108
|
-
|
|
109
|
-
## 8.1.0-canary.52
|
|
110
|
-
|
|
111
|
-
## 8.1.0-canary.51
|
|
112
|
-
|
|
113
|
-
## 8.1.0-canary.50
|
|
114
|
-
|
|
115
|
-
## 8.1.0-canary.49
|
|
116
|
-
|
|
117
|
-
## 8.1.0-canary.48
|
|
118
|
-
|
|
119
|
-
## 8.1.0-canary.47
|
|
120
|
-
|
|
121
|
-
## 8.1.0-canary.46
|
|
122
|
-
|
|
123
|
-
## 8.1.0-canary.45
|
|
124
|
-
|
|
125
|
-
## 8.1.0-canary.44
|
|
126
|
-
|
|
127
|
-
## 8.1.0-canary.43
|
|
128
|
-
|
|
129
|
-
## 8.1.0-canary.42
|
|
130
|
-
|
|
131
|
-
## 8.1.0-canary.41
|
|
132
|
-
|
|
133
|
-
## 8.1.0-canary.40
|
|
134
|
-
|
|
135
|
-
## 8.1.0-canary.39
|
|
136
|
-
|
|
137
|
-
## 8.1.0-canary.38
|
|
138
|
-
|
|
139
|
-
## 8.1.0-canary.37
|
|
140
|
-
|
|
141
|
-
## 8.1.0-canary.36
|
|
142
|
-
|
|
143
|
-
## 8.1.0-canary.35
|
|
144
|
-
|
|
145
|
-
## 8.1.0-canary.34
|
|
146
|
-
|
|
147
|
-
## 8.1.0-canary.33
|
|
148
|
-
|
|
149
|
-
## 8.1.0-canary.32
|
|
150
|
-
|
|
151
|
-
## 8.1.0-canary.31
|
|
152
|
-
|
|
153
|
-
## 8.1.0-canary.30
|
|
154
|
-
|
|
155
|
-
## 8.1.0-canary.29
|
|
156
|
-
|
|
157
|
-
## 8.1.0-canary.28
|
|
158
|
-
|
|
159
|
-
## 8.1.0-canary.27
|
|
160
|
-
|
|
161
|
-
## 8.1.0-canary.26
|
|
162
|
-
|
|
163
|
-
## 8.1.0-canary.25
|
|
164
|
-
|
|
165
|
-
## 8.1.0-canary.24
|
|
166
|
-
|
|
167
|
-
## 8.1.0-canary.23
|
|
168
|
-
|
|
169
|
-
## 8.1.0-canary.22
|
|
170
|
-
|
|
171
|
-
## 8.1.0-canary.21
|
|
172
|
-
|
|
173
77
|
## 8.1.0-canary.20
|
|
174
78
|
|
|
175
79
|
### Patch Changes
|
|
176
80
|
|
|
177
81
|
- [#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))
|
|
178
82
|
|
|
179
|
-
## 8.1.0-canary.19
|
|
180
|
-
|
|
181
|
-
## 8.1.0-canary.18
|
|
182
|
-
|
|
183
|
-
## 8.1.0-canary.17
|
|
184
|
-
|
|
185
|
-
## 8.1.0-canary.16
|
|
186
|
-
|
|
187
|
-
## 8.1.0-canary.15
|
|
188
|
-
|
|
189
|
-
## 8.1.0-canary.14
|
|
190
|
-
|
|
191
|
-
## 8.1.0-canary.13
|
|
192
|
-
|
|
193
|
-
## 8.1.0-canary.12
|
|
194
|
-
|
|
195
|
-
## 8.1.0-canary.11
|
|
196
|
-
|
|
197
|
-
## 8.1.0-canary.10
|
|
198
|
-
|
|
199
|
-
## 8.1.0-canary.9
|
|
200
|
-
|
|
201
|
-
## 8.1.0-canary.8
|
|
202
|
-
|
|
203
|
-
## 8.1.0-canary.7
|
|
204
|
-
|
|
205
|
-
## 8.1.0-canary.6
|
|
206
|
-
|
|
207
|
-
## 8.1.0-canary.5
|
|
208
|
-
|
|
209
|
-
## 8.0.6-canary.4
|
|
210
|
-
|
|
211
|
-
## 8.0.6-canary.3
|
|
212
|
-
|
|
213
83
|
## 8.0.6-canary.2
|
|
214
84
|
|
|
215
85
|
### Patch Changes
|
|
216
86
|
|
|
217
87
|
- [#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))
|
|
218
88
|
|
|
219
|
-
## 8.0.6-canary.1
|
|
220
|
-
|
|
221
|
-
## 8.0.6-canary.0
|
|
222
|
-
|
|
223
89
|
## 8.0.5
|
|
224
90
|
|
|
225
91
|
### Patch Changes
|
|
@@ -231,45 +97,8 @@
|
|
|
231
97
|
|
|
232
98
|
- [#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))
|
|
233
99
|
|
|
234
|
-
## 8.0.5-canary.10
|
|
235
|
-
|
|
236
|
-
## 8.0.5-canary.9
|
|
237
|
-
|
|
238
|
-
## 8.0.5-canary.8
|
|
239
|
-
|
|
240
|
-
## 8.0.5-canary.7
|
|
241
|
-
|
|
242
|
-
## 8.0.5-canary.6
|
|
243
|
-
|
|
244
|
-
## 8.0.5-canary.5
|
|
245
|
-
|
|
246
|
-
## 8.0.5-canary.4
|
|
247
|
-
|
|
248
|
-
## 8.0.5-canary.3
|
|
249
|
-
|
|
250
|
-
## 8.0.5-canary.2
|
|
251
|
-
|
|
252
|
-
## 8.0.5-canary.1
|
|
253
|
-
|
|
254
|
-
### Patch Changes
|
|
255
|
-
|
|
256
|
-
- [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`f120bce`](https://github.com/graphcommerce-org/graphcommerce/commit/f120bce617808d756aebb7c500aa1deb9e4cf487) - Google Datalayer, Analytics and Tagmanager improvements.
|
|
257
|
-
|
|
258
|
-
- 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.
|
|
259
|
-
- Created cartItemToGoogleDatalayerItem and productToGoogleDatalayerItem for easier modifications. ([@paales](https://github.com/paales))
|
|
260
|
-
|
|
261
|
-
- [#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))
|
|
262
|
-
|
|
263
|
-
## 8.0.5-canary.0
|
|
264
|
-
|
|
265
100
|
## 8.0.4
|
|
266
101
|
|
|
267
102
|
### Patch Changes
|
|
268
103
|
|
|
269
104
|
- [#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))
|
|
270
|
-
|
|
271
|
-
## 8.0.4-canary.1
|
|
272
|
-
|
|
273
|
-
### Patch Changes
|
|
274
|
-
|
|
275
|
-
- [#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.
|
|
5
|
+
"version": "9.0.1-canary.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,16 +12,17 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.
|
|
16
|
-
"@graphcommerce/magento-cart": "^9.0.
|
|
17
|
-
"@graphcommerce/magento-cart-payment-method": "^9.0.
|
|
18
|
-
"@graphcommerce/magento-cart-shipping-method": "^9.0.
|
|
19
|
-
"@graphcommerce/magento-product": "^9.0.
|
|
20
|
-
"@graphcommerce/next-ui": "^9.0.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.
|
|
22
|
-
"@graphcommerce/
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.1-canary.0",
|
|
16
|
+
"@graphcommerce/magento-cart": "^9.0.1-canary.0",
|
|
17
|
+
"@graphcommerce/magento-cart-payment-method": "^9.0.1-canary.0",
|
|
18
|
+
"@graphcommerce/magento-cart-shipping-method": "^9.0.1-canary.0",
|
|
19
|
+
"@graphcommerce/magento-product": "^9.0.1-canary.0",
|
|
20
|
+
"@graphcommerce/next-ui": "^9.0.1-canary.0",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.1-canary.0",
|
|
22
|
+
"@graphcommerce/react-hook-form": "^9.0.1-canary.0",
|
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.1-canary.0",
|
|
23
24
|
"@mui/material": "^5.14.20",
|
|
24
|
-
"next": "
|
|
25
|
+
"next": "*",
|
|
25
26
|
"react": "^18.2.0",
|
|
26
27
|
"react-dom": "^18.2.0"
|
|
27
28
|
},
|
|
@@ -43,6 +44,6 @@
|
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"web-vitals": "^
|
|
47
|
+
"web-vitals": "^4.2.4"
|
|
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])
|