@voyant-travel/flights-react 0.119.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.
- package/LICENSE +201 -0
- package/README.md +74 -0
- package/dist/admin/index.d.ts +134 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +122 -0
- package/dist/admin/pages/flight-book-page.d.ts +12 -0
- package/dist/admin/pages/flight-book-page.d.ts.map +1 -0
- package/dist/admin/pages/flight-book-page.js +40 -0
- package/dist/admin/pages/flights-index-page.d.ts +14 -0
- package/dist/admin/pages/flights-index-page.d.ts.map +1 -0
- package/dist/admin/pages/flights-index-page.js +28 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +75 -0
- package/dist/components/airline-logo.d.ts +19 -0
- package/dist/components/airline-logo.d.ts.map +1 -0
- package/dist/components/airline-logo.js +18 -0
- package/dist/components/airport-combobox.d.ts +20 -0
- package/dist/components/airport-combobox.d.ts.map +1 -0
- package/dist/components/airport-combobox.js +31 -0
- package/dist/components/billing-pickers.d.ts +19 -0
- package/dist/components/billing-pickers.d.ts.map +1 -0
- package/dist/components/billing-pickers.js +148 -0
- package/dist/components/flight-baggage-step.d.ts +32 -0
- package/dist/components/flight-baggage-step.d.ts.map +1 -0
- package/dist/components/flight-baggage-step.js +119 -0
- package/dist/components/flight-billing-step.d.ts +69 -0
- package/dist/components/flight-billing-step.d.ts.map +1 -0
- package/dist/components/flight-billing-step.js +117 -0
- package/dist/components/flight-booking-journey.d.ts +31 -0
- package/dist/components/flight-booking-journey.d.ts.map +1 -0
- package/dist/components/flight-booking-journey.js +103 -0
- package/dist/components/flight-booking-ledger.d.ts +53 -0
- package/dist/components/flight-booking-ledger.d.ts.map +1 -0
- package/dist/components/flight-booking-ledger.js +104 -0
- package/dist/components/flight-booking-page.d.ts +25 -0
- package/dist/components/flight-booking-page.d.ts.map +1 -0
- package/dist/components/flight-booking-page.js +175 -0
- package/dist/components/flight-booking-shell-helpers.d.ts +29 -0
- package/dist/components/flight-booking-shell-helpers.d.ts.map +1 -0
- package/dist/components/flight-booking-shell-helpers.js +204 -0
- package/dist/components/flight-booking-shell-panels.d.ts +24 -0
- package/dist/components/flight-booking-shell-panels.d.ts.map +1 -0
- package/dist/components/flight-booking-shell-panels.js +39 -0
- package/dist/components/flight-booking-shell-types.d.ts +49 -0
- package/dist/components/flight-booking-shell-types.d.ts.map +1 -0
- package/dist/components/flight-booking-shell-types.js +18 -0
- package/dist/components/flight-booking-shell.d.ts +12 -0
- package/dist/components/flight-booking-shell.d.ts.map +1 -0
- package/dist/components/flight-booking-shell.js +210 -0
- package/dist/components/flight-contact-form.d.ts +16 -0
- package/dist/components/flight-contact-form.d.ts.map +1 -0
- package/dist/components/flight-contact-form.js +25 -0
- package/dist/components/flight-fare-upsell-step.d.ts +26 -0
- package/dist/components/flight-fare-upsell-step.d.ts.map +1 -0
- package/dist/components/flight-fare-upsell-step.js +169 -0
- package/dist/components/flight-filters-bar.d.ts +19 -0
- package/dist/components/flight-filters-bar.d.ts.map +1 -0
- package/dist/components/flight-filters-bar.js +98 -0
- package/dist/components/flight-itinerary.d.ts +28 -0
- package/dist/components/flight-itinerary.d.ts.map +1 -0
- package/dist/components/flight-itinerary.js +110 -0
- package/dist/components/flight-offer-detail.d.ts +21 -0
- package/dist/components/flight-offer-detail.d.ts.map +1 -0
- package/dist/components/flight-offer-detail.js +49 -0
- package/dist/components/flight-offer-row.d.ts +25 -0
- package/dist/components/flight-offer-row.d.ts.map +1 -0
- package/dist/components/flight-offer-row.js +78 -0
- package/dist/components/flight-order-confirmation.d.ts +13 -0
- package/dist/components/flight-order-confirmation.d.ts.map +1 -0
- package/dist/components/flight-order-confirmation.js +46 -0
- package/dist/components/flight-passenger-form.d.ts +49 -0
- package/dist/components/flight-passenger-form.d.ts.map +1 -0
- package/dist/components/flight-passenger-form.js +159 -0
- package/dist/components/flight-payment-selector.d.ts +13 -0
- package/dist/components/flight-payment-selector.d.ts.map +1 -0
- package/dist/components/flight-payment-selector.js +32 -0
- package/dist/components/flight-payment-step.d.ts +32 -0
- package/dist/components/flight-payment-step.d.ts.map +1 -0
- package/dist/components/flight-payment-step.js +81 -0
- package/dist/components/flight-search-form.d.ts +14 -0
- package/dist/components/flight-search-form.d.ts.map +1 -0
- package/dist/components/flight-search-form.js +58 -0
- package/dist/components/flight-seat-map.d.ts +32 -0
- package/dist/components/flight-seat-map.d.ts.map +1 -0
- package/dist/components/flight-seat-map.js +101 -0
- package/dist/components/flight-seats-step.d.ts +40 -0
- package/dist/components/flight-seats-step.d.ts.map +1 -0
- package/dist/components/flight-seats-step.js +214 -0
- package/dist/components/flight-services-step.d.ts +27 -0
- package/dist/components/flight-services-step.d.ts.map +1 -0
- package/dist/components/flight-services-step.js +123 -0
- package/dist/components/flights-page-panels.d.ts +27 -0
- package/dist/components/flights-page-panels.d.ts.map +1 -0
- package/dist/components/flights-page-panels.js +40 -0
- package/dist/components/flights-page-types.d.ts +39 -0
- package/dist/components/flights-page-types.d.ts.map +1 -0
- package/dist/components/flights-page-types.js +1 -0
- package/dist/components/flights-page-utils.d.ts +14 -0
- package/dist/components/flights-page-utils.d.ts.map +1 -0
- package/dist/components/flights-page-utils.js +79 -0
- package/dist/components/flights-page.d.ts +4 -0
- package/dist/components/flights-page.d.ts.map +1 -0
- package/dist/components/flights-page.js +209 -0
- package/dist/components/passenger-contact-picker.d.ts +16 -0
- package/dist/components/passenger-contact-picker.d.ts.map +1 -0
- package/dist/components/passenger-contact-picker.js +45 -0
- package/dist/components/pax-cabin-popover.d.ts +18 -0
- package/dist/components/pax-cabin-popover.d.ts.map +1 -0
- package/dist/components/pax-cabin-popover.js +35 -0
- package/dist/components/popular-routes.d.ts +42 -0
- package/dist/components/popular-routes.d.ts.map +1 -0
- package/dist/components/popular-routes.js +108 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/use-aircraft.d.ts +17 -0
- package/dist/hooks/use-aircraft.d.ts.map +1 -0
- package/dist/hooks/use-aircraft.js +18 -0
- package/dist/hooks/use-airlines.d.ts +18 -0
- package/dist/hooks/use-airlines.d.ts.map +1 -0
- package/dist/hooks/use-airlines.js +18 -0
- package/dist/hooks/use-airport-search.d.ts +28 -0
- package/dist/hooks/use-airport-search.d.ts.map +1 -0
- package/dist/hooks/use-airport-search.js +23 -0
- package/dist/hooks/use-airports.d.ts +21 -0
- package/dist/hooks/use-airports.d.ts.map +1 -0
- package/dist/hooks/use-airports.js +17 -0
- package/dist/hooks/use-flight-ancillaries.d.ts +63 -0
- package/dist/hooks/use-flight-ancillaries.d.ts.map +1 -0
- package/dist/hooks/use-flight-ancillaries.js +24 -0
- package/dist/hooks/use-flight-book.d.ts +139 -0
- package/dist/hooks/use-flight-book.d.ts.map +1 -0
- package/dist/hooks/use-flight-book.js +24 -0
- package/dist/hooks/use-flight-offer.d.ts +106 -0
- package/dist/hooks/use-flight-offer.d.ts.map +1 -0
- package/dist/hooks/use-flight-offer.js +20 -0
- package/dist/hooks/use-flight-order.d.ts +286 -0
- package/dist/hooks/use-flight-order.d.ts.map +1 -0
- package/dist/hooks/use-flight-order.js +38 -0
- package/dist/hooks/use-flight-orders.d.ts +147 -0
- package/dist/hooks/use-flight-orders.d.ts.map +1 -0
- package/dist/hooks/use-flight-orders.js +31 -0
- package/dist/hooks/use-flight-search.d.ts +110 -0
- package/dist/hooks/use-flight-search.d.ts.map +1 -0
- package/dist/hooks/use-flight-search.js +18 -0
- package/dist/hooks/use-flight-seat-map.d.ts +49 -0
- package/dist/hooks/use-flight-seat-map.d.ts.map +1 -0
- package/dist/hooks/use-flight-seat-map.js +23 -0
- package/dist/hooks/use-saved-payment-methods.d.ts +23 -0
- package/dist/hooks/use-saved-payment-methods.d.ts.map +1 -0
- package/dist/hooks/use-saved-payment-methods.js +20 -0
- package/dist/i18n/en.d.ts +465 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +520 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages.d.ts +392 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +952 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro.d.ts +465 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +520 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +42 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +22 -0
- package/dist/query-options.d.ts +827 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +58 -0
- package/dist/schemas.d.ts +1658 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +295 -0
- package/dist/ui.d.ts +31 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +28 -0
- package/package.json +148 -0
- package/src/styles.css +11 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type FlightOrdersListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseFlightOrdersOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* GET `/v1/admin/flights/orders` — paginated list of flight orders the
|
|
7
|
+
* adapter has visibility on. Capability-gated: adapters that don't declare
|
|
8
|
+
* `flight/list-orders` will 501.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFlightOrders(filters?: FlightOrdersListFilters, options?: UseFlightOrdersOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
11
|
+
orders: {
|
|
12
|
+
orderId: string;
|
|
13
|
+
status: "pending" | "failed" | "cancelled" | "confirmed" | "ticketed";
|
|
14
|
+
offer: {
|
|
15
|
+
offerId: string;
|
|
16
|
+
source: string;
|
|
17
|
+
itineraries: {
|
|
18
|
+
segments: {
|
|
19
|
+
segmentId: string;
|
|
20
|
+
carrierCode: string;
|
|
21
|
+
flightNumber: string;
|
|
22
|
+
departure: {
|
|
23
|
+
iataCode: string;
|
|
24
|
+
at: string;
|
|
25
|
+
terminal?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
arrival: {
|
|
28
|
+
iataCode: string;
|
|
29
|
+
at: string;
|
|
30
|
+
terminal?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
cabin: "economy" | "premium_economy" | "business" | "first";
|
|
33
|
+
operatingCarrierCode?: string | undefined;
|
|
34
|
+
operatingFlightNumber?: string | undefined;
|
|
35
|
+
duration?: string | undefined;
|
|
36
|
+
aircraft?: string | undefined;
|
|
37
|
+
fareClass?: string | undefined;
|
|
38
|
+
fareBasis?: string | undefined;
|
|
39
|
+
status?: string | undefined;
|
|
40
|
+
providerData?: Record<string, unknown> | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
duration?: string | undefined;
|
|
43
|
+
}[];
|
|
44
|
+
fareBreakdowns: {
|
|
45
|
+
passengerType: "adult" | "child" | "infant" | "senior" | "youth";
|
|
46
|
+
passengerCount: number;
|
|
47
|
+
baseFare: {
|
|
48
|
+
amount: string;
|
|
49
|
+
currency: string;
|
|
50
|
+
};
|
|
51
|
+
taxes: {
|
|
52
|
+
amount: string;
|
|
53
|
+
currency: string;
|
|
54
|
+
};
|
|
55
|
+
total: {
|
|
56
|
+
amount: string;
|
|
57
|
+
currency: string;
|
|
58
|
+
};
|
|
59
|
+
fees?: {
|
|
60
|
+
amount: string;
|
|
61
|
+
currency: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
fareFamily?: string | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
totalPrice: {
|
|
66
|
+
amount: string;
|
|
67
|
+
currency: string;
|
|
68
|
+
};
|
|
69
|
+
validatingCarrier?: string | undefined;
|
|
70
|
+
expiresAt?: string | undefined;
|
|
71
|
+
lastTicketingDate?: string | undefined;
|
|
72
|
+
instantTicketing?: boolean | undefined;
|
|
73
|
+
fareBundles?: {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
tier: "basic" | "standard" | "plus" | "premium";
|
|
77
|
+
priceDelta: {
|
|
78
|
+
amount: string;
|
|
79
|
+
currency: string;
|
|
80
|
+
};
|
|
81
|
+
inclusions: {
|
|
82
|
+
cabinBag?: {
|
|
83
|
+
included: boolean;
|
|
84
|
+
weightKg?: number | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
checkedBag?: {
|
|
87
|
+
included: boolean;
|
|
88
|
+
pieces?: number | undefined;
|
|
89
|
+
weightKg?: number | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
seatSelection?: "none" | "standard" | "free" | undefined;
|
|
92
|
+
priorityBoarding?: boolean | undefined;
|
|
93
|
+
loungeAccess?: boolean | undefined;
|
|
94
|
+
refundable?: boolean | undefined;
|
|
95
|
+
changeable?: boolean | undefined;
|
|
96
|
+
notes?: string[] | undefined;
|
|
97
|
+
};
|
|
98
|
+
recommended?: boolean | undefined;
|
|
99
|
+
providerData?: Record<string, unknown> | undefined;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
providerData?: Record<string, unknown> | undefined;
|
|
102
|
+
};
|
|
103
|
+
passengers: {
|
|
104
|
+
passengerId: string;
|
|
105
|
+
type: "adult" | "child" | "infant" | "senior" | "youth";
|
|
106
|
+
firstName: string;
|
|
107
|
+
lastName: string;
|
|
108
|
+
dateOfBirth: string;
|
|
109
|
+
middleName?: string | undefined;
|
|
110
|
+
gender?: "M" | "F" | "X" | undefined;
|
|
111
|
+
email?: string | undefined;
|
|
112
|
+
phone?: string | undefined;
|
|
113
|
+
documents?: {
|
|
114
|
+
type: "passport" | "national_id" | "visa";
|
|
115
|
+
number: string;
|
|
116
|
+
countryOfIssue: string;
|
|
117
|
+
countryOfNationality?: string | undefined;
|
|
118
|
+
expiryDate?: string | undefined;
|
|
119
|
+
}[] | undefined;
|
|
120
|
+
}[];
|
|
121
|
+
totalPrice: {
|
|
122
|
+
amount: string;
|
|
123
|
+
currency: string;
|
|
124
|
+
};
|
|
125
|
+
createdAt: string;
|
|
126
|
+
pnr?: string | undefined;
|
|
127
|
+
contact?: {
|
|
128
|
+
email?: string | undefined;
|
|
129
|
+
phone?: string | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
tickets?: {
|
|
132
|
+
ticketNumber: string;
|
|
133
|
+
passengerId: string;
|
|
134
|
+
segmentIds: string[];
|
|
135
|
+
status?: string | undefined;
|
|
136
|
+
}[] | undefined;
|
|
137
|
+
paymentDeadline?: string | undefined;
|
|
138
|
+
updatedAt?: string | undefined;
|
|
139
|
+
providerData?: Record<string, unknown> | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
pagination: {
|
|
142
|
+
total: number;
|
|
143
|
+
hasMore: boolean;
|
|
144
|
+
cursor?: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
}, Error>;
|
|
147
|
+
//# sourceMappingURL=use-flight-orders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-flight-orders.d.ts","sourceRoot":"","sources":["../../src/hooks/use-flight-orders.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,kBAAkB,CAAA;AAGjF,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,GAAE,uBAA4B,EACrC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqBrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation, withQueryParams } from "../client.js";
|
|
4
|
+
import { useVoyantFlightsContext } from "../provider.js";
|
|
5
|
+
import { flightsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { flightOrdersListResponseSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* GET `/v1/admin/flights/orders` — paginated list of flight orders the
|
|
9
|
+
* adapter has visibility on. Capability-gated: adapters that don't declare
|
|
10
|
+
* `flight/list-orders` will 501.
|
|
11
|
+
*/
|
|
12
|
+
export function useFlightOrders(filters = {}, options = {}) {
|
|
13
|
+
const client = useVoyantFlightsContext();
|
|
14
|
+
const { enabled = true } = options;
|
|
15
|
+
const params = {};
|
|
16
|
+
if (filters.cursor)
|
|
17
|
+
params.cursor = filters.cursor;
|
|
18
|
+
if (filters.limit !== undefined)
|
|
19
|
+
params.limit = filters.limit;
|
|
20
|
+
if (filters.search)
|
|
21
|
+
params.q = filters.search;
|
|
22
|
+
if (filters.status?.length)
|
|
23
|
+
params.status = filters.status;
|
|
24
|
+
if (filters.paymentStatus?.length)
|
|
25
|
+
params.paymentStatus = filters.paymentStatus;
|
|
26
|
+
return useQuery({
|
|
27
|
+
queryKey: flightsQueryKeys.orderList(filters),
|
|
28
|
+
queryFn: () => fetchWithValidation(withQueryParams("/v1/admin/flights/orders", params), flightOrdersListResponseSchema, client),
|
|
29
|
+
enabled,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { FlightSearchRequest } from "@voyant-travel/flights/contract/types";
|
|
2
|
+
export interface UseFlightSearchOptions {
|
|
3
|
+
/** Disable the query — useful while the form is incomplete. */
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
/** TanStack Query stale time, milliseconds. Default 30s. */
|
|
6
|
+
staleTime?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* POST `/v1/admin/flights/search`. Re-runs whenever the request changes.
|
|
10
|
+
* Disabled by default until the form is complete (no slices, etc.) — pass
|
|
11
|
+
* `enabled: true` once the request is ready to fire.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useFlightSearch(request: FlightSearchRequest, options?: UseFlightSearchOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
14
|
+
offers: {
|
|
15
|
+
offerId: string;
|
|
16
|
+
source: string;
|
|
17
|
+
itineraries: {
|
|
18
|
+
segments: {
|
|
19
|
+
segmentId: string;
|
|
20
|
+
carrierCode: string;
|
|
21
|
+
flightNumber: string;
|
|
22
|
+
departure: {
|
|
23
|
+
iataCode: string;
|
|
24
|
+
at: string;
|
|
25
|
+
terminal?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
arrival: {
|
|
28
|
+
iataCode: string;
|
|
29
|
+
at: string;
|
|
30
|
+
terminal?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
cabin: "economy" | "premium_economy" | "business" | "first";
|
|
33
|
+
operatingCarrierCode?: string | undefined;
|
|
34
|
+
operatingFlightNumber?: string | undefined;
|
|
35
|
+
duration?: string | undefined;
|
|
36
|
+
aircraft?: string | undefined;
|
|
37
|
+
fareClass?: string | undefined;
|
|
38
|
+
fareBasis?: string | undefined;
|
|
39
|
+
status?: string | undefined;
|
|
40
|
+
providerData?: Record<string, unknown> | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
duration?: string | undefined;
|
|
43
|
+
}[];
|
|
44
|
+
fareBreakdowns: {
|
|
45
|
+
passengerType: "adult" | "child" | "infant" | "senior" | "youth";
|
|
46
|
+
passengerCount: number;
|
|
47
|
+
baseFare: {
|
|
48
|
+
amount: string;
|
|
49
|
+
currency: string;
|
|
50
|
+
};
|
|
51
|
+
taxes: {
|
|
52
|
+
amount: string;
|
|
53
|
+
currency: string;
|
|
54
|
+
};
|
|
55
|
+
total: {
|
|
56
|
+
amount: string;
|
|
57
|
+
currency: string;
|
|
58
|
+
};
|
|
59
|
+
fees?: {
|
|
60
|
+
amount: string;
|
|
61
|
+
currency: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
fareFamily?: string | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
totalPrice: {
|
|
66
|
+
amount: string;
|
|
67
|
+
currency: string;
|
|
68
|
+
};
|
|
69
|
+
validatingCarrier?: string | undefined;
|
|
70
|
+
expiresAt?: string | undefined;
|
|
71
|
+
lastTicketingDate?: string | undefined;
|
|
72
|
+
instantTicketing?: boolean | undefined;
|
|
73
|
+
fareBundles?: {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
tier: "basic" | "standard" | "plus" | "premium";
|
|
77
|
+
priceDelta: {
|
|
78
|
+
amount: string;
|
|
79
|
+
currency: string;
|
|
80
|
+
};
|
|
81
|
+
inclusions: {
|
|
82
|
+
cabinBag?: {
|
|
83
|
+
included: boolean;
|
|
84
|
+
weightKg?: number | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
checkedBag?: {
|
|
87
|
+
included: boolean;
|
|
88
|
+
pieces?: number | undefined;
|
|
89
|
+
weightKg?: number | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
seatSelection?: "none" | "standard" | "free" | undefined;
|
|
92
|
+
priorityBoarding?: boolean | undefined;
|
|
93
|
+
loungeAccess?: boolean | undefined;
|
|
94
|
+
refundable?: boolean | undefined;
|
|
95
|
+
changeable?: boolean | undefined;
|
|
96
|
+
notes?: string[] | undefined;
|
|
97
|
+
};
|
|
98
|
+
recommended?: boolean | undefined;
|
|
99
|
+
providerData?: Record<string, unknown> | undefined;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
providerData?: Record<string, unknown> | undefined;
|
|
102
|
+
}[];
|
|
103
|
+
pagination?: {
|
|
104
|
+
total: number;
|
|
105
|
+
hasMore: boolean;
|
|
106
|
+
cursor?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
providerData?: Record<string, unknown> | undefined;
|
|
109
|
+
}, Error>;
|
|
110
|
+
//# sourceMappingURL=use-flight-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-flight-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-flight-search.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAKhF,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,mBAAmB,EAC5B,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UASrC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantFlightsContext } from "../provider.js";
|
|
4
|
+
import { getFlightSearchQueryOptions } from "../query-options.js";
|
|
5
|
+
/**
|
|
6
|
+
* POST `/v1/admin/flights/search`. Re-runs whenever the request changes.
|
|
7
|
+
* Disabled by default until the form is complete (no slices, etc.) — pass
|
|
8
|
+
* `enabled: true` once the request is ready to fire.
|
|
9
|
+
*/
|
|
10
|
+
export function useFlightSearch(request, options = {}) {
|
|
11
|
+
const client = useVoyantFlightsContext();
|
|
12
|
+
const { enabled = false, staleTime = 30_000 } = options;
|
|
13
|
+
return useQuery({
|
|
14
|
+
...getFlightSearchQueryOptions(client, request),
|
|
15
|
+
enabled: enabled && request.slices.length > 0 && request.passengers.adults > 0,
|
|
16
|
+
staleTime,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FlightOffer } from "@voyant-travel/flights/contract/types";
|
|
2
|
+
export interface UseFlightSeatMapOptions {
|
|
3
|
+
/** Disable the query — useful before the offer is re-priced or the user enters the seats step. */
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
/** TanStack Query stale time, milliseconds. Default 5 minutes. */
|
|
6
|
+
staleTime?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* POST `/v1/admin/flights/seatmap` — fetches the seat map for one segment
|
|
10
|
+
* of an offer. Maps are per-segment because layouts differ by aircraft and
|
|
11
|
+
* cabin (a multi-stop itinerary may use different equipment per leg).
|
|
12
|
+
*
|
|
13
|
+
* Default `enabled = false` so callers gate fetching on the user actually
|
|
14
|
+
* entering the seat selection step. When the connector doesn't declare
|
|
15
|
+
* `flight/seatmap`, the API returns 501 — propagated as a query error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useFlightSeatMap(input: {
|
|
18
|
+
offerId: string;
|
|
19
|
+
segmentId: string;
|
|
20
|
+
offer?: FlightOffer;
|
|
21
|
+
} | null, options?: UseFlightSeatMapOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
22
|
+
seatMap: {
|
|
23
|
+
segmentId: string;
|
|
24
|
+
cabin: "economy" | "premium_economy" | "business" | "first";
|
|
25
|
+
columnLayout: (string | null)[];
|
|
26
|
+
rows: {
|
|
27
|
+
row: number;
|
|
28
|
+
seats: {
|
|
29
|
+
seatNumber: string;
|
|
30
|
+
row: number;
|
|
31
|
+
column: string;
|
|
32
|
+
status: "available" | "blocked" | "unavailable" | "selected";
|
|
33
|
+
category: "standard" | "premium" | "preferred" | "extra_legroom" | "exit_row" | "bulkhead";
|
|
34
|
+
price?: {
|
|
35
|
+
amount: string;
|
|
36
|
+
currency: string;
|
|
37
|
+
} | undefined;
|
|
38
|
+
notes?: string | undefined;
|
|
39
|
+
window?: boolean | undefined;
|
|
40
|
+
aisle?: boolean | undefined;
|
|
41
|
+
providerData?: Record<string, unknown> | undefined;
|
|
42
|
+
}[];
|
|
43
|
+
}[];
|
|
44
|
+
aircraft?: string | undefined;
|
|
45
|
+
providerData?: Record<string, unknown> | undefined;
|
|
46
|
+
};
|
|
47
|
+
validUntil?: string | undefined;
|
|
48
|
+
}, Error>;
|
|
49
|
+
//# sourceMappingURL=use-flight-seat-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-flight-seat-map.d.ts","sourceRoot":"","sources":["../../src/hooks/use-flight-seat-map.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAA;AAKxE,MAAM,WAAW,uBAAuB;IACtC,kGAAkG;IAClG,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,EACzE,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;UAUtC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantFlightsContext } from "../provider.js";
|
|
4
|
+
import { getFlightSeatMapQueryOptions } from "../query-options.js";
|
|
5
|
+
/**
|
|
6
|
+
* POST `/v1/admin/flights/seatmap` — fetches the seat map for one segment
|
|
7
|
+
* of an offer. Maps are per-segment because layouts differ by aircraft and
|
|
8
|
+
* cabin (a multi-stop itinerary may use different equipment per leg).
|
|
9
|
+
*
|
|
10
|
+
* Default `enabled = false` so callers gate fetching on the user actually
|
|
11
|
+
* entering the seat selection step. When the connector doesn't declare
|
|
12
|
+
* `flight/seatmap`, the API returns 501 — propagated as a query error.
|
|
13
|
+
*/
|
|
14
|
+
export function useFlightSeatMap(input, options = {}) {
|
|
15
|
+
const client = useVoyantFlightsContext();
|
|
16
|
+
const { enabled = false, staleTime = 5 * 60_000 } = options;
|
|
17
|
+
const safeInput = input ?? { offerId: "", segmentId: "" };
|
|
18
|
+
return useQuery({
|
|
19
|
+
...getFlightSeatMapQueryOptions(client, safeInput),
|
|
20
|
+
enabled: enabled && !!input?.offerId && !!input?.segmentId,
|
|
21
|
+
staleTime,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface UseSavedPaymentMethodsOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
staleTime?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* GET `/v1/relationships/people/:personId/payment-methods` — list a person's saved
|
|
7
|
+
* payment methods. Backed by the CRM `person_payment_methods` table.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSavedPaymentMethods(personId: string | null | undefined, options?: UseSavedPaymentMethodsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
10
|
+
data: {
|
|
11
|
+
id: string;
|
|
12
|
+
brand: "visa" | "mastercard" | "amex" | "revolut" | "bank_transfer";
|
|
13
|
+
last4: string | null;
|
|
14
|
+
processorToken: string;
|
|
15
|
+
isDefault: boolean;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
personId?: string | undefined;
|
|
18
|
+
holderName?: string | null | undefined;
|
|
19
|
+
expMonth?: number | null | undefined;
|
|
20
|
+
expYear?: number | null | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
}, Error>;
|
|
23
|
+
//# sourceMappingURL=use-saved-payment-methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-saved-payment-methods.d.ts","sourceRoot":"","sources":["../../src/hooks/use-saved-payment-methods.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,GAAE,6BAAkC;;;;;;;;;;;;;UAe5C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantFlightsContext } from "../provider.js";
|
|
5
|
+
import { flightsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { savedPaymentMethodListResponseSchema, } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* GET `/v1/relationships/people/:personId/payment-methods` — list a person's saved
|
|
9
|
+
* payment methods. Backed by the CRM `person_payment_methods` table.
|
|
10
|
+
*/
|
|
11
|
+
export function useSavedPaymentMethods(personId, options = {}) {
|
|
12
|
+
const client = useVoyantFlightsContext();
|
|
13
|
+
const { enabled = true, staleTime = 30_000 } = options;
|
|
14
|
+
return useQuery({
|
|
15
|
+
queryKey: flightsQueryKeys.savedPaymentMethods(personId ?? ""),
|
|
16
|
+
queryFn: () => fetchWithValidation(`/v1/relationships/people/${encodeURIComponent(personId ?? "")}/payment-methods`, savedPaymentMethodListResponseSchema, client),
|
|
17
|
+
enabled: enabled && !!personId,
|
|
18
|
+
staleTime,
|
|
19
|
+
});
|
|
20
|
+
}
|