@qite/tide-booking-component 1.4.12 → 1.4.14

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.
@@ -149,20 +149,18 @@ export declare const selectRoomOptionReturnFlightsMetaData: ((state: {
149
149
  priceDetails: import("../price-details/price-details-slice").PriceDetailsState;
150
150
  summary: import("../summary/summary-slice").SummaryState;
151
151
  apiSettings: import("../../../shared/types").ApiSettingsState;
152
- }) => (
153
- | import("@qite/tide-client").BookingPackageFlightMetaData
154
- | undefined
155
- )[]) &
152
+ }) =>
153
+ | (import("@qite/tide-client").BookingPackageFlightMetaData | undefined)[]
154
+ | undefined) &
156
155
  import("reselect").OutputSelectorFields<
157
156
  (
158
157
  args_0: import("@qite/tide-client").BookingPackageOption | undefined,
159
158
  args_1:
160
159
  | import("@qite/tide-client").BookingPackageEntryLineFlightMetaData[]
161
160
  | undefined
162
- ) => (
163
- | import("@qite/tide-client").BookingPackageFlightMetaData
164
- | undefined
165
- )[],
161
+ ) =>
162
+ | (import("@qite/tide-client").BookingPackageFlightMetaData | undefined)[]
163
+ | undefined,
166
164
  {
167
165
  clearCache: () => void;
168
166
  }
@@ -12442,42 +12442,60 @@ var selectRoomOptionReturnFlightsMetaData = toolkit.createSelector(
12442
12442
  selectFlightMetaData,
12443
12443
  function (ativeOption, flightMetaData) {
12444
12444
  var _a;
12445
- var roomOptions =
12445
+ var selectedRoomOptions =
12446
12446
  ativeOption === null || ativeOption === void 0
12447
12447
  ? void 0
12448
12448
  : ativeOption.rooms.map(function (r) {
12449
- return r.options
12450
- .filter(function (o) {
12451
- return o.isSelected;
12452
- })
12453
- .reverse()
12454
- .shift();
12449
+ return r.options.filter(function (o) {
12450
+ return o.isSelected;
12451
+ });
12455
12452
  });
12456
- return (_a =
12457
- roomOptions === null || roomOptions === void 0
12453
+ // check if there are return flights selected
12454
+ if (
12455
+ selectedRoomOptions === null || selectedRoomOptions === void 0
12458
12456
  ? void 0
12459
- : roomOptions
12460
- .map(function (ro) {
12461
- var _a;
12462
- return (_a =
12463
- flightMetaData === null || flightMetaData === void 0
12457
+ : selectedRoomOptions.some(function (ro) {
12458
+ return ro.length > 1;
12459
+ })
12460
+ ) {
12461
+ var roomOptions =
12462
+ ativeOption === null || ativeOption === void 0
12463
+ ? void 0
12464
+ : ativeOption.rooms.map(function (r) {
12465
+ return r.options
12466
+ .filter(function (o) {
12467
+ return o.isSelected;
12468
+ })
12469
+ .reverse()
12470
+ .shift();
12471
+ });
12472
+ return (_a =
12473
+ roomOptions === null || roomOptions === void 0
12474
+ ? void 0
12475
+ : roomOptions
12476
+ .map(function (ro) {
12477
+ var _a;
12478
+ return (_a =
12479
+ flightMetaData === null || flightMetaData === void 0
12480
+ ? void 0
12481
+ : flightMetaData.find(function (f) {
12482
+ return (
12483
+ f.entryLineGuid ===
12484
+ (ro === null || ro === void 0
12485
+ ? void 0
12486
+ : ro.entryLineGuid)
12487
+ );
12488
+ })) === null || _a === void 0
12464
12489
  ? void 0
12465
- : flightMetaData.find(function (f) {
12466
- return (
12467
- f.entryLineGuid ===
12468
- (ro === null || ro === void 0
12469
- ? void 0
12470
- : ro.entryLineGuid)
12471
- );
12472
- })) === null || _a === void 0
12473
- ? void 0
12474
- : _a.flightMetaData;
12475
- })
12476
- .filter(function (f) {
12477
- return f !== undefined;
12478
- })) !== null && _a !== void 0
12479
- ? _a
12480
- : [];
12490
+ : _a.flightMetaData;
12491
+ })
12492
+ .filter(function (f) {
12493
+ return f !== undefined;
12494
+ })) !== null && _a !== void 0
12495
+ ? _a
12496
+ : [];
12497
+ }
12498
+ return undefined;
12481
12499
  }
12482
12500
  );
