@voyantjs/hospitality-react 0.2.0
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/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +59 -0
- package/dist/hooks/index.d.ts +35 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +34 -0
- package/dist/hooks/use-housekeeping-task-mutation.d.ts +54 -0
- package/dist/hooks/use-housekeeping-task-mutation.d.ts.map +1 -0
- package/dist/hooks/use-housekeeping-task-mutation.js +38 -0
- package/dist/hooks/use-housekeeping-tasks.d.ts +30 -0
- package/dist/hooks/use-housekeeping-tasks.d.ts.map +1 -0
- package/dist/hooks/use-housekeeping-tasks.js +11 -0
- package/dist/hooks/use-maintenance-block-mutation.d.ts +47 -0
- package/dist/hooks/use-maintenance-block-mutation.d.ts.map +1 -0
- package/dist/hooks/use-maintenance-block-mutation.js +38 -0
- package/dist/hooks/use-maintenance-blocks.d.ts +24 -0
- package/dist/hooks/use-maintenance-blocks.d.ts.map +1 -0
- package/dist/hooks/use-maintenance-blocks.js +11 -0
- package/dist/hooks/use-meal-plan-mutation.d.ts +53 -0
- package/dist/hooks/use-meal-plan-mutation.d.ts.map +1 -0
- package/dist/hooks/use-meal-plan-mutation.js +38 -0
- package/dist/hooks/use-meal-plan.d.ts +18 -0
- package/dist/hooks/use-meal-plan.d.ts.map +1 -0
- package/dist/hooks/use-meal-plan.js +12 -0
- package/dist/hooks/use-meal-plans.d.ts +27 -0
- package/dist/hooks/use-meal-plans.d.ts.map +1 -0
- package/dist/hooks/use-meal-plans.js +11 -0
- package/dist/hooks/use-rate-plan-inventory-override-mutation.d.ts +47 -0
- package/dist/hooks/use-rate-plan-inventory-override-mutation.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan-inventory-override-mutation.js +44 -0
- package/dist/hooks/use-rate-plan-inventory-overrides.d.ts +27 -0
- package/dist/hooks/use-rate-plan-inventory-overrides.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan-inventory-overrides.js +11 -0
- package/dist/hooks/use-rate-plan-mutation.d.ts +68 -0
- package/dist/hooks/use-rate-plan-mutation.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan-mutation.js +38 -0
- package/dist/hooks/use-rate-plan-room-type-mutation.d.ts +41 -0
- package/dist/hooks/use-rate-plan-room-type-mutation.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan-room-type-mutation.js +38 -0
- package/dist/hooks/use-rate-plan-room-types.d.ts +25 -0
- package/dist/hooks/use-rate-plan-room-types.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan-room-types.js +11 -0
- package/dist/hooks/use-rate-plan.d.ts +23 -0
- package/dist/hooks/use-rate-plan.d.ts.map +1 -0
- package/dist/hooks/use-rate-plan.js +12 -0
- package/dist/hooks/use-rate-plans.d.ts +32 -0
- package/dist/hooks/use-rate-plans.d.ts.map +1 -0
- package/dist/hooks/use-rate-plans.js +11 -0
- package/dist/hooks/use-room-block-mutation.d.ts +51 -0
- package/dist/hooks/use-room-block-mutation.d.ts.map +1 -0
- package/dist/hooks/use-room-block-mutation.js +38 -0
- package/dist/hooks/use-room-blocks.d.ts +25 -0
- package/dist/hooks/use-room-blocks.d.ts.map +1 -0
- package/dist/hooks/use-room-blocks.js +11 -0
- package/dist/hooks/use-room-inventory-mutation.d.ts +53 -0
- package/dist/hooks/use-room-inventory-mutation.d.ts.map +1 -0
- package/dist/hooks/use-room-inventory-mutation.js +38 -0
- package/dist/hooks/use-room-inventory.d.ts +29 -0
- package/dist/hooks/use-room-inventory.d.ts.map +1 -0
- package/dist/hooks/use-room-inventory.js +11 -0
- package/dist/hooks/use-room-type-mutation.d.ts +83 -0
- package/dist/hooks/use-room-type-mutation.d.ts.map +1 -0
- package/dist/hooks/use-room-type-mutation.js +38 -0
- package/dist/hooks/use-room-type-rate-mutation.d.ts +50 -0
- package/dist/hooks/use-room-type-rate-mutation.d.ts.map +1 -0
- package/dist/hooks/use-room-type-rate-mutation.js +38 -0
- package/dist/hooks/use-room-type-rates.d.ts +28 -0
- package/dist/hooks/use-room-type-rates.d.ts.map +1 -0
- package/dist/hooks/use-room-type-rates.js +11 -0
- package/dist/hooks/use-room-type.d.ts +28 -0
- package/dist/hooks/use-room-type.d.ts.map +1 -0
- package/dist/hooks/use-room-type.js +12 -0
- package/dist/hooks/use-room-types.d.ts +37 -0
- package/dist/hooks/use-room-types.d.ts.map +1 -0
- package/dist/hooks/use-room-types.js +11 -0
- package/dist/hooks/use-room-unit-mutation.d.ts +56 -0
- package/dist/hooks/use-room-unit-mutation.d.ts.map +1 -0
- package/dist/hooks/use-room-unit-mutation.js +38 -0
- package/dist/hooks/use-room-unit.d.ts +19 -0
- package/dist/hooks/use-room-unit.d.ts.map +1 -0
- package/dist/hooks/use-room-unit.js +12 -0
- package/dist/hooks/use-room-units.d.ts +28 -0
- package/dist/hooks/use-room-units.d.ts.map +1 -0
- package/dist/hooks/use-room-units.js +11 -0
- package/dist/hooks/use-stay-booking-item-mutation.d.ts +72 -0
- package/dist/hooks/use-stay-booking-item-mutation.d.ts.map +1 -0
- package/dist/hooks/use-stay-booking-item-mutation.js +38 -0
- package/dist/hooks/use-stay-booking-items.d.ts +39 -0
- package/dist/hooks/use-stay-booking-items.d.ts.map +1 -0
- package/dist/hooks/use-stay-booking-items.js +11 -0
- package/dist/hooks/use-stay-folio-mutation.d.ts +39 -0
- package/dist/hooks/use-stay-folio-mutation.d.ts.map +1 -0
- package/dist/hooks/use-stay-folio-mutation.js +38 -0
- package/dist/hooks/use-stay-folios.d.ts +22 -0
- package/dist/hooks/use-stay-folios.d.ts.map +1 -0
- package/dist/hooks/use-stay-folios.js +11 -0
- package/dist/hooks/use-stay-operation-mutation.d.ts +51 -0
- package/dist/hooks/use-stay-operation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-stay-operation-mutation.js +38 -0
- package/dist/hooks/use-stay-operations.d.ts +28 -0
- package/dist/hooks/use-stay-operations.d.ts.map +1 -0
- package/dist/hooks/use-stay-operations.js +11 -0
- package/dist/hooks/use-stay-rule-mutation.d.ts +74 -0
- package/dist/hooks/use-stay-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-stay-rule-mutation.js +38 -0
- package/dist/hooks/use-stay-rules.d.ts +33 -0
- package/dist/hooks/use-stay-rules.d.ts.map +1 -0
- package/dist/hooks/use-stay-rules.js +11 -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 +129 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +48 -0
- package/dist/query-options.d.ts +1678 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +189 -0
- package/dist/schemas.d.ts +965 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +225 -0
- package/package.json +79 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface UseRoomUnitsOptions {
|
|
2
|
+
propertyId: string | null | undefined;
|
|
3
|
+
search?: string | undefined;
|
|
4
|
+
limit?: number | undefined;
|
|
5
|
+
offset?: number | undefined;
|
|
6
|
+
enabled?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function useRoomUnits(options: UseRoomUnitsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
9
|
+
data: {
|
|
10
|
+
propertyId: string;
|
|
11
|
+
roomTypeId: string;
|
|
12
|
+
id: string;
|
|
13
|
+
code: string | null;
|
|
14
|
+
roomNumber: string | null;
|
|
15
|
+
floor: string | null;
|
|
16
|
+
wing: string | null;
|
|
17
|
+
status: "active" | "inactive" | "archived" | "out_of_order";
|
|
18
|
+
viewCode: string | null;
|
|
19
|
+
accessibilityCode: string | null;
|
|
20
|
+
genderRestriction: string | null;
|
|
21
|
+
notes: string | null;
|
|
22
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
23
|
+
}[];
|
|
24
|
+
total: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
}, Error>;
|
|
28
|
+
//# sourceMappingURL=use-room-units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-room-units.d.ts","sourceRoot":"","sources":["../../src/hooks/use-room-units.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;UAOxD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getRoomUnitsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useRoomUnits(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getRoomUnitsQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true) && Boolean(options.propertyId),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { insertStayBookingItemSchema, updateStayBookingItemSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateStayBookingItemInput = z.input<typeof insertStayBookingItemSchema>;
|
|
4
|
+
export type UpdateStayBookingItemInput = z.input<typeof updateStayBookingItemSchema>;
|
|
5
|
+
export declare function useStayBookingItemMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
id: string;
|
|
8
|
+
bookingItemId: string;
|
|
9
|
+
propertyId: string;
|
|
10
|
+
roomTypeId: string;
|
|
11
|
+
roomUnitId: string | null;
|
|
12
|
+
ratePlanId: string;
|
|
13
|
+
mealPlanId: string | null;
|
|
14
|
+
checkInDate: string;
|
|
15
|
+
checkOutDate: string;
|
|
16
|
+
nightCount: number;
|
|
17
|
+
roomCount: number;
|
|
18
|
+
adults: number;
|
|
19
|
+
children: number;
|
|
20
|
+
infants: number;
|
|
21
|
+
confirmationCode: string | null;
|
|
22
|
+
voucherCode: string | null;
|
|
23
|
+
status: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show";
|
|
24
|
+
notes: string | null;
|
|
25
|
+
}, Error, {
|
|
26
|
+
bookingItemId: string;
|
|
27
|
+
propertyId: string;
|
|
28
|
+
roomTypeId: string;
|
|
29
|
+
ratePlanId: string;
|
|
30
|
+
checkInDate: string;
|
|
31
|
+
checkOutDate: string;
|
|
32
|
+
roomUnitId?: string | null | undefined;
|
|
33
|
+
nightCount?: number | undefined;
|
|
34
|
+
roomCount?: number | undefined;
|
|
35
|
+
adults?: number | undefined;
|
|
36
|
+
children?: number | undefined;
|
|
37
|
+
infants?: number | undefined;
|
|
38
|
+
mealPlanId?: string | null | undefined;
|
|
39
|
+
confirmationCode?: string | null | undefined;
|
|
40
|
+
voucherCode?: string | null | undefined;
|
|
41
|
+
status?: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show" | undefined;
|
|
42
|
+
notes?: string | null | undefined;
|
|
43
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
44
|
+
}, unknown>;
|
|
45
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
46
|
+
id: string;
|
|
47
|
+
bookingItemId: string;
|
|
48
|
+
propertyId: string;
|
|
49
|
+
roomTypeId: string;
|
|
50
|
+
roomUnitId: string | null;
|
|
51
|
+
ratePlanId: string;
|
|
52
|
+
mealPlanId: string | null;
|
|
53
|
+
checkInDate: string;
|
|
54
|
+
checkOutDate: string;
|
|
55
|
+
nightCount: number;
|
|
56
|
+
roomCount: number;
|
|
57
|
+
adults: number;
|
|
58
|
+
children: number;
|
|
59
|
+
infants: number;
|
|
60
|
+
confirmationCode: string | null;
|
|
61
|
+
voucherCode: string | null;
|
|
62
|
+
status: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show";
|
|
63
|
+
notes: string | null;
|
|
64
|
+
}, Error, {
|
|
65
|
+
id: string;
|
|
66
|
+
input: UpdateStayBookingItemInput;
|
|
67
|
+
}, unknown>;
|
|
68
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
69
|
+
success: boolean;
|
|
70
|
+
}, Error, string, unknown>;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=use-stay-booking-item-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-booking-item-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-booking-item-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AACpF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAEpF,wBAAgB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBE,MAAM;eAAS,0BAA0B;;;;;EA8BpF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
5
|
+
import { hospitalityQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { stayBookingItemSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useStayBookingItemMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/stay-booking-items", stayBookingItemSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayBookingItems() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayBookingItem(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/stay-booking-items/${id}`, stayBookingItemSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayBookingItems() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayBookingItem(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/stay-booking-items/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayBookingItems() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.stayBookingItem(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface UseStayBookingItemsOptions {
|
|
2
|
+
propertyId?: string | null | undefined;
|
|
3
|
+
bookingItemId?: string | undefined;
|
|
4
|
+
roomTypeId?: string | undefined;
|
|
5
|
+
roomUnitId?: string | undefined;
|
|
6
|
+
ratePlanId?: string | undefined;
|
|
7
|
+
status?: string | undefined;
|
|
8
|
+
dateFrom?: string | undefined;
|
|
9
|
+
dateTo?: string | undefined;
|
|
10
|
+
limit?: number | undefined;
|
|
11
|
+
offset?: number | undefined;
|
|
12
|
+
enabled?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function useStayBookingItems(options: UseStayBookingItemsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
15
|
+
data: {
|
|
16
|
+
id: string;
|
|
17
|
+
bookingItemId: string;
|
|
18
|
+
propertyId: string;
|
|
19
|
+
roomTypeId: string;
|
|
20
|
+
roomUnitId: string | null;
|
|
21
|
+
ratePlanId: string;
|
|
22
|
+
mealPlanId: string | null;
|
|
23
|
+
checkInDate: string;
|
|
24
|
+
checkOutDate: string;
|
|
25
|
+
nightCount: number;
|
|
26
|
+
roomCount: number;
|
|
27
|
+
adults: number;
|
|
28
|
+
children: number;
|
|
29
|
+
infants: number;
|
|
30
|
+
confirmationCode: string | null;
|
|
31
|
+
voucherCode: string | null;
|
|
32
|
+
status: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show";
|
|
33
|
+
notes: string | null;
|
|
34
|
+
}[];
|
|
35
|
+
total: number;
|
|
36
|
+
limit: number;
|
|
37
|
+
offset: number;
|
|
38
|
+
}, Error>;
|
|
39
|
+
//# sourceMappingURL=use-stay-booking-items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-booking-items.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-booking-items.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACtC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;UAOtE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getStayBookingItemsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useStayBookingItems(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getStayBookingItemsQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { insertStayFolioSchema, updateStayFolioSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateStayFolioInput = z.input<typeof insertStayFolioSchema>;
|
|
4
|
+
export type UpdateStayFolioInput = z.input<typeof updateStayFolioSchema>;
|
|
5
|
+
export declare function useStayFolioMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
id: string;
|
|
8
|
+
stayOperationId: string;
|
|
9
|
+
currencyCode: string;
|
|
10
|
+
status: "open" | "closed" | "transferred" | "void";
|
|
11
|
+
openedAt: string | null;
|
|
12
|
+
closedAt: string | null;
|
|
13
|
+
notes: string | null;
|
|
14
|
+
}, Error, {
|
|
15
|
+
stayOperationId: string;
|
|
16
|
+
currencyCode: string;
|
|
17
|
+
status?: "open" | "closed" | "transferred" | "void" | undefined;
|
|
18
|
+
openedAt?: string | null | undefined;
|
|
19
|
+
closedAt?: string | null | undefined;
|
|
20
|
+
notes?: string | null | undefined;
|
|
21
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
22
|
+
}, unknown>;
|
|
23
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
24
|
+
id: string;
|
|
25
|
+
stayOperationId: string;
|
|
26
|
+
currencyCode: string;
|
|
27
|
+
status: "open" | "closed" | "transferred" | "void";
|
|
28
|
+
openedAt: string | null;
|
|
29
|
+
closedAt: string | null;
|
|
30
|
+
notes: string | null;
|
|
31
|
+
}, Error, {
|
|
32
|
+
id: string;
|
|
33
|
+
input: UpdateStayFolioInput;
|
|
34
|
+
}, unknown>;
|
|
35
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
}, Error, string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=use-stay-folio-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-folio-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-folio-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACzF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACxE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAExE,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBQ,MAAM;eAAS,oBAAoB;;;;;EA8B9E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
5
|
+
import { hospitalityQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { stayFolioSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useStayFolioMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/stay-folios", stayFolioSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayFolios() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayFolio(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/stay-folios/${id}`, stayFolioSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayFolios() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayFolio(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/stay-folios/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayFolios() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.stayFolio(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface UseStayFoliosOptions {
|
|
2
|
+
stayOperationId?: string | undefined;
|
|
3
|
+
status?: string | undefined;
|
|
4
|
+
limit?: number | undefined;
|
|
5
|
+
offset?: number | undefined;
|
|
6
|
+
enabled?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function useStayFolios(options: UseStayFoliosOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
9
|
+
data: {
|
|
10
|
+
id: string;
|
|
11
|
+
stayOperationId: string;
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
status: "open" | "closed" | "transferred" | "void";
|
|
14
|
+
openedAt: string | null;
|
|
15
|
+
closedAt: string | null;
|
|
16
|
+
notes: string | null;
|
|
17
|
+
}[];
|
|
18
|
+
total: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
offset: number;
|
|
21
|
+
}, Error>;
|
|
22
|
+
//# sourceMappingURL=use-stay-folios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-folios.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-folios.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB;;;;;;;;;;;;;UAO1D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getStayFoliosQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useStayFolios(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getStayFoliosQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { insertStayOperationSchema, updateStayOperationSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateStayOperationInput = z.input<typeof insertStayOperationSchema>;
|
|
4
|
+
export type UpdateStayOperationInput = z.input<typeof updateStayOperationSchema>;
|
|
5
|
+
export declare function useStayOperationMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
id: string;
|
|
8
|
+
stayBookingItemId: string;
|
|
9
|
+
propertyId: string;
|
|
10
|
+
roomUnitId: string | null;
|
|
11
|
+
operationStatus: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show" | "expected_arrival";
|
|
12
|
+
expectedArrivalAt: string | null;
|
|
13
|
+
expectedDepartureAt: string | null;
|
|
14
|
+
checkedInAt: string | null;
|
|
15
|
+
checkedOutAt: string | null;
|
|
16
|
+
noShowRecordedAt: string | null;
|
|
17
|
+
notes: string | null;
|
|
18
|
+
}, Error, {
|
|
19
|
+
stayBookingItemId: string;
|
|
20
|
+
propertyId: string;
|
|
21
|
+
roomUnitId?: string | null | undefined;
|
|
22
|
+
operationStatus?: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show" | "expected_arrival" | undefined;
|
|
23
|
+
expectedArrivalAt?: string | null | undefined;
|
|
24
|
+
expectedDepartureAt?: string | null | undefined;
|
|
25
|
+
checkedInAt?: string | null | undefined;
|
|
26
|
+
checkedOutAt?: string | null | undefined;
|
|
27
|
+
noShowRecordedAt?: string | null | undefined;
|
|
28
|
+
notes?: string | null | undefined;
|
|
29
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
30
|
+
}, unknown>;
|
|
31
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
id: string;
|
|
33
|
+
stayBookingItemId: string;
|
|
34
|
+
propertyId: string;
|
|
35
|
+
roomUnitId: string | null;
|
|
36
|
+
operationStatus: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show" | "expected_arrival";
|
|
37
|
+
expectedArrivalAt: string | null;
|
|
38
|
+
expectedDepartureAt: string | null;
|
|
39
|
+
checkedInAt: string | null;
|
|
40
|
+
checkedOutAt: string | null;
|
|
41
|
+
noShowRecordedAt: string | null;
|
|
42
|
+
notes: string | null;
|
|
43
|
+
}, Error, {
|
|
44
|
+
id: string;
|
|
45
|
+
input: UpdateStayOperationInput;
|
|
46
|
+
}, unknown>;
|
|
47
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
48
|
+
success: boolean;
|
|
49
|
+
}, Error, string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=use-stay-operation-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-operation-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-operation-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACjG,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAChF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEhF,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBI,MAAM;eAAS,wBAAwB;;;;;EA8BlF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
5
|
+
import { hospitalityQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { stayOperationSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useStayOperationMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/stay-operations", stayOperationSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayOperations() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayOperation(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/stay-operations/${id}`, stayOperationSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayOperations() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayOperation(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/stay-operations/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayOperations() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.stayOperation(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface UseStayOperationsOptions {
|
|
2
|
+
propertyId?: string | null | undefined;
|
|
3
|
+
stayBookingItemId?: string | undefined;
|
|
4
|
+
roomUnitId?: string | undefined;
|
|
5
|
+
operationStatus?: string | undefined;
|
|
6
|
+
limit?: number | undefined;
|
|
7
|
+
offset?: number | undefined;
|
|
8
|
+
enabled?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function useStayOperations(options: UseStayOperationsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
11
|
+
data: {
|
|
12
|
+
id: string;
|
|
13
|
+
stayBookingItemId: string;
|
|
14
|
+
propertyId: string;
|
|
15
|
+
roomUnitId: string | null;
|
|
16
|
+
operationStatus: "cancelled" | "reserved" | "checked_in" | "checked_out" | "no_show" | "expected_arrival";
|
|
17
|
+
expectedArrivalAt: string | null;
|
|
18
|
+
expectedDepartureAt: string | null;
|
|
19
|
+
checkedInAt: string | null;
|
|
20
|
+
checkedOutAt: string | null;
|
|
21
|
+
noShowRecordedAt: string | null;
|
|
22
|
+
notes: string | null;
|
|
23
|
+
}[];
|
|
24
|
+
total: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
}, Error>;
|
|
28
|
+
//# sourceMappingURL=use-stay-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-operations.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-operations.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACtC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB;;;;;;;;;;;;;;;;;UAOlE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getStayOperationsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useStayOperations(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getStayOperationsQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { insertStayRuleSchema, updateStayRuleSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateStayRuleInput = z.input<typeof insertStayRuleSchema>;
|
|
4
|
+
export type UpdateStayRuleInput = z.input<typeof updateStayRuleSchema>;
|
|
5
|
+
export declare function useStayRuleMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
propertyId: string;
|
|
8
|
+
closedToArrival: boolean;
|
|
9
|
+
closedToDeparture: boolean;
|
|
10
|
+
id: string;
|
|
11
|
+
ratePlanId: string | null;
|
|
12
|
+
roomTypeId: string | null;
|
|
13
|
+
validFrom: string | null;
|
|
14
|
+
validTo: string | null;
|
|
15
|
+
minNights: number | null;
|
|
16
|
+
maxNights: number | null;
|
|
17
|
+
minAdvanceDays: number | null;
|
|
18
|
+
maxAdvanceDays: number | null;
|
|
19
|
+
releaseDays: number | null;
|
|
20
|
+
arrivalWeekdays: string[] | null;
|
|
21
|
+
departureWeekdays: string[] | null;
|
|
22
|
+
notes: string | null;
|
|
23
|
+
active: boolean;
|
|
24
|
+
priority: number;
|
|
25
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
26
|
+
}, Error, {
|
|
27
|
+
propertyId: string;
|
|
28
|
+
ratePlanId?: string | null | undefined;
|
|
29
|
+
roomTypeId?: string | null | undefined;
|
|
30
|
+
validFrom?: string | null | undefined;
|
|
31
|
+
validTo?: string | null | undefined;
|
|
32
|
+
minNights?: number | null | undefined;
|
|
33
|
+
maxNights?: number | null | undefined;
|
|
34
|
+
minAdvanceDays?: number | null | undefined;
|
|
35
|
+
maxAdvanceDays?: number | null | undefined;
|
|
36
|
+
closedToArrival?: boolean | undefined;
|
|
37
|
+
closedToDeparture?: boolean | undefined;
|
|
38
|
+
arrivalWeekdays?: string[] | null | undefined;
|
|
39
|
+
departureWeekdays?: string[] | null | undefined;
|
|
40
|
+
releaseDays?: number | null | undefined;
|
|
41
|
+
active?: boolean | undefined;
|
|
42
|
+
priority?: number | undefined;
|
|
43
|
+
notes?: string | null | undefined;
|
|
44
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
45
|
+
}, unknown>;
|
|
46
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
47
|
+
propertyId: string;
|
|
48
|
+
closedToArrival: boolean;
|
|
49
|
+
closedToDeparture: boolean;
|
|
50
|
+
id: string;
|
|
51
|
+
ratePlanId: string | null;
|
|
52
|
+
roomTypeId: string | null;
|
|
53
|
+
validFrom: string | null;
|
|
54
|
+
validTo: string | null;
|
|
55
|
+
minNights: number | null;
|
|
56
|
+
maxNights: number | null;
|
|
57
|
+
minAdvanceDays: number | null;
|
|
58
|
+
maxAdvanceDays: number | null;
|
|
59
|
+
releaseDays: number | null;
|
|
60
|
+
arrivalWeekdays: string[] | null;
|
|
61
|
+
departureWeekdays: string[] | null;
|
|
62
|
+
notes: string | null;
|
|
63
|
+
active: boolean;
|
|
64
|
+
priority: number;
|
|
65
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
66
|
+
}, Error, {
|
|
67
|
+
id: string;
|
|
68
|
+
input: UpdateStayRuleInput;
|
|
69
|
+
}, unknown>;
|
|
70
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
71
|
+
success: boolean;
|
|
72
|
+
}, Error, string, unknown>;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=use-stay-rule-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-rule-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-rule-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACvF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACtE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEtE,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBS,MAAM;eAAS,mBAAmB;;;;;EA8B7E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
5
|
+
import { hospitalityQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { stayRuleSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useStayRuleMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/stay-rules", stayRuleSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayRules() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayRule(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/stay-rules/${id}`, stayRuleSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayRules() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.stayRule(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/stay-rules/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.stayRules() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.stayRule(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface UseStayRulesOptions {
|
|
2
|
+
propertyId: string | null | undefined;
|
|
3
|
+
limit?: number | undefined;
|
|
4
|
+
offset?: number | undefined;
|
|
5
|
+
enabled?: boolean | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function useStayRules(options: UseStayRulesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
8
|
+
data: {
|
|
9
|
+
propertyId: string;
|
|
10
|
+
closedToArrival: boolean;
|
|
11
|
+
closedToDeparture: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
ratePlanId: string | null;
|
|
14
|
+
roomTypeId: string | null;
|
|
15
|
+
validFrom: string | null;
|
|
16
|
+
validTo: string | null;
|
|
17
|
+
minNights: number | null;
|
|
18
|
+
maxNights: number | null;
|
|
19
|
+
minAdvanceDays: number | null;
|
|
20
|
+
maxAdvanceDays: number | null;
|
|
21
|
+
releaseDays: number | null;
|
|
22
|
+
arrivalWeekdays: string[] | null;
|
|
23
|
+
departureWeekdays: string[] | null;
|
|
24
|
+
notes: string | null;
|
|
25
|
+
active: boolean;
|
|
26
|
+
priority: number;
|
|
27
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
total: number;
|
|
30
|
+
limit: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
}, Error>;
|
|
33
|
+
//# sourceMappingURL=use-stay-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stay-rules.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stay-rules.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;UAOxD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getStayRulesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useStayRules(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getStayRulesQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true) && Boolean(options.propertyId),
|
|
10
|
+
});
|
|
11
|
+
}
|