"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.checkSession = void 0;
var _services = require("@mirai/services");
const MIRAI = 1;
const PESTANA = 3;
const checkSession = async function (idHotel, session) {
  let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  const _config$club = config.club,
    _config$club2 = _config$club === void 0 ? {} : _config$club,
    _config$club2$club = _config$club2.club,
    _config$club2$club2 = _config$club2$club === void 0 ? {} : _config$club2$club,
    _config$club2$club2$a = _config$club2$club2.authentication,
    _config$club2$club2$a2 = _config$club2$club2$a === void 0 ? {} : _config$club2$club2$a,
    _config$club2$club2$a3 = _config$club2$club2$a2.type,
    type = _config$club2$club2$a3 === void 0 ? MIRAI : _config$club2$club2$a3,
    idClub = _config$club2$club2.idClub;
  const response = await _services.ServiceUser.check({
    idHotel,
    session
  });
  if (!response && type === PESTANA && idClub) document.location.href = "".concat(process.env.SERVICE_USER, "/club/v1/forwarder/expiration?idClub=").concat(idClub);
  return response;
};
exports.checkSession = checkSession;
//# sourceMappingURL=checkSession.js.map