@qite/tide-booking-component 1.4.78 → 1.4.80

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 (28) hide show
  1. package/build/build-cjs/index.js +771 -473
  2. package/build/build-cjs/src/qsm/types.d.ts +2 -0
  3. package/build/build-cjs/src/search-results/store/search-results-slice.d.ts +10 -1
  4. package/build/build-cjs/src/search-results/types.d.ts +5 -4
  5. package/build/build-cjs/src/search-results/utils/search-results-utils.d.ts +9 -2
  6. package/build/build-esm/index.js +769 -438
  7. package/build/build-esm/src/qsm/types.d.ts +2 -0
  8. package/build/build-esm/src/search-results/store/search-results-slice.d.ts +10 -1
  9. package/build/build-esm/src/search-results/types.d.ts +5 -4
  10. package/build/build-esm/src/search-results/utils/search-results-utils.d.ts +9 -2
  11. package/package.json +2 -2
  12. package/src/booking-wizard/features/price-details/selectors.ts +1 -1
  13. package/src/content/features/content-page/content-page-self-contained.tsx +4 -4
  14. package/src/qsm/components/QSMContainer/qsm-container.tsx +9 -0
  15. package/src/search-results/components/hotel/hotel-accommodation-results.tsx +97 -99
  16. package/src/search-results/components/hotel/hotel-card.tsx +29 -7
  17. package/src/search-results/components/search-results-container/flight-search-results.tsx +2 -2
  18. package/src/search-results/components/search-results-container/search-results-container.tsx +191 -40
  19. package/src/search-results/features/flights/flight-search-results-self-contained.tsx +21 -2
  20. package/src/search-results/features/hotels/hotel-flight-search-results-self-contained.tsx +21 -2
  21. package/src/search-results/features/hotels/hotel-search-results-self-contained.tsx +21 -2
  22. package/src/search-results/features/roundtrips/roundtrip-search-results-self-contained.tsx +21 -2
  23. package/src/search-results/store/search-results-slice.ts +19 -1
  24. package/src/search-results/types.ts +5 -5
  25. package/src/search-results/utils/search-results-utils.ts +185 -2
  26. package/build/build-cjs/src/search-results/components/filters/utility.d.ts +0 -3
  27. package/build/build-esm/src/search-results/components/filters/utility.d.ts +0 -3
  28. package/src/search-results/components/filters/utility.tsx +0 -79
