All files / build index.js

67.8% Statements 80/118
45.24% Branches 38/84
58.06% Functions 18/31
75.9% Lines 63/83

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170    1x     1x   1x   1x   1x       4x   3x   1x   4x   4x   1x   1x   1x   1x   1x 8x     1x   1x                       1x       1x 1x         4x   4x 4x 4x 4x 4x   4x       4x 1x 1x 1x 1x   1x 1x               1x 1x     1x 1x 1x 1x 1x 1x 1x   1x             1x       1x             1x 1x     1x       1x       1x             1x       4x     1x     1x         1x 1x 1x         4x       1x     1x 1x    
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.FullStoryAPI = exports.getWindowFullStory = void 0;
 
var _react = require("react");
 
var _propTypes = _interopRequireDefault(require("prop-types"));
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
 
function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 
function _createClass(Constructor, protoProps, staticProps) { Eif (protoProps) _defineProperties(Constructor.prototype, protoProps); Iif (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
 
function _possibleConstructorReturn(self, call) { Iif (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
 
function _assertThisInitialized(self) { Iif (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
 
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
 
function _inherits(subClass, superClass) { Iif (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Eif (superClass) _setPrototypeOf(subClass, superClass); }
 
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
 
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
 
var getWindowFullStory = function getWindowFullStory() {
  return window[window['_fs_namespace']];
};
 
exports.getWindowFullStory = getWindowFullStory;
 
var FullStoryAPI = function FullStoryAPI(fn) {
  if (canUseDOM && getWindowFullStory()) {
    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }
 
    getWindowFullStory()[fn].apply(null, args);
  } else {
    console.warn('FullStory not initialized yet');
  }
};
 
exports.FullStoryAPI = FullStoryAPI;
 
var FullStory =
/*#__PURE__*/
function (_Component) {
  _inherits(FullStory, _Component);
 
  function FullStory(props) {
    var _this;
 
    _classCallCheck(this, FullStory);
 
    _this = _possibleConstructorReturn(this, _getPrototypeOf(FullStory).call(this, props));
    var org = props.org,
        debug = props.debug,
        host = props.host,
        namespace = props.namespace;
 
    Iif (!org || !canUseDOM) {
      return _possibleConstructorReturn(_this);
    }
 
    if (!getWindowFullStory()) {
      window['_fs_debug'] = debug || false;
      window['_fs_host'] = host || 'fullstory.com';
      window['_fs_org'] = org;
      window['_fs_namespace'] = namespace || 'FS';
 
      (function (m, n, e, t, l, o, g, y) {
        Iif (e in m) {
          if (m.console && m.console.log) {
            m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');
          }
 
          return;
        }
 
        g = m[e] = function (a, b, s) {
          g.q ? g.q.push([a, b, s]) : g._api(a, b, s);
        };
 
        g.q = [];
        o = n.createElement(t);
        o.async = 1;
        o.src = 'https://' + window['_fs_host'] + '/s/fs.js';
        n.head.appendChild(o);
        y = n.getElementsByTagName(t)[0];
        y.parentNode.insertBefore(o, y);
 
        g.identify = function (i, v, s) {
          g(l, {
            uid: i
          }, s);
          if (v) g(l, v, s);
        };
 
        g.setUserVars = function (v, s) {
          g(l, v, s);
        };
 
        g.event = function (i, v, s) {
          g('event', {
            n: i,
            p: v
          }, s);
        };
 
        g.shutdown = function () {
          g('rec', !1);
        };
 
        g.restart = function () {
          g('rec', !0);
        };
 
        g.consent = function (a) {
          g('consent', !arguments.length || a);
        };
 
        g.identifyAccount = function (i, v) {
          o = 'account';
          v = v || {};
          v.acctId = i;
          g(o, v);
        };
 
        g.clearUserCookie = function () {};
      })(window, document, window['_fs_namespace'], 'script', 'user');
    }
 
    return _this;
  }
 
  _createClass(FullStory, [{
    key: "shouldComponentUpdate",
    value: function shouldComponentUpdate() {
      return false;
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      Iif (!canUseDOM || !getWindowFullStory()) return false;
      getWindowFullStory().shutdown();
      delete getWindowFullStory();
    }
  }, {
    key: "render",
    value: function render() {
      return false;
    }
  }]);
 
  return FullStory;
}(_react.Component);
 
exports.default = FullStory;
FullStory.propTypes = {
  org: _propTypes.default.string.isRequired
};