@qite/tide-booking-component 1.4.87 → 1.4.89

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,316 @@ 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, _c;
38341
+ var isLoading = _a.isLoading,
38342
+ isOpen = _a.isOpen,
38343
+ setIsOpen = _a.setIsOpen;
38344
+ var dispatch = useDispatch();
38345
+ var context = useContext(SearchResultsConfigurationContext);
38346
+ if (isLoading) {
38347
+ return React__default.createElement(
38348
+ React__default.Fragment,
38349
+ null,
38350
+ (_b = context === null || context === void 0 ? void 0 : context.customSpinner) !== null && _b !== void 0
38351
+ ? _b
38352
+ : React__default.createElement(Spinner, null)
38353
+ );
38354
+ }
38355
+ var language = (_c = context === null || context === void 0 ? void 0 : context.languageCode) !== null && _c !== void 0 ? _c : 'en-GB';
38356
+ var translations = getTranslations(language);
38357
+ var bookingPackageDetails = useSelector(function (state) {
38358
+ return state.searchResults;
38359
+ }).bookingPackageDetails;
38360
+ var selectedBookingPackageDetails = useMemo(
38361
+ function () {
38362
+ var _a;
38363
+ return (_a = bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.options) === null || _a === void 0
38364
+ ? void 0
38365
+ : _a.find(function (x) {
38366
+ return x.isSelected;
38367
+ });
38368
+ },
38369
+ [bookingPackageDetails]
38370
+ );
38371
+ var groupedRooms = useMemo(
38372
+ function () {
38373
+ if (!(selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms)) return [];
38374
+ return selectedBookingPackageDetails.rooms.map(function (room) {
38375
+ var groupedMap = new Map();
38376
+ room.options.forEach(function (option) {
38377
+ var _a, _b;
38378
+ var key = option.accommodationCode;
38379
+ if (!groupedMap.has(key)) {
38380
+ groupedMap.set(key, {
38381
+ accommodationCode: option.accommodationCode,
38382
+ accommodationName: option.accommodationName,
38383
+ regimes: []
38384
+ });
38385
+ }
38386
+ (_a = groupedMap.get(key)) === null || _a === void 0
38387
+ ? void 0
38388
+ : _a.regimes.push({
38389
+ id: option.entryLineGuid,
38390
+ label: (_b = option.regimeName) !== null && _b !== void 0 ? _b : 'No regime'
38391
+ });
38392
+ });
38393
+ return Array.from(groupedMap.values());
38394
+ });
38395
+ },
38396
+ [selectedBookingPackageDetails]
38397
+ );
38398
+ if (!bookingPackageDetails) {
38399
+ return null;
38400
+ }
38401
+ var getSelectedOptionForRoom = function (roomIndex) {
38402
+ var _a, _b, _c;
38403
+ return (_c =
38404
+ (_b =
38405
+ (_a = selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms) === null ||
38406
+ _a === void 0
38407
+ ? void 0
38408
+ : _a[roomIndex]) === null || _b === void 0
38409
+ ? void 0
38410
+ : _b.options) === null || _c === void 0
38411
+ ? void 0
38412
+ : _c.find(function (option) {
38413
+ return option.isSelected;
38414
+ });
38415
+ };
38416
+ var getSelectedOptionForAccommodation = function (roomIndex, accommodationCode) {
38417
+ var _a, _b, _c;
38418
+ return (_c =
38419
+ (_b =
38420
+ (_a = selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0 ? void 0 : selectedBookingPackageDetails.rooms) === null ||
38421
+ _a === void 0
38422
+ ? void 0
38423
+ : _a[roomIndex]) === null || _b === void 0
38424
+ ? void 0
38425
+ : _b.options) === null || _c === void 0
38426
+ ? void 0
38427
+ : _c.find(function (option) {
38428
+ return option.accommodationCode === accommodationCode && option.isSelected;
38429
+ });
38430
+ };
38431
+ var handlePick = function (roomIndex, selectedGuid) {
38432
+ if (!bookingPackageDetails || !selectedBookingPackageDetails) return;
38433
+ var updatedBookingPackageDetails = __assign(__assign({}, bookingPackageDetails), {
38434
+ options: bookingPackageDetails.options.map(function (bookingOption) {
38435
+ if (!bookingOption.isSelected) {
38436
+ return bookingOption;
38437
+ }
38438
+ return __assign(__assign({}, bookingOption), {
38439
+ rooms: bookingOption.rooms.map(function (room, currentRoomIndex) {
38440
+ if (currentRoomIndex !== roomIndex) {
38441
+ return room;
38442
+ }
38443
+ return __assign(__assign({}, room), {
38444
+ options: room.options.map(function (roomOption) {
38445
+ return __assign(__assign({}, roomOption), { isSelected: roomOption.entryLineGuid === selectedGuid });
38446
+ })
38447
+ });
38448
+ })
38449
+ });
38450
+ })
38451
+ });
38452
+ dispatch(setBookingPackageDetails({ details: updatedBookingPackageDetails }));
38453
+ };
38454
+ var handleConfirm = function () {
38455
+ if (isOpen) {
38456
+ setIsOpen(false);
38457
+ }
38458
+ console.log('Booking package details sent to onBook callback:', bookingPackageDetails);
38459
+ if (context === null || context === void 0 ? void 0 : context.onBook) {
38460
+ context.onBook(bookingPackageDetails);
38461
+ }
38462
+ };
38463
+ var calculateTotalPrice = function () {
38464
+ var selectedOptions =
38465
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38466
+ ? void 0
38467
+ : selectedBookingPackageDetails.rooms.flatMap(function (room) {
38468
+ return room.options.filter(function (option) {
38469
+ return option.isSelected;
38470
+ });
38471
+ });
38472
+ var totalPrice =
38473
+ selectedOptions === null || selectedOptions === void 0
38474
+ ? void 0
38475
+ : selectedOptions.reduce(function (total, option) {
38476
+ return total + (option.price || 0);
38477
+ }, 0);
38478
+ return formatPrice(totalPrice, bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.currencyCode);
38479
+ };
38480
+ var getPriceDifference = function (currentSelectedPrice, roomIndex, accommodationCode, regimeId) {
38481
+ var targetPrice = 0;
38482
+ var selectedOption = getSelectedOptionForAccommodation(roomIndex, accommodationCode);
38483
+ if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.price) {
38484
+ targetPrice = selectedOption.price;
38485
+ } else {
38486
+ var firstOption =
38487
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38488
+ ? void 0
38489
+ : selectedBookingPackageDetails.rooms[roomIndex].options.find(function (option) {
38490
+ return option.accommodationCode === accommodationCode;
38491
+ });
38492
+ targetPrice = (firstOption === null || firstOption === void 0 ? void 0 : firstOption.price) || 0;
38493
+ }
38494
+ if (regimeId) {
38495
+ var regimeOption =
38496
+ selectedBookingPackageDetails === null || selectedBookingPackageDetails === void 0
38497
+ ? void 0
38498
+ : selectedBookingPackageDetails.rooms[roomIndex].options.find(function (option) {
38499
+ return option.entryLineGuid === regimeId;
38500
+ });
38501
+ targetPrice = (regimeOption === null || regimeOption === void 0 ? void 0 : regimeOption.price) || 0;
38502
+ }
38503
+ return targetPrice - (currentSelectedPrice || 0);
38504
+ };
38505
+ var formatPriceDifference = function (difference, currencyCode) {
38506
+ if (difference === 0) {
38507
+ return null;
38508
+ }
38509
+ var formattedAbsoluteValue = formatPrice(Math.abs(difference), currencyCode);
38510
+ return ''.concat(difference > 0 ? '+' : '-', ' ').concat(formattedAbsoluteValue);
38511
+ };
38512
+ var getPriceDifferenceClassName = function (difference) {
38513
+ if (difference < 0) {
38514
+ return 'flyin__acco__price flyin__acco__price--decrease';
38515
+ }
38516
+ if (difference > 0) {
38517
+ return 'flyin__acco__price flyin__acco__price--increase';
38518
+ }
38519
+ return 'flyin__acco__price';
38520
+ };
38521
+ var regimeFormatter = function (roomIndex, accommodation, regimeId, label) {
38522
+ var roomOption = getSelectedOptionForRoom(roomIndex);
38523
+ var difference = getPriceDifference(
38524
+ roomOption === null || roomOption === void 0 ? void 0 : roomOption.price,
38525
+ roomIndex,
38526
+ accommodation.accommodationCode,
38527
+ regimeId
38528
+ );
38529
+ return ''.concat(label, ' ').concat(difference !== 0 ? '('.concat(formatPriceDifference(difference, bookingPackageDetails.currencyCode), ')') : '');
38530
+ };
38531
+ return React__default.createElement(
38532
+ React__default.Fragment,
38533
+ null,
38534
+ React__default.createElement(
38535
+ 'div',
38536
+ { className: 'flyin__content' },
38537
+ groupedRooms.map(function (roomAccommodations, roomIndex) {
38538
+ var selectedRoomOption = getSelectedOptionForRoom(roomIndex);
38539
+ return React__default.createElement(
38540
+ 'div',
38541
+ { className: 'flyin__acco', key: 'room-'.concat(roomIndex) },
38542
+ React__default.createElement('h3', { className: 'flyin__acco__room-title' }, 'Room ', roomIndex + 1),
38543
+ React__default.createElement(
38544
+ 'div',
38545
+ { className: 'flyin__acco__cards' },
38546
+ roomAccommodations.map(function (accommodation) {
38547
+ var _a;
38548
+ var selectedOption = getSelectedOptionForAccommodation(roomIndex, accommodation.accommodationCode);
38549
+ var priceDifference = getPriceDifference(
38550
+ selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.price,
38551
+ roomIndex,
38552
+ accommodation.accommodationCode
38553
+ );
38554
+ return React__default.createElement(
38555
+ 'div',
38556
+ { className: 'flyin__acco__card', key: ''.concat(roomIndex, '-').concat(accommodation.accommodationCode) },
38557
+ React__default.createElement(
38558
+ 'div',
38559
+ { className: 'flyin__acco__content' },
38560
+ React__default.createElement('h4', { className: 'flyin__acco__title' }, accommodation.accommodationName)
38561
+ ),
38562
+ React__default.createElement(
38563
+ 'div',
38564
+ { className: 'flyin__acco__footer' },
38565
+ React__default.createElement(ItemPicker$1, {
38566
+ items: accommodation.regimes,
38567
+ selection: selectedOption != null ? ((_a = selectedOption.regimeName) !== null && _a !== void 0 ? _a : 'No regime') : undefined,
38568
+ label: '',
38569
+ placeholder: 'Select regime',
38570
+ classModifier: '',
38571
+ onPick: function (selected, selectedGuid) {
38572
+ return handlePick(roomIndex, selectedGuid);
38573
+ },
38574
+ valueFormatter: function (id, label) {
38575
+ return regimeFormatter(roomIndex, accommodation, id, label);
38576
+ }
38577
+ }),
38578
+ React__default.createElement(
38579
+ 'div',
38580
+ { className: 'flyin__acco__footer__actions' },
38581
+ React__default.createElement(
38582
+ 'button',
38583
+ {
38584
+ className:
38585
+ (selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.accommodationCode) ==
38586
+ accommodation.accommodationCode
38587
+ ? 'cta cta--select cta--selected'
38588
+ : 'cta cta--select',
38589
+ onClick: function () {
38590
+ var _a;
38591
+ handlePick(
38592
+ roomIndex,
38593
+ selectedOption ? selectedOption.entryLineGuid : (_a = first(accommodation.regimes)) === null || _a === void 0 ? void 0 : _a.id
38594
+ );
38595
+ }
38596
+ },
38597
+ (selectedRoomOption === null || selectedRoomOption === void 0 ? void 0 : selectedRoomOption.accommodationCode) ==
38598
+ accommodation.accommodationCode
38599
+ ? translations === null || translations === void 0
38600
+ ? void 0
38601
+ : translations.SHARED.SELECTED
38602
+ : translations === null || translations === void 0
38603
+ ? void 0
38604
+ : translations.SHARED.SELECT
38605
+ ),
38606
+ React__default.createElement(
38607
+ 'div',
38608
+ { className: 'flyin__acco__price__wrapper' },
38609
+ React__default.createElement(
38610
+ 'span',
38611
+ { className: getPriceDifferenceClassName(priceDifference) },
38612
+ formatPriceDifference(
38613
+ priceDifference,
38614
+ bookingPackageDetails === null || bookingPackageDetails === void 0 ? void 0 : bookingPackageDetails.currencyCode
38615
+ )
38616
+ )
38617
+ )
38618
+ )
38619
+ )
38620
+ );
38621
+ })
38622
+ )
38623
+ );
38624
+ })
38625
+ ),
38626
+ React__default.createElement(
38627
+ 'div',
38628
+ { className: 'flyin__footer' },
38629
+ React__default.createElement('div', { className: 'flyin__footer__price' }, 'Total price: ', calculateTotalPrice()),
38630
+ React__default.createElement(
38631
+ 'div',
38632
+ { className: 'flyin__button-wrapper' },
38633
+ React__default.createElement('button', { className: 'cta cta--select', onClick: handleConfirm }, translations.PRODUCT.BOOK_NOW)
38634
+ )
38635
+ )
38636
+ );
38637
+ };
38638
+
38329
38639
  var FlyIn = function (_a) {
38330
38640
  var title = _a.title,
38331
38641
  srpType = _a.srpType,
@@ -38333,7 +38643,8 @@ var FlyIn = function (_a) {
38333
38643
  setIsOpen = _a.setIsOpen,
38334
38644
  _b = _a.className,
38335
38645
  className = _b === void 0 ? '' : _b,
38336
- onPanelRef = _a.onPanelRef;
38646
+ onPanelRef = _a.onPanelRef,
38647
+ detailsLoading = _a.detailsLoading;
38337
38648
  var dispatch = useDispatch();
38338
38649
  var onCancelSearch = useFlightSearch().onCancelSearch;
38339
38650
  var panelRef = useRef(null);
@@ -38408,8 +38719,10 @@ var FlyIn = function (_a) {
38408
38719
  )
38409
38720
  ),
38410
38721
  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 })
