@voyantjs/pricing-react 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +109 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +33 -0
- package/dist/hooks/use-cancellation-policies.d.ts +20 -0
- package/dist/hooks/use-cancellation-policies.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policies.js +12 -0
- package/dist/hooks/use-cancellation-policy-mutation.d.ts +57 -0
- package/dist/hooks/use-cancellation-policy-mutation.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policy-mutation.js +49 -0
- package/dist/hooks/use-cancellation-policy-rule-mutation.d.ts +58 -0
- package/dist/hooks/use-cancellation-policy-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policy-rule-mutation.js +49 -0
- package/dist/hooks/use-cancellation-policy-rule.d.ts +15 -0
- package/dist/hooks/use-cancellation-policy-rule.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policy-rule.js +12 -0
- package/dist/hooks/use-cancellation-policy-rules.d.ts +21 -0
- package/dist/hooks/use-cancellation-policy-rules.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policy-rules.js +12 -0
- package/dist/hooks/use-cancellation-policy.d.ts +14 -0
- package/dist/hooks/use-cancellation-policy.d.ts.map +1 -0
- package/dist/hooks/use-cancellation-policy.js +12 -0
- package/dist/hooks/use-dropoff-price-rule-mutation.d.ts +72 -0
- package/dist/hooks/use-dropoff-price-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-dropoff-price-rule-mutation.js +52 -0
- package/dist/hooks/use-dropoff-price-rule.d.ts +18 -0
- package/dist/hooks/use-dropoff-price-rule.d.ts.map +1 -0
- package/dist/hooks/use-dropoff-price-rule.js +12 -0
- package/dist/hooks/use-dropoff-price-rules.d.ts +24 -0
- package/dist/hooks/use-dropoff-price-rules.d.ts.map +1 -0
- package/dist/hooks/use-dropoff-price-rules.js +12 -0
- package/dist/hooks/use-extra-price-rule-mutation.d.ts +72 -0
- package/dist/hooks/use-extra-price-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-extra-price-rule-mutation.js +52 -0
- package/dist/hooks/use-extra-price-rule.d.ts +18 -0
- package/dist/hooks/use-extra-price-rule.d.ts.map +1 -0
- package/dist/hooks/use-extra-price-rule.js +12 -0
- package/dist/hooks/use-extra-price-rules.d.ts +24 -0
- package/dist/hooks/use-extra-price-rules.d.ts.map +1 -0
- package/dist/hooks/use-extra-price-rules.js +12 -0
- package/dist/hooks/use-option-price-rule-mutation.d.ts +98 -0
- package/dist/hooks/use-option-price-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-price-rule-mutation.js +66 -0
- package/dist/hooks/use-option-price-rule.d.ts +24 -0
- package/dist/hooks/use-option-price-rule.d.ts.map +1 -0
- package/dist/hooks/use-option-price-rule.js +12 -0
- package/dist/hooks/use-option-price-rules.d.ts +30 -0
- package/dist/hooks/use-option-price-rules.d.ts.map +1 -0
- package/dist/hooks/use-option-price-rules.js +12 -0
- package/dist/hooks/use-option-start-time-rule-mutation.d.ts +70 -0
- package/dist/hooks/use-option-start-time-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-start-time-rule-mutation.js +51 -0
- package/dist/hooks/use-option-start-time-rule.d.ts +17 -0
- package/dist/hooks/use-option-start-time-rule.d.ts.map +1 -0
- package/dist/hooks/use-option-start-time-rule.js +12 -0
- package/dist/hooks/use-option-start-time-rules.d.ts +23 -0
- package/dist/hooks/use-option-start-time-rules.d.ts.map +1 -0
- package/dist/hooks/use-option-start-time-rules.js +12 -0
- package/dist/hooks/use-option-unit-price-rule-mutation.d.ts +79 -0
- package/dist/hooks/use-option-unit-price-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-price-rule-mutation.js +54 -0
- package/dist/hooks/use-option-unit-price-rule.d.ts +19 -0
- package/dist/hooks/use-option-unit-price-rule.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-price-rule.js +12 -0
- package/dist/hooks/use-option-unit-price-rules.d.ts +25 -0
- package/dist/hooks/use-option-unit-price-rules.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-price-rules.js +12 -0
- package/dist/hooks/use-option-unit-tier-mutation.d.ts +50 -0
- package/dist/hooks/use-option-unit-tier-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-tier-mutation.js +48 -0
- package/dist/hooks/use-option-unit-tier.d.ts +14 -0
- package/dist/hooks/use-option-unit-tier.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-tier.js +12 -0
- package/dist/hooks/use-option-unit-tiers.d.ts +20 -0
- package/dist/hooks/use-option-unit-tiers.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-tiers.js +12 -0
- package/dist/hooks/use-pickup-price-rule-mutation.d.ts +64 -0
- package/dist/hooks/use-pickup-price-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-pickup-price-rule-mutation.js +50 -0
- package/dist/hooks/use-pickup-price-rule.d.ts +16 -0
- package/dist/hooks/use-pickup-price-rule.d.ts.map +1 -0
- package/dist/hooks/use-pickup-price-rule.js +12 -0
- package/dist/hooks/use-pickup-price-rules.d.ts +22 -0
- package/dist/hooks/use-pickup-price-rules.d.ts.map +1 -0
- package/dist/hooks/use-pickup-price-rules.js +12 -0
- package/dist/hooks/use-price-catalog-mutation.d.ts +60 -0
- package/dist/hooks/use-price-catalog-mutation.d.ts.map +1 -0
- package/dist/hooks/use-price-catalog-mutation.js +51 -0
- package/dist/hooks/use-price-catalog.d.ts +14 -0
- package/dist/hooks/use-price-catalog.d.ts.map +1 -0
- package/dist/hooks/use-price-catalog.js +12 -0
- package/dist/hooks/use-price-catalogs.d.ts +20 -0
- package/dist/hooks/use-price-catalogs.d.ts.map +1 -0
- package/dist/hooks/use-price-catalogs.js +12 -0
- package/dist/hooks/use-price-schedule-mutation.d.ts +76 -0
- package/dist/hooks/use-price-schedule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-price-schedule-mutation.js +64 -0
- package/dist/hooks/use-price-schedule.d.ts +18 -0
- package/dist/hooks/use-price-schedule.d.ts.map +1 -0
- package/dist/hooks/use-price-schedule.js +12 -0
- package/dist/hooks/use-price-schedules.d.ts +28 -0
- package/dist/hooks/use-price-schedules.d.ts.map +1 -0
- package/dist/hooks/use-price-schedules.js +11 -0
- package/dist/hooks/use-pricing-categories.d.ts +1 -1
- package/dist/hooks/use-pricing-categories.d.ts.map +1 -1
- package/dist/hooks/use-pricing-categories.js +2 -0
- package/dist/hooks/use-pricing-category-mutation.d.ts +2 -2
- package/dist/hooks/use-pricing-category.d.ts +1 -1
- package/dist/hooks/use-pricing-category.d.ts.map +1 -1
- package/dist/hooks/use-pricing-category.js +2 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/provider.d.ts +1 -13
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -16
- package/dist/query-keys.d.ts +116 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +33 -0
- package/dist/query-options.d.ts +1727 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +409 -0
- package/dist/schemas.d.ts +688 -3
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +165 -0
- package/package.json +42 -46
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const optionStartTimeRuleInputSchema: z.ZodObject<{
|
|
3
|
+
optionPriceRuleId: z.ZodString;
|
|
4
|
+
optionId: z.ZodString;
|
|
5
|
+
startTimeId: z.ZodString;
|
|
6
|
+
ruleMode: z.ZodEnum<{
|
|
7
|
+
override: "override";
|
|
8
|
+
included: "included";
|
|
9
|
+
excluded: "excluded";
|
|
10
|
+
adjustment: "adjustment";
|
|
11
|
+
}>;
|
|
12
|
+
adjustmentType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
13
|
+
fixed: "fixed";
|
|
14
|
+
percentage: "percentage";
|
|
15
|
+
}>>>;
|
|
16
|
+
sellAdjustmentCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
costAdjustmentCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
18
|
+
adjustmentBasisPoints: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type CreateOptionStartTimeRuleInput = z.input<typeof optionStartTimeRuleInputSchema>;
|
|
23
|
+
export type UpdateOptionStartTimeRuleInput = Partial<CreateOptionStartTimeRuleInput>;
|
|
24
|
+
export declare function useOptionStartTimeRuleMutation(): {
|
|
25
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
26
|
+
id: string;
|
|
27
|
+
optionPriceRuleId: string;
|
|
28
|
+
optionId: string;
|
|
29
|
+
startTimeId: string;
|
|
30
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
31
|
+
adjustmentType: "fixed" | "percentage" | null;
|
|
32
|
+
sellAdjustmentCents: number | null;
|
|
33
|
+
costAdjustmentCents: number | null;
|
|
34
|
+
adjustmentBasisPoints: number | null;
|
|
35
|
+
active: boolean;
|
|
36
|
+
notes: string | null;
|
|
37
|
+
}, Error, {
|
|
38
|
+
optionPriceRuleId: string;
|
|
39
|
+
optionId: string;
|
|
40
|
+
startTimeId: string;
|
|
41
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
42
|
+
adjustmentType?: "fixed" | "percentage" | null | undefined;
|
|
43
|
+
sellAdjustmentCents?: number | null | undefined;
|
|
44
|
+
costAdjustmentCents?: number | null | undefined;
|
|
45
|
+
adjustmentBasisPoints?: number | null | undefined;
|
|
46
|
+
active?: boolean | undefined;
|
|
47
|
+
notes?: string | null | undefined;
|
|
48
|
+
}, unknown>;
|
|
49
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
50
|
+
id: string;
|
|
51
|
+
optionPriceRuleId: string;
|
|
52
|
+
optionId: string;
|
|
53
|
+
startTimeId: string;
|
|
54
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
55
|
+
adjustmentType: "fixed" | "percentage" | null;
|
|
56
|
+
sellAdjustmentCents: number | null;
|
|
57
|
+
costAdjustmentCents: number | null;
|
|
58
|
+
adjustmentBasisPoints: number | null;
|
|
59
|
+
active: boolean;
|
|
60
|
+
notes: string | null;
|
|
61
|
+
}, Error, {
|
|
62
|
+
id: string;
|
|
63
|
+
input: UpdateOptionStartTimeRuleInput;
|
|
64
|
+
}, unknown>;
|
|
65
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
66
|
+
success: boolean;
|
|
67
|
+
}, Error, string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=use-option-start-time-rule-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-start-time-rule-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-start-time-rule-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;iBAWlC,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAC3F,MAAM,MAAM,8BAA8B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAA;AAEpF,wBAAgB,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBF,MAAM;eAAS,8BAA8B;;;;;EA8BxF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
6
|
+
import { pricingQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { optionStartTimeRuleSingleResponse, successEnvelope } from "../schemas.js";
|
|
8
|
+
const optionStartTimeRuleInputSchema = z.object({
|
|
9
|
+
optionPriceRuleId: z.string(),
|
|
10
|
+
optionId: z.string(),
|
|
11
|
+
startTimeId: z.string(),
|
|
12
|
+
ruleMode: z.enum(["included", "excluded", "override", "adjustment"]),
|
|
13
|
+
adjustmentType: z.enum(["fixed", "percentage"]).nullable().optional(),
|
|
14
|
+
sellAdjustmentCents: z.number().int().min(0).nullable().optional(),
|
|
15
|
+
costAdjustmentCents: z.number().int().min(0).nullable().optional(),
|
|
16
|
+
adjustmentBasisPoints: z.number().int().min(0).max(10000).nullable().optional(),
|
|
17
|
+
active: z.boolean().optional(),
|
|
18
|
+
notes: z.string().nullable().optional(),
|
|
19
|
+
});
|
|
20
|
+
export function useOptionStartTimeRuleMutation() {
|
|
21
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
22
|
+
const queryClient = useQueryClient();
|
|
23
|
+
const create = useMutation({
|
|
24
|
+
mutationFn: async (input) => {
|
|
25
|
+
const { data } = await fetchWithValidation("/v1/pricing/option-start-time-rules", optionStartTimeRuleSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
26
|
+
return data;
|
|
27
|
+
},
|
|
28
|
+
onSuccess: (data) => {
|
|
29
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionStartTimeRules() });
|
|
30
|
+
queryClient.setQueryData(pricingQueryKeys.optionStartTimeRule(data.id), data);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const update = useMutation({
|
|
34
|
+
mutationFn: async ({ id, input }) => {
|
|
35
|
+
const { data } = await fetchWithValidation(`/v1/pricing/option-start-time-rules/${id}`, optionStartTimeRuleSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
36
|
+
return data;
|
|
37
|
+
},
|
|
38
|
+
onSuccess: (data) => {
|
|
39
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionStartTimeRules() });
|
|
40
|
+
queryClient.setQueryData(pricingQueryKeys.optionStartTimeRule(data.id), data);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const remove = useMutation({
|
|
44
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/pricing/option-start-time-rules/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
45
|
+
onSuccess: (_data, id) => {
|
|
46
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionStartTimeRules() });
|
|
47
|
+
queryClient.removeQueries({ queryKey: pricingQueryKeys.optionStartTimeRule(id) });
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return { create, update, remove };
|
|
51
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface UseOptionStartTimeRuleOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useOptionStartTimeRule(id: string | null | undefined, options?: UseOptionStartTimeRuleOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
optionPriceRuleId: string;
|
|
7
|
+
optionId: string;
|
|
8
|
+
startTimeId: string;
|
|
9
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
10
|
+
adjustmentType: "fixed" | "percentage" | null;
|
|
11
|
+
sellAdjustmentCents: number | null;
|
|
12
|
+
costAdjustmentCents: number | null;
|
|
13
|
+
adjustmentBasisPoints: number | null;
|
|
14
|
+
active: boolean;
|
|
15
|
+
notes: string | null;
|
|
16
|
+
}, Error>;
|
|
17
|
+
//# sourceMappingURL=use-option-start-time-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-start-time-rule.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-start-time-rule.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,6BAAkC;;;;;;;;;;;;UAS5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionStartTimeRuleQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionStartTimeRule(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionStartTimeRuleQueryOptions({ baseUrl, fetcher }, id ?? "__missing__"),
|
|
10
|
+
enabled: enabled && Boolean(id),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OptionStartTimeRulesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseOptionStartTimeRulesOptions extends OptionStartTimeRulesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useOptionStartTimeRules(options?: UseOptionStartTimeRulesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
optionPriceRuleId: string;
|
|
9
|
+
optionId: string;
|
|
10
|
+
startTimeId: string;
|
|
11
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
12
|
+
adjustmentType: "fixed" | "percentage" | null;
|
|
13
|
+
sellAdjustmentCents: number | null;
|
|
14
|
+
costAdjustmentCents: number | null;
|
|
15
|
+
adjustmentBasisPoints: number | null;
|
|
16
|
+
active: boolean;
|
|
17
|
+
notes: string | null;
|
|
18
|
+
}[];
|
|
19
|
+
total: number;
|
|
20
|
+
limit: number;
|
|
21
|
+
offset: number;
|
|
22
|
+
}, Error>;
|
|
23
|
+
//# sourceMappingURL=use-option-start-time-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-start-time-rules.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-start-time-rules.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAA;AAGvE,MAAM,WAAW,8BAA+B,SAAQ,+BAA+B;IACrF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;;;UAQnF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionStartTimeRulesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionStartTimeRules(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionStartTimeRulesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const optionUnitPriceRuleInputSchema: z.ZodObject<{
|
|
3
|
+
optionPriceRuleId: z.ZodString;
|
|
4
|
+
optionId: z.ZodString;
|
|
5
|
+
unitId: z.ZodString;
|
|
6
|
+
pricingCategoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
pricingMode: z.ZodEnum<{
|
|
8
|
+
included: "included";
|
|
9
|
+
per_person: "per_person";
|
|
10
|
+
per_booking: "per_booking";
|
|
11
|
+
on_request: "on_request";
|
|
12
|
+
free: "free";
|
|
13
|
+
per_unit: "per_unit";
|
|
14
|
+
}>;
|
|
15
|
+
sellAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
|
+
costAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
minQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
18
|
+
maxQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type CreateOptionUnitPriceRuleInput = z.input<typeof optionUnitPriceRuleInputSchema>;
|
|
25
|
+
export type UpdateOptionUnitPriceRuleInput = Partial<CreateOptionUnitPriceRuleInput>;
|
|
26
|
+
export declare function useOptionUnitPriceRuleMutation(): {
|
|
27
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
28
|
+
id: string;
|
|
29
|
+
optionPriceRuleId: string;
|
|
30
|
+
optionId: string;
|
|
31
|
+
unitId: string;
|
|
32
|
+
pricingCategoryId: string | null;
|
|
33
|
+
pricingMode: "included" | "per_person" | "per_booking" | "on_request" | "free" | "per_unit";
|
|
34
|
+
sellAmountCents: number | null;
|
|
35
|
+
costAmountCents: number | null;
|
|
36
|
+
minQuantity: number | null;
|
|
37
|
+
maxQuantity: number | null;
|
|
38
|
+
sortOrder: number;
|
|
39
|
+
active: boolean;
|
|
40
|
+
notes: string | null;
|
|
41
|
+
}, Error, {
|
|
42
|
+
optionPriceRuleId: string;
|
|
43
|
+
optionId: string;
|
|
44
|
+
unitId: string;
|
|
45
|
+
pricingMode: "included" | "per_person" | "per_booking" | "on_request" | "free" | "per_unit";
|
|
46
|
+
pricingCategoryId?: string | null | undefined;
|
|
47
|
+
sellAmountCents?: number | null | undefined;
|
|
48
|
+
costAmountCents?: number | null | undefined;
|
|
49
|
+
minQuantity?: number | null | undefined;
|
|
50
|
+
maxQuantity?: number | null | undefined;
|
|
51
|
+
active?: boolean | undefined;
|
|
52
|
+
sortOrder?: number | undefined;
|
|
53
|
+
notes?: string | null | undefined;
|
|
54
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
55
|
+
}, unknown>;
|
|
56
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
57
|
+
id: string;
|
|
58
|
+
optionPriceRuleId: string;
|
|
59
|
+
optionId: string;
|
|
60
|
+
unitId: string;
|
|
61
|
+
pricingCategoryId: string | null;
|
|
62
|
+
pricingMode: "included" | "per_person" | "per_booking" | "on_request" | "free" | "per_unit";
|
|
63
|
+
sellAmountCents: number | null;
|
|
64
|
+
costAmountCents: number | null;
|
|
65
|
+
minQuantity: number | null;
|
|
66
|
+
maxQuantity: number | null;
|
|
67
|
+
sortOrder: number;
|
|
68
|
+
active: boolean;
|
|
69
|
+
notes: string | null;
|
|
70
|
+
}, Error, {
|
|
71
|
+
id: string;
|
|
72
|
+
input: UpdateOptionUnitPriceRuleInput;
|
|
73
|
+
}, unknown>;
|
|
74
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
75
|
+
success: boolean;
|
|
76
|
+
}, Error, string, unknown>;
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=use-option-unit-price-rule-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-price-rule-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-price-rule-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;iBAclC,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAC3F,MAAM,MAAM,8BAA8B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAA;AAEpF,wBAAgB,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBF,MAAM;eAAS,8BAA8B;;;;;EA8BxF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
6
|
+
import { pricingQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { optionUnitPriceRuleSingleResponse, successEnvelope } from "../schemas.js";
|
|
8
|
+
const optionUnitPriceRuleInputSchema = z.object({
|
|
9
|
+
optionPriceRuleId: z.string(),
|
|
10
|
+
optionId: z.string(),
|
|
11
|
+
unitId: z.string(),
|
|
12
|
+
pricingCategoryId: z.string().nullable().optional(),
|
|
13
|
+
pricingMode: z.enum(["per_unit", "per_person", "per_booking", "included", "free", "on_request"]),
|
|
14
|
+
sellAmountCents: z.number().int().min(0).nullable().optional(),
|
|
15
|
+
costAmountCents: z.number().int().min(0).nullable().optional(),
|
|
16
|
+
minQuantity: z.number().int().min(0).nullable().optional(),
|
|
17
|
+
maxQuantity: z.number().int().min(0).nullable().optional(),
|
|
18
|
+
active: z.boolean().optional(),
|
|
19
|
+
sortOrder: z.number().int().optional(),
|
|
20
|
+
notes: z.string().nullable().optional(),
|
|
21
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
22
|
+
});
|
|
23
|
+
export function useOptionUnitPriceRuleMutation() {
|
|
24
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
25
|
+
const queryClient = useQueryClient();
|
|
26
|
+
const create = useMutation({
|
|
27
|
+
mutationFn: async (input) => {
|
|
28
|
+
const { data } = await fetchWithValidation("/v1/pricing/option-unit-price-rules", optionUnitPriceRuleSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
29
|
+
return data;
|
|
30
|
+
},
|
|
31
|
+
onSuccess: (data) => {
|
|
32
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitPriceRules() });
|
|
33
|
+
queryClient.setQueryData(pricingQueryKeys.optionUnitPriceRule(data.id), data);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const update = useMutation({
|
|
37
|
+
mutationFn: async ({ id, input }) => {
|
|
38
|
+
const { data } = await fetchWithValidation(`/v1/pricing/option-unit-price-rules/${id}`, optionUnitPriceRuleSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
39
|
+
return data;
|
|
40
|
+
},
|
|
41
|
+
onSuccess: (data) => {
|
|
42
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitPriceRules() });
|
|
43
|
+
queryClient.setQueryData(pricingQueryKeys.optionUnitPriceRule(data.id), data);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const remove = useMutation({
|
|
47
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/pricing/option-unit-price-rules/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
48
|
+
onSuccess: (_data, id) => {
|
|
49
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitPriceRules() });
|
|
50
|
+
queryClient.removeQueries({ queryKey: pricingQueryKeys.optionUnitPriceRule(id) });
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
return { create, update, remove };
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UseOptionUnitPriceRuleOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useOptionUnitPriceRule(id: string | null | undefined, options?: UseOptionUnitPriceRuleOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
optionPriceRuleId: string;
|
|
7
|
+
optionId: string;
|
|
8
|
+
unitId: string;
|
|
9
|
+
pricingCategoryId: string | null;
|
|
10
|
+
pricingMode: "included" | "per_person" | "per_booking" | "on_request" | "free" | "per_unit";
|
|
11
|
+
sellAmountCents: number | null;
|
|
12
|
+
costAmountCents: number | null;
|
|
13
|
+
minQuantity: number | null;
|
|
14
|
+
maxQuantity: number | null;
|
|
15
|
+
sortOrder: number;
|
|
16
|
+
active: boolean;
|
|
17
|
+
notes: string | null;
|
|
18
|
+
}, Error>;
|
|
19
|
+
//# sourceMappingURL=use-option-unit-price-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-price-rule.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-price-rule.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,6BAAkC;;;;;;;;;;;;;;UAS5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitPriceRuleQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnitPriceRule(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitPriceRuleQueryOptions({ baseUrl, fetcher }, id ?? "__missing__"),
|
|
10
|
+
enabled: enabled && Boolean(id),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OptionUnitPriceRulesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseOptionUnitPriceRulesOptions extends OptionUnitPriceRulesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useOptionUnitPriceRules(options?: UseOptionUnitPriceRulesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
optionPriceRuleId: string;
|
|
9
|
+
optionId: string;
|
|
10
|
+
unitId: string;
|
|
11
|
+
pricingCategoryId: string | null;
|
|
12
|
+
pricingMode: "included" | "per_person" | "per_booking" | "on_request" | "free" | "per_unit";
|
|
13
|
+
sellAmountCents: number | null;
|
|
14
|
+
costAmountCents: number | null;
|
|
15
|
+
minQuantity: number | null;
|
|
16
|
+
maxQuantity: number | null;
|
|
17
|
+
sortOrder: number;
|
|
18
|
+
active: boolean;
|
|
19
|
+
notes: string | null;
|
|
20
|
+
}[];
|
|
21
|
+
total: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
}, Error>;
|
|
25
|
+
//# sourceMappingURL=use-option-unit-price-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-price-rules.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-price-rules.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAA;AAGvE,MAAM,WAAW,8BAA+B,SAAQ,+BAA+B;IACrF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;;;;;UAQnF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitPriceRulesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnitPriceRules(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitPriceRulesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const optionUnitTierInputSchema: z.ZodObject<{
|
|
3
|
+
optionUnitPriceRuleId: z.ZodString;
|
|
4
|
+
minQuantity: z.ZodNumber;
|
|
5
|
+
maxQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
6
|
+
sellAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
7
|
+
costAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
8
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type CreateOptionUnitTierInput = z.input<typeof optionUnitTierInputSchema>;
|
|
12
|
+
export type UpdateOptionUnitTierInput = Partial<CreateOptionUnitTierInput>;
|
|
13
|
+
export declare function useOptionUnitTierMutation(): {
|
|
14
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
15
|
+
id: string;
|
|
16
|
+
optionUnitPriceRuleId: string;
|
|
17
|
+
minQuantity: number;
|
|
18
|
+
maxQuantity: number | null;
|
|
19
|
+
sellAmountCents: number | null;
|
|
20
|
+
costAmountCents: number | null;
|
|
21
|
+
active: boolean;
|
|
22
|
+
sortOrder: number;
|
|
23
|
+
}, Error, {
|
|
24
|
+
optionUnitPriceRuleId: string;
|
|
25
|
+
minQuantity: number;
|
|
26
|
+
maxQuantity?: number | null | undefined;
|
|
27
|
+
sellAmountCents?: number | null | undefined;
|
|
28
|
+
costAmountCents?: number | null | undefined;
|
|
29
|
+
active?: boolean | undefined;
|
|
30
|
+
sortOrder?: number | undefined;
|
|
31
|
+
}, unknown>;
|
|
32
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
33
|
+
id: string;
|
|
34
|
+
optionUnitPriceRuleId: string;
|
|
35
|
+
minQuantity: number;
|
|
36
|
+
maxQuantity: number | null;
|
|
37
|
+
sellAmountCents: number | null;
|
|
38
|
+
costAmountCents: number | null;
|
|
39
|
+
active: boolean;
|
|
40
|
+
sortOrder: number;
|
|
41
|
+
}, Error, {
|
|
42
|
+
id: string;
|
|
43
|
+
input: UpdateOptionUnitTierInput;
|
|
44
|
+
}, unknown>;
|
|
45
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
46
|
+
success: boolean;
|
|
47
|
+
}, Error, string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=use-option-unit-tier-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-tier-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-tier-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,QAAA,MAAM,yBAAyB;;;;;;;;iBAQ7B,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AACjF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAE1E,wBAAgB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBG,MAAM;eAAS,yBAAyB;;;;;EA8BnF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
6
|
+
import { pricingQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { optionUnitTierSingleResponse, successEnvelope } from "../schemas.js";
|
|
8
|
+
const optionUnitTierInputSchema = z.object({
|
|
9
|
+
optionUnitPriceRuleId: z.string(),
|
|
10
|
+
minQuantity: z.number().int().min(1),
|
|
11
|
+
maxQuantity: z.number().int().min(1).nullable().optional(),
|
|
12
|
+
sellAmountCents: z.number().int().min(0).nullable().optional(),
|
|
13
|
+
costAmountCents: z.number().int().min(0).nullable().optional(),
|
|
14
|
+
active: z.boolean().optional(),
|
|
15
|
+
sortOrder: z.number().int().optional(),
|
|
16
|
+
});
|
|
17
|
+
export function useOptionUnitTierMutation() {
|
|
18
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
19
|
+
const queryClient = useQueryClient();
|
|
20
|
+
const create = useMutation({
|
|
21
|
+
mutationFn: async (input) => {
|
|
22
|
+
const { data } = await fetchWithValidation("/v1/pricing/option-unit-tiers", optionUnitTierSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitTiers() });
|
|
27
|
+
queryClient.setQueryData(pricingQueryKeys.optionUnitTier(data.id), data);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const update = useMutation({
|
|
31
|
+
mutationFn: async ({ id, input }) => {
|
|
32
|
+
const { data } = await fetchWithValidation(`/v1/pricing/option-unit-tiers/${id}`, optionUnitTierSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
33
|
+
return data;
|
|
34
|
+
},
|
|
35
|
+
onSuccess: (data) => {
|
|
36
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitTiers() });
|
|
37
|
+
queryClient.setQueryData(pricingQueryKeys.optionUnitTier(data.id), data);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const remove = useMutation({
|
|
41
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/pricing/option-unit-tiers/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
42
|
+
onSuccess: (_data, id) => {
|
|
43
|
+
void queryClient.invalidateQueries({ queryKey: pricingQueryKeys.optionUnitTiers() });
|
|
44
|
+
queryClient.removeQueries({ queryKey: pricingQueryKeys.optionUnitTier(id) });
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return { create, update, remove };
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UseOptionUnitTierOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useOptionUnitTier(id: string | null | undefined, options?: UseOptionUnitTierOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
optionUnitPriceRuleId: string;
|
|
7
|
+
minQuantity: number;
|
|
8
|
+
maxQuantity: number | null;
|
|
9
|
+
sellAmountCents: number | null;
|
|
10
|
+
costAmountCents: number | null;
|
|
11
|
+
active: boolean;
|
|
12
|
+
sortOrder: number;
|
|
13
|
+
}, Error>;
|
|
14
|
+
//# sourceMappingURL=use-option-unit-tier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-tier.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-tier.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,wBAA6B;;;;;;;;;UASvC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitTierQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnitTier(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitTierQueryOptions({ baseUrl, fetcher }, id ?? "__missing__"),
|
|
10
|
+
enabled: enabled && Boolean(id),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OptionUnitTiersListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseOptionUnitTiersOptions extends OptionUnitTiersListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useOptionUnitTiers(options?: UseOptionUnitTiersOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
optionUnitPriceRuleId: string;
|
|
9
|
+
minQuantity: number;
|
|
10
|
+
maxQuantity: number | null;
|
|
11
|
+
sellAmountCents: number | null;
|
|
12
|
+
costAmountCents: number | null;
|
|
13
|
+
active: boolean;
|
|
14
|
+
sortOrder: number;
|
|
15
|
+
}[];
|
|
16
|
+
total: number;
|
|
17
|
+
limit: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
}, Error>;
|
|
20
|
+
//# sourceMappingURL=use-option-unit-tiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-tiers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-tiers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAGlE,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B;;;;;;;;;;;;;;UAQzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantPricingContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitTiersQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnitTiers(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantPricingContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitTiersQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|