custom/plugins/SmartsuppChat/src/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@@Storefront/storefront/base.html.twig' %}
  2. {% block base_body_script %}
  3.     {{ parent() }}
  4.     {% set swCookies = page.extensions.smartsuppCookies.key == 1 %}
  5.     {% set Key = page.extensions.smartsuppConfiguration.key %}
  6.     {% set hasKey = Key is defined and Key != '' %}
  7.     {% set Color = page.extensions.smartsuppColor.key %}
  8.     {% set hasColor = Color is defined and Color != '' %}
  9.     {% set Config = page.extensions.smartsuppConfig.key %}
  10.     {% set hasConfig = Config is defined and Config != '' %}
  11.     {% set Api = page.extensions.smartsuppApi.key %}
  12.     {% set hasApi = Api is defined and Api != '' %}
  13.     {% if hasKey %}
  14.         <script id="smartsupp_live_chat" key="{{ Key }}"{% if hasColor %} color="{{ Color }}"{% endif %}{% if hasConfig %} config="{{ Config }}"{% endif %}{% if hasApi %} api="{{ Api }}"{% endif %}>
  15.             function getCookie(name) {
  16.                 var cookieMatch = document.cookie.match(name + '=(.*?)(;|$)');
  17.                 return cookieMatch && decodeURI(cookieMatch[1]);
  18.             }
  19.             var ssCookieFcn = getCookie('cookieSmartsuppFunctional'),
  20.                 ssCookieSts = getCookie('cookieSmartsuppStatistics'),
  21.                 ssCookieMkt = getCookie('cookieSmartsuppMarketing')
  22.             {% if swCookies %}
  23.                 if (ssCookieFcn != null) {
  24.                     var _smartsupp = _smartsupp || {};
  25.                         _smartsupp.key = '{{ page.extensions.smartsuppConfiguration.key }}';
  26.                         _smartsupp.pluginVersion = '1.0.1';
  27.                         _smartsupp.offsetY = 65;
  28.                     window.smartsupp||(function(d) {
  29.                         var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
  30.                         s=d.getElementsByTagName('script')[0];c=d.createElement('script');
  31.                         c.type='text/javascript';c.charset='utf-8';c.async=true;
  32.                         c.src='//www.smartsuppchat.com/loader.js?';s.parentNode.insertBefore(c,s);
  33.                     })(document);
  34.                     
  35.                     if (ssCookieSts != null) {
  36.                         smartsupp('analyticsConsent', true);
  37.                     } else {
  38.                         smartsupp('analyticsConsent', false);
  39.                     }
  40.                     if (ssCookieMkt != null) {
  41.                         smartsupp('marketingConsent', true);
  42.                     } else {
  43.                         smartsupp('marketingConsent', false);
  44.                     }
  45.                     {% if hasColor %}
  46.                         _smartsupp.color = '{{ Color }}';
  47.                     {% endif %}
  48.                     {% if hasConfig %}
  49.                         {{ Config }}
  50.                     {% endif %}
  51.                     {% if hasApi %}
  52.                         {{ Api }}
  53.                     {% endif %}
  54.                 }
  55.             {% else %}
  56.                 var _smartsupp = _smartsupp || {};
  57.                     _smartsupp.key = '{{ Key }}';
  58.                     _smartsupp.pluginVersion = '1.0.1';
  59.                     _smartsupp.offsetY = 65;
  60.                     {% if hasColor %}
  61.                         _smartsupp.color = '{{ Color }}';
  62.                     {% endif %}
  63.                 window.smartsupp||(function(d) {
  64.                     var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
  65.                     s=d.getElementsByTagName('script')[0];c=d.createElement('script');
  66.                     c.type='text/javascript';c.charset='utf-8';c.async=true;
  67.                     c.src='//www.smartsuppchat.com/loader.js?';s.parentNode.insertBefore(c,s);
  68.                 })(document);
  69.                     
  70.                 smartsupp('analyticsConsent', true);
  71.                 smartsupp('marketingConsent', true);
  72.                 {% if hasConfig %}
  73.                     {{ Config }}
  74.                 {% endif %}
  75.                 {% if hasApi %}
  76.                     {{ Api }}
  77.                 {% endif %}
  78.             {% endif %}
  79.         </script>
  80.     {% endif %}
  81. {% endblock %}