@graphcommerce/googleanalytics 7.0.0-canary.21 → 7.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 CHANGED
@@ -1,6 +1,190 @@
1
1
  # Change Log
2
2
 
3
- ## 7.0.0-canary.21
3
+ ## 7.0.1-canary.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2047](https://github.com/graphcommerce-org/graphcommerce/pull/2047) [`f1200dada`](https://github.com/graphcommerce-org/graphcommerce/commit/f1200dadabb12a6d892de6c7b4dd4bf53a54f884) - Solved an issue the events wouldn't fire for RemoveItemFromCart and UpdateItemQuantity ([@paales](https://github.com/paales))
8
+
9
+ - [#2047](https://github.com/graphcommerce-org/graphcommerce/pull/2047) [`136580b39`](https://github.com/graphcommerce-org/graphcommerce/commit/136580b39e3cffdd07e3fa087e049bd532c3e8f1) - Updated all dependencies to the latest version where possible. ([@paales](https://github.com/paales))
10
+
11
+ ## 7.0.0
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1944](https://github.com/graphcommerce-org/graphcommerce/pull/1944) [`d83c92b76`](https://github.com/graphcommerce-org/graphcommerce/commit/d83c92b767cfab24b33b7530837e601f1b49de38) - When there are no items in the cart, do not send a viewCart event ([@paales](https://github.com/paales))
16
+
17
+ - [#1915](https://github.com/graphcommerce-org/graphcommerce/pull/1915) [`4c8d6fc73`](https://github.com/graphcommerce-org/graphcommerce/commit/4c8d6fc734a83b9ffa078abf10b26c65e49f4940) - GaViewItem would still be enabled even when googleAnalyticsId was enabled ([@paales](https://github.com/paales))
18
+
19
+ - [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
20
+
21
+ ## 6.2.0-canary.98
22
+
23
+ ## 6.2.0-canary.97
24
+
25
+ ## 6.2.0-canary.96
26
+
27
+ ## 6.2.0-canary.95
28
+
29
+ ## 6.2.0-canary.94
30
+
31
+ ## 6.2.0-canary.93
32
+
33
+ ## 6.2.0-canary.92
34
+
35
+ ## 6.2.0-canary.91
36
+
37
+ ## 6.2.0-canary.90
38
+
39
+ ## 6.2.0-canary.89
40
+
41
+ ### Patch Changes
42
+
43
+ - [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
44
+
45
+ ## 6.2.0-canary.88
46
+
47
+ ### Patch Changes
48
+
49
+ - [`372c8974b`](https://github.com/graphcommerce-org/graphcommerce/commit/372c8974b8724a603d5d9e80f708a2d695055559) - Fix regression with the new cart renderer ([@paales](https://github.com/paales))
50
+
51
+ ## 6.2.0-canary.87
52
+
53
+ ## 6.2.0-canary.86
54
+
55
+ ## 6.2.0-canary.85
56
+
57
+ ## 6.2.0-canary.84
58
+
59
+ ## 6.2.0-canary.83
60
+
61
+ ## 6.2.0-canary.82
62
+
63
+ ## 6.2.0-canary.81
64
+
65
+ ## 6.2.0-canary.80
66
+
67
+ ## 6.2.0-canary.79
68
+
69
+ ## 6.2.0-canary.78
70
+
71
+ ## 6.2.0-canary.77
72
+
73
+ ## 6.2.0-canary.76
74
+
75
+ ## 6.2.0-canary.75
76
+
77
+ ## 6.2.0-canary.74
78
+
79
+ ## 6.2.0-canary.73
80
+
81
+ ## 6.2.0-canary.72
82
+
83
+ ## 6.2.0-canary.71
84
+
85
+ ## 6.2.0-canary.70
86
+
87
+ ## 6.2.0-canary.69
88
+
89
+ ## 6.2.0-canary.68
90
+
91
+ ## 6.2.0-canary.67
92
+
93
+ ## 6.2.0-canary.66
94
+
95
+ ## 6.2.0-canary.65
96
+
97
+ ## 6.2.0-canary.64
98
+
99
+ ## 6.2.0-canary.63
100
+
101
+ ## 6.2.0-canary.62
102
+
103
+ ## 6.2.0-canary.61
104
+
105
+ ## 6.2.0-canary.60
106
+
107
+ ## 6.2.0-canary.59
108
+
109
+ ## 6.2.0-canary.58
110
+
111
+ ## 6.2.0-canary.57
112
+
113
+ ## 6.2.0-canary.56
114
+
115
+ ## 6.2.0-canary.55
116
+
117
+ ## 6.2.0-canary.54
118
+
119
+ ## 6.2.0-canary.53
120
+
121
+ ## 6.2.0-canary.52
122
+
123
+ ## 6.2.0-canary.51
124
+
125
+ ## 6.2.0-canary.50
126
+
127
+ ## 6.2.0-canary.49
128
+
129
+ ## 6.2.0-canary.48
130
+
131
+ ## 6.2.0-canary.47
132
+
133
+ ## 6.2.0-canary.46
134
+
135
+ ## 6.2.0-canary.45
136
+
137
+ ## 6.2.0-canary.44
138
+
139
+ ## 6.2.0-canary.43
140
+
141
+ ## 6.2.0-canary.42
142
+
143
+ ## 6.2.0-canary.41
144
+
145
+ ## 6.2.0-canary.40
146
+
147
+ ## 6.2.0-canary.39
148
+
149
+ ## 6.2.0-canary.38
150
+
151
+ ## 6.2.0-canary.37
152
+
153
+ ## 6.2.0-canary.36
154
+
155
+ ## 6.2.0-canary.35
156
+
157
+ ## 6.2.0-canary.34
158
+
159
+ ## 6.2.0-canary.33
160
+
161
+ ## 6.2.0-canary.32
162
+
163
+ ## 6.2.0-canary.31
164
+
165
+ ## 6.2.0-canary.30
166
+
167
+ ## 6.2.0-canary.29
168
+
169
+ ## 6.2.0-canary.28
170
+
171
+ ## 6.2.0-canary.27
172
+
173
+ ## 6.2.0-canary.26
174
+
175
+ ## 6.2.0-canary.25
176
+
177
+ ### Patch Changes
178
+
179
+ - [#1944](https://github.com/graphcommerce-org/graphcommerce/pull/1944) [`d83c92b76`](https://github.com/graphcommerce-org/graphcommerce/commit/d83c92b767cfab24b33b7530837e601f1b49de38) - When there are no items in the cart, do not send a viewCart event ([@paales](https://github.com/paales))
180
+
181
+ ## 6.2.0-canary.24
182
+
183
+ ## 6.2.0-canary.23
184
+
185
+ ## 6.2.0-canary.22
186
+
187
+ ## 6.2.0-canary.21
4
188
 
5
189
  ## 6.2.0-canary.20
6
190
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/googleanalytics",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "7.0.0-canary.21",
5
+ "version": "7.0.1-canary.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,19 +12,19 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@graphcommerce/graphql-mesh": "7.0.0-canary.21",
16
- "@graphcommerce/magento-cart": "7.0.0-canary.21",
17
- "@graphcommerce/magento-cart-payment-method": "7.0.0-canary.21",
18
- "@graphcommerce/magento-cart-shipping-method": "7.0.0-canary.21",
19
- "@graphcommerce/magento-product": "7.0.0-canary.21",
20
- "@graphcommerce/next-config": "7.0.0-canary.21",
21
- "@graphcommerce/next-ui": "7.0.0-canary.21"
15
+ "@graphcommerce/graphql-mesh": "7.0.1-canary.0",
16
+ "@graphcommerce/magento-cart": "7.0.1-canary.0",
17
+ "@graphcommerce/magento-cart-payment-method": "7.0.1-canary.0",
18
+ "@graphcommerce/magento-cart-shipping-method": "7.0.1-canary.0",
19
+ "@graphcommerce/magento-product": "7.0.1-canary.0",
20
+ "@graphcommerce/next-config": "7.0.1-canary.0",
21
+ "@graphcommerce/next-ui": "7.0.1-canary.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@graphcommerce/eslint-config-pwa": "7.0.0-canary.21",
25
- "@graphcommerce/prettier-config-pwa": "7.0.0-canary.21",
26
- "@graphcommerce/typescript-config-pwa": "7.0.0-canary.21",
27
- "@types/gtag.js": "^0.0.12"
24
+ "@graphcommerce/eslint-config-pwa": "7.0.1-canary.0",
25
+ "@graphcommerce/prettier-config-pwa": "7.0.1-canary.0",
26
+ "@graphcommerce/typescript-config-pwa": "7.0.1-canary.0",
27
+ "@types/gtag.js": "^0.0.13"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@mui/material": "^5.10.16",
@@ -16,7 +16,11 @@ export function GaCartStartCheckoutLinkOrButton(
16
16
 
17
17
  const cartObject = useMemoObject({ items: rest.items, prices: rest.prices })
18
18
 
19
- useEffect(() => gtagViewCart(cartObject), [cartObject])
19
+ useEffect(() => {
20
+ if (cartObject.items) {
21
+ gtagViewCart(cartObject)
22
+ }
23
+ }, [cartObject])
20
24
 
21
25
  return (
22
26
  <Prev
@@ -1,32 +1,26 @@
1
- import { RemoveItemFromCartProps } from '@graphcommerce/magento-cart-items'
2
- import { IfConfig, PluginProps } from '@graphcommerce/next-config'
1
+ import type { RemoveItemFromCart } from '@graphcommerce/magento-cart-items'
2
+ import { IfConfig, ReactPlugin } from '@graphcommerce/next-config'
3
3
  import { gtagRemoveFromCart } from '../events/gtagRemoveFromCart/gtagRemoveFromCart'
4
4
 
5
- export const component = 'RemoveItemFromCartFab'
6
- export const exported = '@graphcommerce/magento-cart-items/RemoveItemFromCart/RemoveItemFromCartFab'
5
+ export const component = 'RemoveItemFromCart'
6
+ export const exported = '@graphcommerce/magento-cart-items/components/RemoveItemFromCart/RemoveItemFromCart'
7
7
  export const ifConfig: IfConfig = 'googleAnalyticsId'
8
8
 
9
- export function GaRemoveItemFromCart(props: PluginProps<RemoveItemFromCartProps>) {
10
- const { Prev, uid, quantity, prices, product, onClick } = props
9
+ export const GaRemoveItemFromCart: ReactPlugin<typeof RemoveItemFromCart> = (props) => {
10
+ const { Prev, uid, quantity, prices, product, buttonProps } = props
11
11
 
12
12
  return (
13
13
  <Prev
14
14
  {...props}
15
15
  product={product}
16
- onClick={(e) => {
17
- gtagRemoveFromCart({
18
- __typename: 'Cart',
19
- items: [
20
- {
21
- uid,
22
- __typename: 'SimpleCartItem',
23
- product,
24
- quantity,
25
- prices,
26
- },
27
- ],
28
- })
29
- onClick?.(e)
16
+ buttonProps={{
17
+ onClick: (e) => {
18
+ gtagRemoveFromCart({
19
+ __typename: 'Cart',
20
+ items: [{ uid, __typename: 'SimpleCartItem', product, quantity, prices }],
21
+ })
22
+ buttonProps?.onClick?.(e)
23
+ },
30
24
  }}
31
25
  />
32
26
  )
@@ -0,0 +1,29 @@
1
+ import type { RemoveItemFromCartFab } from '@graphcommerce/magento-cart-items'
2
+ import { IfConfig, ReactPlugin } from '@graphcommerce/next-config'
3
+ import { gtagRemoveFromCart } from '../events/gtagRemoveFromCart/gtagRemoveFromCart'
4
+
5
+ export const component = 'RemoveItemFromCartFab'
6
+ export const exported = '@graphcommerce/magento-cart-items/components/RemoveItemFromCart/RemoveItemFromCartFab'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
8
+
9
+ export const GaRemoveItemFromCartFab: ReactPlugin<typeof RemoveItemFromCartFab> = (props) => {
10
+ const { Prev, uid, quantity, prices, product, fabProps } = props
11
+
12
+ return (
13
+ <Prev
14
+ {...props}
15
+ product={product}
16
+ fabProps={{
17
+ onClick: (e) => {
18
+ gtagRemoveFromCart({
19
+ __typename: 'Cart',
20
+ items: [{ uid, __typename: 'SimpleCartItem', product, quantity, prices }],
21
+ })
22
+ fabProps?.onClick?.(e)
23
+ },
24
+ }}
25
+ />
26
+ )
27
+ }
28
+
29
+ export const Plugin = GaRemoveItemFromCartFab
@@ -2,7 +2,7 @@ import type { UpdateItemQuantityProps } from '@graphcommerce/magento-cart-items'
2
2
  import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
 
4
4
  export const component = 'UpdateItemQuantity'
5
- export const exported = '@graphcommerce/magento-cart-items/UpdateItemQuantity/UpdateItemQuantity'
5
+ export const exported = '@graphcommerce/magento-cart-items/components/UpdateItemQuantity/UpdateItemQuantity'
6
6
  export const ifConfig: IfConfig = 'googleAnalyticsId'
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { ProductPageMetaFragment } from '@graphcommerce/magento-product/components/ProductPageMeta/ProductPageMeta.gql'
1
+ import type { ProductPageMeta } from '@graphcommerce/magento-product'
2
2
  import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { useMemoObject } from '@graphcommerce/next-ui'
4
4
  import { useEffect } from 'react'
@@ -9,13 +9,14 @@ export const exported = '@graphcommerce/magento-product'
9
9
  export const ifConfig: IfConfig = 'googleAnalyticsId'
10
10
 
11
11
  /** When a product is added to the Cart, send a Google Analytics event */
12
- function GaViewItem(props: PluginProps<ProductPageMetaFragment>) {
13
- const { Prev, price_range } = props
12
+ function GaViewItem(props: PluginProps<React.ComponentProps<typeof ProductPageMeta>>) {
13
+ const { Prev, product } = props
14
+ const { price_range } = product
14
15
 
15
16
  const viewItem = useMemoObject({
16
17
  currency: price_range.minimum_price.final_price.currency,
17
18
  value: price_range.minimum_price.final_price.value,
18
- items: [productToGtagItem(props)],
19
+ items: [productToGtagItem(product)],
19
20
  })
20
21
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
21
22
  useEffect(() => globalThis.gtag?.('event', 'view_item', viewItem), [viewItem])