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