@voyantjs/bookings-react 0.3.0 → 0.3.1
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 +11 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.d.ts +145 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.js +35 -0
- package/dist/hooks/use-public-booking-session-state.d.ts +16 -0
- package/dist/hooks/use-public-booking-session-state.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session-state.js +12 -0
- package/dist/hooks/use-public-booking-session.d.ts +98 -0
- package/dist/hooks/use-public-booking-session.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/query-keys.d.ts +3 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +3 -0
- package/dist/query-options.d.ts +432 -0
- package/dist/query-options.d.ts.map +1 -1
- package/dist/query-options.js +13 -1
- package/dist/schemas.d.ts +339 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +4 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
`@voyantjs/bookings-react` provides React Query hooks and provider utilities for Voyant bookings.
|
|
2
|
+
|
|
3
|
+
It now includes public storefront flow helpers alongside the admin hooks:
|
|
4
|
+
|
|
5
|
+
- `usePublicBookingSession`
|
|
6
|
+
- `usePublicBookingSessionState`
|
|
7
|
+
- `usePublicBookingSessionFlowMutation`
|
|
8
|
+
- `getPublicBookingSessionQueryOptions`
|
|
9
|
+
- `getPublicBookingSessionStateQueryOptions`
|
|
10
|
+
|
|
11
|
+
Those helpers target the public booking session contract for wizard-state
|
|
12
|
+
storage and room-selection repricing.
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export { type UpdateBookingStatusInput, useBookingStatusMutation, } from "./use-
|
|
|
7
7
|
export { type UseBookingsOptions, useBookings } from "./use-bookings.js";
|
|
8
8
|
export { type CreatePassengerInput, type UpdatePassengerInput, usePassengerMutation, } from "./use-passenger-mutation.js";
|
|
9
9
|
export { type UsePassengersOptions, usePassengers } from "./use-passengers.js";
|
|
10
|
+
export { type UsePublicBookingSessionOptions, usePublicBookingSession, } from "./use-public-booking-session.js";
|
|
11
|
+
export { usePublicBookingSessionFlowMutation } from "./use-public-booking-session-flow-mutation.js";
|
|
12
|
+
export { type UsePublicBookingSessionStateOptions, usePublicBookingSessionState, } from "./use-public-booking-session-state.js";
|
|
10
13
|
export { type CreateSupplierStatusInput, type UpdateSupplierStatusInput, useSupplierStatusMutation, } from "./use-supplier-status-mutation.js";
|
|
11
14
|
export { type UseSupplierStatusesOptions, useSupplierStatuses } from "./use-supplier-statuses.js";
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,KAAK,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,sBAAsB,EAC3B,sBAAsB,GACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,yBAAyB,GAC1B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,KAAK,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,sBAAsB,EAC3B,sBAAsB,GACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EACL,KAAK,8BAA8B,EACnC,uBAAuB,GACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAA;AACnG,OAAO,EACL,KAAK,mCAAmC,EACxC,4BAA4B,GAC7B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,yBAAyB,GAC1B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -7,5 +7,8 @@ export { useBookingStatusMutation, } from "./use-booking-status-mutation.js";
|
|
|
7
7
|
export { useBookings } from "./use-bookings.js";
|
|
8
8
|
export { usePassengerMutation, } from "./use-passenger-mutation.js";
|
|
9
9
|
export { usePassengers } from "./use-passengers.js";
|
|
10
|
+
export { usePublicBookingSession, } from "./use-public-booking-session.js";
|
|
11
|
+
export { usePublicBookingSessionFlowMutation } from "./use-public-booking-session-flow-mutation.js";
|
|
12
|
+
export { usePublicBookingSessionState, } from "./use-public-booking-session-state.js";
|
|
10
13
|
export { useSupplierStatusMutation, } from "./use-supplier-status-mutation.js";
|
|
11
14
|
export { useSupplierStatuses } from "./use-supplier-statuses.js";
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export declare function usePublicBookingSessionFlowMutation(sessionId: string): {
|
|
2
|
+
updateState: import("@tanstack/react-query").UseMutationResult<{
|
|
3
|
+
sessionId: string;
|
|
4
|
+
stateKey: "wizard";
|
|
5
|
+
currentStep: string | null;
|
|
6
|
+
completedSteps: string[];
|
|
7
|
+
payload: Record<string, unknown>;
|
|
8
|
+
version: number;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}, Error, {
|
|
12
|
+
payload: Record<string, unknown>;
|
|
13
|
+
replacePayload: boolean;
|
|
14
|
+
currentStep?: string | null | undefined;
|
|
15
|
+
completedSteps?: string[] | undefined;
|
|
16
|
+
}, unknown>;
|
|
17
|
+
reprice: import("@tanstack/react-query").UseMutationResult<{
|
|
18
|
+
pricing: {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
catalogId: string | null;
|
|
21
|
+
currencyCode: string;
|
|
22
|
+
totalSellAmountCents: number;
|
|
23
|
+
items: {
|
|
24
|
+
itemId: string;
|
|
25
|
+
title: string;
|
|
26
|
+
productId: string | null;
|
|
27
|
+
optionId: string | null;
|
|
28
|
+
optionUnitId: string | null;
|
|
29
|
+
optionUnitName: string | null;
|
|
30
|
+
optionUnitType: string | null;
|
|
31
|
+
pricingCategoryId: string | null;
|
|
32
|
+
quantity: number;
|
|
33
|
+
pricingMode: string;
|
|
34
|
+
unitSellAmountCents: number | null;
|
|
35
|
+
totalSellAmountCents: number | null;
|
|
36
|
+
warnings: string[];
|
|
37
|
+
}[];
|
|
38
|
+
warnings: string[];
|
|
39
|
+
appliedToSession: boolean;
|
|
40
|
+
};
|
|
41
|
+
session: {
|
|
42
|
+
sessionId: string;
|
|
43
|
+
bookingNumber: string;
|
|
44
|
+
status: "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
|
|
45
|
+
externalBookingRef: string | null;
|
|
46
|
+
communicationLanguage: string | null;
|
|
47
|
+
sellCurrency: string;
|
|
48
|
+
sellAmountCents: number | null;
|
|
49
|
+
startDate: string | null;
|
|
50
|
+
endDate: string | null;
|
|
51
|
+
pax: number | null;
|
|
52
|
+
holdExpiresAt: string | null;
|
|
53
|
+
confirmedAt: string | null;
|
|
54
|
+
expiredAt: string | null;
|
|
55
|
+
cancelledAt: string | null;
|
|
56
|
+
completedAt: string | null;
|
|
57
|
+
participants: {
|
|
58
|
+
id: string;
|
|
59
|
+
participantType: "traveler" | "booker" | "contact" | "occupant" | "staff" | "other";
|
|
60
|
+
travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
|
|
61
|
+
firstName: string;
|
|
62
|
+
lastName: string;
|
|
63
|
+
email: string | null;
|
|
64
|
+
phone: string | null;
|
|
65
|
+
preferredLanguage: string | null;
|
|
66
|
+
accessibilityNeeds: string | null;
|
|
67
|
+
specialRequests: string | null;
|
|
68
|
+
isPrimary: boolean;
|
|
69
|
+
notes: string | null;
|
|
70
|
+
}[];
|
|
71
|
+
items: {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
description: string | null;
|
|
75
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
76
|
+
status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
|
|
77
|
+
serviceDate: string | null;
|
|
78
|
+
startsAt: string | null;
|
|
79
|
+
endsAt: string | null;
|
|
80
|
+
quantity: number;
|
|
81
|
+
sellCurrency: string;
|
|
82
|
+
unitSellAmountCents: number | null;
|
|
83
|
+
totalSellAmountCents: number | null;
|
|
84
|
+
costCurrency: string | null;
|
|
85
|
+
unitCostAmountCents: number | null;
|
|
86
|
+
totalCostAmountCents: number | null;
|
|
87
|
+
notes: string | null;
|
|
88
|
+
productId: string | null;
|
|
89
|
+
optionId: string | null;
|
|
90
|
+
optionUnitId: string | null;
|
|
91
|
+
pricingCategoryId: string | null;
|
|
92
|
+
participantLinks: {
|
|
93
|
+
id: string;
|
|
94
|
+
participantId: string;
|
|
95
|
+
role: "traveler" | "occupant" | "other" | "primary_contact" | "service_assignee" | "beneficiary";
|
|
96
|
+
isPrimary: boolean;
|
|
97
|
+
}[];
|
|
98
|
+
}[];
|
|
99
|
+
allocations: {
|
|
100
|
+
id: string;
|
|
101
|
+
bookingItemId: string | null;
|
|
102
|
+
productId: string | null;
|
|
103
|
+
optionId: string | null;
|
|
104
|
+
optionUnitId: string | null;
|
|
105
|
+
pricingCategoryId: string | null;
|
|
106
|
+
availabilitySlotId: string | null;
|
|
107
|
+
quantity: number;
|
|
108
|
+
allocationType: "unit" | "pickup" | "resource";
|
|
109
|
+
status: "confirmed" | "expired" | "cancelled" | "fulfilled" | "held" | "released";
|
|
110
|
+
holdExpiresAt: string | null;
|
|
111
|
+
confirmedAt: string | null;
|
|
112
|
+
releasedAt: string | null;
|
|
113
|
+
}[];
|
|
114
|
+
checklist: {
|
|
115
|
+
hasParticipants: boolean;
|
|
116
|
+
hasTraveler: boolean;
|
|
117
|
+
hasPrimaryParticipant: boolean;
|
|
118
|
+
hasItems: boolean;
|
|
119
|
+
hasAllocations: boolean;
|
|
120
|
+
readyForConfirmation: boolean;
|
|
121
|
+
};
|
|
122
|
+
state: {
|
|
123
|
+
sessionId: string;
|
|
124
|
+
stateKey: "wizard";
|
|
125
|
+
currentStep: string | null;
|
|
126
|
+
completedSteps: string[];
|
|
127
|
+
payload: Record<string, unknown>;
|
|
128
|
+
version: number;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
updatedAt: string;
|
|
131
|
+
} | null;
|
|
132
|
+
} | null;
|
|
133
|
+
}, Error, {
|
|
134
|
+
applyToSession: boolean;
|
|
135
|
+
selections: {
|
|
136
|
+
itemId: string;
|
|
137
|
+
optionId?: string | null | undefined;
|
|
138
|
+
optionUnitId?: string | null | undefined;
|
|
139
|
+
pricingCategoryId?: string | null | undefined;
|
|
140
|
+
quantity?: number | undefined;
|
|
141
|
+
}[];
|
|
142
|
+
catalogId?: string | undefined;
|
|
143
|
+
}, unknown>;
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=use-public-booking-session-flow-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-public-booking-session-flow-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-public-booking-session-flow-mutation.ts"],"names":[],"mappings":"AAgBA,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCpE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantBookingsContext } from "../provider.js";
|
|
5
|
+
import { bookingsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { publicBookingSessionRepriceResponse, publicBookingSessionStateResponse, } from "../schemas.js";
|
|
7
|
+
export function usePublicBookingSessionFlowMutation(sessionId) {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantBookingsContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const updateState = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation(`/v1/public/bookings/sessions/${sessionId}/state`, publicBookingSessionStateResponse, { baseUrl, fetcher }, { method: "PUT", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
queryClient.setQueryData(bookingsQueryKeys.publicSessionState(sessionId), { data });
|
|
17
|
+
void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.publicSession(sessionId) });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const reprice = useMutation({
|
|
21
|
+
mutationFn: async (input) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/public/bookings/sessions/${sessionId}/reprice`, publicBookingSessionRepriceResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
if (data.session) {
|
|
27
|
+
queryClient.setQueryData(bookingsQueryKeys.publicSession(sessionId), { data: data.session });
|
|
28
|
+
void queryClient.invalidateQueries({
|
|
29
|
+
queryKey: bookingsQueryKeys.publicSessionState(sessionId),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
return { updateState, reprice };
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UsePublicBookingSessionStateOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function usePublicBookingSessionState(sessionId: string | null | undefined, options?: UsePublicBookingSessionStateOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
data: {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
stateKey: "wizard";
|
|
8
|
+
currentStep: string | null;
|
|
9
|
+
completedSteps: string[];
|
|
10
|
+
payload: Record<string, unknown>;
|
|
11
|
+
version: number;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
};
|
|
15
|
+
}, Error>;
|
|
16
|
+
//# sourceMappingURL=use-public-booking-session-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-public-booking-session-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-public-booking-session-state.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mCAAmC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,mCAAwC;;;;;;;;;;;UASlD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantBookingsContext } from "../provider.js";
|
|
4
|
+
import { getPublicBookingSessionStateQueryOptions } from "../query-options.js";
|
|
5
|
+
export function usePublicBookingSessionState(sessionId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantBookingsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getPublicBookingSessionStateQueryOptions({ baseUrl, fetcher }, sessionId),
|
|
10
|
+
enabled: enabled && Boolean(sessionId),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface UsePublicBookingSessionOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function usePublicBookingSession(sessionId: string | null | undefined, options?: UsePublicBookingSessionOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
data: {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
bookingNumber: string;
|
|
8
|
+
status: "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
|
|
9
|
+
externalBookingRef: string | null;
|
|
10
|
+
communicationLanguage: string | null;
|
|
11
|
+
sellCurrency: string;
|
|
12
|
+
sellAmountCents: number | null;
|
|
13
|
+
startDate: string | null;
|
|
14
|
+
endDate: string | null;
|
|
15
|
+
pax: number | null;
|
|
16
|
+
holdExpiresAt: string | null;
|
|
17
|
+
confirmedAt: string | null;
|
|
18
|
+
expiredAt: string | null;
|
|
19
|
+
cancelledAt: string | null;
|
|
20
|
+
completedAt: string | null;
|
|
21
|
+
participants: {
|
|
22
|
+
id: string;
|
|
23
|
+
participantType: "traveler" | "booker" | "contact" | "occupant" | "staff" | "other";
|
|
24
|
+
travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
email: string | null;
|
|
28
|
+
phone: string | null;
|
|
29
|
+
preferredLanguage: string | null;
|
|
30
|
+
accessibilityNeeds: string | null;
|
|
31
|
+
specialRequests: string | null;
|
|
32
|
+
isPrimary: boolean;
|
|
33
|
+
notes: string | null;
|
|
34
|
+
}[];
|
|
35
|
+
items: {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
40
|
+
status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
|
|
41
|
+
serviceDate: string | null;
|
|
42
|
+
startsAt: string | null;
|
|
43
|
+
endsAt: string | null;
|
|
44
|
+
quantity: number;
|
|
45
|
+
sellCurrency: string;
|
|
46
|
+
unitSellAmountCents: number | null;
|
|
47
|
+
totalSellAmountCents: number | null;
|
|
48
|
+
costCurrency: string | null;
|
|
49
|
+
unitCostAmountCents: number | null;
|
|
50
|
+
totalCostAmountCents: number | null;
|
|
51
|
+
notes: string | null;
|
|
52
|
+
productId: string | null;
|
|
53
|
+
optionId: string | null;
|
|
54
|
+
optionUnitId: string | null;
|
|
55
|
+
pricingCategoryId: string | null;
|
|
56
|
+
participantLinks: {
|
|
57
|
+
id: string;
|
|
58
|
+
participantId: string;
|
|
59
|
+
role: "traveler" | "occupant" | "other" | "primary_contact" | "service_assignee" | "beneficiary";
|
|
60
|
+
isPrimary: boolean;
|
|
61
|
+
}[];
|
|
62
|
+
}[];
|
|
63
|
+
allocations: {
|
|
64
|
+
id: string;
|
|
65
|
+
bookingItemId: string | null;
|
|
66
|
+
productId: string | null;
|
|
67
|
+
optionId: string | null;
|
|
68
|
+
optionUnitId: string | null;
|
|
69
|
+
pricingCategoryId: string | null;
|
|
70
|
+
availabilitySlotId: string | null;
|
|
71
|
+
quantity: number;
|
|
72
|
+
allocationType: "unit" | "pickup" | "resource";
|
|
73
|
+
status: "confirmed" | "expired" | "cancelled" | "fulfilled" | "held" | "released";
|
|
74
|
+
holdExpiresAt: string | null;
|
|
75
|
+
confirmedAt: string | null;
|
|
76
|
+
releasedAt: string | null;
|
|
77
|
+
}[];
|
|
78
|
+
checklist: {
|
|
79
|
+
hasParticipants: boolean;
|
|
80
|
+
hasTraveler: boolean;
|
|
81
|
+
hasPrimaryParticipant: boolean;
|
|
82
|
+
hasItems: boolean;
|
|
83
|
+
hasAllocations: boolean;
|
|
84
|
+
readyForConfirmation: boolean;
|
|
85
|
+
};
|
|
86
|
+
state: {
|
|
87
|
+
sessionId: string;
|
|
88
|
+
stateKey: "wizard";
|
|
89
|
+
currentStep: string | null;
|
|
90
|
+
completedSteps: string[];
|
|
91
|
+
payload: Record<string, unknown>;
|
|
92
|
+
version: number;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
} | null;
|
|
96
|
+
};
|
|
97
|
+
}, Error>;
|
|
98
|
+
//# sourceMappingURL=use-public-booking-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-public-booking-session.d.ts","sourceRoot":"","sources":["../../src/hooks/use-public-booking-session.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAS7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantBookingsContext } from "../provider.js";
|
|
4
|
+
import { getPublicBookingSessionQueryOptions } from "../query-options.js";
|
|
5
|
+
export function usePublicBookingSession(sessionId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantBookingsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getPublicBookingSessionQueryOptions({ baseUrl, fetcher }, sessionId),
|
|
10
|
+
enabled: enabled && Boolean(sessionId),
|
|
11
|
+
});
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher
|
|
|
2
2
|
export * from "./hooks/index.js";
|
|
3
3
|
export { useVoyantBookingsContext, type VoyantBookingsContextValue, VoyantBookingsProvider, type VoyantBookingsProviderProps, } from "./provider.js";
|
|
4
4
|
export { bookingsQueryKeys } from "./query-keys.js";
|
|
5
|
-
export { getBookingActivityQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
5
|
+
export { getBookingActivityQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
6
6
|
export * from "./schemas.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,mCAAmC,EACnC,wCAAwC,EACxC,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,5 +2,5 @@ export { defaultFetcher, fetchWithValidation, VoyantApiError, } from "./client.j
|
|
|
2
2
|
export * from "./hooks/index.js";
|
|
3
3
|
export { useVoyantBookingsContext, VoyantBookingsProvider, } from "./provider.js";
|
|
4
4
|
export { bookingsQueryKeys } from "./query-keys.js";
|
|
5
|
-
export { getBookingActivityQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
5
|
+
export { getBookingActivityQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
6
6
|
export * from "./schemas.js";
|
package/dist/query-keys.d.ts
CHANGED
|
@@ -7,8 +7,11 @@ export interface BookingsListFilters {
|
|
|
7
7
|
export declare const bookingsQueryKeys: {
|
|
8
8
|
readonly all: readonly ["voyant", "bookings"];
|
|
9
9
|
readonly bookings: () => readonly ["voyant", "bookings", "bookings"];
|
|
10
|
+
readonly publicSessions: () => readonly ["voyant", "bookings", "public-sessions"];
|
|
10
11
|
readonly bookingsList: (filters: BookingsListFilters) => readonly ["voyant", "bookings", "bookings", "list", BookingsListFilters];
|
|
11
12
|
readonly booking: (id: string) => readonly ["voyant", "bookings", "bookings", "detail", string];
|
|
13
|
+
readonly publicSession: (sessionId: string) => readonly ["voyant", "bookings", "public-sessions", "detail", string];
|
|
14
|
+
readonly publicSessionState: (sessionId: string) => readonly ["voyant", "bookings", "public-sessions", "detail", string, "state"];
|
|
12
15
|
readonly passengers: (bookingId: string) => readonly ["voyant", "bookings", "bookings", "detail", string, "passengers"];
|
|
13
16
|
readonly supplierStatuses: (bookingId: string) => readonly ["voyant", "bookings", "bookings", "detail", string, "supplier-statuses"];
|
|
14
17
|
readonly activity: (bookingId: string) => readonly ["voyant", "bookings", "bookings", "detail", string, "activity"];
|
package/dist/query-keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,eAAO,MAAM,iBAAiB;;;;qCAKJ,mBAAmB;2BAE7B,MAAM;wCACO,MAAM;6CAED,MAAM;qCAGd,MAAM;2CAEA,MAAM;mCAEd,MAAM;gCACT,MAAM;CACjB,CAAA"}
|
package/dist/query-keys.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export const bookingsQueryKeys = {
|
|
2
2
|
all: ["voyant", "bookings"],
|
|
3
3
|
bookings: () => [...bookingsQueryKeys.all, "bookings"],
|
|
4
|
+
publicSessions: () => [...bookingsQueryKeys.all, "public-sessions"],
|
|
4
5
|
bookingsList: (filters) => [...bookingsQueryKeys.bookings(), "list", filters],
|
|
5
6
|
booking: (id) => [...bookingsQueryKeys.bookings(), "detail", id],
|
|
7
|
+
publicSession: (sessionId) => [...bookingsQueryKeys.publicSessions(), "detail", sessionId],
|
|
8
|
+
publicSessionState: (sessionId) => [...bookingsQueryKeys.publicSession(sessionId), "state"],
|
|
6
9
|
passengers: (bookingId) => [...bookingsQueryKeys.booking(bookingId), "passengers"],
|
|
7
10
|
supplierStatuses: (bookingId) => [...bookingsQueryKeys.booking(bookingId), "supplier-statuses"],
|
|
8
11
|
activity: (bookingId) => [...bookingsQueryKeys.booking(bookingId), "activity"],
|