"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getUrlBooking = void 0;
var _toUrlParams = require("./toUrlParams");
var _ButtonPayment = require("../ButtonPayment.constants");
const getUrlBooking = _ref => {
  let code = _ref.code,
    environment = _ref.environment,
    _ref$forwarder = _ref.forwarder,
    _ref$forwarder2 = _ref$forwarder === void 0 ? {} : _ref$forwarder,
    _ref$forwarder2$booki = _ref$forwarder2.booking,
    url = _ref$forwarder2$booki === void 0 ? "".concat(process.env.SERVICE_BOOKING, "/").concat(_ButtonPayment.ENDPOINT.BOOKING) : _ref$forwarder2$booki,
    id = _ref.id,
    locale = _ref.locale,
    reservationCode = _ref.reservationCode,
    tracking = _ref.tracking,
    home = _ref.url,
    _ref$urlParams = _ref.urlParams,
    _ref$urlParams2 = _ref$urlParams === void 0 ? {} : _ref$urlParams,
    fingerprint = _ref$urlParams2.fingerprint,
    _ref$urlParams2$hsri = _ref$urlParams2.hsri,
    hsri = _ref$urlParams2$hsri === void 0 ? _ButtonPayment.DEFAULT_HSRI : _ref$urlParams2$hsri,
    idchain = _ref$urlParams2.idchain,
    miraiId = _ref$urlParams2.miraiId,
    type = _ref$urlParams2.type,
    utm_source = _ref$urlParams2.utm_source,
    variant = _ref$urlParams2.variant;
  if (!code || !id || !locale || !reservationCode) return;
  return "".concat(url).concat((0, _toUrlParams.toUrlParams)({
    code,
    env: environment,
    fingerprint,
    hsri,
    home,
    idchain,
    idHotel: id,
    lang: locale.split('-')[0],
    miraiId,
    reservationCode,
    type,
    tracking,
    utm_source,
    variant,
    version: 2
  }));
};
exports.getUrlBooking = getUrlBooking;
//# sourceMappingURL=getUrlBooking.js.map