<?php
namespace WbfkExtensions\Storefront\Framework\Routing;
use Shopware\Core\Checkout\Customer\Event\CustomerLoginEvent;
use Shopware\Core\Framework\Event\BeforeSendResponseEvent;
use Shopware\Core\Framework\Routing\Event\SalesChannelContextResolvedEvent;
use Shopware\Storefront\Event\StorefrontRenderEvent;
use Shopware\Storefront\Framework\Routing\StorefrontSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use WbfkExtensions\Service\OrderDeepLinkContextService;
class StorefrontSubscriberDecorator implements EventSubscriberInterface
{
public function __construct(
private readonly EventSubscriberInterface $decorated
) {
}
/**
* @inheritDoc
*/
public static function getSubscribedEvents(): array
{
return StorefrontSubscriber::getSubscribedEvents();
}
public function startSession(): void
{
$this->decorated->startSession();
}
public function updateSessionAfterLogin(CustomerLoginEvent $event): void
{
$this->decorated->updateSessionAfterLogin($event);
}
public function updateSessionAfterLogout(): void
{
$this->decorated->updateSessionAfterLogout();
}
public function updateSession(string $token, bool $destroyOldSession = false): void
{
$this->decorated->updateSession($token, $destroyOldSession);
}
public function showHtmlExceptionResponse(ExceptionEvent $event): void
{
$this->decorated->showHtmlExceptionResponse($event);
}
public function customerNotLoggedInHandler(ExceptionEvent $event): void
{
$this->decorated->customerNotLoggedInHandler($event);
}
public function maintenanceResolver(RequestEvent $event): void
{
$this->decorated->maintenanceResolver($event);
}
public function preventPageLoadingFromXmlHttpRequest(ControllerEvent $event): void
{
$this->decorated->preventPageLoadingFromXmlHttpRequest($event);
}
public function replaceContextToken(SalesChannelContextResolvedEvent $event): void
{
$contextToken = $event->getSalesChannelContext()->getToken();
// Never replace context token if it is an order context token
// Access to this context should be available only for current request
if (str_starts_with($contextToken, OrderDeepLinkContextService::ORDER_CONTEXT_TOKEN_PREFIX)) {
return;
}
$this->decorated->replaceContextToken($event);
}
public function setCanonicalUrl(BeforeSendResponseEvent $event): void
{
$this->decorated->setCanonicalUrl($event);
}
public function replaceCsrfToken(BeforeSendResponseEvent $event): void
{
$this->decorated->replaceCsrfToken($event);
}
public function addHreflang(StorefrontRenderEvent $event): void
{
$this->decorated->addHreflang($event);
}
public function addShopIdParameter(StorefrontRenderEvent $event): void
{
$this->decorated->addShopIdParameter($event);
}
public function addIconSetConfig(StorefrontRenderEvent $event): void
{
$this->decorated->addIconSetConfig($event);
}
}