@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
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
13
|
+
export declare function fetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: FetchWithValidationOptions, init?: RequestInit): Promise<TOut>;
|
|
14
|
+
//# 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;AAaD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;CACvB;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,CAgCf"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
function extractErrorMessage(status, statusText, body) {
|
|
13
|
+
if (typeof body === "object" && body !== null && "error" in body) {
|
|
14
|
+
const err = body.error;
|
|
15
|
+
if (typeof err === "string")
|
|
16
|
+
return err;
|
|
17
|
+
if (typeof err === "object" && err !== null && "message" in err) {
|
|
18
|
+
return String(err.message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return `Voyant API error: ${status} ${statusText}`;
|
|
22
|
+
}
|
|
23
|
+
export async function fetchWithValidation(path, schema, options, init) {
|
|
24
|
+
const url = joinUrl(options.baseUrl, path);
|
|
25
|
+
const headers = new Headers(init?.headers);
|
|
26
|
+
if (init?.body !== undefined && !headers.has("Content-Type")) {
|
|
27
|
+
headers.set("Content-Type", "application/json");
|
|
28
|
+
}
|
|
29
|
+
const response = await options.fetcher(url, { ...init, headers });
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const body = await safeJson(response);
|
|
32
|
+
throw new VoyantApiError(extractErrorMessage(response.status, response.statusText, body), response.status, body);
|
|
33
|
+
}
|
|
34
|
+
if (response.status === 204) {
|
|
35
|
+
return schema.parse(undefined);
|
|
36
|
+
}
|
|
37
|
+
const body = await safeJson(response);
|
|
38
|
+
const parsed = schema.safeParse(body);
|
|
39
|
+
if (!parsed.success) {
|
|
40
|
+
throw new VoyantApiError(`Voyant API response failed validation: ${parsed.error.message}`, response.status, body);
|
|
41
|
+
}
|
|
42
|
+
return parsed.data;
|
|
43
|
+
}
|
|
44
|
+
async function safeJson(response) {
|
|
45
|
+
const text = await response.text();
|
|
46
|
+
if (!text)
|
|
47
|
+
return undefined;
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(text);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return text;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function joinUrl(baseUrl, path) {
|
|
56
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
57
|
+
const trimmedPath = path.startsWith("/") ? path : `/${path}`;
|
|
58
|
+
return `${trimmedBase}${trimmedPath}`;
|
|
59
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from "./use-housekeeping-task-mutation.js";
|
|
2
|
+
export * from "./use-housekeeping-tasks.js";
|
|
3
|
+
export * from "./use-maintenance-block-mutation.js";
|
|
4
|
+
export * from "./use-maintenance-blocks.js";
|
|
5
|
+
export * from "./use-meal-plan.js";
|
|
6
|
+
export * from "./use-meal-plan-mutation.js";
|
|
7
|
+
export * from "./use-meal-plans.js";
|
|
8
|
+
export * from "./use-rate-plan.js";
|
|
9
|
+
export * from "./use-rate-plan-inventory-override-mutation.js";
|
|
10
|
+
export * from "./use-rate-plan-inventory-overrides.js";
|
|
11
|
+
export * from "./use-rate-plan-mutation.js";
|
|
12
|
+
export * from "./use-rate-plan-room-type-mutation.js";
|
|
13
|
+
export * from "./use-rate-plan-room-types.js";
|
|
14
|
+
export * from "./use-rate-plans.js";
|
|
15
|
+
export * from "./use-room-block-mutation.js";
|
|
16
|
+
export * from "./use-room-blocks.js";
|
|
17
|
+
export * from "./use-room-inventory.js";
|
|
18
|
+
export * from "./use-room-inventory-mutation.js";
|
|
19
|
+
export * from "./use-room-type.js";
|
|
20
|
+
export * from "./use-room-type-mutation.js";
|
|
21
|
+
export * from "./use-room-type-rate-mutation.js";
|
|
22
|
+
export * from "./use-room-type-rates.js";
|
|
23
|
+
export * from "./use-room-types.js";
|
|
24
|
+
export * from "./use-room-unit.js";
|
|
25
|
+
export * from "./use-room-unit-mutation.js";
|
|
26
|
+
export * from "./use-room-units.js";
|
|
27
|
+
export * from "./use-stay-booking-item-mutation.js";
|
|
28
|
+
export * from "./use-stay-booking-items.js";
|
|
29
|
+
export * from "./use-stay-folio-mutation.js";
|
|
30
|
+
export * from "./use-stay-folios.js";
|
|
31
|
+
export * from "./use-stay-operation-mutation.js";
|
|
32
|
+
export * from "./use-stay-operations.js";
|
|
33
|
+
export * from "./use-stay-rule-mutation.js";
|
|
34
|
+
export * from "./use-stay-rules.js";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gDAAgD,CAAA;AAC9D,cAAc,wCAAwC,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uCAAuC,CAAA;AACrD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./use-housekeeping-task-mutation.js";
|
|
2
|
+
export * from "./use-housekeeping-tasks.js";
|
|
3
|
+
export * from "./use-maintenance-block-mutation.js";
|
|
4
|
+
export * from "./use-maintenance-blocks.js";
|
|
5
|
+
export * from "./use-meal-plan.js";
|
|
6
|
+
export * from "./use-meal-plan-mutation.js";
|
|
7
|
+
export * from "./use-meal-plans.js";
|
|
8
|
+
export * from "./use-rate-plan.js";
|
|
9
|
+
export * from "./use-rate-plan-inventory-override-mutation.js";
|
|
10
|
+
export * from "./use-rate-plan-inventory-overrides.js";
|
|
11
|
+
export * from "./use-rate-plan-mutation.js";
|
|
12
|
+
export * from "./use-rate-plan-room-type-mutation.js";
|
|
13
|
+
export * from "./use-rate-plan-room-types.js";
|
|
14
|
+
export * from "./use-rate-plans.js";
|
|
15
|
+
export * from "./use-room-block-mutation.js";
|
|
16
|
+
export * from "./use-room-blocks.js";
|
|
17
|
+
export * from "./use-room-inventory.js";
|
|
18
|
+
export * from "./use-room-inventory-mutation.js";
|
|
19
|
+
export * from "./use-room-type.js";
|
|
20
|
+
export * from "./use-room-type-mutation.js";
|
|
21
|
+
export * from "./use-room-type-rate-mutation.js";
|
|
22
|
+
export * from "./use-room-type-rates.js";
|
|
23
|
+
export * from "./use-room-types.js";
|
|
24
|
+
export * from "./use-room-unit.js";
|
|
25
|
+
export * from "./use-room-unit-mutation.js";
|
|
26
|
+
export * from "./use-room-units.js";
|
|
27
|
+
export * from "./use-stay-booking-item-mutation.js";
|
|
28
|
+
export * from "./use-stay-booking-items.js";
|
|
29
|
+
export * from "./use-stay-folio-mutation.js";
|
|
30
|
+
export * from "./use-stay-folios.js";
|
|
31
|
+
export * from "./use-stay-operation-mutation.js";
|
|
32
|
+
export * from "./use-stay-operations.js";
|
|
33
|
+
export * from "./use-stay-rule-mutation.js";
|
|
34
|
+
export * from "./use-stay-rules.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { insertHousekeepingTaskSchema, updateHousekeepingTaskSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateHousekeepingTaskInput = z.input<typeof insertHousekeepingTaskSchema>;
|
|
4
|
+
export type UpdateHousekeepingTaskInput = z.input<typeof updateHousekeepingTaskSchema>;
|
|
5
|
+
export declare function useHousekeepingTaskMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
id: string;
|
|
8
|
+
propertyId: string;
|
|
9
|
+
roomUnitId: string;
|
|
10
|
+
stayBookingItemId: string | null;
|
|
11
|
+
taskType: string;
|
|
12
|
+
status: "in_progress" | "completed" | "cancelled" | "open";
|
|
13
|
+
priority: number;
|
|
14
|
+
dueAt: string | null;
|
|
15
|
+
startedAt: string | null;
|
|
16
|
+
completedAt: string | null;
|
|
17
|
+
assignedTo: string | null;
|
|
18
|
+
notes: string | null;
|
|
19
|
+
}, Error, {
|
|
20
|
+
propertyId: string;
|
|
21
|
+
roomUnitId: string;
|
|
22
|
+
taskType: string;
|
|
23
|
+
stayBookingItemId?: string | null | undefined;
|
|
24
|
+
status?: "in_progress" | "completed" | "cancelled" | "open" | undefined;
|
|
25
|
+
priority?: number | undefined;
|
|
26
|
+
dueAt?: string | null | undefined;
|
|
27
|
+
startedAt?: string | null | undefined;
|
|
28
|
+
completedAt?: string | null | undefined;
|
|
29
|
+
assignedTo?: string | null | undefined;
|
|
30
|
+
notes?: string | null | undefined;
|
|
31
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
32
|
+
}, unknown>;
|
|
33
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
34
|
+
id: string;
|
|
35
|
+
propertyId: string;
|
|
36
|
+
roomUnitId: string;
|
|
37
|
+
stayBookingItemId: string | null;
|
|
38
|
+
taskType: string;
|
|
39
|
+
status: "in_progress" | "completed" | "cancelled" | "open";
|
|
40
|
+
priority: number;
|
|
41
|
+
dueAt: string | null;
|
|
42
|
+
startedAt: string | null;
|
|
43
|
+
completedAt: string | null;
|
|
44
|
+
assignedTo: string | null;
|
|
45
|
+
notes: string | null;
|
|
46
|
+
}, Error, {
|
|
47
|
+
id: string;
|
|
48
|
+
input: UpdateHousekeepingTaskInput;
|
|
49
|
+
}, unknown>;
|
|
50
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
}, Error, string, unknown>;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=use-housekeeping-task-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-housekeeping-task-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-housekeeping-task-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACtF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEtF,wBAAgB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBC,MAAM;eAAS,2BAA2B;;;;;EA8BrF"}
|
|
@@ -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 { housekeepingTaskSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useHousekeepingTaskMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/housekeeping-tasks", housekeepingTaskSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.housekeepingTasks() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.housekeepingTask(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/housekeeping-tasks/${id}`, housekeepingTaskSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.housekeepingTasks() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.housekeepingTask(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/housekeeping-tasks/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.housekeepingTasks() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.housekeepingTask(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseHousekeepingTasksOptions {
|
|
2
|
+
propertyId?: string | null | undefined;
|
|
3
|
+
roomUnitId?: string | undefined;
|
|
4
|
+
stayBookingItemId?: string | undefined;
|
|
5
|
+
status?: string | undefined;
|
|
6
|
+
taskType?: string | undefined;
|
|
7
|
+
limit?: number | undefined;
|
|
8
|
+
offset?: number | undefined;
|
|
9
|
+
enabled?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function useHousekeepingTasks(options: UseHousekeepingTasksOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
12
|
+
data: {
|
|
13
|
+
id: string;
|
|
14
|
+
propertyId: string;
|
|
15
|
+
roomUnitId: string;
|
|
16
|
+
stayBookingItemId: string | null;
|
|
17
|
+
taskType: string;
|
|
18
|
+
status: "in_progress" | "completed" | "cancelled" | "open";
|
|
19
|
+
priority: number;
|
|
20
|
+
dueAt: string | null;
|
|
21
|
+
startedAt: string | null;
|
|
22
|
+
completedAt: string | null;
|
|
23
|
+
assignedTo: string | null;
|
|
24
|
+
notes: string | null;
|
|
25
|
+
}[];
|
|
26
|
+
total: number;
|
|
27
|
+
limit: number;
|
|
28
|
+
offset: number;
|
|
29
|
+
}, Error>;
|
|
30
|
+
//# sourceMappingURL=use-housekeeping-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-housekeeping-tasks.d.ts","sourceRoot":"","sources":["../../src/hooks/use-housekeeping-tasks.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,2BAA2B;IAC1C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,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,oBAAoB,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;UAOxE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getHousekeepingTasksQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useHousekeepingTasks(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getHousekeepingTasksQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { insertMaintenanceBlockSchema, updateMaintenanceBlockSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateMaintenanceBlockInput = z.input<typeof insertMaintenanceBlockSchema>;
|
|
4
|
+
export type UpdateMaintenanceBlockInput = z.input<typeof updateMaintenanceBlockSchema>;
|
|
5
|
+
export declare function useMaintenanceBlockMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
propertyId: string;
|
|
8
|
+
startsOn: string;
|
|
9
|
+
endsOn: string;
|
|
10
|
+
id: string;
|
|
11
|
+
roomTypeId: string | null;
|
|
12
|
+
roomUnitId: string | null;
|
|
13
|
+
status: "in_progress" | "cancelled" | "open" | "resolved";
|
|
14
|
+
reason: string | null;
|
|
15
|
+
notes: string | null;
|
|
16
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
17
|
+
}, Error, {
|
|
18
|
+
propertyId: string;
|
|
19
|
+
startsOn: string;
|
|
20
|
+
endsOn: string;
|
|
21
|
+
roomTypeId?: string | null | undefined;
|
|
22
|
+
roomUnitId?: string | null | undefined;
|
|
23
|
+
status?: "in_progress" | "cancelled" | "open" | "resolved" | undefined;
|
|
24
|
+
reason?: string | null | undefined;
|
|
25
|
+
notes?: string | null | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
27
|
+
}, unknown>;
|
|
28
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
29
|
+
propertyId: string;
|
|
30
|
+
startsOn: string;
|
|
31
|
+
endsOn: string;
|
|
32
|
+
id: string;
|
|
33
|
+
roomTypeId: string | null;
|
|
34
|
+
roomUnitId: string | null;
|
|
35
|
+
status: "in_progress" | "cancelled" | "open" | "resolved";
|
|
36
|
+
reason: string | null;
|
|
37
|
+
notes: string | null;
|
|
38
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
39
|
+
}, Error, {
|
|
40
|
+
id: string;
|
|
41
|
+
input: UpdateMaintenanceBlockInput;
|
|
42
|
+
}, unknown>;
|
|
43
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
}, Error, string, unknown>;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=use-maintenance-block-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-maintenance-block-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-maintenance-block-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACtF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEtF,wBAAgB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBC,MAAM;eAAS,2BAA2B;;;;;EA8BrF"}
|
|
@@ -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 { maintenanceBlockSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useMaintenanceBlockMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/maintenance-blocks", maintenanceBlockSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.maintenanceBlocks() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.maintenanceBlock(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/maintenance-blocks/${id}`, maintenanceBlockSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.maintenanceBlocks() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.maintenanceBlock(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/maintenance-blocks/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.maintenanceBlocks() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.maintenanceBlock(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface UseMaintenanceBlocksOptions {
|
|
2
|
+
propertyId: string | null | undefined;
|
|
3
|
+
limit?: number | undefined;
|
|
4
|
+
offset?: number | undefined;
|
|
5
|
+
enabled?: boolean | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function useMaintenanceBlocks(options: UseMaintenanceBlocksOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
8
|
+
data: {
|
|
9
|
+
propertyId: string;
|
|
10
|
+
startsOn: string;
|
|
11
|
+
endsOn: string;
|
|
12
|
+
id: string;
|
|
13
|
+
roomTypeId: string | null;
|
|
14
|
+
roomUnitId: string | null;
|
|
15
|
+
status: "in_progress" | "cancelled" | "open" | "resolved";
|
|
16
|
+
reason: string | null;
|
|
17
|
+
notes: string | null;
|
|
18
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
19
|
+
}[];
|
|
20
|
+
total: number;
|
|
21
|
+
limit: number;
|
|
22
|
+
offset: number;
|
|
23
|
+
}, Error>;
|
|
24
|
+
//# sourceMappingURL=use-maintenance-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-maintenance-blocks.d.ts","sourceRoot":"","sources":["../../src/hooks/use-maintenance-blocks.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,2BAA2B;IAC1C,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,oBAAoB,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;;;;;;;UAOxE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getMaintenanceBlocksQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useMaintenanceBlocks(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getMaintenanceBlocksQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true) && Boolean(options.propertyId),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { insertMealPlanSchema, updateMealPlanSchema } from "@voyantjs/hospitality";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateMealPlanInput = z.input<typeof insertMealPlanSchema>;
|
|
4
|
+
export type UpdateMealPlanInput = z.input<typeof updateMealPlanSchema>;
|
|
5
|
+
export declare function useMealPlanMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
propertyId: string;
|
|
8
|
+
code: string;
|
|
9
|
+
name: string;
|
|
10
|
+
id: string;
|
|
11
|
+
description: string | null;
|
|
12
|
+
includesBreakfast: boolean;
|
|
13
|
+
includesLunch: boolean;
|
|
14
|
+
includesDinner: boolean;
|
|
15
|
+
includesDrinks: boolean;
|
|
16
|
+
active: boolean;
|
|
17
|
+
sortOrder: number;
|
|
18
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
19
|
+
}, Error, {
|
|
20
|
+
propertyId: string;
|
|
21
|
+
code: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string | null | undefined;
|
|
24
|
+
includesBreakfast?: boolean | undefined;
|
|
25
|
+
includesLunch?: boolean | undefined;
|
|
26
|
+
includesDinner?: boolean | undefined;
|
|
27
|
+
includesDrinks?: boolean | undefined;
|
|
28
|
+
active?: boolean | undefined;
|
|
29
|
+
sortOrder?: number | undefined;
|
|
30
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
31
|
+
}, unknown>;
|
|
32
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
33
|
+
propertyId: string;
|
|
34
|
+
code: string;
|
|
35
|
+
name: string;
|
|
36
|
+
id: string;
|
|
37
|
+
description: string | null;
|
|
38
|
+
includesBreakfast: boolean;
|
|
39
|
+
includesLunch: boolean;
|
|
40
|
+
includesDinner: boolean;
|
|
41
|
+
includesDrinks: boolean;
|
|
42
|
+
active: boolean;
|
|
43
|
+
sortOrder: number;
|
|
44
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
45
|
+
}, Error, {
|
|
46
|
+
id: string;
|
|
47
|
+
input: UpdateMealPlanInput;
|
|
48
|
+
}, unknown>;
|
|
49
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
}, Error, string, unknown>;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=use-meal-plan-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-meal-plan-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-meal-plan-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 { mealPlanSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useMealPlanMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/hospitality/meal-plans", mealPlanSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.mealPlans() });
|
|
17
|
+
queryClient.setQueryData(hospitalityQueryKeys.mealPlan(data.id), { data });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/hospitality/meal-plans/${id}`, mealPlanSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.mealPlans() });
|
|
27
|
+
queryClient.setQueryData(hospitalityQueryKeys.mealPlan(data.id), { data });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/hospitality/meal-plans/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: hospitalityQueryKeys.mealPlans() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: hospitalityQueryKeys.mealPlan(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface UseMealPlanOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useMealPlan(id: string | null | undefined, options?: UseMealPlanOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
propertyId: string;
|
|
6
|
+
code: string;
|
|
7
|
+
name: string;
|
|
8
|
+
id: string;
|
|
9
|
+
description: string | null;
|
|
10
|
+
includesBreakfast: boolean;
|
|
11
|
+
includesLunch: boolean;
|
|
12
|
+
includesDinner: boolean;
|
|
13
|
+
includesDrinks: boolean;
|
|
14
|
+
active: boolean;
|
|
15
|
+
sortOrder: number;
|
|
16
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
17
|
+
}, Error>;
|
|
18
|
+
//# sourceMappingURL=use-meal-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-meal-plan.d.ts","sourceRoot":"","sources":["../../src/hooks/use-meal-plan.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;UAQ1F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantHospitalityContext } from "../provider.js";
|
|
4
|
+
import { getMealPlanQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useMealPlan(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getMealPlanQueryOptions({ baseUrl, fetcher }, id ?? "__missing__"),
|
|
10
|
+
enabled: enabled && Boolean(id),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface UseMealPlansOptions {
|
|
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 useMealPlans(options: UseMealPlansOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
9
|
+
data: {
|
|
10
|
+
propertyId: string;
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
includesBreakfast: boolean;
|
|
16
|
+
includesLunch: boolean;
|
|
17
|
+
includesDinner: boolean;
|
|
18
|
+
includesDrinks: boolean;
|
|
19
|
+
active: boolean;
|
|
20
|
+
sortOrder: number;
|
|
21
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
22
|
+
}[];
|
|
23
|
+
total: number;
|
|
24
|
+
limit: number;
|
|
25
|
+
offset: number;
|
|
26
|
+
}, Error>;
|
|
27
|
+
//# sourceMappingURL=use-meal-plans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-meal-plans.d.ts","sourceRoot":"","sources":["../../src/hooks/use-meal-plans.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 { getMealPlansQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useMealPlans(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantHospitalityContext();
|
|
7
|
+
return useQuery({
|
|
8
|
+
...getMealPlansQueryOptions({ baseUrl, fetcher }, options),
|
|
9
|
+
enabled: Boolean(options.enabled ?? true) && Boolean(options.propertyId),
|
|
10
|
+
});
|
|
11
|
+
}
|