@qite/tide-booking-component 1.0.1 → 1.0.2

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.
@@ -1,7 +1,11 @@
1
- import { BookingOptionPax } from "@qite/tide-client/build/types";
1
+ import {
2
+ BookingOptionPax,
3
+ BookingPackagePax,
4
+ } from "@qite/tide-client/build/types";
2
5
  import React from "react";
3
6
  interface OptionPaxCardProps {
4
7
  pax: BookingOptionPax[];
8
+ requestRoomsPax?: BookingPackagePax[];
5
9
  parentIndex?: number;
6
10
  onPaxChange?: (pax: BookingOptionPax[], index?: number) => void;
7
11
  }
@@ -9652,6 +9652,7 @@ var OptionPaxGroup = function (_a) {
9652
9652
 
9653
9653
  var OptionPaxCard = function (_a) {
9654
9654
  var pax = _a.pax,
9655
+ requestRoomsPax = _a.requestRoomsPax,
9655
9656
  parentIndex = _a.parentIndex,
9656
9657
  onPaxChange = _a.onPaxChange;
9657
9658
  var _b = React.useState(),
@@ -9702,6 +9703,7 @@ var OptionPaxCard = function (_a) {
9702
9703
  React__default["default"].Fragment,
9703
9704
  null,
9704
9705
  pax.map(function (p, i) {
9706
+ var _a, _b;
9705
9707
  return React__default["default"].createElement(
9706
9708
  "div",
9707
9709
  {
@@ -9719,6 +9721,25 @@ var OptionPaxCard = function (_a) {
9719
9721
  { className: "booking-card__body-heading" },
9720
9722
  getPaxName(p)
9721
9723
  ),
9724
+ ((_a =
9725
+ requestRoomsPax === null || requestRoomsPax === void 0
9726
+ ? void 0
9727
+ : requestRoomsPax.find(function (x) {
9728
+ return x.id == p.id;
9729
+ })) === null || _a === void 0
9730
+ ? void 0
9731
+ : _a.age) &&
9732
+ React__default["default"].createElement(
9733
+ "p",
9734
+ { className: "form__region-label" },
9735
+ ((_b = requestRoomsPax.find(function (x) {
9736
+ return x.id == p.id;
9737
+ })) === null || _b === void 0
9738
+ ? void 0
9739
+ : _b.age) > CHILD_MAX_AGE
9740
+ ? translations.TRAVELERS_FORM.ADULT
9741
+ : translations.TRAVELERS_FORM.CHILD
9742
+ ),
9722
9743
  React__default["default"].createElement(
9723
9744
  "div",
9724
9745
  { className: "booking-card__actions" },
@@ -10248,6 +10269,12 @@ var OptionsForm = function () {
10248
10269
  loaderComponent = _a.loaderComponent;
10249
10270
  var dispatch = useAppDispatch();
10250
10271
  var requestRooms = reactRedux.useSelector(selectRequestRooms);
10272
+ var requestRoomsPax =
10273
+ requestRooms === null || requestRooms === void 0
10274
+ ? void 0
10275
+ : requestRooms.flatMap(function (x) {
10276
+ return x.pax;
10277
+ });
10251
10278
  var pax = reactRedux.useSelector(selectBookingPackagePax);
10252
10279
  var packageRooms = reactRedux.useSelector(selectPackageRooms);
10253
10280
  var bookingQueryString = reactRedux.useSelector(selectBookingQueryString);
@@ -10444,6 +10471,7 @@ var OptionsForm = function () {
10444
10471
  React__default["default"].createElement(OptionPaxCard, {
10445
10472
  pax: optionPax,
10446
10473
  onPaxChange: handleOnPaxChange,
10474
+ requestRoomsPax: requestRoomsPax,
10447
10475
  })
10448
10476
  )
10449
10477
  )
@@ -1,7 +1,11 @@
1
- import { BookingOptionPax } from "@qite/tide-client/build/types";
1
+ import {
2
+ BookingOptionPax,
3
+ BookingPackagePax,
4
+ } from "@qite/tide-client/build/types";
2
5
  import React from "react";
3
6
  interface OptionPaxCardProps {
4
7
  pax: BookingOptionPax[];
8
+ requestRoomsPax?: BookingPackagePax[];
5
9
  parentIndex?: number;
6
10
  onPaxChange?: (pax: BookingOptionPax[], index?: number) => void;
7
11
  }
@@ -9619,6 +9619,7 @@ var OptionPaxGroup = function (_a) {
9619
9619
 
9620
9620
  var OptionPaxCard = function (_a) {
9621
9621
  var pax = _a.pax,
9622
+ requestRoomsPax = _a.requestRoomsPax,
9622
9623
  parentIndex = _a.parentIndex,
9623
9624
  onPaxChange = _a.onPaxChange;
9624
9625
  var _b = useState(),
@@ -9669,6 +9670,7 @@ var OptionPaxCard = function (_a) {
9669
9670
  React.Fragment,
9670
9671
  null,
9671
9672
  pax.map(function (p, i) {
9673
+ var _a, _b;
9672
9674
  return React.createElement(
9673
9675
  "div",
9674
9676
  {
@@ -9686,6 +9688,25 @@ var OptionPaxCard = function (_a) {
9686
9688
  { className: "booking-card__body-heading" },
9687
9689
  getPaxName(p)
9688
9690
  ),
9691
+ ((_a =
9692
+ requestRoomsPax === null || requestRoomsPax === void 0
9693
+ ? void 0
9694
+ : requestRoomsPax.find(function (x) {
9695
+ return x.id == p.id;
9696
+ })) === null || _a === void 0
9697
+ ? void 0
9698
+ : _a.age) &&
9699
+ React.createElement(
9700
+ "p",
9701
+ { className: "form__region-label" },
9702
+ ((_b = requestRoomsPax.find(function (x) {
9703
+ return x.id == p.id;
9704
+ })) === null || _b === void 0
9705
+ ? void 0
9706
+ : _b.age) > CHILD_MAX_AGE
9707
+ ? translations.TRAVELERS_FORM.ADULT
9708
+ : translations.TRAVELERS_FORM.CHILD
9709
+ ),
9689
9710
  React.createElement(
9690
9711
  "div",
9691
9712
  { className: "booking-card__actions" },
@@ -10188,6 +10209,12 @@ var OptionsForm = function () {
10188
10209
  loaderComponent = _a.loaderComponent;
10189
10210
  var dispatch = useAppDispatch();
10190
10211
  var requestRooms = useSelector(selectRequestRooms);
10212
+ var requestRoomsPax =
10213
+ requestRooms === null || requestRooms === void 0
10214
+ ? void 0
10215
+ : requestRooms.flatMap(function (x) {
10216
+ return x.pax;
10217
+ });
10191
10218
  var pax = useSelector(selectBookingPackagePax);
10192
10219
  var packageRooms = useSelector(selectPackageRooms);
10193
10220
  var bookingQueryString = useSelector(selectBookingQueryString);
@@ -10381,6 +10408,7 @@ var OptionsForm = function () {
10381
10408
  React.createElement(OptionPaxCard, {
10382
10409
  pax: optionPax,
10383
10410
  onPaxChange: handleOnPaxChange,
10411
+ requestRoomsPax: requestRoomsPax,
10384
10412
  })
10385
10413
  )
10386
10414
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "React BookingWizard component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  BookingOptionGroup,
3
3
  BookingOptionPax,
4
+ BookingPackagePax,
4
5
  PerPaxPackageOption,
5
6
  } from "@qite/tide-client/build/types";
6
7
  import React, { useEffect, useState } from "react";
@@ -8,15 +9,19 @@ import { useSelector } from "react-redux";
8
9
  import { buildClassName } from "../../utils/class-util";
9
10
  import { selectBookingPackagePax } from "../booking/selectors";
10
11
  import OptionPaxGroup from "./option-pax-group";
12
+ import translations from "../../translations/translations.json";
13
+ import { CHILD_MAX_AGE } from "../travelers-form/travelers-form-slice";
11
14
 
12
15
  interface OptionPaxCardProps {
13
16
  pax: BookingOptionPax[];
17
+ requestRoomsPax?: BookingPackagePax[];
14
18
  parentIndex?: number;
15
19
  onPaxChange?: (pax: BookingOptionPax[], index?: number) => void;
16
20
  }
17
21
 
18
22
  const OptionPaxCard: React.FC<OptionPaxCardProps> = ({
19
23
  pax,
24
+ requestRoomsPax,
20
25
  parentIndex,
21
26
  onPaxChange,
22
27
  }) => {
@@ -68,6 +73,13 @@ const OptionPaxCard: React.FC<OptionPaxCardProps> = ({
68
73
  >
69
74
  <div className="booking-card__group-header">
70
75
  <h3 className="booking-card__body-heading">{getPaxName(p)}</h3>
76
+ {requestRoomsPax?.find((x) => x.id == p.id)?.age && (
77
+ <p className="form__region-label">
78
+ {requestRoomsPax.find((x) => x.id == p.id)?.age! > CHILD_MAX_AGE
79
+ ? translations.TRAVELERS_FORM.ADULT
80
+ : translations.TRAVELERS_FORM.CHILD}
81
+ </p>
82
+ )}
71
83
  <div className="booking-card__actions">
72
84
  <button
73
85
  type="button"
@@ -43,6 +43,7 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
43
43
 
44
44
  const dispatch = useAppDispatch();
45
45
  const requestRooms = useSelector(selectRequestRooms);
46
+ const requestRoomsPax = requestRooms?.flatMap((x) => x.pax);
46
47
  const pax = useSelector(selectBookingPackagePax);
47
48
  const packageRooms = useSelector(selectPackageRooms);
48
49
  const bookingQueryString = useSelector(selectBookingQueryString);
@@ -194,6 +195,7 @@ const OptionsForm: React.FC<OptionsFormProps> = () => {
194
195
  <OptionPaxCard
195
196
  pax={optionPax}
196
197
  onPaxChange={handleOnPaxChange}
198
+ requestRoomsPax={requestRoomsPax}
197
199
  />
198
200
  </div>
199
201
  </div>