"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Rates = void 0;
var _dataSources = require("@mirai/data-sources");
var _locale = require("@mirai/locale");
var _services = require("@mirai/services");
var _ui = require("@mirai/ui");
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireWildcard(require("react"));
var _components = require("./components");
var _helpers = require("./helpers");
var _hooks = require("./hooks");
var _Rates = require("./Rates.Content");
var _Rates2 = require("./Rates.Footer");
var _Rates3 = require("./Rates.Header");
var _Rates4 = require("./Rates.l10n");
var style = _interopRequireWildcard(require("./Rates.module.css"));
var _Rates5 = require("./Rates.RoomSelector");
var _Rates6 = _interopRequireDefault(require("./Rates.Skeleton"));
var _Rates7 = require("./Rates.Unavailability");
var _Core = require("../../Core.constants");
var _helpers2 = require("../../helpers");
var _shared__ = require("../__shared__");
var _Finder = require("../Finder");
var _Header = require("../Header");
var _helpers3 = require("../helpers");
const _excluded = ["testId"],
  _excluded2 = ["id"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
const Rates = _ref => {
  var _dataSource$hotels, _responseError$tracki, _responseError$tracki2;
  let testId = _ref.testId,
    others = _objectWithoutProperties(_ref, _excluded);
  const _useDevice = (0, _ui.useDevice)(),
    isDesktop = _useDevice.isDesktop,
    isMobile = _useDevice.isMobile,
    width = _useDevice.width;
  const _useRates = (0, _hooks.useRates)(),
    actions = _useRates.actions,
    device = _useRates.device,
    fetch = _useRates.fetch,
    multiRoom = _useRates.multiRoom,
    refRoomSelector = _useRates.refRoomSelector,
    responseError = _useRates.responseError,
    state = _useRates.state;
  const _useStore = (0, _dataSources.useStore)(),
    set = _useStore.set,
    _useStore$value = _useStore.value,
    club = _useStore$value.club,
    currency = _useStore$value.currency,
    _useStore$value$finde = _useStore$value.finder,
    finder = _useStore$value$finde === void 0 ? {} : _useStore$value$finde,
    forwarder = _useStore$value.forwarder,
    _useStore$value$hotel = _useStore$value.hotel,
    hotel = _useStore$value$hotel === void 0 ? {} : _useStore$value$hotel,
    language = _useStore$value.language,
    locale = _useStore$value.locale,
    session = _useStore$value.session,
    _useStore$value$skele = _useStore$value.skeleton,
    skeleton = _useStore$value$skele === void 0 ? false : _useStore$value$skele,
    _useStore$value$urlPa = _useStore$value.urlParams,
    urlParams = _useStore$value$urlPa === void 0 ? {} : _useStore$value$urlPa,
    variant = _useStore$value.variant;
  const _useLocale = (0, _locale.useLocale)(),
    translate = _useLocale.translate;
  const refItems = (0, _react.useRef)({});
  const ratesMetricsSent = (0, _react.useRef)(false);
  const _useState = (0, _react.useState)(false),
    _useState2 = _slicedToArray(_useState, 2),
    busy = _useState2[0],
    setBusy = _useState2[1];
  const _useState3 = (0, _react.useState)(),
    _useState4 = _slicedToArray(_useState3, 2),
    cancellationInfo = _useState4[0],
    setCancellationInfo = _useState4[1];
  const _useState5 = (0, _react.useState)(),
    _useState6 = _slicedToArray(_useState5, 2),
    extras = _useState6[0],
    setExtras = _useState6[1];
  const _useState7 = (0, _react.useState)(),
    _useState8 = _slicedToArray(_useState7, 2),
    extrasClosed = _useState8[0],
    setExtrasClosed = _useState8[1];
  const _useState9 = (0, _react.useState)(),
    _useState0 = _slicedToArray(_useState9, 2),
    filterBoard = _useState0[0],
    setFilterBoard = _useState0[1];
  const _useState1 = (0, _react.useState)({}),
    _useState10 = _slicedToArray(_useState1, 2),
    filters = _useState10[0],
    setFilters = _useState10[1];
  const _useState11 = (0, _react.useState)(),
    _useState12 = _slicedToArray(_useState11, 2),
    itemInfo = _useState12[0],
    setItemInfo = _useState12[1];
  const _useState13 = (0, _react.useState)(),
    _useState14 = _slicedToArray(_useState13, 2),
    itemUrl = _useState14[0],
    setItemUrl = _useState14[1];
  const _useState15 = (0, _react.useState)(),
    _useState16 = _slicedToArray(_useState15, 2),
    mapView = _useState16[0],
    setMapView = _useState16[1];
  const _useState17 = (0, _react.useState)(),
    _useState18 = _slicedToArray(_useState17, 2),
    offerInfo = _useState18[0],
    setOfferInfo = _useState18[1];
  const _useState19 = (0, _react.useState)(),
    _useState20 = _slicedToArray(_useState19, 2),
    twinSelected = _useState20[0],
    setTwinSelected = _useState20[1];
  const _finder$calendar = finder.calendar,
    calendar = _finder$calendar === void 0 ? [] : _finder$calendar,
    _finder$occupation = finder.occupation,
    occupation = _finder$occupation === void 0 ? [] : _finder$occupation;
  const cart = state.cart,
    clubDiscount = state.clubDiscount,
    dataSource = state.dataSource,
    fetching = state.fetching,
    metaBoard = state.metaBoard,
    room = state.room,
    strictSearch = state.strictSearch;
  const setCart = actions.setCart,
    setDataSource = actions.setDataSource,
    setMetaBoard = actions.setMetaBoard,
    setRoom = actions.setRoom,
    setStrictSearch = actions.setStrictSearch;
  (0, _react.useEffect)(() => {
    if (skeleton || responseError || !dataSource || ratesMetricsSent.current) return;
    _dataSources.Event.publish(_helpers3.EVENT.METRICS, _objectSpread(_objectSpread({
      id: _helpers3.METRICS_EVENTS.RATES_READY,
      multiRoom,
      variant
    }, (0, _helpers2.getSearchProps)({
      store: {
        finder,
        currency,
        language,
        locale,
        urlParams
      },
      dataSource
    })), {}, {
      is_refundable: refundable
    }));
    ratesMetricsSent.current = true;
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [dataSource]);
  (0, _react.useEffect)(() => {
    if (!filterBoard) return;
    setMetaBoard(filterBoard);
    scrollToRoom(filterBoard.roomId);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [filterBoard]);

  // -- handlers -------------------------------------------------------------------------------------------------------
  const handleFilters = function () {
    let next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    const nextStrictSearch = next.strictSearch;
    setCart([]);
    setRoom(undefined);
    setFilters(next);
    if (strictSearch !== nextStrictSearch) setStrictSearch(nextStrictSearch);
  };
  const handleFinder = function () {
    let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    setCart([]);
    setDataSource(undefined);
    setRoom();
    setMetaBoard();
    scrollTo(0);
    (0, _helpers3.replaceUrlParams)((0, _helpers.getFinderParams)(_objectSpread(_objectSpread({}, values), {}, {
      hotel
    })));
    const nextCalendar = values.calendar,
      nextOccupation = values.occupation,
      nextPlace = values.place,
      nextPromocode = values.promocode;
    fetch({
      nextCalendar,
      nextOccupation,
      nextPlace,
      nextPromocode
    });
  };
  const handleSelect = (board, others) => {
    const nextCart = [...cart];
    nextCart[room || 0] = board ? _objectSpread(_objectSpread({}, board), others) : undefined;
    if (board) {
      scrollToRoom(board.roomId);
      _dataSources.Event.publish(_helpers3.EVENT.RATES_ADD_TO_CART, {
        event: _helpers3.EVENT.RATES_ADD_TO_CART,
        response: _objectSpread({
          board,
          cart: nextCart
        }, dataSource)
      });
      _dataSources.Event.publish(_helpers3.EVENT.METRICS, {
        id: _helpers3.METRICS_EVENTS.RATES_INTERACTION,
        action: 'room_selected',
        result_position: itemsFiltered.findIndex(function () {
          let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
            id = _ref2.id;
          return id === board.roomId;
        }) + 1,
        loyalty_discount_active: !!session || clubDiscount
      });
    }
    setCart(nextCart);
    setExtras();
    setMetaBoard(undefined);
    setTwinSelected();
    if (!multiRoom && !!board) handleSubmit(nextCart);
    if (multiRoom) {
      if (board && room < occupation.length - 1) return setRoom(room + 1);
      if (!board) set({
        rates: undefined
      });
    }
  };
  const handleSubmit = async cart => {
    const _ref3 = (await _services.ServiceRates.extras(_objectSpread(_objectSpread(_objectSpread({}, (0, _helpers.getCheckoutParams)({
        cart,
        clubDiscount,
        currency,
        dataSource,
        forwarder,
        urlParams: (0, _helpers2.fetchUrlParams)(location.search)
      })), (0, _helpers3.getOccupationTotals)({
        infantAge: dataSource.infantAge,
        occupation
      })), {}, {
        clubDiscount: !!session || clubDiscount,
        device,
        hotelCurrency: dataSource.currency,
        locale,
        session
      })).catch(() => {})) || {},
      _ref3$extras = _ref3.extras,
      extras = _ref3$extras === void 0 ? [] : _ref3$extras;
    const selectableExtras = extras.some(function () {
      let _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        included = _ref4.included;
      return !included;
    });
    if (selectableExtras) {
      setExtras(extras);
      setExtrasClosed();
    } else handleCheckout(cart, extras, variant);
  };
  const handleCheckout = function () {
    let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    let selectedExtras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
    let variant = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'A';
    setBusy(true);
    _dataSources.Event.publish(_helpers3.EVENT.METRICS, {
      id: _helpers3.METRICS_EVENTS.RATES_INTERACTION,
      action: 'rates_submit',
      has_extras: (extras === null || extras === void 0 ? void 0 : extras.length) > 0
    });
    setTimeout(() => {
      setBusy(false);
      document.location.href = (0, _helpers.getForwarderUrl)({
        cart,
        clubDiscount,
        currency,
        dataSource,
        extras: selectedExtras,
        forwarder,
        meta: !!urlParams.rates,
        refundable,
        session,
        urlParams: _objectSpread(_objectSpread({}, (0, _helpers2.fetchUrlParams)(location.search)), {}, {
          device
        }),
        variant,
        occupationTotals: JSON.stringify((0, _helpers3.getOccupationTotals)({
          infantAge: dataSource.infantAge,
          occupation
        }))
      });
    }, _helpers3.SUBMIT_DELAY);
  };
  const handleCloseExtras = () => {
    setExtras();
    !multiRoom && setExtrasClosed(true);
  };
  const handleTwin = roomId => {
    setFilterBoard();
    setMetaBoard();
    setTwinSelected(roomId);
  };
  const scrollTo = function () {
    let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    return window.scrollTo({
      top: value,
      behavior: 'smooth'
    });
  };
  const scrollToRoom = roomId => {
    var _refItems$current$roo;
    const _ref5 = (refItems === null || refItems === void 0 || (_refItems$current$roo = refItems.current[roomId]) === null || _refItems$current$roo === void 0 ? void 0 : _refItems$current$roo.getBoundingClientRect()) || {},
      top = _ref5.top;
    if (top) scrollTo(top + window.scrollY - (isMobile ? 65 : 16 * 5));
  };
  const _Theme$get = _ui.Theme.get(),
    contentBackground = _Theme$get.contentBackground;
  const cardImageHeight = (0, _helpers.getCardImageHeight)();
  const _dateDiff = (0, _locale.dateDiff)(calendar[0], calendar[1]),
    nights = _dateDiff.days;
  const response = dataSource !== undefined;
  const roomSelectorProps = {
    cart,
    occupation,
    room,
    onPress: setRoom
  };
  const features = (0, _helpers.getFeatures)(hotel.features, urlParams, {
    isDesktop
  });
  const priceFactor = features.showPricePerNight && nights > 1 ? nights : 1;
  const uniqueOption = ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.items) || []).filter(function () {
    let _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      soldOut = _ref6.soldOut;
    return !soldOut;
  }).every(_ref7 => {
    let _ref7$boards = _ref7.boards,
      boards = _ref7$boards === void 0 ? [] : _ref7$boards,
      _ref7$cancellations = _ref7.cancellations,
      cancellations = _ref7$cancellations === void 0 ? [] : _ref7$cancellations,
      _ref7$rates = _ref7.rates,
      rates = _ref7$rates === void 0 ? [] : _ref7$rates;
    return boards.length === 1 && cancellations.length === 1 && rates.length === 1;
  });
  const itemsFiltered = (0, _helpers.select)(dataSource === null || dataSource === void 0 ? void 0 : dataSource.items, filters, {
    priceFactor
  });
  const refundable = (0, _helpers2.getRefundableFromItems)(dataSource === null || dataSource === void 0 ? void 0 : dataSource.items);
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Header.Header, {
    currency: true,
    login: !!club,
    name: features.showNameInHeader,
    skeleton: skeleton
  }), /*#__PURE__*/_react.default.createElement(_ui.View, {
    ref: refRoomSelector,
    className: (0, _ui.styles)(style.finder, style.blur, (!multiRoom || responseError) && style.sticky),
    style: !isMobile ? {
      backgroundColor: (0, _helpers3.opacity)(contentBackground, 0.66)
    } : undefined
  }, /*#__PURE__*/_react.default.createElement(_ui.View, {
    row: isMobile,
    className: style.wrapper
  }, /*#__PURE__*/_react.default.createElement(_Finder.Finder, {
    compacted: !isDesktop,
    icon: true,
    onSubmit: handleFinder,
    testId: testId ? "".concat(testId, "-finder") : undefined
  }), !responseError && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.items) && /*#__PURE__*/_react.default.createElement(_components.Filters, _extends({}, dataSource, {
    clubDiscount,
    values: filters,
    priceFactor,
    onSubmit: handleFilters
  })))), /*#__PURE__*/_react.default.createElement(_ui.Progress, {
    indeterminate: true,
    visible: fetching && !responseError,
    className: style.progress
  }), isMobile && !responseError && /*#__PURE__*/_react.default.createElement(_Rates5.RoomSelector, _extends({}, roomSelectorProps, {
    testId: testId ? "".concat(testId, "-multiroom") : undefined
  })), /*#__PURE__*/_react.default.createElement(_ui.View, {
    role: "rates",
    testId: testId,
    className: (0, _ui.styles)(style.container, others.className)
  }, /*#__PURE__*/_react.default.createElement(_ui.View, {
    className: [style.wrapper, style.content]
  }, !responseError && /*#__PURE__*/_react.default.createElement(_Rates.Content, _extends({}, dataSource, others, {
    skeleton: skeleton
  })), (response || multiRoom && !responseError) && /*#__PURE__*/_react.default.createElement(_Rates3.Header, {
    dataSource,
    filters,
    multiRoom,
    priceFactor,
    onMapView: setMapView,
    onSelect: handleSelect
  }, !isMobile ? /*#__PURE__*/_react.default.createElement(_Rates5.RoomSelector, _extends({}, roomSelectorProps, {
    testId: testId ? "".concat(testId, "-multiroom") : undefined
  })) : undefined), response ? /*#__PURE__*/_react.default.createElement(_shared__.Cards, null, itemsFiltered === null || itemsFiltered === void 0 ? void 0 : itemsFiltered.map((_ref8, index) => {
    let id = _ref8.id,
      item = _objectWithoutProperties(_ref8, _excluded2);
    return /*#__PURE__*/_react.default.createElement(_components.Item, _extends({}, _objectSpread(_objectSpread({}, (0, _helpers.filterItem)(item, filters, priceFactor)), {}, {
      cardImageHeight,
      cart,
      extrasClosed,
      features,
      filters,
      metaBoard,
      id,
      resultPosition: index + 1,
      multiRoom,
      nights,
      priceFactor,
      room,
      taxesType: dataSource.taxesType,
      uniqueOption
    }), {
      key: "".concat(id || index, ":").concat(fetching, ":").concat(width),
      ref: el => refItems.current[id] = el,
      selected: cart[room || 0],
      onCancellationInfo: rate => setCancellationInfo(_objectSpread(_objectSpread({}, rate), {}, {
        name: item.name
      })),
      onMoreInfo: () => setItemInfo(item),
      onOfferInfo: rate => setOfferInfo(rate),
      onSelect: handleSelect,
      onTwin: handleTwin,
      onViewUrl: info => setItemUrl(info),
      testId: testId ? "".concat(testId, "-item-").concat(index) : undefined
    }));
  }), (_dataSource$hotels = dataSource.hotels) === null || _dataSource$hotels === void 0 ? void 0 : _dataSource$hotels.map(function () {
    let item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    return /*#__PURE__*/_react.default.createElement(_components.CardHotel, _extends({
      key: item.id
    }, _objectSpread(_objectSpread({}, item), {}, {
      cardImageHeight,
      nights,
      priceFactor
    })));
  })) : responseError ? responseError.hotel || ((_responseError$tracki = responseError.tracking) === null || _responseError$tracki === void 0 || (_responseError$tracki = _responseError$tracki.hotelInfoBAR) === null || _responseError$tracki === void 0 ? void 0 : _responseError$tracki.length) === 0 || (_responseError$tracki2 = responseError.tracking) !== null && _responseError$tracki2 !== void 0 && _responseError$tracki2.hotelInfoBAR[0].noAvailableReason ? /*#__PURE__*/_react.default.createElement(_Rates7.Unavailability, _extends({}, _objectSpread(_objectSpread({}, responseError), {}, {
    nights,
    priceFactor
  }), {
    onMapView: setMapView
  })) : /*#__PURE__*/_react.default.createElement(_ui.Notification, {
    error: true,
    large: true,
    className: style.error
  }, translate(_Rates4.L10N.NOTIFICATION_ERROR[responseError.code || _Core.ERROR.UNKNOWN])) : /*#__PURE__*/_react.default.createElement(_Rates6.default, {
    multiRoom: multiRoom
  })), /*#__PURE__*/_react.default.createElement(_Rates2.Footer, {
    cart: multiRoom ? cart : [],
    dataSource,
    extras,
    multiRoom,
    occupation,
    onSubmit: () => multiRoom ? handleSubmit(cart) : undefined,
    testId: testId ? "".concat(testId, "-footer") : undefined
  })), response && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_components.ModalItemInfo, _extends({}, _objectSpread(_objectSpread({}, itemInfo), {}, {
    features,
    room
  }), {
    visible: !!itemInfo,
    onClose: () => setItemInfo(),
    onViewUrl: info => setItemUrl(info)
  })), /*#__PURE__*/_react.default.createElement(_components.ModalCancellationInfo, _extends({}, cancellationInfo, {
    visible: !!cancellationInfo,
    onClose: () => setCancellationInfo()
  })), /*#__PURE__*/_react.default.createElement(_components.ModalItemUrl, _extends({}, itemUrl, {
    visible: !!itemUrl,
    onClose: () => setItemUrl()
  })), /*#__PURE__*/_react.default.createElement(_components.ModalOfferInfo, _extends({}, _objectSpread({}, offerInfo), {
    visible: !!offerInfo,
    onClose: () => setOfferInfo()
  })), /*#__PURE__*/_react.default.createElement(_components.ModalTwin, _extends({}, _objectSpread(_objectSpread({}, itemInfo), {}, {
    clubDiscount,
    dataSource,
    cart,
    features,
    filters,
    nights,
    priceFactor,
    room,
    selected: twinSelected
  }), {
    onBook: handleSelect,
    onClose: () => setTwinSelected(),
    onFilter: handleFilters,
    onSelect: setFilterBoard
  })), /*#__PURE__*/_react.default.createElement(_components.ModalExtras, _extends({}, _objectSpread(_objectSpread({}, dataSource), {}, {
    busy,
    cart,
    extras
  }), {
    visible: !!extras,
    onClose: handleCloseExtras,
    onSubmit: extras => handleCheckout(cart, extras, variant),
    testId: testId ? "".concat(testId, "-modalExtras") : undefined
  }))), /*#__PURE__*/_react.default.createElement(_components.ModalMapView, {
    items: mapView,
    nights: nights,
    visible: !!mapView,
    onClose: () => setMapView()
  }), /*#__PURE__*/_react.default.createElement(_shared__.Footer, null));
};
exports.Rates = Rates;
Rates.displayName = 'Mirai:Core:Rates';
Rates.propTypes = {
  testId: _propTypes.default.string
};
//# sourceMappingURL=Rates.js.map