"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _cookie = require("../utils/cookie");

// writes a beta cookie lazily
// for opting into beta
var _default = ({
  domain,
  redirect,
  maxAge
}) => ({
  name: 'betaBundle',
  init: store => {
    setTimeout(store.doEnsureBetaCookie, 2000);
  },
  doEnsureBetaCookie: () => () => {
    (0, _cookie.writeCookie)('beta', 1, {
      maxAge,
      domain
    });
  },
  doLeaveBeta: () => () => {
    (0, _cookie.deleteCookie)('beta', domain);
    location = redirect;
  }
});

exports.default = _default;