@voyant-travel/legal-react 0.119.2
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 +201 -0
- package/README.md +66 -0
- package/dist/admin/contract-detail-host.d.ts +21 -0
- package/dist/admin/contract-detail-host.d.ts.map +1 -0
- package/dist/admin/contract-detail-host.js +118 -0
- package/dist/admin/contract-dialog-fields.d.ts +79 -0
- package/dist/admin/contract-dialog-fields.d.ts.map +1 -0
- package/dist/admin/contract-dialog-fields.js +178 -0
- package/dist/admin/contract-dialog.d.ts +4 -0
- package/dist/admin/contract-dialog.d.ts.map +1 -0
- package/dist/admin/contract-dialog.js +479 -0
- package/dist/admin/contract-upload-field.d.ts +12 -0
- package/dist/admin/contract-upload-field.d.ts.map +1 -0
- package/dist/admin/contract-upload-field.js +31 -0
- package/dist/admin/contracts-host.d.ts +10 -0
- package/dist/admin/contracts-host.d.ts.map +1 -0
- package/dist/admin/contracts-host.js +32 -0
- package/dist/admin/index.d.ts +78 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +193 -0
- package/dist/admin/legal-admin-shared.d.ts +31 -0
- package/dist/admin/legal-admin-shared.d.ts.map +1 -0
- package/dist/admin/legal-admin-shared.js +48 -0
- package/dist/admin/number-series-dialog.d.ts +11 -0
- package/dist/admin/number-series-dialog.d.ts.map +1 -0
- package/dist/admin/number-series-dialog.js +110 -0
- package/dist/admin/number-series-host.d.ts +7 -0
- package/dist/admin/number-series-host.d.ts.map +1 -0
- package/dist/admin/number-series-host.js +12 -0
- package/dist/admin/pages/contract-detail-page.d.ts +7 -0
- package/dist/admin/pages/contract-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/contract-detail-page.js +9 -0
- package/dist/admin/pages/policy-detail-page.d.ts +7 -0
- package/dist/admin/pages/policy-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/policy-detail-page.js +9 -0
- package/dist/admin/pages/template-detail-page.d.ts +7 -0
- package/dist/admin/pages/template-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/template-detail-page.js +9 -0
- package/dist/admin/policies-host.d.ts +9 -0
- package/dist/admin/policies-host.d.ts.map +1 -0
- package/dist/admin/policies-host.js +16 -0
- package/dist/admin/policy-assignment-dialog.d.ts +11 -0
- package/dist/admin/policy-assignment-dialog.d.ts.map +1 -0
- package/dist/admin/policy-assignment-dialog.js +234 -0
- package/dist/admin/policy-detail-host.d.ts +12 -0
- package/dist/admin/policy-detail-host.d.ts.map +1 -0
- package/dist/admin/policy-detail-host.js +17 -0
- package/dist/admin/policy-dialog.d.ts +10 -0
- package/dist/admin/policy-dialog.d.ts.map +1 -0
- package/dist/admin/policy-dialog.js +81 -0
- package/dist/admin/template-detail-host.d.ts +11 -0
- package/dist/admin/template-detail-host.d.ts.map +1 -0
- package/dist/admin/template-detail-host.js +20 -0
- package/dist/admin/template-dialog.d.ts +10 -0
- package/dist/admin/template-dialog.d.ts.map +1 -0
- package/dist/admin/template-dialog.js +117 -0
- package/dist/admin/template-version-dialog.d.ts +9 -0
- package/dist/admin/template-version-dialog.d.ts.map +1 -0
- package/dist/admin/template-version-dialog.js +67 -0
- package/dist/admin/templates-host.d.ts +9 -0
- package/dist/admin/templates-host.d.ts.map +1 -0
- package/dist/admin/templates-host.js +20 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +69 -0
- package/dist/components/attachment-dialog.d.ts +11 -0
- package/dist/components/attachment-dialog.d.ts.map +1 -0
- package/dist/components/attachment-dialog.js +154 -0
- package/dist/components/booking-contract-card.d.ts +37 -0
- package/dist/components/booking-contract-card.d.ts.map +1 -0
- package/dist/components/booking-contract-card.js +101 -0
- package/dist/components/contract-detail-page.d.ts +36 -0
- package/dist/components/contract-detail-page.d.ts.map +1 -0
- package/dist/components/contract-detail-page.js +156 -0
- package/dist/components/contract-dialog-fields.d.ts +114 -0
- package/dist/components/contract-dialog-fields.d.ts.map +1 -0
- package/dist/components/contract-dialog-fields.js +233 -0
- package/dist/components/contract-dialog.d.ts +5 -0
- package/dist/components/contract-dialog.d.ts.map +1 -0
- package/dist/components/contract-dialog.js +345 -0
- package/dist/components/contract-send-dialog.d.ts +37 -0
- package/dist/components/contract-send-dialog.d.ts.map +1 -0
- package/dist/components/contract-send-dialog.js +56 -0
- package/dist/components/contracts-page.d.ts +30 -0
- package/dist/components/contracts-page.d.ts.map +1 -0
- package/dist/components/contracts-page.js +192 -0
- package/dist/components/number-series-page.d.ts +13 -0
- package/dist/components/number-series-page.d.ts.map +1 -0
- package/dist/components/number-series-page.js +37 -0
- package/dist/components/policies-page.d.ts +13 -0
- package/dist/components/policies-page.d.ts.map +1 -0
- package/dist/components/policies-page.js +70 -0
- package/dist/components/policy-detail-page.d.ts +23 -0
- package/dist/components/policy-detail-page.d.ts.map +1 -0
- package/dist/components/policy-detail-page.js +171 -0
- package/dist/components/policy-rule-dialog.d.ts +12 -0
- package/dist/components/policy-rule-dialog.d.ts.map +1 -0
- package/dist/components/policy-rule-dialog.js +101 -0
- package/dist/components/policy-version-dialog.d.ts +11 -0
- package/dist/components/policy-version-dialog.d.ts.map +1 -0
- package/dist/components/policy-version-dialog.js +62 -0
- package/dist/components/signature-dialog.d.ts +9 -0
- package/dist/components/signature-dialog.d.ts.map +1 -0
- package/dist/components/signature-dialog.js +64 -0
- package/dist/components/template-detail-page.d.ts +10 -0
- package/dist/components/template-detail-page.d.ts.map +1 -0
- package/dist/components/template-detail-page.js +84 -0
- package/dist/components/templates-page.d.ts +27 -0
- package/dist/components/templates-page.d.ts.map +1 -0
- package/dist/components/templates-page.js +65 -0
- package/dist/hooks/index.d.ts +31 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +30 -0
- package/dist/hooks/use-contract-attachment-mutation.d.ts +119 -0
- package/dist/hooks/use-contract-attachment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-attachment-mutation.js +72 -0
- package/dist/hooks/use-contract-attachments.d.ts +23 -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 +427 -0
- package/dist/hooks/use-contract-mutation.d.ts.map +1 -0
- package/dist/hooks/use-contract-mutation.js +151 -0
- package/dist/hooks/use-contract-signature-mutation.d.ts +35 -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 +28 -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-authoring.d.ts +5 -0
- package/dist/hooks/use-contract-template-authoring.d.ts.map +1 -0
- package/dist/hooks/use-contract-template-authoring.js +7 -0
- package/dist/hooks/use-contract-template-mutation.d.ts +56 -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 +22 -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 +15 -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 +20 -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 +26 -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 +47 -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 +53 -0
- package/dist/hooks/use-contracts.d.ts.map +1 -0
- package/dist/hooks/use-contracts.js +12 -0
- package/dist/hooks/use-default-contract-template.d.ts +21 -0
- package/dist/hooks/use-default-contract-template.d.ts.map +1 -0
- package/dist/hooks/use-default-contract-template.js +12 -0
- package/dist/hooks/use-evaluate-cancellation.d.ts +46 -0
- package/dist/hooks/use-evaluate-cancellation.d.ts.map +1 -0
- package/dist/hooks/use-evaluate-cancellation.js +43 -0
- package/dist/hooks/use-number-series-mutation.d.ts +58 -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 +24 -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 +26 -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 +69 -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 +19 -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/hooks/use-resolve-policy.d.ts +72 -0
- package/dist/hooks/use-resolve-policy.d.ts.map +1 -0
- package/dist/hooks/use-resolve-policy.js +16 -0
- package/dist/hooks/use-term.d.ts +27 -0
- package/dist/hooks/use-term.d.ts.map +1 -0
- package/dist/hooks/use-term.js +12 -0
- package/dist/hooks/use-terms.d.ts +33 -0
- package/dist/hooks/use-terms.d.ts.map +1 -0
- package/dist/hooks/use-terms.js +12 -0
- package/dist/i18n/en.d.ts +548 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +547 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/messages.d.ts +504 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +29 -0
- package/dist/i18n/provider.d.ts +1118 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro.d.ts +548 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +547 -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 +120 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +27 -0
- package/dist/query-options.d.ts +1929 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +183 -0
- package/dist/schemas.d.ts +1547 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +269 -0
- package/dist/ui.d.ts +16 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +15 -0
- package/package.json +159 -0
- package/src/styles.css +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,2CAA2C,CAAA;AAClD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAY5B,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAC3E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAC3E,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AACpG,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,qCAAqC,CAC7C,CAAA;AAED,MAAM,WAAW,0BAA0B;IACzC,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,0BAA0B,CAAA;CACnC;AAED,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBI,MAAM;eAAS,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkHzE,MAAM;gBACF,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BtC,MAAM;gBACF,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAwB/B,MAAM;gBACT,iCAAiC;;EAkC9C"}
|
|
@@ -0,0 +1,151 @@
|
|
|
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 { legalBookingContractGenerateDocumentResponse, legalContractGenerateDocumentResponse, legalContractSingleResponse, successEnvelope, } from "../schemas.js";
|
|
7
|
+
export function useLegalContractMutation() {
|
|
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", legalContractSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
17
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}`, legalContractSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
27
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/admin/legal/contracts/${id}`, successEnvelope, { baseUrl, fetcher }, {
|
|
32
|
+
method: "DELETE",
|
|
33
|
+
}),
|
|
34
|
+
onSuccess: (_data, id) => {
|
|
35
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
36
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.contract(id) });
|
|
37
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.contractSignatures(id) });
|
|
38
|
+
queryClient.removeQueries({ queryKey: legalQueryKeys.contractAttachments(id) });
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const issue = useMutation({
|
|
42
|
+
mutationFn: async (id) => {
|
|
43
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}/issue`, legalContractSingleResponse, { baseUrl, fetcher }, { method: "POST" });
|
|
44
|
+
return data;
|
|
45
|
+
},
|
|
46
|
+
onSuccess: (data) => {
|
|
47
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
48
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const send = useMutation({
|
|
52
|
+
mutationFn: async (input) => {
|
|
53
|
+
// Back-compat: callers that just need the status flip can keep
|
|
54
|
+
// passing the id string. New callers (ContractSendDialog) pass
|
|
55
|
+
// `{ id, input: { subject, message, recipientEmail } }` so the
|
|
56
|
+
// route can carry their customization onto the `contract.sent`
|
|
57
|
+
// lifecycle event.
|
|
58
|
+
const normalized = typeof input === "string" ? { id: input, input: {} } : input;
|
|
59
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${normalized.id}/send`, legalContractSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(normalized.input ?? {}) });
|
|
60
|
+
return data;
|
|
61
|
+
},
|
|
62
|
+
onSuccess: (data) => {
|
|
63
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
64
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const execute = useMutation({
|
|
68
|
+
mutationFn: async (id) => {
|
|
69
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}/execute`, legalContractSingleResponse, { baseUrl, fetcher }, { method: "POST" });
|
|
70
|
+
return data;
|
|
71
|
+
},
|
|
72
|
+
onSuccess: (data) => {
|
|
73
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
74
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
const voidContract = useMutation({
|
|
78
|
+
mutationFn: async (id) => {
|
|
79
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}/void`, legalContractSingleResponse, { baseUrl, fetcher }, { method: "POST" });
|
|
80
|
+
return data;
|
|
81
|
+
},
|
|
82
|
+
onSuccess: (data) => {
|
|
83
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
84
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.id), data);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Trigger a fresh document render for a contract. First call issues the
|
|
89
|
+
* draft + generates via the server's configured generator; subsequent
|
|
90
|
+
* calls (see `regenerate`) replace the attachment.
|
|
91
|
+
*/
|
|
92
|
+
const generateDocument = useMutation({
|
|
93
|
+
mutationFn: async ({ id, input = {}, }) => {
|
|
94
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}/generate-document`, legalContractGenerateDocumentResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
95
|
+
return data;
|
|
96
|
+
},
|
|
97
|
+
onSuccess: (_data, variables) => {
|
|
98
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contract(variables.id) });
|
|
99
|
+
void queryClient.invalidateQueries({
|
|
100
|
+
queryKey: legalQueryKeys.contractAttachments(variables.id),
|
|
101
|
+
});
|
|
102
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Same as `generateDocument` but explicit about replacing an existing
|
|
107
|
+
* attachment of the same kind. Use this for the operator's "Regenerate"
|
|
108
|
+
* button so stale PDFs don't accumulate.
|
|
109
|
+
*/
|
|
110
|
+
const regenerateDocument = useMutation({
|
|
111
|
+
mutationFn: async ({ id, input = {}, }) => {
|
|
112
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/${id}/regenerate-document`, legalContractGenerateDocumentResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
113
|
+
return data;
|
|
114
|
+
},
|
|
115
|
+
onSuccess: (_data, variables) => {
|
|
116
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contract(variables.id) });
|
|
117
|
+
void queryClient.invalidateQueries({
|
|
118
|
+
queryKey: legalQueryKeys.contractAttachments(variables.id),
|
|
119
|
+
});
|
|
120
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const generateForBooking = useMutation({
|
|
124
|
+
mutationFn: async ({ bookingId, input = {}, }) => {
|
|
125
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/bookings/${bookingId}/generate-document`, legalBookingContractGenerateDocumentResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
126
|
+
return data;
|
|
127
|
+
},
|
|
128
|
+
onSuccess: (data, variables) => {
|
|
129
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contracts() });
|
|
130
|
+
void queryClient.invalidateQueries({
|
|
131
|
+
queryKey: legalQueryKeys.contractsList({ bookingId: variables.bookingId }),
|
|
132
|
+
});
|
|
133
|
+
queryClient.setQueryData(legalQueryKeys.contract(data.contract.id), data.contract);
|
|
134
|
+
void queryClient.invalidateQueries({
|
|
135
|
+
queryKey: legalQueryKeys.contractAttachments(data.contract.id),
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
create,
|
|
141
|
+
update,
|
|
142
|
+
remove,
|
|
143
|
+
issue,
|
|
144
|
+
send,
|
|
145
|
+
execute,
|
|
146
|
+
voidContract,
|
|
147
|
+
generateDocument,
|
|
148
|
+
regenerateDocument,
|
|
149
|
+
generateForBooking,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { insertContractSignatureSchema } from "@voyant-travel/legal/contracts/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalContractSignatureInput = z.input<typeof insertContractSignatureSchema>;
|
|
4
|
+
export declare function useLegalContractSignatureMutation(): {
|
|
5
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
6
|
+
contractId: string;
|
|
7
|
+
data: {
|
|
8
|
+
method: "manual" | "electronic" | "docusign" | "other";
|
|
9
|
+
signerName: string;
|
|
10
|
+
id: string;
|
|
11
|
+
contractId: string;
|
|
12
|
+
signerEmail: string | null;
|
|
13
|
+
signerRole: string | null;
|
|
14
|
+
personId: string | null;
|
|
15
|
+
provider: string | null;
|
|
16
|
+
externalReference: string | null;
|
|
17
|
+
signatureData: string | null;
|
|
18
|
+
ipAddress: string | null;
|
|
19
|
+
userAgent: string | null;
|
|
20
|
+
signedAt: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
targetKind?: "booking" | "quote_version" | "program" | "product" | "inventory_item" | "supplier_channel_relationship" | "provider_source_ref" | null | undefined;
|
|
23
|
+
targetId?: string | null | undefined;
|
|
24
|
+
targetProvider?: string | null | undefined;
|
|
25
|
+
targetSourceRef?: string | null | undefined;
|
|
26
|
+
legacyTransactionOfferId?: string | null | undefined;
|
|
27
|
+
legacyTransactionOrderId?: string | null | undefined;
|
|
28
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
29
|
+
};
|
|
30
|
+
}, Error, {
|
|
31
|
+
contractId: string;
|
|
32
|
+
input: CreateLegalContractSignatureInput;
|
|
33
|
+
}, unknown>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=use-contract-signature-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-signature-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-signature-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAA;AAC9F,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAE7F,wBAAgB,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAS/B,MAAM;eACX,iCAAiC;;EAmB7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { legalContractSignatureRecordSchema } from "../schemas.js";
|
|
7
|
+
export function useLegalContractSignatureMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async ({ contractId, input, }) => {
|
|
12
|
+
const data = await fetchWithValidation(`/v1/admin/legal/contracts/${contractId}/sign`, legalContractSignatureRecordSchema, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return { contractId, data };
|
|
14
|
+
},
|
|
15
|
+
onSuccess: ({ contractId }) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: legalQueryKeys.contract(contractId) });
|
|
17
|
+
void queryClient.invalidateQueries({
|
|
18
|
+
queryKey: legalQueryKeys.contractSignatures(contractId),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return { create };
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface UseLegalContractSignaturesOptions {
|
|
2
|
+
contractId: string;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContractSignatures(options: UseLegalContractSignaturesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
method: "manual" | "electronic" | "docusign" | "other";
|
|
7
|
+
signerName: string;
|
|
8
|
+
id: string;
|
|
9
|
+
contractId: string;
|
|
10
|
+
signerEmail: string | null;
|
|
11
|
+
signerRole: string | null;
|
|
12
|
+
personId: string | null;
|
|
13
|
+
provider: string | null;
|
|
14
|
+
externalReference: string | null;
|
|
15
|
+
signatureData: string | null;
|
|
16
|
+
ipAddress: string | null;
|
|
17
|
+
userAgent: string | null;
|
|
18
|
+
signedAt: string;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
targetKind?: "booking" | "quote_version" | "program" | "product" | "inventory_item" | "supplier_channel_relationship" | "provider_source_ref" | null | undefined;
|
|
21
|
+
targetId?: string | null | undefined;
|
|
22
|
+
targetProvider?: string | null | undefined;
|
|
23
|
+
targetSourceRef?: string | null | undefined;
|
|
24
|
+
legacyTransactionOfferId?: string | null | undefined;
|
|
25
|
+
legacyTransactionOrderId?: string | null | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
27
|
+
}[], Error>;
|
|
28
|
+
//# sourceMappingURL=use-contract-signatures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-signatures.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-signatures.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iCAAiC;;;;;;;;;;;;;;;;;;;;;;YAQpF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getLegalContractSignaturesQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalContractSignatures(options) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalContractSignaturesQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useLegalContractTemplateAuthoring(): {
|
|
2
|
+
variableCatalog: import("@voyant-travel/legal/contracts").ContractTemplateVariableCategory[];
|
|
3
|
+
liquidSnippets: import("@voyant-travel/legal/contracts").ContractTemplateLiquidSnippet[];
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=use-contract-template-authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-contract-template-authoring.d.ts","sourceRoot":"","sources":["../../src/hooks/use-contract-template-authoring.ts"],"names":[],"mappings":"AAKA,wBAAgB,iCAAiC;;;EAKhD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { contractTemplateLiquidSnippets, contractTemplateVariableCatalog, } from "@voyant-travel/legal/contracts";
|
|
2
|
+
export function useLegalContractTemplateAuthoring() {
|
|
3
|
+
return {
|
|
4
|
+
variableCatalog: contractTemplateVariableCatalog,
|
|
5
|
+
liquidSnippets: contractTemplateLiquidSnippets,
|
|
6
|
+
};
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { insertContractTemplateSchema, updateContractTemplateSchema } from "@voyant-travel/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
|
+
body: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
isDefault: boolean;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
channelId?: string | null | undefined;
|
|
19
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
20
|
+
currentVersionId?: string | null | undefined;
|
|
21
|
+
}, Error, {
|
|
22
|
+
name: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
25
|
+
body: string;
|
|
26
|
+
language?: string | undefined;
|
|
27
|
+
description?: string | null | undefined;
|
|
28
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
29
|
+
channelId?: string | null | undefined;
|
|
30
|
+
isDefault?: boolean | undefined;
|
|
31
|
+
active?: boolean | undefined;
|
|
32
|
+
}, unknown>;
|
|
33
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
34
|
+
name: string;
|
|
35
|
+
slug: string;
|
|
36
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
37
|
+
language: string;
|
|
38
|
+
body: string;
|
|
39
|
+
active: boolean;
|
|
40
|
+
id: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
isDefault: boolean;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
channelId?: string | null | undefined;
|
|
46
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
47
|
+
currentVersionId?: string | null | undefined;
|
|
48
|
+
}, Error, {
|
|
49
|
+
id: string;
|
|
50
|
+
input: UpdateLegalContractTemplateInput;
|
|
51
|
+
}, unknown>;
|
|
52
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
}, Error, string, unknown>;
|
|
55
|
+
};
|
|
56
|
+
//# 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,2CAA2C,CAAA;AAClD,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,22 @@
|
|
|
1
|
+
import type { insertContractTemplateVersionSchema } from "@voyant-travel/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
|
+
body: string;
|
|
9
|
+
id: string;
|
|
10
|
+
templateId: string;
|
|
11
|
+
version: number;
|
|
12
|
+
changelog: string | null;
|
|
13
|
+
createdBy: string | null;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
}, Error, {
|
|
18
|
+
templateId: string;
|
|
19
|
+
input: CreateLegalContractTemplateVersionInput;
|
|
20
|
+
}, unknown>;
|
|
21
|
+
};
|
|
22
|
+
//# 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,2CAA2C,CAAA;AACpG,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,15 @@
|
|
|
1
|
+
export interface UseLegalContractTemplateVersionsOptions {
|
|
2
|
+
templateId: string;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalContractTemplateVersions(options: UseLegalContractTemplateVersionsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
body: string;
|
|
7
|
+
id: string;
|
|
8
|
+
templateId: string;
|
|
9
|
+
version: number;
|
|
10
|
+
changelog: string | null;
|
|
11
|
+
createdBy: string | null;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
14
|
+
}[], Error>;
|
|
15
|
+
//# 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,20 @@
|
|
|
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
|
+
body: string;
|
|
10
|
+
active: boolean;
|
|
11
|
+
id: string;
|
|
12
|
+
description: string | null;
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
channelId?: string | null | undefined;
|
|
17
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
18
|
+
currentVersionId?: string | null | undefined;
|
|
19
|
+
}, Error>;
|
|
20
|
+
//# 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,26 @@
|
|
|
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
|
+
body: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
isDefault: boolean;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
channelId?: string | null | undefined;
|
|
19
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
20
|
+
currentVersionId?: string | null | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
total: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
offset: number;
|
|
25
|
+
}, Error>;
|
|
26
|
+
//# 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,47 @@
|
|
|
1
|
+
export interface UseLegalContractOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useLegalContract(id: string, options?: UseLegalContractOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
language: string;
|
|
6
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
7
|
+
status: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
8
|
+
title: string;
|
|
9
|
+
id: string;
|
|
10
|
+
contractNumber: string | null;
|
|
11
|
+
stageHistory: {
|
|
12
|
+
stage: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
13
|
+
previousStage: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired" | null;
|
|
14
|
+
transition: "issued" | "sent" | "signed" | "executed" | "created" | "voided";
|
|
15
|
+
enteredAt: string;
|
|
16
|
+
actorId?: string | null | undefined;
|
|
17
|
+
}[];
|
|
18
|
+
templateVersionId: string | null;
|
|
19
|
+
seriesId: string | null;
|
|
20
|
+
personId: string | null;
|
|
21
|
+
organizationId: string | null;
|
|
22
|
+
supplierId: string | null;
|
|
23
|
+
channelId: string | null;
|
|
24
|
+
bookingId: string | null;
|
|
25
|
+
renderedBodyFormat: "markdown" | "html" | "lexical_json";
|
|
26
|
+
renderedBody: string | null;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
variables?: Record<string, unknown> | null | undefined;
|
|
30
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
31
|
+
targetKind?: "booking" | "quote_version" | "program" | "product" | "inventory_item" | "supplier_channel_relationship" | "provider_source_ref" | null | undefined;
|
|
32
|
+
targetId?: string | null | undefined;
|
|
33
|
+
targetProvider?: string | null | undefined;
|
|
34
|
+
targetSourceRef?: string | null | undefined;
|
|
35
|
+
legacyTransactionOfferId?: string | null | undefined;
|
|
36
|
+
legacyTransactionOrderId?: string | null | undefined;
|
|
37
|
+
personFirstName?: string | null | undefined;
|
|
38
|
+
personLastName?: string | null | undefined;
|
|
39
|
+
personEmail?: string | null | undefined;
|
|
40
|
+
personPhone?: string | null | undefined;
|
|
41
|
+
issuedAt?: string | null | undefined;
|
|
42
|
+
sentAt?: string | null | undefined;
|
|
43
|
+
executedAt?: string | null | undefined;
|
|
44
|
+
expiresAt?: string | null | undefined;
|
|
45
|
+
voidedAt?: string | null | undefined;
|
|
46
|
+
}, Error>;
|
|
47
|
+
//# 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
|
+
}
|