@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.
Files changed (31) hide show
  1. package/build/build-cjs/index.js +2167 -1400
  2. package/build/build-cjs/src/search-results/components/filters/filters.d.ts +2 -0
  3. package/build/build-cjs/src/search-results/components/hotel/hotel-accommodation-results.d.ts +1 -0
  4. package/build/build-cjs/src/search-results/store/search-results-selectors.d.ts +424 -0
  5. package/build/build-cjs/src/search-results/store/search-results-slice.d.ts +27 -8
  6. package/build/build-cjs/src/search-results/types.d.ts +14 -2
  7. package/build/build-cjs/src/search-results/utils/search-results-utils.d.ts +8 -6
  8. package/build/build-cjs/src/shared/components/flyin/flyin.d.ts +3 -3
  9. package/build/build-cjs/src/shared/components/flyin/packaging-flights-flyin.d.ts +7 -0
  10. package/build/build-esm/index.js +2152 -1395
  11. package/build/build-esm/src/search-results/components/filters/filters.d.ts +2 -0
  12. package/build/build-esm/src/search-results/components/hotel/hotel-accommodation-results.d.ts +1 -0
  13. package/build/build-esm/src/search-results/store/search-results-selectors.d.ts +424 -0
  14. package/build/build-esm/src/search-results/store/search-results-slice.d.ts +27 -8
  15. package/build/build-esm/src/search-results/types.d.ts +14 -2
  16. package/build/build-esm/src/search-results/utils/search-results-utils.d.ts +8 -6
  17. package/build/build-esm/src/shared/components/flyin/flyin.d.ts +3 -3
  18. package/build/build-esm/src/shared/components/flyin/packaging-flights-flyin.d.ts +7 -0
  19. package/package.json +1 -1
  20. package/src/booking-wizard/features/flight-options/index.tsx +6 -2
  21. package/src/search-results/components/filters/filters.tsx +8 -9
  22. package/src/search-results/components/hotel/hotel-accommodation-results.tsx +81 -24
  23. package/src/search-results/components/search-results-container/search-results-container.tsx +118 -102
  24. package/src/search-results/store/search-results-selectors.ts +73 -0
  25. package/src/search-results/store/search-results-slice.ts +94 -14
  26. package/src/search-results/types.ts +14 -2
  27. package/src/search-results/utils/search-results-utils.ts +310 -58
  28. package/src/shared/components/flyin/flyin.tsx +102 -19
  29. package/src/shared/components/flyin/packaging-flights-flyin.tsx +164 -0
  30. package/styles/components/_flyin.scss +16 -0
  31. package/styles/components/_search.scss +4 -1
