@voyantjs/suppliers-react 0.1.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.
Files changed (56) hide show
  1. package/README.md +35 -0
  2. package/dist/client.d.ts +14 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +59 -0
  5. package/dist/constants.d.ts +69 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +34 -0
  8. package/dist/hooks/index.d.ts +10 -0
  9. package/dist/hooks/index.d.ts.map +1 -0
  10. package/dist/hooks/index.js +10 -0
  11. package/dist/hooks/use-supplier-mutation.d.ts +67 -0
  12. package/dist/hooks/use-supplier-mutation.d.ts.map +1 -0
  13. package/dist/hooks/use-supplier-mutation.js +41 -0
  14. package/dist/hooks/use-supplier-note-mutation.d.ts +13 -0
  15. package/dist/hooks/use-supplier-note-mutation.d.ts.map +1 -0
  16. package/dist/hooks/use-supplier-note-mutation.js +20 -0
  17. package/dist/hooks/use-supplier-notes.d.ts +13 -0
  18. package/dist/hooks/use-supplier-notes.d.ts.map +1 -0
  19. package/dist/hooks/use-supplier-notes.js +12 -0
  20. package/dist/hooks/use-supplier-rate-mutation.d.ts +56 -0
  21. package/dist/hooks/use-supplier-rate-mutation.d.ts.map +1 -0
  22. package/dist/hooks/use-supplier-rate-mutation.js +41 -0
  23. package/dist/hooks/use-supplier-service-mutation.d.ts +45 -0
  24. package/dist/hooks/use-supplier-service-mutation.d.ts.map +1 -0
  25. package/dist/hooks/use-supplier-service-mutation.js +44 -0
  26. package/dist/hooks/use-supplier-service-rates.d.ts +20 -0
  27. package/dist/hooks/use-supplier-service-rates.d.ts.map +1 -0
  28. package/dist/hooks/use-supplier-service-rates.js +12 -0
  29. package/dist/hooks/use-supplier-services.d.ts +19 -0
  30. package/dist/hooks/use-supplier-services.d.ts.map +1 -0
  31. package/dist/hooks/use-supplier-services.js +12 -0
  32. package/dist/hooks/use-supplier.d.ts +26 -0
  33. package/dist/hooks/use-supplier.d.ts.map +1 -0
  34. package/dist/hooks/use-supplier.js +9 -0
  35. package/dist/hooks/use-suppliers.d.ts +30 -0
  36. package/dist/hooks/use-suppliers.d.ts.map +1 -0
  37. package/dist/hooks/use-suppliers.js +9 -0
  38. package/dist/index.d.ts +9 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +8 -0
  41. package/dist/provider.d.ts +2 -0
  42. package/dist/provider.d.ts.map +1 -0
  43. package/dist/provider.js +1 -0
  44. package/dist/query-keys.d.ts +20 -0
  45. package/dist/query-keys.d.ts.map +1 -0
  46. package/dist/query-keys.js +12 -0
  47. package/dist/query-options.d.ts +371 -0
  48. package/dist/query-options.d.ts.map +1 -0
  49. package/dist/query-options.js +49 -0
  50. package/dist/schemas.d.ts +300 -0
  51. package/dist/schemas.d.ts.map +1 -0
  52. package/dist/schemas.js +95 -0
  53. package/dist/utils.d.ts +4 -0
  54. package/dist/utils.d.ts.map +1 -0
  55. package/dist/utils.js +10 -0
  56. package/package.json +79 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-supplier-service-rates.d.ts","sourceRoot":"","sources":["../../src/hooks/use-supplier-service-rates.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;UAQ7C"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantSuppliersContext } from "../provider.js";
