@qite/tide-booking-component 1.4.87 → 1.4.88

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.
@@ -6753,7 +6753,7 @@ var DepartureRange;
6753
6753
  DepartureRange[(DepartureRange['Night'] = 3)] = 'Night';
6754
6754
  })(DepartureRange || (DepartureRange = {}));
6755
6755
 
6756
- var formatPrice$1 = function (price, currencyCode, locale) {
6756
+ var formatPrice$2 = function (price, currencyCode, locale) {
6757
6757
  if (locale === void 0) {
6758
6758
  locale = 'nl-BE';
6759
6759
  }
@@ -6860,7 +6860,7 @@ function getLocale(code) {
6860
6860
  }
6861
6861
  }
6862
6862
  var getPriceDifferenceText = function (price, currencyCode) {
6863
- return price > 0 ? '+ '.concat(formatPrice$1(Math.abs(price), currencyCode)) : '- '.concat(formatPrice$1(Math.abs(price), currencyCode));
6863
+ return price > 0 ? '+ '.concat(formatPrice$2(Math.abs(price), currencyCode)) : '- '.concat(formatPrice$2(Math.abs(price), currencyCode));
6864
6864
  };
6865
6865
  function format(text, args) {
6866
6866
  return text.replace(/{([0-9]+)}/g, function (match, index) {
@@ -13584,16 +13584,16 @@ var formatPriceByMode = function (price, priceMode, personCount, duration, perPe
13584
13584
  if (!price) return '';
13585
13585
  switch (priceMode) {
13586
13586
  case 0:
13587
- return ''.concat(formatPrice$1(price, currencyCode));
13587
+ return ''.concat(formatPrice$2(price, currencyCode));
13588
13588
  case 1:
13589
13589
  var perPersonPrice = price / personCount;
13590
- return ''.concat(formatPrice$1(perPersonPrice, currencyCode), ' / ').concat(perPersonLabel);
13590
+ return ''.concat(formatPrice$2(perPersonPrice, currencyCode), ' / ').concat(perPersonLabel);
13591
13591
  case 2:
13592
13592
  var perNightPrice = price / duration;
13593
- return ''.concat(formatPrice$1(perNightPrice, currencyCode), ' / ').concat(perNightLabel);
13593
+ return ''.concat(formatPrice$2(perNightPrice, currencyCode), ' / ').concat(perNightLabel);
13594
13594
  case 3:
13595
13595
  var perPersonPerNightPrice = price / duration;
13596
- return ''.concat(formatPrice$1(perPersonPerNightPrice, currencyCode), ' / ').concat(perPersonPerNightLabel);
13596
+ return ''.concat(formatPrice$2(perPersonPerNightPrice, currencyCode), ' / ').concat(perPersonPerNightLabel);
13597
13597
  }
13598
13598
  };
13599
13599
 
@@ -22000,7 +22000,7 @@ var NoneOption = function (_a) {
22000
22000
  return x.requirementType === 2;
22001
22001
  });
22002
22002
  var noneSelected = !selectedOption;
22003
- var priceDifferencetext = selectedOption ? '- '.concat(formatPrice$1(Math.abs(selectedOption.line.price), currencyCode)) : '';
22003
+ var priceDifferencetext = selectedOption ? '- '.concat(formatPrice$2(Math.abs(selectedOption.line.price), currencyCode)) : '';
22004
22004
  return React__default.createElement(
22005
22005
  React__default.Fragment,
22006
22006
  null,
@@ -23273,7 +23273,7 @@ var OptionRoom = function (_a) {
23273
23273
  e.preventDefault();
23274
23274
  };
23275
23275
  var getPriceDifferenceText = function (price) {
23276
- return price > 0 ? '+ '.concat(formatPrice$1(Math.abs(price), currencyCode)) : '- '.concat(formatPrice$1(Math.abs(price), currencyCode));
23276
+ return price > 0 ? '+ '.concat(formatPrice$2(Math.abs(price), currencyCode)) : '- '.concat(formatPrice$2(Math.abs(price), currencyCode));
23277
23277
  };
23278
23278
  var getAccommodationPriceDifference = function (accommodation) {
23279
23279
  var _a;
@@ -24793,7 +24793,7 @@ var Sidebar = function (_a) {
24793
24793
  { className: 'pricing-summary__property' },
24794
24794
  React__default.createElement('h6', { className: 'pricing-summary__title' }, translations.SIDEBAR.BASE_PRICE)
24795
24795
  ),
24796
- React__default.createElement('div', { className: 'pricing-summary__value' }, formatPrice$1(basePrice, currencyCode))
24796
+ React__default.createElement('div', { className: 'pricing-summary__value' }, formatPrice$2(basePrice, currencyCode))
24797
24797
  ),
24798
24798
  basePricePerPaxType &&
24799
24799
  basePricePerPaxType.map(function (ppt, index) {
@@ -24810,7 +24810,7 @@ var Sidebar = function (_a) {
24810
24810
  ' ',
24811
24811
  getPaxTypeTranslation(translations, ppt.paxType, ppt.numberOfPax)
24812
24812
  ),
24813
- React__default.createElement('div', { className: 'pricing-summary__value' }, formatPrice$1(ppt.pricePerPaxType, currencyCode))
24813
+ React__default.createElement('div', { className: 'pricing-summary__value' }, formatPrice$2(ppt.pricePerPaxType, currencyCode))
24814
24814
  ),
24815
24815
  ppt.details.map(function (detail, dIndex) {
24816
24816
  return React__default.createElement(
@@ -24823,7 +24823,7 @@ var Sidebar = function (_a) {
24823
24823
  React__default.createElement(
24824
24824
  'div',
24825
24825
  { className: 'pricing-summary__value' },
24826
- formatPrice$1(detail.price / detail.numberOfPax, currencyCode)
24826
+ formatPrice$2(detail.price / detail.numberOfPax, currencyCode)
24827
24827
  )
24828
24828
  );
24829
24829
  })
@@ -24850,7 +24850,7 @@ var Sidebar = function (_a) {
24850
24850
  React__default.createElement(
24851
24851
  'div',
24852
24852
  { className: 'pricing-summary__value' },
24853
- formatPrice$1(priceDetail.price * priceDetail.amount, currencyCode)
24853
+ formatPrice$2(priceDetail.price * priceDetail.amount, currencyCode)
24854
24854
  )
24855
24855
  ),
24856
24856
  React__default.createElement(
@@ -24885,7 +24885,7 @@ var Sidebar = function (_a) {
24885
24885
  React__default.createElement(
24886
24886
  'div',
24887
24887
  { className: 'pricing-summary__value' },
24888
- formatPrice$1(priceDetail.price * priceDetail.amount, currencyCode)
24888
+ formatPrice$2(priceDetail.price * priceDetail.amount, currencyCode)
24889
24889
  )
24890
24890
  ),
24891
24891
  React__default.createElement(
@@ -24915,7 +24915,7 @@ var Sidebar = function (_a) {
24915
24915
  React__default.createElement(
24916
24916
  'div',
24917
24917
  { className: 'pricing-summary__value' },
24918
- formatPrice$1(ppt.pricePerPaxType, currencyCode)
24918
+ formatPrice$2(ppt.pricePerPaxType, currencyCode)
24919
24919
  )
24920
24920
  ),
24921
24921
  ppt.details.map(function (detail, dIndex) {
@@ -24935,7 +24935,7 @@ var Sidebar = function (_a) {
24935
24935
  React__default.createElement(
24936
24936
  'div',
24937
24937
  { className: 'pricing-summary__value' },
24938
- formatPrice$1(detail.price / detail.numberOfPax, currencyCode)
24938
+ formatPrice$2(detail.price / detail.numberOfPax, currencyCode)
24939
24939
  )
24940
24940
  );
24941
24941
  })
@@ -24977,7 +24977,7 @@ var Sidebar = function (_a) {
24977
24977
  React__default.createElement(
24978
24978
  'div',
24979
24979
  { className: 'pricing' },
24980
- React__default.createElement('div', { className: 'pricing__price' }, formatPrice$1(totalPrice, currencyCode))
24980
+ React__default.createElement('div', { className: 'pricing__price' }, formatPrice$2(totalPrice, currencyCode))
24981
24981
  )
24982
24982
  )
24983
24983
  ),
@@ -24995,7 +24995,7 @@ var Sidebar = function (_a) {
24995
24995
  React__default.createElement(
24996
24996
  'div',
24997
24997
  { className: 'pricing' },
24998
- React__default.createElement('div', { className: 'pricing__price' }, formatPrice$1(deposit, currencyCode))
24998
+ React__default.createElement('div', { className: 'pricing__price' }, formatPrice$2(deposit, currencyCode))
24999
24999
  )
25000
25000
  )
25001
25001
  ),
@@ -25011,7 +25011,7 @@ var Sidebar = function (_a) {
25011
25011
  translations.SIDEBAR.DEPOSIT_TEXT1,
25012
25012
  React__default.createElement('strong', null, translations.SIDEBAR.DEPOSIT_TEXT2),
25013
25013
  translations.SIDEBAR.DEPOSIT_TEXT3,
25014
- formatPrice$1(remainingAmount, currencyCode),
25014
+ formatPrice$2(remainingAmount, currencyCode),
25015
25015
  translations.SIDEBAR.DEPOSIT_TEXT4,
25016
25016
  React__default.createElement('strong', null, translations.SIDEBAR.DEPOSIT_TEXT5),
25017
25017
  translations.SIDEBAR.DEPOSIT_TEXT6
@@ -25038,7 +25038,7 @@ var Sidebar = function (_a) {
25038
25038
  React__default.createElement(
25039
25039
  'div',
25040
25040
  { className: 'pricing' },
25041
- React__default.createElement('div', { className: 'pricing__price' }, formatPrice$1(totalPrice, currencyCode))
25041
+ React__default.createElement('div', { className: 'pricing__price' }, formatPrice$2(totalPrice, currencyCode))
25042
25042
  )
25043
25043
  )
25044
25044
  )
@@ -33534,7 +33534,7 @@ var _a;
33534
33534
  var initialState$1 = {
33535
33535
  results: [],
33536
33536
  filteredResults: [],
33537
- selectedSearchResultId: null,
33537
+ selectedSearchResult: null,
33538
33538
  packagingAccoResults: [],
33539
33539
  filteredPackagingAccoResults: [],
33540
33540
  packagingAccoSearchDetails: [],
@@ -33561,7 +33561,7 @@ var searchResultsSlice = createSlice({
33561
33561
  state.filteredResults = action.payload;
33562
33562
  },
33563
33563
  setSelectedSearchResult: function (state, action) {
33564
- state.selectedSearchResultId = action.payload;
33564
+ state.selectedSearchResult = action.payload;
33565
33565
  },
33566
33566
  setPackagingAccoResults: function (state, action) {
33567
33567
  state.packagingAccoResults = action.payload;
@@ -34840,7 +34840,7 @@ var Itinerary = function (_a) {
34840
34840
  React__default.createElement(
34841
34841
  'h3',
34842
34842
  { className: 'search__filter__prices--amount' },
34843
- formatPrice$1(
34843
+ formatPrice$2(
34844
34844
  ((entry === null || entry === void 0 ? void 0 : entry.sellingPrice) || 0) /
34845
34845
  ((entry === null || entry === void 0 ? void 0 : entry.numberOfPax) || 1),
34846
34846
  (entry === null || entry === void 0 ? void 0 : entry.currencyCode) || 'EUR'
@@ -34854,7 +34854,7 @@ var Itinerary = function (_a) {
34854
34854
  'strong',
34855
34855
  null,
34856
34856
  '(',
34857
- formatPrice$1(
34857
+ formatPrice$2(
34858
34858
  (entry === null || entry === void 0 ? void 0 : entry.sellingPrice) || 0,
34859
34859
  (entry === null || entry === void 0 ? void 0 : entry.currencyCode) || 'EUR'
34860
34860
  ),
@@ -37889,7 +37889,7 @@ var FlightsFlyIn = function (_a) {
37889
37889
  );
37890
37890
  };
37891
37891
 
37892
- var formatPrice = function (price, currencyCode) {
37892
+ var formatPrice$1 = function (price, currencyCode) {
37893
37893
  if (currencyCode === void 0) {
37894
37894
  currencyCode = 'EUR';
37895
37895
  }
@@ -38020,7 +38020,7 @@ var AccommodationFlyIn = function (_a) {
38020
38020
  var totalPrice = selectedOptions.reduce(function (total, option) {
38021
38021
  return total + (option.price || 0);
38022
38022
  }, 0);
38023
- return formatPrice(totalPrice, selectedPackagingAccoSearchDetails.currencyCode);
38023
+ return formatPrice$1(totalPrice, selectedPackagingAccoSearchDetails.currencyCode);
38024
38024
  };
38025
38025
  var getPriceDifference = function (currentSelectedPrice, roomIndex, accommodationCode, regimeId) {
38026
38026
  var targetPrice = 0;
@@ -38045,7 +38045,7 @@ var AccommodationFlyIn = function (_a) {
38045
38045
  if (difference === 0) {
38046
38046
  return null;
38047
38047
  }
38048
- var formattedAbsoluteValue = formatPrice(Math.abs(difference), currencyCode);
38048
+ var formattedAbsoluteValue = formatPrice$1(Math.abs(difference), currencyCode);
38049
38049
  return ''.concat(difference > 0 ? '+' : '-', ' ').concat(formattedAbsoluteValue);
38050
38050
  };
38051
38051
  var getPriceDifferenceClassName = function (difference) {
@@ -38326,6 +38326,306 @@ var AccommodationFlyIn = function (_a) {
38326
38326
  // </>
38327
38327
  };
38328
38328
 
38329
+ var formatPrice = function (price, currencyCode) {
38330
+ if (currencyCode === void 0) {
38331
+ currencyCode = 'EUR';
38332
+ }
38333
+ if (typeof price !== 'number') return '';
38334
+ return new Intl.NumberFormat('nl-BE', {
38335
+ style: 'currency',
38336
+ currency: currencyCode
38337
+ }).format(price);
38338
+ };
38339
+ var GroupTourFlyIn = function (_a) {
38340
+ var _b;
38341
+ _a.isLoading;
38342
+ var isOpen = _a.isOpen,
38343
+ setIsOpen = _a.setIsOpen;
38344
+ var dispatch = useDispatch();
38345
+ var context = useContext(SearchResultsConfigurationContext);
38346
+ var language = (_b = context === null || context === void 0 ? void 0 : context.languageCode) !== null && _b !== void 0 ? _b : 'en-GB';
38347
+ var translations = getTranslations(language);
38348
+ var bookingPackageDetails = useSelector(function (state) {
38349
+ return state.searchResults;
38350
+ }).bookingPackageDetails;
38351
+ var selectedBookingPackageDetails = useMemo(
38352
+ function () {
38353
+ var _a;
38354
+ return (_a = bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.options) === null || _a === void 0
38355
+ ? void 0
38356
+ : _a.find(function (x) {
38357
+ return x.isSelected;
38358
+ });
38359
+ },
38360
+ [bookingPackageDetails]
38361
+ );
38362
+ var groupedRooms = useMemo(
38363
+ function () {
38364
+ if (!(selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms)) return [];
38365
+ return selectedBookingPackageDetails.rooms.map(function (room) {
38366
+ var groupedMap = new Map();
38367
+ room.options.forEach(function (option) {
38368
+ var _a;
38369
+ var key = option.accommodationCode;
38370
+ if (!groupedMap.has(key)) {
38371
+ groupedMap.set(key, {
38372
+ accommodationCode: option.accommodationCode,
38373
+ accommodationName: option.accommodationName,
38374
+ regimes: []
38375
+ });
38376
+ }
38377
+ (_a = groupedMap.get(key)) === null || _a === void 0
38378
+ ? void 0
38379
+ : _a.regimes.push({
38380
+ id: option.entryLineGuid,
38381
+ label: option.regimeName
38382
+ });
38383
+ });
38384
+ return Array.from(groupedMap.values());
38385
+ });
38386
+ },
38387
+ [selectedBookingPackageDetails]
38388
+ );
38389
+ if (!bookingPackageDetails) {
38390
+ return null;
38391
+ }
38392
+ var getSelectedOptionForRoom = function (roomIndex) {
38393
+ var _a, _b, _c;
38394
+ return (_c =
38395
+ (_b =
38396
+ (_a = selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms) === null ||
38397
+ _a === void 0
38398
+ ? void 0
38399
+ : _a[roomIndex]) === null || _b === void 0
38400
+ ? void 0
38401
+ : _b.options) === null || _c === void 0
38402
+ ? void 0
38403
+ : _c.find(function (option) {
38404
+ return option.isSelected;
38405
+ });
38406
+ };
38407
+ var getSelectedOptionForAccommodation = function (roomIndex, accommodationCode) {
38408
+ var _a, _b, _c;
38409
+ return (_c =
38410
+ (_b =
38411
+ (_a = selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms) === null ||
38412
+ _a === void 0
38413
+ ? void 0
38414
+ : _a[roomIndex]) === null || _b === void 0
38415
+ ? void 0
38416
+ : _b.options) === null || _c === void 0
38417
+ ? void 0
38418
+ : _c.find(function (option) {
38419
+ return option.accommodationCode === accommodationCode && option.isSelected;
38420
+ });
38421
+ };
38422
+ var handlePick = function (roomIndex, selectedGuid) {
38423
+ if (!bookingPackageDetails || !selectedBookingPackageDetails) return;
38424
+ var updatedBookingPackageDetails = __assign(__assign({}, bookingPackageDetails), {
38425
+ options: bookingPackageDetails.options.map(function (bookingOption) {
38426
+ if (!bookingOption.isSelected) {
38427
+ return bookingOption;
38428
+ }
38429
+ return __assign(__assign({}, bookingOption), {
38430
+ rooms: bookingOption.rooms.map(function (room, currentRoomIndex) {
38431
+ if (currentRoomIndex !== roomIndex) {
38432
+ return room;
38433
+ }
38434
+ return __assign(__assign({}, room), {
38435
+ options: room.options.map(function (roomOption) {
38436
+ return __assign(__assign({}, roomOption), { isSelected: roomOption.entryLineGuid === selectedGuid });
38437
+ })
38438
+ });
38439
+ })
38440
+ });
38441
+ })
38442
+ });
38443
+ dispatch(setBookingPackageDetails({ details: updatedBookingPackageDetails }));
38444
+ };
38445
+ var handleConfirm = function () {
38446
+ if (isOpen) {
38447
+ setIsOpen(false);
38448
+ }
38449
+ console.log('Booking package details sent to onBook callback:', bookingPackageDetails);
38450
+ if (context === null || context === void 0 ? void 0 : context.onBook) {
38451
+ context.onBook(bookingPackageDetails);
38452
+ }
38453
+ };
38454
+ var calculateTotalPrice = function () {
38455
+ var selectedOptions =
38456
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38457
+ ? void 0
38458
+ : selectedBookingPackageDetails.rooms.flatMap(function (room) {
38459
+ return room.options.filter(function (option) {
38460
+ return option.isSelected;
38461
+ });
38462
+ });
38463
+ var totalPrice =
38464
+ selectedOptions === null || selectedOptions === void 0
38465
+ ? void 0
38466
+ : selectedOptions.reduce(function (total, option) {
38467
+ return total + (option.price || 0);
38468
+ }, 0);
38469
+ return formatPrice(totalPrice, bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.currencyCode);
38470
+ };
38471
+ var getPriceDifference = function (currentSelectedPrice, roomIndex, accommodationCode, regimeId) {
38472
+ var targetPrice = 0;
38473
+ var selectedOption = getSelectedOptionForAccommodation(roomIndex, accommodationCode);
38474
+ if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.price) {
38475
+ targetPrice = selectedOption.price;
38476
+ } else {
38477
+ var firstOption =
38478
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38479
+ ? void 0
38480
+ : selectedBookingPackageDetails.rooms[roomIndex].options.find(function (option) {
38481
+ return option.accommodationCode === accommodationCode;
38482
+ });
38483
+ targetPrice = (firstOption === null || firstOption === void 0 ? void 0 : firstOption.price) || 0;
38484
+ }
38485
+ if (regimeId) {
38486
+ var regimeOption =
38487
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38488
+ ? void 0
38489
+ : selectedBookingPackageDetails.rooms[roomIndex].options.find(function (option) {
38490
+ return option.entryLineGuid === regimeId;
38491
+ });
38492
+ targetPrice = (regimeOption === null || regimeOption === void 0 ? void 0 : regimeOption.price) || 0;
38493
+ }
38494
+ return targetPrice - (currentSelectedPrice || 0);
38495
+ };
38496
+ var formatPriceDifference = function (difference, currencyCode) {
38497
+ if (difference === 0) {
38498
+ return null;
38499
+ }
38500
+ var formattedAbsoluteValue = formatPrice(Math.abs(difference), currencyCode);
38501
+ return ''.concat(difference > 0 ? '+' : '-', ' ').concat(formattedAbsoluteValue);
38502
+ };
38503
+ var getPriceDifferenceClassName = function (difference) {
38504
+ if (difference < 0) {
38505
+ return 'flyin__acco__price flyin__acco__price--decrease';
38506
+ }
38507
+ if (difference > 0) {
38508
+ return 'flyin__acco__price flyin__acco__price--increase';
38509
+ }
38510
+ return 'flyin__acco__price';
38511
+ };
38512
+ var regimeFormatter = function (roomIndex, accommodation, regimeId, label) {
38513
+ var roomOption = getSelectedOptionForRoom(roomIndex);
38514
+ var difference = getPriceDifference(
38515
+ roomOption === null || roomOption === void 0 ? void 0 : roomOption.price,
38516
+ roomIndex,
38517
+ accommodation.accommodationCode,
38518
+ regimeId
38519
+ );
38520
+ return ''.concat(label, ' ').concat(difference !== 0 ? '('.concat(formatPriceDifference(difference, bookingPackageDetails.currencyCode), ')') : '');
38521
+ };
38522
+ return React__default.createElement(
38523
+ React__default.Fragment,
38524
+ null,
38525
+ React__default.createElement(
38526
+ 'div',
38527
+ { className: 'flyin__content' },
38528
+ groupedRooms.map(function (roomAccommodations, roomIndex) {
38529
+ var selectedRoomOption = getSelectedOptionForRoom(roomIndex);
38530
+ return React__default.createElement(
38531
+ 'div',
38532
+ { className: 'flyin__acco', key: 'room-'.concat(roomIndex) },
38533
+ React__default.createElement('h3', { className: 'flyin__acco__room-title' }, 'Room ', roomIndex + 1),
38534
+ React__default.createElement(
38535
+ 'div',
38536
+ { className: 'flyin__acco__cards' },
38537
+ roomAccommodations.map(function (accommodation) {
38538
+ var selectedOption = getSelectedOptionForAccommodation(roomIndex, accommodation.accommodationCode);
38539
+ var priceDifference = getPriceDifference(
38540
+ selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.price,
38541
+ roomIndex,
38542
+ accommodation.accommodationCode
38543
+ );
38544
+ return React__default.createElement(
38545
+ 'div',
38546
+ { className: 'flyin__acco__card', key: ''.concat(roomIndex, '-').concat(accommodation.accommodationCode) },
38547
+ React__default.createElement(
38548
+ 'div',
38549
+ { className: 'flyin__acco__content' },
38550
+ React__default.createElement('h4', { className: 'flyin__acco__title' }, accommodation.accommodationName)
38551
+ ),
38552
+ React__default.createElement(
38553
+ 'div',
38554
+ { className: 'flyin__acco__footer' },
38555
+ React__default.createElement(ItemPicker$1, {
38556
+ items: accommodation.regimes,
38557
+ selection: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.regimeName,
38558
+ label: '',
38559
+ placeholder: 'Select regime',
38560
+ classModifier: '',
38561
+ onPick: function (selected, selectedGuid) {
38562
+ return handlePick(roomIndex, selectedGuid);
38563
+ },
38564
+ valueFormatter: function (id, label) {
38565
+ return regimeFormatter(roomIndex, accommodation, id, label);
38566
+ }
38567
+ }),
38568
+ React__default.createElement(
38569
+ 'div',
38570
+ { className: 'flyin__acco__footer__actions' },
38571
+ React__default.createElement(
38572
+ 'button',
38573
+ {
38574
+ className:
38575
+ (selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.accommodationCode) ==
38576
+ accommodation.accommodationCode
38577
+ ? 'cta cta--select cta--selected'
38578
+ : 'cta cta--select',
38579
+ onClick: function () {
38580
+ var _a;
38581
+ handlePick(
38582
+ roomIndex,
38583
+ selectedOption ? selectedOption.entryLineGuid : (_a = first(accommodation.regimes)) === null || _a === void 0 ? void 0 : _a.id
38584
+ );
38585
+ }
38586
+ },
38587
+ (selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.accommodationCode) ==
38588
+ accommodation.accommodationCode
38589
+ ? translations === null || translations === void 0
38590
+ ? void 0
38591
+ : translations.SHARED.SELECTED
38592
+ : translations === null || translations === void 0
38593
+ ? void 0
38594
+ : translations.SHARED.SELECT
38595
+ ),
38596
+ React__default.createElement(
38597
+ 'div',
38598
+ { className: 'flyin__acco__price__wrapper' },
38599
+ React__default.createElement(
38600
+ 'span',
38601
+ { className: getPriceDifferenceClassName(priceDifference) },
38602
+ formatPriceDifference(
38603
+ priceDifference,
38604
+ bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.currencyCode
38605
+ )
38606
+ )
38607
+ )
38608
+ )
38609
+ )
38610
+ );
38611
+ })
38612
+ )
38613
+ );
38614
+ })
38615
+ ),
38616
+ React__default.createElement(
38617
+ 'div',
38618
+ { className: 'flyin__footer' },
38619
+ React__default.createElement('div', { className: 'flyin__footer__price' }, 'Total price: ', calculateTotalPrice()),
38620
+ React__default.createElement(
38621
+ 'div',
38622
+ { className: 'flyin__button-wrapper' },
38623
+ React__default.createElement('button', { className: 'cta cta--select', onClick: handleConfirm }, translations.PRODUCT.BOOK_NOW)
38624
+ )
38625
+ )
38626
+ );
38627
+ };
38628
+
38329
38629
  var FlyIn = function (_a) {
38330
38630
  var title = _a.title,
38331
38631
  srpType = _a.srpType,
@@ -38408,8 +38708,9 @@ var FlyIn = function (_a) {
38408
38708
  )
38409
38709
  ),
38410
38710
  srpType === build.PortalQsmType.Flight && React__default.createElement(FlightsFlyIn, { isOpen: isOpen, setIsOpen: setIsOpen }),
38411
- (srpType === build.PortalQsmType.Accommodation || srpType === build.PortalQsmType.GroupTour) &&
38412
- React__default.createElement(AccommodationFlyIn, { isLoading: true, isOpen: isOpen, setIsOpen: setIsOpen })
38711
+ srpType === build.PortalQsmType.Accommodation &&
38712
+ React__default.createElement(AccommodationFlyIn, { isLoading: true, isOpen: isOpen, setIsOpen: setIsOpen }),
38713
+ srpType === build.PortalQsmType.GroupTour && React__default.createElement(GroupTourFlyIn, { isLoading: true, isOpen: isOpen, setIsOpen: setIsOpen })
38413
38714
  )
38414
38715
  );
38415
38716
  };
@@ -42720,7 +43021,7 @@ var getBaseHotelResult = function (searchResult, cmsItem, languageCode, translat
42720
43021
  searchResult.countryName,
42721
43022
  (_h = cmsItem === null || cmsItem === void 0 ? void 0 : cmsItem.parentItem) === null || _h === void 0 ? void 0 : _h.name
42722
43023
  ),
42723
- price: formatPrice$1(searchResult.price, searchResult.currencyCode, languageCode),
43024
+ price: formatPrice$2(searchResult.price, searchResult.currencyCode, languageCode),
42724
43025
  ctaText: translations === null || translations === void 0 ? void 0 : translations.SRP.VIEW_DETAILS
42725
43026
  };
42726
43027
  };
@@ -43479,7 +43780,7 @@ var PairedFlightOption = function (_a) {
43479
43780
  React__default.createElement(
43480
43781
  'span',
43481
43782
  { className: 'price' },
43482
- formatPrice$1(
43783
+ formatPrice$2(
43483
43784
  item.price,
43484
43785
  'EUR',
43485
43786
  (_c = context === null || context === void 0 ? void 0 : context.languageCode) !== null && _c !== void 0 ? _c : 'en-GB'
@@ -45709,9 +46010,9 @@ var GroupTourCard = function (_a) {
45709
46010
  languageCode = _a.languageCode,
45710
46011
  cmsItem = _a.cmsItem;
45711
46012
  var context = useContext(SearchResultsConfigurationContext);
45712
- var selectedSearchResultId = useSelector(function (state) {
46013
+ var selectedSearchResult = useSelector(function (state) {
45713
46014
  return state.searchResults;
45714
- }).selectedSearchResultId;
46015
+ }).selectedSearchResult;
45715
46016
  if (!context) {
45716
46017
  return;
45717
46018
  }
@@ -45727,9 +46028,8 @@ var GroupTourCard = function (_a) {
45727
46028
  var otherCount = genders.filter(function (g) {
45728
46029
  return g === 2;
45729
46030
  }).length;
45730
- var handleChange = function (productId) {
45731
- console.log('Selected product ID:', productId);
45732
- dispatch(setSelectedSearchResult(productId));
46031
+ var handleChange = function (result) {
46032
+ dispatch(setSelectedSearchResult(result));
45733
46033
  };
45734
46034
  return React__default.createElement(
45735
46035
  'div',
@@ -45844,7 +46144,7 @@ var GroupTourCard = function (_a) {
45844
46144
  React__default.createElement(
45845
46145
  'div',
45846
46146
  { className: 'search__result-card__allotment__price' },
45847
- formatPrice$1(result.price, result.currencyCode, languageCode),
46147
+ formatPrice$2(result.price, result.currencyCode, languageCode),
45848
46148
  ' ',
45849
46149
  translations.PRODUCT.PER_PERSON
45850
46150
  )
@@ -45853,23 +46153,12 @@ var GroupTourCard = function (_a) {
45853
46153
  'button',
45854
46154
  {
45855
46155
  type: 'button',
45856
- className: 'cta cta--select',
46156
+ className: 'cta '.concat(selectedSearchResult === result ? 'cta--selected' : 'cta--select'),
45857
46157
  onClick: function () {
45858
- return context.onBook && context.onBook(result);
46158
+ return handleChange(result);
45859
46159
  }
45860
46160
  },
45861
- translations === null || translations === void 0 ? void 0 : translations.PRODUCT.BOOK_NOW
45862
- ),
45863
- React__default.createElement(
45864
- 'button',
45865
- {
45866
- type: 'button',
45867
- className: 'cta '.concat(selectedSearchResultId === result.productId ? 'cta--selected' : 'cta--select'),
45868
- onClick: function () {
45869
- return handleChange(result.productId);
45870
- }
45871
- },
45872
- selectedSearchResultId === result.productId
46161
+ selectedSearchResult === result
45873
46162
  ? translations === null || translations === void 0
45874
46163
  ? void 0
45875
46164
  : translations.SHARED.SELECTED
@@ -46265,7 +46554,7 @@ var SearchResultsContainer = function () {
46265
46554
  isLoading = _b.isLoading,
46266
46555
  filters = _b.filters,
46267
46556
  selectedSortType = _b.selectedSortType,
46268
- selectedSearchResultId = _b.selectedSearchResultId,
46557
+ selectedSearchResult = _b.selectedSearchResult,
46269
46558
  selectedPackagingAccoResultCode = _b.selectedPackagingAccoResultCode,
46270
46559
  flyInIsOpen = _b.flyInIsOpen;
46271
46560
  var isMobile = useMediaQuery('(max-width: 1200px)');
@@ -46631,14 +46920,14 @@ var SearchResultsContainer = function () {
46631
46920
  var runSearch = function () {
46632
46921
  return __awaiter(void 0, void 0, void 0, function () {
46633
46922
  var config, params, entryId, entryLight, searchRequest, rq, packageSearchResults, enrichedFilters, initialFilteredResults, matching, err_1;
46634
- var _a, _b;
46635
- return __generator(this, function (_c) {
46636
- switch (_c.label) {
46923
+ var _a;
46924
+ return __generator(this, function (_b) {
46925
+ switch (_b.label) {
46637
46926
  case 0:
46638
46927
  dispatch(setIsLoading(true));
46639
- _c.label = 1;
46928
+ _b.label = 1;
46640
46929
  case 1:
46641
- _c.trys.push([1, 6, , 7]);
46930
+ _b.trys.push([1, 6, , 7]);
46642
46931
  if (!context) {
46643
46932
  return [2 /*return*/];
46644
46933
  }
@@ -46653,7 +46942,7 @@ var SearchResultsContainer = function () {
46653
46942
  if (!entryId) return [3 /*break*/, 3];
46654
46943
  return [4 /*yield*/, build.getEntryLight(config, entryId)];
46655
46944
  case 2:
46656
- entryLight = _c.sent();
46945
+ entryLight = _b.sent();
46657
46946
  // populate itinerary store
46658
46947
  dispatch(setEntry({ entry: entryLight }));
46659
46948
  searchRequest = buildSearchFromEntry(entryLight);
@@ -46664,11 +46953,11 @@ var SearchResultsContainer = function () {
46664
46953
  throw new Error('Invalid search parameters');
46665
46954
  }
46666
46955
  searchRequest = rq;
46667
- _c.label = 4;
46956
+ _b.label = 4;
46668
46957
  case 4:
46669
46958
  return [4 /*yield*/, build.search(config, searchRequest)];
46670
46959
  case 5:
46671
- packageSearchResults = _c.sent();
46960
+ packageSearchResults = _b.sent();
46672
46961
  console.log('Search results', packageSearchResults);
46673
46962
  enrichedFilters = enrichFiltersWithResults(packageSearchResults, context.filters, (_a = context.tags) !== null && _a !== void 0 ? _a : []);
46674
46963
  if (!initialFiltersSet) {
@@ -46685,18 +46974,18 @@ var SearchResultsContainer = function () {
46685
46974
  return r.productId === (entry === null || entry === void 0 ? void 0 : entry.id);
46686
46975
  });
46687
46976
  if (matching) {
46688
- dispatch(setSelectedSearchResult(matching.productId));
46977
+ dispatch(setSelectedSearchResult(matching));
46689
46978
  }
46690
46979
  } else {
46691
46980
  if (context.searchConfiguration.qsmType === build.PortalQsmType.AccommodationAndFlight) {
46692
- dispatch(setSelectedSearchResult((_b = packageSearchResults[0]) === null || _b === void 0 ? void 0 : _b.productId));
46981
+ dispatch(setSelectedSearchResult(packageSearchResults[0]));
46693
46982
  }
46694
46983
  }
46695
46984
  }
46696
46985
  dispatch(setIsLoading(false));
46697
46986
  return [3 /*break*/, 7];
46698
46987
  case 6:
46699
- err_1 = _c.sent();
46988
+ err_1 = _b.sent();
46700
46989
  console.error('Search failed', err_1);
46701
46990
  dispatch(setIsLoading(false));
46702
46991
  return [3 /*break*/, 7];
@@ -46795,8 +47084,8 @@ var SearchResultsContainer = function () {
46795
47084
  return __generator(this, function (_a) {
46796
47085
  switch (_a.label) {
46797
47086
  case 0:
46798
- console.log('Fetching details for selected search result', selectedSearchResultId);
46799
- if (!selectedSearchResultId || !context) return [2 /*return*/];
47087
+ console.log('Fetching details for selected search result', selectedSearchResult);
47088
+ if (!selectedSearchResult || !context) return [2 /*return*/];
46800
47089
  if (
46801
47090
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.Accommodation ||
46802
47091
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.GroupTour
@@ -46811,7 +47100,7 @@ var SearchResultsContainer = function () {
46811
47100
  apiKey: context.tideConnection.apiKey
46812
47101
  };
46813
47102
  selectedItem = results.find(function (r) {
46814
- return r.productId === selectedSearchResultId;
47103
+ return r.productId === selectedSearchResult.productId;
46815
47104
  });
46816
47105
  if (!selectedItem) {
46817
47106
  // TODO: handle this case better, show an error message to the user
@@ -46985,14 +47274,14 @@ var SearchResultsContainer = function () {
46985
47274
  });
46986
47275
  });
46987
47276
  };
46988
- if (selectedSearchResultId) {
47277
+ if (selectedSearchResult) {
46989
47278
  fetchDetails();
46990
47279
  }
46991
47280
  if (selectedPackagingAccoResultCode) {
46992
47281
  fetchPackagingAccoSearchDetails();
46993
47282
  }
46994
47283
  },
46995
- [selectedSearchResultId, selectedPackagingAccoResultCode]
47284
+ [selectedSearchResult, selectedPackagingAccoResultCode]
46996
47285
  );
46997
47286
  useEffect(
46998
47287
  function () {