@tripian/react 9.3.23 → 9.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -61609,7 +61609,7 @@ const validatePayment = (f) => {
61609
61609
  e.card_security = 'Invalid CVV';
61610
61610
  return e;
61611
61611
  };
61612
- const KiwiBookingModal = ({ hotelName, roomTitle, rate, currency, checkIn, checkOut, nightCount, adults, children, propertyCode, roomCode, generateExternalId, onClose, onCreateReservation, }) => {
61612
+ const KiwiBookingModal = ({ hotelName, roomTitle, rate, currency, checkIn, checkOut, nightCount, adults, children, propertyCode, roomCode, generateExternalId, onClose, onCreateReservation, onReservationFailed, }) => {
61613
61613
  var _a;
61614
61614
  const [step, setStep] = (0, react_1.useState)(1);
61615
61615
  const [lead, setLead] = (0, react_1.useState)(emptyLead);
@@ -61717,11 +61717,17 @@ const KiwiBookingModal = ({ hotelName, roomTitle, rate, currency, checkIn, check
61717
61717
  setStep(3);
61718
61718
  }
61719
61719
  else {
61720
- setApiError('Reservation could not be completed. Please try again.');
61720
+ const msg = 'Reservation could not be completed. Please try again.';
61721
+ setApiError(msg);
61722
+ if (onReservationFailed)
61723
+ onReservationFailed(msg);
61721
61724
  }
61722
61725
  }
61723
- catch {
61724
- setApiError('An error occurred. Please check your details and try again.');
61726
+ catch (err) {
61727
+ const msg = 'An error occurred. Please check your details and try again.';
61728
+ setApiError(msg);
61729
+ if (onReservationFailed)
61730
+ onReservationFailed(msg);
61725
61731
  }
61726
61732
  finally {
61727
61733
  setSubmitting(false);
@@ -94265,7 +94271,7 @@ const TABS = [
94265
94271
  { key: 'rooms', label: 'Rooms' },
94266
94272
  { key: 'contact', label: 'Contact Us' },
94267
94273
  ];
94268
- const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchPropertyAvailability, availabilityRequest, searchDestination = '', searchCheckIn = '', searchCheckOut = '', searchAdults = 2, searchChildren = 0, searchCitySuggestions, onSearchDestinationChange, onSearchCitySelect, onSearchCheckInChange, onSearchCheckOutChange, onSearchAdultsChange, onSearchChildrenChange, onSearch, onBookNow, onCreateReservation, onReservationCreated, generateExternalId, isFavorite, onFavoriteToggle, showVisaBadge, dayBadgeText, onDayBadgeRemove, onShare, topOffset = '0px', }) => {
94274
+ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchPropertyAvailability, availabilityRequest, searchDestination = '', searchCheckIn = '', searchCheckOut = '', searchAdults = 2, searchChildren = 0, searchCitySuggestions, onSearchDestinationChange, onSearchCitySelect, onSearchCheckInChange, onSearchCheckOutChange, onSearchAdultsChange, onSearchChildrenChange, onSearch, onBookNow, onCreateReservation, onReservationCreated, generateExternalId, isFavorite, onFavoriteToggle, showVisaBadge, dayBadgeText, onDayBadgeRemove, onShare, topOffset = '0px', onRoomsTabView, onRoomAvailabilitySearch, onRateDetailOpen, onSeeMoreDetails, onBookNowClick, onReservationFailed, }) => {
94269
94275
  var _a, _b;
94270
94276
  const [propertyDetail, setPropertyDetail] = (0, react_1.useState)(undefined);
94271
94277
  const [loadingDetail, setLoadingDetail] = (0, react_1.useState)(false);
@@ -94340,6 +94346,8 @@ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchProperty
94340
94346
  const triggerAvailabilityFetch = (checkIn, checkOut, adults, children) => {
94341
94347
  if (!fetchPropertyAvailability || !hotel.code || !checkIn || !checkOut)
94342
94348
  return;
94349
+ if (onRoomAvailabilitySearch)
94350
+ onRoomAvailabilitySearch(hotel, checkIn, checkOut, adults, children);
94343
94351
  setLoadingAvailability(true);
94344
94352
  setAvailabilityData(undefined);
94345
94353
  fetchPropertyAvailability(hotel.code, { in_date: checkIn, out_date: checkOut, adults, children })
@@ -94352,6 +94360,8 @@ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchProperty
94352
94360
  var _a, _b;
94353
94361
  if (activeTab !== 'rooms')
94354
94362
  return;
94363
+ if (onRoomsTabView)
94364
+ onRoomsTabView(hotel);
94355
94365
  const checkIn = (availabilityRequest === null || availabilityRequest === void 0 ? void 0 : availabilityRequest.in_date) || internalCheckIn;
94356
94366
  const checkOut = (availabilityRequest === null || availabilityRequest === void 0 ? void 0 : availabilityRequest.out_date) || internalCheckOut;
94357
94367
  const adults = (_a = availabilityRequest === null || availabilityRequest === void 0 ? void 0 : availabilityRequest.adults) !== null && _a !== void 0 ? _a : internalAdults;
@@ -94769,13 +94779,16 @@ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchProperty
94769
94779
  new Intl.NumberFormat('en-US').format(Math.round(nightlyPrice)),
94770
94780
  " ",
94771
94781
  rateCurrency),
94772
- react_1.default.createElement("button", { type: "button", className: KiwiHotelInfoModal_scss_1.default.ratePriceLabelRow, onClick: () => setRateDetailInfo({ rate, currency: rateCurrency }) },
94782
+ react_1.default.createElement("button", { type: "button", className: KiwiHotelInfoModal_scss_1.default.ratePriceLabelRow, onClick: () => { setRateDetailInfo({ rate, currency: rateCurrency }); if (onRateDetailOpen)
94783
+ onRateDetailOpen(hotel, room, rate); } },
94773
94784
  react_1.default.createElement("span", null, "Average nightly rate"),
94774
94785
  react_1.default.createElement("svg", { className: KiwiHotelInfoModal_scss_1.default.ratePriceInfoIcon, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg" },
94775
94786
  react_1.default.createElement("circle", { cx: "12", cy: "12", r: "10" }),
94776
94787
  react_1.default.createElement("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
94777
94788
  react_1.default.createElement("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" }))))),
94778
94789
  (onCreateReservation || onBookNow) && (react_1.default.createElement("button", { type: "button", className: KiwiHotelInfoModal_scss_1.default.bookNowBtn, onClick: () => {
94790
+ if (onBookNowClick)
94791
+ onBookNowClick(hotel, room, rate);
94779
94792
  if (onCreateReservation) {
94780
94793
  setBookingModal({ room, rate, currency: rateCurrency });
94781
94794
  }
@@ -94783,7 +94796,8 @@ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchProperty
94783
94796
  onBookNow(hotel, room, rate);
94784
94797
  }
94785
94798
  } }, "Book Now")))),
