@qite/tide-booking-component 1.0.6 → 1.0.8

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.
@@ -26,6 +26,11 @@ export declare const selectPackageRooms: (
26
26
  ) =>
27
27
  | import("@qite/tide-client/build/types/offer").BookingPackageRoom[]
28
28
  | undefined;
29
+ export declare const selectPackageTags: (
30
+ state: RootState
31
+ ) =>
32
+ | import("@qite/tide-client/build/types/offer/booking-v2/shared/booking-package-tag").BookingPackageTag[]
33
+ | undefined;
29
34
  export declare const selectIsOnRequest: (
30
35
  state: RootState
31
36
  ) => boolean | undefined;
@@ -220,6 +220,17 @@ var AvailabilitySearchType = {
220
220
  allotment: 1,
221
221
  };
222
222
 
223
+ var EntryStatus;
224
+ (function (EntryStatus) {
225
+ EntryStatus[(EntryStatus["new"] = -1)] = "new";
226
+ EntryStatus[(EntryStatus["offer"] = 0)] = "offer";
227
+ EntryStatus[(EntryStatus["option"] = 1)] = "option";
228
+ EntryStatus[(EntryStatus["booking"] = 2)] = "booking";
229
+ EntryStatus[(EntryStatus["cancellationByClient"] = 3)] =
230
+ "cancellationByClient";
231
+ EntryStatus[(EntryStatus["cancellationByYou"] = 4)] = "cancellationByYou";
232
+ })(EntryStatus || (EntryStatus = {}));
233
+
223
234
  var Gender = {
224
235
  male: 0,
225
236
  female: 1,
@@ -473,6 +484,7 @@ var get$1 = function (url, apiKey, signal) {
473
484
  headers: {
474
485
  "Api-Key": apiKey,
475
486
  },
487
+ credentials: "include",
476
488
  signal: signal,
477
489
  }),
478
490
  ];
@@ -7224,6 +7236,12 @@ var selectPackageRooms = function (state) {
7224
7236
  ? void 0
7225
7237
  : _b.rooms;
7226
7238
  };
7239
+ var selectPackageTags = function (state) {
7240
+ var _a;
7241
+ return (_a = state.booking.package) === null || _a === void 0
7242
+ ? void 0
7243
+ : _a.tags;
7244
+ };
7227
7245
  var selectIsOnRequest = function (state) {
7228
7246
  var _a, _b;
7229
7247
  return (_b =
@@ -10326,10 +10344,11 @@ var OptionBookingGroup = function (_a) {
10326
10344
  };
10327
10345
 
10328
10346
  var OptionsForm = function () {
10329
- var _a = React.useContext(SettingsContext),
10330
- basePath = _a.basePath,
10331
- travellers = _a.travellers,
10332
- loaderComponent = _a.loaderComponent;
10347
+ var _a;
10348
+ var _b = React.useContext(SettingsContext),
10349
+ basePath = _b.basePath,
10350
+ travellers = _b.travellers,
10351
+ loaderComponent = _b.loaderComponent;
10333
10352
  var dispatch = useAppDispatch();
10334
10353
  var requestRooms = reactRedux.useSelector(selectRequestRooms);
10335
10354
  var requestRoomsPax =
@@ -10345,6 +10364,11 @@ var OptionsForm = function () {
10345
10364
  var groups = reactRedux.useSelector(selectPackageGroups);
10346
10365
  var optionUnits = reactRedux.useSelector(selectPackageOptionUnits);
10347
10366
  var optionPax = reactRedux.useSelector(selectPackageOptionPax);
10367
+ var packageTags = reactRedux.useSelector(selectPackageTags);
10368
+ var tagIds =
10369
+ (_a = reactRedux.useSelector(selectTagIds)) !== null && _a !== void 0
10370
+ ? _a
10371
+ : [];
10348
10372
  if (!packageRooms) {
10349
10373
  router.navigate("".concat(basePath, "?").concat(bookingQueryString));
10350
10374
  }
@@ -10396,6 +10420,29 @@ var OptionsForm = function () {
10396
10420
  dispatch(setPackageRooms(updatedPackageRooms));
10397
10421
  dispatch(fetchPriceDetails$1());
10398
10422
  };
10423
+ var handleOnTagChange = function (id, checked) {
10424
+ var updatedTags = __spreadArray([], tagIds, true);
10425
+ if (checked) {
10426
+ if (
10427
+ !(updatedTags === null || updatedTags === void 0
10428
+ ? void 0
10429
+ : updatedTags.includes(id))
10430
+ ) {
10431
+ updatedTags === null || updatedTags === void 0
10432
+ ? void 0
10433
+ : updatedTags.push(id);
10434
+ }
10435
+ } else {
10436
+ updatedTags =
10437
+ updatedTags === null || updatedTags === void 0
10438
+ ? void 0
10439
+ : updatedTags.filter(function (x) {
10440
+ return x != id;
10441
+ });
10442
+ }
10443
+ dispatch(setTagIds(updatedTags));
10444
+ dispatch(fetchPriceDetails$1());
10445
+ };
10399
10446
  var handleOnPaxChange = function (pax) {
10400
10447
  dispatch(setPackageOptionPax(pax));
10401
10448
  dispatch(fetchPriceDetails$1());
@@ -10481,6 +10528,57 @@ var OptionsForm = function () {
10481
10528
  );
10482
10529
  })
10483
10530
  )
10531
+ ),
10532
+ React__default["default"].createElement(
10533
+ "div",
10534
+ { className: "booking-card__tag-translations" },
10535
+ packageTags &&
10536
+ packageTags.map(function (tag, index) {
10537
+ return React__default["default"].createElement(
10538
+ "label",
10539
+ {
10540
+ key: index,
10541
+ htmlFor: "tag-translation-"
10542
+ .concat(index, "-")
10543
+ .concat(tag.title),
10544
+ className: "checkbox__label tag-translation",
10545
+ },
10546
+ React__default["default"].createElement(
10547
+ "div",
10548
+ { className: "tag-translation-input__container" },
10549
+ React__default["default"].createElement("input", {
10550
+ type: "checkbox",
10551
+ id: "tag-translation-"
10552
+ .concat(index, "-")
10553
+ .concat(tag.title),
10554
+ name: "tag-translation-"
10555
+ .concat(index, "-")
10556
+ .concat(tag.title),
10557
+ className: "checkbox__input",
10558
+ checked:
10559
+ tagIds === null || tagIds === void 0
10560
+ ? void 0
10561
+ : tagIds.includes(tag.id),
10562
+ onChange: function (e) {
10563
+ return handleOnTagChange(
10564
+ tag.id,
10565
+ e.target.checked
10566
+ );
10567
+ },
10568
+ })
10569
+ ),
10570
+ React__default["default"].createElement(
10571
+ "span",
10572
+ { className: "tag-translation__title" },
10573
+ tag.title
10574
+ ),
10575
+ React__default["default"].createElement(
10576
+ "span",
10577
+ { className: "tag-translation__description" },
10578
+ tag.description
10579
+ )
10580
+ );
10581
+ })
10484
10582
  )
10485
10583
  )
