@voyantjs/products-react 0.6.8 → 0.6.9
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/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-duplicate-product-option-mutation.d.ts +19 -0
- package/dist/hooks/use-duplicate-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-duplicate-product-option-mutation.js +65 -0
- package/dist/hooks/use-option-unit-mutation.d.ts +2 -2
- package/dist/hooks/use-option-unit.d.ts +1 -1
- package/dist/hooks/use-option-units.d.ts +1 -1
- package/dist/hooks/use-product-day-mutation.d.ts +4 -2
- package/dist/hooks/use-product-day-mutation.d.ts.map +1 -1
- package/dist/hooks/use-product-day-mutation.js +20 -7
- package/dist/hooks/use-product-days.d.ts +1 -1
- package/dist/hooks/use-product-itineraries.d.ts +15 -0
- package/dist/hooks/use-product-itineraries.d.ts.map +1 -0
- package/dist/hooks/use-product-itineraries.js +12 -0
- package/dist/hooks/use-product-itinerary-days.d.ts +16 -0
- package/dist/hooks/use-product-itinerary-days.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-days.js +12 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts +54 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-mutation.js +63 -0
- package/dist/hooks/use-product-mutation.d.ts +2 -2
- package/dist/hooks/use-product.d.ts +1 -1
- package/dist/hooks/use-products.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/query-keys.d.ts +2 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +2 -0
- package/dist/query-options.d.ts +121 -19
- package/dist/query-options.d.ts.map +1 -1
- package/dist/query-options.js +25 -1
- package/dist/schemas.d.ts +49 -14
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +14 -3
- package/package.json +5 -5
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./use-duplicate-product-option-mutation.js";
|
|
1
2
|
export * from "./use-option-unit.js";
|
|
2
3
|
export * from "./use-option-unit-mutation.js";
|
|
3
4
|
export * from "./use-option-units.js";
|
|
@@ -9,6 +10,9 @@ export * from "./use-product-day-mutation.js";
|
|
|
9
10
|
export * from "./use-product-day-service-mutation.js";
|
|
10
11
|
export * from "./use-product-day-services.js";
|
|
11
12
|
export * from "./use-product-days.js";
|
|
13
|
+
export * from "./use-product-itineraries.js";
|
|
14
|
+
export * from "./use-product-itinerary-days.js";
|
|
15
|
+
export * from "./use-product-itinerary-mutation.js";
|
|
12
16
|
export * from "./use-product-media.js";
|
|
13
17
|
export * from "./use-product-media-mutation.js";
|
|
14
18
|
export * from "./use-product-mutation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oCAAoC,CAAA;AAClD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uCAAuC,CAAA;AACrD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAA;AAC1D,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oCAAoC,CAAA;AAClD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uCAAuC,CAAA;AACrD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,qCAAqC,CAAA;AACnD,cAAc,wBAAwB,CAAA;AACtC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./use-duplicate-product-option-mutation.js";
|
|
1
2
|
export * from "./use-option-unit.js";
|
|
2
3
|
export * from "./use-option-unit-mutation.js";
|
|
3
4
|
export * from "./use-option-units.js";
|
|
@@ -9,6 +10,9 @@ export * from "./use-product-day-mutation.js";
|
|
|
9
10
|
export * from "./use-product-day-service-mutation.js";
|
|
10
11
|
export * from "./use-product-day-services.js";
|
|
11
12
|
export * from "./use-product-days.js";
|
|
13
|
+
export * from "./use-product-itineraries.js";
|
|
14
|
+
export * from "./use-product-itinerary-days.js";
|
|
15
|
+
export * from "./use-product-itinerary-mutation.js";
|
|
12
16
|
export * from "./use-product-media.js";
|
|
13
17
|
export * from "./use-product-media-mutation.js";
|
|
14
18
|
export * from "./use-product-mutation.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ProductOptionRecord } from "../schemas.js";
|
|
2
|
+
export interface DuplicateProductOptionInput {
|
|
3
|
+
sourceOptionId: string;
|
|
4
|
+
productId?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
code?: string | null;
|
|
7
|
+
description?: string | null;
|
|
8
|
+
status?: ProductOptionRecord["status"];
|
|
9
|
+
isDefault?: boolean;
|
|
10
|
+
sortOrder?: number;
|
|
11
|
+
availableFrom?: string | null;
|
|
12
|
+
availableTo?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface DuplicateProductOptionResult {
|
|
15
|
+
option: ProductOptionRecord;
|
|
16
|
+
unitIdMap: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export declare function useDuplicateProductOptionMutation(): import("@tanstack/react-query").UseMutationResult<DuplicateProductOptionResult, Error, DuplicateProductOptionInput, unknown>;
|
|
19
|
+
//# sourceMappingURL=use-duplicate-product-option-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-duplicate-product-option-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-duplicate-product-option-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,eAAe,CAAA;AAItB,MAAM,WAAW,2BAA2B;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IACtC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,mBAAmB,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAMD,wBAAgB,iCAAiC,iIAwEhD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { optionUnitListResponse, productOptionSingleResponse, } from "../schemas.js";
|
|
7
|
+
import { useOptionUnitMutation } from "./use-option-unit-mutation.js";
|
|
8
|
+
import { useProductOptionMutation } from "./use-product-option-mutation.js";
|
|
9
|
+
function defaultDuplicateName(name) {
|
|
10
|
+
return `${name} Copy`;
|
|
11
|
+
}
|
|
12
|
+
export function useDuplicateProductOptionMutation() {
|
|
13
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
14
|
+
const queryClient = useQueryClient();
|
|
15
|
+
const { create: createOption } = useProductOptionMutation();
|
|
16
|
+
const { create: createUnit } = useOptionUnitMutation();
|
|
17
|
+
return useMutation({
|
|
18
|
+
mutationFn: async ({ sourceOptionId, productId, name, code, description, status, isDefault, sortOrder, availableFrom, availableTo, }) => {
|
|
19
|
+
const [{ data: sourceOption }, { data: sourceUnits }] = await Promise.all([
|
|
20
|
+
fetchWithValidation(`/v1/products/options/${sourceOptionId}`, productOptionSingleResponse, {
|
|
21
|
+
baseUrl,
|
|
22
|
+
fetcher,
|
|
23
|
+
}),
|
|
24
|
+
fetchWithValidation(`/v1/products/option-units?optionId=${encodeURIComponent(sourceOptionId)}&limit=100`, optionUnitListResponse, { baseUrl, fetcher }),
|
|
25
|
+
]);
|
|
26
|
+
const duplicatedOption = await createOption.mutateAsync({
|
|
27
|
+
productId: productId ?? sourceOption.productId,
|
|
28
|
+
name: name ?? defaultDuplicateName(sourceOption.name),
|
|
29
|
+
code: code === undefined ? null : code,
|
|
30
|
+
description: description ?? sourceOption.description,
|
|
31
|
+
status: status ?? sourceOption.status,
|
|
32
|
+
isDefault: isDefault ?? false,
|
|
33
|
+
sortOrder: sortOrder ?? sourceOption.sortOrder + 1,
|
|
34
|
+
availableFrom: availableFrom ?? sourceOption.availableFrom,
|
|
35
|
+
availableTo: availableTo ?? sourceOption.availableTo,
|
|
36
|
+
});
|
|
37
|
+
const unitIdMap = {};
|
|
38
|
+
for (const unit of [...sourceUnits].sort((a, b) => a.sortOrder - b.sortOrder)) {
|
|
39
|
+
const duplicatedUnit = await createUnit.mutateAsync({
|
|
40
|
+
optionId: duplicatedOption.id,
|
|
41
|
+
name: unit.name,
|
|
42
|
+
code: unit.code,
|
|
43
|
+
description: unit.description,
|
|
44
|
+
unitType: unit.unitType,
|
|
45
|
+
minQuantity: unit.minQuantity,
|
|
46
|
+
maxQuantity: unit.maxQuantity,
|
|
47
|
+
minAge: unit.minAge,
|
|
48
|
+
maxAge: unit.maxAge,
|
|
49
|
+
occupancyMin: unit.occupancyMin,
|
|
50
|
+
occupancyMax: unit.occupancyMax,
|
|
51
|
+
isRequired: unit.isRequired,
|
|
52
|
+
isHidden: unit.isHidden,
|
|
53
|
+
sortOrder: unit.sortOrder,
|
|
54
|
+
});
|
|
55
|
+
unitIdMap[unit.id] = duplicatedUnit.id;
|
|
56
|
+
}
|
|
57
|
+
return { option: duplicatedOption, unitIdMap };
|
|
58
|
+
},
|
|
59
|
+
onSuccess: (data) => {
|
|
60
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.productOptions() });
|
|
61
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.optionUnits() });
|
|
62
|
+
queryClient.setQueryData(productsQueryKeys.productOption(data.option.id), data.option);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -22,7 +22,7 @@ export declare function useOptionUnitMutation(): {
|
|
|
22
22
|
name: string;
|
|
23
23
|
code: string | null;
|
|
24
24
|
description: string | null;
|
|
25
|
-
unitType: "
|
|
25
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
26
26
|
minQuantity: number | null;
|
|
27
27
|
maxQuantity: number | null;
|
|
28
28
|
minAge: number | null;
|
|
@@ -39,7 +39,7 @@ export declare function useOptionUnitMutation(): {
|
|
|
39
39
|
name: string;
|
|
40
40
|
code: string | null;
|
|
41
41
|
description: string | null;
|
|
42
|
-
unitType: "
|
|
42
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
43
43
|
minQuantity: number | null;
|
|
44
44
|
maxQuantity: number | null;
|
|
45
45
|
minAge: number | null;
|
|
@@ -7,7 +7,7 @@ export declare function useOptionUnit(id: string | undefined, options?: UseOptio
|
|
|
7
7
|
name: string;
|
|
8
8
|
code: string | null;
|
|
9
9
|
description: string | null;
|
|
10
|
-
unitType: "
|
|
10
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
11
11
|
minQuantity: number | null;
|
|
12
12
|
maxQuantity: number | null;
|
|
13
13
|
minAge: number | null;
|
|
@@ -9,7 +9,7 @@ export declare function useOptionUnits(options?: UseOptionUnitsOptions): import(
|
|
|
9
9
|
name: string;
|
|
10
10
|
code: string | null;
|
|
11
11
|
description: string | null;
|
|
12
|
-
unitType: "
|
|
12
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
13
13
|
minQuantity: number | null;
|
|
14
14
|
maxQuantity: number | null;
|
|
15
15
|
minAge: number | null;
|
|
@@ -2,7 +2,7 @@ import { type UpdateProductDayInput } from "../schemas.js";
|
|
|
2
2
|
export declare function useProductDayMutation(): {
|
|
3
3
|
create: import("@tanstack/react-query").UseMutationResult<{
|
|
4
4
|
id: string;
|
|
5
|
-
|
|
5
|
+
itineraryId: string;
|
|
6
6
|
dayNumber: number;
|
|
7
7
|
title: string | null;
|
|
8
8
|
description: string | null;
|
|
@@ -16,10 +16,11 @@ export declare function useProductDayMutation(): {
|
|
|
16
16
|
location?: string | null | undefined;
|
|
17
17
|
} & {
|
|
18
18
|
productId: string;
|
|
19
|
+
itineraryId?: string;
|
|
19
20
|
}, unknown>;
|
|
20
21
|
update: import("@tanstack/react-query").UseMutationResult<{
|
|
21
22
|
id: string;
|
|
22
|
-
|
|
23
|
+
itineraryId: string;
|
|
23
24
|
dayNumber: number;
|
|
24
25
|
title: string | null;
|
|
25
26
|
description: string | null;
|
|
@@ -36,6 +37,7 @@ export declare function useProductDayMutation(): {
|
|
|
36
37
|
}, Error, {
|
|
37
38
|
productId: string;
|
|
38
39
|
dayId: string;
|
|
40
|
+
itineraryId?: string;
|
|
39
41
|
}, unknown>;
|
|
40
42
|
};
|
|
41
43
|
//# sourceMappingURL=use-product-day-mutation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-product-day-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-day-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AAEtB,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-product-day-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-day-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AAEtB,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;mBASO,MAAM;sBAAgB,MAAM;;;;;;;;;;;;mBA2BvD,MAAM;eACV,MAAM;eACN,qBAAqB;;;;;mBAyBjB,MAAM;eACV,MAAM;sBACC,MAAM;;EAwBzB"}
|
|
@@ -8,13 +8,18 @@ export function useProductDayMutation() {
|
|
|
8
8
|
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
9
9
|
const queryClient = useQueryClient();
|
|
10
10
|
const create = useMutation({
|
|
11
|
-
mutationFn: async ({ productId, ...input }) => {
|
|
12
|
-
const { data } = await fetchWithValidation(
|
|
11
|
+
mutationFn: async ({ productId, itineraryId, ...input }) => {
|
|
12
|
+
const { data } = await fetchWithValidation(itineraryId
|
|
13
|
+
? `/v1/products/${productId}/itineraries/${itineraryId}/days`
|
|
14
|
+
: `/v1/products/${productId}/days`, productDayResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
15
|
return data;
|
|
14
16
|
},
|
|
15
|
-
onSuccess: async (data) => {
|
|
17
|
+
onSuccess: async (data, variables) => {
|
|
16
18
|
await queryClient.invalidateQueries({
|
|
17
|
-
queryKey: productsQueryKeys.productDays(
|
|
19
|
+
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
20
|
+
});
|
|
21
|
+
await queryClient.invalidateQueries({
|
|
22
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, data.itineraryId),
|
|
18
23
|
});
|
|
19
24
|
},
|
|
20
25
|
});
|
|
@@ -23,18 +28,26 @@ export function useProductDayMutation() {
|
|
|
23
28
|
const { data } = await fetchWithValidation(`/v1/products/${productId}/days/${dayId}`, productDayResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
24
29
|
return data;
|
|
25
30
|
},
|
|
26
|
-
onSuccess: async (data) => {
|
|
31
|
+
onSuccess: async (data, variables) => {
|
|
32
|
+
await queryClient.invalidateQueries({
|
|
33
|
+
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
34
|
+
});
|
|
27
35
|
await queryClient.invalidateQueries({
|
|
28
|
-
queryKey: productsQueryKeys.
|
|
36
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, data.itineraryId),
|
|
29
37
|
});
|
|
30
38
|
},
|
|
31
39
|
});
|
|
32
40
|
const remove = useMutation({
|
|
33
|
-
mutationFn: async ({ productId, dayId }) => fetchWithValidation(`/v1/products/${productId}/days/${dayId}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
41
|
+
mutationFn: async ({ productId, dayId, }) => fetchWithValidation(`/v1/products/${productId}/days/${dayId}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
34
42
|
onSuccess: async (_data, variables) => {
|
|
35
43
|
await queryClient.invalidateQueries({
|
|
36
44
|
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
37
45
|
});
|
|
46
|
+
if (variables.itineraryId) {
|
|
47
|
+
await queryClient.invalidateQueries({
|
|
48
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, variables.itineraryId),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
38
51
|
},
|
|
39
52
|
});
|
|
40
53
|
return { create, update, remove };
|
|
@@ -4,7 +4,7 @@ export interface UseProductDaysOptions {
|
|
|
4
4
|
export declare function useProductDays(productId: string | null | undefined, options?: UseProductDaysOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
5
|
data: {
|
|
6
6
|
id: string;
|
|
7
|
-
|
|
7
|
+
itineraryId: string;
|
|
8
8
|
dayNumber: number;
|
|
9
9
|
title: string | null;
|
|
10
10
|
description: string | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface UseProductItinerariesOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useProductItineraries(productId: string | null | undefined, options?: UseProductItinerariesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
productId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
isDefault: boolean;
|
|
10
|
+
sortOrder: number;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}[];
|
|
14
|
+
}, Error>;
|
|
15
|
+
//# sourceMappingURL=use-product-itineraries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-itineraries.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-itineraries.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,4BAAiC;;;;;;;;;;UAS3C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
4
|
+
import { getProductItinerariesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useProductItineraries(productId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getProductItinerariesQueryOptions({ baseUrl, fetcher }, productId, options),
|
|
10
|
+
enabled: enabled && Boolean(productId),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseProductItineraryDaysOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useProductItineraryDays(productId: string | null | undefined, itineraryId: string | null | undefined, options?: UseProductItineraryDaysOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
itineraryId: string;
|
|
8
|
+
dayNumber: number;
|
|
9
|
+
title: string | null;
|
|
10
|
+
description: string | null;
|
|
11
|
+
location: string | null;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}[];
|
|
15
|
+
}, Error>;
|
|
16
|
+
//# sourceMappingURL=use-product-itinerary-days.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-itinerary-days.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-itinerary-days.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,GAAE,8BAAmC;;;;;;;;;;;UAS7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
4
|
+
import { getProductItineraryDaysQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useProductItineraryDays(productId, itineraryId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getProductItineraryDaysQueryOptions({ baseUrl, fetcher }, productId, itineraryId, options),
|
|
10
|
+
enabled: enabled && Boolean(productId) && Boolean(itineraryId),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type CreateProductItineraryInput, type DuplicateProductItineraryInput, type UpdateProductItineraryInput } from "../schemas.js";
|
|
2
|
+
export declare function useProductItineraryMutation(): {
|
|
3
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
4
|
+
id: string;
|
|
5
|
+
productId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
isDefault: boolean;
|
|
8
|
+
sortOrder: number;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}, Error, {
|
|
12
|
+
productId: string;
|
|
13
|
+
input: CreateProductItineraryInput;
|
|
14
|
+
}, unknown>;
|
|
15
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
16
|
+
productId: string;
|
|
17
|
+
itinerary: {
|
|
18
|
+
id: string;
|
|
19
|
+
productId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
isDefault: boolean;
|
|
22
|
+
sortOrder: number;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
};
|
|
26
|
+
}, Error, {
|
|
27
|
+
productId: string;
|
|
28
|
+
itineraryId: string;
|
|
29
|
+
input: UpdateProductItineraryInput;
|
|
30
|
+
}, unknown>;
|
|
31
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
productId: string;
|
|
33
|
+
}, Error, {
|
|
34
|
+
productId: string;
|
|
35
|
+
itineraryId: string;
|
|
36
|
+
}, unknown>;
|
|
37
|
+
duplicate: import("@tanstack/react-query").UseMutationResult<{
|
|
38
|
+
productId: string;
|
|
39
|
+
itinerary: {
|
|
40
|
+
id: string;
|
|
41
|
+
productId: string;
|
|
42
|
+
name: string;
|
|
43
|
+
isDefault: boolean;
|
|
44
|
+
sortOrder: number;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
};
|
|
48
|
+
}, Error, {
|
|
49
|
+
productId: string;
|
|
50
|
+
itineraryId: string;
|
|
51
|
+
input?: DuplicateProductItineraryInput;
|
|
52
|
+
}, unknown>;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=use-product-itinerary-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-itinerary-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-itinerary-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EAGnC,KAAK,2BAA2B,EACjC,MAAM,eAAe,CAAA;AAEtB,wBAAgB,2BAA2B;;;;;;;;;;mBAS1B,MAAM;eACV,2BAA2B;;;;;;;;;;;;;;mBAuBvB,MAAM;qBACJ,MAAM;eACZ,2BAA2B;;;;;mBAuBwB,MAAM;qBAAe,MAAM;;;;;;;;;;;;;;mBAuB1E,MAAM;qBACJ,MAAM;gBACX,8BAA8B;;EAqB3C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { productItineraryResponse, successEnvelope, } from "../schemas.js";
|
|
7
|
+
export function useProductItineraryMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async ({ productId, input, }) => {
|
|
12
|
+
const { data } = await fetchWithValidation(`/v1/products/${productId}/itineraries`, productItineraryResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: async (data) => {
|
|
16
|
+
await queryClient.invalidateQueries({
|
|
17
|
+
queryKey: productsQueryKeys.productItineraries(data.productId),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const update = useMutation({
|
|
22
|
+
mutationFn: async ({ productId, itineraryId, input, }) => {
|
|
23
|
+
const { data } = await fetchWithValidation(`/v1/products/itineraries/${itineraryId}`, productItineraryResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
24
|
+
return { productId, itinerary: data };
|
|
25
|
+
},
|
|
26
|
+
onSuccess: async ({ productId, itinerary }) => {
|
|
27
|
+
await queryClient.invalidateQueries({
|
|
28
|
+
queryKey: productsQueryKeys.productItineraries(productId),
|
|
29
|
+
});
|
|
30
|
+
if (itinerary.isDefault) {
|
|
31
|
+
await queryClient.invalidateQueries({
|
|
32
|
+
queryKey: productsQueryKeys.productDays(productId),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const remove = useMutation({
|
|
38
|
+
mutationFn: async ({ productId, itineraryId }) => fetchWithValidation(`/v1/products/itineraries/${itineraryId}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }).then(() => ({ productId })),
|
|
39
|
+
onSuccess: async ({ productId }) => {
|
|
40
|
+
await queryClient.invalidateQueries({
|
|
41
|
+
queryKey: productsQueryKeys.productItineraries(productId),
|
|
42
|
+
});
|
|
43
|
+
await queryClient.invalidateQueries({
|
|
44
|
+
queryKey: productsQueryKeys.productDays(productId),
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const duplicate = useMutation({
|
|
49
|
+
mutationFn: async ({ productId, itineraryId, input, }) => {
|
|
50
|
+
const { data } = await fetchWithValidation(`/v1/products/itineraries/${itineraryId}/duplicate`, productItineraryResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input ?? {}) });
|
|
51
|
+
return { productId, itinerary: data };
|
|
52
|
+
},
|
|
53
|
+
onSuccess: async ({ productId }) => {
|
|
54
|
+
await queryClient.invalidateQueries({
|
|
55
|
+
queryKey: productsQueryKeys.productItineraries(productId),
|
|
56
|
+
});
|
|
57
|
+
await queryClient.invalidateQueries({
|
|
58
|
+
queryKey: productsQueryKeys.productDays(productId),
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
return { create, update, remove, duplicate };
|
|
63
|
+
}
|
|
@@ -26,7 +26,7 @@ export declare function useProductMutation(): {
|
|
|
26
26
|
name: string;
|
|
27
27
|
status: "draft" | "active" | "archived";
|
|
28
28
|
description: string | null;
|
|
29
|
-
bookingMode: "
|
|
29
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
30
30
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
31
31
|
timezone: string | null;
|
|
32
32
|
visibility: "public" | "private" | "hidden";
|
|
@@ -50,7 +50,7 @@ export declare function useProductMutation(): {
|
|
|
50
50
|
name: string;
|
|
51
51
|
status: "draft" | "active" | "archived";
|
|
52
52
|
description: string | null;
|
|
53
|
-
bookingMode: "
|
|
53
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
54
54
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
55
55
|
timezone: string | null;
|
|
56
56
|
visibility: "public" | "private" | "hidden";
|
|
@@ -6,7 +6,7 @@ export declare function useProduct(id: string | undefined, options?: UseProductO
|
|
|
6
6
|
name: string;
|
|
7
7
|
status: "draft" | "active" | "archived";
|
|
8
8
|
description: string | null;
|
|
9
|
-
bookingMode: "
|
|
9
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
10
10
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
11
11
|
timezone: string | null;
|
|
12
12
|
visibility: "public" | "private" | "hidden";
|
|
@@ -8,7 +8,7 @@ export declare function useProducts(options?: UseProductsOptions): import("@tans
|
|
|
8
8
|
name: string;
|
|
9
9
|
status: "draft" | "active" | "archived";
|
|
10
10
|
description: string | null;
|
|
11
|
-
bookingMode: "
|
|
11
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
12
12
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
13
13
|
timezone: string | null;
|
|
14
14
|
visibility: "public" | "private" | "hidden";
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher
|
|
|
2
2
|
export * from "./hooks/index.js";
|
|
3
3
|
export { useVoyantProductsContext, type VoyantProductsContextValue, VoyantProductsProvider, type VoyantProductsProviderProps, } from "./provider.js";
|
|
4
4
|
export { productsQueryKeys } from "./query-keys.js";
|
|
5
|
-
export { getOptionUnitQueryOptions, getOptionUnitsQueryOptions, getProductCategoriesQueryOptions, getProductDayServicesQueryOptions, getProductDaysQueryOptions, getProductMediaQueryOptions, getProductOptionQueryOptions, getProductOptionsQueryOptions, getProductQueryOptions, getProductsQueryOptions, getProductTagsQueryOptions, getProductTypeQueryOptions, getProductTypesQueryOptions, getProductVersionsQueryOptions, } from "./query-options.js";
|
|
5
|
+
export { getOptionUnitQueryOptions, getOptionUnitsQueryOptions, getProductCategoriesQueryOptions, getProductDayServicesQueryOptions, getProductDaysQueryOptions, getProductItinerariesQueryOptions, getProductItineraryDaysQueryOptions, getProductMediaQueryOptions, getProductOptionQueryOptions, getProductOptionsQueryOptions, getProductQueryOptions, getProductsQueryOptions, getProductTagsQueryOptions, getProductTypeQueryOptions, getProductTypesQueryOptions, getProductVersionsQueryOptions, } from "./query-options.js";
|
|
6
6
|
export * from "./schemas.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,gCAAgC,EAChC,iCAAiC,EACjC,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,gCAAgC,EAChC,iCAAiC,EACjC,0BAA0B,EAC1B,iCAAiC,EACjC,mCAAmC,EACnC,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,5 +2,5 @@ export { defaultFetcher, fetchWithValidation, VoyantApiError, } from "./client.j
|
|
|
2
2
|
export * from "./hooks/index.js";
|
|
3
3
|
export { useVoyantProductsContext, VoyantProductsProvider, } from "./provider.js";
|
|
4
4
|
export { productsQueryKeys } from "./query-keys.js";
|
|
5
|
-
export { getOptionUnitQueryOptions, getOptionUnitsQueryOptions, getProductCategoriesQueryOptions, getProductDayServicesQueryOptions, getProductDaysQueryOptions, getProductMediaQueryOptions, getProductOptionQueryOptions, getProductOptionsQueryOptions, getProductQueryOptions, getProductsQueryOptions, getProductTagsQueryOptions, getProductTypeQueryOptions, getProductTypesQueryOptions, getProductVersionsQueryOptions, } from "./query-options.js";
|
|
5
|
+
export { getOptionUnitQueryOptions, getOptionUnitsQueryOptions, getProductCategoriesQueryOptions, getProductDayServicesQueryOptions, getProductDaysQueryOptions, getProductItinerariesQueryOptions, getProductItineraryDaysQueryOptions, getProductMediaQueryOptions, getProductOptionQueryOptions, getProductOptionsQueryOptions, getProductQueryOptions, getProductsQueryOptions, getProductTagsQueryOptions, getProductTypeQueryOptions, getProductTypesQueryOptions, getProductVersionsQueryOptions, } from "./query-options.js";
|
|
6
6
|
export * from "./schemas.js";
|
package/dist/query-keys.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export declare const productsQueryKeys: {
|
|
|
64
64
|
readonly optionUnits: () => readonly ["voyant", "products", "option-units"];
|
|
65
65
|
readonly optionUnitsList: (filters: OptionUnitsListFilters) => readonly ["voyant", "products", "option-units", "list", OptionUnitsListFilters];
|
|
66
66
|
readonly optionUnit: (id: string) => readonly ["voyant", "products", "option-units", "detail", string];
|
|
67
|
+
readonly productItineraries: (productId: string) => readonly ["voyant", "products", "products", "detail", string, "itineraries"];
|
|
68
|
+
readonly productItineraryDays: (productId: string, itineraryId: string) => readonly ["voyant", "products", "products", "detail", string, "itineraries", string, "days"];
|
|
67
69
|
readonly productDays: (productId: string) => readonly ["voyant", "products", "products", "detail", string, "days"];
|
|
68
70
|
readonly productDayServices: (productId: string, dayId: string) => readonly ["voyant", "products", "products", "detail", string, "days", string, "services"];
|
|
69
71
|
readonly productVersions: (productId: string) => readonly ["voyant", "products", "products", "detail", string, "versions"];
|
package/dist/query-keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAA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E,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,eAAO,MAAM,iBAAiB;;;qCAIJ,mBAAmB;2BAE7B,MAAM;;yCAGQ,uBAAuB;+BAEjC,MAAM;;8CAGS,4BAA4B;mCAEvC,MAAM;;wCAID,sBAAsB;8BAEhC,MAAM;;2CAGO,yBAAyB;iCAEnC,MAAM;;wCAGC,sBAAsB;8BAEhC,MAAM;6CAES,MAAM;+CAEJ,MAAM,eAAe,MAAM;sCAEpC,MAAM;6CACC,MAAM,SAAS,MAAM;0CAExB,MAAM;uCAET,MAAM;2CACF,MAAM,WAAW,uBAAuB;yCAE1C,MAAM;CAE1B,CAAA"}
|
package/dist/query-keys.js
CHANGED
|
@@ -18,6 +18,8 @@ export const productsQueryKeys = {
|
|
|
18
18
|
optionUnits: () => [...productsQueryKeys.all, "option-units"],
|
|
19
19
|
optionUnitsList: (filters) => [...productsQueryKeys.optionUnits(), "list", filters],
|
|
20
20
|
optionUnit: (id) => [...productsQueryKeys.optionUnits(), "detail", id],
|
|
21
|
+
productItineraries: (productId) => [...productsQueryKeys.product(productId), "itineraries"],
|
|
22
|
+
productItineraryDays: (productId, itineraryId) => [...productsQueryKeys.productItineraries(productId), itineraryId, "days"],
|
|
21
23
|
productDays: (productId) => [...productsQueryKeys.product(productId), "days"],
|
|
22
24
|
productDayServices: (productId, dayId) => [...productsQueryKeys.productDays(productId), dayId, "services"],
|
|
23
25
|
productVersions: (productId) => [...productsQueryKeys.product(productId), "versions"],
|
package/dist/query-options.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { UseProductOptions } from "./hooks/use-product.js";
|
|
|
5
5
|
import type { UseProductCategoriesOptions } from "./hooks/use-product-categories.js";
|
|
6
6
|
import type { UseProductDayServicesOptions } from "./hooks/use-product-day-services.js";
|
|
7
7
|
import type { UseProductDaysOptions } from "./hooks/use-product-days.js";
|
|
8
|
+
import type { UseProductItinerariesOptions } from "./hooks/use-product-itineraries.js";
|
|
9
|
+
import type { UseProductItineraryDaysOptions } from "./hooks/use-product-itinerary-days.js";
|
|
8
10
|
import type { UseProductMediaOptions } from "./hooks/use-product-media.js";
|
|
9
11
|
import type { UseProductOptionOptions } from "./hooks/use-product-option.js";
|
|
10
12
|
import type { UseProductOptionsListOptions } from "./hooks/use-product-options.js";
|
|
@@ -18,7 +20,7 @@ export declare function getProductsQueryOptions(client: FetchWithValidationOptio
|
|
|
18
20
|
name: string;
|
|
19
21
|
status: "draft" | "active" | "archived";
|
|
20
22
|
description: string | null;
|
|
21
|
-
bookingMode: "
|
|
23
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
22
24
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
23
25
|
timezone: string | null;
|
|
24
26
|
visibility: "public" | "private" | "hidden";
|
|
@@ -46,7 +48,7 @@ export declare function getProductsQueryOptions(client: FetchWithValidationOptio
|
|
|
46
48
|
name: string;
|
|
47
49
|
status: "draft" | "active" | "archived";
|
|
48
50
|
description: string | null;
|
|
49
|
-
bookingMode: "
|
|
51
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
50
52
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
51
53
|
timezone: string | null;
|
|
52
54
|
visibility: "public" | "private" | "hidden";
|
|
@@ -75,7 +77,7 @@ export declare function getProductsQueryOptions(client: FetchWithValidationOptio
|
|
|
75
77
|
name: string;
|
|
76
78
|
status: "draft" | "active" | "archived";
|
|
77
79
|
description: string | null;
|
|
78
|
-
bookingMode: "
|
|
80
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
79
81
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
80
82
|
timezone: string | null;
|
|
81
83
|
visibility: "public" | "private" | "hidden";
|
|
@@ -106,7 +108,7 @@ export declare function getProductsQueryOptions(client: FetchWithValidationOptio
|
|
|
106
108
|
name: string;
|
|
107
109
|
status: "draft" | "active" | "archived";
|
|
108
110
|
description: string | null;
|
|
109
|
-
bookingMode: "
|
|
111
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
110
112
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
111
113
|
timezone: string | null;
|
|
112
114
|
visibility: "public" | "private" | "hidden";
|
|
@@ -137,7 +139,7 @@ export declare function getProductQueryOptions(client: FetchWithValidationOption
|
|
|
137
139
|
name: string;
|
|
138
140
|
status: "draft" | "active" | "archived";
|
|
139
141
|
description: string | null;
|
|
140
|
-
bookingMode: "
|
|
142
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
141
143
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
142
144
|
timezone: string | null;
|
|
143
145
|
visibility: "public" | "private" | "hidden";
|
|
@@ -160,7 +162,7 @@ export declare function getProductQueryOptions(client: FetchWithValidationOption
|
|
|
160
162
|
name: string;
|
|
161
163
|
status: "draft" | "active" | "archived";
|
|
162
164
|
description: string | null;
|
|
163
|
-
bookingMode: "
|
|
165
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
164
166
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
165
167
|
timezone: string | null;
|
|
166
168
|
visibility: "public" | "private" | "hidden";
|
|
@@ -184,7 +186,7 @@ export declare function getProductQueryOptions(client: FetchWithValidationOption
|
|
|
184
186
|
name: string;
|
|
185
187
|
status: "draft" | "active" | "archived";
|
|
186
188
|
description: string | null;
|
|
187
|
-
bookingMode: "
|
|
189
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
188
190
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
189
191
|
timezone: string | null;
|
|
190
192
|
visibility: "public" | "private" | "hidden";
|
|
@@ -210,7 +212,7 @@ export declare function getProductQueryOptions(client: FetchWithValidationOption
|
|
|
210
212
|
name: string;
|
|
211
213
|
status: "draft" | "active" | "archived";
|
|
212
214
|
description: string | null;
|
|
213
|
-
bookingMode: "
|
|
215
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
214
216
|
capacityMode: "free_sale" | "limited" | "on_request";
|
|
215
217
|
timezone: string | null;
|
|
216
218
|
visibility: "public" | "private" | "hidden";
|
|
@@ -615,7 +617,7 @@ export declare function getOptionUnitsQueryOptions(client: FetchWithValidationOp
|
|
|
615
617
|
name: string;
|
|
616
618
|
code: string | null;
|
|
617
619
|
description: string | null;
|
|
618
|
-
unitType: "
|
|
620
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
619
621
|
minQuantity: number | null;
|
|
620
622
|
maxQuantity: number | null;
|
|
621
623
|
minAge: number | null;
|
|
@@ -636,7 +638,7 @@ export declare function getOptionUnitsQueryOptions(client: FetchWithValidationOp
|
|
|
636
638
|
name: string;
|
|
637
639
|
code: string | null;
|
|
638
640
|
description: string | null;
|
|
639
|
-
unitType: "
|
|
641
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
640
642
|
minQuantity: number | null;
|
|
641
643
|
maxQuantity: number | null;
|
|
642
644
|
minAge: number | null;
|
|
@@ -658,7 +660,7 @@ export declare function getOptionUnitsQueryOptions(client: FetchWithValidationOp
|
|
|
658
660
|
name: string;
|
|
659
661
|
code: string | null;
|
|
660
662
|
description: string | null;
|
|
661
|
-
unitType: "
|
|
663
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
662
664
|
minQuantity: number | null;
|
|
663
665
|
maxQuantity: number | null;
|
|
664
666
|
minAge: number | null;
|
|
@@ -682,7 +684,7 @@ export declare function getOptionUnitsQueryOptions(client: FetchWithValidationOp
|
|
|
682
684
|
name: string;
|
|
683
685
|
code: string | null;
|
|
684
686
|
description: string | null;
|
|
685
|
-
unitType: "
|
|
687
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
686
688
|
minQuantity: number | null;
|
|
687
689
|
maxQuantity: number | null;
|
|
688
690
|
minAge: number | null;
|
|
@@ -706,7 +708,7 @@ export declare function getOptionUnitQueryOptions(client: FetchWithValidationOpt
|
|
|
706
708
|
name: string;
|
|
707
709
|
code: string | null;
|
|
708
710
|
description: string | null;
|
|
709
|
-
unitType: "
|
|
711
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
710
712
|
minQuantity: number | null;
|
|
711
713
|
maxQuantity: number | null;
|
|
712
714
|
minAge: number | null;
|
|
@@ -722,7 +724,7 @@ export declare function getOptionUnitQueryOptions(client: FetchWithValidationOpt
|
|
|
722
724
|
name: string;
|
|
723
725
|
code: string | null;
|
|
724
726
|
description: string | null;
|
|
725
|
-
unitType: "
|
|
727
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
726
728
|
minQuantity: number | null;
|
|
727
729
|
maxQuantity: number | null;
|
|
728
730
|
minAge: number | null;
|
|
@@ -739,7 +741,7 @@ export declare function getOptionUnitQueryOptions(client: FetchWithValidationOpt
|
|
|
739
741
|
name: string;
|
|
740
742
|
code: string | null;
|
|
741
743
|
description: string | null;
|
|
742
|
-
unitType: "
|
|
744
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
743
745
|
minQuantity: number | null;
|
|
744
746
|
maxQuantity: number | null;
|
|
745
747
|
minAge: number | null;
|
|
@@ -758,7 +760,7 @@ export declare function getOptionUnitQueryOptions(client: FetchWithValidationOpt
|
|
|
758
760
|
name: string;
|
|
759
761
|
code: string | null;
|
|
760
762
|
description: string | null;
|
|
761
|
-
unitType: "
|
|
763
|
+
unitType: "service" | "other" | "person" | "group" | "room" | "vehicle";
|
|
762
764
|
minQuantity: number | null;
|
|
763
765
|
maxQuantity: number | null;
|
|
764
766
|
minAge: number | null;
|
|
@@ -775,7 +777,7 @@ export declare function getOptionUnitQueryOptions(client: FetchWithValidationOpt
|
|
|
775
777
|
export declare function getProductDaysQueryOptions(client: FetchWithValidationOptions, productId: string | null | undefined, options?: UseProductDaysOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
776
778
|
data: {
|
|
777
779
|
id: string;
|
|
778
|
-
|
|
780
|
+
itineraryId: string;
|
|
779
781
|
dayNumber: number;
|
|
780
782
|
title: string | null;
|
|
781
783
|
description: string | null;
|
|
@@ -786,7 +788,7 @@ export declare function getProductDaysQueryOptions(client: FetchWithValidationOp
|
|
|
786
788
|
}, Error, {
|
|
787
789
|
data: {
|
|
788
790
|
id: string;
|
|
789
|
-
|
|
791
|
+
itineraryId: string;
|
|
790
792
|
dayNumber: number;
|
|
791
793
|
title: string | null;
|
|
792
794
|
description: string | null;
|
|
@@ -798,7 +800,7 @@ export declare function getProductDaysQueryOptions(client: FetchWithValidationOp
|
|
|
798
800
|
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
799
801
|
data: {
|
|
800
802
|
id: string;
|
|
801
|
-
|
|
803
|
+
itineraryId: string;
|
|
802
804
|
dayNumber: number;
|
|
803
805
|
title: string | null;
|
|
804
806
|
description: string | null;
|
|
@@ -809,10 +811,110 @@ export declare function getProductDaysQueryOptions(client: FetchWithValidationOp
|
|
|
809
811
|
}, readonly ["voyant", "products", "products", "detail", string, "days"], never> | undefined;
|
|
810
812
|
} & {
|
|
811
813
|
queryKey: readonly ["voyant", "products", "products", "detail", string, "days"] & {
|
|
814
|
+
[dataTagSymbol]: {
|
|
815
|
+
data: {
|
|
816
|
+
id: string;
|
|
817
|
+
itineraryId: string;
|
|
818
|
+
dayNumber: number;
|
|
819
|
+
title: string | null;
|
|
820
|
+
description: string | null;
|
|
821
|
+
location: string | null;
|
|
822
|
+
createdAt: string;
|
|
823
|
+
updatedAt: string;
|
|
824
|
+
}[];
|
|
825
|
+
};
|
|
826
|
+
[dataTagErrorSymbol]: Error;
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
export declare function getProductItinerariesQueryOptions(client: FetchWithValidationOptions, productId: string | null | undefined, options?: UseProductItinerariesOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
830
|
+
data: {
|
|
831
|
+
id: string;
|
|
832
|
+
productId: string;
|
|
833
|
+
name: string;
|
|
834
|
+
isDefault: boolean;
|
|
835
|
+
sortOrder: number;
|
|
836
|
+
createdAt: string;
|
|
837
|
+
updatedAt: string;
|
|
838
|
+
}[];
|
|
839
|
+
}, Error, {
|
|
840
|
+
data: {
|
|
841
|
+
id: string;
|
|
842
|
+
productId: string;
|
|
843
|
+
name: string;
|
|
844
|
+
isDefault: boolean;
|
|
845
|
+
sortOrder: number;
|
|
846
|
+
createdAt: string;
|
|
847
|
+
updatedAt: string;
|
|
848
|
+
}[];
|
|
849
|
+
}, readonly ["voyant", "products", "products", "detail", string, "itineraries"]>, "queryFn"> & {
|
|
850
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
851
|
+
data: {
|
|
852
|
+
id: string;
|
|
853
|
+
productId: string;
|
|
854
|
+
name: string;
|
|
855
|
+
isDefault: boolean;
|
|
856
|
+
sortOrder: number;
|
|
857
|
+
createdAt: string;
|
|
858
|
+
updatedAt: string;
|
|
859
|
+
}[];
|
|
860
|
+
}, readonly ["voyant", "products", "products", "detail", string, "itineraries"], never> | undefined;
|
|
861
|
+
} & {
|
|
862
|
+
queryKey: readonly ["voyant", "products", "products", "detail", string, "itineraries"] & {
|
|
812
863
|
[dataTagSymbol]: {
|
|
813
864
|
data: {
|
|
814
865
|
id: string;
|
|
815
866
|
productId: string;
|
|
867
|
+
name: string;
|
|
868
|
+
isDefault: boolean;
|
|
869
|
+
sortOrder: number;
|
|
870
|
+
createdAt: string;
|
|
871
|
+
updatedAt: string;
|
|
872
|
+
}[];
|
|
873
|
+
};
|
|
874
|
+
[dataTagErrorSymbol]: Error;
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
export declare function getProductItineraryDaysQueryOptions(client: FetchWithValidationOptions, productId: string | null | undefined, itineraryId: string | null | undefined, options?: UseProductItineraryDaysOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
878
|
+
data: {
|
|
879
|
+
id: string;
|
|
880
|
+
itineraryId: string;
|
|
881
|
+
dayNumber: number;
|
|
882
|
+
title: string | null;
|
|
883
|
+
description: string | null;
|
|
884
|
+
location: string | null;
|
|
885
|
+
createdAt: string;
|
|
886
|
+
updatedAt: string;
|
|
887
|
+
}[];
|
|
888
|
+
}, Error, {
|
|
889
|
+
data: {
|
|
890
|
+
id: string;
|
|
891
|
+
itineraryId: string;
|
|
892
|
+
dayNumber: number;
|
|
893
|
+
title: string | null;
|
|
894
|
+
description: string | null;
|
|
895
|
+
location: string | null;
|
|
896
|
+
createdAt: string;
|
|
897
|
+
updatedAt: string;
|
|
898
|
+
}[];
|
|
899
|
+
}, readonly ["voyant", "products", "products", "detail", string, "itineraries", string, "days"]>, "queryFn"> & {
|
|
900
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
901
|
+
data: {
|
|
902
|
+
id: string;
|
|
903
|
+
itineraryId: string;
|
|
904
|
+
dayNumber: number;
|
|
905
|
+
title: string | null;
|
|
906
|
+
description: string | null;
|
|
907
|
+
location: string | null;
|
|
908
|
+
createdAt: string;
|
|
909
|
+
updatedAt: string;
|
|
910
|
+
}[];
|
|
911
|
+
}, readonly ["voyant", "products", "products", "detail", string, "itineraries", string, "days"], never> | undefined;
|
|
912
|
+
} & {
|
|
913
|
+
queryKey: readonly ["voyant", "products", "products", "detail", string, "itineraries", string, "days"] & {
|
|
914
|
+
[dataTagSymbol]: {
|
|
915
|
+
data: {
|
|
916
|
+
id: string;
|
|
917
|
+
itineraryId: string;
|
|
816
918
|
dayNumber: number;
|
|
817
919
|
title: string | null;
|
|
818
920
|
description: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src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G,SAAS,EACpC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BrC"}
|
package/dist/query-options.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { queryOptions } from "@tanstack/react-query";
|
|
3
3
|
import { fetchWithValidation } from "./client.js";
|
|
4
4
|
import { productsQueryKeys } from "./query-keys.js";
|
|
5
|
-
import { optionUnitListResponse, optionUnitSingleResponse, productCategoryListResponse, productDayServicesResponse, productDaysResponse, productListResponse, productMediaListResponse, productOptionListResponse, productOptionSingleResponse, productSingleResponse, productTagListResponse, productTypeListResponse, productTypeSingleResponse, productVersionsResponse, } from "./schemas.js";
|
|
5
|
+
import { optionUnitListResponse, optionUnitSingleResponse, productCategoryListResponse, productDayServicesResponse, productDaysResponse, productItinerariesResponse, productListResponse, productMediaListResponse, productOptionListResponse, productOptionSingleResponse, productSingleResponse, productTagListResponse, productTypeListResponse, productTypeSingleResponse, productVersionsResponse, } from "./schemas.js";
|
|
6
6
|
export function getProductsQueryOptions(client, options = {}) {
|
|
7
7
|
const { enabled: _enabled = true, ...filters } = options;
|
|
8
8
|
return queryOptions({
|
|
@@ -183,6 +183,30 @@ export function getProductDaysQueryOptions(client, productId, options = {}) {
|
|
|
183
183
|
},
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
+
export function getProductItinerariesQueryOptions(client, productId, options = {}) {
|
|
187
|
+
const { enabled: _enabled = true } = options;
|
|
188
|
+
return queryOptions({
|
|
189
|
+
queryKey: productsQueryKeys.productItineraries(productId ?? ""),
|
|
190
|
+
queryFn: async () => {
|
|
191
|
+
if (!productId) {
|
|
192
|
+
throw new Error("getProductItinerariesQueryOptions requires a productId");
|
|
193
|
+
}
|
|
194
|
+
return fetchWithValidation(`/v1/products/${productId}/itineraries`, productItinerariesResponse, client);
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
export function getProductItineraryDaysQueryOptions(client, productId, itineraryId, options = {}) {
|
|
199
|
+
const { enabled: _enabled = true } = options;
|
|
200
|
+
return queryOptions({
|
|
201
|
+
queryKey: productsQueryKeys.productItineraryDays(productId ?? "", itineraryId ?? ""),
|
|
202
|
+
queryFn: async () => {
|
|
203
|
+
if (!productId || !itineraryId) {
|
|
204
|
+
throw new Error("getProductItineraryDaysQueryOptions requires productId and itineraryId");
|
|
205
|
+
}
|
|
206
|
+
return fetchWithValidation(`/v1/products/${productId}/itineraries/${itineraryId}/days`, productDaysResponse, client);
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
186
210
|
export function getProductDayServicesQueryOptions(client, productId, dayId, options = {}) {
|
|
187
211
|
const { enabled: _enabled = true } = options;
|
|
188
212
|
return queryOptions({
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertDaySchema, insertDayServiceSchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateProductMediaSchema } from "@voyantjs/products";
|
|
1
|
+
import { duplicateItinerarySchema, insertDaySchema, insertDayServiceSchema, insertItinerarySchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateItinerarySchema, updateProductMediaSchema } from "@voyantjs/products";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const paginatedEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
|
|
4
4
|
data: z.ZodArray<T>;
|
|
@@ -25,8 +25,8 @@ export declare const productRecordSchema: z.ZodObject<{
|
|
|
25
25
|
}>;
|
|
26
26
|
description: z.ZodNullable<z.ZodString>;
|
|
27
27
|
bookingMode: z.ZodEnum<{
|
|
28
|
-
other: "other";
|
|
29
28
|
date: "date";
|
|
29
|
+
other: "other";
|
|
30
30
|
date_time: "date_time";
|
|
31
31
|
open: "open";
|
|
32
32
|
stay: "stay";
|
|
@@ -118,12 +118,12 @@ export declare const optionUnitRecordSchema: z.ZodObject<{
|
|
|
118
118
|
code: z.ZodNullable<z.ZodString>;
|
|
119
119
|
description: z.ZodNullable<z.ZodString>;
|
|
120
120
|
unitType: z.ZodEnum<{
|
|
121
|
+
service: "service";
|
|
122
|
+
other: "other";
|
|
121
123
|
person: "person";
|
|
122
124
|
group: "group";
|
|
123
125
|
room: "room";
|
|
124
126
|
vehicle: "vehicle";
|
|
125
|
-
service: "service";
|
|
126
|
-
other: "other";
|
|
127
127
|
}>;
|
|
128
128
|
minQuantity: z.ZodNullable<z.ZodNumber>;
|
|
129
129
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
@@ -136,9 +136,19 @@ export declare const optionUnitRecordSchema: z.ZodObject<{
|
|
|
136
136
|
sortOrder: z.ZodNumber;
|
|
137
137
|
}, z.core.$strip>;
|
|
138
138
|
export type OptionUnitRecord = z.infer<typeof optionUnitRecordSchema>;
|
|
139
|
-
export declare const
|
|
139
|
+
export declare const productItineraryRecordSchema: z.ZodObject<{
|
|
140
140
|
id: z.ZodString;
|
|
141
141
|
productId: z.ZodString;
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
isDefault: z.ZodBoolean;
|
|
144
|
+
sortOrder: z.ZodNumber;
|
|
145
|
+
createdAt: z.ZodString;
|
|
146
|
+
updatedAt: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
export type ProductItineraryRecord = z.infer<typeof productItineraryRecordSchema>;
|
|
149
|
+
export declare const productDayRecordSchema: z.ZodObject<{
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
itineraryId: z.ZodString;
|
|
142
152
|
dayNumber: z.ZodNumber;
|
|
143
153
|
title: z.ZodNullable<z.ZodString>;
|
|
144
154
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -211,8 +221,8 @@ export declare const productListResponse: z.ZodObject<{
|
|
|
211
221
|
}>;
|
|
212
222
|
description: z.ZodNullable<z.ZodString>;
|
|
213
223
|
bookingMode: z.ZodEnum<{
|
|
214
|
-
other: "other";
|
|
215
224
|
date: "date";
|
|
225
|
+
other: "other";
|
|
216
226
|
date_time: "date_time";
|
|
217
227
|
open: "open";
|
|
218
228
|
stay: "stay";
|
|
@@ -260,8 +270,8 @@ export declare const productSingleResponse: z.ZodObject<{
|
|
|
260
270
|
}>;
|
|
261
271
|
description: z.ZodNullable<z.ZodString>;
|
|
262
272
|
bookingMode: z.ZodEnum<{
|
|
263
|
-
other: "other";
|
|
264
273
|
date: "date";
|
|
274
|
+
other: "other";
|
|
265
275
|
date_time: "date_time";
|
|
266
276
|
open: "open";
|
|
267
277
|
stay: "stay";
|
|
@@ -425,12 +435,12 @@ export declare const optionUnitListResponse: z.ZodObject<{
|
|
|
425
435
|
code: z.ZodNullable<z.ZodString>;
|
|
426
436
|
description: z.ZodNullable<z.ZodString>;
|
|
427
437
|
unitType: z.ZodEnum<{
|
|
438
|
+
service: "service";
|
|
439
|
+
other: "other";
|
|
428
440
|
person: "person";
|
|
429
441
|
group: "group";
|
|
430
442
|
room: "room";
|
|
431
443
|
vehicle: "vehicle";
|
|
432
|
-
service: "service";
|
|
433
|
-
other: "other";
|
|
434
444
|
}>;
|
|
435
445
|
minQuantity: z.ZodNullable<z.ZodNumber>;
|
|
436
446
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
@@ -454,12 +464,12 @@ export declare const optionUnitSingleResponse: z.ZodObject<{
|
|
|
454
464
|
code: z.ZodNullable<z.ZodString>;
|
|
455
465
|
description: z.ZodNullable<z.ZodString>;
|
|
456
466
|
unitType: z.ZodEnum<{
|
|
467
|
+
service: "service";
|
|
468
|
+
other: "other";
|
|
457
469
|
person: "person";
|
|
458
470
|
group: "group";
|
|
459
471
|
room: "room";
|
|
460
472
|
vehicle: "vehicle";
|
|
461
|
-
service: "service";
|
|
462
|
-
other: "other";
|
|
463
473
|
}>;
|
|
464
474
|
minQuantity: z.ZodNullable<z.ZodNumber>;
|
|
465
475
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
@@ -472,10 +482,32 @@ export declare const optionUnitSingleResponse: z.ZodObject<{
|
|
|
472
482
|
sortOrder: z.ZodNumber;
|
|
473
483
|
}, z.core.$strip>;
|
|
474
484
|
}, z.core.$strip>;
|
|
475
|
-
export declare const
|
|
485
|
+
export declare const productItinerariesResponse: z.ZodObject<{
|
|
476
486
|
data: z.ZodArray<z.ZodObject<{
|
|
477
487
|
id: z.ZodString;
|
|
478
488
|
productId: z.ZodString;
|
|
489
|
+
name: z.ZodString;
|
|
490
|
+
isDefault: z.ZodBoolean;
|
|
491
|
+
sortOrder: z.ZodNumber;
|
|
492
|
+
createdAt: z.ZodString;
|
|
493
|
+
updatedAt: z.ZodString;
|
|
494
|
+
}, z.core.$strip>>;
|
|
495
|
+
}, z.core.$strip>;
|
|
496
|
+
export declare const productItineraryResponse: z.ZodObject<{
|
|
497
|
+
data: z.ZodObject<{
|
|
498
|
+
id: z.ZodString;
|
|
499
|
+
productId: z.ZodString;
|
|
500
|
+
name: z.ZodString;
|
|
501
|
+
isDefault: z.ZodBoolean;
|
|
502
|
+
sortOrder: z.ZodNumber;
|
|
503
|
+
createdAt: z.ZodString;
|
|
504
|
+
updatedAt: z.ZodString;
|
|
505
|
+
}, z.core.$strip>;
|
|
506
|
+
}, z.core.$strip>;
|
|
507
|
+
export declare const productDaysResponse: z.ZodObject<{
|
|
508
|
+
data: z.ZodArray<z.ZodObject<{
|
|
509
|
+
id: z.ZodString;
|
|
510
|
+
itineraryId: z.ZodString;
|
|
479
511
|
dayNumber: z.ZodNumber;
|
|
480
512
|
title: z.ZodNullable<z.ZodString>;
|
|
481
513
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -487,7 +519,7 @@ export declare const productDaysResponse: z.ZodObject<{
|
|
|
487
519
|
export declare const productDayResponse: z.ZodObject<{
|
|
488
520
|
data: z.ZodObject<{
|
|
489
521
|
id: z.ZodString;
|
|
490
|
-
|
|
522
|
+
itineraryId: z.ZodString;
|
|
491
523
|
dayNumber: z.ZodNumber;
|
|
492
524
|
title: z.ZodNullable<z.ZodString>;
|
|
493
525
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -611,7 +643,10 @@ export declare const productMediaResponse: z.ZodObject<{
|
|
|
611
643
|
updatedAt: z.ZodString;
|
|
612
644
|
}, z.core.$strip>;
|
|
613
645
|
}, z.core.$strip>;
|
|
614
|
-
export { insertDaySchema, insertDayServiceSchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateProductMediaSchema, };
|
|
646
|
+
export { duplicateItinerarySchema, insertDaySchema, insertDayServiceSchema, insertItinerarySchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateItinerarySchema, updateProductMediaSchema, };
|
|
647
|
+
export type CreateProductItineraryInput = z.input<typeof insertItinerarySchema>;
|
|
648
|
+
export type UpdateProductItineraryInput = z.input<typeof updateItinerarySchema>;
|
|
649
|
+
export type DuplicateProductItineraryInput = z.input<typeof duplicateItinerarySchema>;
|
|
615
650
|
export type CreateProductDayInput = z.input<typeof insertDaySchema>;
|
|
616
651
|
export type UpdateProductDayInput = z.input<typeof updateDaySchema>;
|
|
617
652
|
export type CreateProductDayServiceInput = z.input<typeof insertDayServiceSchema>;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MA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B,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,GACzB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC/E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC/E,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACrF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACjF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACjF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC3E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC9E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|
package/dist/schemas.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertDaySchema, insertDayServiceSchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateProductMediaSchema, } from "@voyantjs/products";
|
|
1
|
+
import { duplicateItinerarySchema, insertDaySchema, insertDayServiceSchema, insertItinerarySchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateItinerarySchema, updateProductMediaSchema, } from "@voyantjs/products";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export const paginatedEnvelope = (item) => z.object({
|
|
4
4
|
data: z.array(item),
|
|
@@ -93,9 +93,18 @@ export const optionUnitRecordSchema = z.object({
|
|
|
93
93
|
isHidden: z.boolean(),
|
|
94
94
|
sortOrder: z.number().int(),
|
|
95
95
|
});
|
|
96
|
-
export const
|
|
96
|
+
export const productItineraryRecordSchema = z.object({
|
|
97
97
|
id: z.string(),
|
|
98
98
|
productId: z.string(),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
isDefault: z.boolean(),
|
|
101
|
+
sortOrder: z.number().int(),
|
|
102
|
+
createdAt: z.string(),
|
|
103
|
+
updatedAt: z.string(),
|
|
104
|
+
});
|
|
105
|
+
export const productDayRecordSchema = z.object({
|
|
106
|
+
id: z.string(),
|
|
107
|
+
itineraryId: z.string(),
|
|
99
108
|
dayNumber: z.number().int(),
|
|
100
109
|
title: z.string().nullable(),
|
|
101
110
|
description: z.string().nullable(),
|
|
@@ -154,6 +163,8 @@ export const productOptionListResponse = paginatedEnvelope(productOptionRecordSc
|
|
|
154
163
|
export const productOptionSingleResponse = singleEnvelope(productOptionRecordSchema);
|
|
155
164
|
export const optionUnitListResponse = paginatedEnvelope(optionUnitRecordSchema);
|
|
156
165
|
export const optionUnitSingleResponse = singleEnvelope(optionUnitRecordSchema);
|
|
166
|
+
export const productItinerariesResponse = arrayEnvelope(productItineraryRecordSchema);
|
|
167
|
+
export const productItineraryResponse = singleEnvelope(productItineraryRecordSchema);
|
|
157
168
|
export const productDaysResponse = arrayEnvelope(productDayRecordSchema);
|
|
158
169
|
export const productDayResponse = singleEnvelope(productDayRecordSchema);
|
|
159
170
|
export const productDayServicesResponse = arrayEnvelope(productDayServiceRecordSchema);
|
|
@@ -162,4 +173,4 @@ export const productVersionsResponse = arrayEnvelope(productVersionRecordSchema)
|
|
|
162
173
|
export const productVersionResponse = singleEnvelope(productVersionRecordSchema);
|
|
163
174
|
export const productMediaListResponse = paginatedEnvelope(productMediaRecordSchema);
|
|
164
175
|
export const productMediaResponse = singleEnvelope(productMediaRecordSchema);
|
|
165
|
-
export { insertDaySchema, insertDayServiceSchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateProductMediaSchema, };
|
|
176
|
+
export { duplicateItinerarySchema, insertDaySchema, insertDayServiceSchema, insertItinerarySchema, insertProductMediaSchema, insertVersionSchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateItinerarySchema, updateProductMediaSchema, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/products-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react": "^19.0.0",
|
|
36
36
|
"react-dom": "^19.0.0",
|
|
37
37
|
"zod": "^4.0.0",
|
|
38
|
-
"@voyantjs/products": "0.6.
|
|
38
|
+
"@voyantjs/products": "0.6.9"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@tanstack/react-query": "^5.96.2",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"typescript": "^6.0.2",
|
|
47
47
|
"vitest": "^4.1.2",
|
|
48
48
|
"zod": "^4.3.6",
|
|
49
|
-
"@voyantjs/products": "0.6.
|
|
50
|
-
"@voyantjs/react": "0.6.
|
|
49
|
+
"@voyantjs/products": "0.6.9",
|
|
50
|
+
"@voyantjs/react": "0.6.9",
|
|
51
51
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@voyantjs/react": "0.6.
|
|
54
|
+
"@voyantjs/react": "0.6.9"
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
57
|
"dist"
|