<?php
use Twig\Environment;
use function Shopware\Core\Framework\Adapter\Twig\sw_get_attribute;
use function Shopware\Core\Framework\Adapter\Twig\sw_escape_filter;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* @ShopsyKlaviyo6/storefront/base.html.twig */
class __TwigTemplate_e9068fe1a435c529e973dbdb128f1af8 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->blocks = [
'base_body_script' => [$this, 'block_base_body_script'],
'base_body' => [$this, 'block_base_body'],
];
}
protected function doGetParent(array $context)
{
// line 2
return "@IntediaDoofinderSW6/storefront/base.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@ShopsyKlaviyo6/storefront/base.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@ShopsyKlaviyo6/storefront/base.html.twig"));
$this->parent = $this->loadTemplate("@IntediaDoofinderSW6/storefront/base.html.twig", "@ShopsyKlaviyo6/storefront/base.html.twig", 2);
$this->parent->display($context, array_merge($this->blocks, $blocks));
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
// line 3
public function block_base_body_script($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "base_body_script"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "base_body_script"));
// line 4
echo " ";
$this->displayParentBlock("base_body_script", $context, $blocks);
echo "
<script type=\"text/javascript\">
document.addEventListener(\"DOMContentLoaded\", function(event) {
var substring = 'shopsyKlaviyo=shopsyKlaviyo';
var checkCookie = document.cookie.indexOf(substring) !== -1;
var cookieRequired;
if (document.getElementsByName('cookieRequired')[0] !== undefined) {
cookieRequired = document.getElementsByName('cookieRequired')[0].value;
}
if (cookieRequired !== \"1\" || checkCookie) {
waitForKlaviyoElement('form button.needsclick').then((elm) => {
const submitbutton = document.querySelectorAll('form button.needsclick');
submitbutton[0].addEventListener('click', function () {
const email = document.querySelectorAll('form input.needsclick[type=email]')[0].value;
window.localStorage.setItem('klaviyoValue', btoa(email));
});
});
var imported = document.createElement('script');
imported.src = 'https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=";
// line 26
echo sw_escape_filter($this->env, sw_get_attribute($this->env, $this->source, sw_get_attribute($this->env, $this->source, ($context["page"] ?? null), "shopsyKlaviyo", [], "any", false, false, false, 26), "apiKey", [], "any", false, false, false, 26), "html", null, true);
echo "';
imported.setAttribute(\"type\", \"text/javascript\");
imported.async = 'async';
document.head.appendChild(imported);
}
if (checkCookie || cookieRequired !== \"1\") {
!function () {
if (!window.klaviyo) {
window._klOnsite = window._klOnsite || [];
try {
window.klaviyo = new Proxy({}, {
get: function (n, i) {
return \"push\" === i ? function () {
var n;
(n = window._klOnsite).push.apply(n, arguments)
} : function () {
for (var n = arguments.length, o = new Array(n), w = 0; w < n; w++)
o[w] = arguments[w];
var t = \"function\" == typeof o[o.length - 1] ? o.pop() : void 0,
e = new Promise(function (n) {
window._klOnsite.push([i].concat(o, [function (i) {
t && t(i), n(i)
}]))
});
return e
}
}
})
} catch (n) {
window.klaviyo = window.klaviyo || [], window.klaviyo.push = function () {
var n;
(n = window._klOnsite).push.apply(n, arguments)
}
}
}
}();
(function () {
var b = document.createElement('script');
b.type = 'text/javascript';
b.async = true;
b.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + 'static.klaviyo.com/onsite/js/klaviyo.js?company_id=";
// line 68
echo sw_escape_filter($this->env, sw_get_attribute($this->env, $this->source, sw_get_attribute($this->env, $this->source, ($context["page"] ?? null), "shopsyKlaviyo", [], "any", false, false, false, 68), "apiKey", [], "any", false, false, false, 68), "html", null, true);
echo "';
var a = document.getElementsByTagName('script')[0];
a.parentNode.insertBefore(b, a);
})();
}
});
function waitForKlaviyoElement(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
</script>
";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
}
// line 98
public function block_base_body($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "base_body"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "base_body"));
// line 99
echo " ";
$this->displayParentBlock("base_body", $context, $blocks);
echo "
";
// line 101
$this->loadTemplate("@ShopsyKlaviyo6/storefront/shopsy-klaviyo/shopsy-klaviyo-hidden-input-fields.html.twig", "@ShopsyKlaviyo6/storefront/base.html.twig", 101)->display($context);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
}
public function getTemplateName()
{
return "@ShopsyKlaviyo6/storefront/base.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 195 => 101, 189 => 99, 179 => 98, 140 => 68, 95 => 26, 69 => 4, 59 => 3, 36 => 2,);
}
public function getSourceContext()
{
return new Source("{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body_script %}
{{ parent() }}
<script type=\"text/javascript\">
document.addEventListener(\"DOMContentLoaded\", function(event) {
var substring = 'shopsyKlaviyo=shopsyKlaviyo';
var checkCookie = document.cookie.indexOf(substring) !== -1;
var cookieRequired;
if (document.getElementsByName('cookieRequired')[0] !== undefined) {
cookieRequired = document.getElementsByName('cookieRequired')[0].value;
}
if (cookieRequired !== \"1\" || checkCookie) {
waitForKlaviyoElement('form button.needsclick').then((elm) => {
const submitbutton = document.querySelectorAll('form button.needsclick');
submitbutton[0].addEventListener('click', function () {
const email = document.querySelectorAll('form input.needsclick[type=email]')[0].value;
window.localStorage.setItem('klaviyoValue', btoa(email));
});
});
var imported = document.createElement('script');
imported.src = 'https://static.klaviyo.com/onsite/js/klaviyo.js?company_id={{ page.shopsyKlaviyo.apiKey }}';
imported.setAttribute(\"type\", \"text/javascript\");
imported.async = 'async';
document.head.appendChild(imported);
}
if (checkCookie || cookieRequired !== \"1\") {
!function () {
if (!window.klaviyo) {
window._klOnsite = window._klOnsite || [];
try {
window.klaviyo = new Proxy({}, {
get: function (n, i) {
return \"push\" === i ? function () {
var n;
(n = window._klOnsite).push.apply(n, arguments)
} : function () {
for (var n = arguments.length, o = new Array(n), w = 0; w < n; w++)
o[w] = arguments[w];
var t = \"function\" == typeof o[o.length - 1] ? o.pop() : void 0,
e = new Promise(function (n) {
window._klOnsite.push([i].concat(o, [function (i) {
t && t(i), n(i)
}]))
});
return e
}
}
})
} catch (n) {
window.klaviyo = window.klaviyo || [], window.klaviyo.push = function () {
var n;
(n = window._klOnsite).push.apply(n, arguments)
}
}
}
}();
(function () {
var b = document.createElement('script');
b.type = 'text/javascript';
b.async = true;
b.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + 'static.klaviyo.com/onsite/js/klaviyo.js?company_id={{ page.shopsyKlaviyo.apiKey }}';
var a = document.getElementsByTagName('script')[0];
a.parentNode.insertBefore(b, a);
})();
}
});
function waitForKlaviyoElement(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
</script>
{% endblock %}
{% block base_body %}
{{ parent() }}
{% sw_include '@ShopsyKlaviyo6/storefront/shopsy-klaviyo/shopsy-klaviyo-hidden-input-fields.html.twig' %}
{% endblock %}", "@ShopsyKlaviyo6/storefront/base.html.twig", "/var/www/staging1.grimm-gastrobedarf.de/custom/plugins/ShopsyKlaviyo6/src/Resources/views/storefront/base.html.twig");
}
}