@qite/tide-booking-component 1.4.126 → 1.4.127

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.
@@ -17788,6 +17788,7 @@ const selectCalculateDeposit = (state) => state.booking.calculateDeposit;
17788
17788
  const selectShowCommission = (state) => state.booking.showCommission;
17789
17789
  const selectIsRetry = (state) => state.booking.isRetry;
17790
17790
  const selectStartDate = (state) => state.booking.package?.options.find((x) => x.isSelected)?.fromDate;
17791
+ const selectEndDate = (state) => state.booking.package?.options.find((x) => x.isSelected)?.toDate;
17791
17792
  const selectAgents = (state) => state.booking.agents;
17792
17793
  const selectCountries = (state) => state.booking.countries;
17793
17794
  const selectProductCode = (state) => state.booking.productAttributes?.productCode;
@@ -22026,8 +22027,9 @@ const validateForm$1 = (values, agentRequired, bookingType, translations, formFi
22026
22027
  if (lodash.isEmpty(adult.birthDate)) {
22027
22028
  lodash.set(errors, `rooms[${rIndex}].adults[${index}].birthDate`, formatTravelerField(rIndex + 1, index + 1, translations.TRAVELERS_FORM.BIRTHDATE));
22028
22029
  }
22029
- else if (values.startDate) {
22030
- const age = getAge(adult.birthDate, values.startDate);
22030
+ else if (values.endDate) {
22031
+ // If you are younger than the maxChildAge at the end of the trip, you are considered a child, so we check the endDate here instead of the startDate
22032
+ const age = getAge(adult.birthDate, values.endDate);
22031
22033
  if (age <= maxChildAge) {
22032
22034
  lodash.set(errors, `rooms[${rIndex}].adults[${index}].birthDate`, formatTravelerIsNoAdult(rIndex + 1, index + 1));
22033
22035
  }
@@ -22048,8 +22050,9 @@ const validateForm$1 = (values, agentRequired, bookingType, translations, formFi
22048
22050
  if (lodash.isEmpty(child.birthDate)) {
22049
22051
  lodash.set(errors, `rooms[${rIndex}].children[${index}].birthDate`, formatTravelerField(rIndex + 1, r.adults.length + index + 1, translations.TRAVELERS_FORM.BIRTHDATE));
22050
22052
  }
22051
- else if (values.startDate) {
22052
- const age = getAge(child.birthDate, values.startDate);
22053
+ else if (values.endDate) {
22054
+ // You need to be under the maxChildAge until the end of the trip, so we check the endDate here instead of the startDate
22055
+ const age = getAge(child.birthDate, values.endDate);
22053
22056
  if (age > maxChildAge) {
22054
22057
  lodash.set(errors, `rooms[${rIndex}].children[${index}].birthDate`, formatTravelerIsNoChild(rIndex + 1, r.adults.length + index + 1));
22055
22058
  }
@@ -22273,10 +22276,11 @@ function createTraveler(traveler, followNumber, personTranslation, isCompact) {
22273
22276
  gender: ''
22274
22277
  };
22275
22278
  }
22276
- function createInitialValuesFromRooms(formRooms, startDate, agentAdressId, personTranslation, isCompact) {
22279
+ function createInitialValuesFromRooms(formRooms, startDate, endDate, agentAdressId, personTranslation, isCompact) {
22277
22280
  const followNumber = { number: 1 };
22278
22281
  const initialValues = {
22279
22282
  startDate,
22283
+ endDate,
22280
22284
  rooms: formRooms.map((room) => ({
22281
22285
  adults: room.adults.map((traveler) => createTraveler(traveler, followNumber, personTranslation, isCompact)),
22282
22286
  children: room.children.map((traveler) => createTraveler(traveler, followNumber, personTranslation, isCompact))
@@ -22326,7 +22330,7 @@ function createInitialValuesFromEditablePackagingEntry(editablePackagingEntry, a
22326
22330
  })
22327
22331
  };
22328
22332
  });
22329
- const values = createInitialValuesFromRooms(rooms.map((room) => ({ adults: room.adults, children: room.children })), editablePackagingEntry?.lines?.[0]?.from, agentAdressId);
22333
+ const values = createInitialValuesFromRooms(rooms.map((room) => ({ adults: room.adults, children: room.children })), lodash.first(editablePackagingEntry?.lines)?.from, lodash.last(editablePackagingEntry?.lines)?.to, agentAdressId);
22330
22334
  values.rooms = rooms;
22331
22335
  values.mainBookerId = pax.find((x) => x.isMainBooker)?.id ?? rooms[0]?.adults?.[0]?.id ?? -1;
22332
22336
  const address = editablePackagingEntry?.address;
@@ -22604,6 +22608,7 @@ const TravelersForm = () => {
22604
22608
  const navigate = settings.skipRouter ? () => { } : reactRouter.useNavigate();
22605
22609
  const bookingQueryString = reactRedux.useSelector(selectBookingQueryString);
22606
22610
  const startDate = reactRedux.useSelector(selectStartDate);
22611
+ const endDate = reactRedux.useSelector(selectEndDate);
22607
22612
  const selectFormRooms = React.useMemo(() => makeSelectFormRooms(settings.maxChildAge), [settings.maxChildAge]);
22608
22613
  const formRooms = reactRedux.useSelector(selectFormRooms);
22609
22614
  const bookingType = reactRedux.useSelector(selectBookingType);
@@ -22620,7 +22625,7 @@ const TravelersForm = () => {
22620
22625
  const useCompactForm = !!settings.travellers.compactForm && !!settings.agentAdressId;
22621
22626
  const showAllCountries = !!settings.travellers.showAllCountries;
22622
22627
  const initialValues = reactRedux.useSelector(selectTravelersFormValues) ??
22623
- createInitialValuesFromRooms(formRooms, startDate, agentAdressId, translations.TRAVELERS_FORM.PERSON, useCompactForm);
22628
+ createInitialValuesFromRooms(formRooms, startDate, endDate, agentAdressId, translations.TRAVELERS_FORM.PERSON, useCompactForm);
22624
22629
  const [showAgentSelection, setShowAgentSelection] = React.useState(!settings.agentAdressId && !settings.hideAgentSelection);
22625
22630
  const formik$1 = formik.useFormik({
22626
22631
  initialValues,
@@ -256,6 +256,7 @@ export declare const selectCalculateDeposit: (state: RootState) => boolean;
256
256
  export declare const selectShowCommission: (state: RootState) => boolean | undefined;
257
257
  export declare const selectIsRetry: (state: RootState) => boolean;
258
258
  export declare const selectStartDate: (state: RootState) => string | undefined;
259
+ export declare const selectEndDate: (state: RootState) => string | undefined;
259
260
  export declare const selectAgents: (state: RootState) => import("@qite/tide-client").BookingTravelAgent[] | undefined;
260
261
  export declare const selectCountries: (state: RootState) => import("@qite/tide-client").CountryItem[] | undefined;
261
262
  export declare const selectProductCode: (state: RootState) => string | undefined;
@@ -163,6 +163,7 @@ export interface FlightInfo {
163
163
  export interface TravelersFormValues {
164
164
  rooms: TravelersFormRoomValues[];
165
165
  startDate?: string;
166
+ endDate?: string;
166
167
  mainBookerId: number;
167
168
  street: string;
168
169
  houseNumber: string;
@@ -44,7 +44,7 @@ export declare function createTraveler(traveler: RoomTraveler, followNumber: {
44
44
  export declare function createInitialValuesFromRooms(formRooms: {
45
45
  adults: RoomTraveler[];
46
46
  children: RoomTraveler[];
47
- }[], startDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean): TravelersFormValues;
47
+ }[], startDate?: string, endDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean): TravelersFormValues;
48
48
  export declare function createInitialValuesFromEditablePackagingEntry(editablePackagingEntry: PackagingEntry, agentAdressId?: number): TravelersFormValues;
49
49
  export declare function applyTravelersFormValuesToEditablePackagingEntry(editablePackagingEntry: PackagingEntry, values: TravelersFormValues): {
50
50
  pax: PackagingEntryPax[];
@@ -17759,6 +17759,7 @@ const selectCalculateDeposit = (state) => state.booking.calculateDeposit;
17759
17759
  const selectShowCommission = (state) => state.booking.showCommission;
17760
17760
  const selectIsRetry = (state) => state.booking.isRetry;
17761
17761
  const selectStartDate = (state) => state.booking.package?.options.find((x) => x.isSelected)?.fromDate;
17762
+ const selectEndDate = (state) => state.booking.package?.options.find((x) => x.isSelected)?.toDate;
17762
17763
  const selectAgents = (state) => state.booking.agents;
17763
17764
  const selectCountries = (state) => state.booking.countries;
17764
17765
  const selectProductCode = (state) => state.booking.productAttributes?.productCode;
@@ -21997,8 +21998,9 @@ const validateForm$1 = (values, agentRequired, bookingType, translations, formFi
21997
21998
  if (isEmpty$1(adult.birthDate)) {
21998
21999
  set(errors, `rooms[${rIndex}].adults[${index}].birthDate`, formatTravelerField(rIndex + 1, index + 1, translations.TRAVELERS_FORM.BIRTHDATE));
21999
22000
  }
22000
- else if (values.startDate) {
22001
- const age = getAge(adult.birthDate, values.startDate);
22001
+ else if (values.endDate) {
22002
+ // If you are younger than the maxChildAge at the end of the trip, you are considered a child, so we check the endDate here instead of the startDate
22003
+ const age = getAge(adult.birthDate, values.endDate);
22002
22004
  if (age <= maxChildAge) {
22003
22005
  set(errors, `rooms[${rIndex}].adults[${index}].birthDate`, formatTravelerIsNoAdult(rIndex + 1, index + 1));
22004
22006
  }
@@ -22019,8 +22021,9 @@ const validateForm$1 = (values, agentRequired, bookingType, translations, formFi
22019
22021
  if (isEmpty$1(child.birthDate)) {
22020
22022
  set(errors, `rooms[${rIndex}].children[${index}].birthDate`, formatTravelerField(rIndex + 1, r.adults.length + index + 1, translations.TRAVELERS_FORM.BIRTHDATE));
22021
22023
  }
22022
- else if (values.startDate) {
22023
- const age = getAge(child.birthDate, values.startDate);
22024
+ else if (values.endDate) {
22025
+ // You need to be under the maxChildAge until the end of the trip, so we check the endDate here instead of the startDate
22026
+ const age = getAge(child.birthDate, values.endDate);
22024
22027
  if (age > maxChildAge) {
22025
22028
  set(errors, `rooms[${rIndex}].children[${index}].birthDate`, formatTravelerIsNoChild(rIndex + 1, r.adults.length + index + 1));
22026
22029
  }
@@ -22244,10 +22247,11 @@ function createTraveler(traveler, followNumber, personTranslation, isCompact) {
22244
22247
  gender: ''
22245
22248
  };
22246
22249
  }
22247
- function createInitialValuesFromRooms(formRooms, startDate, agentAdressId, personTranslation, isCompact) {
22250
+ function createInitialValuesFromRooms(formRooms, startDate, endDate, agentAdressId, personTranslation, isCompact) {
22248
22251
  const followNumber = { number: 1 };
22249
22252
  const initialValues = {
22250
22253
  startDate,
22254
+ endDate,
22251
22255
  rooms: formRooms.map((room) => ({
22252
22256
  adults: room.adults.map((traveler) => createTraveler(traveler, followNumber, personTranslation, isCompact)),
22253
22257
  children: room.children.map((traveler) => createTraveler(traveler, followNumber, personTranslation, isCompact))
@@ -22297,7 +22301,7 @@ function createInitialValuesFromEditablePackagingEntry(editablePackagingEntry, a
22297
22301
  })
22298
22302
  };
22299
22303
  });
22300
- const values = createInitialValuesFromRooms(rooms.map((room) => ({ adults: room.adults, children: room.children })), editablePackagingEntry?.lines?.[0]?.from, agentAdressId);
22304
+ const values = createInitialValuesFromRooms(rooms.map((room) => ({ adults: room.adults, children: room.children })), first(editablePackagingEntry?.lines)?.from, last(editablePackagingEntry?.lines)?.to, agentAdressId);
22301
22305
  values.rooms = rooms;
22302
22306
  values.mainBookerId = pax.find((x) => x.isMainBooker)?.id ?? rooms[0]?.adults?.[0]?.id ?? -1;
22303
22307
  const address = editablePackagingEntry?.address;
@@ -22575,6 +22579,7 @@ const TravelersForm = () => {
22575
22579
  const navigate = settings.skipRouter ? () => { } : useNavigate();
22576
22580
  const bookingQueryString = useSelector(selectBookingQueryString);
22577
22581
  const startDate = useSelector(selectStartDate);
22582
+ const endDate = useSelector(selectEndDate);
22578
22583
  const selectFormRooms = useMemo(() => makeSelectFormRooms(settings.maxChildAge), [settings.maxChildAge]);
22579
22584
  const formRooms = useSelector(selectFormRooms);
22580
22585
  const bookingType = useSelector(selectBookingType);
@@ -22591,7 +22596,7 @@ const TravelersForm = () => {
22591
22596
  const useCompactForm = !!settings.travellers.compactForm && !!settings.agentAdressId;
22592
22597
  const showAllCountries = !!settings.travellers.showAllCountries;
22593
22598
  const initialValues = useSelector(selectTravelersFormValues) ??
22594
- createInitialValuesFromRooms(formRooms, startDate, agentAdressId, translations.TRAVELERS_FORM.PERSON, useCompactForm);
22599
+ createInitialValuesFromRooms(formRooms, startDate, endDate, agentAdressId, translations.TRAVELERS_FORM.PERSON, useCompactForm);
22595
22600
  const [showAgentSelection, setShowAgentSelection] = useState(!settings.agentAdressId && !settings.hideAgentSelection);
22596
22601
  const formik = useFormik({
22597
22602
  initialValues,
@@ -256,6 +256,7 @@ export declare const selectCalculateDeposit: (state: RootState) => boolean;
256
256
  export declare const selectShowCommission: (state: RootState) => boolean | undefined;
257
257
  export declare const selectIsRetry: (state: RootState) => boolean;
258
258
  export declare const selectStartDate: (state: RootState) => string | undefined;
259
+ export declare const selectEndDate: (state: RootState) => string | undefined;
259
260
  export declare const selectAgents: (state: RootState) => import("@qite/tide-client").BookingTravelAgent[] | undefined;
260
261
  export declare const selectCountries: (state: RootState) => import("@qite/tide-client").CountryItem[] | undefined;
261
262
  export declare const selectProductCode: (state: RootState) => string | undefined;
@@ -163,6 +163,7 @@ export interface FlightInfo {
163
163
  export interface TravelersFormValues {
164
164
  rooms: TravelersFormRoomValues[];
165
165
  startDate?: string;
166
+ endDate?: string;
166
167
  mainBookerId: number;
167
168
  street: string;
168
169
  houseNumber: string;
@@ -44,7 +44,7 @@ export declare function createTraveler(traveler: RoomTraveler, followNumber: {
44
44
  export declare function createInitialValuesFromRooms(formRooms: {
45
45
  adults: RoomTraveler[];
46
46
  children: RoomTraveler[];
47
- }[], startDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean): TravelersFormValues;
47
+ }[], startDate?: string, endDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean): TravelersFormValues;
48
48
  export declare function createInitialValuesFromEditablePackagingEntry(editablePackagingEntry: PackagingEntry, agentAdressId?: number): TravelersFormValues;
49
49
  export declare function applyTravelersFormValuesToEditablePackagingEntry(editablePackagingEntry: PackagingEntry, values: TravelersFormValues): {
50
50
  pax: PackagingEntryPax[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.126",
3
+ "version": "1.4.127",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "types": "build/build-cjs/src/index.d.ts",