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