@qite/tide-booking-component 1.4.84 → 1.4.86

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.
Files changed (39) hide show
  1. package/build/build-cjs/index.js +570 -288
  2. package/build/build-cjs/src/content/footer/types.d.ts +1 -0
  3. package/build/build-cjs/src/content/navbar/types.d.ts +1 -0
  4. package/build/build-cjs/src/qsm/components/item-picker/index.d.ts +4 -4
  5. package/build/build-cjs/src/qsm/store/qsm-slice.d.ts +5 -5
  6. package/build/build-cjs/src/qsm/types.d.ts +4 -9
  7. package/build/build-cjs/src/search-results/components/item-picker/index.d.ts +2 -2
  8. package/build/build-cjs/src/search-results/store/search-results-slice.d.ts +5 -0
  9. package/build/build-cjs/src/shared/types.d.ts +2 -7
  10. package/build/build-esm/index.js +570 -288
  11. package/build/build-esm/src/content/footer/types.d.ts +1 -0
  12. package/build/build-esm/src/content/navbar/types.d.ts +1 -0
  13. package/build/build-esm/src/qsm/components/item-picker/index.d.ts +4 -4
  14. package/build/build-esm/src/qsm/store/qsm-slice.d.ts +5 -5
  15. package/build/build-esm/src/qsm/types.d.ts +4 -9
  16. package/build/build-esm/src/search-results/components/item-picker/index.d.ts +2 -2
  17. package/build/build-esm/src/search-results/store/search-results-slice.d.ts +5 -0
  18. package/build/build-esm/src/shared/types.d.ts +2 -7
  19. package/package.json +2 -2
  20. package/src/content/features/content-page/content-page-self-contained.tsx +17 -17
  21. package/src/content/footer/index.tsx +4 -1
  22. package/src/content/footer/types.ts +1 -0
  23. package/src/content/navbar/index.tsx +17 -2
  24. package/src/content/navbar/types.ts +1 -0
  25. package/src/qsm/components/item-picker/index.tsx +10 -13
  26. package/src/qsm/components/travel-class-picker/index.tsx +3 -2
  27. package/src/qsm/components/travel-nationality-picker/index.tsx +3 -2
  28. package/src/qsm/components/travel-type-picker/index.tsx +3 -2
  29. package/src/qsm/store/qsm-slice.ts +5 -5
  30. package/src/qsm/types.ts +5 -10
  31. package/src/search-results/components/item-picker/index.tsx +2 -2
  32. package/src/search-results/components/search-results-container/flight-search-results.tsx +5 -5
  33. package/src/search-results/components/search-results-container/search-results-container.tsx +96 -4
  34. package/src/search-results/store/search-results-slice.ts +6 -0
  35. package/src/shared/components/flyin/accommodation-flyin.tsx +373 -157
  36. package/src/shared/types.ts +13 -7
  37. package/styles/components/_flyin.scss +187 -158
  38. package/styles/components/_footer.scss +1 -0
  39. package/styles/components/_navbar.scss +1 -0
@@ -13,7 +13,8 @@ import {
13
13
  setFlyInIsOpen,
14
14
  setFilteredResults,
15
15
  setPackagingAccoResults,
16
- setFilteredPackagingAccoResults
16
+ setFilteredPackagingAccoResults,
17
+ setPackagingAccoSearchDetails
17
18
  } from '../../store/search-results-slice';
18
19
  import { Filter, SortByType } from '../../types';
19
20
  import useMediaQuery from '../../../shared/utils/use-media-query-util';
