Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import { asyncToGenerator as _asyncToGenerator } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import { removeCookies } from '../../helpers/storage.js';

var COOKIE_NAME_REGEXES = [/doodle_tracking_id/];
/**
 * Initialises Doodle Data Layer.
 *
 * @async
 * @param {TrackingApiOptions} options - The API client's options
 * @returns {Promise<boolean>}
 */
// eslint-disable-next-line no-unused-vars,require-await

var initDoodleDataLayer = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(options) {
    return regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", true);

          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));

  return function initDoodleDataLayer(_x) {
    return _ref.apply(this, arguments);
  };
}();
/**
 * Removes the Data Layer cookies from the browser.
 * @param {string|null} cookieDomain - Optionally, the cookie domain to use when removing cookies.
 */


var removeDoodleDataLayerCookies = function removeDoodleDataLayerCookies() {
  var cookieDomain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  removeCookies(COOKIE_NAME_REGEXES, cookieDomain);
};
/**
 * Removes Doodle Data Layer.
 *
 * @async
 * @private
 * @param {TrackingApiOptions} options - The API client's options
 * @return {Promise.<boolean>}
 */
// eslint-disable-next-line require-await


var removeDoodleDataLayer = /*#__PURE__*/function () {
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(options) {
    var _options$env, env;

    return regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            _options$env = options.env, env = _options$env === void 0 ? {} : _options$env;
            removeDoodleDataLayerCookies(env.cookieDomain);
            return _context2.abrupt("return", true);

          case 3:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));

  return function removeDoodleDataLayer(_x2) {
    return _ref2.apply(this, arguments);
  };
}();

export { initDoodleDataLayer, removeDoodleDataLayer, removeDoodleDataLayerCookies };
//# sourceMappingURL=init.js.map