"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 {
    instances = [],
    response: {
      tracking = {}
    } = {},
    store: {
      finder = {},
      id,
      type
    } = {}
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------
  const {
    hotelInfo = {},
    idReservation,
    reservedExtras = {},
    reservedRooms = [],
    totalPriceWithoutTaxes
  } = tracking;
  const {
    currency: hotelCurrency = {}
  } = hotelInfo;
  const value = {
    currency: hotelCurrency.code,
    items: (0, _helpers.parseItems)({
      finder,
      hotelInfo,
      id,
      reservedExtras,
      reservedRooms,
      tracking,
      type
    }),
    send_to: instances.map(function () {
      let {
        idAnalytics
      } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      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