94786
- (rate.description || (rate.policies && Object.values(rate.policies).some(Boolean))) && (react_1.default.createElement("button", { type: "button", className: KiwiHotelInfoModal_scss_1.default.seeMoreBtn, onClick: () => setRoomRateModal({ roomTitle: room.title, rate, currency: rateCurrency }) },
94799
+ (rate.description || (rate.policies && Object.values(rate.policies).some(Boolean))) && (react_1.default.createElement("button", { type: "button", className: KiwiHotelInfoModal_scss_1.default.seeMoreBtn, onClick: () => { setRoomRateModal({ roomTitle: room.title, rate, currency: rateCurrency }); if (onSeeMoreDetails)
94800
+ onSeeMoreDetails(hotel, room, rate); } },
94787
94801
  react_1.default.createElement("span", { className: KiwiHotelInfoModal_scss_1.default.seeMoreDesktop }, "See more details"),
94788
94802
  react_1.default.createElement("span", { className: KiwiHotelInfoModal_scss_1.default.seeMoreMobile }, "More Info")))));
94789
94803
  }))));
@@ -94873,7 +94887,7 @@ const KiwiHotelInfoModal = ({ hotel, onClose, fetchPropertyDetail, fetchProperty
94873
94887
  onReservationCreated(res.data, req.external_id);
94874
94888
  }
94875
94889
  return res;
94876
- } })),
94890
+ }, onReservationFailed: onReservationFailed ? (msg) => onReservationFailed(hotel, bookingModal.room, bookingModal.rate, msg) : undefined })),
94877
94891
  rateDetailInfo && (react_1.default.createElement(KiwiRateDetailModal_1.default, { rate: rateDetailInfo.rate, currency: rateDetailInfo.currency, nightCount: nightCount, onClose: () => setRateDetailInfo(undefined) }))), document.body);
94878
94892
  };
94879
94893
  exports.default = KiwiHotelInfoModal;