@voyantjs/bookings-react 0.2.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/LICENSE +109 -0
- package/README.md +11 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/use-booking-activity.d.ts +15 -0
- package/dist/hooks/use-booking-activity.d.ts.map +1 -0
- package/dist/hooks/use-booking-activity.js +12 -0
- package/dist/hooks/use-booking-note-mutation.d.ts +11 -0
- package/dist/hooks/use-booking-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-note-mutation.js +24 -0
- package/dist/hooks/use-booking-notes.d.ts +13 -0
- package/dist/hooks/use-booking-notes.d.ts.map +1 -0
- package/dist/hooks/use-booking-notes.js +12 -0
- package/dist/hooks/use-booking.d.ts.map +1 -1
- package/dist/hooks/use-booking.js +2 -5
- package/dist/hooks/use-bookings.d.ts +1 -1
- package/dist/hooks/use-bookings.d.ts.map +1 -1
- package/dist/hooks/use-bookings.js +2 -20
- package/dist/hooks/use-passengers.d.ts.map +1 -1
- package/dist/hooks/use-passengers.js +2 -8
- 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/hooks/use-supplier-status-mutation.d.ts +46 -0
- package/dist/hooks/use-supplier-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-status-mutation.js +39 -0
- package/dist/hooks/use-supplier-statuses.d.ts +20 -0
- package/dist/hooks/use-supplier-statuses.d.ts.map +1 -0
- package/dist/hooks/use-supplier-statuses.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/provider.d.ts +1 -13
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -16
- 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 +828 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +71 -0
- package/dist/schemas.d.ts +342 -3
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +4 -0
- package/package.json +42 -46
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface CreateSupplierStatusInput {
|
|
2
|
+
supplierServiceId?: string | null;
|
|
3
|
+
serviceName: string;
|
|
4
|
+
status?: "pending" | "confirmed" | "rejected" | "cancelled";
|
|
5
|
+
supplierReference?: string | null;
|
|
6
|
+
costCurrency: string;
|
|
7
|
+
costAmountCents: number;
|
|
8
|
+
notes?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export type UpdateSupplierStatusInput = Partial<CreateSupplierStatusInput> & {
|
|
11
|
+
confirmedAt?: string | null;
|
|
12
|
+
};
|
|
13
|
+
export declare function useSupplierStatusMutation(bookingId: string): {
|
|
14
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
15
|
+
id: string;
|
|
16
|
+
bookingId: string;
|
|
17
|
+
supplierServiceId: string | null;
|
|
18
|
+
serviceName: string;
|
|
19
|
+
status: "pending" | "confirmed" | "cancelled" | "rejected";
|
|
20
|
+
supplierReference: string | null;
|
|
21
|
+
costCurrency: string;
|
|
22
|
+
costAmountCents: number;
|
|
23
|
+
notes: string | null;
|
|
24
|
+
confirmedAt: string | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}, Error, CreateSupplierStatusInput, unknown>;
|
|
28
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
29
|
+
id: string;
|
|
30
|
+
bookingId: string;
|
|
31
|
+
supplierServiceId: string | null;
|
|
32
|
+
serviceName: string;
|
|
33
|
+
status: "pending" | "confirmed" | "cancelled" | "rejected";
|
|
34
|
+
supplierReference: string | null;
|
|
35
|
+
costCurrency: string;
|
|
36
|
+
costAmountCents: number;
|
|
37
|
+
notes: string | null;
|
|
38
|
+
confirmedAt: string | null;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}, Error, {
|
|
42
|
+
id: string;
|
|
43
|
+
input: UpdateSupplierStatusInput;
|
|
44
|
+
}, unknown>;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=use-supplier-status-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-supplier-status-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-supplier-status-mutation.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CAAA;IAC3D,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,GAAG;IAC3E,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAMD,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBf,MAAM;eAAS,yBAAyB;;EAkBnF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantBookingsContext } from "../provider.js";
|
|
6
|
+
import { bookingsQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { bookingSupplierStatusRecordSchema } from "../schemas.js";
|
|
8
|
+
const bookingSupplierStatusSingleResponse = z.object({
|
|
9
|
+
data: bookingSupplierStatusRecordSchema,
|
|
10
|
+
});
|
|
11
|
+
export function useSupplierStatusMutation(bookingId) {
|
|
12
|
+
const { baseUrl, fetcher } = useVoyantBookingsContext();
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
const create = useMutation({
|
|
15
|
+
mutationFn: async (input) => {
|
|
16
|
+
const { data } = await fetchWithValidation(`/v1/bookings/${bookingId}/supplier-statuses`, bookingSupplierStatusSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
17
|
+
return data;
|
|
18
|
+
},
|
|
19
|
+
onSuccess: () => {
|
|
20
|
+
void queryClient.invalidateQueries({
|
|
21
|
+
queryKey: bookingsQueryKeys.supplierStatuses(bookingId),
|
|
22
|
+
});
|
|
23
|
+
void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const update = useMutation({
|
|
27
|
+
mutationFn: async ({ id, input }) => {
|
|
28
|
+
const { data } = await fetchWithValidation(`/v1/bookings/${bookingId}/supplier-statuses/${id}`, bookingSupplierStatusSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
29
|
+
return data;
|
|
30
|
+
},
|
|
31
|
+
onSuccess: () => {
|
|
32
|
+
void queryClient.invalidateQueries({
|
|
33
|
+
queryKey: bookingsQueryKeys.supplierStatuses(bookingId),
|
|
34
|
+
});
|
|
35
|
+
void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return { create, update };
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UseSupplierStatusesOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useSupplierStatuses(bookingId: string | null | undefined, options?: UseSupplierStatusesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
bookingId: string;
|
|
8
|
+
supplierServiceId: string | null;
|
|
9
|
+
serviceName: string;
|
|
10
|
+
status: "pending" | "confirmed" | "cancelled" | "rejected";
|
|
11
|
+
supplierReference: string | null;
|
|
12
|
+
costCurrency: string;
|
|
13
|
+
costAmountCents: number;
|
|
14
|
+
notes: string | null;
|
|
15
|
+
confirmedAt: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}[];
|
|
19
|
+
}, Error>;
|
|
20
|
+
//# sourceMappingURL=use-supplier-statuses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-supplier-statuses.d.ts","sourceRoot":"","sources":["../../src/hooks/use-supplier-statuses.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;;UASzC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantBookingsContext } from "../provider.js";
|
|
4
|
+
import { getSupplierStatusesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useSupplierStatuses(bookingId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantBookingsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getSupplierStatusesQueryOptions({ baseUrl, fetcher }, bookingId),
|
|
10
|
+
enabled: enabled && Boolean(bookingId),
|
|
11
|
+
});
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +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, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
5
6
|
export * from "./schemas.js";
|
|
6
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,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,4 +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, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
|
|
5
6
|
export * from "./schemas.js";
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type VoyantFetcher } from "./client.js";
|
|
3
|
-
export interface VoyantBookingsContextValue {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
fetcher: VoyantFetcher;
|
|
6
|
-
}
|
|
7
|
-
export interface VoyantBookingsProviderProps {
|
|
8
|
-
baseUrl: string;
|
|
9
|
-
fetcher?: VoyantFetcher;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare function VoyantBookingsProvider({ baseUrl, fetcher, children, }: VoyantBookingsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare function useVoyantBookingsContext(): VoyantBookingsContextValue;
|
|
1
|
+
export { useVoyantReactContext as useVoyantBookingsContext, type VoyantReactContextValue as VoyantBookingsContextValue, VoyantReactProvider as VoyantBookingsProvider, type VoyantReactProviderProps as VoyantBookingsProviderProps, } from "@voyantjs/react";
|
|
14
2
|
//# sourceMappingURL=provider.d.ts.map
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,wBAAwB,EACjD,KAAK,uBAAuB,IAAI,0BAA0B,EAC1D,mBAAmB,IAAI,sBAAsB,EAC7C,KAAK,wBAAwB,IAAI,2BAA2B,GAC7D,MAAM,iBAAiB,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useMemo } from "react";
|
|
4
|
-
import { defaultFetcher } from "./client.js";
|
|
5
|
-
const VoyantBookingsContext = createContext(null);
|
|
6
|
-
export function VoyantBookingsProvider({ baseUrl, fetcher, children, }) {
|
|
7
|
-
const value = useMemo(() => ({ baseUrl, fetcher: fetcher ?? defaultFetcher }), [baseUrl, fetcher]);
|
|
8
|
-
return _jsx(VoyantBookingsContext.Provider, { value: value, children: children });
|
|
9
|
-
}
|
|
10
|
-
export function useVoyantBookingsContext() {
|
|
11
|
-
const context = useContext(VoyantBookingsContext);
|
|
12
|
-
if (!context) {
|
|
13
|
-
throw new Error('useVoyantBookingsContext must be used inside <VoyantBookingsProvider>. Wrap your app with <VoyantBookingsProvider baseUrl="/api" />.');
|
|
14
|
-
}
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
1
|
+
export { useVoyantReactContext as useVoyantBookingsContext, VoyantReactProvider as VoyantBookingsProvider, } from "@voyantjs/react";
|
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"],
|