12483
12501
  var selectApiSettings = function (state) {
@@ -20912,19 +20930,16 @@ var Sidebar = function (_a) {
20912
20930
  isLoading && loaderComponent,
20913
20931
  !isLoading &&
20914
20932
  departureFlightMetaData &&
20933
+ React__default["default"].createElement(SidebarFlight, {
20934
+ title: translations.SIDEBAR.DEPARTURE_FLIGHT,
20935
+ flightMetaData: departureFlightMetaData,
20936
+ }),
20937
+ !isLoading &&
20915
20938
  returnFlightMetaData &&
20916
- React__default["default"].createElement(
20917
- React__default["default"].Fragment,
20918
- null,
20919
- React__default["default"].createElement(SidebarFlight, {
20920
- title: translations.SIDEBAR.DEPARTURE_FLIGHT,
20921
- flightMetaData: departureFlightMetaData,
20922
- }),
20923
- React__default["default"].createElement(SidebarFlight, {
20924
- title: translations.SIDEBAR.ARRIVAL_FLIGHT,
20925
- flightMetaData: returnFlightMetaData,
20926
- })
20927
- ),
20939
+ React__default["default"].createElement(SidebarFlight, {
20940
+ title: translations.SIDEBAR.ARRIVAL_FLIGHT,
20941
+ flightMetaData: returnFlightMetaData,
20942
+ }),
20928
20943
  accommodations &&
20929
20944
  React__default["default"].createElement(
20930
20945
  "div",
@@ -22274,20 +22289,26 @@ var Summary = function () {
22274
22289
  { className: "list list--booking-summary" },
22275
22290
  (activeOption === null || activeOption === void 0
22276
22291
  ? void 0
22277
- : activeOption.serviceType) == build.ServiceType.flight &&
22278
- departureFlightMetaData &&
22279
- returnFlightMetaData
22292
+ : activeOption.serviceType) == build.ServiceType.flight
22280
22293
  ? React__default["default"].createElement(
22281
22294
  React__default["default"].Fragment,
22282
22295
  null,
22283
- React__default["default"].createElement(SummaryFlight, {
22284
- flightMetaData: departureFlightMetaData,
22285
- header: translations.SIDEBAR.DEPARTURE_FLIGHT,
22286
- }),
22287
- React__default["default"].createElement(SummaryFlight, {
22288
- flightMetaData: returnFlightMetaData,
22289
- header: translations.SIDEBAR.ARRIVAL_FLIGHT,
22290
- })
22296
+ departureFlightMetaData &&
22297
+ React__default["default"].createElement(
22298
+ SummaryFlight,
22299
+ {
22300
+ flightMetaData: departureFlightMetaData,
22301
+ header: translations.SIDEBAR.DEPARTURE_FLIGHT,
22302
+ }
22303
+ ),
22304
+ returnFlightMetaData &&
22305
+ React__default["default"].createElement(
22306
+ SummaryFlight,
22307
+ {
22308
+ flightMetaData: returnFlightMetaData,
22309
+ header: translations.SIDEBAR.ARRIVAL_FLIGHT,
22310
+ }
22311
+ )
22291
22312
  )
22292
22313
  : React__default["default"].createElement(
22293
22314
  React__default["default"].Fragment,
@@ -25313,8 +25334,23 @@ var Booking = function (_a) {
25313
25334
  );
25314
25335
  React.useEffect(
25315
25336
  function () {
25316
- var next = { productCode: productCode, productName: productName };
25317
- if (!lodash.isNil(productCode) && !lodash.isNil(productName)) {
25337
+ var _a, _b;
25338
+ var params = new URLSearchParams(location.search);
25339
+ var foundproductCode =
25340
+ (_a = getStringFromParams(params, "productCode")) !== null &&
25341
+ _a !== void 0
25342
+ ? _a
25343
+ : productCode;
25344
+ var foundproductName =
25345
+ (_b = getStringFromParams(params, "productName")) !== null &&
25346
+ _b !== void 0
25347
+ ? _b
25348
+ : productName;
25349
+ var next = {
25350
+ productCode: foundproductCode,
25351
+ productName: foundproductName,
25352
+ };
25353
+ if (!lodash.isNil(foundproductCode) && !lodash.isNil(foundproductName)) {
25318
25354
  if (!lodash.isEqual(productAttributes, next)) {
25319
25355
  dispatch(setProductAttributes(next));
25320
25356
  }
@@ -25326,7 +25362,7 @@ var Booking = function (_a) {
25326
25362
  );
25327
25363
  }
25328
25364
  },
25329
- [productCode, productName, setProductAttributes]
25365
+ [location.search, productCode, productName, setProductAttributes]
25330
25366
  );
25331
25367
  var getTranslations = function () {
25332
25368
  return __awaiter(void 0, void 0, void 0, function () {
@@ -149,20 +149,18 @@ export declare const selectRoomOptionReturnFlightsMetaData: ((state: {
149
149
  priceDetails: import("../price-details/price-details-slice").PriceDetailsState;
150
150
  summary: import("../summary/summary-slice").SummaryState;
151
151
  apiSettings: import("../../../shared/types").ApiSettingsState;
152
- }) => (
153
- | import("@qite/tide-client").BookingPackageFlightMetaData
154
- | undefined
155
- )[]) &
152
+ }) =>
153
+ | (import("@qite/tide-client").BookingPackageFlightMetaData | undefined)[]
154
+ | undefined) &
156
155
  import("reselect").OutputSelectorFields<
157
156
  (
158
157
  args_0: import("@qite/tide-client").BookingPackageOption | undefined,
159
158
  args_1:
160
159
  | import("@qite/tide-client").BookingPackageEntryLineFlightMetaData[]
161
160
  | undefined
162
- ) => (
163
- | import("@qite/tide-client").BookingPackageFlightMetaData
164
- | undefined
165
- )[],
161
+ ) =>
162
+ | (import("@qite/tide-client").BookingPackageFlightMetaData | undefined)[]
163
+ | undefined,
166
164
  {
167
165
  clearCache: () => void;
168
166
  }
@@ -12443,42 +12443,60 @@ var selectRoomOptionReturnFlightsMetaData = createSelector(
12443
12443
  selectFlightMetaData,
12444
12444
  function (ativeOption, flightMetaData) {
12445
12445
  var _a;
12446
- var roomOptions =
12446
+ var selectedRoomOptions =
12447
12447
  ativeOption === null || ativeOption === void 0
12448
12448
  ? void 0
12449
12449
  : ativeOption.rooms.map(function (r) {
12450
- return r.options
12451
- .filter(function (o) {
12452
- return o.isSelected;
12453
- })
12454
- .reverse()
12455
- .shift();
12450
+ return r.options.filter(function (o) {
12451
+ return o.isSelected;
12452
+ });
12456
12453
  });
12457
- return (_a =
12458
- roomOptions === null || roomOptions === void 0
12454
+ // check if there are return flights selected
12455
+ if (
12456
+ selectedRoomOptions === null || selectedRoomOptions === void 0
12459
12457
  ? void 0
12460
- : roomOptions
12461
- .map(function (ro) {
12462
- var _a;
12463
- return (_a =
12464
- flightMetaData === null || flightMetaData === void 0
12458
+ : selectedRoomOptions.some(function (ro) {
12459
+ return ro.length > 1;
12460
+ })
12461
+ ) {
12462
+ var roomOptions =
12463
+ ativeOption === null || ativeOption === void 0
12464
+ ? void 0
12465
+ : ativeOption.rooms.map(function (r) {
12466
+ return r.options
12467
+ .filter(function (o) {
12468
+ return o.isSelected;
12469
+ })
12470
+ .reverse()
12471
+ .shift();
12472
+ });
12473
+ return (_a =
12474
+ roomOptions === null || roomOptions === void 0
12475
+ ? void 0
12476
+ : roomOptions
12477
+ .map(function (ro) {
12478
+ var _a;
12479
+ return (_a =
12480
+ flightMetaData === null || flightMetaData === void 0
12481
+ ? void 0
12482
+ : flightMetaData.find(function (f) {
12483
+ return (
12484
+ f.entryLineGuid ===
12485
+ (ro === null || ro === void 0
12486
+ ? void 0
12487
+ : ro.entryLineGuid)
12488
+ );
12489
+ })) === null || _a === void 0
12465
12490
  ? void 0
12466
- : flightMetaData.find(function (f) {
12467
- return (
12468
- f.entryLineGuid ===
12469
- (ro === null || ro === void 0
12470
- ? void 0
12471
- : ro.entryLineGuid)
12472
- );
12473
- })) === null || _a === void 0
12474
- ? void 0
12475
- : _a.flightMetaData;
12476
- })
12477
- .filter(function (f) {
12478
- return f !== undefined;
12479
- })) !== null && _a !== void 0
12480
- ? _a
12481
- : [];
12491
+ : _a.flightMetaData;
12492
+ })
12493
+ .filter(function (f) {
12494
+ return f !== undefined;
12495
+ })) !== null && _a !== void 0
12496
+ ? _a
12497
+ : [];
12498
+ }
12499
+ return undefined;
12482
12500
  }
12483
12501
  );
12484
12502
  var selectApiSettings = function (state) {
@@ -20643,19 +20661,16 @@ var Sidebar = function (_a) {
20643
20661
  isLoading && loaderComponent,
20644
20662
  !isLoading &&
20645
20663
  departureFlightMetaData &&
20664
+ React.createElement(SidebarFlight, {
20665
+ title: translations.SIDEBAR.DEPARTURE_FLIGHT,
20666
+ flightMetaData: departureFlightMetaData,
20667
+ }),
20668
+ !isLoading &&
20646
20669
  returnFlightMetaData &&
20647
- React.createElement(
20648
- React.Fragment,
20649
- null,
20650
- React.createElement(SidebarFlight, {
20651
- title: translations.SIDEBAR.DEPARTURE_FLIGHT,
20652
- flightMetaData: departureFlightMetaData,
20653
- }),
20654
- React.createElement(SidebarFlight, {
20655
- title: translations.SIDEBAR.ARRIVAL_FLIGHT,
20656
- flightMetaData: returnFlightMetaData,
20657
- })
20658
- ),
20670
+ React.createElement(SidebarFlight, {
20671
+ title: translations.SIDEBAR.ARRIVAL_FLIGHT,
20672
+ flightMetaData: returnFlightMetaData,
20673
+ }),
20659
20674
  accommodations &&
20660
20675
  React.createElement(
20661
20676
  "div",
@@ -21939,20 +21954,20 @@ var Summary = function () {
21939
21954
  { className: "list list--booking-summary" },
21940
21955
  (activeOption === null || activeOption === void 0
21941
21956
  ? void 0
21942
- : activeOption.serviceType) == build.ServiceType.flight &&
21943
- departureFlightMetaData &&
21944
- returnFlightMetaData
21957
+ : activeOption.serviceType) == build.ServiceType.flight
21945
21958
  ? React.createElement(
21946
21959
  React.Fragment,
21947
21960
  null,
21948
- React.createElement(SummaryFlight, {
21949
- flightMetaData: departureFlightMetaData,
21950
- header: translations.SIDEBAR.DEPARTURE_FLIGHT,
21951
- }),
21952
- React.createElement(SummaryFlight, {
21953
- flightMetaData: returnFlightMetaData,
21954
- header: translations.SIDEBAR.ARRIVAL_FLIGHT,
21955
- })
21961
+ departureFlightMetaData &&
21962
+ React.createElement(SummaryFlight, {
21963
+ flightMetaData: departureFlightMetaData,
21964
+ header: translations.SIDEBAR.DEPARTURE_FLIGHT,
21965
+ }),
21966
+ returnFlightMetaData &&
21967
+ React.createElement(SummaryFlight, {
21968
+ flightMetaData: returnFlightMetaData,
21969
+ header: translations.SIDEBAR.ARRIVAL_FLIGHT,
21970
+ })
21956
21971
  )
21957
21972
  : React.createElement(
21958
21973
  React.Fragment,
@@ -24871,8 +24886,23 @@ var Booking = function (_a) {
24871
24886
  );
24872
24887
  useEffect(
24873
24888
  function () {
24874
- var next = { productCode: productCode, productName: productName };
24875
- if (!isNil(productCode) && !isNil(productName)) {
24889
+ var _a, _b;
24890
+ var params = new URLSearchParams(location.search);
24891
+ var foundproductCode =
24892
+ (_a = getStringFromParams(params, "productCode")) !== null &&
24893
+ _a !== void 0
24894
+ ? _a
24895
+ : productCode;
24896
+ var foundproductName =
24897
+ (_b = getStringFromParams(params, "productName")) !== null &&
24898
+ _b !== void 0
24899
+ ? _b
24900
+ : productName;
24901
+ var next = {
24902
+ productCode: foundproductCode,
24903
+ productName: foundproductName,
24904
+ };
24905
+ if (!isNil(foundproductCode) && !isNil(foundproductName)) {
24876
24906
  if (!isEqual$1(productAttributes, next)) {
24877
24907
  dispatch(setProductAttributes(next));
24878
24908
  }
@@ -24884,7 +24914,7 @@ var Booking = function (_a) {
24884
24914
  );
24885
24915
  }
24886
24916
  },
24887
- [productCode, productName, setProductAttributes]
24917
+ [location.search, productCode, productName, setProductAttributes]
24888
24918
  );
24889
24919
  var getTranslations = function () {
24890
24920
  return __awaiter(void 0, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -200,8 +200,16 @@ const Booking: React.FC<BookingProps> = ({
200
200
  }, [isRetry]);
201
201
 
202
202
  useEffect(() => {
203
- const next = { productCode, productName };
204
- if (!isNil(productCode) && !isNil(productName)) {
203
+ const params = new URLSearchParams(location.search);
204
+ const foundproductCode =
205
+ getStringFromParams(params, "productCode") ?? productCode;
206
+ const foundproductName =
207
+ getStringFromParams(params, "productName") ?? productName;
208
+ const next = {
209
+ productCode: foundproductCode,
210
+ productName: foundproductName,
211
+ };
212
+ if (!isNil(foundproductCode) && !isNil(foundproductName)) {
205
213
  if (!isEqual(productAttributes, next)) {
206
214
  dispatch(setProductAttributes(next));
207
215
  }
@@ -212,7 +220,7 @@ const Booking: React.FC<BookingProps> = ({
212
220
  productName
213
221
  );
214
222
  }
215
- }, [productCode, productName, setProductAttributes]);
223
+ }, [location.search, productCode, productName, setProductAttributes]);
216
224
 
217
225
  const getTranslations = async () => {
218
226
  const translations = translationFiles?.map((x) =>
@@ -120,21 +120,28 @@ export const selectRoomOptionReturnFlightsMetaData = createSelector(
120
120
  selectActiveOption,
121
121
  selectFlightMetaData,
122
122
  (ativeOption, flightMetaData) => {
123
- const roomOptions = ativeOption?.rooms.map((r) =>
124
- r.options
125
- .filter((o) => o.isSelected)
126
- .reverse()
127
- .shift()
128
- );
129
- return (
130
- roomOptions
131
- ?.map(
132
- (ro) =>
133
- flightMetaData?.find((f) => f.entryLineGuid === ro?.entryLineGuid)
134
- ?.flightMetaData
135
- )
136
- .filter((f) => f !== undefined) ?? []
123
+ const selectedRoomOptions = ativeOption?.rooms.map((r) =>
124
+ r.options.filter((o) => o.isSelected)
137
125
  );
126
+ // check if there are return flights selected
127
+ if (selectedRoomOptions?.some((ro) => ro.length > 1)) {
128
+ const roomOptions = ativeOption?.rooms.map((r) =>
129
+ r.options
130
+ .filter((o) => o.isSelected)
131
+ .reverse()
132
+ .shift()
133
+ );
134
+ return (
135
+ roomOptions
136
+ ?.map(
137
+ (ro) =>
138
+ flightMetaData?.find((f) => f.entryLineGuid === ro?.entryLineGuid)
139
+ ?.flightMetaData
140
+ )
141
+ .filter((f) => f !== undefined) ?? []
142
+ );
143
+ }
144
+ return undefined;
138
145
  }
139
146
  );
140
147
 
@@ -143,20 +143,19 @@ const Sidebar: React.FC<SidebarProps> = ({
143
143
  </div>
144
144
 
145
145
  {isLoading && loaderComponent}
146
- {!isLoading &&
147
- departureFlightMetaData &&
148
- returnFlightMetaData && (
149
- <>
150
- <SidebarFlight
151
- title={translations.SIDEBAR.DEPARTURE_FLIGHT}
152
- flightMetaData={departureFlightMetaData}
153
- />
154
- <SidebarFlight
155
- title={translations.SIDEBAR.ARRIVAL_FLIGHT}
156
- flightMetaData={returnFlightMetaData}
157
- />
158
- </>
159
- )}
146
+ {!isLoading && departureFlightMetaData && (
147
+ <SidebarFlight
148
+ title={translations.SIDEBAR.DEPARTURE_FLIGHT}
149
+ flightMetaData={departureFlightMetaData}
150
+ />
151
+ )}
152
+
153
+ {!isLoading && returnFlightMetaData && (
154
+ <SidebarFlight
155
+ title={translations.SIDEBAR.ARRIVAL_FLIGHT}
156
+ flightMetaData={returnFlightMetaData}
157
+ />
158
+ )}
160
159
 
161
160
  {accommodations && (
162
161
  <div className="pricing-summary__group">
@@ -400,18 +400,20 @@ const Summary: React.FC<SummaryProps> = () => {
400
400
  <div className="form__row">
401
401
  <div className="form__group">
402
402
  <ul className="list list--booking-summary">
403
- {activeOption?.serviceType == ServiceType.flight &&
404
- departureFlightMetaData &&
405
- returnFlightMetaData ? (
403
+ {activeOption?.serviceType == ServiceType.flight ? (
406
404
  <>
407
- <SummaryFlight
408
- flightMetaData={departureFlightMetaData}
409
- header={translations.SIDEBAR.DEPARTURE_FLIGHT}
410
- />
411
- <SummaryFlight
412
- flightMetaData={returnFlightMetaData}
413
- header={translations.SIDEBAR.ARRIVAL_FLIGHT}
414
- />
405
+ {departureFlightMetaData && (
406
+ <SummaryFlight
407
+ flightMetaData={departureFlightMetaData}
408
+ header={translations.SIDEBAR.DEPARTURE_FLIGHT}
409
+ />
410
+ )}
411
+ {returnFlightMetaData && (
412
+ <SummaryFlight
413
+ flightMetaData={returnFlightMetaData}
414
+ header={translations.SIDEBAR.ARRIVAL_FLIGHT}
415
+ />
416
+ )}
415
417
  </>
416
418
  ) : (
417
419
  <>