Sha256: 8bc42de74a27845d8ea22ffadf00ee485e13ae6befaad3552d1069486563ccc6

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

(function() {
  function setCookieAndRedirect() {
    document.cookie = "shopify.cookies_persist=true";
    window.location.href = window.shopOrigin + "/admin/apps/" + window.apiKey;
  }

  function shouldDisplayPrompt() {
    if (navigator.userAgent.indexOf('com.jadedpixel.pos') !== -1) {
      return false;
    }

    if (navigator.userAgent.indexOf('Shopify Mobile/iOS') !== -1) {
      return false;
    }

    return Boolean(document.hasStorageAccess);
  }

  document.addEventListener("DOMContentLoaded", function() {
    if (shouldDisplayPrompt()) {
      var itpContent = document.querySelector('#CookiePartitionPrompt');
      itpContent.style.display = 'block';

      var button = document.querySelector('#AcceptCookies');
      button.addEventListener('click', setCookieAndRedirect);
    } else {
      setCookieAndRedirect();
    }
  });
})();

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shopify_app-8.3.2 app/assets/javascripts/shopify_app/itp_polyfill.js
shopify_app-8.3.1 app/assets/javascripts/shopify_app/itp_polyfill.js
shopify_app-8.3.0 app/assets/javascripts/shopify_app/itp_polyfill.js