@qite/tide-booking-component 1.0.9 → 1.0.10

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.
@@ -10350,6 +10350,7 @@ var OptionsForm = function () {
10350
10350
  travellers = _b.travellers,
10351
10351
  loaderComponent = _b.loaderComponent;
10352
10352
  var dispatch = useAppDispatch();
10353
+ var packageDetails = reactRedux.useSelector(selectPackageDetails);
10353
10354
  var requestRooms = reactRedux.useSelector(selectRequestRooms);
10354
10355
  var requestRoomsPax =
10355
10356
  requestRooms === null || requestRooms === void 0
@@ -10464,6 +10465,60 @@ var OptionsForm = function () {
10464
10465
  }
10465
10466
  };
10466
10467
  React.useEffect(function () {
10468
+ var _a, _b;
10469
+ if (packageDetails) {
10470
+ var params = new URLSearchParams(location.search);
10471
+ var outwardFlight_1 =
10472
+ (_a = params.get("outwardflight")) !== null && _a !== void 0
10473
+ ? _a
10474
+ : undefined;
10475
+ var returnFlight_1 =
10476
+ (_b = params.get("returnflight")) !== null && _b !== void 0
10477
+ ? _b
10478
+ : undefined;
10479
+ if (outwardFlight_1 && returnFlight_1) {
10480
+ var desiredOutwardFlight_1 = packageDetails.outwardFlights.find(
10481
+ function (x) {
10482
+ return x.entryLineGuid == outwardFlight_1;
10483
+ }
10484
+ );
10485
+ var desiredReturnFlight_1 = packageDetails.returnFlights.find(function (
10486
+ x
10487
+ ) {
10488
+ return x.entryLineGuid == returnFlight_1;
10489
+ });
10490
+ if (desiredOutwardFlight_1 && desiredReturnFlight_1) {
10491
+ dispatch(
10492
+ setPackage(
10493
+ __assign(__assign({}, packageDetails), {
10494
+ outwardFlights: packageDetails.outwardFlights.map(function (
10495
+ flight
10496
+ ) {
10497
+ return __assign(__assign({}, flight), {
10498
+ isSelected:
10499
+ flight.entryLineGuid ==
10500
+ desiredOutwardFlight_1.entryLineGuid
10501
+ ? true
10502
+ : false,
10503
+ });
10504
+ }),
10505
+ returnFlights: packageDetails.returnFlights.map(function (
10506
+ flight
10507
+ ) {
10508
+ return __assign(__assign({}, flight), {
10509
+ isSelected:
10510
+ flight.entryLineGuid ==
10511
+ desiredReturnFlight_1.entryLineGuid
10512
+ ? true
10513
+ : false,
10514
+ });
10515
+ }),
10516
+ })
10517
+ )
10518
+ );
10519
+ }
10520
+ }
10521
+ }
10467
10522
  dispatch(fetchPriceDetails$1());
10468
10523
  }, []);
