Sha256: 593f8125e98e25cf6f9d5772233dd61c0f6dd9e2bc356441d5b54ef7b42f7a12

Contents?: true

Size: 1.08 KB

Versions: 71

Compression:

Stored size: 1.08 KB

Contents

(function() {
  function ITPHelper(opts) {
    this.itpContent = document.getElementById('TopLevelInteractionContent');
    this.itpAction = document.getElementById('TopLevelInteractionButton');
    this.redirectUrl = opts.redirectUrl;
  }

  ITPHelper.prototype.redirect = function() {
    sessionStorage.setItem('shopify.top_level_interaction', true);
    window.location.href = this.redirectUrl;
  }

  ITPHelper.prototype.userAgentIsAffected = function() {
    return Boolean(document.hasStorageAccess);
  }

  ITPHelper.prototype.canPartitionCookies = function() {
    var versionRegEx = /Version\/12\.0\.?\d? Safari/;
    return versionRegEx.test(navigator.userAgent);
  }

  ITPHelper.prototype.setUpContent = function(onClick) {
    this.itpContent.style.display = 'block';
    this.itpAction.addEventListener('click', this.redirect.bind(this));
  }

  ITPHelper.prototype.execute = function() {
    if (!this.itpContent) {
      return;
    }

    if (this.userAgentIsAffected()) {
      this.setUpContent();
    } else {
      this.redirect();
    }
  }

  this.ITPHelper = ITPHelper;
})(window);

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
shopify_app-13.1.1 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-13.1.0 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-13.0.1 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-13.0.0 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.7 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.6 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.5 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.4 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.3 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.2 app/assets/javascripts/shopify_app/itp_helper.js
shopify_app-12.0.1 app/assets/javascripts/shopify_app/itp_helper.js