@qite/tide-booking-component 1.0.7 → 1.0.9

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.
@@ -10688,15 +10688,6 @@ var OptionsForm = function () {
10688
10688
  React__default["default"].createElement(
10689
10689
  "div",
10690
10690
  { className: "booking__navigator" },
10691
- React__default["default"].createElement(
10692
- router.Link,
10693
- {
10694
- to: "".concat(basePath, "?").concat(bookingQueryString),
10695
- title: translations.STEPS.PREVIOUS,
10696
- className: "cta cta--secondary",
10697
- },
10698
- translations.STEPS.PREVIOUS
10699
- ),
10700
10691
  React__default["default"].createElement(
10701
10692
  "button",
10702
10693
  {
@@ -11820,6 +11811,9 @@ var Summary = function () {
11820
11811
  case 0:
11821
11812
  e.preventDefault();
11822
11813
  setIsSubmitting(true);
11814
+ if (typeof window !== "undefined") {
11815
+ window.scrollTo(0, 0);
11816
+ }
11823
11817
  tideClientConfig = buildTideClientConfig();
11824
11818
  if (!bookRequest || !tideClientConfig) {
11825
11819
  return [2 /*return*/];
@@ -12466,10 +12460,13 @@ var Summary = function () {
12466
12460
  React__default["default"].createElement(
12467
12461
  React__default["default"].Fragment,
12468
12462
  null,
12469
- notifications
12470
- .filter(function (x) {
12471
- return !x.hasToBeConfirmed;
12472
- })
12463
+ lodash
12464
+ .uniqBy(
12465
+ notifications.filter(function (x) {
12466
+ return !x.hasToBeConfirmed;
12467
+ }),
12468
+ "id"
12469
+ )
12473
12470
  .map(function (notification) {
12474
12471
  return React__default["default"].createElement(
12475
12472
  "span",
@@ -12491,10 +12488,13 @@ var Summary = function () {
12491
12488
  )
12492
12489
  );
12493
12490
  }),
12494
- notifications
12495
- .filter(function (x) {
12496
- return x.hasToBeConfirmed;
12497
- })
12491
+ lodash
12492
+ .uniqBy(
12493
+ notifications.filter(function (x) {
12494
+ return x.hasToBeConfirmed;
12495
+ }),
12496
+ "id"
12497
+ )
12498
12498
  .map(function (notification) {
12499
12499
  return React__default["default"].createElement(
12500
12500
  "div",
@@ -12645,7 +12645,7 @@ var Summary = function () {
12645
12645
  {
12646
12646
  to: ""
12647
12647
  .concat(settings.basePath)
12648
- .concat(settings.options.pathSuffix, "?")
12648
+ .concat(settings.travellers.pathSuffix, "?")
12649
12649
  .concat(bookingQueryString),
12650
12650
  title: translations.STEPS.PREVIOUS,
12651
12651
  className: "cta cta--secondary",
@@ -13107,7 +13107,9 @@ var TravelersForm = function () {
13107
13107
  function (values) {
13108
13108
  values.adults = adultIds.map(function (id) {
13109
13109
  var _a;
13110
- return (_a = values.adults[id]) !== null && _a !== void 0
13110
+ return (_a = values.adults.find(function (x) {
13111
+ return x.id == id;
13112
+ })) !== null && _a !== void 0
13111
13113
  ? _a
13112
13114
  : createTraveler(id);
13113
13115
  });
@@ -13133,7 +13135,9 @@ var TravelersForm = function () {
13133
13135
  function (values) {
13134
13136
  values.children = childIds.map(function (id) {
13135
13137
  var _a;
13136
- return (_a = values.children[id]) !== null && _a !== void 0
13138
+ return (_a = values.children.find(function (x) {
13139
+ return x.id == id;
13140
+ })) !== null && _a !== void 0
13137
13141
  ? _a
13138
13142
  : createTraveler(id);
13139
13143
  });
@@ -13829,6 +13833,15 @@ var TravelersForm = function () {
13829
13833
  React__default["default"].createElement(
13830
13834
  "div",
13831
13835
  { className: "booking__navigator" },
13836
+ React__default["default"].createElement(
13837
+ router.Link,
13838
+ {
13839
+ to: "".concat(settings.basePath, "?").concat(bookingQueryString),
13840
+ title: translations.STEPS.PREVIOUS,
13841
+ className: "cta cta--secondary",
13842
+ },
13843
+ translations.STEPS.PREVIOUS
13844
+ ),
13832
13845
  React__default["default"].createElement(
13833
13846
  "button",
13834
13847
  { type: "submit", title: translations.STEPS.NEXT, className: "cta" },
@@ -13901,6 +13914,9 @@ var Booking = function (_a) {
13901
13914
  (_a = params.get("bookingNr")) !== null && _a !== void 0
13902
13915
  ? _a
13903
13916
  : undefined;
13917
+ if (typeof window !== "undefined") {
13918
+ window.scrollTo(0, 0);
13919
+ }
13904
13920
  if (!lodash.isNil(bookingNumber)) {
13905
13921
  dispatch(setBookingNumber(bookingNumber));
13906
13922
  router.navigate(
@@ -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";
@@ -10620,15 +10620,6 @@ var OptionsForm = function () {
10620
10620
  React.createElement(
10621
10621
  "div",
10622
10622
  { className: "booking__navigator" },
10623
- React.createElement(
10624
- Link,
10625
- {
10626
- to: "".concat(basePath, "?").concat(bookingQueryString),
10627
- title: translations.STEPS.PREVIOUS,
10628
- className: "cta cta--secondary",
10629
- },
10630
- translations.STEPS.PREVIOUS
10631
- ),
10632
10623
  React.createElement(
10633
10624
  "button",
10634
10625
  {
@@ -11707,6 +11698,9 @@ var Summary = function () {
11707
11698
  case 0:
11708
11699
  e.preventDefault();
11709
11700
  setIsSubmitting(true);
11701
+ if (typeof window !== "undefined") {
11702
+ window.scrollTo(0, 0);
11703
+ }
11710
11704
  tideClientConfig = buildTideClientConfig();
11711
11705
  if (!bookRequest || !tideClientConfig) {
11712
11706
  return [2 /*return*/];
@@ -12341,73 +12335,73 @@ var Summary = function () {
12341
12335
  React.createElement(
12342
12336
  React.Fragment,
12343
12337
  null,
12344
- notifications
12345
- .filter(function (x) {
12338
+ uniqBy(
12339
+ notifications.filter(function (x) {
12346
12340
  return !x.hasToBeConfirmed;
12347
- })
12348
- .map(function (notification) {
12349
- return React.createElement(
12350
- "span",
12351
- {
12352
- key: notification.id,
12353
- className: "checkbox__label-text",
12354
- },
12355
- React.createElement(
12356
- "strong",
12357
- { className: "checkbox__label-text--title" },
12358
- notification.title
12359
- ),
12360
- React.createElement(
12361
- "span",
12362
- {
12363
- className: "checkbox__label-text--description",
12364
- },
12365
- notification.description
12366
- )
12367
- );
12368
12341
  }),
12369
- notifications
12370
- .filter(function (x) {
12342
+ "id"
12343
+ ).map(function (notification) {
12344
+ return React.createElement(
12345
+ "span",
12346
+ {
12347
+ key: notification.id,
12348
+ className: "checkbox__label-text",
12349
+ },
12350
+ React.createElement(
12351
+ "strong",
12352
+ { className: "checkbox__label-text--title" },
12353
+ notification.title
12354
+ ),
12355
+ React.createElement(
12356
+ "span",
12357
+ { className: "checkbox__label-text--description" },
12358
+ notification.description
12359
+ )
12360
+ );
12361
+ }),
12362
+ uniqBy(
12363
+ notifications.filter(function (x) {
12371
12364
  return x.hasToBeConfirmed;
12372
- })
12373
- .map(function (notification) {
12374
- return React.createElement(
12375
- "div",
12376
- { className: "checkbox", key: notification.id },
12365
+ }),
12366
+ "id"
12367
+ ).map(function (notification) {
12368
+ return React.createElement(
12369
+ "div",
12370
+ { className: "checkbox", key: notification.id },
12371
+ React.createElement(
12372
+ "label",
12373
+ { className: "checkbox__label" },
12374
+ React.createElement("input", {
12375
+ type: "checkbox",
12376
+ className: "checkbox__input",
12377
+ checked: notification.isConfirmed,
12378
+ onChange: function (e) {
12379
+ return handleNotificationChange(
12380
+ notification.id,
12381
+ e.target.checked
12382
+ );
12383
+ },
12384
+ }),
12377
12385
  React.createElement(
12378
- "label",
12379
- { className: "checkbox__label" },
12380
- React.createElement("input", {
12381
- type: "checkbox",
12382
- className: "checkbox__input",
12383
- checked: notification.isConfirmed,
12384
- onChange: function (e) {
12385
- return handleNotificationChange(
12386
- notification.id,
12387
- e.target.checked
12388
- );
12389
- },
12390
- }),
12386
+ "span",
12387
+ { className: "checkbox__label-text" },
12388
+ React.createElement(
12389
+ "strong",
12390
+ { className: "checkbox__label-text--title" },
12391
+ notification.title
12392
+ ),
12391
12393
  React.createElement(
12392
12394
  "span",
12393
- { className: "checkbox__label-text" },
12394
- React.createElement(
12395
- "strong",
12396
- { className: "checkbox__label-text--title" },
12397
- notification.title
12398
- ),
12399
- React.createElement(
12400
- "span",
12401
- {
12402
- className:
12403
- "checkbox__label-text--description",
12404
- },
12405
- notification.description
12406
- )
12395
+ {
12396
+ className:
12397
+ "checkbox__label-text--description",
12398
+ },
12399
+ notification.description
12407
12400
  )
12408
12401
  )
12409
- );
12410
- })
12402
+ )
12403
+ );
12404
+ })
12411
12405
  )
12412
12406
  )
12413
12407
  )
@@ -12520,7 +12514,7 @@ var Summary = function () {
12520
12514
  {
12521
12515
  to: ""
12522
12516
  .concat(settings.basePath)
12523
- .concat(settings.options.pathSuffix, "?")
12517
+ .concat(settings.travellers.pathSuffix, "?")
12524
12518
  .concat(bookingQueryString),
12525
12519
  title: translations.STEPS.PREVIOUS,
12526
12520
  className: "cta cta--secondary",
@@ -12977,7 +12971,9 @@ var TravelersForm = function () {
12977
12971
  var formValues = produce(formik.values, function (values) {
12978
12972
  values.adults = adultIds.map(function (id) {
12979
12973
  var _a;
12980
- return (_a = values.adults[id]) !== null && _a !== void 0
12974
+ return (_a = values.adults.find(function (x) {
12975
+ return x.id == id;
12976
+ })) !== null && _a !== void 0
12981
12977
  ? _a
12982
12978
  : createTraveler(id);
12983
12979
  });
@@ -13000,7 +12996,9 @@ var TravelersForm = function () {
13000
12996
  var formValues = produce(formik.values, function (values) {
13001
12997
  values.children = childIds.map(function (id) {
13002
12998
  var _a;
13003
- return (_a = values.children[id]) !== null && _a !== void 0
12999
+ return (_a = values.children.find(function (x) {
13000
+ return x.id == id;
13001
+ })) !== null && _a !== void 0
13004
13002
  ? _a
13005
13003
  : createTraveler(id);
13006
13004
  });
@@ -13680,6 +13678,15 @@ var TravelersForm = function () {
13680
13678
  React.createElement(
13681
13679
  "div",
13682
13680
  { className: "booking__navigator" },
13681
+ React.createElement(
13682
+ Link,
13683
+ {
13684
+ to: "".concat(settings.basePath, "?").concat(bookingQueryString),
13685
+ title: translations.STEPS.PREVIOUS,
13686
+ className: "cta cta--secondary",
13687
+ },
13688
+ translations.STEPS.PREVIOUS
13689
+ ),
13683
13690
  React.createElement(
13684
13691
  "button",
13685
13692
  { type: "submit", title: translations.STEPS.NEXT, className: "cta" },
@@ -13752,6 +13759,9 @@ var Booking = function (_a) {
13752
13759
  (_a = params.get("bookingNr")) !== null && _a !== void 0
13753
13760
  ? _a
13754
13761
  : undefined;
13762
+ if (typeof window !== "undefined") {
13763
+ window.scrollTo(0, 0);
13764
+ }
13755
13765
  if (!isNil(bookingNumber)) {
13756
13766
  dispatch(setBookingNumber(bookingNumber));
13757
13767
  navigate(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "React BookingWizard component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -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(
@@ -2,7 +2,7 @@ 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,
@@ -287,13 +287,6 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
287
287
  </div>
288
288
  )}
289
289
  <div className="booking__navigator">
290
- <Link
291
- to={`${basePath}?${bookingQueryString}`}
292
- title={translations.STEPS.PREVIOUS}
293
- className="cta cta--secondary"
294
- >
295
- {translations.STEPS.PREVIOUS}
296
- </Link>
297
290
  <button
298
291
  type="submit"
299
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";
@@ -103,6 +103,10 @@ const Summary: React.FC<SummaryProps> = () => {
103
103
  e.preventDefault();
104
104
  setIsSubmitting(true);
105
105
 
106
+ if (typeof window !== "undefined") {
107
+ window.scrollTo(0, 0);
108
+ }
109
+
106
110
  const tideClientConfig = buildTideClientConfig();
107
111
 
108
112
  if (!bookRequest || !tideClientConfig) {
@@ -458,48 +462,50 @@ const Summary: React.FC<SummaryProps> = () => {
458
462
  <div className="info-message__copy">
459
463
  <h5>{translations.SUMMARY.NOTIFICATIONS_TITLE}</h5>
460
464
  <>
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>
465
+ {uniqBy(
466
+ notifications.filter((x) => !x.hasToBeConfirmed),
467
+ "id"
468
+ ).map((notification) => (
469
+ <span
470
+ key={notification.id}
471
+ className="checkbox__label-text"
472
+ >
473
+ <strong className="checkbox__label-text--title">
474
+ {notification.title}
475
+ </strong>
476
+ <span className="checkbox__label-text--description">
477
+ {notification.description}
474
478
  </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>
479
+ </span>
480
+ ))}
481
+ {uniqBy(
482
+ notifications.filter((x) => x.hasToBeConfirmed),
483
+ "id"
484
+ ).map((notification) => (
485
+ <div className="checkbox" key={notification.id}>
486
+ <label className="checkbox__label">
487
+ <input
488
+ type="checkbox"
489
+ className="checkbox__input"
490
+ checked={notification.isConfirmed}
491
+ onChange={(e) =>
492
+ handleNotificationChange(
493
+ notification.id,
494
+ e.target.checked
495
+ )
496
+ }
497
+ />
498
+ <span className="checkbox__label-text">
499
+ <strong className="checkbox__label-text--title">
500
+ {notification.title}
501
+ </strong>
502
+ <span className="checkbox__label-text--description">
503
+ {notification.description}
499
504
  </span>
500
- </label>
501
- </div>
502
- ))}
505
+ </span>
506
+ </label>
507
+ </div>
508
+ ))}
503
509
  </>
504
510
  </div>
505
511
  </div>
@@ -569,7 +575,7 @@ const Summary: React.FC<SummaryProps> = () => {
569
575
 
570
576
  <div className="booking__navigator">
571
577
  <Link
572
- to={`${settings.basePath}${settings.options.pathSuffix}?${bookingQueryString}`}
578
+ to={`${settings.basePath}${settings.travellers.pathSuffix}?${bookingQueryString}`}
573
579
  title={translations.STEPS.PREVIOUS}
574
580
  className="cta cta--secondary"
575
581
  >
@@ -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>