38722
+ srpType === build.PortalQsmType.Accommodation &&
38723
+ React__default.createElement(AccommodationFlyIn, { isLoading: true, isOpen: isOpen, setIsOpen: setIsOpen }),
38724
+ srpType === build.PortalQsmType.GroupTour &&
38725
+ React__default.createElement(GroupTourFlyIn, { isLoading: detailsLoading, isOpen: isOpen, setIsOpen: setIsOpen })
38413
38726
  )
38414
38727
  );
38415
38728
  };
@@ -42720,7 +43033,7 @@ var getBaseHotelResult = function (searchResult, cmsItem, languageCode, translat
42720
43033
  searchResult.countryName,
42721
43034
  (_h = cmsItem === null || cmsItem === void 0 ? void 0 : cmsItem.parentItem) === null || _h === void 0 ? void 0 : _h.name
42722
43035
  ),
42723
- price: formatPrice$1(searchResult.price, searchResult.currencyCode, languageCode),
43036
+ price: formatPrice$2(searchResult.price, searchResult.currencyCode, languageCode),
42724
43037
  ctaText: translations === null || translations === void 0 ? void 0 : translations.SRP.VIEW_DETAILS
42725
43038
  };
42726
43039
  };
@@ -43479,7 +43792,7 @@ var PairedFlightOption = function (_a) {
43479
43792
  React__default.createElement(
43480
43793
  'span',
43481
43794
  { className: 'price' },
43482
- formatPrice$1(
43795
+ formatPrice$2(
43483
43796
  item.price,
43484
43797
  'EUR',
43485
43798
  (_c = context === null || context === void 0 ? void 0 : context.languageCode) !== null && _c !== void 0 ? _c : 'en-GB'
@@ -45709,9 +46022,9 @@ var GroupTourCard = function (_a) {
45709
46022
  languageCode = _a.languageCode,
45710
46023
  cmsItem = _a.cmsItem;
45711
46024
  var context = useContext(SearchResultsConfigurationContext);
45712
- var selectedSearchResultId = useSelector(function (state) {
46025
+ var selectedSearchResult = useSelector(function (state) {
45713
46026
  return state.searchResults;
45714
- }).selectedSearchResultId;
46027
+ }).selectedSearchResult;
45715
46028
  if (!context) {
45716
46029
  return;
45717
46030
  }
@@ -45727,9 +46040,8 @@ var GroupTourCard = function (_a) {
45727
46040
  var otherCount = genders.filter(function (g) {
45728
46041
  return g === 2;
45729
46042
  }).length;
45730
- var handleChange = function (productId) {
45731
- console.log('Selected product ID:', productId);
45732
- dispatch(setSelectedSearchResult(productId));
46043
+ var handleChange = function (result) {
46044
+ dispatch(setSelectedSearchResult(result));
45733
46045
  };
45734
46046
  return React__default.createElement(
45735
46047
  'div',
@@ -45844,7 +46156,7 @@ var GroupTourCard = function (_a) {
45844
46156
  React__default.createElement(
45845
46157
  'div',
45846
46158
  { className: 'search__result-card__allotment__price' },
45847
- formatPrice$1(result.price, result.currencyCode, languageCode),
46159
+ formatPrice$2(result.price, result.currencyCode, languageCode),
45848
46160
  ' ',
45849
46161
  translations.PRODUCT.PER_PERSON
45850
46162
  )
@@ -45853,23 +46165,12 @@ var GroupTourCard = function (_a) {
45853
46165
  'button',
45854
46166
  {
45855
46167
  type: 'button',
45856
- className: 'cta cta--select',
46168
+ className: 'cta '.concat(selectedSearchResult === result ? 'cta--selected' : 'cta--select'),
45857
46169
  onClick: function () {
45858
- return context.onBook && context.onBook(result);
46170
+ return handleChange(result);
45859
46171
  }
45860
46172
  },
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
46173
+ selectedSearchResult === result
45873
46174
  ? translations === null || translations === void 0
45874
46175
  ? void 0
45875
46176
  : translations.SHARED.SELECTED
@@ -46265,7 +46566,7 @@ var SearchResultsContainer = function () {
46265
46566
  isLoading = _b.isLoading,
46266
46567
  filters = _b.filters,
46267
46568
  selectedSortType = _b.selectedSortType,
46268
- selectedSearchResultId = _b.selectedSearchResultId,
46569
+ selectedSearchResult = _b.selectedSearchResult,
46269
46570
  selectedPackagingAccoResultCode = _b.selectedPackagingAccoResultCode,
46270
46571
  flyInIsOpen = _b.flyInIsOpen;
46271
46572
  var isMobile = useMediaQuery('(max-width: 1200px)');
@@ -46279,8 +46580,11 @@ var SearchResultsContainer = function () {
46279
46580
  filtersOpen = _e[0],
46280
46581
  setFiltersOpen = _e[1];
46281
46582
  var _f = useState(false),
46282
- itineraryOpen = _f[0],
46283
- setItineraryOpen = _f[1];
46583
+ detailsIsLoading = _f[0],
46584
+ setDetailsIsLoading = _f[1];
46585
+ var _g = useState(false),
46586
+ itineraryOpen = _g[0],
46587
+ setItineraryOpen = _g[1];
46284
46588
  var panelRef = useRef(null);
46285
46589
  var sortByTypes = [
46286
46590
  { direction: 'asc', label: 'default' },
@@ -46631,14 +46935,14 @@ var SearchResultsContainer = function () {
46631
46935
  var runSearch = function () {
46632
46936
  return __awaiter(void 0, void 0, void 0, function () {
46633
46937
  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) {
46938
+ var _a;
46939
+ return __generator(this, function (_b) {
46940
+ switch (_b.label) {
46637
46941
  case 0:
46638
46942
  dispatch(setIsLoading(true));
46639
- _c.label = 1;
46943
+ _b.label = 1;
46640
46944
  case 1:
46641
- _c.trys.push([1, 6, , 7]);
46945
+ _b.trys.push([1, 6, , 7]);
46642
46946
  if (!context) {
46643
46947
  return [2 /*return*/];
46644
46948
  }
@@ -46653,7 +46957,7 @@ var SearchResultsContainer = function () {
46653
46957
  if (!entryId) return [3 /*break*/, 3];
46654
46958
  return [4 /*yield*/, build.getEntryLight(config, entryId)];
46655
46959
  case 2:
46656
- entryLight = _c.sent();
46960
+ entryLight = _b.sent();
46657
46961
  // populate itinerary store
46658
46962
  dispatch(setEntry({ entry: entryLight }));
46659
46963
  searchRequest = buildSearchFromEntry(entryLight);
@@ -46664,11 +46968,11 @@ var SearchResultsContainer = function () {
46664
46968
  throw new Error('Invalid search parameters');
46665
46969
  }
46666
46970
  searchRequest = rq;
46667
- _c.label = 4;
46971
+ _b.label = 4;
46668
46972
  case 4:
46669
46973
  return [4 /*yield*/, build.search(config, searchRequest)];
46670
46974
  case 5:
46671
- packageSearchResults = _c.sent();
46975
+ packageSearchResults = _b.sent();
46672
46976
  console.log('Search results', packageSearchResults);
46673
46977
  enrichedFilters = enrichFiltersWithResults(packageSearchResults, context.filters, (_a = context.tags) !== null && _a !== void 0 ? _a : []);
46674
46978
  if (!initialFiltersSet) {
@@ -46685,18 +46989,18 @@ var SearchResultsContainer = function () {
46685
46989
  return r.productId === (entry === null || entry === void 0 ? void 0 : entry.id);
46686
46990
  });
46687
46991
  if (matching) {
46688
- dispatch(setSelectedSearchResult(matching.productId));
46992
+ dispatch(setSelectedSearchResult(matching));
46689
46993
  }
46690
46994
  } else {
46691
46995
  if (context.searchConfiguration.qsmType === build.PortalQsmType.AccommodationAndFlight) {
46692
- dispatch(setSelectedSearchResult((_b = packageSearchResults[0]) === null || _b === void 0 ? void 0 : _b.productId));
46996
+ dispatch(setSelectedSearchResult(packageSearchResults[0]));
46693
46997
  }
46694
46998
  }
46695
46999
  }
46696
47000
  dispatch(setIsLoading(false));
46697
47001
  return [3 /*break*/, 7];
46698
47002
  case 6:
46699
- err_1 = _c.sent();
47003
+ err_1 = _b.sent();
46700
47004
  console.error('Search failed', err_1);
46701
47005
  dispatch(setIsLoading(false));
46702
47006
  return [3 /*break*/, 7];
@@ -46795,8 +47099,9 @@ var SearchResultsContainer = function () {
46795
47099
  return __generator(this, function (_a) {
46796
47100
  switch (_a.label) {
46797
47101
  case 0:
46798
- console.log('Fetching details for selected search result', selectedSearchResultId);
46799
- if (!selectedSearchResultId || !context) return [2 /*return*/];
47102
+ setDetailsIsLoading(true);
47103
+ console.log('Fetching details for selected search result', selectedSearchResult);
47104
+ if (!selectedSearchResult || !context) return [2 /*return*/];
46800
47105
  if (
46801
47106
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.Accommodation ||
46802
47107
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.GroupTour
@@ -46811,7 +47116,7 @@ var SearchResultsContainer = function () {
46811
47116
  apiKey: context.tideConnection.apiKey
46812
47117
  };
46813
47118
  selectedItem = results.find(function (r) {
46814
- return r.productId === selectedSearchResultId;
47119
+ return r.productId === selectedSearchResult.productId;
46815
47120
  });
46816
47121
  if (!selectedItem) {
46817
47122
  // TODO: handle this case better, show an error message to the user
@@ -46858,12 +47163,14 @@ var SearchResultsContainer = function () {
46858
47163
  case 4:
46859
47164
  detailsResponse = _a.sent();
46860
47165
  dispatch(setBookingPackageDetails({ details: detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.payload }));
47166
+ setDetailsIsLoading(false);
46861
47167
  _a.label = 5;
46862
47168
  case 5:
46863
47169
  return [3 /*break*/, 7];
46864
47170
  case 6:
46865
47171
  err_3 = _a.sent();
46866
47172
  console.error('Failed to fetch package details', err_3);
47173
+ setDetailsIsLoading(false);
46867
47174
  return [3 /*break*/, 7];
46868
47175
  case 7:
46869
47176
  return [2 /*return*/];
@@ -46985,14 +47292,14 @@ var SearchResultsContainer = function () {
46985
47292
  });
46986
47293
  });
46987
47294
  };
46988
- if (selectedSearchResultId) {
47295
+ if (selectedSearchResult) {
46989
47296
  fetchDetails();
46990
47297
  }
46991
47298
  if (selectedPackagingAccoResultCode) {
46992
47299
  fetchPackagingAccoSearchDetails();
46993
47300
  }
46994
47301
  },
46995
- [selectedSearchResultId, selectedPackagingAccoResultCode]
47302
+ [selectedSearchResult, selectedPackagingAccoResultCode]
46996
47303
  );
46997
47304
  useEffect(
46998
47305
  function () {
@@ -47028,7 +47335,8 @@ var SearchResultsContainer = function () {
47028
47335
  setIsOpen: handleFlyInToggle,
47029
47336
  onPanelRef: function (el) {
47030
47337
  return (panelRef.current = el);
47031
- }
47338
+ },
47339
+ detailsLoading: detailsIsLoading
47032
47340
  })
47033
47341
  ),
47034
47342
  (context.searchConfiguration.qsmType === build.PortalQsmType.AccommodationAndFlight ||
@@ -47192,7 +47500,8 @@ var SearchResultsContainer = function () {
47192
47500
  setIsOpen: handleFlyInToggle,
47193
47501
  onPanelRef: function (el) {
47194
47502
  return (panelRef.current = el);
47195
- }
47503
+ },
47504
+ detailsLoading: detailsIsLoading
47196
47505
  })
47197
47506
  )
47198
47507
  )