@voyantjs/legal-react 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +58 -0
- package/dist/hooks/index.d.ts +25 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +24 -0
- package/dist/hooks/use-contract-attachment-mutation.d.ts +53 -0
- package/dist/hooks/use-contract-attachment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-attachment-mutation.js +41 -0
- package/dist/hooks/use-contract-attachments.d.ts +17 -0
- package/dist/hooks/use-contract-attachments.d.ts.map +1 -0
- package/dist/hooks/use-contract-attachments.js +12 -0
- package/dist/hooks/use-contract-mutation.d.ts +191 -0
- package/dist/hooks/use-contract-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-mutation.js +82 -0
- package/dist/hooks/use-contract-signature-mutation.d.ts +29 -0
- package/dist/hooks/use-contract-signature-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-signature-mutation.js +23 -0
- package/dist/hooks/use-contract-signatures.d.ts +22 -0
- package/dist/hooks/use-contract-signatures.d.ts.map +1 -0
- package/dist/hooks/use-contract-signatures.js +12 -0
- package/dist/hooks/use-contract-template-mutation.d.ts +53 -0
- package/dist/hooks/use-contract-template-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-template-mutation.js +39 -0
- package/dist/hooks/use-contract-template-version-mutation.d.ts +23 -0
- package/dist/hooks/use-contract-template-version-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-template-version-mutation.js +22 -0
- package/dist/hooks/use-contract-template-versions.d.ts +16 -0
- package/dist/hooks/use-contract-template-versions.d.ts.map +1 -0
- package/dist/hooks/use-contract-template-versions.js +12 -0
- package/dist/hooks/use-contract-template.d.ts +19 -0
- package/dist/hooks/use-contract-template.d.ts.map +1 -0
- package/dist/hooks/use-contract-template.js +12 -0
- package/dist/hooks/use-contract-templates.d.ts +25 -0
- package/dist/hooks/use-contract-templates.d.ts.map +1 -0
- package/dist/hooks/use-contract-templates.js +12 -0
- package/dist/hooks/use-contract.d.ts +31 -0
- package/dist/hooks/use-contract.d.ts.map +1 -0
- package/dist/hooks/use-contract.js +12 -0
- package/dist/hooks/use-contracts.d.ts +37 -0
- package/dist/hooks/use-contracts.d.ts.map +1 -0
- package/dist/hooks/use-contracts.js +12 -0
- package/dist/hooks/use-number-series-mutation.d.ts +52 -0
- package/dist/hooks/use-number-series-mutation.d.ts.map +1 -0
- package/dist/hooks/use-number-series-mutation.js +38 -0
- package/dist/hooks/use-number-series.d.ts +25 -0
- package/dist/hooks/use-number-series.d.ts.map +1 -0
- package/dist/hooks/use-number-series.js +12 -0
- package/dist/hooks/use-policies.d.ts +22 -0
- package/dist/hooks/use-policies.d.ts.map +1 -0
- package/dist/hooks/use-policies.js +12 -0
- package/dist/hooks/use-policy-acceptances.d.ts +22 -0
- package/dist/hooks/use-policy-acceptances.d.ts.map +1 -0
- package/dist/hooks/use-policy-acceptances.js +12 -0
- package/dist/hooks/use-policy-assignment-mutation.d.ts +63 -0
- package/dist/hooks/use-policy-assignment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-policy-assignment-mutation.js +41 -0
- package/dist/hooks/use-policy-assignments.d.ts +23 -0
- package/dist/hooks/use-policy-assignments.d.ts.map +1 -0
- package/dist/hooks/use-policy-assignments.js +12 -0
- package/dist/hooks/use-policy-mutation.d.ts +44 -0
- package/dist/hooks/use-policy-mutation.d.ts.map +1 -0
- package/dist/hooks/use-policy-mutation.js +40 -0
- package/dist/hooks/use-policy-rule-mutation.d.ts +56 -0
- package/dist/hooks/use-policy-rule-mutation.d.ts.map +1 -0
- package/dist/hooks/use-policy-rule-mutation.js +39 -0
- package/dist/hooks/use-policy-rules.d.ts +22 -0
- package/dist/hooks/use-policy-rules.d.ts.map +1 -0
- package/dist/hooks/use-policy-rules.js +12 -0
- package/dist/hooks/use-policy-version-mutation.d.ts +73 -0
- package/dist/hooks/use-policy-version-mutation.d.ts.map +1 -0
- package/dist/hooks/use-policy-version-mutation.js +50 -0
- package/dist/hooks/use-policy-versions.d.ts +20 -0
- package/dist/hooks/use-policy-versions.d.ts.map +1 -0
- package/dist/hooks/use-policy-versions.js +12 -0
- package/dist/hooks/use-policy.d.ts +16 -0
- package/dist/hooks/use-policy.d.ts.map +1 -0
- package/dist/hooks/use-policy.js +12 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +68 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +22 -0
- package/dist/query-options.d.ts +1200 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +152 -0
- package/dist/schemas.d.ts +779 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +163 -0
- package/package.json +79 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { insertContractTemplateSchema, updateContractTemplateSchema } from "@voyantjs/legal/contracts/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalContractTemplateInput = z.input<typeof insertContractTemplateSchema>;
|
|
4
|
+
export type UpdateLegalContractTemplateInput = z.input<typeof updateContractTemplateSchema>;
|
|
5
|
+
export declare function useLegalContractTemplateMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
10
|
+
language: string;
|
|
11
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
12
|
+
body: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
id: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
19
|
+
currentVersionId?: string | null | undefined;
|
|
20
|
+
}, Error, {
|
|
21
|
+
name: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
24
|
+
body: string;
|
|
25
|
+
language?: string | undefined;
|
|
26
|
+
description?: string | null | undefined;
|
|
27
|
+
bodyFormat?: "markdown" | "html" | "lexical_json" | undefined;
|
|
28
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
29
|
+
active?: boolean | undefined;
|
|
30
|
+
}, unknown>;
|
|
31
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
name: string;
|
|
33
|
+
slug: string;
|
|
34
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
35
|
+
language: string;
|
|
36
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
37
|
+
body: string;
|
|
38
|
+
active: boolean;
|
|
39
|
+
id: string;
|
|
40
|
+
description: string | null;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
44
|
+
currentVersionId?: string | null | undefined;
|
|
45
|
+
}, Error, {
|
|
46
|
+
id: string;
|
|
47
|
+
input: UpdateLegalContractTemplateInput;
|
|
48
|
+
}, unknown>;
|
|
49
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
}, Error, string, unknown>;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=use-contract-template-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-template-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-template-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAC3F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAE3F,wBAAgB,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBJ,MAAM;eAAS,gCAAgC;;;;;EA+B1F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
5
|
+
import { legalQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { legalContractTemplateSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useLegalContractTemplateMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/admin/legal/contracts/templates", legalContractTemplateSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.templates() });
|
|
17
|
+
queryClient.setQueryData(legalQueryKeys.template(data.id), data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/templates/${id}`, legalContractTemplateSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.templates() });
|
|
27
|
+
queryClient.setQueryData(legalQueryKeys.template(data.id), data);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/admin/legal/contracts/templates/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.templates() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.template(id) });
|
|
35
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.templateVersions(id) });
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return { create, update, remove };
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { insertContractTemplateVersionSchema } from "@voyantjs/legal/contracts/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalContractTemplateVersionInput = z.input<typeof insertContractTemplateVersionSchema>;
|
|
4
|
+
export declare function useLegalContractTemplateVersionMutation(): {
|
|
5
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
6
|
+
templateId: string;
|
|
7
|
+
data: {
|
|
8
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
9
|
+
body: string;
|
|
10
|
+
id: string;
|
|
11
|
+
templateId: string;
|
|
12
|
+
version: number;
|
|
13
|
+
changelog: string | null;
|
|
14
|
+
createdBy: string | null;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
}, Error, {
|
|
19
|
+
templateId: string;
|
|
20
|
+
input: CreateLegalContractTemplateVersionInput;
|
|
21
|
+
}, unknown>;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=use-contract-template-version-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-template-version-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-template-version-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAA;AAC/F,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,mCAAmC,CAC3C,CAAA;AAED,wBAAgB,uCAAuC;;;;;;;;;;;;;;;oBASrC,MAAM;eACX,uCAAuC;;EAkBnD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
5
|
+
import { legalQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { legalContractTemplateVersionRecordSchema } from "../schemas.js";
|
|
7
|
+
export function useLegalContractTemplateVersionMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async ({ templateId, input, }) => {
|
|
12
|
+
const data = await fetchWithValidation(`/v1/admin/legal/contracts/templates/${templateId}/versions`, legalContractTemplateVersionRecordSchema, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return { templateId, data };
|
|
14
|
+
},
|
|
15
|
+
onSuccess: ({ templateId }) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.templates() });
|
|
17
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.template(templateId) });
|
|
18
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.templateVersions(templateId) });
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return { create };
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseLegalContractTemplateVersionsOptions {
|
|
2
|
+
templateId: string;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContractTemplateVersions(options: UseLegalContractTemplateVersionsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
7
|
+
body: string;
|
|
8
|
+
id: string;
|
|
9
|
+
templateId: string;
|
|
10
|
+
version: number;
|
|
11
|
+
changelog: string | null;
|
|
12
|
+
createdBy: string | null;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
15
|
+
}[], Error>;
|
|
16
|
+
//# sourceMappingURL=use-contract-template-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-template-versions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-template-versions.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,uCAAuC;IACtD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,uCAAuC;;;;;;;;;;YAQhG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractTemplateVersionsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContractTemplateVersions(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractTemplateVersionsQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UseLegalContractTemplateOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useLegalContractTemplate(id: string, options?: UseLegalContractTemplateOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
8
|
+
language: string;
|
|
9
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
10
|
+
body: string;
|
|
11
|
+
active: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
description: string | null;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
17
|
+
currentVersionId?: string | null | undefined;
|
|
18
|
+
}, Error>;
|
|
19
|
+
//# sourceMappingURL=use-contract-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-template.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-template.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,+BAA+B;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,+BAAoC;;;;;;;;;;;;;;UAS9C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractTemplateQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContractTemplate(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractTemplateQueryOptions({ baseUrl, fetcher }, id),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LegalContractTemplatesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalContractTemplatesOptions extends LegalContractTemplatesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContractTemplates(options?: UseLegalContractTemplatesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
10
|
+
language: string;
|
|
11
|
+
bodyFormat: "markdown" | "html" | "lexical_json";
|
|
12
|
+
body: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
id: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
19
|
+
currentVersionId?: string | null | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
total: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
}, Error>;
|
|
25
|
+
//# sourceMappingURL=use-contract-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-templates.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-templates.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAA;AAGzE,MAAM,WAAW,gCAAiC,SAAQ,iCAAiC;IACzF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,gCAAqC;;;;;;;;;;;;;;;;;;;UAQvF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractTemplatesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContractTemplates(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractTemplatesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface UseLegalContractOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useLegalContract(id: string, options?: UseLegalContractOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
6
|
+
status: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
7
|
+
title: string;
|
|
8
|
+
language: string;
|
|
9
|
+
id: string;
|
|
10
|
+
contractNumber: string | null;
|
|
11
|
+
templateVersionId: string | null;
|
|
12
|
+
seriesId: string | null;
|
|
13
|
+
personId: string | null;
|
|
14
|
+
organizationId: string | null;
|
|
15
|
+
supplierId: string | null;
|
|
16
|
+
channelId: string | null;
|
|
17
|
+
bookingId: string | null;
|
|
18
|
+
orderId: string | null;
|
|
19
|
+
renderedBodyFormat: "markdown" | "html" | "lexical_json";
|
|
20
|
+
renderedBody: string | null;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
variables?: Record<string, unknown> | null | undefined;
|
|
24
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
25
|
+
issuedAt?: string | null | undefined;
|
|
26
|
+
sentAt?: string | null | undefined;
|
|
27
|
+
executedAt?: string | null | undefined;
|
|
28
|
+
expiresAt?: string | null | undefined;
|
|
29
|
+
voidedAt?: string | null | undefined;
|
|
30
|
+
}, Error>;
|
|
31
|
+
//# sourceMappingURL=use-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;UAQjF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContract(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractQueryOptions({ baseUrl, fetcher }, id),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LegalContractsListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalContractsOptions extends LegalContractsListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContracts(options?: UseLegalContractsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
8
|
+
status: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
9
|
+
title: string;
|
|
10
|
+
language: string;
|
|
11
|
+
id: string;
|
|
12
|
+
contractNumber: string | null;
|
|
13
|
+
templateVersionId: string | null;
|
|
14
|
+
seriesId: string | null;
|
|
15
|
+
personId: string | null;
|
|
16
|
+
organizationId: string | null;
|
|
17
|
+
supplierId: string | null;
|
|
18
|
+
channelId: string | null;
|
|
19
|
+
bookingId: string | null;
|
|
20
|
+
orderId: string | null;
|
|
21
|
+
renderedBodyFormat: "markdown" | "html" | "lexical_json";
|
|
22
|
+
renderedBody: string | null;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
variables?: Record<string, unknown> | null | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
27
|
+
issuedAt?: string | null | undefined;
|
|
28
|
+
sentAt?: string | null | undefined;
|
|
29
|
+
executedAt?: string | null | undefined;
|
|
30
|
+
expiresAt?: string | null | undefined;
|
|
31
|
+
voidedAt?: string | null | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
total: number;
|
|
34
|
+
limit: number;
|
|
35
|
+
offset: number;
|
|
36
|
+
}, Error>;
|
|
37
|
+
//# sourceMappingURL=use-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contracts.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contracts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAGjE,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContracts(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractsQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { insertContractNumberSeriesSchema, updateContractNumberSeriesSchema } from "@voyantjs/legal/contracts/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalContractNumberSeriesInput = z.input<typeof insertContractNumberSeriesSchema>;
|
|
4
|
+
export type UpdateLegalContractNumberSeriesInput = z.input<typeof updateContractNumberSeriesSchema>;
|
|
5
|
+
export declare function useLegalContractNumberSeriesMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
prefix: string;
|
|
10
|
+
separator: string;
|
|
11
|
+
padLength: number;
|
|
12
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
13
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
14
|
+
active: boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
currentSequence: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
resetAt?: string | null | undefined;
|
|
20
|
+
}, Error, {
|
|
21
|
+
code: string;
|
|
22
|
+
name: string;
|
|
23
|
+
prefix?: string | undefined;
|
|
24
|
+
separator?: string | undefined;
|
|
25
|
+
padLength?: number | undefined;
|
|
26
|
+
resetStrategy?: "never" | "annual" | "monthly" | undefined;
|
|
27
|
+
scope?: "other" | "customer" | "supplier" | "partner" | "channel" | undefined;
|
|
28
|
+
active?: boolean | undefined;
|
|
29
|
+
}, unknown>;
|
|
30
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
31
|
+
code: string;
|
|
32
|
+
name: string;
|
|
33
|
+
prefix: string;
|
|
34
|
+
separator: string;
|
|
35
|
+
padLength: number;
|
|
36
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
37
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
38
|
+
active: boolean;
|
|
39
|
+
id: string;
|
|
40
|
+
currentSequence: number;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
resetAt?: string | null | undefined;
|
|
44
|
+
}, Error, {
|
|
45
|
+
id: string;
|
|
46
|
+
input: UpdateLegalContractNumberSeriesInput;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
}, Error, string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=use-number-series-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-number-series-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-number-series-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gCAAgC,EAChC,gCAAgC,EACjC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAM5B,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACnG,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEnG,wBAAgB,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyB1C,MAAM;eACH,oCAAoC;;;;;EA+BhD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
5
|
+
import { legalQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { legalContractNumberSeriesSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useLegalContractNumberSeriesMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/admin/legal/contracts/number-series", legalContractNumberSeriesSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.numberSeries() });
|
|
17
|
+
queryClient.setQueryData(legalQueryKeys.numberSeriesDetail(data.id), data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input, }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/number-series/${id}`, legalContractNumberSeriesSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.numberSeries() });
|
|
27
|
+
queryClient.setQueryData(legalQueryKeys.numberSeriesDetail(data.id), data);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/admin/legal/contracts/number-series/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
32
|
+
onSuccess: (_data, id) => {
|
|
33
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.numberSeries() });
|
|
34
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.numberSeriesDetail(id) });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return { create, update, remove };
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LegalContractNumberSeriesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalContractNumberSeriesOptions extends LegalContractNumberSeriesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContractNumberSeries(options?: UseLegalContractNumberSeriesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
prefix: string;
|
|
10
|
+
separator: string;
|
|
11
|
+
padLength: number;
|
|
12
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
13
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
14
|
+
active: boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
currentSequence: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
resetAt?: string | null | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
total: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
}, Error>;
|
|
25
|
+
//# sourceMappingURL=use-number-series.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-number-series.d.ts","sourceRoot":"","sources":["../../src/hooks/use-number-series.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,kBAAkB,CAAA;AAG5E,MAAM,WAAW,mCAAoC,SAAQ,oCAAoC;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,4BAA4B,CAAC,OAAO,GAAE,mCAAwC;;;;;;;;;;;;;;;;;;;UAO7F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractNumberSeriesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContractNumberSeries(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractNumberSeriesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LegalPoliciesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalPoliciesOptions extends LegalPoliciesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalPolicies(options?: UseLegalPoliciesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
kind: "other" | "cancellation" | "payment" | "terms_and_conditions" | "privacy" | "refund" | "commission" | "guarantee";
|
|
8
|
+
name: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
language: string;
|
|
11
|
+
id: string;
|
|
12
|
+
description: string | null;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
16
|
+
currentVersionId?: string | null | undefined;
|
|
17
|
+
}[];
|
|
18
|
+
total: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
offset: number;
|
|
21
|
+
}, Error>;
|
|
22
|
+
//# sourceMappingURL=use-policies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-policies.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policies.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAGhE,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACvE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;UAOrE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalPoliciesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalPolicies(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalPoliciesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LegalPolicyAcceptancesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalPolicyAcceptancesOptions extends LegalPolicyAcceptancesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalPolicyAcceptances(options?: UseLegalPolicyAcceptancesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
policyVersionId: string;
|
|
9
|
+
personId: string | null;
|
|
10
|
+
bookingId: string | null;
|
|
11
|
+
acceptedAt: string;
|
|
12
|
+
method: "implicit" | "explicit_checkbox" | "signature";
|
|
13
|
+
createdAt: string;
|
|
14
|
+
orderId?: string | null | undefined;
|
|
15
|
+
offerId?: string | null | undefined;
|
|
16
|
+
acceptedBy?: string | null | undefined;
|
|
17
|
+
ipAddress?: string | null | undefined;
|
|
18
|
+
userAgent?: string | null | undefined;
|
|
19
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
}, Error>;
|
|
22
|
+
//# sourceMappingURL=use-policy-acceptances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-policy-acceptances.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-acceptances.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAA;AAGzE,MAAM,WAAW,gCAAiC,SAAQ,iCAAiC;IACzF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,gCAAqC;;;;;;;;;;;;;;;;UAOvF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalPolicyAcceptancesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalPolicyAcceptances(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalPolicyAcceptancesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|