@@ -1,7 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { PortalQsmType, TravelClass, TravelType } from '../shared/types';
3
+ import { WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
3
4
  export interface QSMConfiguration {
4
5
  type?: PortalQsmType;
6
+ searchConfigurations: WebsiteConfigurationSearchConfiguration[];
5
7
  askRooms?: boolean;
6
8
  askTravelType?: boolean;
7
9
  allowOneWay?: boolean;
@@ -1,9 +1,12 @@
1
1
  import { ExtendedFlightSearchResponseItem, Filter } from '../types';
2
- import { BookingPackage, BookingPackageItem, EntryLight } from '@qite/tide-client/build/types';
2
+ import { BookingPackage, BookingPackageItem, EntryLight, PackagingAccommodationResponse } from '@qite/tide-client/build/types';
3
3
  export interface SearchResultsState {
4
4
  results: BookingPackageItem[];
5
5
  filteredResults: BookingPackageItem[];
6
6
  selectedSearchResultId: number | null;
7
+ packagingAccoResults: PackagingAccommodationResponse[];
8
+ filteredPackagingAccoResults: PackagingAccommodationResponse[];
9
+ selectedPackagingAccoResultCode: string | null;
7
10
  selectedFlight: ExtendedFlightSearchResponseItem | null;
8
11
  selectedFlightDetails: ExtendedFlightSearchResponseItem | null;
9
12
  bookingPackageDetails: BookingPackage | null;
@@ -18,6 +21,12 @@ export interface SearchResultsState {
18
21
  export declare const setResults: import('@reduxjs/toolkit').ActionCreatorWithPayload<BookingPackageItem[], 'searchResults/setResults'>,
19
22
  setFilteredResults: import('@reduxjs/toolkit').ActionCreatorWithPayload<BookingPackageItem[], 'searchResults/setFilteredResults'>,
20
23
  setSelectedSearchResult: import('@reduxjs/toolkit').ActionCreatorWithPayload<number | null, 'searchResults/setSelectedSearchResult'>,
24
+ setPackagingAccoResults: import('@reduxjs/toolkit').ActionCreatorWithPayload<PackagingAccommodationResponse[], 'searchResults/setPackagingAccoResults'>,
25
+ setFilteredPackagingAccoResults: import('@reduxjs/toolkit').ActionCreatorWithPayload<
26
+ PackagingAccommodationResponse[],
27
+ 'searchResults/setFilteredPackagingAccoResults'
28
+ >,
29
+ setSelectedPackagingAccoResult: import('@reduxjs/toolkit').ActionCreatorWithPayload<string | null, 'searchResults/setSelectedPackagingAccoResult'>,
21
30
  setSelectedFlight: import('@reduxjs/toolkit').ActionCreatorWithPayload<ExtendedFlightSearchResponseItem | null, 'searchResults/setSelectedFlight'>,
22
31
  setSelectedFlightDetails: import('@reduxjs/toolkit').ActionCreatorWithPayload<
23
32
  ExtendedFlightSearchResponseItem | null,
@@ -1,9 +1,8 @@
1
- import { FlightSearchResponseItem } from '@qite/tide-client';
1
+ import { FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
2
2
  import { ReactNode } from 'react';
3
- import { PortalQsmType } from '../shared/types';
4
3
  export type FlightSelectionMode = 'paired' | 'independent';
5
4
  export interface SearchResultsConfiguration {
6
- type: PortalQsmType;
5
+ searchConfiguration: WebsiteConfigurationSearchConfiguration;
7
6
  tideConnection: {
8
7
  host: string;
9
8
  apiKey: string;
@@ -61,7 +60,8 @@ export interface PaginationConfig {
61
60
  }
62
61
  export type SearchResult = HotelResult | FlightResult | RoundTripResult;
63
62
  export interface BaseSearchResult {
64
- id: number;
63
+ id?: number;
64
+ code: string;
65
65
  title: string;
66
66
  image: string;
67
67
  description?: string;
@@ -76,6 +76,7 @@ export interface BaseSearchResult {
76
76
  export interface HotelResult extends BaseSearchResult {
77
77
  type: 'hotel';
78
78
  days: string;
79
+ contents?: string;
79
80
  }
80
81
  export interface RoundTripResult extends BaseSearchResult {
81
82
  type: 'roundTrip';
@@ -1,3 +1,10 @@
1
- import { BookingPackageItem } from '@qite/tide-client';
2
- import { Filter } from '../types';
1
+ import { BookingPackageItem, PackagingAccommodationResponse } from '@qite/tide-client';
2
+ import { Filter, TideTag } from '../types';
3
+ export declare const enrichFiltersWithResults: (results: BookingPackageItem[], filters: Filter[] | undefined, tags: TideTag[]) => Filter[];
4
+ export declare const enrichFiltersWithPackageAccoResults: (
5
+ results: PackagingAccommodationResponse[],
6
+ filters: Filter[] | undefined,
7
+ tags: TideTag[]
8
+ ) => Filter[];
3
9
  export declare const applyFilters: (results: BookingPackageItem[], filters: Filter[]) => BookingPackageItem[];
10
+ export declare const applyFiltersToPackageAccoResults: (results: PackagingAccommodationResponse[], filters: Filter[]) => PackagingAccommodationResponse[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.78",
3
+ "version": "1.4.80",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "types": "build/build-cjs/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "devDependencies": {
30
30
  "@jsonurl/jsonurl": "^1.1.4",
31
31
  "@popperjs/core": "^2.10.2",
32
- "@qite/tide-client": "^1.1.146",
32
+ "@qite/tide-client": "^1.1.148",
33
33
  "@reduxjs/toolkit": "^2.8.2",
34
34
  "@rollup/plugin-commonjs": "^19.0.1",
35
35
  "@rollup/plugin-json": "^4.1.0",
@@ -51,7 +51,7 @@ const aggregatePricePerPaxType = (priceDetails: BookingPriceDetail[], requestRoo
51
51
  room.pax.forEach((pax) => {
52
52
  let paxType = 'ADULT';
53
53
  if (typeof pax.age === 'number') {
54
- if (pax.age <= 11) {
54
+ if (pax.age <= 11 && pax.age > 2) {
55
55
  paxType = 'CHILD';
56
56
  } else if (pax.age <= 2) {
57
57
  paxType = 'INFANT';
@@ -60,7 +60,7 @@ const searchConfigurations: WebsiteConfigurationSearchConfiguration[] = [
60
60
  icon: '',
61
61
  defaultSearchType: 1,
62
62
  serviceTypes: [0],
63
- defaultCatalogueId: undefined,
63
+ defaultCatalogueId: 1,
64
64
  defaultDuration: undefined,
65
65
  fromDateAmount: 0,
66
66
  fromDateAmountType: 0,
@@ -80,7 +80,7 @@ const searchConfigurations: WebsiteConfigurationSearchConfiguration[] = [
80
80
  icon: '',
81
81
  defaultSearchType: 0,
82
82
  serviceTypes: [3],
83
- defaultCatalogueId: undefined,
83
+ defaultCatalogueId: 1,
84
84
  defaultDuration: undefined,
85
85
  fromDateAmount: 1,
86
86
  fromDateAmountType: 1,
@@ -100,7 +100,7 @@ const searchConfigurations: WebsiteConfigurationSearchConfiguration[] = [
100
100
  icon: '',
101
101
  defaultSearchType: 3,
102
102
  serviceTypes: [7],
103
- defaultCatalogueId: undefined,
103
+ defaultCatalogueId: 1,
104
104
  defaultDuration: undefined,
105
105
  fromDateAmount: 1,
106
106
  fromDateAmountType: 1,
@@ -120,7 +120,7 @@ const searchConfigurations: WebsiteConfigurationSearchConfiguration[] = [
120
120
  icon: '',
121
121
  defaultSearchType: 0,
122
122
  serviceTypes: [0],
123
- defaultCatalogueId: undefined,
123
+ defaultCatalogueId: 1,
124
124
  defaultDuration: undefined,
125
125
  fromDateAmount: 1,
126
126
  fromDateAmountType: 1,
@@ -19,6 +19,7 @@ import { BaseFieldConfig, DoubleFieldConfig } from '../../types';
19
19
  import { getTranslations } from '../../../shared/utils/localization-util';
20
20
  import { PortalQsmType } from '../../../shared/types';
21
21
  import { DateAmountType } from '@qite/tide-client';
22
+ import { first } from 'lodash';
22
23
 
23
24
  const QSMContainer: React.FC = () => {
24
25
  const dispatch = useDispatch();
@@ -46,6 +47,14 @@ const QSMContainer: React.FC = () => {
46
47
  } = useContext(QSMConfigurationContext);
47
48
  const translations = getTranslations(languageCode ?? 'en-GB');
48
49
 
50
+ useEffect(() => {
51
+ const defaultQsmType = first(searchConfigurations)?.qsmType;
52
+ console.log('Available search configurations:', searchConfigurations);
53
+ if (!defaultQsmType) return;
54
+ console.log('set default qsmType:', defaultQsmType);
55
+ handleQsmTypeChange(defaultQsmType);
56
+ }, [searchConfigurations]);
57
+
49
58
  useEffect(() => {
50
59
  if (fromDate || toDate) return;
51
60
 
@@ -4,24 +4,25 @@ import Spinner from '../spinner/spinner';
4
4
  import HotelCard from './hotel-card';
5
5
  import { useSelector } from 'react-redux';
6
6
  import { SearchResultsRootState } from '../../store/search-results-store';
7
- import { BookingPackageItem } from '@qite/tide-client/build/types';
7
+ import { BookingPackageItem, PackagingAccommodationResponse } from '@qite/tide-client/build/types';
8
8
  import { format, parseISO } from 'date-fns';
9
9
  import { calculateNights, formatPrice, getTranslations } from '../../../shared/utils/localization-util';
10
10
  import SearchResultsConfigurationContext from '../../search-results-configuration-context';
11
+ import { first } from 'lodash';
11
12
 
12
13
  interface HotelAccommodationResultsProps {
13
14
  isLoading: boolean;
14
15
  }
15
16
 
16
17
  const renderResults = (
17
- results: BookingPackageItem[],
18
+ results: PackagingAccommodationResponse[],
18
19
  context: SearchResultsConfiguration,
19
20
  cmsMap: Map<any, any>,
20
21
  activeTab: string | null,
21
22
  translations: any
22
23
  ) => {
23
24
  const renderedResults = results.map((result, index) => {
24
- const cmsItem = cmsMap.get(result.productId);
25
+ const cmsItem = cmsMap.get(result.code);
25
26
  const mappedResult: HotelResult = mapSearchResult(result, cmsItem, context.languageCode, translations);
26
27
  if (context?.showCustomCards && context?.customCardRenderer) {
27
28
  return (
@@ -36,10 +37,10 @@ const renderResults = (
36
37
  return <div className={`search__results__cards ${activeTab ? `search__results__cards--${activeTab}` : ''}`}>{renderedResults}</div>;
37
38
  };
38
39
 
39
- const mapSearchResult = (searchResult: BookingPackageItem, cmsItem: any, languageCode?: string, translations?: any): HotelResult => {
40
+ const mapSearchResult = (searchResult: PackagingAccommodationResponse, cmsItem: any, languageCode?: string, translations?: any): HotelResult => {
40
41
  return {
41
42
  type: 'hotel',
42
- id: searchResult.productId,
43
+ code: searchResult.code,
43
44
  title: cmsItem?.content?.general?.title || searchResult.name,
44
45
  image: cmsItem?.content?.images?.thumbnailPicture?.url,
45
46
  description: cmsItem?.content?.descriptions?.introductionTitle || '',
@@ -49,10 +50,11 @@ const mapSearchResult = (searchResult: BookingPackageItem, cmsItem: any, languag
49
50
  : cmsItem?.parentItem?.name || '',
50
51
  price: formatPrice(searchResult.price, searchResult.currencyCode, languageCode),
51
52
  ctaText: translations?.SRP.VIEW_DETAILS,
52
- days: `${calculateNights(searchResult.stayFromDate, searchResult.stayToDate)} ${translations?.SRP.NIGHTS}`,
53
- accommodation: searchResult.accommodationName,
54
- regime: searchResult.regimeName,
55
- stars: cmsItem?.content?.general?.stars || searchResult.hotelStars
53
+ days: `${calculateNights(new Date(searchResult.fromDate), new Date(searchResult.toDate))} ${translations?.SRP.NIGHTS}`,
54
+ accommodation: first(searchResult.rooms)?.options?.find((x) => x.isSelected)?.accommodationName || '',
55
+ regime: first(searchResult.rooms)?.options?.find((x) => x.isSelected)?.regimeName || '',
56
+ stars: cmsItem?.content?.general?.stars,
57
+ contents: searchResult.contents
56
58
  };
57
59
  };
58
60
 
@@ -62,32 +64,28 @@ const HotelAccommodationResults: React.FC<HotelAccommodationResultsProps> = ({ i
62
64
  return;
63
65
  }
64
66
 
65
- if (context.showMockup) {
66
- return showMocukups(context);
67
- }
68
-
69
67
  const translations = getTranslations(context?.languageCode ?? 'en-GB');
70
68
 
71
69
  if (isLoading) {
72
70
  return <>{context?.customSpinner ?? <Spinner />}</>;
73
71
  }
74
72
 
75
- const { filteredResults, activeTab } = useSelector((state: SearchResultsRootState) => state.searchResults);
73
+ const { filteredPackagingAccoResults, activeTab } = useSelector((state: SearchResultsRootState) => state.searchResults);
76
74
 
77
- if (!filteredResults.length) {
75
+ if (!filteredPackagingAccoResults.length) {
78
76
  return <div className="no-results">{translations.SRP.NO_RESULTS}</div>;
79
77
  }
80
78
 
81
79
  const cmsMap = React.useMemo(() => {
82
80
  const map = new Map();
83
81
  context.cmsHotelData?.forEach((item) => {
84
- const id = item?.content?.general?.product?.tideId;
85
- if (id) map.set(id, item);
82
+ const code = item?.content?.general?.product?.code;
83
+ if (code) map.set(code, item);
86
84
  });
87
85
  return map;
88
86
  }, [context.cmsHotelData]);
89
87
 
90
- const firstResult = filteredResults?.[0];
88
+ const firstResult = filteredPackagingAccoResults?.[0];
91
89
 
92
90
  const firstResultDay = firstResult?.fromDate ? format(parseISO(firstResult.fromDate), 'd') : null;
93
91
 
@@ -106,90 +104,90 @@ const HotelAccommodationResults: React.FC<HotelAccommodationResultsProps> = ({ i
106
104
  </h3>
107
105
  </div>
108
106
  </div>
109
- {renderResults(filteredResults, context, cmsMap, activeTab, translations)}
107
+ {renderResults(filteredPackagingAccoResults, context, cmsMap, activeTab, translations)}
110
108
  </>
111
109
  );
112
110
  };
113
111
 
114
112
  export default HotelAccommodationResults;
115
113
 
116
- const showMocukups = (context: any) => {
117
- const mockedHotelResults = [
118
- {
119
- type: 'hotel',
120
- id: 2,
121
- title: 'HTFSWILLCARL',
122
- image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
123
- description: '2 persoons kamer',
124
- location: 'Tenerif, Spanje',
125
- price: '$2244',
126
- ctaText: 'Bekijk details',
127
- days: '7 nights',
128
- flightInfo: null,
129
- accommodation: 'Hotel XYZ',
130
- regime: 'All-inclusive',
131
- stars: 5
132
- } as HotelResult,
133
- {
134
- type: 'hotel',
135
- id: 3,
136
- title: 'HTFSSOFTROCK',
137
- image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
138
- description: '3 persoons kamer',
139
- location: 'Tenerif, Spanje',
140
- price: '$2244',
141
- ctaText: 'Bekijk details',
142
- days: '7 nights',
143
- flightInfo: null,
144
- accommodation: 'Hotel ABC',
145
- regime: 'Half-board',
146
- stars: 4
147
- } as HotelResult,
148
- {
149
- type: 'hotel',
150
- id: 4,
151
- title: 'HTFSROYGAR',
152
- image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
153
- description: '4 persoons kamer',
154
- location: 'Tenerif, Spanje',
155
- price: '$2496',
156
- ctaText: 'Bekijk details',
157
- days: '7 nights',
158
- flightInfo: null,
159
- accommodation: 'Hotel DEF',
160
- regime: 'Full-board',
161
- stars: 5
162
- } as HotelResult,
163
- {
164
- type: 'hotel',
165
- id: 5,
166
- title: 'HTFSCONBEL',
167
- image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
168
- description: '5 persoons kamer',
169
- location: 'Tenerif, Spanje',
170
- price: '$6784.8',
171
- ctaText: 'Bekijk details',
172
- days: '7 nights',
173
- flightInfo: null,
174
- accommodation: 'Hotel GHI',
175
- regime: 'All-inclusive',
176
- stars: 5
177
- } as HotelResult
178
- ] as HotelResult[];
179
- return <>{renderMockupResults(mockedHotelResults, context)}</>;
180
- };
181
-
182
- const renderMockupResults = (results: any[], context: any) => {
183
- const renderedResults = results.map((result, index) => {
184
- if (context?.showCustomCards && context?.customCardRenderer) {
185
- return (
186
- <div key={`${result.id}-${index}`} className="search__result-card">
187
- {context.customCardRenderer(result)}
188
- </div>
189
- );
190
- }
191
- return <HotelCard key={`${result.id}-${index}`} result={result} />;
192
- });
193
-
194
- return <div className="search__results__cards">{renderedResults}</div>;
195
- };
114
+ // const showMocukups = (context: any) => {
115
+ // const mockedHotelResults = [
116
+ // {
117
+ // type: 'hotel',
118
+ // id: 2,
119
+ // title: 'HTFSWILLCARL',
120
+ // image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
121
+ // description: '2 persoons kamer',
122
+ // location: 'Tenerif, Spanje',
123
+ // price: '$2244',
124
+ // ctaText: 'Bekijk details',
125
+ // days: '7 nights',
126
+ // flightInfo: null,
127
+ // accommodation: 'Hotel XYZ',
128
+ // regime: 'All-inclusive',
129
+ // stars: 5
130
+ // } as HotelResult,
131
+ // {
132
+ // type: 'hotel',
133
+ // id: 3,
134
+ // title: 'HTFSSOFTROCK',
135
+ // image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
136
+ // description: '3 persoons kamer',
137
+ // location: 'Tenerif, Spanje',
138
+ // price: '$2244',
139
+ // ctaText: 'Bekijk details',
140
+ // days: '7 nights',
141
+ // flightInfo: null,
142
+ // accommodation: 'Hotel ABC',
143
+ // regime: 'Half-board',
144
+ // stars: 4
145
+ // } as HotelResult,
146
+ // {
147
+ // type: 'hotel',
148
+ // id: 4,
149
+ // title: 'HTFSROYGAR',
150
+ // image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
151
+ // description: '4 persoons kamer',
152
+ // location: 'Tenerif, Spanje',
153
+ // price: '$2496',
154
+ // ctaText: 'Bekijk details',
155
+ // days: '7 nights',
156
+ // flightInfo: null,
157
+ // accommodation: 'Hotel DEF',
158
+ // regime: 'Full-board',
159
+ // stars: 5
160
+ // } as HotelResult,
161
+ // {
162
+ // type: 'hotel',
163
+ // id: 5,
164
+ // title: 'HTFSCONBEL',
165
+ // image: 'https://images.unsplash.com/photo-1573790387438-4da905039392?q=80&w=1925&auto=format&fit=crop',
166
+ // description: '5 persoons kamer',
167
+ // location: 'Tenerif, Spanje',
168
+ // price: '$6784.8',
169
+ // ctaText: 'Bekijk details',
170
+ // days: '7 nights',
171
+ // flightInfo: null,
172
+ // accommodation: 'Hotel GHI',
173
+ // regime: 'All-inclusive',
174
+ // stars: 5
175
+ // } as HotelResult
176
+ // ] as HotelResult[];
177
+ // return <>{renderMockupResults(mockedHotelResults, context)}</>;
178
+ // };
179
+
180
+ // const renderMockupResults = (results: any[], context: any) => {
181
+ // const renderedResults = results.map((result, index) => {
182
+ // if (context?.showCustomCards && context?.customCardRenderer) {
183
+ // return (
184
+ // <div key={`${result.id}-${index}`} className="search__result-card">
185
+ // {context.customCardRenderer(result)}
186
+ // </div>
187
+ // );
188
+ // }
189
+ // return <HotelCard key={`${result.id}-${index}`} result={result} />;
190
+ // });
191
+
192
+ // return <div className="search__results__cards">{renderedResults}</div>;
193
+ // };
@@ -3,7 +3,7 @@ import { HotelResult } from '../../types';
3
3
  import Icon from '../icon';
4
4
  import { useDispatch, useSelector } from 'react-redux';
5
5
  import { SearchResultsRootState } from '../../store/search-results-store';
6
- import { setSelectedSearchResult } from '../../store/search-results-slice';
6
+ import { setSelectedPackagingAccoResult } from '../../store/search-results-slice';
7
7
 
8
8
  interface HotelCardProps {
9
9
  result: HotelResult;
@@ -12,12 +12,34 @@ interface HotelCardProps {
12
12
 
13
13
  const HotelCard: React.FC<HotelCardProps> = ({ result, translations }) => {
14
14
  const dispatch = useDispatch();
15
- const { selectedSearchResultId } = useSelector((state: SearchResultsRootState) => state.searchResults);
15
+ const { selectedPackagingAccoResultCode } = useSelector((state: SearchResultsRootState) => state.searchResults);
16
16
 
17
- const handleChange = (productId: number) => {
18
- dispatch(setSelectedSearchResult(productId));
17
+ const handleChange = (productCode: string) => {
18
+ dispatch(setSelectedPackagingAccoResult(productCode));
19
19
  };
20
20
 
21
+ if (result.contents?.length) {
22
+ return (
23
+ <div className="search__result-card__wrapper">
24
+ <div
25
+ dangerouslySetInnerHTML={{
26
+ __html: result.contents
27
+ }}></div>
28
+ <div className="search__result-card__footer">
29
+ <button
30
+ type="button"
31
+ className={`cta ${selectedPackagingAccoResultCode === result.code ? 'cta--selected' : 'cta--select'}`}
32
+ onClick={() => handleChange(result.code)}>
33
+ {selectedPackagingAccoResultCode === result.code ? translations?.SHARED.SELECTED : translations?.SHARED.SELECT}
34
+ </button>
35
+ {/* <button type="button" className="cta cta--select" onClick={() => console.log('Clicked on customCard with id:', result.id)}>
36
+ {translations?.SRP.VIEW_DETAILS}
37
+ </button> */}
38
+ </div>
39
+ </div>
40
+ );
41
+ }
42
+
21
43
  return (
22
44
  <div
23
45
  key={result.id}
@@ -73,9 +95,9 @@ const HotelCard: React.FC<HotelCardProps> = ({ result, translations }) => {
73
95
  <div className="search__result-card__footer">
74
96
  <button
75
97
  type="button"
76
- className={`cta ${selectedSearchResultId === result.id ? 'cta--selected' : 'cta--select'}`}
77
- onClick={() => handleChange(result.id)}>
78
- {selectedSearchResultId === result.id ? translations?.SHARED.SELECTED : translations?.SHARED.SELECT}
98
+ className={`cta ${selectedPackagingAccoResultCode === result.code ? 'cta--selected' : 'cta--select'}`}
99
+ onClick={() => handleChange(result.code)}>
100
+ {selectedPackagingAccoResultCode === result.code ? translations?.SHARED.SELECTED : translations?.SHARED.SELECT}
79
101
  </button>
80
102
  {/* <button type="button" className="cta cta--select" onClick={() => console.log('Clicked on customCard with id:', result.id)}>
81
103
  {translations?.SRP.VIEW_DETAILS}
@@ -43,7 +43,7 @@ const FlightResultsContainer: React.FC<FlightResultsContainerProps> = ({ isMobil
43
43
 
44
44
  useEffect(() => {
45
45
  if (!context?.showMockup) {
46
- if (context?.type === PortalQsmType.Flight && isHubReady) {
46
+ if (context?.searchConfiguration.qsmType === PortalQsmType.Flight && isHubReady) {
47
47
  onFlightSearch();
48
48
  }
49
49
  }
@@ -129,7 +129,7 @@ const FlightResultsContainer: React.FC<FlightResultsContainerProps> = ({ isMobil
129
129
 
130
130
  <div className="search__results__wrapper">
131
131
  {flightsLoading && <Spinner />}
132
- {context?.type == PortalQsmType.Flight && context?.showFlightAccommodationResults && results && results.length > 0 && (
132
+ {context?.searchConfiguration.qsmType == PortalQsmType.Flight && context?.showFlightAccommodationResults && results && results.length > 0 && (
133
133
  <FlightSelection searchResults={results} flightSelectionType={flightSelectionType} />
134
134
  )}
135
135
  </div>