@graphcommerce/google-datalayer 9.1.0-canary.26 → 9.1.0-canary.29
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 +10 -0
- package/api/sendEvent.ts +0 -7
- package/components/DatalayerViewItemList.tsx +1 -1
- package/hooks/useSendEvent.ts +9 -0
- package/index.ts +1 -0
- package/package.json +10 -10
- package/plugins/GoogleDatalayerAddProductsToCartForm.tsx +1 -1
- package/plugins/GoogleDatalayerCartStartCheckout.tsx +1 -1
- package/plugins/GoogleDatalayerCartStartCheckoutLinkOrButton.tsx +1 -1
- package/plugins/GoogleDatalayerPaymentMethodButton.tsx +1 -1
- package/plugins/GoogleDatalayerPaymentMethodContextProvider.tsx +1 -1
- package/plugins/GoogleDatalayerRemoveItemFromCart.tsx +1 -1
- package/plugins/GoogleDatalayerShippingMethodForm.tsx +1 -1
- package/plugins/GoogleDatalayerUseRemoveItemFromCart.tsx +1 -1
- package/plugins/GoogleDatalayerViewItem.tsx +1 -1
- package/plugins/GoogleDatalayerWebVitals.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @graphcommerce/google-datalayer
|
|
2
2
|
|
|
3
|
+
## 9.1.0-canary.29
|
|
4
|
+
|
|
5
|
+
## 9.1.0-canary.28
|
|
6
|
+
|
|
7
|
+
## 9.1.0-canary.27
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#2514](https://github.com/graphcommerce-org/graphcommerce/pull/2514) [`57ece20`](https://github.com/graphcommerce-org/graphcommerce/commit/57ece2097b9a3799e1d0a459c006dab656d20b9d) - Solve an issue where Analytics and Tagmanager events wouldn't be sent. Split useSendEvent and sendEvent methods into two files so plugins can be correctly applied to each. ([@paales](https://github.com/paales))
|
|
12
|
+
|
|
3
13
|
## 9.1.0-canary.26
|
|
4
14
|
|
|
5
15
|
## 9.1.0-canary.25
|
package/api/sendEvent.ts
CHANGED
|
@@ -13,10 +13,3 @@ export function sendEvent<Event extends keyof GoogleEventTypes>(
|
|
|
13
13
|
) {
|
|
14
14
|
// This is a generic event handler and is plugins from google-analytics and google datalayer
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
export function useSendEvent() {
|
|
18
|
-
return <Event extends keyof GoogleEventTypes>(
|
|
19
|
-
eventName: Event,
|
|
20
|
-
eventData: GoogleEventTypes[Event],
|
|
21
|
-
) => sendEvent<Event>(eventName, eventData)
|
|
22
|
-
}
|
|
@@ -4,7 +4,7 @@ import { useMemoObject } from '@graphcommerce/next-ui'
|
|
|
4
4
|
import { useDebounce } from '@graphcommerce/react-hook-form'
|
|
5
5
|
import { useEventCallback } from '@mui/material'
|
|
6
6
|
import React, { useContext, useEffect, useRef } from 'react'
|
|
7
|
-
import { useSendEvent } from '../
|
|
7
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
8
8
|
import {
|
|
9
9
|
productItemsToViewItemList,
|
|
10
10
|
viewItemListToSelectItem,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GoogleEventTypes } from '../api/googleEventNames'
|
|
2
|
+
import { sendEvent } from '../api/sendEvent'
|
|
3
|
+
|
|
4
|
+
export function useSendEvent() {
|
|
5
|
+
return <Event extends keyof GoogleEventTypes>(
|
|
6
|
+
eventName: Event,
|
|
7
|
+
eventData: GoogleEventTypes[Event],
|
|
8
|
+
) => sendEvent<Event>(eventName, eventData)
|
|
9
|
+
}
|
package/index.ts
CHANGED
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.1.0-canary.
|
|
5
|
+
"version": "9.1.0-canary.29",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.
|
|
16
|
-
"@graphcommerce/magento-cart": "^9.1.0-canary.
|
|
17
|
-
"@graphcommerce/magento-cart-payment-method": "^9.1.0-canary.
|
|
18
|
-
"@graphcommerce/magento-cart-shipping-method": "^9.1.0-canary.
|
|
19
|
-
"@graphcommerce/magento-product": "^9.1.0-canary.
|
|
20
|
-
"@graphcommerce/next-ui": "^9.1.0-canary.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
|
22
|
-
"@graphcommerce/react-hook-form": "^9.1.0-canary.
|
|
23
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.29",
|
|
16
|
+
"@graphcommerce/magento-cart": "^9.1.0-canary.29",
|
|
17
|
+
"@graphcommerce/magento-cart-payment-method": "^9.1.0-canary.29",
|
|
18
|
+
"@graphcommerce/magento-cart-shipping-method": "^9.1.0-canary.29",
|
|
19
|
+
"@graphcommerce/magento-product": "^9.1.0-canary.29",
|
|
20
|
+
"@graphcommerce/next-ui": "^9.1.0-canary.29",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.29",
|
|
22
|
+
"@graphcommerce/react-hook-form": "^9.1.0-canary.29",
|
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.29",
|
|
24
24
|
"@mui/material": "^5.14.20",
|
|
25
25
|
"next": "*",
|
|
26
26
|
"react": "^18.2.0",
|
|
@@ -2,7 +2,7 @@ import type { AddProductsToCartFormProps } from '@graphcommerce/magento-product'
|
|
|
2
2
|
import { findAddedItems, toUserErrors } from '@graphcommerce/magento-product'
|
|
3
3
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
4
4
|
import { nonNullable } from '@graphcommerce/next-ui'
|
|
5
|
-
import { useSendEvent } from '../
|
|
5
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
6
6
|
import { cartItemToDatalayerItem } from '../mapping/cartItemToDatalayerItem/cartItemToDatalayerItem'
|
|
7
7
|
import { datalayerItemsToCurrencyValue } from '../mapping/datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ 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'
|
|
5
|
-
import { useSendEvent } from '../
|
|
5
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
6
6
|
import { cartToBeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
|
|
7
7
|
import { cartToViewCart } from '../mapping/cartToViewCart/cartToViewCart'
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CartStartCheckoutLinkOrButtonProps } from '@graphcommerce/magento-cart'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
|
-
import { useSendEvent } from '../
|
|
3
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
4
4
|
import { cartToBeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
|
|
5
5
|
|
|
6
6
|
export const config: PluginConfig = {
|
|
@@ -2,7 +2,7 @@ import { useCartQuery } from '@graphcommerce/magento-cart'
|
|
|
2
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
|
-
import { useSendEvent } from '../
|
|
5
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
6
6
|
import { cartToAddPaymentInfo } from '../mapping/cartToAddPaymentInfo/cartToAddPaymentInfo'
|
|
7
7
|
|
|
8
8
|
export const config: PluginConfig = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PaymentMethodContextProviderProps } from '@graphcommerce/magento-cart-payment-method'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
|
-
import { useSendEvent } from '../
|
|
3
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
4
4
|
import { cartToPurchase } from '../mapping/cartToPurchase/cartToPurchase'
|
|
5
5
|
|
|
6
6
|
export const config: PluginConfig = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { useRemoveItemFromCart as useRemoveItemFromCartBase } from '@graphcommerce/magento-cart-items'
|
|
2
2
|
import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
|
|
3
|
-
import { useSendEvent } from '../
|
|
3
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
4
4
|
import { cartItemToRemoveFromCart } from '../mapping/cartItemToRemoveFromCart/cartToRemoveFromCart'
|
|
5
5
|
|
|
6
6
|
export const config: PluginConfig = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShippingMethodFormProps } from '@graphcommerce/magento-cart-shipping-method'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
|
-
import { useSendEvent } from '../
|
|
3
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
4
4
|
import { cartToAddShippingInfo } from '../mapping/cartToAddShippingInfo/cartToAddShippingInfo'
|
|
5
5
|
|
|
6
6
|
export const config: PluginConfig = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UpdateItemQuantityProps } from '@graphcommerce/magento-cart-items'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
|
-
import { useSendEvent } from '../
|
|
3
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
4
4
|
import { cartItemToDatalayerItem } from '../mapping/cartItemToDatalayerItem/cartItemToDatalayerItem'
|
|
5
5
|
import { datalayerItemsToCurrencyValue } from '../mapping/datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import type { ProductPageMetaProps } from '@graphcommerce/magento-product'
|
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useMemoObject } from '@graphcommerce/next-ui'
|
|
4
4
|
import { useEffect } from 'react'
|
|
5
|
-
import { useSendEvent } from '../
|
|
5
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
6
6
|
import { productToViewItem } from '../mapping/productToViewItem/productToViewItem'
|
|
7
7
|
|
|
8
8
|
export const config: PluginConfig = {
|
|
@@ -4,7 +4,7 @@ import { useEventCallback } from '@mui/material'
|
|
|
4
4
|
import { useEffect } from 'react'
|
|
5
5
|
import type { Metric } from 'web-vitals/attribution'
|
|
6
6
|
import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals/attribution'
|
|
7
|
-
import { useSendEvent } from '../
|
|
7
|
+
import { useSendEvent } from '../hooks/useSendEvent'
|
|
8
8
|
|
|
9
9
|
export const config: PluginConfig = {
|
|
10
10
|
type: 'component',
|