"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.bookingCancel = void 0;
var _helpers = require("./helpers");
var _legacy = require("../helpers/legacy");
const bookingCancel = function () {
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
    _ref$instances = _ref.instances,
    instances = _ref$instances === void 0 ? [] : _ref$instances,
    _ref$response = _ref.response,
    _ref$response2 = _ref$response === void 0 ? {} : _ref$response,
    _ref$response2$tracki = _ref$response2.tracking,
    tracking = _ref$response2$tracki === void 0 ? {} : _ref$response2$tracki,
    _ref$store = _ref.store,
    _ref$store2 = _ref$store === void 0 ? {} : _ref$store,
    _ref$store2$finder = _ref$store2.finder,
    finder = _ref$store2$finder === void 0 ? {} : _ref$store2$finder,
    id = _ref$store2.id,
    type = _ref$store2.type;
  // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------
  const _tracking$hotelInfo = tracking.hotelInfo,
    hotelInfo = _tracking$hotelInfo === void 0 ? {} : _tracking$hotelInfo,
    idReservation = tracking.idReservation,
    _tracking$reservedExt = tracking.reservedExtras,
    reservedExtras = _tracking$reservedExt === void 0 ? {} : _tracking$reservedExt,
    _tracking$reservedRoo = tracking.reservedRooms,
    reservedRooms = _tracking$reservedRoo === void 0 ? [] : _tracking$reservedRoo,
    totalPriceWithoutTaxes = tracking.totalPriceWithoutTaxes;
  const _hotelInfo$currency = hotelInfo.currency,
    hotelCurrency = _hotelInfo$currency === void 0 ? {} : _hotelInfo$currency;
  const value = {
    currency: hotelCurrency.code,
    items: (0, _helpers.parseItems)({
      finder,
      hotelInfo,
      id,
      reservedExtras,
      reservedRooms,
      tracking,
      type
    }),
    send_to: instances.map(function () {
      let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        idAnalytics = _ref2.idAnalytics;
      return idAnalytics;
    }),
    transaction_id: idReservation,
    value: (0, _legacy.formatPrice)(totalPriceWithoutTaxes, hotelCurrency)
  };
  window.gtag('event', 'refund', value);
  return value;
};
exports.bookingCancel = bookingCancel;
//# sourceMappingURL=bookingCancel.js.map