@qite/tide-components 1.0.1 → 1.0.3
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/README.md +392 -421
- package/build/build-cjs/index.js +1031 -133
- package/build/build-cjs/src/booking-wizard/features/booking/selectors.d.ts +5 -5
- package/build/build-cjs/src/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/features/travelers-form/validate-form.d.ts +1 -1
- package/build/build-cjs/src/booking-wizard/types.d.ts +15 -0
- package/build/build-cjs/src/search-results/components/traject/traject-node-card.d.ts +14 -0
- package/build/build-cjs/src/search-results/components/traject/traject-results.d.ts +6 -0
- package/build/build-cjs/src/search-results/hooks/use-traject-availability.d.ts +2 -0
- package/build/build-cjs/src/search-results/store/search-results-slice.d.ts +21 -2
- package/build/build-cjs/src/search-results/types.d.ts +2 -1
- package/build/build-cjs/src/search-results/utils/flight-booking-params.d.ts +18 -0
- package/build/build-cjs/src/search-results/utils/traject-utils.d.ts +33 -0
- package/build/build-cjs/src/shared/booking/travelers-form.d.ts +3 -2
- package/build/build-esm/index.js +1032 -134
- package/build/build-esm/src/booking-wizard/features/booking/selectors.d.ts +5 -5
- package/build/build-esm/src/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/features/travelers-form/validate-form.d.ts +1 -1
- package/build/build-esm/src/booking-wizard/types.d.ts +15 -0
- package/build/build-esm/src/search-results/components/traject/traject-node-card.d.ts +14 -0
- package/build/build-esm/src/search-results/components/traject/traject-results.d.ts +6 -0
- package/build/build-esm/src/search-results/hooks/use-traject-availability.d.ts +2 -0
- package/build/build-esm/src/search-results/store/search-results-slice.d.ts +21 -2
- package/build/build-esm/src/search-results/types.d.ts +2 -1
- package/build/build-esm/src/search-results/utils/flight-booking-params.d.ts +18 -0
- package/build/build-esm/src/search-results/utils/traject-utils.d.ts +33 -0
- package/build/build-esm/src/shared/booking/travelers-form.d.ts +3 -2
- package/package.json +2 -2
|
@@ -185,19 +185,19 @@ export declare const selectTranslations: ((state: {
|
|
|
185
185
|
priceDetails: import("../price-details/price-details-slice").PriceDetailsState;
|
|
186
186
|
summary: import("../summary/summary-slice").SummaryState;
|
|
187
187
|
apiSettings: import("../../..").ApiSettingsState;
|
|
188
|
-
}) =>
|
|
188
|
+
}) => any) & {
|
|
189
189
|
clearCache: () => void;
|
|
190
190
|
resultsCount: () => number;
|
|
191
191
|
resetResultsCount: () => void;
|
|
192
192
|
} & {
|
|
193
|
-
resultFunc: (resultFuncArgs_0:
|
|
194
|
-
memoizedResultFunc: ((resultFuncArgs_0:
|
|
193
|
+
resultFunc: (resultFuncArgs_0: string, resultFuncArgs_1: any) => any;
|
|
194
|
+
memoizedResultFunc: ((resultFuncArgs_0: string, resultFuncArgs_1: any) => any) & {
|
|
195
195
|
clearCache: () => void;
|
|
196
196
|
resultsCount: () => number;
|
|
197
197
|
resetResultsCount: () => void;
|
|
198
198
|
};
|
|
199
|
-
lastResult: () =>
|
|
200
|
-
dependencies: [(state: RootState) =>
|
|
199
|
+
lastResult: () => any;
|
|
200
|
+
dependencies: [(state: RootState) => string, ((state: {
|
|
201
201
|
booking: import("./booking-slice").BookingState;
|
|
202
202
|
travelersForm: import("../travelers-form/travelers-form-slice").TravelersFormState;
|
|
203
203
|
priceDetails: import("../price-details/price-details-slice").PriceDetailsState;
|
package/build/build-cjs/src/booking-wizard/features/travelers-form/travelers-form-slice.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface TravelersFormState {
|
|
|
5
5
|
isTravelersFirst?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const CHILD_MAX_AGE = 17;
|
|
8
|
+
export declare const BABY_MAX_AGE = 1;
|
|
8
9
|
export declare const setFormValues: import("@reduxjs/toolkit").ActionCreatorWithPayload<TravelersFormValues, "travelersForm/setFormValues">;
|
|
9
10
|
export declare const selectTravelersFormValues: (state: RootState) => TravelersFormValues | undefined;
|
|
10
11
|
export declare const selectRooms: ((state: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FormikErrors } from 'formik';
|
|
2
2
|
import { FormField, TravelersFormValues } from '../../types';
|
|
3
|
-
declare const validateForm: (values: TravelersFormValues, agentRequired?: boolean, bookingType?: string, translations?: any, formFields?: FormField[], mainBookerFormFields?: FormField[], maxChildAge?: number) => FormikErrors<TravelersFormValues>;
|
|
3
|
+
declare const validateForm: (values: TravelersFormValues, agentRequired?: boolean, bookingType?: string, translations?: any, formFields?: FormField[], mainBookerFormFields?: FormField[], maxChildAge?: number, maxBabyAge?: number) => FormikErrors<TravelersFormValues>;
|
|
4
4
|
export default validateForm;
|
|
@@ -102,6 +102,16 @@ export interface Settings {
|
|
|
102
102
|
* See TIDE-3197.
|
|
103
103
|
*/
|
|
104
104
|
maxChildAge?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Maximum age (inclusive) at which a child traveler is still considered a baby.
|
|
107
|
+
* Babies get the BABY label instead of CHILD in the travelers form, and their
|
|
108
|
+
* birth date is validated against the travel start date instead of the end
|
|
109
|
+
* date: they have to be younger than maxBabyAge + 1 on departure.
|
|
110
|
+
*
|
|
111
|
+
* When omitted, the wizard falls back to BABY_MAX_AGE (1, i.e. baby = younger
|
|
112
|
+
* than 2 on departure). See TIDE-3269.
|
|
113
|
+
*/
|
|
114
|
+
maxBabyAge?: number;
|
|
105
115
|
}
|
|
106
116
|
export interface FormField {
|
|
107
117
|
type: string;
|
|
@@ -133,6 +143,11 @@ export interface Traveler {
|
|
|
133
143
|
lastName: string;
|
|
134
144
|
birthDate: string;
|
|
135
145
|
age?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Set when the traveler was booked as a baby (see settings.maxBabyAge), so the
|
|
148
|
+
* form and its validation can treat the traveler as a baby instead of a child.
|
|
149
|
+
*/
|
|
150
|
+
isBaby?: boolean;
|
|
136
151
|
}
|
|
137
152
|
export interface Room {
|
|
138
153
|
adults: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PackagingAccommodationResponse } from '@qite/tide-client';
|
|
3
|
+
import { TrajectNodeWithLine } from '../../utils/traject-utils';
|
|
4
|
+
interface TrajectNodeCardProps {
|
|
5
|
+
item: TrajectNodeWithLine;
|
|
6
|
+
result: PackagingAccommodationResponse;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
languageCode?: string;
|
|
9
|
+
translations: any;
|
|
10
|
+
onSelect: () => void;
|
|
11
|
+
showNights?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const TrajectNodeCard: React.FC<TrajectNodeCardProps>;
|
|
14
|
+
export default TrajectNodeCard;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcursionSearchParams, ExtendedFlightSearchResponseItem, Filter, FlyInType, SortByType } from '../types';
|
|
2
|
-
import { BookingPackage, BookingPackageItem, BookingPriceDetails, ClientPortalItinerary, PackagingAccommodationResponse, PackagingEntry, PackagingFlightResponse } from '@qite/tide-client/build/types';
|
|
2
|
+
import { BookingPackage, BookingPackageItem, BookingPriceDetails, ClientPortalItinerary, PackagingAccommodationResponse, PackagingEntry, PackagingEntryLine, PackagingFlightResponse } from '@qite/tide-client/build/types';
|
|
3
3
|
export interface SearchResultsState {
|
|
4
4
|
results: BookingPackageItem[];
|
|
5
5
|
filteredResults: BookingPackageItem[];
|
|
@@ -38,6 +38,17 @@ export interface SearchResultsState {
|
|
|
38
38
|
bookPackagingEntry: boolean;
|
|
39
39
|
currentStep: number;
|
|
40
40
|
bookingNumber?: string;
|
|
41
|
+
/** Per-traject-node availability, keyed by the entry line guid the node maps to. */
|
|
42
|
+
trajectNodeAvailability: Record<string, TrajectNodeAvailability>;
|
|
43
|
+
trajectFlightsResolved: boolean;
|
|
44
|
+
}
|
|
45
|
+
export type TrajectNodeStatus = 'idle' | 'loading' | 'resolved' | 'unavailable';
|
|
46
|
+
export interface TrajectNodeAvailability {
|
|
47
|
+
lineGuid: string;
|
|
48
|
+
status: TrajectNodeStatus;
|
|
49
|
+
results: PackagingAccommodationResponse[];
|
|
50
|
+
selectedCode: string | null;
|
|
51
|
+
preferredUnavailable: boolean;
|
|
41
52
|
}
|
|
42
53
|
export declare const setResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<BookingPackageItem[], "searchResults/setResults">, setFilteredResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<BookingPackageItem[], "searchResults/setFilteredResults">, setSelectedSearchResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<BookingPackageItem | null, "searchResults/setSelectedSearchResult">, setPackagingAccoResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingAccommodationResponse[], "searchResults/setPackagingAccoResults">, setFilteredPackagingAccoResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingAccommodationResponse[], "searchResults/setFilteredPackagingAccoResults">, setFilteredPackagingFlightResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingFlightResponse[], "searchResults/setFilteredPackagingFlightResults">, setPackagingAccoSearchDetails: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingAccommodationResponse[], "searchResults/setPackagingAccoSearchDetails">, setSelectedPackagingAccoResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "searchResults/setSelectedPackagingAccoResult">, setPackagingFlightResults: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingFlightResponse[], "searchResults/setPackagingFlightResults">, setSelectedPackagingFlight: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingFlightResponse | null, "searchResults/setSelectedPackagingFlight">, setSelectedFlight: import("@reduxjs/toolkit").ActionCreatorWithPayload<ExtendedFlightSearchResponseItem | null, "searchResults/setSelectedFlight">, setSelectedFlightDetails: import("@reduxjs/toolkit").ActionCreatorWithPayload<ExtendedFlightSearchResponseItem | null, "searchResults/setSelectedFlightDetails">, setBookingPackageDetails: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
43
54
|
details: BookingPackage;
|
|
@@ -52,6 +63,14 @@ export declare const setResults: import("@reduxjs/toolkit").ActionCreatorWithPay
|
|
|
52
63
|
excursionCode: string;
|
|
53
64
|
}, "searchResults/removeConfirmedExcursionForDay">, clearConfirmedExcursionsForDay: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
54
65
|
dayKey: string;
|
|
55
|
-
}, "searchResults/clearConfirmedExcursionsForDay">, setBookPackagingEntry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "searchResults/setBookPackagingEntry">, setCurrentStep: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "searchResults/setCurrentStep">, setBookingNumber: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "searchResults/setBookingNumber"
|
|
66
|
+
}, "searchResults/clearConfirmedExcursionsForDay">, setBookPackagingEntry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "searchResults/setBookPackagingEntry">, setCurrentStep: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "searchResults/setCurrentStep">, setBookingNumber: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "searchResults/setBookingNumber">, setTrajectNodeLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "searchResults/setTrajectNodeLoading">, setTrajectNodeAvailability: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
67
|
+
lineGuid: string;
|
|
68
|
+
results: PackagingAccommodationResponse[];
|
|
69
|
+
selectedCode: string | null;
|
|
70
|
+
preferredUnavailable: boolean;
|
|
71
|
+
}, "searchResults/setTrajectNodeAvailability">, setTrajectNodeSelection: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
72
|
+
lineGuid: string;
|
|
73
|
+
code: string;
|
|
74
|
+
}, "searchResults/setTrajectNodeSelection">, setTrajectFlightsResolved: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "searchResults/setTrajectFlightsResolved">, resetTrajectAvailability: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"searchResults/resetTrajectAvailability">, updateEditableEntryLine: import("@reduxjs/toolkit").ActionCreatorWithPayload<PackagingEntryLine, "searchResults/updateEditableEntryLine">, removeEditableEntryLines: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "searchResults/removeEditableEntryLines">;
|
|
56
75
|
declare const _default: import("@reduxjs/toolkit").Reducer<SearchResultsState>;
|
|
57
76
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BookingPackage, BookingPackageRequestRoom, FlightSearchResponseItem, PackageMainRoom, PackagingEntry, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
|
|
1
|
+
import { BookingPackage, BookingPackageRequestRoom, FlightSearchResponseItem, PackageMainRoom, PackagingEntry, PackagingTrajectResponse, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export type FlightSelectionMode = 'paired' | 'independent';
|
|
4
4
|
export interface SearchResultsConfiguration {
|
|
@@ -38,6 +38,7 @@ export interface SearchResultsConfiguration {
|
|
|
38
38
|
onBook?: (result: BookingPackage) => void;
|
|
39
39
|
onFlightBook?: (result: ExtendedFlightSearchResponseItem) => void;
|
|
40
40
|
packagingEntry?: PackagingEntry | null;
|
|
41
|
+
trajectEntry?: PackagingTrajectResponse | null;
|
|
41
42
|
generatePaymentUrl?: boolean;
|
|
42
43
|
entryStatus?: number;
|
|
43
44
|
customEntryStatusId?: number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FlightSearchResponseItem } from '@qite/tide-client';
|
|
2
|
+
import { FlightInfo, Room } from '../../booking-wizard/types';
|
|
3
|
+
export interface FlightBookingParamsOptions {
|
|
4
|
+
catalogueId: number;
|
|
5
|
+
rooms: Omit<Room, 'children'>[];
|
|
6
|
+
}
|
|
7
|
+
export declare const buildFlightInfo: (flight: FlightSearchResponseItem) => FlightInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Serializes a flight search result into the query string the booking wizard parses (see the
|
|
10
|
+
* getters in shared/utils/query-string-util and the request it builds in booking-wizard/features/booking).
|
|
11
|
+
*
|
|
12
|
+
* The wizard only books a flight when both flightRouteId and flight are present, and a flight has no
|
|
13
|
+
* product of its own, so productCode stays empty. productName is only shown in the wizard, never sent
|
|
14
|
+
* to Tide; it defaults to the outward flight code.
|
|
15
|
+
*
|
|
16
|
+
* Returns a mutable URLSearchParams so the host can add or override its own params before navigating.
|
|
17
|
+
*/
|
|
18
|
+
export declare const buildFlightBookingParams: (flight: FlightSearchResponseItem, { catalogueId, rooms }: FlightBookingParamsOptions) => URLSearchParams;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PackagingAccommodationRequest, PackagingAccommodationResponse, PackagingEntry, PackagingEntryLine, PackagingFlightResponse, PackagingRoom, PackagingTrajectAlternative, PackagingTrajectNode, PackagingTrajectResponse } from '@qite/tide-client';
|
|
2
|
+
export declare const REGULAR_TRAJECT_NODE_TYPE = 0;
|
|
3
|
+
export declare const CONNECTING_TRAJECT_NODE_TYPE = 1;
|
|
4
|
+
export interface TrajectNodeWithLine {
|
|
5
|
+
node: PackagingTrajectNode;
|
|
6
|
+
line: PackagingEntryLine;
|
|
7
|
+
}
|
|
8
|
+
export declare const isSearchableTrajectNode: (node: PackagingTrajectNode) => boolean;
|
|
9
|
+
export declare const isTrajectFlightNode: (node: PackagingTrajectNode) => boolean;
|
|
10
|
+
export declare const getTrajectNodesWithLines: (trajectEntry: PackagingTrajectResponse) => TrajectNodeWithLine[];
|
|
11
|
+
export interface TrajectSearchContext {
|
|
12
|
+
transactionId: string;
|
|
13
|
+
officeId: number;
|
|
14
|
+
catalogueId: number;
|
|
15
|
+
searchConfigurationId: number;
|
|
16
|
+
portalId?: number | null;
|
|
17
|
+
agentId?: number | null;
|
|
18
|
+
language: string;
|
|
19
|
+
rooms: PackagingAccommodationRequest['rooms'];
|
|
20
|
+
}
|
|
21
|
+
export declare const buildTrajectNodeRequest: ({ node, line }: TrajectNodeWithLine, context: TrajectSearchContext, productCode: string) => PackagingAccommodationRequest;
|
|
22
|
+
export declare const getNodeCandidates: (node: PackagingTrajectNode) => PackagingTrajectAlternative[];
|
|
23
|
+
export declare const findCandidateForResult: (node: PackagingTrajectNode, result: PackagingAccommodationResponse) => PackagingTrajectAlternative | null;
|
|
24
|
+
export declare const matchesCode: (result: PackagingAccommodationResponse, code: string) => boolean;
|
|
25
|
+
export declare const getPackagingRoomsFromEntry: (entry: PackagingEntry) => PackagingRoom[];
|
|
26
|
+
export declare const pickCheapest: (results: PackagingAccommodationResponse[]) => PackagingAccommodationResponse | null;
|
|
27
|
+
export declare const applyResultToLine: (line: PackagingEntryLine, result: PackagingAccommodationResponse) => PackagingEntryLine;
|
|
28
|
+
export declare const applyFlightToLine: (line: PackagingEntryLine, flight: PackagingFlightResponse, isOutbound: boolean) => PackagingEntryLine;
|
|
29
|
+
export declare const pairTrajectFlights: (nodes: TrajectNodeWithLine[]) => {
|
|
30
|
+
outbound: TrajectNodeWithLine;
|
|
31
|
+
inbound: TrajectNodeWithLine | null;
|
|
32
|
+
unsupported: TrajectNodeWithLine[];
|
|
33
|
+
};
|
|
@@ -38,13 +38,14 @@ export interface SharedTravelersFormProps {
|
|
|
38
38
|
renderPreviousButton?: () => ReactNode;
|
|
39
39
|
onBookingTypeChange?: (bookingType: string) => void;
|
|
40
40
|
}
|
|
41
|
+
export declare function isBabyAge(age?: number | null, maxBabyAge?: number): boolean;
|
|
41
42
|
export declare function createTraveler(traveler: RoomTraveler, followNumber: {
|
|
42
43
|
number: number;
|
|
43
|
-
}, personTranslation?: string, isCompact?: boolean): Traveler;
|
|
44
|
+
}, personTranslation?: string, isCompact?: boolean, maxBabyAge?: number): Traveler;
|
|
44
45
|
export declare function createInitialValuesFromRooms(formRooms: {
|
|
45
46
|
adults: RoomTraveler[];
|
|
46
47
|
children: RoomTraveler[];
|
|
47
|
-
}[], startDate?: string, endDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean): TravelersFormValues;
|
|
48
|
+
}[], startDate?: string, endDate?: string, agentAdressId?: number, personTranslation?: string, isCompact?: boolean, maxBabyAge?: number): TravelersFormValues;
|
|
48
49
|
export declare function createInitialValuesFromEditablePackagingEntry(editablePackagingEntry: PackagingEntry, agentAdressId?: number): TravelersFormValues;
|
|
49
50
|
export declare function applyTravelersFormValuesToEditablePackagingEntry(editablePackagingEntry: PackagingEntry, values: TravelersFormValues): {
|
|
50
51
|
pax: PackagingEntryPax[];
|