@graphcommerce/google-datalayer 9.0.0-canary.59 → 9.0.0-canary.60

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,5 +1,11 @@
1
1
  # @graphcommerce/google-datalayer
2
2
 
3
+ ## 9.0.0-canary.60
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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))
8
+
3
9
  ## 9.0.0-canary.59
4
10
 
5
11
  ## 9.0.0-canary.58
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.59",
5
+ "version": "9.0.0-canary.60",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,14 +12,14 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.59",
16
- "@graphcommerce/magento-cart": "^9.0.0-canary.59",
17
- "@graphcommerce/magento-cart-payment-method": "^9.0.0-canary.59",
18
- "@graphcommerce/magento-cart-shipping-method": "^9.0.0-canary.59",
19
- "@graphcommerce/magento-product": "^9.0.0-canary.59",
20
- "@graphcommerce/next-ui": "^9.0.0-canary.59",
21
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.59",
22
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.59",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.60",
16
+ "@graphcommerce/magento-cart": "^9.0.0-canary.60",
17
+ "@graphcommerce/magento-cart-payment-method": "^9.0.0-canary.60",
18
+ "@graphcommerce/magento-cart-shipping-method": "^9.0.0-canary.60",
19
+ "@graphcommerce/magento-product": "^9.0.0-canary.60",
20
+ "@graphcommerce/next-ui": "^9.0.0-canary.60",
21
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.60",
22
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.60",
23
23
  "@mui/material": "^5.14.20",
24
24
  "next": "^14",
25
25
  "react": "^18.2.0",
@@ -3,17 +3,19 @@ import {
3
3
  findAddedItems,
4
4
  toUserErrors,
5
5
  } from '@graphcommerce/magento-product'
6
- import type { PluginProps } from '@graphcommerce/next-config'
6
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
7
7
  import { nonNullable } from '@graphcommerce/next-ui'
8
8
  import { sendEvent } from '../api/sendEvent'
9
9
  import { cartItemToDatalayerItem } from '../mapping/cartItemToDatalayerItem/cartItemToDatalayerItem'
10
10
  import { datalayerItemsToCurrencyValue } from '../mapping/datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
11
11
 
12
- export const component = 'AddProductsToCartForm'
13
- export const exported = '@graphcommerce/magento-product'
12
+ export const config: PluginConfig = {
13
+ module: '@graphcommerce/magento-product',
14
+ type: 'component',
15
+ }
14
16
 
15
17
  /** When a product is added to the Cart, send a Google Analytics event */
