@qite/tide-booking-component 1.4.103 → 1.4.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/build-cjs/index.js +2167 -1400
- package/build/build-cjs/src/search-results/components/filters/filters.d.ts +2 -0
- package/build/build-cjs/src/search-results/components/hotel/hotel-accommodation-results.d.ts +1 -0
- package/build/build-cjs/src/search-results/store/search-results-selectors.d.ts +424 -0
- package/build/build-cjs/src/search-results/store/search-results-slice.d.ts +27 -8
- package/build/build-cjs/src/search-results/types.d.ts +14 -2
- package/build/build-cjs/src/search-results/utils/search-results-utils.d.ts +8 -6
- package/build/build-cjs/src/shared/components/flyin/flyin.d.ts +3 -3
- package/build/build-cjs/src/shared/components/flyin/packaging-flights-flyin.d.ts +7 -0
- package/build/build-esm/index.js +2152 -1395
- package/build/build-esm/src/search-results/components/filters/filters.d.ts +2 -0
- package/build/build-esm/src/search-results/components/hotel/hotel-accommodation-results.d.ts +1 -0
- package/build/build-esm/src/search-results/store/search-results-selectors.d.ts +424 -0
- package/build/build-esm/src/search-results/store/search-results-slice.d.ts +27 -8
- package/build/build-esm/src/search-results/types.d.ts +14 -2
- package/build/build-esm/src/search-results/utils/search-results-utils.d.ts +8 -6
- package/build/build-esm/src/shared/components/flyin/flyin.d.ts +3 -3
- package/build/build-esm/src/shared/components/flyin/packaging-flights-flyin.d.ts +7 -0
- package/package.json +1 -1
- package/src/booking-wizard/features/flight-options/index.tsx +6 -2
- package/src/search-results/components/filters/filters.tsx +8 -9
- package/src/search-results/components/hotel/hotel-accommodation-results.tsx +81 -24
- package/src/search-results/components/search-results-container/search-results-container.tsx +118 -102
- package/src/search-results/store/search-results-selectors.ts +73 -0
- package/src/search-results/store/search-results-slice.ts +94 -14
- package/src/search-results/types.ts +14 -2
- package/src/search-results/utils/search-results-utils.ts +310 -58
- package/src/shared/components/flyin/flyin.tsx +102 -19
- package/src/shared/components/flyin/packaging-flights-flyin.tsx +164 -0
- package/styles/components/_flyin.scss +16 -0
- package/styles/components/_search.scss +4 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
+
import { SearchResultsRootState } from './search-results-store';
|
|
3
|
+
import { getFlightKey } from '../utils/flight-utils';
|
|
4
|
+
import { PackagingFlightResponse } from '@qite/tide-client';
|
|
5
|
+
|
|
6
|
+
const selectSearchResultsState = (state: SearchResultsRootState) => state.searchResults;
|
|
7
|
+
|
|
8
|
+
export const selectPackagingFlightResults = createSelector([selectSearchResultsState], (state) => state.packagingFlightResults);
|
|
9
|
+
export const selectFilteredPackagingFlightResults = createSelector([selectSearchResultsState], (state) => state.filteredPackagingFlightResults);
|
|
10
|
+
|
|
11
|
+
export const selectSelectedOutwardKey = createSelector([selectSearchResultsState], (state) => state.selectedOutwardKey);
|
|
12
|
+
|
|
13
|
+
export const selectSelectedReturnKey = createSelector([selectSearchResultsState], (state) => state.selectedReturnKey);
|
|
14
|
+
|
|
15
|
+
export const selectUniqueOutwardFlights = createSelector([selectFilteredPackagingFlightResults], (packagingFlightResults): PackagingFlightResponse[] => {
|
|
16
|
+
const map = new Map<string, PackagingFlightResponse>();
|
|
17
|
+
|
|
18
|
+
packagingFlightResults.forEach((flight) => {
|
|
19
|
+
const key = getFlightKey(flight.outward.segments);
|
|
20
|
+
|
|
21
|
+
if (!map.has(key)) {
|
|
22
|
+
map.set(key, flight);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return Array.from(map.values());
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const selectUniqueReturnFlights = createSelector(
|
|
30
|
+
[selectFilteredPackagingFlightResults, selectSelectedOutwardKey],
|
|
31
|
+
(packagingFlightResults, selectedOutwardKey): PackagingFlightResponse[] => {
|
|
32
|
+
if (!selectedOutwardKey) return [];
|
|
33
|
+
|
|
34
|
+
const matchingCombinations = packagingFlightResults.filter((flight) => getFlightKey(flight.outward.segments) === selectedOutwardKey);
|
|
35
|
+
|
|
36
|
+
const map = new Map<string, PackagingFlightResponse>();
|
|
37
|
+
|
|
38
|
+
matchingCombinations.forEach((flight) => {
|
|
39
|
+
const key = getFlightKey(flight.return.segments);
|
|
40
|
+
|
|
41
|
+
if (!map.has(key)) {
|
|
42
|
+
map.set(key, flight);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return Array.from(map.values());
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const selectSelectedOutward = createSelector([selectPackagingFlightResults, selectSelectedOutwardKey], (packagingFlightResults, selectedOutwardKey) => {
|
|
51
|
+
if (!selectedOutwardKey) return null;
|
|
52
|
+
|
|
53
|
+
return packagingFlightResults.find((flight) => getFlightKey(flight.outward.segments) === selectedOutwardKey) ?? null;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const selectSelectedReturn = createSelector([selectPackagingFlightResults, selectSelectedReturnKey], (packagingFlightResults, selectedReturnKey) => {
|
|
57
|
+
if (!selectedReturnKey) return null;
|
|
58
|
+
|
|
59
|
+
return packagingFlightResults.find((flight) => getFlightKey(flight.return.segments) === selectedReturnKey) ?? null;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const selectSelectedCombinationFlight = createSelector(
|
|
63
|
+
[selectPackagingFlightResults, selectSelectedOutwardKey, selectSelectedReturnKey],
|
|
64
|
+
(packagingFlightResults, selectedOutwardKey, selectedReturnKey) => {
|
|
65
|
+
if (!selectedOutwardKey || !selectedReturnKey) return null;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
packagingFlightResults.find(
|
|
69
|
+
(flight) => getFlightKey(flight.outward.segments) === selectedOutwardKey && getFlightKey(flight.return.segments) === selectedReturnKey
|
|
70
|
+
) ?? null
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import {
|
|
2
|
+
import { ExtendedFlightSearchResponseItem, Filter, FlyInType, SortByType } from '../types';
|
|
3
3
|
import {
|
|
4
4
|
BookingPackage,
|
|
5
5
|
BookingPackageItem,
|
|
@@ -14,53 +14,87 @@ export interface SearchResultsState {
|
|
|
14
14
|
results: BookingPackageItem[];
|
|
15
15
|
filteredResults: BookingPackageItem[];
|
|
16
16
|
selectedSearchResult: BookingPackageItem | null;
|
|
17
|
+
|
|
17
18
|
packagingAccoResults: PackagingAccommodationResponse[];
|
|
18
19
|
filteredPackagingAccoResults: PackagingAccommodationResponse[];
|
|
19
20
|
packagingAccoSearchDetails: PackagingAccommodationResponse[];
|
|
20
21
|
selectedPackagingAccoResultCode: string | null;
|
|
22
|
+
|
|
21
23
|
packagingFlightResults: PackagingFlightResponse[];
|
|
24
|
+
filteredPackagingFlightResults: PackagingFlightResponse[];
|
|
22
25
|
selectedPackagingFlight: PackagingFlightResponse | null;
|
|
26
|
+
selectedOutwardKey: string | null;
|
|
27
|
+
selectedReturnKey: string | null;
|
|
28
|
+
|
|
23
29
|
selectedFlight: ExtendedFlightSearchResponseItem | null;
|
|
24
30
|
selectedFlightDetails: ExtendedFlightSearchResponseItem | null;
|
|
31
|
+
|
|
25
32
|
bookingPackageDetails: BookingPackage | null;
|
|
33
|
+
priceDetails: BookingPriceDetails | null;
|
|
34
|
+
|
|
26
35
|
isLoading: boolean;
|
|
27
36
|
flightsLoading: boolean;
|
|
28
|
-
|
|
37
|
+
|
|
29
38
|
selectedSortType: SortByType | null;
|
|
39
|
+
selectedFlightSortType: SortByType | null;
|
|
40
|
+
filters: Filter[];
|
|
41
|
+
initialFilters: Filter[];
|
|
42
|
+
flightFilters: Filter[];
|
|
43
|
+
initialFlightFilters: Filter[];
|
|
44
|
+
|
|
30
45
|
activeTab: string | null;
|
|
31
46
|
currentPage: number;
|
|
32
|
-
|
|
33
|
-
editablePackagingEntry: PackagingEntry | null;
|
|
47
|
+
|
|
34
48
|
transactionId: string | null;
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
|
|
50
|
+
flyInIsOpen: boolean;
|
|
51
|
+
flyInType: FlyInType | null;
|
|
52
|
+
|
|
37
53
|
itinerary: ClientPortalItinerary | null;
|
|
54
|
+
editablePackagingEntry: PackagingEntry | null;
|
|
38
55
|
}
|
|
39
56
|
|
|
40
57
|
const initialState: SearchResultsState = {
|
|
41
58
|
results: [],
|
|
42
59
|
filteredResults: [],
|
|
43
60
|
selectedSearchResult: null,
|
|
61
|
+
|
|
44
62
|
packagingAccoResults: [],
|
|
45
63
|
filteredPackagingAccoResults: [],
|
|
46
64
|
packagingAccoSearchDetails: [],
|
|
47
65
|
selectedPackagingAccoResultCode: null,
|
|
66
|
+
|
|
48
67
|
packagingFlightResults: [],
|
|
68
|
+
filteredPackagingFlightResults: [],
|
|
49
69
|
selectedPackagingFlight: null,
|
|
70
|
+
selectedOutwardKey: null,
|
|
71
|
+
selectedReturnKey: null,
|
|
72
|
+
|
|
50
73
|
selectedFlight: null,
|
|
51
74
|
selectedFlightDetails: null,
|
|
75
|
+
|
|
52
76
|
bookingPackageDetails: null,
|
|
77
|
+
priceDetails: null,
|
|
78
|
+
|
|
53
79
|
isLoading: false,
|
|
54
80
|
flightsLoading: false,
|
|
55
|
-
|
|
81
|
+
|
|
56
82
|
selectedSortType: null,
|
|
83
|
+
selectedFlightSortType: null,
|
|
84
|
+
initialFilters: [],
|
|
85
|
+
filters: [],
|
|
86
|
+
initialFlightFilters: [],
|
|
87
|
+
flightFilters: [],
|
|
88
|
+
|
|
57
89
|
activeTab: 'compact',
|
|
58
90
|
currentPage: 1,
|
|
91
|
+
|
|
92
|
+
transactionId: null,
|
|
93
|
+
|
|
59
94
|
flyInIsOpen: false,
|
|
95
|
+
flyInType: null,
|
|
96
|
+
|
|
60
97
|
editablePackagingEntry: null,
|
|
61
|
-
transactionId: null,
|
|
62
|
-
accommodationFlyInStep: 'details',
|
|
63
|
-
priceDetails: null,
|
|
64
98
|
itinerary: null
|
|
65
99
|
};
|
|
66
100
|
|
|
@@ -92,6 +126,9 @@ const searchResultsSlice = createSlice({
|
|
|
92
126
|
setPackagingFlightResults(state, action: PayloadAction<PackagingFlightResponse[]>) {
|
|
93
127
|
state.packagingFlightResults = action.payload;
|
|
94
128
|
},
|
|
129
|
+
setFilteredPackagingFlightResults(state, action: PayloadAction<PackagingFlightResponse[]>) {
|
|
130
|
+
state.filteredPackagingFlightResults = action.payload;
|
|
131
|
+
},
|
|
95
132
|
setSelectedPackagingFlight(state, action: PayloadAction<PackagingFlightResponse | null>) {
|
|
96
133
|
state.selectedPackagingFlight = action.payload;
|
|
97
134
|
},
|
|
@@ -122,6 +159,9 @@ const searchResultsSlice = createSlice({
|
|
|
122
159
|
setFlightsLoading(state, action: PayloadAction<boolean>) {
|
|
123
160
|
state.flightsLoading = action.payload;
|
|
124
161
|
},
|
|
162
|
+
setInitialFilters(state, action: PayloadAction<Filter[]>) {
|
|
163
|
+
state.initialFilters = action.payload;
|
|
164
|
+
},
|
|
125
165
|
setFilters(state, action: PayloadAction<Filter[]>) {
|
|
126
166
|
const updatedFilters = action.payload;
|
|
127
167
|
|
|
@@ -137,9 +177,30 @@ const searchResultsSlice = createSlice({
|
|
|
137
177
|
resetFilters(state, action: PayloadAction<Filter[]>) {
|
|
138
178
|
state.filters = action.payload;
|
|
139
179
|
},
|
|
180
|
+
setInitialFlightFilters(state, action: PayloadAction<Filter[]>) {
|
|
181
|
+
state.initialFlightFilters = action.payload;
|
|
182
|
+
},
|
|
183
|
+
setFlightFilters(state, action: PayloadAction<Filter[]>) {
|
|
184
|
+
const updatedFilters = action.payload;
|
|
185
|
+
|
|
186
|
+
updatedFilters.forEach((updatedFilter) => {
|
|
187
|
+
const existingIndex = state.flightFilters.findIndex((f) => f.property === updatedFilter.property);
|
|
188
|
+
if (existingIndex !== -1) {
|
|
189
|
+
state.flightFilters[existingIndex] = updatedFilter;
|
|
190
|
+
} else {
|
|
191
|
+
state.flightFilters.push(updatedFilter); // Optional: Add new filters if not present
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
resetFlightFilters(state, action: PayloadAction<Filter[]>) {
|
|
196
|
+
state.flightFilters = action.payload;
|
|
197
|
+
},
|
|
140
198
|
setSortType(state, action: PayloadAction<SortByType | null>) {
|
|
141
199
|
state.selectedSortType = action.payload;
|
|
142
200
|
},
|
|
201
|
+
setFlightSortType(state, action: PayloadAction<SortByType | null>) {
|
|
202
|
+
state.selectedFlightSortType = action.payload;
|
|
203
|
+
},
|
|
143
204
|
setActiveTab(state, action: PayloadAction<string | null>) {
|
|
144
205
|
state.activeTab = action.payload;
|
|
145
206
|
},
|
|
@@ -163,14 +224,24 @@ const searchResultsSlice = createSlice({
|
|
|
163
224
|
setTransactionId(state, action: PayloadAction<string | null>) {
|
|
164
225
|
state.transactionId = action.payload;
|
|
165
226
|
},
|
|
166
|
-
|
|
167
|
-
state.
|
|
227
|
+
setFlyInType(state, action: PayloadAction<FlyInType | null>) {
|
|
228
|
+
state.flyInType = action.payload;
|
|
168
229
|
},
|
|
169
230
|
setPriceDetails(state, action: PayloadAction<BookingPriceDetails | null>) {
|
|
170
231
|
state.priceDetails = action.payload;
|
|
171
232
|
},
|
|
172
233
|
setItinerary(state, action: PayloadAction<ClientPortalItinerary | null>) {
|
|
173
234
|
state.itinerary = action.payload;
|
|
235
|
+
},
|
|
236
|
+
setSelectedOutwardKey: (state, action: PayloadAction<string | null>) => {
|
|
237
|
+
state.selectedOutwardKey = action.payload;
|
|
238
|
+
},
|
|
239
|
+
setSelectedReturnKey: (state, action: PayloadAction<string | null>) => {
|
|
240
|
+
state.selectedReturnKey = action.payload;
|
|
241
|
+
},
|
|
242
|
+
resetFlightSelection: (state) => {
|
|
243
|
+
state.selectedOutwardKey = null;
|
|
244
|
+
state.selectedReturnKey = null;
|
|
174
245
|
}
|
|
175
246
|
}
|
|
176
247
|
});
|
|
@@ -181,6 +252,7 @@ export const {
|
|
|
181
252
|
setSelectedSearchResult,
|
|
182
253
|
setPackagingAccoResults,
|
|
183
254
|
setFilteredPackagingAccoResults,
|
|
255
|
+
setFilteredPackagingFlightResults,
|
|
184
256
|
setPackagingAccoSearchDetails,
|
|
185
257
|
setSelectedPackagingAccoResult,
|
|
186
258
|
setPackagingFlightResults,
|
|
@@ -191,18 +263,26 @@ export const {
|
|
|
191
263
|
selectFlight,
|
|
192
264
|
setIsLoading,
|
|
193
265
|
setFlightsLoading,
|
|
266
|
+
setInitialFilters,
|
|
194
267
|
setFilters,
|
|
195
268
|
resetFilters,
|
|
269
|
+
setInitialFlightFilters,
|
|
270
|
+
setFlightFilters,
|
|
271
|
+
resetFlightFilters,
|
|
196
272
|
setSortType,
|
|
273
|
+
setFlightSortType,
|
|
197
274
|
setActiveTab,
|
|
198
275
|
setCurrentPage,
|
|
199
276
|
resetSearchState,
|
|
200
277
|
setFlyInIsOpen,
|
|
201
278
|
setEditablePackagingEntry,
|
|
202
279
|
setTransactionId,
|
|
203
|
-
|
|
280
|
+
setFlyInType,
|
|
204
281
|
setPriceDetails,
|
|
205
|
-
setItinerary
|
|
282
|
+
setItinerary,
|
|
283
|
+
setSelectedOutwardKey,
|
|
284
|
+
setSelectedReturnKey,
|
|
285
|
+
resetFlightSelection
|
|
206
286
|
} = searchResultsSlice.actions;
|
|
207
287
|
|
|
208
288
|
export default searchResultsSlice.reducer;
|
|
@@ -64,7 +64,19 @@ export interface SearchResultsConfiguration {
|
|
|
64
64
|
|
|
65
65
|
export type FilterType = 'checkbox' | 'toggle' | 'slider' | 'star-rating';
|
|
66
66
|
|
|
67
|
-
export type FilterProperty =
|
|
67
|
+
export type FilterProperty =
|
|
68
|
+
| 'regime'
|
|
69
|
+
| 'accommodation'
|
|
70
|
+
| 'max-duration'
|
|
71
|
+
| 'price'
|
|
72
|
+
| 'rating'
|
|
73
|
+
| 'theme'
|
|
74
|
+
| 'airline'
|
|
75
|
+
| 'numberOfStops'
|
|
76
|
+
| 'departureRange'
|
|
77
|
+
| 'departureAirport'
|
|
78
|
+
| 'arrivalAirport'
|
|
79
|
+
| 'travelDuration';
|
|
68
80
|
|
|
69
81
|
export interface FilterOption {
|
|
70
82
|
label: string;
|
|
@@ -205,4 +217,4 @@ export type SearchSeed = {
|
|
|
205
217
|
rooms: BookingPackageRequestRoom[];
|
|
206
218
|
};
|
|
207
219
|
|
|
208
|
-
export type
|
|
220
|
+
export type FlyInType = 'flight-outward-results' | 'flight-return-results' | 'flight-details' | 'acco-results' | 'acco-details';
|