10469
10524
  return React__default["default"].createElement(
@@ -10290,6 +10290,7 @@ var OptionsForm = function () {
10290
10290
  travellers = _b.travellers,
10291
10291
  loaderComponent = _b.loaderComponent;
10292
10292
  var dispatch = useAppDispatch();
10293
+ var packageDetails = useSelector(selectPackageDetails);
10293
10294
  var requestRooms = useSelector(selectRequestRooms);
10294
10295
  var requestRoomsPax =
10295
10296
  requestRooms === null || requestRooms === void 0
@@ -10402,6 +10403,60 @@ var OptionsForm = function () {
10402
10403
  }
10403
10404
  };
10404
10405
  useEffect(function () {
10406
+ var _a, _b;
10407
+ if (packageDetails) {
10408
+ var params = new URLSearchParams(location.search);
10409
+ var outwardFlight_1 =
10410
+ (_a = params.get("outwardflight")) !== null && _a !== void 0
10411
+ ? _a
10412
+ : undefined;
10413
+ var returnFlight_1 =
10414
+ (_b = params.get("returnflight")) !== null && _b !== void 0
10415
+ ? _b
10416
+ : undefined;
10417
+ if (outwardFlight_1 && returnFlight_1) {
10418
+ var desiredOutwardFlight_1 = packageDetails.outwardFlights.find(
10419
+ function (x) {
10420
+ return x.entryLineGuid == outwardFlight_1;
10421
+ }
10422
+ );
10423
+ var desiredReturnFlight_1 = packageDetails.returnFlights.find(function (
10424
+ x
10425
+ ) {
10426
+ return x.entryLineGuid == returnFlight_1;
10427
+ });
10428
+ if (desiredOutwardFlight_1 && desiredReturnFlight_1) {
10429
+ dispatch(
10430
+ setPackage(
10431
+ __assign(__assign({}, packageDetails), {
10432
+ outwardFlights: packageDetails.outwardFlights.map(function (
10433
+ flight
10434
+ ) {
10435
+ return __assign(__assign({}, flight), {
10436
+ isSelected:
10437
+ flight.entryLineGuid ==
10438
+ desiredOutwardFlight_1.entryLineGuid
10439
+ ? true
10440
+ : false,
10441
+ });
10442
+ }),
10443
+ returnFlights: packageDetails.returnFlights.map(function (
10444
+ flight
10445
+ ) {
10446
+ return __assign(__assign({}, flight), {
10447
+ isSelected:
10448
+ flight.entryLineGuid ==
10449
+ desiredReturnFlight_1.entryLineGuid
10450
+ ? true
10451
+ : false,
10452
+ });
10453
+ }),
10454
+ })
10455
+ )
10456
+ );
10457
+ }
10458
+ }
10459
+ }
10405
10460
  dispatch(fetchPriceDetails$1());
10406
10461
  }, []);
10407
10462
  return React.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "React BookingWizard component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -4,6 +4,7 @@ import SettingsContext from "../../settings-context";
4
4
  import { isEmpty } from "lodash";
5
5
  import { navigate } from "@reach/router";
6
6
  import {
7
+ setPackage,
7
8
  setPackageGroups,
8
9
  setPackageOptionPax,
9
10
  setPackageOptionUnits,
@@ -14,6 +15,7 @@ import {
14
15
  selectBookingPackagePax,
15
16
  selectBookingQueryString,
16
17
  selectIsFetchingProductOptions,
18
+ selectPackageDetails,
17
19
  selectPackageGroups,
18
20
  selectPackageOptionPax,
19
21
  selectPackageOptionUnits,
@@ -34,6 +36,7 @@ import {
34
36
  BookingOptionGroup,
35
37
  BookingOptionPax,
36
38
  BookingOptionUnit,
39
+ BookingPackageFlight,
37
40
  PerBookingPackageOption,
38
41
  } from "@qite/tide-client/build/types";
39
42
  import OptionUnitsCard from "./option-units-card";
@@ -45,6 +48,7 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
45
48
  const { basePath, travellers, loaderComponent } = useContext(SettingsContext);
46
49
 
47
50
  const dispatch = useAppDispatch();
51
+ const packageDetails = useSelector(selectPackageDetails);
48
52
  const requestRooms = useSelector(selectRequestRooms);
49
53
  const requestRoomsPax = requestRooms?.flatMap((x) => x.pax);
50
54
  const pax = useSelector(selectBookingPackagePax);
@@ -141,6 +145,45 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
141
145
  };
142
146
 
143
147
  useEffect(() => {
148
+ if (packageDetails) {
149
+ const params = new URLSearchParams(location.search);
150
+
151
+ const outwardFlight = params.get("outwardflight") ?? undefined;
152
+ const returnFlight = params.get("returnflight") ?? undefined;
153
+ if (outwardFlight && returnFlight) {
154
+ const desiredOutwardFlight = packageDetails.outwardFlights.find(
155
+ (x) => x.entryLineGuid == outwardFlight
156
+ );
157
+ const desiredReturnFlight = packageDetails.returnFlights.find(
158
+ (x) => x.entryLineGuid == returnFlight
159
+ );
160
+ if (desiredOutwardFlight && desiredReturnFlight) {
161
+ dispatch(
162
+ setPackage({
163
+ ...packageDetails,
164
+ outwardFlights: packageDetails.outwardFlights.map((flight) => {
165
+ return {
166
+ ...flight,
167
+ isSelected:
168
+ flight.entryLineGuid == desiredOutwardFlight.entryLineGuid
169
+ ? true
170
+ : false,
171
+ } as BookingPackageFlight;
172
+ }),
173
+ returnFlights: packageDetails.returnFlights.map((flight) => {
174
+ return {
175
+ ...flight,
176
+ isSelected:
177
+ flight.entryLineGuid == desiredReturnFlight.entryLineGuid
178
+ ? true
179
+ : false,
180
+ } as BookingPackageFlight;
181
+ }),
182
+ })
183
+ );
184
+ }
185
+ }
186
+ }
144
187
  dispatch(fetchPriceDetails());
145
188
  }, []);
146
189