4
+ import { getSupplierServiceRatesQueryOptions } from "../query-options.js";
5
+ export function useSupplierServiceRates(supplierId, serviceId, options = {}) {
6
+ const client = useVoyantSuppliersContext();
7
+ const { enabled = true } = options;
8
+ return useQuery({
9
+ ...getSupplierServiceRatesQueryOptions(client, supplierId, serviceId),
10
+ enabled: enabled && !!supplierId && !!serviceId,
11
+ });
12
+ }
@@ -0,0 +1,19 @@
1
+ export interface UseSupplierServicesOptions {
2
+ enabled?: boolean;
3
+ }
4
+ export declare function useSupplierServices(supplierId: string, options?: UseSupplierServicesOptions): import("@tanstack/react-query").UseQueryResult<{
5
+ data: {
6
+ id: string;
7
+ supplierId: string;
8
+ serviceType: "transfer" | "guide" | "experience" | "other" | "accommodation" | "meal";
9
+ name: string;
10
+ description: string | null;
11
+ duration: string | null;
12
+ capacity: number | null;
13
+ active: boolean;
14
+ tags: string[];
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }[];
18
+ }, Error>;
19
+ //# sourceMappingURL=use-supplier-services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-supplier-services.d.ts","sourceRoot":"","sources":["../../src/hooks/use-supplier-services.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;UAO/F"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantSuppliersContext } from "../provider.js";
4
+ import { getSupplierServicesQueryOptions } from "../query-options.js";
5
+ export function useSupplierServices(supplierId, options = {}) {
6
+ const client = useVoyantSuppliersContext();
7
+ const { enabled = true } = options;
8
+ return useQuery({
9
+ ...getSupplierServicesQueryOptions(client, supplierId),
10
+ enabled: enabled && !!supplierId,
11
+ });
12
+ }
@@ -0,0 +1,26 @@
1
+ export interface UseSupplierOptions {
2
+ enabled?: boolean;
3
+ }
4
+ export declare function useSupplier(id: string, options?: UseSupplierOptions): import("@tanstack/react-query").UseQueryResult<{
5
+ data: {
6
+ id: string;
7
+ name: string;
8
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
9
+ status: "active" | "inactive" | "pending";
10
+ description: string | null;
11
+ email: string | null;
12
+ phone: string | null;
13
+ website: string | null;
14
+ address: string | null;
15
+ city: string | null;
16
+ country: string | null;
17
+ defaultCurrency: string | null;
18
+ contactName: string | null;
19
+ contactEmail: string | null;
20
+ contactPhone: string | null;
21
+ tags: string[];
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ };
25
+ }, Error>;
26
+ //# sourceMappingURL=use-supplier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-supplier.d.ts","sourceRoot":"","sources":["../../src/hooks/use-supplier.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;UAIvE"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantSuppliersContext } from "../provider.js";
4
+ import { getSupplierQueryOptions } from "../query-options.js";
5
+ export function useSupplier(id, options = {}) {
6
+ const client = useVoyantSuppliersContext();
7
+ const { enabled = true } = options;
8
+ return useQuery({ ...getSupplierQueryOptions(client, id), enabled: enabled && !!id });
9
+ }
@@ -0,0 +1,30 @@
1
+ import type { SuppliersListFilters } from "../query-keys.js";
2
+ export interface UseSuppliersOptions extends SuppliersListFilters {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function useSuppliers(options?: UseSuppliersOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ data: {
7
+ id: string;
8
+ name: string;
9
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
10
+ status: "active" | "inactive" | "pending";
11
+ description: string | null;
12
+ email: string | null;
13
+ phone: string | null;
14
+ website: string | null;
15
+ address: string | null;
16
+ city: string | null;
17
+ country: string | null;
18
+ defaultCurrency: string | null;
19
+ contactName: string | null;
20
+ contactEmail: string | null;
21
+ contactPhone: string | null;
22
+ tags: string[];
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }[];
26
+ total: number;
27
+ limit: number;
28
+ offset: number;
29
+ }, Error>;
30
+ //# sourceMappingURL=use-suppliers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-suppliers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-suppliers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAG5D,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB;;;;;;;;;;;;;;;;;;;;;;;;UAI7D"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantSuppliersContext } from "../provider.js";
4
+ import { getSuppliersQueryOptions } from "../query-options.js";
5
+ export function useSuppliers(options = {}) {
6
+ const client = useVoyantSuppliersContext();
7
+ const { enabled = true } = options;
8
+ return useQuery({ ...getSuppliersQueryOptions(client, options), enabled });
9
+ }
@@ -0,0 +1,9 @@
1
+ export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher, } from "./client.js";
2
+ export * from "./constants.js";
3
+ export * from "./hooks/index.js";
4
+ export { useVoyantSuppliersContext, type VoyantSuppliersContextValue, VoyantSuppliersProvider, type VoyantSuppliersProviderProps, } from "./provider.js";
5
+ export { suppliersQueryKeys } from "./query-keys.js";
6
+ export { getSupplierNotesQueryOptions, getSupplierQueryOptions, getSupplierServiceRatesQueryOptions, getSupplierServicesQueryOptions, getSuppliersQueryOptions, } from "./query-options.js";
7
+ export * from "./schemas.js";
8
+ export * from "./utils.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,EAChC,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,mCAAmC,EACnC,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { defaultFetcher, fetchWithValidation, VoyantApiError, } from "./client.js";
2
+ export * from "./constants.js";
3
+ export * from "./hooks/index.js";
4
+ export { useVoyantSuppliersContext, VoyantSuppliersProvider, } from "./provider.js";
5
+ export { suppliersQueryKeys } from "./query-keys.js";
6
+ export { getSupplierNotesQueryOptions, getSupplierQueryOptions, getSupplierServiceRatesQueryOptions, getSupplierServicesQueryOptions, getSuppliersQueryOptions, } from "./query-options.js";
7
+ export * from "./schemas.js";
8
+ export * from "./utils.js";
@@ -0,0 +1,2 @@
1
+ export { useVoyantReactContext as useVoyantSuppliersContext, type VoyantReactContextValue as VoyantSuppliersContextValue, VoyantReactProvider as VoyantSuppliersProvider, type VoyantReactProviderProps as VoyantSuppliersProviderProps, } from "@voyantjs/react";
2
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,yBAAyB,EAClD,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,mBAAmB,IAAI,uBAAuB,EAC9C,KAAK,wBAAwB,IAAI,4BAA4B,GAC9D,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1 @@
1
+ export { useVoyantReactContext as useVoyantSuppliersContext, VoyantReactProvider as VoyantSuppliersProvider, } from "@voyantjs/react";
@@ -0,0 +1,20 @@
1
+ export interface PaginationFilters {
2
+ limit?: number | undefined;
3
+ offset?: number | undefined;
4
+ }
5
+ export interface SuppliersListFilters extends PaginationFilters {
6
+ search?: string | undefined;
7
+ }
8
+ export declare const suppliersQueryKeys: {
9
+ readonly all: readonly ["voyant", "suppliers"];
10
+ readonly suppliers: () => readonly ["voyant", "suppliers", "suppliers"];
11
+ readonly suppliersList: (filters: SuppliersListFilters) => readonly ["voyant", "suppliers", "suppliers", "list", SuppliersListFilters];
12
+ readonly supplierDetail: (id: string) => readonly ["voyant", "suppliers", "suppliers", "detail", string];
13
+ readonly services: () => readonly ["voyant", "suppliers", "services"];
14
+ readonly supplierServices: (supplierId: string) => readonly ["voyant", "suppliers", "services", "list", string];
15
+ readonly notes: () => readonly ["voyant", "suppliers", "notes"];
16
+ readonly supplierNotes: (supplierId: string) => readonly ["voyant", "suppliers", "notes", "list", string];
17
+ readonly rates: () => readonly ["voyant", "suppliers", "rates"];
18
+ readonly supplierServiceRates: (supplierId: string, serviceId: string) => readonly ["voyant", "suppliers", "rates", "list", string, string];
19
+ };
20
+ //# sourceMappingURL=query-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,eAAO,MAAM,kBAAkB;;;sCAIJ,oBAAoB;kCAExB,MAAM;;4CAGI,MAAM;;yCAIT,MAAM;;gDAIC,MAAM,aAAa,MAAM;CAEpD,CAAA"}
@@ -0,0 +1,12 @@
1
+ export const suppliersQueryKeys = {
2
+ all: ["voyant", "suppliers"],
3
+ suppliers: () => [...suppliersQueryKeys.all, "suppliers"],
4
+ suppliersList: (filters) => [...suppliersQueryKeys.suppliers(), "list", filters],
5
+ supplierDetail: (id) => [...suppliersQueryKeys.suppliers(), "detail", id],
6
+ services: () => [...suppliersQueryKeys.all, "services"],
7
+ supplierServices: (supplierId) => [...suppliersQueryKeys.services(), "list", supplierId],
8
+ notes: () => [...suppliersQueryKeys.all, "notes"],
9
+ supplierNotes: (supplierId) => [...suppliersQueryKeys.notes(), "list", supplierId],
10
+ rates: () => [...suppliersQueryKeys.all, "rates"],
11
+ supplierServiceRates: (supplierId, serviceId) => [...suppliersQueryKeys.rates(), "list", supplierId, serviceId],
12
+ };
@@ -0,0 +1,371 @@
1
+ import { type FetchWithValidationOptions } from "./client.js";
2
+ import type { UseSuppliersOptions } from "./hooks/use-suppliers.js";
3
+ export declare function getSuppliersQueryOptions(client: FetchWithValidationOptions, options?: UseSuppliersOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
4
+ data: {
5
+ id: string;
6
+ name: string;
7
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
8
+ status: "active" | "inactive" | "pending";
9
+ description: string | null;
10
+ email: string | null;
11
+ phone: string | null;
12
+ website: string | null;
13
+ address: string | null;
14
+ city: string | null;
15
+ country: string | null;
16
+ defaultCurrency: string | null;
17
+ contactName: string | null;
18
+ contactEmail: string | null;
19
+ contactPhone: string | null;
20
+ tags: string[];
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ }[];
24
+ total: number;
25
+ limit: number;
26
+ offset: number;
27
+ }, Error, {
28
+ data: {
29
+ id: string;
30
+ name: string;
31
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
32
+ status: "active" | "inactive" | "pending";
33
+ description: string | null;
34
+ email: string | null;
35
+ phone: string | null;
36
+ website: string | null;
37
+ address: string | null;
38
+ city: string | null;
39
+ country: string | null;
40
+ defaultCurrency: string | null;
41
+ contactName: string | null;
42
+ contactEmail: string | null;
43
+ contactPhone: string | null;
44
+ tags: string[];
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ }[];
48
+ total: number;
49
+ limit: number;
50
+ offset: number;
51
+ }, readonly ["voyant", "suppliers", "suppliers", "list", import("./query-keys.js").SuppliersListFilters]>, "queryFn"> & {
52
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
53
+ data: {
54
+ id: string;
55
+ name: string;
56
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
57
+ status: "active" | "inactive" | "pending";
58
+ description: string | null;
59
+ email: string | null;
60
+ phone: string | null;
61
+ website: string | null;
62
+ address: string | null;
63
+ city: string | null;
64
+ country: string | null;
65
+ defaultCurrency: string | null;
66
+ contactName: string | null;
67
+ contactEmail: string | null;
68
+ contactPhone: string | null;
69
+ tags: string[];
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ }[];
73
+ total: number;
74
+ limit: number;
75
+ offset: number;
76
+ }, readonly ["voyant", "suppliers", "suppliers", "list", import("./query-keys.js").SuppliersListFilters], never> | undefined;
77
+ } & {
78
+ queryKey: readonly ["voyant", "suppliers", "suppliers", "list", import("./query-keys.js").SuppliersListFilters] & {
79
+ [dataTagSymbol]: {
80
+ data: {
81
+ id: string;
82
+ name: string;
83
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
84
+ status: "active" | "inactive" | "pending";
85
+ description: string | null;
86
+ email: string | null;
87
+ phone: string | null;
88
+ website: string | null;
89
+ address: string | null;
90
+ city: string | null;
91
+ country: string | null;
92
+ defaultCurrency: string | null;
93
+ contactName: string | null;
94
+ contactEmail: string | null;
95
+ contactPhone: string | null;
96
+ tags: string[];
97
+ createdAt: string;
98
+ updatedAt: string;
99
+ }[];
100
+ total: number;
101
+ limit: number;
102
+ offset: number;
103
+ };
104
+ [dataTagErrorSymbol]: Error;
105
+ };
106
+ };
107
+ export declare function getSupplierQueryOptions(client: FetchWithValidationOptions, id: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
108
+ data: {
109
+ id: string;
110
+ name: string;
111
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
112
+ status: "active" | "inactive" | "pending";
113
+ description: string | null;
114
+ email: string | null;
115
+ phone: string | null;
116
+ website: string | null;
117
+ address: string | null;
118
+ city: string | null;
119
+ country: string | null;
120
+ defaultCurrency: string | null;
121
+ contactName: string | null;
122
+ contactEmail: string | null;
123
+ contactPhone: string | null;
124
+ tags: string[];
125
+ createdAt: string;
126
+ updatedAt: string;
127
+ };
128
+ }, Error, {
129
+ data: {
130
+ id: string;
131
+ name: string;
132
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
133
+ status: "active" | "inactive" | "pending";
134
+ description: string | null;
135
+ email: string | null;
136
+ phone: string | null;
137
+ website: string | null;
138
+ address: string | null;
139
+ city: string | null;
140
+ country: string | null;
141
+ defaultCurrency: string | null;
142
+ contactName: string | null;
143
+ contactEmail: string | null;
144
+ contactPhone: string | null;
145
+ tags: string[];
146
+ createdAt: string;
147
+ updatedAt: string;
148
+ };
149
+ }, readonly ["voyant", "suppliers", "suppliers", "detail", string]>, "queryFn"> & {
150
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
151
+ data: {
152
+ id: string;
153
+ name: string;
154
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
155
+ status: "active" | "inactive" | "pending";
156
+ description: string | null;
157
+ email: string | null;
158
+ phone: string | null;
159
+ website: string | null;
160
+ address: string | null;
161
+ city: string | null;
162
+ country: string | null;
163
+ defaultCurrency: string | null;
164
+ contactName: string | null;
165
+ contactEmail: string | null;
166
+ contactPhone: string | null;
167
+ tags: string[];
168
+ createdAt: string;
169
+ updatedAt: string;
170
+ };
171
+ }, readonly ["voyant", "suppliers", "suppliers", "detail", string], never> | undefined;
172
+ } & {
173
+ queryKey: readonly ["voyant", "suppliers", "suppliers", "detail", string] & {
174
+ [dataTagSymbol]: {
175
+ data: {
176
+ id: string;
177
+ name: string;
178
+ type: "hotel" | "transfer" | "guide" | "experience" | "airline" | "restaurant" | "other";
179
+ status: "active" | "inactive" | "pending";
180
+ description: string | null;
181
+ email: string | null;
182
+ phone: string | null;
183
+ website: string | null;
184
+ address: string | null;
185
+ city: string | null;
186
+ country: string | null;
187
+ defaultCurrency: string | null;
188
+ contactName: string | null;
189
+ contactEmail: string | null;
190
+ contactPhone: string | null;
191
+ tags: string[];
192
+ createdAt: string;
193
+ updatedAt: string;
194
+ };
195
+ };
196
+ [dataTagErrorSymbol]: Error;
197
+ };
198
+ };
199
+ export declare function getSupplierServicesQueryOptions(client: FetchWithValidationOptions, supplierId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
200
+ data: {
201
+ id: string;
202
+ supplierId: string;
203
+ serviceType: "transfer" | "guide" | "experience" | "other" | "accommodation" | "meal";
204
+ name: string;
205
+ description: string | null;
206
+ duration: string | null;
207
+ capacity: number | null;
208
+ active: boolean;
209
+ tags: string[];
210
+ createdAt: string;
211
+ updatedAt: string;
212
+ }[];
213
+ }, Error, {
214
+ data: {
215
+ id: string;
216
+ supplierId: string;
217
+ serviceType: "transfer" | "guide" | "experience" | "other" | "accommodation" | "meal";
218
+ name: string;
219
+ description: string | null;
220
+ duration: string | null;
221
+ capacity: number | null;
222
+ active: boolean;
223
+ tags: string[];
224
+ createdAt: string;
225
+ updatedAt: string;
226
+ }[];
227
+ }, readonly ["voyant", "suppliers", "services", "list", string]>, "queryFn"> & {
228
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
229
+ data: {
230
+ id: string;
231
+ supplierId: string;
232
+ serviceType: "transfer" | "guide" | "experience" | "other" | "accommodation" | "meal";
233
+ name: string;
234
+ description: string | null;
235
+ duration: string | null;
236
+ capacity: number | null;
237
+ active: boolean;
238
+ tags: string[];
239
+ createdAt: string;
240
+ updatedAt: string;
241
+ }[];
242
+ }, readonly ["voyant", "suppliers", "services", "list", string], never> | undefined;
243
+ } & {
244
+ queryKey: readonly ["voyant", "suppliers", "services", "list", string] & {
245
+ [dataTagSymbol]: {
246
+ data: {
247
+ id: string;
248
+ supplierId: string;
249
+ serviceType: "transfer" | "guide" | "experience" | "other" | "accommodation" | "meal";
250
+ name: string;
251
+ description: string | null;
252
+ duration: string | null;
253
+ capacity: number | null;
254
+ active: boolean;
255
+ tags: string[];
256
+ createdAt: string;
257
+ updatedAt: string;
258
+ }[];
259
+ };
260
+ [dataTagErrorSymbol]: Error;
261
+ };
262
+ };
263
+ export declare function getSupplierNotesQueryOptions(client: FetchWithValidationOptions, supplierId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
264
+ data: {
265
+ id: string;
266
+ supplierId: string;
267
+ authorId: string;
268
+ content: string;
269
+ createdAt: string;
270
+ }[];
271
+ }, Error, {
272
+ data: {
273
+ id: string;
274
+ supplierId: string;
275
+ authorId: string;
276
+ content: string;
277
+ createdAt: string;
278
+ }[];
279
+ }, readonly ["voyant", "suppliers", "notes", "list", string]>, "queryFn"> & {
280
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
281
+ data: {
282
+ id: string;
283
+ supplierId: string;
284
+ authorId: string;
285
+ content: string;
286
+ createdAt: string;
287
+ }[];
288
+ }, readonly ["voyant", "suppliers", "notes", "list", string], never> | undefined;
289
+ } & {
290
+ queryKey: readonly ["voyant", "suppliers", "notes", "list", string] & {
291
+ [dataTagSymbol]: {
292
+ data: {
293
+ id: string;
294
+ supplierId: string;
295
+ authorId: string;
296
+ content: string;
297
+ createdAt: string;
298
+ }[];
299
+ };
300
+ [dataTagErrorSymbol]: Error;
301
+ };
302
+ };
303
+ export declare function getSupplierServiceRatesQueryOptions(client: FetchWithValidationOptions, supplierId: string, serviceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
304
+ data: {
305
+ id: string;
306
+ serviceId: string;
307
+ name: string;
308
+ currency: string;
309
+ amountCents: number;
310
+ unit: "per_person" | "per_group" | "per_night" | "per_vehicle" | "flat";
311
+ validFrom: string | null;
312
+ validTo: string | null;
313
+ minPax: number | null;
314
+ maxPax: number | null;
315
+ notes: string | null;
316
+ createdAt: string;
317
+ }[];
318
+ }, Error, {
319
+ data: {
320
+ id: string;
321
+ serviceId: string;
322
+ name: string;
323
+ currency: string;
324
+ amountCents: number;
325
+ unit: "per_person" | "per_group" | "per_night" | "per_vehicle" | "flat";
326
+ validFrom: string | null;
327
+ validTo: string | null;
328
+ minPax: number | null;
329
+ maxPax: number | null;
330
+ notes: string | null;
331
+ createdAt: string;
332
+ }[];
333
+ }, readonly ["voyant", "suppliers", "rates", "list", string, string]>, "queryFn"> & {
334
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
335
+ data: {
336
+ id: string;
337
+ serviceId: string;
338
+ name: string;
339
+ currency: string;
340
+ amountCents: number;
341
+ unit: "per_person" | "per_group" | "per_night" | "per_vehicle" | "flat";
342
+ validFrom: string | null;
343
+ validTo: string | null;
344
+ minPax: number | null;
345
+ maxPax: number | null;
346
+ notes: string | null;
347
+ createdAt: string;
348
+ }[];
349
+ }, readonly ["voyant", "suppliers", "rates", "list", string, string], never> | undefined;
350
+ } & {
351
+ queryKey: readonly ["voyant", "suppliers", "rates", "list", string, string] & {
352
+ [dataTagSymbol]: {
353
+ data: {
354
+ id: string;
355
+ serviceId: string;
356
+ name: string;
357
+ currency: string;
358
+ amountCents: number;
359
+ unit: "per_person" | "per_group" | "per_night" | "per_vehicle" | "flat";
360
+ validFrom: string | null;
361
+ validTo: string | null;
362
+ minPax: number | null;
363
+ maxPax: number | null;
364
+ notes: string | null;
365
+ createdAt: string;
366
+ }[];
367
+ };
368
+ [dataTagErrorSymbol]: Error;
369
+ };
370
+ };
371
+ //# sourceMappingURL=query-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAenE,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,mBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAalC;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,0BAA0B,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrF;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOnB;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOnB;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWlB"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { queryOptions } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "./client.js";
4
+ import { suppliersQueryKeys } from "./query-keys.js";
5
+ import { supplierDetailResponse, supplierListResponse, supplierNotesResponse, supplierRatesResponse, supplierServicesResponse, } from "./schemas.js";
6
+ function appendPagination(params, filters) {
7
+ if (filters.limit !== undefined)
8
+ params.set("limit", String(filters.limit));
9
+ if (filters.offset !== undefined)
10
+ params.set("offset", String(filters.offset));
11
+ }
12
+ export function getSuppliersQueryOptions(client, options = {}) {
13
+ const { enabled: _enabled = true, ...filters } = options;
14
+ return queryOptions({
15
+ queryKey: suppliersQueryKeys.suppliersList(filters),
16
+ queryFn: () => {
17
+ const params = new URLSearchParams();
18
+ if (filters.search)
19
+ params.set("search", filters.search);
20
+ appendPagination(params, filters);
21
+ const qs = params.toString();
22
+ return fetchWithValidation(`/v1/suppliers${qs ? `?${qs}` : ""}`, supplierListResponse, client);
23
+ },
24
+ });
25
+ }
26
+ export function getSupplierQueryOptions(client, id) {
27
+ return queryOptions({
28
+ queryKey: suppliersQueryKeys.supplierDetail(id),
29
+ queryFn: () => fetchWithValidation(`/v1/suppliers/${id}`, supplierDetailResponse, client),
30
+ });
31
+ }
32
+ export function getSupplierServicesQueryOptions(client, supplierId) {
33
+ return queryOptions({
34
+ queryKey: suppliersQueryKeys.supplierServices(supplierId),
35
+ queryFn: () => fetchWithValidation(`/v1/suppliers/${supplierId}/services`, supplierServicesResponse, client),
36
+ });
37
+ }
38
+ export function getSupplierNotesQueryOptions(client, supplierId) {
39
+ return queryOptions({
40
+ queryKey: suppliersQueryKeys.supplierNotes(supplierId),
41
+ queryFn: () => fetchWithValidation(`/v1/suppliers/${supplierId}/notes`, supplierNotesResponse, client),
42
+ });
43
+ }
44
+ export function getSupplierServiceRatesQueryOptions(client, supplierId, serviceId) {
45
+ return queryOptions({
46
+ queryKey: suppliersQueryKeys.supplierServiceRates(supplierId, serviceId),
47
+ queryFn: () => fetchWithValidation(`/v1/suppliers/${supplierId}/services/${serviceId}/rates`, supplierRatesResponse, client),
48
+ });
49
+ }