From 0e0adc130d7d9970d4b33b283c559c4ee4f85b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20L=C3=B8vgaard?= Date: Tue, 5 Sep 2023 14:38:10 +0200 Subject: [PATCH] Upgrade Google Analytics related libraries --- composer.json | 5 +++-- src/Event/ItemResolved.php | 2 +- src/EventSubscriber/AddPaymentInfoSubscriber.php | 4 ++-- src/EventSubscriber/AddShippingInfoSubscriber.php | 4 ++-- src/EventSubscriber/AddToCartSubscriber.php | 4 ++-- src/EventSubscriber/BeginCheckoutSubscriber.php | 4 ++-- .../DispatchSendPurchaseRequestSubscriber.php | 2 +- src/EventSubscriber/PurchaseSubscriber.php | 4 ++-- src/EventSubscriber/ViewCartSubscriber.php | 4 ++-- src/EventSubscriber/ViewItemListSubscriber.php | 4 ++-- src/EventSubscriber/ViewItemSubscriber.php | 4 ++-- src/Message/Command/SendPurchaseEvent.php | 2 +- src/Resolver/Item/ItemResolver.php | 2 +- src/Resolver/Item/ItemResolverInterface.php | 2 +- src/Resolver/Items/ItemsResolverInterface.php | 2 +- .../templates/bundles/SyliusShopBundle/layout.html.twig | 5 ++--- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/composer.json b/composer.json index eeb9321..fbb8fbd 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,9 @@ "psr/event-dispatcher": "^1.0", "psr/log": "^1.1 || ^2.0 || ^3.0", "setono/composite-compiler-pass": "^1.1", - "setono/google-analytics-bundle": "^1.0.0-alpha.6", - "setono/google-analytics-measurement-protocol": "^1.0@alpha", + "setono/google-analytics-bundle": "^2.0@alpha", + "setono/google-analytics-events": "^1.0@beta", + "setono/google-analytics-measurement-protocol": "^2.0@beta", "sylius/channel": "^1.0", "sylius/channel-bundle": "^1.0", "sylius/core": "^1.8", diff --git a/src/Event/ItemResolved.php b/src/Event/ItemResolved.php index a1d14bd..3075041 100644 --- a/src/Event/ItemResolved.php +++ b/src/Event/ItemResolved.php @@ -4,7 +4,7 @@ namespace Setono\SyliusAnalyticsPlugin\Event; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Item\Item; +use Setono\GoogleAnalyticsEvents\Event\Item\Item; /** * Is fired when an item has been resolved. Use this to do common manipulations on the item before it's sent to Google diff --git a/src/EventSubscriber/AddPaymentInfoSubscriber.php b/src/EventSubscriber/AddPaymentInfoSubscriber.php index 2606541..cab4aaf 100644 --- a/src/EventSubscriber/AddPaymentInfoSubscriber.php +++ b/src/EventSubscriber/AddPaymentInfoSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\AddPaymentInfoEvent; +use Setono\GoogleAnalyticsEvents\Event\AddPaymentInfoEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; @@ -62,7 +62,7 @@ public function track(ResourceControllerEvent $resourceControllerEvent): void ), ); } catch (\Throwable $e) { - $this->log(AddPaymentInfoEvent::NAME, $e); + $this->log(AddPaymentInfoEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/AddShippingInfoSubscriber.php b/src/EventSubscriber/AddShippingInfoSubscriber.php index dcb0acb..10c4cc4 100644 --- a/src/EventSubscriber/AddShippingInfoSubscriber.php +++ b/src/EventSubscriber/AddShippingInfoSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\AddShippingInfoEvent; +use Setono\GoogleAnalyticsEvents\Event\AddShippingInfoEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; @@ -64,7 +64,7 @@ public function track(ResourceControllerEvent $resourceControllerEvent): void ), ); } catch (\Throwable $e) { - $this->log(AddShippingInfoEvent::NAME, $e); + $this->log(AddShippingInfoEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/AddToCartSubscriber.php b/src/EventSubscriber/AddToCartSubscriber.php index 1cff444..44394b9 100644 --- a/src/EventSubscriber/AddToCartSubscriber.php +++ b/src/EventSubscriber/AddToCartSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\AddToCartEvent; +use Setono\GoogleAnalyticsEvents\Event\AddToCartEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Item\ItemResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; @@ -71,7 +71,7 @@ public function track(ResourceControllerEvent $resourceControllerEvent): void ), ); } catch (\Throwable $e) { - $this->log(AddToCartEvent::NAME, $e); + $this->log(AddToCartEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/BeginCheckoutSubscriber.php b/src/EventSubscriber/BeginCheckoutSubscriber.php index b10f203..6ad9dcf 100644 --- a/src/EventSubscriber/BeginCheckoutSubscriber.php +++ b/src/EventSubscriber/BeginCheckoutSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\BeginCheckoutEvent; +use Setono\GoogleAnalyticsEvents\Event\BeginCheckoutEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Component\Core\Model\OrderInterface; @@ -70,7 +70,7 @@ public function track(RequestEvent $requestEvent): void ), ); } catch (\Throwable $e) { - $this->log(BeginCheckoutEvent::NAME, $e); + $this->log(BeginCheckoutEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/DispatchSendPurchaseRequestSubscriber.php b/src/EventSubscriber/DispatchSendPurchaseRequestSubscriber.php index fe070e3..08f3281 100644 --- a/src/EventSubscriber/DispatchSendPurchaseRequestSubscriber.php +++ b/src/EventSubscriber/DispatchSendPurchaseRequestSubscriber.php @@ -5,7 +5,7 @@ namespace Setono\SyliusAnalyticsPlugin\EventSubscriber; use Setono\GoogleAnalyticsBundle\Context\ClientIdContextInterface; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\PurchaseEvent; +use Setono\GoogleAnalyticsEvents\Event\PurchaseEvent; use Setono\SyliusAnalyticsPlugin\Message\Command\SendPurchaseEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; diff --git a/src/EventSubscriber/PurchaseSubscriber.php b/src/EventSubscriber/PurchaseSubscriber.php index 47430b0..e7862b3 100644 --- a/src/EventSubscriber/PurchaseSubscriber.php +++ b/src/EventSubscriber/PurchaseSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\PurchaseEvent; +use Setono\GoogleAnalyticsEvents\Event\PurchaseEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Component\Core\Model\OrderInterface; @@ -87,7 +87,7 @@ public function track(RequestEvent $requestEvent): void ), ); } catch (\Throwable $e) { - $this->log(PurchaseEvent::NAME, $e); + $this->log(PurchaseEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/ViewCartSubscriber.php b/src/EventSubscriber/ViewCartSubscriber.php index 28b8325..82aa1f8 100644 --- a/src/EventSubscriber/ViewCartSubscriber.php +++ b/src/EventSubscriber/ViewCartSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\ViewCartEvent; +use Setono\GoogleAnalyticsEvents\Event\ViewCartEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Component\Core\Model\OrderInterface; @@ -70,7 +70,7 @@ public function track(RequestEvent $requestEvent): void ), ); } catch (\Throwable $e) { - $this->log(ViewCartEvent::NAME, $e); + $this->log(ViewCartEvent::getName(), $e); } } } diff --git a/src/EventSubscriber/ViewItemListSubscriber.php b/src/EventSubscriber/ViewItemListSubscriber.php index e37870a..a3d95c8 100644 --- a/src/EventSubscriber/ViewItemListSubscriber.php +++ b/src/EventSubscriber/ViewItemListSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\ViewItemListEvent; +use Setono\GoogleAnalyticsEvents\Event\ViewItemListEvent; use Setono\SyliusAnalyticsPlugin\Event\ItemListViewed; use Setono\SyliusAnalyticsPlugin\Resolver\Item\ItemResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; @@ -104,7 +104,7 @@ public function trackNative(ResourceControllerEvent $resourceControllerEvent): v $this->eventDispatcher->dispatch(new ClientSideEvent($event)); } catch (\Throwable $e) { - $this->log(ViewItemListEvent::NAME, $e); + $this->log(ViewItemListEvent::getName(), $e); } } diff --git a/src/EventSubscriber/ViewItemSubscriber.php b/src/EventSubscriber/ViewItemSubscriber.php index 2ead39d..73e5726 100644 --- a/src/EventSubscriber/ViewItemSubscriber.php +++ b/src/EventSubscriber/ViewItemSubscriber.php @@ -6,7 +6,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Setono\GoogleAnalyticsBundle\Event\ClientSideEvent; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\ViewItemEvent; +use Setono\GoogleAnalyticsEvents\Event\ViewItemEvent; use Setono\SyliusAnalyticsPlugin\Resolver\Item\ItemResolverInterface; use Setono\SyliusAnalyticsPlugin\Util\FormatAmountTrait; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; @@ -54,7 +54,7 @@ public function track(ResourceControllerEvent $resourceControllerEvent): void ), ); } catch (\Throwable $e) { - $this->log(ViewItemEvent::NAME, $e); + $this->log(ViewItemEvent::getName(), $e); } } } diff --git a/src/Message/Command/SendPurchaseEvent.php b/src/Message/Command/SendPurchaseEvent.php index 29a9029..bf526ed 100644 --- a/src/Message/Command/SendPurchaseEvent.php +++ b/src/Message/Command/SendPurchaseEvent.php @@ -4,7 +4,7 @@ namespace Setono\SyliusAnalyticsPlugin\Message\Command; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\PurchaseEvent; +use Setono\GoogleAnalyticsEvents\Event\PurchaseEvent; final class SendPurchaseEvent implements CommandInterface { diff --git a/src/Resolver/Item/ItemResolver.php b/src/Resolver/Item/ItemResolver.php index 5458a98..7e07ccf 100644 --- a/src/Resolver/Item/ItemResolver.php +++ b/src/Resolver/Item/ItemResolver.php @@ -5,7 +5,7 @@ namespace Setono\SyliusAnalyticsPlugin\Resolver\Item; use Psr\EventDispatcher\EventDispatcherInterface; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Item\Item; +use Setono\GoogleAnalyticsEvents\Event\Item\Item; use Setono\SyliusAnalyticsPlugin\Event\ItemResolved; use Setono\SyliusAnalyticsPlugin\Resolver\Brand\BrandResolverInterface; use Setono\SyliusAnalyticsPlugin\Resolver\Category\CategoryResolverInterface; diff --git a/src/Resolver/Item/ItemResolverInterface.php b/src/Resolver/Item/ItemResolverInterface.php index 0368e58..a38298c 100644 --- a/src/Resolver/Item/ItemResolverInterface.php +++ b/src/Resolver/Item/ItemResolverInterface.php @@ -4,7 +4,7 @@ namespace Setono\SyliusAnalyticsPlugin\Resolver\Item; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Item\Item; +use Setono\GoogleAnalyticsEvents\Event\Item\Item; use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Core\Model\ProductInterface; diff --git a/src/Resolver/Items/ItemsResolverInterface.php b/src/Resolver/Items/ItemsResolverInterface.php index 63543ca..600c62e 100644 --- a/src/Resolver/Items/ItemsResolverInterface.php +++ b/src/Resolver/Items/ItemsResolverInterface.php @@ -4,7 +4,7 @@ namespace Setono\SyliusAnalyticsPlugin\Resolver\Items; -use Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Item\Item; +use Setono\GoogleAnalyticsEvents\Event\Item\Item; use Sylius\Component\Core\Model\OrderInterface; interface ItemsResolverInterface diff --git a/tests/Application/templates/bundles/SyliusShopBundle/layout.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/layout.html.twig index cac2c5a..bca67ab 100644 --- a/tests/Application/templates/bundles/SyliusShopBundle/layout.html.twig +++ b/tests/Application/templates/bundles/SyliusShopBundle/layout.html.twig @@ -28,9 +28,8 @@ {{ sylius_template_event('sylius.shop.layout.before_body') }}
{% block top %} -