@voyant-travel/trips-react 0.110.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 +30 -0
- package/dist/admin/admin-trips-page-controls.d.ts +28 -0
- package/dist/admin/admin-trips-page-controls.d.ts.map +1 -0
- package/dist/admin/admin-trips-page-controls.js +28 -0
- package/dist/admin/admin-trips-page-model.d.ts +87 -0
- package/dist/admin/admin-trips-page-model.d.ts.map +1 -0
- package/dist/admin/admin-trips-page-model.js +457 -0
- package/dist/admin/admin-trips-page.d.ts +6 -0
- package/dist/admin/admin-trips-page.d.ts.map +1 -0
- package/dist/admin/admin-trips-page.js +322 -0
- package/dist/admin/admin-trips-panels.d.ts +11 -0
- package/dist/admin/admin-trips-panels.d.ts.map +1 -0
- package/dist/admin/admin-trips-panels.js +11 -0
- package/dist/admin/index.d.ts +63 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +119 -0
- package/dist/admin/pages/trip-detail-page.d.ts +10 -0
- package/dist/admin/pages/trip-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/trip-detail-page.js +12 -0
- package/dist/admin/trip-component-display.d.ts +10 -0
- package/dist/admin/trip-component-display.d.ts.map +1 -0
- package/dist/admin/trip-component-display.js +137 -0
- package/dist/admin/trip-detail-host.d.ts +12 -0
- package/dist/admin/trip-detail-host.d.ts.map +1 -0
- package/dist/admin/trip-detail-host.js +37 -0
- package/dist/admin/trip-detail-record-model.d.ts +30 -0
- package/dist/admin/trip-detail-record-model.d.ts.map +1 -0
- package/dist/admin/trip-detail-record-model.js +56 -0
- package/dist/admin/trip-detail-record.d.ts +47 -0
- package/dist/admin/trip-detail-record.d.ts.map +1 -0
- package/dist/admin/trip-detail-record.js +170 -0
- package/dist/admin/trip-list-filters.d.ts +33 -0
- package/dist/admin/trip-list-filters.d.ts.map +1 -0
- package/dist/admin/trip-list-filters.js +94 -0
- package/dist/admin/trips-host.d.ts +15 -0
- package/dist/admin/trips-host.d.ts.map +1 -0
- package/dist/admin/trips-host.js +233 -0
- package/dist/admin/trips-panels/catalog-configurator.d.ts +34 -0
- package/dist/admin/trips-panels/catalog-configurator.d.ts.map +1 -0
- package/dist/admin/trips-panels/catalog-configurator.js +200 -0
- package/dist/admin/trips-panels/catalog-options.d.ts +58 -0
- package/dist/admin/trips-panels/catalog-options.d.ts.map +1 -0
- package/dist/admin/trips-panels/catalog-options.js +124 -0
- package/dist/admin/trips-panels/committed-component-card.d.ts +27 -0
- package/dist/admin/trips-panels/committed-component-card.d.ts.map +1 -0
- package/dist/admin/trips-panels/committed-component-card.js +44 -0
- package/dist/admin/trips-panels/display.d.ts +51 -0
- package/dist/admin/trips-panels/display.d.ts.map +1 -0
- package/dist/admin/trips-panels/display.js +336 -0
- package/dist/admin/trips-panels/flight-configurator.d.ts +34 -0
- package/dist/admin/trips-panels/flight-configurator.d.ts.map +1 -0
- package/dist/admin/trips-panels/flight-configurator.js +208 -0
- package/dist/admin/trips-panels/manual-configurators.d.ts +16 -0
- package/dist/admin/trips-panels/manual-configurators.d.ts.map +1 -0
- package/dist/admin/trips-panels/manual-configurators.js +41 -0
- package/dist/admin/trips-panels/pending-component-card.d.ts +16 -0
- package/dist/admin/trips-panels/pending-component-card.d.ts.map +1 -0
- package/dist/admin/trips-panels/pending-component-card.js +29 -0
- package/dist/admin/trips-panels/shared.d.ts +122 -0
- package/dist/admin/trips-panels/shared.d.ts.map +1 -0
- package/dist/admin/trips-panels/shared.js +152 -0
- package/dist/admin/trips-panels/travelers-section.d.ts +53 -0
- package/dist/admin/trips-panels/travelers-section.d.ts.map +1 -0
- package/dist/admin/trips-panels/travelers-section.js +183 -0
- package/dist/admin/trips-panels/trip-preview-rail.d.ts +52 -0
- package/dist/admin/trips-panels/trip-preview-rail.d.ts.map +1 -0
- package/dist/admin/trips-panels/trip-preview-rail.js +122 -0
- package/dist/cache.d.ts +9 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +21 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +51 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/use-price-trip.d.ts +3 -0
- package/dist/hooks/use-price-trip.d.ts.map +1 -0
- package/dist/hooks/use-price-trip.js +17 -0
- package/dist/hooks/use-reserve-trip.d.ts +3 -0
- package/dist/hooks/use-reserve-trip.d.ts.map +1 -0
- package/dist/hooks/use-reserve-trip.js +17 -0
- package/dist/hooks/use-trip-checkout.d.ts +3 -0
- package/dist/hooks/use-trip-checkout.d.ts.map +1 -0
- package/dist/hooks/use-trip-checkout.js +17 -0
- package/dist/hooks/use-trip-components.d.ts +40 -0
- package/dist/hooks/use-trip-components.d.ts.map +1 -0
- package/dist/hooks/use-trip-components.js +13 -0
- package/dist/hooks/use-trip.d.ts +5 -0
- package/dist/hooks/use-trip.d.ts.map +1 -0
- package/dist/hooks/use-trip.js +13 -0
- package/dist/hooks/use-trips.d.ts +6 -0
- package/dist/hooks/use-trips.d.ts.map +1 -0
- package/dist/hooks/use-trips.js +12 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/operations.d.ts +212 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +92 -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 +10 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +9 -0
- package/dist/query-options.d.ts +167 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +22 -0
- package/dist/schemas.d.ts +69 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +16 -0
- package/package.json +133 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useOperatorAdminMessages as useAdminMessages } from "@voyant-travel/admin";
|
|
4
|
+
import { VoucherPickerSection } from "@voyant-travel/bookings-react/ui";
|
|
5
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
6
|
+
import { useOrganization, usePerson } from "@voyant-travel/relationships-react";
|
|
7
|
+
import { Alert, AlertDescription, AlertTitle } from "@voyant-travel/ui/components/alert";
|
|
8
|
+
import { Badge } from "@voyant-travel/ui/components/badge";
|
|
9
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
10
|
+
import { AlertTriangle, Check, Loader2 } from "lucide-react";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { componentIcon, componentOptionSummaryFor, componentThumbnailFor, componentTitleFor, formatMoney, formatScheduleLabel, isUserVisibleWarning, resolveBillingDisplay, sortComponentsBySchedule, } from "./display.js";
|
|
13
|
+
import { formatPersonName } from "./travelers-section.js";
|
|
14
|
+
export function TripPreviewRail({ trip, pendingCount, travelers, billing, billingPersonId, voucher, onVoucherChange, paymentCurrency, }) {
|
|
15
|
+
const envelope = trip?.envelope;
|
|
16
|
+
const aggregate = envelope?.aggregatePricingSnapshot;
|
|
17
|
+
const components = React.useMemo(() => sortComponentsBySchedule((trip?.components ?? []).filter((component) => component.status !== "removed")), [trip?.components]);
|
|
18
|
+
const status = envelope?.status;
|
|
19
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
20
|
+
return (_jsxs("div", { className: "flex flex-col gap-4 rounded-md border bg-muted/10 p-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(PreviewLabel, { children: t.tripPreviewLabel }), _jsx(Badge, { variant: "outline", className: "text-[10px] capitalize", children: status ?? "draft" })] }), components.length === 0 && pendingCount === 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t.previewRail.empty })) : null, components.length > 0 ? (_jsx("ul", { className: "flex flex-col gap-3", children: components.map((component) => (_jsx("li", { children: _jsx(PreviewComponentRow, { component: component }) }, component.id))) })) : null, pendingCount > 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: pendingCount === 1
|
|
21
|
+
? t.previewRail.pendingComponentsSingular
|
|
22
|
+
: formatMessage(t.previewRail.pendingComponentsPlural, { count: pendingCount }) })) : null, components.length > 0 ? _jsx(CurrencyTotals, { components: components }) : null, _jsxs("div", { className: "flex items-center justify-between border-t pt-3 text-sm", children: [_jsx(PreviewLabel, { children: t.paymentCurrencyLabel }), _jsx("span", { className: "font-medium", children: paymentCurrency })] }), _jsx(BillingPreview, { billing: billing }), _jsx(TravelersPreview, { travelers: travelers, billingPersonId: billingPersonId ?? null }), (() => {
|
|
23
|
+
const warnings = (aggregate?.warnings ?? []).filter(isUserVisibleWarning);
|
|
24
|
+
if (warnings.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsxs(Alert, { children: [_jsx(AlertTriangle, { className: "size-4" }), _jsx(AlertTitle, { children: t.pricingWarningsTitle }), _jsx(AlertDescription, { children: warnings.join(", ") })] }));
|
|
27
|
+
})(), components.length > 0 ? (_jsx("div", { className: "flex flex-col gap-4 border-t pt-3", children: _jsx(VoucherPickerSection, { value: voucher, onChange: onVoucherChange, currency: paymentCurrency, amountCents: aggregate?.totalAmountCents ?? undefined }) })) : null] }));
|
|
28
|
+
}
|
|
29
|
+
export function PreviewComponentRow({ component }) {
|
|
30
|
+
const Icon = componentIcon(component);
|
|
31
|
+
const coverUrl = componentThumbnailFor(component);
|
|
32
|
+
const name = componentTitleFor(component);
|
|
33
|
+
const optionSummary = componentOptionSummaryFor(component);
|
|
34
|
+
return (_jsxs("div", { className: "flex items-start gap-3", children: [coverUrl ? (_jsx("img", { src: coverUrl, alt: "", className: "size-12 shrink-0 rounded-md object-cover ring-1 ring-border", loading: "lazy" })) : (_jsx("div", { className: "flex size-12 shrink-0 items-center justify-center rounded-md bg-muted", children: _jsx(Icon, { className: "size-5 text-muted-foreground" }) })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { className: "truncate font-medium text-sm", children: name }), (() => {
|
|
35
|
+
const label = formatScheduleLabel(component);
|
|
36
|
+
return label ? (_jsx("span", { className: "truncate text-muted-foreground text-xs", children: label })) : null;
|
|
37
|
+
})(), optionSummary ? (_jsx("span", { className: "truncate text-muted-foreground text-xs", children: optionSummary })) : null] }), _jsx("span", { className: "shrink-0 font-medium text-sm", children: formatMoney(component.componentTotalAmountCents, component.componentCurrency) })] }));
|
|
38
|
+
}
|
|
39
|
+
export function BillingPreview({ billing }) {
|
|
40
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
41
|
+
const personQuery = usePerson(billing.personId || undefined, {
|
|
42
|
+
enabled: billing.mode === "existing" && Boolean(billing.personId),
|
|
43
|
+
});
|
|
44
|
+
const orgQuery = useOrganization(billing.organizationId ?? undefined, {
|
|
45
|
+
enabled: billing.billTo === "organization" && Boolean(billing.organizationId),
|
|
46
|
+
});
|
|
47
|
+
const display = resolveBillingDisplay(billing, personQuery.data, orgQuery.data, t);
|
|
48
|
+
if (!display.primary && !display.secondary)
|
|
49
|
+
return null;
|
|
50
|
+
return (_jsxs("div", { className: "flex flex-col gap-0.5 border-t pt-3", children: [_jsx(PreviewLabel, { children: t.billingLabel }), _jsx("span", { className: "truncate text-sm", children: display.primary || "—" }), display.secondary ? (_jsx("span", { className: "truncate text-muted-foreground text-xs", children: display.secondary })) : null] }));
|
|
51
|
+
}
|
|
52
|
+
export function TravelersPreview({ travelers, billingPersonId, }) {
|
|
53
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
54
|
+
if (travelers.length === 0)
|
|
55
|
+
return null;
|
|
56
|
+
const leadLocalId = (billingPersonId &&
|
|
57
|
+
travelers.find((traveler) => traveler.personId === billingPersonId)?.localId) ||
|
|
58
|
+
travelers[0]?.localId ||
|
|
59
|
+
null;
|
|
60
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 border-t pt-3", children: [_jsx(PreviewLabel, { children: formatMessage(t.travelersWithCount, { count: travelers.length }) }), _jsx("ul", { className: "flex flex-col gap-0.5 text-sm", children: travelers.map((traveler, idx) => (_jsx(TravelerPreviewRow, { traveler: traveler, index: idx, isLead: traveler.localId === leadLocalId }, traveler.localId))) })] }));
|
|
61
|
+
}
|
|
62
|
+
export function TravelerPreviewRow({ traveler, index, isLead, }) {
|
|
63
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
64
|
+
const personQuery = usePerson(traveler.personId || undefined, {
|
|
65
|
+
enabled: Boolean(traveler.personId),
|
|
66
|
+
});
|
|
67
|
+
const inlineName = [traveler.firstName, traveler.lastName]
|
|
68
|
+
.filter((part) => part.trim().length > 0)
|
|
69
|
+
.join(" ")
|
|
70
|
+
.trim();
|
|
71
|
+
const name = inlineName ||
|
|
72
|
+
formatPersonName(personQuery.data) ||
|
|
73
|
+
formatMessage(t.travelerNumberedFallback, { number: index + 1 });
|
|
74
|
+
return (_jsxs("li", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "truncate", children: name }), _jsx("span", { className: "shrink-0 text-muted-foreground text-xs capitalize", children: isLead ? t.leadBadge : traveler.role })] }));
|
|
75
|
+
}
|
|
76
|
+
export function CurrencyTotals({ components }) {
|
|
77
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
78
|
+
const buckets = React.useMemo(() => aggregateByCurrency(components), [components]);
|
|
79
|
+
if (buckets.length === 0)
|
|
80
|
+
return null;
|
|
81
|
+
return (_jsx("div", { className: "flex flex-col gap-4 border-t pt-3 text-sm", children: buckets.map((bucket) => (_jsxs("div", { className: "flex flex-col gap-1", children: [buckets.length > 1 ? _jsx(PreviewLabel, { children: bucket.currency }) : null, _jsxs("div", { className: "flex items-center justify-between text-muted-foreground", children: [_jsx("span", { children: t.subtotal }), _jsx("span", { children: formatMoney(bucket.subtotal, bucket.currency) })] }), _jsxs("div", { className: "flex items-center justify-between text-muted-foreground", children: [_jsx("span", { children: t.tax }), _jsx("span", { children: formatMoney(bucket.tax, bucket.currency) })] }), _jsxs("div", { className: "mt-0.5 flex items-center justify-between font-semibold", children: [_jsx("span", { children: t.total }), _jsx("span", { className: "text-lg", children: formatMoney(bucket.total, bucket.currency) })] })] }, bucket.currency))) }));
|
|
82
|
+
}
|
|
83
|
+
export function aggregateByCurrency(components) {
|
|
84
|
+
const map = new Map();
|
|
85
|
+
for (const component of components) {
|
|
86
|
+
const code = component.componentCurrency;
|
|
87
|
+
if (!code)
|
|
88
|
+
continue;
|
|
89
|
+
const entry = map.get(code) ?? { currency: code, subtotal: 0, tax: 0, total: 0 };
|
|
90
|
+
entry.subtotal += component.componentSubtotalAmountCents ?? 0;
|
|
91
|
+
entry.tax += component.componentTaxAmountCents ?? 0;
|
|
92
|
+
entry.total += component.componentTotalAmountCents ?? 0;
|
|
93
|
+
map.set(code, entry);
|
|
94
|
+
}
|
|
95
|
+
return [...map.values()].sort((a, b) => b.total - a.total);
|
|
96
|
+
}
|
|
97
|
+
export function PrimaryAction({ status, componentCount, isBusy, pricePending, reservePending, onReserve, }) {
|
|
98
|
+
const t = useAdminMessages().trips.adminComposer.panels;
|
|
99
|
+
if (status === "checkout_started" || status === "booked") {
|
|
100
|
+
return (_jsx("div", { className: "rounded-md border bg-card p-3 text-center text-muted-foreground text-sm", children: status === "booked" ? t.primaryAction.tripBooked : t.primaryAction.tripCheckoutInProgress }));
|
|
101
|
+
}
|
|
102
|
+
if (status === "reserved") {
|
|
103
|
+
return (_jsx("div", { className: "rounded-md border bg-card p-3 text-center text-muted-foreground text-sm", children: t.primaryAction.tripReserved }));
|
|
104
|
+
}
|
|
105
|
+
if (componentCount === 0) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (pricePending) {
|
|
109
|
+
return (_jsxs(Button, { disabled: true, className: "w-full", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t.primaryAction.pricingTrip] }));
|
|
110
|
+
}
|
|
111
|
+
if (status === "reserve_in_progress" || reservePending) {
|
|
112
|
+
return (_jsxs(Button, { disabled: true, className: "w-full", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), t.primaryAction.reservingTrip] }));
|
|
113
|
+
}
|
|
114
|
+
// `failed` lands here after a reserve attempt errored — allow retry. `priced`
|
|
115
|
+
// is the happy-path entry into reserve. Any other status (e.g. `draft`)
|
|
116
|
+
// means pricing hasn't run yet — gate the button until that catches up.
|
|
117
|
+
const canReserve = status === "priced" || status === "failed";
|
|
118
|
+
return (_jsxs(Button, { onClick: onReserve, disabled: isBusy || !canReserve, className: "w-full", children: [_jsx(Check, { className: "size-4" }), status === "failed" ? t.primaryAction.retryReserve : t.primaryAction.reserveAndCreateLink] }));
|
|
119
|
+
}
|
|
120
|
+
export function PreviewLabel({ children }) {
|
|
121
|
+
return (_jsx("span", { className: "font-medium text-[11px] text-muted-foreground uppercase tracking-wider", children: children }));
|
|
122
|
+
}
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import type { PriceTripResult, ReserveTripResult, StartCheckoutResult } from "@voyant-travel/trips";
|
|
3
|
+
type TripLikeResult = Pick<PriceTripResult | ReserveTripResult | StartCheckoutResult, "envelope" | "components">;
|
|
4
|
+
export declare function writeTripCache(queryClient: QueryClient, result: TripLikeResult): void;
|
|
5
|
+
export declare function writePriceTripCache(queryClient: QueryClient, result: PriceTripResult): void;
|
|
6
|
+
export declare function writeReserveTripCache(queryClient: QueryClient, result: ReserveTripResult): void;
|
|
7
|
+
export declare function writeTripCheckoutCache(queryClient: QueryClient, result: StartCheckoutResult): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAInG,KAAK,cAAc,GAAG,IAAI,CACxB,eAAe,GAAG,iBAAiB,GAAG,mBAAmB,EACzD,UAAU,GAAG,YAAY,CAC1B,CAAA;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,QAO9E;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,QAGpF;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,QAExF;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,QAG3F"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tripsQueryKeys } from "./query-keys.js";
|
|
3
|
+
export function writeTripCache(queryClient, result) {
|
|
4
|
+
void queryClient.invalidateQueries({ queryKey: tripsQueryKeys.trips() });
|
|
5
|
+
queryClient.setQueryData(tripsQueryKeys.trip(result.envelope.id), {
|
|
6
|
+
envelope: result.envelope,
|
|
7
|
+
components: result.components,
|
|
8
|
+
});
|
|
9
|
+
queryClient.setQueryData(tripsQueryKeys.components(result.envelope.id), result.components);
|
|
10
|
+
}
|
|
11
|
+
export function writePriceTripCache(queryClient, result) {
|
|
12
|
+
writeTripCache(queryClient, result);
|
|
13
|
+
queryClient.setQueryData(tripsQueryKeys.pricing(result.envelope.id), result.pricing);
|
|
14
|
+
}
|
|
15
|
+
export function writeReserveTripCache(queryClient, result) {
|
|
16
|
+
writeTripCache(queryClient, result);
|
|
17
|
+
}
|
|
18
|
+
export function writeTripCheckoutCache(queryClient, result) {
|
|
19
|
+
writeTripCache(queryClient, result);
|
|
20
|
+
queryClient.setQueryData(tripsQueryKeys.checkout(result.envelope.id), result.target);
|
|
21
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export type VoyantFetcher = (url: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export declare const defaultFetcher: VoyantFetcher;
|
|
4
|
+
export declare class VoyantApiError extends Error {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly body: unknown;
|
|
7
|
+
constructor(message: string, status: number, body: unknown);
|
|
8
|
+
}
|
|
9
|
+
export interface FetchWithValidationOptions {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
fetcher: VoyantFetcher;
|
|
12
|
+
surface?: "admin" | "public";
|
|
13
|
+
}
|
|
14
|
+
export declare function fetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: FetchWithValidationOptions, init?: RequestInit): Promise<TOut>;
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAElF,eAAO,MAAM,cAAc,EAAE,aACoB,CAAA;AAEjD,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC7B;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,0BAA0B,EACnC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const defaultFetcher = (url, init) => fetch(url, { credentials: "include", ...init });
|
|
2
|
+
export class VoyantApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "VoyantApiError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function fetchWithValidation(path, schema, options, init) {
|
|
13
|
+
const headers = new Headers(init?.headers);
|
|
14
|
+
if (init?.body !== undefined && !headers.has("Content-Type")) {
|
|
15
|
+
headers.set("Content-Type", "application/json");
|
|
16
|
+
}
|
|
17
|
+
const response = await options.fetcher(joinUrl(options.baseUrl, path), { ...init, headers });
|
|
18
|
+
const body = await safeJson(response);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new VoyantApiError(errorMessage(response, body), response.status, body);
|
|
21
|
+
}
|
|
22
|
+
const parsed = schema.safeParse(body);
|
|
23
|
+
if (!parsed.success) {
|
|
24
|
+
throw new VoyantApiError(`Voyant API response failed validation: ${parsed.error.message}`, response.status, body);
|
|
25
|
+
}
|
|
26
|
+
return parsed.data;
|
|
27
|
+
}
|
|
28
|
+
function errorMessage(response, body) {
|
|
29
|
+
if (typeof body === "object" && body !== null && "error" in body) {
|
|
30
|
+
const error = body.error;
|
|
31
|
+
if (typeof error === "string")
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
34
|
+
return `Voyant API error: ${response.status} ${response.statusText}`;
|
|
35
|
+
}
|
|
36
|
+
async function safeJson(response) {
|
|
37
|
+
const text = await response.text();
|
|
38
|
+
if (!text)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function joinUrl(baseUrl, path) {
|
|
48
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
49
|
+
const trimmedPath = path.startsWith("/") ? path : `/${path}`;
|
|
50
|
+
return `${trimmedBase}${trimmedPath}`;
|
|
51
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { usePriceTrip } from "./use-price-trip.js";
|
|
2
|
+
export { useReserveTrip } from "./use-reserve-trip.js";
|
|
3
|
+
export { type UseTripOptions, useTrip } from "./use-trip.js";
|
|
4
|
+
export { useTripCheckout } from "./use-trip-checkout.js";
|
|
5
|
+
export { type UseTripComponentsOptions, useTripComponents } from "./use-trip-components.js";
|
|
6
|
+
export { type UseTripsOptions, useTrips } from "./use-trips.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,KAAK,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { usePriceTrip } from "./use-price-trip.js";
|
|
2
|
+
export { useReserveTrip } from "./use-reserve-trip.js";
|
|
3
|
+
export { useTrip } from "./use-trip.js";
|
|
4
|
+
export { useTripCheckout } from "./use-trip-checkout.js";
|
|
5
|
+
export { useTripComponents } from "./use-trip-components.js";
|
|
6
|
+
export { useTrips } from "./use-trips.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type PriceTripBody } from "../operations.js";
|
|
2
|
+
export declare function usePriceTrip(envelopeId: string | null | undefined): import("@tanstack/react-query").UseMutationResult<import("@voyant-travel/trips").PriceTripResult, Error, PriceTripBody, unknown>;
|
|
3
|
+
//# sourceMappingURL=use-price-trip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-price-trip.d.ts","sourceRoot":"","sources":["../../src/hooks/use-price-trip.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,kBAAkB,CAAA;AAGhE,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,oIAWjE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { writePriceTripCache } from "../cache.js";
|
|
4
|
+
import { priceTrip } from "../operations.js";
|
|
5
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
6
|
+
export function usePriceTrip(envelopeId) {
|
|
7
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
8
|
+
const queryClient = useQueryClient();
|
|
9
|
+
return useMutation({
|
|
10
|
+
mutationFn: async (input) => {
|
|
11
|
+
if (!envelopeId)
|
|
12
|
+
throw new Error("usePriceTrip requires an envelopeId");
|
|
13
|
+
return priceTrip({ baseUrl, fetcher }, envelopeId, input);
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (result) => writePriceTripCache(queryClient, result),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ReserveTripBody } from "../operations.js";
|
|
2
|
+
export declare function useReserveTrip(envelopeId: string | null | undefined): import("@tanstack/react-query").UseMutationResult<import("@voyant-travel/trips").ReserveTripResult, Error, ReserveTripBody, unknown>;
|
|
3
|
+
//# sourceMappingURL=use-reserve-trip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-reserve-trip.d.ts","sourceRoot":"","sources":["../../src/hooks/use-reserve-trip.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,kBAAkB,CAAA;AAGpE,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,wIAWnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { writeReserveTripCache } from "../cache.js";
|
|
4
|
+
import { reserveTrip } from "../operations.js";
|
|
5
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
6
|
+
export function useReserveTrip(envelopeId) {
|
|
7
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
8
|
+
const queryClient = useQueryClient();
|
|
9
|
+
return useMutation({
|
|
10
|
+
mutationFn: async (input = {}) => {
|
|
11
|
+
if (!envelopeId)
|
|
12
|
+
throw new Error("useReserveTrip requires an envelopeId");
|
|
13
|
+
return reserveTrip({ baseUrl, fetcher }, envelopeId, input);
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (result) => writeReserveTripCache(queryClient, result),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type StartTripCheckoutBody } from "../operations.js";
|
|
2
|
+
export declare function useTripCheckout(envelopeId: string | null | undefined): import("@tanstack/react-query").UseMutationResult<import("@voyant-travel/trips").StartCheckoutResult, Error, StartTripCheckoutBody, unknown>;
|
|
3
|
+
//# sourceMappingURL=use-trip-checkout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-trip-checkout.d.ts","sourceRoot":"","sources":["../../src/hooks/use-trip-checkout.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAAqB,MAAM,kBAAkB,CAAA;AAGhF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,gJAWpE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { writeTripCheckoutCache } from "../cache.js";
|
|
4
|
+
import { startTripCheckout } from "../operations.js";
|
|
5
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
6
|
+
export function useTripCheckout(envelopeId) {
|
|
7
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
8
|
+
const queryClient = useQueryClient();
|
|
9
|
+
return useMutation({
|
|
10
|
+
mutationFn: async (input) => {
|
|
11
|
+
if (!envelopeId)
|
|
12
|
+
throw new Error("useTripCheckout requires an envelopeId");
|
|
13
|
+
return startTripCheckout({ baseUrl, fetcher }, envelopeId, input);
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (result) => writeTripCheckoutCache(queryClient, result),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface UseTripComponentsOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useTripComponents(envelopeId: string | null | undefined, options?: UseTripComponentsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
title: string | null;
|
|
7
|
+
description: string | null;
|
|
8
|
+
metadata: Record<string, unknown>;
|
|
9
|
+
status: "failed" | "cancelled" | "draft" | "priced" | "checkout_started" | "booked" | "unavailable" | "held" | "removed";
|
|
10
|
+
bookingGroupId: string | null;
|
|
11
|
+
orderId: string | null;
|
|
12
|
+
paymentSessionId: string | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
envelopeId: string;
|
|
16
|
+
sequence: number;
|
|
17
|
+
kind: "catalog_booking" | "manual_placeholder" | "flight_placeholder" | "flight_order" | "external_order";
|
|
18
|
+
entityModule: string | null;
|
|
19
|
+
entityId: string | null;
|
|
20
|
+
sourceKind: string | null;
|
|
21
|
+
sourceConnectionId: string | null;
|
|
22
|
+
sourceRef: string | null;
|
|
23
|
+
bookingDraftId: string | null;
|
|
24
|
+
catalogQuoteId: string | null;
|
|
25
|
+
bookingId: string | null;
|
|
26
|
+
providerRef: string | null;
|
|
27
|
+
supplierRef: string | null;
|
|
28
|
+
componentCurrency: string | null;
|
|
29
|
+
componentSubtotalAmountCents: number | null;
|
|
30
|
+
componentTaxAmountCents: number | null;
|
|
31
|
+
componentTotalAmountCents: number | null;
|
|
32
|
+
pricingSnapshot: import("@voyant-travel/trips").TripComponentPricingSnapshot | null;
|
|
33
|
+
taxLines: import("@voyant-travel/trips").TripComponentTaxLineSnapshot[] | null;
|
|
34
|
+
cancellationSnapshot: Record<string, unknown> | null;
|
|
35
|
+
holdToken: string | null;
|
|
36
|
+
holdExpiresAt: Date | null;
|
|
37
|
+
priceExpiresAt: Date | null;
|
|
38
|
+
warningCodes: string[];
|
|
39
|
+
}[], Error>;
|
|
40
|
+
//# sourceMappingURL=use-trip-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-trip-components.d.ts","sourceRoot":"","sources":["../../src/hooks/use-trip-components.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,OAAO,GAAE,wBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUvC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
4
|
+
import { getTripComponentsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useTripComponents(envelopeId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
const id = envelopeId ?? "";
|
|
9
|
+
return useQuery({
|
|
10
|
+
...getTripComponentsQueryOptions({ baseUrl, fetcher }, id),
|
|
11
|
+
enabled: enabled && Boolean(envelopeId),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface UseTripOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useTrip(envelopeId: string | null | undefined, options?: UseTripOptions): import("@tanstack/react-query").UseQueryResult<import("@voyant-travel/trips").Trip, Error>;
|
|
5
|
+
//# sourceMappingURL=use-trip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-trip.d.ts","sourceRoot":"","sources":["../../src/hooks/use-trip.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,cAAmB,8FAS1F"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
4
|
+
import { getTripQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useTrip(envelopeId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
const id = envelopeId ?? "";
|
|
9
|
+
return useQuery({
|
|
10
|
+
...getTripQueryOptions({ baseUrl, fetcher }, id),
|
|
11
|
+
enabled: enabled && Boolean(envelopeId),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ListTripsParams } from "../operations.js";
|
|
2
|
+
export interface UseTripsOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useTrips(params?: ListTripsParams, options?: UseTripsOptions): import("@tanstack/react-query").UseQueryResult<import("@voyant-travel/trips").TripListResult, Error>;
|
|
6
|
+
//# sourceMappingURL=use-trips.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-trips.d.ts","sourceRoot":"","sources":["../../src/hooks/use-trips.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAIvD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,QAAQ,CAAC,MAAM,GAAE,eAAoB,EAAE,OAAO,GAAE,eAAoB,wGAQnF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantTripsContext } from "../provider.js";
|
|
4
|
+
import { listTripsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useTrips(params = {}, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantTripsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...listTripsQueryOptions({ baseUrl, fetcher }, params),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { writePriceTripCache, writeReserveTripCache, writeTripCache, writeTripCheckoutCache, } from "./cache.js";
|
|
2
|
+
export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher, } from "./client.js";
|
|
3
|
+
export * from "./hooks/index.js";
|
|
4
|
+
export { type AddTripComponentBody, addTripComponent, type CancelTripComponentsBody, type CreateTripBody, type CreateTripSnapshotBody, cancelTripComponents, createTrip, freezeTripSnapshot, freezeTripSnapshotForQuoteVersion, getTrip, getTripSnapshot, type ListTripsParams, listTripSnapshots, listTrips, type PreviewTripCancellationBody, type PriceTripBody, previewTripCancellation, priceTrip, type ReserveTripBody, removeTripComponent, reserveTrip, type StartTripCheckoutBody, startTripCheckout, type UpdateTripComponentBody, updateTripComponent, } from "./operations.js";
|
|
5
|
+
export { useVoyantTripsContext, type VoyantTripsContextValue, VoyantTripsProvider, type VoyantTripsProviderProps, } from "./provider.js";
|
|
6
|
+
export { tripsQueryKeys } from "./query-keys.js";
|
|
7
|
+
export { getTripComponentsQueryOptions, getTripQueryOptions, listTripsQueryOptions, } from "./query-options.js";
|
|
8
|
+
export * from "./schemas.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACvB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,iCAAiC,EACjC,OAAO,EACP,eAAe,EACf,KAAK,eAAe,EACpB,iBAAiB,EACjB,SAAS,EACT,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,uBAAuB,EACvB,SAAS,EACT,KAAK,eAAe,EACpB,mBAAmB,EACnB,WAAW,EACX,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { writePriceTripCache, writeReserveTripCache, writeTripCache, writeTripCheckoutCache, } from "./cache.js";
|
|
2
|
+
export { defaultFetcher, fetchWithValidation, VoyantApiError, } from "./client.js";
|
|
3
|
+
export * from "./hooks/index.js";
|
|
4
|
+
export { addTripComponent, cancelTripComponents, createTrip, freezeTripSnapshot, freezeTripSnapshotForQuoteVersion, getTrip, getTripSnapshot, listTripSnapshots, listTrips, previewTripCancellation, priceTrip, removeTripComponent, reserveTrip, startTripCheckout, updateTripComponent, } from "./operations.js";
|
|
5
|
+
export { useVoyantTripsContext, VoyantTripsProvider, } from "./provider.js";
|
|
6
|
+
export { tripsQueryKeys } from "./query-keys.js";
|
|
7
|
+
export { getTripComponentsQueryOptions, getTripQueryOptions, listTripsQueryOptions, } from "./query-options.js";
|
|
8
|
+
export * from "./schemas.js";
|