@qite/tide-booking-component 0.0.2-preview.74 → 0.0.2-preview.75
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.
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +1 -0
- package/build/build-cjs/index.js +7 -6
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +1 -0
- package/build/build-esm/index.js +7 -6
- package/package.json +1 -1
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +66 -65
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +5 -4
- package/src/booking-wizard/features/travelers-form/validate-form.ts +3 -2
|
@@ -3,6 +3,7 @@ import { TravelersFormValues } from "../../types";
|
|
|
3
3
|
export interface TravelersFormState {
|
|
4
4
|
formValues?: TravelersFormValues;
|
|
5
5
|
}
|
|
6
|
+
export declare const CHILD_MAX_AGE = 17;
|
|
6
7
|
export declare const setFormValues: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
7
8
|
TravelersFormValues,
|
|
8
9
|
string
|
package/build/build-cjs/index.js
CHANGED
|
@@ -6991,6 +6991,7 @@ var resetPriceDetails =
|
|
|
6991
6991
|
setNotifications = _a$1.setNotifications;
|
|
6992
6992
|
var priceDetailsReducer = priceDetailsSlice.reducer;
|
|
6993
6993
|
|
|
6994
|
+
var CHILD_MAX_AGE = 17;
|
|
6994
6995
|
var initialState$2 = {
|
|
6995
6996
|
formValues: undefined,
|
|
6996
6997
|
};
|
|
@@ -7057,14 +7058,14 @@ var selectAdultIds = toolkit.createSelector(
|
|
|
7057
7058
|
if (rooms) {
|
|
7058
7059
|
rooms.forEach(function (x) {
|
|
7059
7060
|
return x.pax.forEach(function (p) {
|
|
7060
|
-
if (p.age && p.age >
|
|
7061
|
+
if (p.age && p.age > CHILD_MAX_AGE) {
|
|
7061
7062
|
ids.push(p.id);
|
|
7062
7063
|
} else if (p.dateOfBirth) {
|
|
7063
7064
|
var diff = dateFns.differenceInYears(
|
|
7064
7065
|
new Date(),
|
|
7065
7066
|
new Date(p.dateOfBirth)
|
|
7066
7067
|
);
|
|
7067
|
-
if (diff >
|
|
7068
|
+
if (diff > CHILD_MAX_AGE) {
|
|
7068
7069
|
ids.push(p.id);
|
|
7069
7070
|
}
|
|
7070
7071
|
}
|
|
@@ -7081,14 +7082,14 @@ var selectChildIds = toolkit.createSelector(
|
|
|
7081
7082
|
if (rooms) {
|
|
7082
7083
|
rooms.forEach(function (x) {
|
|
7083
7084
|
return x.pax.forEach(function (p) {
|
|
7084
|
-
if (p.age && p.age <=
|
|
7085
|
+
if (p.age && p.age <= CHILD_MAX_AGE) {
|
|
7085
7086
|
ids.push(p.id);
|
|
7086
7087
|
} else if (p.dateOfBirth) {
|
|
7087
7088
|
var diff = dateFns.differenceInYears(
|
|
7088
7089
|
new Date(),
|
|
7089
7090
|
new Date(p.dateOfBirth)
|
|
7090
7091
|
);
|
|
7091
|
-
if (diff <=
|
|
7092
|
+
if (diff <= CHILD_MAX_AGE) {
|
|
7092
7093
|
ids.push(p.id);
|
|
7093
7094
|
}
|
|
7094
7095
|
}
|
|
@@ -12279,7 +12280,7 @@ var validateForm = function (values, agentRequired) {
|
|
|
12279
12280
|
);
|
|
12280
12281
|
} else if (values.startDate) {
|
|
12281
12282
|
var age = getAge(adult.birthDate, values.startDate);
|
|
12282
|
-
if (age
|
|
12283
|
+
if (age <= CHILD_MAX_AGE) {
|
|
12283
12284
|
lodash.set(
|
|
12284
12285
|
errors,
|
|
12285
12286
|
"adults[".concat(index, "].birthDate"),
|
|
@@ -12318,7 +12319,7 @@ var validateForm = function (values, agentRequired) {
|
|
|
12318
12319
|
);
|
|
12319
12320
|
} else if (values.startDate) {
|
|
12320
12321
|
var age = getAge(child.birthDate, values.startDate);
|
|
12321
|
-
if (age
|
|
12322
|
+
if (age > CHILD_MAX_AGE) {
|
|
12322
12323
|
lodash.set(
|
|
12323
12324
|
errors,
|
|
12324
12325
|
"children[".concat(index, "].birthDate"),
|
|
@@ -3,6 +3,7 @@ import { TravelersFormValues } from "../../types";
|
|
|
3
3
|
export interface TravelersFormState {
|
|
4
4
|
formValues?: TravelersFormValues;
|
|
5
5
|
}
|
|
6
|
+
export declare const CHILD_MAX_AGE = 17;
|
|
6
7
|
export declare const setFormValues: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
7
8
|
TravelersFormValues,
|
|
8
9
|
string
|
package/build/build-esm/index.js
CHANGED
|
@@ -7006,6 +7006,7 @@ var resetPriceDetails =
|
|
|
7006
7006
|
setNotifications = _a$1.setNotifications;
|
|
7007
7007
|
var priceDetailsReducer = priceDetailsSlice.reducer;
|
|
7008
7008
|
|
|
7009
|
+
var CHILD_MAX_AGE = 17;
|
|
7009
7010
|
var initialState$2 = {
|
|
7010
7011
|
formValues: undefined,
|
|
7011
7012
|
};
|
|
@@ -7070,11 +7071,11 @@ var selectAdultIds = createSelector(selectRequestRooms$1, function (rooms) {
|
|
|
7070
7071
|
if (rooms) {
|
|
7071
7072
|
rooms.forEach(function (x) {
|
|
7072
7073
|
return x.pax.forEach(function (p) {
|
|
7073
|
-
if (p.age && p.age >
|
|
7074
|
+
if (p.age && p.age > CHILD_MAX_AGE) {
|
|
7074
7075
|
ids.push(p.id);
|
|
7075
7076
|
} else if (p.dateOfBirth) {
|
|
7076
7077
|
var diff = differenceInYears(new Date(), new Date(p.dateOfBirth));
|
|
7077
|
-
if (diff >
|
|
7078
|
+
if (diff > CHILD_MAX_AGE) {
|
|
7078
7079
|
ids.push(p.id);
|
|
7079
7080
|
}
|
|
7080
7081
|
}
|
|
@@ -7088,11 +7089,11 @@ var selectChildIds = createSelector(selectRequestRooms$1, function (rooms) {
|
|
|
7088
7089
|
if (rooms) {
|
|
7089
7090
|
rooms.forEach(function (x) {
|
|
7090
7091
|
return x.pax.forEach(function (p) {
|
|
7091
|
-
if (p.age && p.age <=
|
|
7092
|
+
if (p.age && p.age <= CHILD_MAX_AGE) {
|
|
7092
7093
|
ids.push(p.id);
|
|
7093
7094
|
} else if (p.dateOfBirth) {
|
|
7094
7095
|
var diff = differenceInYears(new Date(), new Date(p.dateOfBirth));
|
|
7095
|
-
if (diff <=
|
|
7096
|
+
if (diff <= CHILD_MAX_AGE) {
|
|
7096
7097
|
ids.push(p.id);
|
|
7097
7098
|
}
|
|
7098
7099
|
}
|
|
@@ -12156,7 +12157,7 @@ var validateForm = function (values, agentRequired) {
|
|
|
12156
12157
|
);
|
|
12157
12158
|
} else if (values.startDate) {
|
|
12158
12159
|
var age = getAge(adult.birthDate, values.startDate);
|
|
12159
|
-
if (age
|
|
12160
|
+
if (age <= CHILD_MAX_AGE) {
|
|
12160
12161
|
set(
|
|
12161
12162
|
errors,
|
|
12162
12163
|
"adults[".concat(index, "].birthDate"),
|
|
@@ -12195,7 +12196,7 @@ var validateForm = function (values, agentRequired) {
|
|
|
12195
12196
|
);
|
|
12196
12197
|
} else if (values.startDate) {
|
|
12197
12198
|
var age = getAge(child.birthDate, values.startDate);
|
|
12198
|
-
if (age
|
|
12199
|
+
if (age > CHILD_MAX_AGE) {
|
|
12199
12200
|
set(
|
|
12200
12201
|
errors,
|
|
12201
12202
|
"children[".concat(index, "].birthDate"),
|
package/package.json
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import { BookingPackageFlight } from "@qite/tide-client/build/types";
|
|
2
|
-
import { first, last } from "lodash";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { getAirlines, getDateText, parseFlightLines } from "./sidebar-util";
|
|
5
|
-
import translations from "../../translations/translations.json";
|
|
6
|
-
|
|
7
|
-
interface SidebarFlightProps {
|
|
8
|
-
title: string;
|
|
9
|
-
flight: BookingPackageFlight;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const SidebarFlight: React.FC<SidebarFlightProps> = ({ title, flight }) => {
|
|
13
|
-
const flightLines = parseFlightLines(flight.flightMetaData);
|
|
14
|
-
const firstFlight = first(flightLines);
|
|
15
|
-
const lastFlight = last(flightLines);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="pricing-summary__group">
|
|
19
|
-
<h6 className="pricing-summary__title">{title}</h6>
|
|
20
|
-
<div className="pricing-summary__row">
|
|
21
|
-
<div className="pricing-summary__property">
|
|
22
|
-
{translations.SIDEBAR.FLIGHT_DEPARTURE}
|
|
23
|
-
</div>
|
|
24
|
-
<div className="pricing-summary__value">
|
|
25
|
-
{firstFlight?.departureAirportDescription} (
|
|
26
|
-
{firstFlight?.departureAirportIata})<br />
|
|
27
|
-
{getDateText(firstFlight?.departureDate)} {firstFlight?.departureTime}
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div className="pricing-summary__row">
|
|
32
|
-
<div className="pricing-summary__property">
|
|
33
|
-
{translations.SIDEBAR.FLIGHT_ARRIVAL}
|
|
34
|
-
</div>
|
|
35
|
-
<div className="pricing-summary__value">
|
|
36
|
-
{lastFlight?.arrivalAirportDescription} (
|
|
37
|
-
{lastFlight?.arrivalAirportIata})<br />
|
|
38
|
-
{getDateText(lastFlight?.arrivalDate)} {lastFlight?.arrivalTime}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div className="pricing-summary__row">
|
|
43
|
-
<div className="pricing-summary__property">
|
|
44
|
-
{flight.flightMetaData.flightLines.length > 1 && (
|
|
45
|
-
<i>
|
|
46
|
-
{flight.flightMetaData.flightLines.length - 1}
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<div className="pricing-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
import { BookingPackageFlight } from "@qite/tide-client/build/types";
|
|
2
|
+
import { first, last } from "lodash";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { getAirlines, getDateText, parseFlightLines } from "./sidebar-util";
|
|
5
|
+
import translations from "../../translations/translations.json";
|
|
6
|
+
|
|
7
|
+
interface SidebarFlightProps {
|
|
8
|
+
title: string;
|
|
9
|
+
flight: BookingPackageFlight;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const SidebarFlight: React.FC<SidebarFlightProps> = ({ title, flight }) => {
|
|
13
|
+
const flightLines = parseFlightLines(flight.flightMetaData);
|
|
14
|
+
const firstFlight = first(flightLines);
|
|
15
|
+
const lastFlight = last(flightLines);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="pricing-summary__group">
|
|
19
|
+
<h6 className="pricing-summary__title">{title}</h6>
|
|
20
|
+
<div className="pricing-summary__row">
|
|
21
|
+
<div className="pricing-summary__property">
|
|
22
|
+
{translations.SIDEBAR.FLIGHT_DEPARTURE}
|
|
23
|
+
</div>
|
|
24
|
+
<div className="pricing-summary__value">
|
|
25
|
+
{firstFlight?.departureAirportDescription} (
|
|
26
|
+
{firstFlight?.departureAirportIata})<br />
|
|
27
|
+
{getDateText(firstFlight?.departureDate)} {firstFlight?.departureTime}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div className="pricing-summary__row">
|
|
32
|
+
<div className="pricing-summary__property">
|
|
33
|
+
{translations.SIDEBAR.FLIGHT_ARRIVAL}
|
|
34
|
+
</div>
|
|
35
|
+
<div className="pricing-summary__value">
|
|
36
|
+
{lastFlight?.arrivalAirportDescription} (
|
|
37
|
+
{lastFlight?.arrivalAirportIata})<br />
|
|
38
|
+
{getDateText(lastFlight?.arrivalDate)} {lastFlight?.arrivalTime}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div className="pricing-summary__row">
|
|
43
|
+
<div className="pricing-summary__property">
|
|
44
|
+
{flight.flightMetaData.flightLines.length > 1 && (
|
|
45
|
+
<i>
|
|
46
|
+
{flight.flightMetaData.flightLines.length - 1}
|
|
47
|
+
{"x "}
|
|
48
|
+
{translations.SIDEBAR.CHANGES}
|
|
49
|
+
</i>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
<div className="pricing-summary__value">{getAirlines(flightLines)}</div>
|
|
53
|
+
</div>
|
|
54
|
+
{flight.flightMetaData.luggageIncluded && (
|
|
55
|
+
<div className="pricing-summary__row">
|
|
56
|
+
<div className="pricing-summary__property"></div>
|
|
57
|
+
<div className="pricing-summary__value">
|
|
58
|
+
{translations.SIDEBAR.LUGGAGE_INCLUDED}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default SidebarFlight;
|
|
@@ -8,6 +8,7 @@ export interface TravelersFormState {
|
|
|
8
8
|
formValues?: TravelersFormValues;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export const CHILD_MAX_AGE = 17;
|
|
11
12
|
const isDebug = false;
|
|
12
13
|
|
|
13
14
|
const debugFormValues = {
|
|
@@ -100,12 +101,12 @@ export const selectAdultIds = createSelector(selectRequestRooms, (rooms) => {
|
|
|
100
101
|
if (rooms) {
|
|
101
102
|
rooms.forEach((x) =>
|
|
102
103
|
x.pax.forEach((p) => {
|
|
103
|
-
if (p.age && p.age >
|
|
104
|
+
if (p.age && p.age > CHILD_MAX_AGE) {
|
|
104
105
|
ids.push(p.id);
|
|
105
106
|
} else if (p.dateOfBirth) {
|
|
106
107
|
const diff = differenceInYears(new Date(), new Date(p.dateOfBirth));
|
|
107
108
|
|
|
108
|
-
if (diff >
|
|
109
|
+
if (diff > CHILD_MAX_AGE) {
|
|
109
110
|
ids.push(p.id);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
@@ -120,12 +121,12 @@ export const selectChildIds = createSelector(selectRequestRooms, (rooms) => {
|
|
|
120
121
|
if (rooms) {
|
|
121
122
|
rooms.forEach((x) =>
|
|
122
123
|
x.pax.forEach((p) => {
|
|
123
|
-
if (p.age && p.age <=
|
|
124
|
+
if (p.age && p.age <= CHILD_MAX_AGE) {
|
|
124
125
|
ids.push(p.id);
|
|
125
126
|
} else if (p.dateOfBirth) {
|
|
126
127
|
const diff = differenceInYears(new Date(), new Date(p.dateOfBirth));
|
|
127
128
|
|
|
128
|
-
if (diff <=
|
|
129
|
+
if (diff <= CHILD_MAX_AGE) {
|
|
129
130
|
ids.push(p.id);
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormikErrors } from "formik";
|
|
2
2
|
import { isEmpty, set } from "lodash";
|
|
3
3
|
import { TravelersFormValues } from "../../types";
|
|
4
|
+
import { CHILD_MAX_AGE } from "./travelers-form-slice";
|
|
4
5
|
|
|
5
6
|
function isValidEmail(email: string) {
|
|
6
7
|
return !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(email);
|
|
@@ -51,7 +52,7 @@ const validateForm = (values: TravelersFormValues, agentRequired?: boolean) => {
|
|
|
51
52
|
} else if (values.startDate) {
|
|
52
53
|
const age = getAge(adult.birthDate, values.startDate);
|
|
53
54
|
|
|
54
|
-
if (age
|
|
55
|
+
if (age <= CHILD_MAX_AGE) {
|
|
55
56
|
set(
|
|
56
57
|
errors,
|
|
57
58
|
`adults[${index}].birthDate`,
|
|
@@ -95,7 +96,7 @@ const validateForm = (values: TravelersFormValues, agentRequired?: boolean) => {
|
|
|
95
96
|
} else if (values.startDate) {
|
|
96
97
|
const age = getAge(child.birthDate, values.startDate);
|
|
97
98
|
|
|
98
|
-
if (age
|
|
99
|
+
if (age > CHILD_MAX_AGE) {
|
|
99
100
|
set(
|
|
100
101
|
errors,
|
|
101
102
|
`children[${index}].birthDate`,
|