@@ -0,0 +1,164 @@
1
+ import React, { useContext, useState } from 'react';
2
+ import { useDispatch, useSelector } from 'react-redux';
3
+ import {
4
+ resetFlightFilters,
5
+ setFlightFilters,
6
+ setFlightSortType,
7
+ setFlyInIsOpen,
8
+ setFlyInType,
9
+ setSelectedOutwardKey,
10
+ setSelectedReturnKey
11
+ } from '../../../search-results/store/search-results-slice';
12
+ import { SearchResultsRootState } from '../../../search-results/store/search-results-store';
13
+ import Spinner from '../../../search-results/components/spinner/spinner';
14
+ import SearchResultsConfigurationContext from '../../../search-results/search-results-configuration-context';
15
+ import { findSortByType, getSortingName, getTranslations } from '../../utils/localization-util';
16
+ import { getFlightKey } from '../../../search-results/utils/flight-utils';
17
+ import {
18
+ selectSelectedOutward,
19
+ selectSelectedReturn,
20
+ selectUniqueOutwardFlights,
21
+ selectUniqueReturnFlights
22
+ } from '../../../search-results/store/search-results-selectors';
23
+ import IndependentFlightOption from '../../../search-results/components/flight/flight-selection/independent-flight-option';
24
+ import Filters from '../../../search-results/components/filters/filters';
25
+ import { SortByType } from '../../../search-results/types';
26
+ import ItemPicker from '../../../search-results/components/item-picker';
27
+
28
+ type FlightsFlyInProps = {
29
+ isOpen: boolean;
30
+ setIsOpen: (open: boolean) => void;
31
+ };
32
+
33
+ const PackageingFlightsFlyIn: React.FC<FlightsFlyInProps> = ({ isOpen, setIsOpen }) => {
34
+ const context = useContext(SearchResultsConfigurationContext);
35
+ const language = context?.languageCode ?? 'en-GB';
36
+ const translations = getTranslations(language);
37
+
38
+ const dispatch = useDispatch();
39
+ const { flightsLoading, initialFlightFilters, flightFilters, flyInType, selectedFlightSortType } = useSelector(
40
+ (state: SearchResultsRootState) => state.searchResults
41
+ );
42
+ const uniqueOutwardFlights = useSelector(selectUniqueOutwardFlights);
43
+ const uniqueReturnFlights = useSelector(selectUniqueReturnFlights);
44
+ const selectedOutward = useSelector(selectSelectedOutward);
45
+ const selectedReturn = useSelector(selectSelectedReturn);
46
+
47
+ const [outwardStepComplete, setOutwardStepComplete] = useState<boolean>(false);
48
+
49
+ const handleConfirm = (): void => {
50
+ if (!outwardStepComplete) {
51
+ setOutwardStepComplete(true);
52
+ dispatch(setFlyInType('flight-return-results'));
53
+ return;
54
+ } else {
55
+ dispatch(setFlyInType(null));
56
+ setOutwardStepComplete(false);
57
+ dispatch(setFlyInIsOpen(false));
58
+ }
59
+ };
60
+
61
+ const sortByTypes = [
62
+ { direction: 'asc', label: 'default' } as SortByType,
63
+ { direction: 'asc', label: 'price' } as SortByType,
64
+ { direction: 'desc', label: 'price' } as SortByType,
65
+ { direction: 'asc', label: 'departureTime' } as SortByType,
66
+ { direction: 'desc', label: 'departureTime' } as SortByType,
67
+ { direction: 'asc', label: 'durationInTicks' } as SortByType,
68
+ { direction: 'desc', label: 'durationInTicks' } as SortByType
69
+ ];
70
+
71
+ const handleSortChange = (newSortKey: string, direction?: string) => {
72
+ if (sortByTypes === undefined) return;
73
+ const newSortByType = findSortByType(sortByTypes, newSortKey, direction ?? 'asc');
74
+ if (newSortByType) {
75
+ dispatch(setFlightSortType(newSortByType));
76
+ }
77
+ };
78
+
79
+ return (
80
+ <>
81
+ <div className="flyin__content flyin__content--columns">
82
+ {flightsLoading ? (
83
+ <Spinner />
84
+ ) : (
85
+ <>
86
+ <Filters
87
+ initialFilters={initialFlightFilters}
88
+ filters={flightFilters}
89
+ isOpen={false}
90
+ handleSetIsOpen={() => {}}
91
+ // handleApplyFilters={() => setSearchTrigger((prev) => prev + 1)}
92
+ isLoading={flightsLoading}
93
+ setFilters={(filters) => dispatch(setFlightFilters(filters))}
94
+ resetFilters={(filters) => dispatch(resetFlightFilters(filters))}
95
+ />
96
+ <div className="search__results__wrapper">
97
+ <div className="search__result-row">
98
+ <span className="search__result-row-text">
99
+ {uniqueOutwardFlights?.length && uniqueOutwardFlights.length}
100
+ &nbsp;{translations.FLIGHTS_FORM.FLIGHTS_FOUND_2}&nbsp;{translations.FLIGHTS_FORM.FLIGHTS_FOUND_3}
101
+ </span>
102
+ {sortByTypes && sortByTypes.length > 0 && (
103
+ <div className="search__result-row-filter">
104
+ <ItemPicker
105
+ items={sortByTypes}
106
+ selection={selectedFlightSortType?.label || undefined}
107
+ selectedSortByType={selectedFlightSortType || undefined}
108
+ label={translations.SRP.SORTBY}
109
+ placeholder={translations.SRP.SORTBY}
110
+ classModifier=""
111
+ valueFormatter={(value, direction) => getSortingName(translations, findSortByType(sortByTypes, value, direction ?? 'asc'))}
112
+ // onPick={handleSortChange}
113
+ onPick={(newSortKey, direction) => handleSortChange(newSortKey, direction)}
114
+ />
115
+ </div>
116
+ )}
117
+ </div>
118
+ <div className="search__results__cards search__results__cards--extended">
119
+ {flyInType == 'flight-outward-results' &&
120
+ uniqueOutwardFlights.map((result) => (
121
+ <IndependentFlightOption
122
+ key={`flight-${result.outwardGuid}`}
123
+ item={result.outward}
124
+ onSelect={() => dispatch(setSelectedOutwardKey(getFlightKey(result.outward.segments)))}
125
+ guid={result.outwardGuid}
126
+ isOutward={true}
127
+ price={result.price}
128
+ currentSelectedPrice={selectedOutward?.price}
129
+ selectedGuid={selectedOutward?.outwardGuid}
130
+ showSelectedState={true}
131
+ />
132
+ ))}
133
+ {flyInType == 'flight-return-results' &&
134
+ uniqueReturnFlights.map((result) => (
135
+ <IndependentFlightOption
136
+ key={`flight-${result.outwardGuid}`}
137
+ item={result.return}
138
+ onSelect={() => dispatch(setSelectedReturnKey(getFlightKey(result.return.segments)))}
139
+ guid={result.outwardGuid}
140
+ isOutward={false}
141
+ price={result.price}
142
+ currentSelectedPrice={selectedReturn?.price}
143
+ selectedGuid={selectedReturn?.outwardGuid}
144
+ showSelectedState={true}
145
+ />
146
+ ))}
147
+ </div>
148
+ </div>
149
+ </>
150
+ )}
151
+ </div>
152
+ <div className="flyin__footer">
153
+ <div className="flyin__footer__price"></div>
154
+ <div className="flyin__button-wrapper">
155
+ <button className="cta cta--select" onClick={() => handleConfirm()}>
156
+ {translations.QSM.CONFIRM}
157
+ </button>
158
+ </div>
159
+ </div>
160
+ </>
161
+ );
162
+ };
163
+
164
+ export default PackageingFlightsFlyIn;
@@ -537,6 +537,20 @@
537
537
  }
538
538
  }
539
539
  }
540
+
541
+ &--columns {
542
+ display: flex;
543
+ gap: 10px;
544
+
545
+ .search__results__wrapper {
546
+ width: 100%;
547
+ }
548
+
549
+ .search__results__cards {
550
+ grid-template-rows: auto;
551
+ align-content: flex-start;
552
+ }
553
+ }
540
554
  }
541
555
 
542
556
  &__button {
@@ -601,6 +615,8 @@
601
615
 
602
616
  background: var(--tide-booking-white);
603
617
 
618
+ z-index: 1;
619
+
604
620
  @include mixins.media-sm {
605
621
  margin-top: auto;
606
622
  padding: 30px;
@@ -361,9 +361,12 @@
361
361
  }
362
362
 
363
363
  &__prices {
364
- padding: 0 20px;
365
364
  display: flex;
366
365
  flex-direction: column;
366
+ justify-content: center;
367
+
368
+ height: 173.5px;
369
+ padding: 0 20px;
367
370
 
368
371
  &__wrapper {
369
372
  padding: 20px 0px;