10486
10584
  )
@@ -10590,15 +10688,6 @@ var OptionsForm = function () {
10590
10688
  React__default["default"].createElement(
10591
10689
  "div",
10592
10690
  { className: "booking__navigator" },
10593
- React__default["default"].createElement(
10594
- router.Link,
10595
- {
10596
- to: "".concat(basePath, "?").concat(bookingQueryString),
10597
- title: translations.STEPS.PREVIOUS,
10598
- className: "cta cta--secondary",
10599
- },
10600
- translations.STEPS.PREVIOUS
10601
- ),
10602
10691
  React__default["default"].createElement(
10603
10692
  "button",
10604
10693
  {
@@ -12368,10 +12457,13 @@ var Summary = function () {
12368
12457
  React__default["default"].createElement(
12369
12458
  React__default["default"].Fragment,
12370
12459
  null,
12371
- notifications
12372
- .filter(function (x) {
12373
- return !x.hasToBeConfirmed;
12374
- })
12460
+ lodash
12461
+ .uniqBy(
12462
+ notifications.filter(function (x) {
12463
+ return !x.hasToBeConfirmed;
12464
+ }),
12465
+ "id"
12466
+ )
12375
12467
  .map(function (notification) {
12376
12468
  return React__default["default"].createElement(
12377
12469
  "span",
@@ -12393,10 +12485,13 @@ var Summary = function () {
12393
12485
  )
12394
12486
  );
12395
12487
  }),
12396
- notifications
12397
- .filter(function (x) {
12398
- return x.hasToBeConfirmed;
12399
- })
12488
+ lodash
12489
+ .uniqBy(
12490
+ notifications.filter(function (x) {
12491
+ return x.hasToBeConfirmed;
12492
+ }),
12493
+ "id"
12494
+ )
12400
12495
  .map(function (notification) {
12401
12496
  return React__default["default"].createElement(
12402
12497
  "div",
@@ -12547,7 +12642,7 @@ var Summary = function () {
12547
12642
  {
12548
12643
  to: ""
12549
12644
  .concat(settings.basePath)
12550
- .concat(settings.options.pathSuffix, "?")
12645
+ .concat(settings.travellers.pathSuffix, "?")
12551
12646
  .concat(bookingQueryString),
12552
12647
  title: translations.STEPS.PREVIOUS,
12553
12648
  className: "cta cta--secondary",
@@ -13009,7 +13104,9 @@ var TravelersForm = function () {
13009
13104
  function (values) {
13010
13105
  values.adults = adultIds.map(function (id) {
13011
13106
  var _a;
13012
- return (_a = values.adults[id]) !== null && _a !== void 0
13107
+ return (_a = values.adults.find(function (x) {
13108
+ return x.id == id;
13109
+ })) !== null && _a !== void 0
13013
13110
  ? _a
13014
13111
  : createTraveler(id);
13015
13112
  });
@@ -13035,7 +13132,9 @@ var TravelersForm = function () {
13035
13132
  function (values) {
13036
13133
  values.children = childIds.map(function (id) {
13037
13134
  var _a;
13038
- return (_a = values.children[id]) !== null && _a !== void 0
13135
+ return (_a = values.children.find(function (x) {
13136
+ return x.id == id;
13137
+ })) !== null && _a !== void 0
13039
13138
  ? _a
13040
13139
  : createTraveler(id);
13041
13140
  });
@@ -13731,6 +13830,15 @@ var TravelersForm = function () {
13731
13830
  React__default["default"].createElement(
13732
13831
  "div",
13733
13832
  { className: "booking__navigator" },
13833
+ React__default["default"].createElement(
13834
+ router.Link,
13835
+ {
13836
+ to: "".concat(settings.basePath, "?").concat(bookingQueryString),
13837
+ title: translations.STEPS.PREVIOUS,
13838
+ className: "cta cta--secondary",
13839
+ },
13840
+ translations.STEPS.PREVIOUS
13841
+ ),
13734
13842
  React__default["default"].createElement(
13735
13843
  "button",
13736
13844
  { type: "submit", title: translations.STEPS.NEXT, className: "cta" },
@@ -13803,6 +13911,9 @@ var Booking = function (_a) {
13803
13911
  (_a = params.get("bookingNr")) !== null && _a !== void 0
13804
13912
  ? _a
13805
13913
  : undefined;
13914
+ if (typeof window !== "undefined") {
13915
+ window.scrollTo(0, 0);
13916
+ }
13806
13917
  if (!lodash.isNil(bookingNumber)) {
13807
13918
  dispatch(setBookingNumber(bookingNumber));
13808
13919
  router.navigate(
@@ -26,6 +26,11 @@ export declare const selectPackageRooms: (
26
26
  ) =>
27
27
  | import("@qite/tide-client/build/types/offer").BookingPackageRoom[]
28
28
  | undefined;
29
+ export declare const selectPackageTags: (
30
+ state: RootState
31
+ ) =>
32
+ | import("@qite/tide-client/build/types/offer/booking-v2/shared/booking-package-tag").BookingPackageTag[]
33
+ | undefined;
29
34
  export declare const selectIsOnRequest: (
30
35
  state: RootState
31
36
  ) => boolean | undefined;
@@ -33,7 +33,7 @@ import {
33
33
  differenceInCalendarDays,
34
34
  parse,
35
35
  } from "date-fns";
36
- import { navigate, Link, useLocation, Router } from "@reach/router";
36
+ import { navigate, useLocation, Link, Router } from "@reach/router";
37
37
  import flat from "flat";
38
38
  import produce from "immer";
39
39
  import { useFormik } from "formik";
@@ -235,6 +235,17 @@ var AvailabilitySearchType = {
235
235
  allotment: 1,
236
236
  };
237
237
 
238
+ var EntryStatus;
239
+ (function (EntryStatus) {
240
+ EntryStatus[(EntryStatus["new"] = -1)] = "new";
241
+ EntryStatus[(EntryStatus["offer"] = 0)] = "offer";
242
+ EntryStatus[(EntryStatus["option"] = 1)] = "option";
243
+ EntryStatus[(EntryStatus["booking"] = 2)] = "booking";
244
+ EntryStatus[(EntryStatus["cancellationByClient"] = 3)] =
245
+ "cancellationByClient";
246
+ EntryStatus[(EntryStatus["cancellationByYou"] = 4)] = "cancellationByYou";
247
+ })(EntryStatus || (EntryStatus = {}));
248
+
238
249
  var Gender = {
239
250
  male: 0,
240
251
  female: 1,
@@ -488,6 +499,7 @@ var get$1 = function (url, apiKey, signal) {
488
499
  headers: {
489
500
  "Api-Key": apiKey,
490
501
  },
502
+ credentials: "include",
491
503
  signal: signal,
492
504
  }),
493
505
  ];
@@ -7227,6 +7239,12 @@ var selectPackageRooms = function (state) {
7227
7239
  ? void 0
7228
7240
  : _b.rooms;
7229
7241
  };
7242
+ var selectPackageTags = function (state) {
7243
+ var _a;
7244
+ return (_a = state.booking.package) === null || _a === void 0
7245
+ ? void 0
7246
+ : _a.tags;
7247
+ };
7230
7248
  var selectIsOnRequest = function (state) {
7231
7249
  var _a, _b;
7232
7250
  return (_b =
@@ -10266,10 +10284,11 @@ var OptionBookingGroup = function (_a) {
10266
10284
  };
10267
10285
 
10268
10286
  var OptionsForm = function () {
10269
- var _a = useContext(SettingsContext),
10270
- basePath = _a.basePath,
10271
- travellers = _a.travellers,
10272
- loaderComponent = _a.loaderComponent;
10287
+ var _a;
10288
+ var _b = useContext(SettingsContext),
10289
+ basePath = _b.basePath,
10290
+ travellers = _b.travellers,
10291
+ loaderComponent = _b.loaderComponent;
10273
10292
  var dispatch = useAppDispatch();
10274
10293
  var requestRooms = useSelector(selectRequestRooms);
10275
10294
  var requestRoomsPax =
@@ -10285,6 +10304,9 @@ var OptionsForm = function () {
10285
10304
  var groups = useSelector(selectPackageGroups);
10286
10305
  var optionUnits = useSelector(selectPackageOptionUnits);
10287
10306
  var optionPax = useSelector(selectPackageOptionPax);
10307
+ var packageTags = useSelector(selectPackageTags);
10308
+ var tagIds =
10309
+ (_a = useSelector(selectTagIds)) !== null && _a !== void 0 ? _a : [];
10288
10310
  if (!packageRooms) {
10289
10311
  navigate("".concat(basePath, "?").concat(bookingQueryString));
10290
10312
  }
@@ -10336,6 +10358,29 @@ var OptionsForm = function () {
10336
10358
  dispatch(setPackageRooms(updatedPackageRooms));
10337
10359
  dispatch(fetchPriceDetails$1());
10338
10360
  };
10361
+ var handleOnTagChange = function (id, checked) {
10362
+ var updatedTags = __spreadArray([], tagIds, true);
10363
+ if (checked) {
10364
+ if (
10365
+ !(updatedTags === null || updatedTags === void 0
10366
+ ? void 0
10367
+ : updatedTags.includes(id))
10368
+ ) {
10369
+ updatedTags === null || updatedTags === void 0
10370
+ ? void 0
10371
+ : updatedTags.push(id);
10372
+ }
10373
+ } else {
10374
+ updatedTags =
10375
+ updatedTags === null || updatedTags === void 0
10376
+ ? void 0
10377
+ : updatedTags.filter(function (x) {
10378
+ return x != id;
10379
+ });
10380
+ }
10381
+ dispatch(setTagIds(updatedTags));
10382
+ dispatch(fetchPriceDetails$1());
10383
+ };
10339
10384
  var handleOnPaxChange = function (pax) {
10340
10385
  dispatch(setPackageOptionPax(pax));
10341
10386
  dispatch(fetchPriceDetails$1());
@@ -10418,6 +10463,57 @@ var OptionsForm = function () {
10418
10463
  });
10419
10464
  })
10420
10465
  )
10466
+ ),
10467
+ React.createElement(
10468
+ "div",
10469
+ { className: "booking-card__tag-translations" },
10470
+ packageTags &&
10471
+ packageTags.map(function (tag, index) {
10472
+ return React.createElement(
10473
+ "label",
10474
+ {
10475
+ key: index,
10476
+ htmlFor: "tag-translation-"
10477
+ .concat(index, "-")
10478
+ .concat(tag.title),
10479
+ className: "checkbox__label tag-translation",
10480
+ },
10481
+ React.createElement(
10482
+ "div",
10483
+ { className: "tag-translation-input__container" },
10484
+ React.createElement("input", {
10485
+ type: "checkbox",
10486
+ id: "tag-translation-"
10487
+ .concat(index, "-")
10488
+ .concat(tag.title),
10489
+ name: "tag-translation-"
10490
+ .concat(index, "-")
10491
+ .concat(tag.title),
10492
+ className: "checkbox__input",
10493
+ checked:
10494
+ tagIds === null || tagIds === void 0
10495
+ ? void 0
10496
+ : tagIds.includes(tag.id),
10497
+ onChange: function (e) {
10498
+ return handleOnTagChange(
10499
+ tag.id,
10500
+ e.target.checked
10501
+ );
10502
+ },
10503
+ })
10504
+ ),
10505
+ React.createElement(
10506
+ "span",
10507
+ { className: "tag-translation__title" },
10508
+ tag.title
10509
+ ),
10510
+ React.createElement(
10511
+ "span",
10512
+ { className: "tag-translation__description" },
10513
+ tag.description
10514
+ )
10515
+ );
10516
+ })
10421
10517
  )
10422
10518
  )
10423
10519
  )
@@ -10524,15 +10620,6 @@ var OptionsForm = function () {
10524
10620
  React.createElement(
10525
10621
  "div",
10526
10622
  { className: "booking__navigator" },
10527
- React.createElement(
10528
- Link,
10529
- {
10530
- to: "".concat(basePath, "?").concat(bookingQueryString),
10531
- title: translations.STEPS.PREVIOUS,
10532
- className: "cta cta--secondary",
10533
- },
10534
- translations.STEPS.PREVIOUS
10535
- ),
10536
10623
  React.createElement(
10537
10624
  "button",
10538
10625
  {
@@ -12245,73 +12332,73 @@ var Summary = function () {
12245
12332
  React.createElement(
12246
12333
  React.Fragment,
12247
12334
  null,
12248
- notifications
12249
- .filter(function (x) {
12335
+ uniqBy(
12336
+ notifications.filter(function (x) {
12250
12337
  return !x.hasToBeConfirmed;
12251
- })
12252
- .map(function (notification) {
12253
- return React.createElement(
12254
- "span",
12255
- {
12256
- key: notification.id,
12257
- className: "checkbox__label-text",
12258
- },
12259
- React.createElement(
12260
- "strong",
12261
- { className: "checkbox__label-text--title" },
12262
- notification.title
12263
- ),
12264
- React.createElement(
12265
- "span",
12266
- {
12267
- className: "checkbox__label-text--description",
12268
- },
12269
- notification.description
12270
- )
12271
- );
12272
12338
  }),
12273
- notifications
12274
- .filter(function (x) {
12339
+ "id"
12340
+ ).map(function (notification) {
12341
+ return React.createElement(
12342
+ "span",
12343
+ {
12344
+ key: notification.id,
12345
+ className: "checkbox__label-text",
12346
+ },
12347
+ React.createElement(
12348
+ "strong",
12349
+ { className: "checkbox__label-text--title" },
12350
+ notification.title
12351
+ ),
12352
+ React.createElement(
12353
+ "span",
12354
+ { className: "checkbox__label-text--description" },
12355
+ notification.description
12356
+ )
12357
+ );
12358
+ }),
12359
+ uniqBy(
12360
+ notifications.filter(function (x) {
12275
12361
  return x.hasToBeConfirmed;
12276
- })
12277
- .map(function (notification) {
12278
- return React.createElement(
12279
- "div",
12280
- { className: "checkbox", key: notification.id },
12362
+ }),
12363
+ "id"
12364
+ ).map(function (notification) {
12365
+ return React.createElement(
12366
+ "div",
12367
+ { className: "checkbox", key: notification.id },
12368
+ React.createElement(
12369
+ "label",
12370
+ { className: "checkbox__label" },
12371
+ React.createElement("input", {
12372
+ type: "checkbox",
12373
+ className: "checkbox__input",
12374
+ checked: notification.isConfirmed,
12375
+ onChange: function (e) {
12376
+ return handleNotificationChange(
12377
+ notification.id,
12378
+ e.target.checked
12379
+ );
12380
+ },
12381
+ }),
12281
12382
  React.createElement(
12282
- "label",
12283
- { className: "checkbox__label" },
12284
- React.createElement("input", {
12285
- type: "checkbox",
12286
- className: "checkbox__input",
12287
- checked: notification.isConfirmed,
12288
- onChange: function (e) {
12289
- return handleNotificationChange(
12290
- notification.id,
12291
- e.target.checked
12292
- );
12293
- },
12294
- }),
12383
+ "span",
12384
+ { className: "checkbox__label-text" },
12385
+ React.createElement(
12386
+ "strong",
12387
+ { className: "checkbox__label-text--title" },
12388
+ notification.title
12389
+ ),
12295
12390
  React.createElement(
12296
12391
  "span",
12297
- { className: "checkbox__label-text" },
12298
- React.createElement(
12299
- "strong",
12300
- { className: "checkbox__label-text--title" },
12301
- notification.title
12302
- ),
12303
- React.createElement(
12304
- "span",
12305
- {
12306
- className:
12307
- "checkbox__label-text--description",
12308
- },
12309
- notification.description
12310
- )
12392
+ {
12393
+ className:
12394
+ "checkbox__label-text--description",
12395
+ },
12396
+ notification.description
12311
12397
  )
12312
12398
  )
12313
- );
12314
- })
12399
+ )
12400
+ );
12401
+ })
12315
12402
  )
12316
12403
  )
12317
12404
  )
@@ -12424,7 +12511,7 @@ var Summary = function () {
12424
12511
  {
12425
12512
  to: ""
12426
12513
  .concat(settings.basePath)
12427
- .concat(settings.options.pathSuffix, "?")
12514
+ .concat(settings.travellers.pathSuffix, "?")
12428
12515
  .concat(bookingQueryString),
12429
12516
  title: translations.STEPS.PREVIOUS,
12430
12517
  className: "cta cta--secondary",
@@ -12881,7 +12968,9 @@ var TravelersForm = function () {
12881
12968
  var formValues = produce(formik.values, function (values) {
12882
12969
  values.adults = adultIds.map(function (id) {
12883
12970
  var _a;
12884
- return (_a = values.adults[id]) !== null && _a !== void 0
12971
+ return (_a = values.adults.find(function (x) {
12972
+ return x.id == id;
12973
+ })) !== null && _a !== void 0
12885
12974
  ? _a
12886
12975
  : createTraveler(id);
12887
12976
  });
@@ -12904,7 +12993,9 @@ var TravelersForm = function () {
12904
12993
  var formValues = produce(formik.values, function (values) {
12905
12994
  values.children = childIds.map(function (id) {
12906
12995
  var _a;
12907
- return (_a = values.children[id]) !== null && _a !== void 0
12996
+ return (_a = values.children.find(function (x) {
12997
+ return x.id == id;
12998
+ })) !== null && _a !== void 0
12908
12999
  ? _a
12909
13000
  : createTraveler(id);
12910
13001
  });
@@ -13584,6 +13675,15 @@ var TravelersForm = function () {
13584
13675
  React.createElement(
13585
13676
  "div",
13586
13677
  { className: "booking__navigator" },
13678
+ React.createElement(
13679
+ Link,
13680
+ {
13681
+ to: "".concat(settings.basePath, "?").concat(bookingQueryString),
13682
+ title: translations.STEPS.PREVIOUS,
13683
+ className: "cta cta--secondary",
13684
+ },
13685
+ translations.STEPS.PREVIOUS
13686
+ ),
13587
13687
  React.createElement(
13588
13688
  "button",
13589
13689
  { type: "submit", title: translations.STEPS.NEXT, className: "cta" },
@@ -13656,6 +13756,9 @@ var Booking = function (_a) {
13656
13756
  (_a = params.get("bookingNr")) !== null && _a !== void 0
13657
13757
  ? _a
13658
13758
  : undefined;
13759
+ if (typeof window !== "undefined") {
13760
+ window.scrollTo(0, 0);
13761
+ }
13659
13762
  if (!isNil(bookingNumber)) {
13660
13763
  dispatch(setBookingNumber(bookingNumber));
13661
13764
  navigate(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "React BookingWizard component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -66,6 +66,6 @@
66
66
  "uuid": "^8.3.2"
67
67
  },
68
68
  "dependencies": {
69
- "@qite/tide-client": "1.1.12"
69
+ "@qite/tide-client": "1.1.15"
70
70
  }
71
71
  }
@@ -102,6 +102,10 @@ const Booking: React.FC<BookingProps> = ({
102
102
  const tourCode = getStringFromParams(params, "tourCode");
103
103
  const bookingNumber = params.get("bookingNr") ?? undefined;
104
104
 
105
+ if (typeof window !== "undefined") {
106
+ window.scrollTo(0, 0);
107
+ }
108
+
105
109
  if (!isNil(bookingNumber)) {
106
110
  dispatch(setBookingNumber(bookingNumber));
107
111
  navigate(
@@ -35,6 +35,9 @@ export const selectReturnFlight = (state: RootState) =>
35
35
  export const selectPackageRooms = (state: RootState) =>
36
36
  state.booking.package?.options.find((x) => x.isSelected)?.rooms;
37
37
 
38
+ export const selectPackageTags = (state: RootState) =>
39
+ state.booking.package?.tags;
40
+
38
41
  export const selectIsOnRequest = (state: RootState) =>
39
42
  state.booking.package?.options.find((x) => x.isSelected)?.isOnRequest;
40
43
 
@@ -2,12 +2,13 @@ import React, { useContext, useEffect } from "react";
2
2
 
3
3
  import SettingsContext from "../../settings-context";
4
4
  import { isEmpty } from "lodash";
5
- import { navigate, Link } from "@reach/router";
5
+ import { navigate } from "@reach/router";
6
6
  import {
7
7
  setPackageGroups,
8
8
  setPackageOptionPax,
9
9
  setPackageOptionUnits,
10
10
  setPackageRooms,
11
+ setTagIds,
11
12
  } from "../booking/booking-slice";
12
13
  import {
13
14
  selectBookingPackagePax,
@@ -17,7 +18,9 @@ import {
17
18
  selectPackageOptionPax,
18
19
  selectPackageOptionUnits,
19
20
  selectPackageRooms,
21
+ selectPackageTags,
20
22
  selectRequestRooms,
23
+ selectTagIds,
21
24
  } from "../booking/selectors";
22
25
  import translations from "../../translations/translations.json";
23
26
  import { useSelector } from "react-redux";
@@ -53,6 +56,9 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
53
56
  const optionUnits = useSelector(selectPackageOptionUnits);
54
57
  const optionPax = useSelector(selectPackageOptionPax);
55
58
 
59
+ const packageTags = useSelector(selectPackageTags);
60
+ let tagIds = useSelector(selectTagIds) ?? [];
61
+
56
62
  if (!packageRooms) {
57
63
  navigate(`${basePath}?${bookingQueryString}`);
58
64
  }
@@ -97,6 +103,20 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
97
103
  dispatch(fetchPriceDetails());
98
104
  };
99
105
 
106
+ const handleOnTagChange = (id: number, checked: boolean) => {
107
+ let updatedTags = [...tagIds];
108
+ if (checked) {
109
+ if (!updatedTags?.includes(id)) {
110
+ updatedTags?.push(id);
111
+ }
112
+ } else {
113
+ updatedTags = updatedTags?.filter((x) => x != id);
114
+ }
115
+
116
+ dispatch(setTagIds(updatedTags));
117
+ dispatch(fetchPriceDetails());
118
+ };
119
+
100
120
  const handleOnPaxChange = (pax: BookingOptionPax[]) => {
101
121
  dispatch(setPackageOptionPax(pax));
102
122
  dispatch(fetchPriceDetails());
@@ -163,6 +183,35 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
163
183
  ))}
164
184
  </tbody>
165
185
  </table>
186
+ <div className="booking-card__tag-translations">
187
+ {packageTags &&
188
+ packageTags.map((tag, index) => (
189
+ <label
190
+ key={index}
191
+ htmlFor={`tag-translation-${index}-${tag.title}`}
192
+ className="checkbox__label tag-translation"
193
+ >
194
+ <div className="tag-translation-input__container">
195
+ <input
196
+ type="checkbox"
197
+ id={`tag-translation-${index}-${tag.title}`}
198
+ name={`tag-translation-${index}-${tag.title}`}
199
+ className="checkbox__input"
200
+ checked={tagIds?.includes(tag.id)}
201
+ onChange={(e) =>
202
+ handleOnTagChange(tag.id, e.target.checked)
203
+ }
204
+ />
205
+ </div>
206
+ <span className="tag-translation__title">
207
+ {tag.title}
208
+ </span>
209
+ <span className="tag-translation__description">
210
+ {tag.description}
211
+ </span>
212
+ </label>
213
+ ))}
214
+ </div>
166
215
  </div>
167
216
  </div>
168
217
  </div>
@@ -238,13 +287,6 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
238
287
  </div>
239
288
  )}
240
289
  <div className="booking__navigator">
241
- <Link
242
- to={`${basePath}?${bookingQueryString}`}
243
- title={translations.STEPS.PREVIOUS}
244
- className="cta cta--secondary"
245
- >
246
- {translations.STEPS.PREVIOUS}
247
- </Link>
248
290
  <button
249
291
  type="submit"
250
292
  title={translations.STEPS.NEXT}
@@ -16,7 +16,7 @@ import Icon from "../../components/icon";
16
16
  import React, { useEffect } from "react";
17
17
  import SettingsContext from "../../settings-context";
18
18
  import { buildClassName } from "../../utils/class-util";
19
- import { compact, findIndex, isEmpty, isNil } from "lodash";
19
+ import { compact, findIndex, isEmpty, isNil, uniqBy } from "lodash";
20
20
  import { Link, navigate } from "@reach/router";
21
21
  import translations from "../../translations/translations.json";
22
22
  import { useContext } from "react";
@@ -458,48 +458,50 @@ const Summary: React.FC<SummaryProps> = () => {
458
458
  <div className="info-message__copy">
459
459
  <h5>{translations.SUMMARY.NOTIFICATIONS_TITLE}</h5>
460
460
  <>
461
- {notifications
462
- .filter((x) => !x.hasToBeConfirmed)
463
- .map((notification) => (
464
- <span
465
- key={notification.id}
466
- className="checkbox__label-text"
467
- >
468
- <strong className="checkbox__label-text--title">
469
- {notification.title}
470
- </strong>
471
- <span className="checkbox__label-text--description">
472
- {notification.description}
473
- </span>
461
+ {uniqBy(
462
+ notifications.filter((x) => !x.hasToBeConfirmed),
463
+ "id"
464
+ ).map((notification) => (
465
+ <span
466
+ key={notification.id}
467
+ className="checkbox__label-text"
468
+ >
469
+ <strong className="checkbox__label-text--title">
470
+ {notification.title}
471
+ </strong>
472
+ <span className="checkbox__label-text--description">
473
+ {notification.description}
474
474
  </span>
475
- ))}
476
- {notifications
477
- .filter((x) => x.hasToBeConfirmed)
478
- .map((notification) => (
479
- <div className="checkbox" key={notification.id}>
480
- <label className="checkbox__label">
481
- <input
482
- type="checkbox"
483
- className="checkbox__input"
484
- checked={notification.isConfirmed}
485
- onChange={(e) =>
486
- handleNotificationChange(
487
- notification.id,
488
- e.target.checked
489
- )
490
- }
491
- />
492
- <span className="checkbox__label-text">
493
- <strong className="checkbox__label-text--title">
494
- {notification.title}
495
- </strong>
496
- <span className="checkbox__label-text--description">
497
- {notification.description}
498
- </span>
475
+ </span>
476
+ ))}
477
+ {uniqBy(
478
+ notifications.filter((x) => x.hasToBeConfirmed),
479
+ "id"
480
+ ).map((notification) => (
481
+ <div className="checkbox" key={notification.id}>
482
+ <label className="checkbox__label">
483
+ <input
484
+ type="checkbox"
485
+ className="checkbox__input"
486
+ checked={notification.isConfirmed}
487
+ onChange={(e) =>
488
+ handleNotificationChange(
489
+ notification.id,
490
+ e.target.checked
491
+ )
492
+ }
493
+ />
494
+ <span className="checkbox__label-text">
495
+ <strong className="checkbox__label-text--title">
496
+ {notification.title}
497
+ </strong>
498
+ <span className="checkbox__label-text--description">
499
+ {notification.description}
499
500
  </span>
500
- </label>
501
- </div>
502
- ))}
501
+ </span>
502
+ </label>
503
+ </div>
504
+ ))}
503
505
  </>
504
506
  </div>
505
507
  </div>
@@ -569,7 +571,7 @@ const Summary: React.FC<SummaryProps> = () => {
569
571
 
570
572
  <div className="booking__navigator">
571
573
  <Link
572
- to={`${settings.basePath}${settings.options.pathSuffix}?${bookingQueryString}`}
574
+ to={`${settings.basePath}${settings.travellers.pathSuffix}?${bookingQueryString}`}
573
575
  title={translations.STEPS.PREVIOUS}
574
576
  className="cta cta--secondary"
575
577
  >
@@ -15,7 +15,7 @@ import { TravelersFormValues } from "../../types";
15
15
  import { buildClassName } from "../../utils/class-util";
16
16
  import { fetchPriceDetails } from "../price-details/price-details-slice";
17
17
  import flat from "flat";
18
- import { navigate } from "@reach/router";
18
+ import { Link, navigate } from "@reach/router";
19
19
  import produce from "immer";
20
20
  import {
21
21
  selectAgentAdressId,
@@ -119,7 +119,7 @@ const TravelersForm: React.FC<TravelersFormProps> = () => {
119
119
  useEffect(() => {
120
120
  const formValues = produce(formik.values, (values) => {
121
121
  values.adults = adultIds.map(
122
- (id) => values.adults[id] ?? createTraveler(id)
122
+ (id) => values.adults.find((x) => x.id == id) ?? createTraveler(id)
123
123
  );
124
124
 
125
125
  if (
@@ -139,7 +139,7 @@ const TravelersForm: React.FC<TravelersFormProps> = () => {
139
139
  useEffect(() => {
140
140
  const formValues = produce(formik.values, (values) => {
141
141
  values.children = childIds.map(
142
- (id) => values.children[id] ?? createTraveler(id)
142
+ (id) => values.children.find((x) => x.id == id) ?? createTraveler(id)
143
143
  );
144
144
  });
145
145
  formik.setValues(formValues, false);
@@ -687,6 +687,13 @@ const TravelersForm: React.FC<TravelersFormProps> = () => {
687
687
  </div>
688
688
  )}
689
689
  <div className="booking__navigator">
690
+ <Link
691
+ to={`${settings.basePath}?${bookingQueryString}`}
692
+ title={translations.STEPS.PREVIOUS}
693
+ className="cta cta--secondary"
694
+ >
695
+ {translations.STEPS.PREVIOUS}
696
+ </Link>
690
697
  <button type="submit" title={translations.STEPS.NEXT} className="cta">
691
698
  {translations.STEPS.NEXT}
692
699
  </button>