@@ -575,8 +576,8 @@ const SearchResultsContainer: React.FC = () => {
575
576
 
576
577
  // Seperate detailsCall
577
578
  useEffect(() => {
578
- const fetchPackageDetails = async () => {
579
- if ((!selectedSearchResultId && !selectedPackagingAccoResultCode) || !context) return;
579
+ const fetchDetails = async () => {
580
+ if (!selectedSearchResultId || !context) return;
580
581
 
581
582
  if (context?.searchConfiguration.qsmType === PortalQsmType.Accommodation || context?.searchConfiguration.qsmType === PortalQsmType.GroupTour) {
582
583
  handleFlyInToggle(true);
@@ -641,7 +642,98 @@ const SearchResultsContainer: React.FC = () => {
641
642
  }
642
643
  };
643
644
 
644
- fetchPackageDetails();
645
+ const fetchPackagingAccoSearchDetails = async () => {
646
+ if (!selectedPackagingAccoResultCode || !context) return;
647
+
648
+ if (context?.searchConfiguration.qsmType === PortalQsmType.Accommodation || context?.searchConfiguration.qsmType === PortalQsmType.GroupTour) {
649
+ handleFlyInToggle(true);
650
+ }
651
+
652
+ try {
653
+ const config: TideClientConfig = {
654
+ host: context.tideConnection.host,
655
+ apiKey: context.tideConnection.apiKey
656
+ };
657
+
658
+ console.log('selectedPackagingAccoResultCode', selectedPackagingAccoResultCode);
659
+ const selectedItem = packagingAccoResults.find((r) => r.code === selectedPackagingAccoResultCode);
660
+ console.log('Selected packaging acco item', selectedItem);
661
+ if (!selectedItem) {
662
+ // TODO: handle this case better, show an error message to the user
663
+ return;
664
+ }
665
+
666
+ const params = new URLSearchParams(location.search);
667
+ const rooms = getRoomsFromParams(params, 'rooms');
668
+ let tagId = getNumberFromParams(params, 'tagId');
669
+ let agentId = getNumberFromParams(params, 'agentId');
670
+
671
+ let destinationAirport = getStringFromParams(params, 'destinationAirport');
672
+
673
+ let destinationId: number | null = null;
674
+ let destinationIsCountry = false;
675
+ let destinationIsRegion = false;
676
+ let destinationIsOord = false;
677
+ let destinationIsLocation = false;
678
+ let destinationCode: string | null = null;
679
+ let destinationIsAirport = false;
680
+
681
+ if (selectedItem.countryId) {
682
+ destinationId = selectedItem.countryId;
683
+ destinationIsCountry = true;
684
+ } else if (selectedItem.regionId) {
685
+ destinationId = selectedItem.regionId;
686
+ destinationIsRegion = true;
687
+ } else if (selectedItem.oordId) {
688
+ destinationId = selectedItem.oordId;
689
+ destinationIsOord = true;
690
+ } else if (selectedItem.locationId) {
691
+ destinationId = selectedItem.locationId;
692
+ destinationIsLocation = true;
693
+ } else if (destinationAirport) {
694
+ destinationCode = destinationAirport;
695
+ destinationIsAirport = true;
696
+ }
697
+
698
+ const detailSearchRequest: PackagingAccommodationRequest = {
699
+ officeId: 1,
700
+ portalId: context.portalId,
701
+ agentId: agentId ?? null,
702
+ catalogueId: context!.searchConfiguration.defaultCatalogueId ?? 0,
703
+ searchConfigurationId: context!.searchConfiguration.id,
704
+ vendorConfigurationId: selectedItem.vendorId,
705
+ language: context!.languageCode ?? 'en-GB',
706
+ serviceType: 3,
707
+ fromDate: selectedItem.fromDate,
708
+ toDate: selectedItem.toDate,
709
+ destination: {
710
+ id: Number(destinationId),
711
+ isCountry: destinationIsCountry,
712
+ isRegion: destinationIsRegion,
713
+ isOord: destinationIsOord,
714
+ isLocation: destinationIsLocation,
715
+ isAirport: destinationIsAirport,
716
+ code: destinationCode
717
+ } as PackagingDestination,
718
+ productCode: selectedItem.code ? selectedItem.code : '',
719
+ rooms: getPackagingRequestRooms(rooms),
720
+ tagIds: tagId ? [tagId] : []
721
+ };
722
+
723
+ const packageAccoSearchDetails = await searchPackagingAccommodations(config, detailSearchRequest);
724
+ console.log('Packaging Acco Search details', packageAccoSearchDetails);
725
+ dispatch(setPackagingAccoSearchDetails(packageAccoSearchDetails));
726
+ } catch (err) {
727
+ console.error('Failed to fetch package details', err);
728
+ }
729
+ };
730
+
731
+ if (selectedSearchResultId) {
732
+ fetchDetails();
733
+ }
734
+ if (selectedPackagingAccoResultCode) {
735
+ fetchPackagingAccoSearchDetails();
736
+ }
645
737
  }, [selectedSearchResultId, selectedPackagingAccoResultCode]);
646
738
 
647
739
  useEffect(() => {
@@ -8,6 +8,7 @@ export interface SearchResultsState {
8
8
  selectedSearchResultId: number | null;
9
9
  packagingAccoResults: PackagingAccommodationResponse[];
10
10
  filteredPackagingAccoResults: PackagingAccommodationResponse[];
11
+ packagingAccoSearchDetails: PackagingAccommodationResponse[];
11
12
  selectedPackagingAccoResultCode: string | null;
12
13
  selectedFlight: ExtendedFlightSearchResponseItem | null;
13
14
  selectedFlightDetails: ExtendedFlightSearchResponseItem | null;
@@ -27,6 +28,7 @@ const initialState: SearchResultsState = {
27
28
  selectedSearchResultId: null,
28
29
  packagingAccoResults: [],
29
30
  filteredPackagingAccoResults: [],
31
+ packagingAccoSearchDetails: [],
30
32
  selectedPackagingAccoResultCode: null,
31
33
  selectedFlight: null,
32
34
  selectedFlightDetails: null,
@@ -59,6 +61,9 @@ const searchResultsSlice = createSlice({
59
61
  setFilteredPackagingAccoResults(state, action: PayloadAction<PackagingAccommodationResponse[]>) {
60
62
  state.filteredPackagingAccoResults = action.payload;
61
63
  },
64
+ setPackagingAccoSearchDetails(state, action: PayloadAction<PackagingAccommodationResponse[]>) {
65
+ state.packagingAccoSearchDetails = action.payload;
66
+ },
62
67
  setSelectedPackagingAccoResult(state, action: PayloadAction<string | null>) {
63
68
  state.selectedPackagingAccoResultCode = action.payload;
64
69
  },
@@ -133,6 +138,7 @@ export const {
133
138
  setSelectedSearchResult,
134
139
  setPackagingAccoResults,
135
140
  setFilteredPackagingAccoResults,
141
+ setPackagingAccoSearchDetails,
136
142
  setSelectedPackagingAccoResult,
137
143
  setSelectedFlight,
138
144
  setSelectedFlightDetails,