16
- function GoogleDatalayerAddProductsToCartForm(props: PluginProps<AddProductsToCartFormProps>) {
18
+ export function AddProductsToCartForm(props: PluginProps<AddProductsToCartFormProps>) {
17
19
  const { Prev, onComplete, ...rest } = props
18
20
 
19
21
  return (
@@ -48,5 +50,3 @@ function GoogleDatalayerAddProductsToCartForm(props: PluginProps<AddProductsToCa
48
50
  />
49
51
  )
50
52
  }
51
-
52
- export const Plugin = GoogleDatalayerAddProductsToCartForm
@@ -1,15 +1,17 @@
1
1
  import { CartStartCheckoutProps } from '@graphcommerce/magento-cart'
2
- import type { PluginProps } from '@graphcommerce/next-config'
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
5
  import { sendEvent } from '../api/sendEvent'
6
6
  import { cartToBeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
7
7
  import { cartToViewCart } from '../mapping/cartToViewCart/cartToViewCart'
8
8
 
9
- export const component = 'CartStartCheckout'
10
- export const exported = '@graphcommerce/magento-cart'
9
+ export const config: PluginConfig = {
10
+ module: '@graphcommerce/magento-cart',
11
+ type: 'component',
12
+ }
11
13
 
12
- export function GoogleDatalayerCartStartCheckout(props: PluginProps<CartStartCheckoutProps>) {
14
+ export function CartStartCheckout(props: PluginProps<CartStartCheckoutProps>) {
13
15
  const { Prev, onStart, ...rest } = props
14
16
 
15
17
  const send = useRef(false)
@@ -31,5 +33,3 @@ export function GoogleDatalayerCartStartCheckout(props: PluginProps<CartStartChe
31
33
  />
32
34
  )
33
35
  }
34
-
35
- export const Plugin = GoogleDatalayerCartStartCheckout
@@ -1,12 +1,14 @@
1
1
  import { CartStartCheckoutLinkOrButtonProps } from '@graphcommerce/magento-cart'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { sendEvent } from '../api/sendEvent'
4
4
  import { cartToBeginCheckout } from '../mapping/cartToBeginCheckout/cartToBeginCheckout'
5
5
 
6
- export const component = 'CartStartCheckoutLinkOrButton'
7
- export const exported = '@graphcommerce/magento-cart'
6
+ export const config: PluginConfig = {
7
+ module: '@graphcommerce/magento-cart',
8
+ type: 'component',
9
+ }
8
10
 
9
- export function GoogleDatalayerCartStartCheckoutLinkOrButton(
11
+ export function CartStartCheckoutLinkOrButton(
10
12
  props: PluginProps<CartStartCheckoutLinkOrButtonProps>,
11
13
  ) {
12
14
  const { Prev, onStart, ...rest } = props
@@ -21,5 +23,3 @@ export function GoogleDatalayerCartStartCheckoutLinkOrButton(
21
23
  />
22
24
  )
23
25
  }
24
-
25
- export const Plugin = GoogleDatalayerCartStartCheckoutLinkOrButton
@@ -1,14 +1,16 @@
1
1
  import { useCartQuery } from '@graphcommerce/magento-cart'
2
2
  import { PaymentMethodButtonProps } from '@graphcommerce/magento-cart-payment-method'
3
3
  import { GetPaymentMethodContextDocument } from '@graphcommerce/magento-cart-payment-method/PaymentMethodContext/GetPaymentMethodContext.gql'
4
- import type { PluginProps } from '@graphcommerce/next-config'
4
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
5
5
  import { sendEvent } from '../api/sendEvent'
6
6
  import { cartToAddPaymentInfo } from '../mapping/cartToAddPaymentInfo/cartToAddPaymentInfo'
7
7
 
8
- export const component = 'PaymentMethodButton'
9
- export const exported = '@graphcommerce/magento-cart-payment-method'
8
+ export const config: PluginConfig = {
9
+ module: '@graphcommerce/magento-cart-payment-method',
10
+ type: 'component',
11
+ }
10
12
 
11
- function GoogleDatalayerPaymentMethodButton(props: PluginProps<PaymentMethodButtonProps>) {
13
+ export function PaymentMethodButton(props: PluginProps<PaymentMethodButtonProps>) {
12
14
  const { Prev, onSubmitSuccessful, ...rest } = props
13
15
  const methodContext = useCartQuery(GetPaymentMethodContextDocument)
14
16
 
@@ -24,5 +26,3 @@ function GoogleDatalayerPaymentMethodButton(props: PluginProps<PaymentMethodButt
24
26
  />
25
27
  )
26
28
  }
27
-
28
- export const Plugin = GoogleDatalayerPaymentMethodButton
@@ -1,12 +1,14 @@
1
1
  import type { PaymentMethodContextProviderProps } from '@graphcommerce/magento-cart-payment-method'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { sendEvent } from '../api/sendEvent'
4
4
  import { orderToPurchase } from '../mapping/orderToPurchase/orderToPurchase'
5
5
 
6
- export const component = 'PaymentMethodContextProvider'
7
- export const exported = '@graphcommerce/magento-cart-payment-method'
6
+ export const config: PluginConfig = {
7
+ module: '@graphcommerce/magento-cart-payment-method',
8
+ type: 'component',
9
+ }
8
10
 
9
- function GoogleDatalayerPaymentMethodContextProvider(
11
+ export function PaymentMethodContextProvider(
10
12
  props: PluginProps<PaymentMethodContextProviderProps>,
11
13
  ) {
12
14
  const { Prev, onSuccess, ...rest } = props
@@ -20,4 +22,3 @@ function GoogleDatalayerPaymentMethodContextProvider(
20
22
  />
21
23
  )
22
24
  }
23
- export const Plugin = GoogleDatalayerPaymentMethodContextProvider
@@ -1,12 +1,14 @@
1
1
  import { ProductListItemProps } from '@graphcommerce/magento-product'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { useEventCallback } from '@mui/material'
4
4
  import { useViewItemList } from '../components/DatalayerViewItemList'
5
5
 
6
- export const component = 'ProductListItem'
7
- export const exported = '@graphcommerce/magento-product'
6
+ export const config: PluginConfig = {
7
+ module: '@graphcommerce/magento-product',
8
+ type: 'component',
9
+ }
8
10
 
9
- function GoogleDatalayerProductListItem(props: PluginProps<ProductListItemProps>) {
11
+ export function ProductListItem(props: PluginProps<ProductListItemProps>) {
10
12
  const { Prev, onClick, ...rest } = props
11
13
  const selectItem = useViewItemList()
12
14
 
@@ -20,5 +22,3 @@ function GoogleDatalayerProductListItem(props: PluginProps<ProductListItemProps>
20
22
  />
21
23
  )
22
24
  }
23
-
24
- export const Plugin = GoogleDatalayerProductListItem
@@ -1,11 +1,13 @@
1
1
  import type { ProductItemsGridProps } from '@graphcommerce/magento-product'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { DatalayerViewItemList } from '../components/DatalayerViewItemList'
4
4
 
5
- export const component = 'ProductListItemsBase'
6
- export const exported = '@graphcommerce/magento-product'
5
+ export const config: PluginConfig = {
6
+ module: '@graphcommerce/magento-product',
7
+ type: 'component',
8
+ }
7
9
 
8
- export function GoogleDatalayerProductListItemsBase(props: PluginProps<ProductItemsGridProps>) {
10
+ export function ProductListItemsBase(props: PluginProps<ProductItemsGridProps>) {
9
11
  const { Prev, ...rest } = props
10
12
  return (
11
13
  <DatalayerViewItemList {...rest}>
@@ -13,5 +15,3 @@ export function GoogleDatalayerProductListItemsBase(props: PluginProps<ProductIt
13
15
  </DatalayerViewItemList>
14
16
  )
15
17
  }
16
-
17
- export const Plugin = GoogleDatalayerProductListItemsBase
@@ -1,12 +1,14 @@
1
1
  import { ShippingMethodFormProps } from '@graphcommerce/magento-cart-shipping-method'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { sendEvent } from '../api/sendEvent'
4
4
  import { cartToAddShippingInfo } from '../mapping/cartToAddShippingInfo/cartToAddShippingInfo'
5
5
 
6
- export const component = 'ShippingMethodForm'
7
- export const exported = '@graphcommerce/magento-cart-shipping-method'
6
+ export const config: PluginConfig = {
7
+ module: '@graphcommerce/magento-cart-shipping-method',
8
+ type: 'component',
9
+ }
8
10
 
9
- export function GoogleDatalayerShippingMethodForm(props: PluginProps<ShippingMethodFormProps>) {
11
+ export function ShippingMethodForm(props: PluginProps<ShippingMethodFormProps>) {
10
12
  const { Prev, onComplete, ...rest } = props
11
13
  return (
12
14
  <Prev
@@ -24,5 +26,3 @@ export function GoogleDatalayerShippingMethodForm(props: PluginProps<ShippingMet
24
26
  />
25
27
  )
26
28
  }
27
-
28
- export const Plugin = GoogleDatalayerShippingMethodForm
@@ -1,18 +1,19 @@
1
1
  import type { UpdateItemQuantityProps } from '@graphcommerce/magento-cart-items'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { sendEvent } from '../api/sendEvent'
4
4
  import { cartItemToDatalayerItem } from '../mapping/cartItemToDatalayerItem/cartItemToDatalayerItem'
5
5
  import { datalayerItemsToCurrencyValue } from '../mapping/datalayerItemsToCurrencyValue/datalayerItemsToCurrencyValue'
6
6
 
7
- export const component = 'UpdateItemQuantity'
8
- export const exported =
9
- '@graphcommerce/magento-cart-items/components/UpdateItemQuantity/UpdateItemQuantity'
7
+ export const config: PluginConfig = {
8
+ module: '@graphcommerce/magento-cart-items',
9
+ type: 'component',
10
+ }
10
11
 
11
12
  /**
12
13
  * When a product is added to the Cart, by using the + button on cart page, send a Google Analytics
13
14
  * event
14
15
  */
15
- function GoogleDatalayerUpdateItemQuantity(props: PluginProps<UpdateItemQuantityProps>) {
16
+ export function UpdateItemQuantity(props: PluginProps<UpdateItemQuantityProps>) {
16
17
  const { Prev, formOptions, quantity, ...rest } = props
17
18
 
18
19
  return (
@@ -44,5 +45,3 @@ function GoogleDatalayerUpdateItemQuantity(props: PluginProps<UpdateItemQuantity
44
45
  />
45
46
  )
46
47
  }
47
-
48
- export const Plugin = GoogleDatalayerUpdateItemQuantity
@@ -1,15 +1,17 @@
1
1
  import type { ProductPageMetaProps } from '@graphcommerce/magento-product'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { useMemoObject } from '@graphcommerce/next-ui'
4
4
  import { useEffect } from 'react'
5
5
  import { sendEvent } from '../api/sendEvent'
6
6
  import { productToViewItem } from '../mapping/productToViewItem/productToViewItem'
7
7
 
8
- export const component = 'ProductPageMeta'
9
- export const exported = '@graphcommerce/magento-product'
8
+ export const config: PluginConfig = {
9
+ module: '@graphcommerce/magento-product',
10
+ type: 'component',
11
+ }
10
12
 
11
13
  /** When a product is added to the Cart, send a Google Analytics event */
12
- function GoogleDatalayerViewItem(props: PluginProps<ProductPageMetaProps>) {
14
+ export function ProductPageMeta(props: PluginProps<ProductPageMetaProps>) {
13
15
  const { Prev, product } = props
14
16
 
15
17
  const viewItem = useMemoObject(productToViewItem(product))
@@ -17,5 +19,3 @@ function GoogleDatalayerViewItem(props: PluginProps<ProductPageMetaProps>) {
17
19
 
18
20
  return <Prev {...props} />
19
21
  }
20
-
21
- export const Plugin = GoogleDatalayerViewItem