@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,53 @@
|
|
|
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
|
+
language: string;
|
|
8
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
9
|
+
status: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
10
|
+
title: string;
|
|
11
|
+
id: string;
|
|
12
|
+
contractNumber: string | null;
|
|
13
|
+
stageHistory: {
|
|
14
|
+
stage: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired";
|
|
15
|
+
previousStage: "void" | "draft" | "issued" | "sent" | "signed" | "executed" | "expired" | null;
|
|
16
|
+
transition: "issued" | "sent" | "signed" | "executed" | "created" | "voided";
|
|
17
|
+
enteredAt: string;
|
|
18
|
+
actorId?: string | null | undefined;
|
|
19
|
+
}[];
|
|
20
|
+
templateVersionId: string | null;
|
|
21
|
+
seriesId: string | null;
|
|
22
|
+
personId: string | null;
|
|
23
|
+
organizationId: string | null;
|
|
24
|
+
supplierId: string | null;
|
|
25
|
+
channelId: string | null;
|
|
26
|
+
bookingId: string | null;
|
|
27
|
+
renderedBodyFormat: "markdown" | "html" | "lexical_json";
|
|
28
|
+
renderedBody: string | null;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
variables?: Record<string, unknown> | null | undefined;
|
|
32
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
targetKind?: "booking" | "quote_version" | "program" | "product" | "inventory_item" | "supplier_channel_relationship" | "provider_source_ref" | null | undefined;
|
|
34
|
+
targetId?: string | null | undefined;
|
|
35
|
+
targetProvider?: string | null | undefined;
|
|
36
|
+
targetSourceRef?: string | null | undefined;
|
|
37
|
+
legacyTransactionOfferId?: string | null | undefined;
|
|
38
|
+
legacyTransactionOrderId?: string | null | undefined;
|
|
39
|
+
personFirstName?: string | null | undefined;
|
|
40
|
+
personLastName?: string | null | undefined;
|
|
41
|
+
personEmail?: string | null | undefined;
|
|
42
|
+
personPhone?: string | null | undefined;
|
|
43
|
+
issuedAt?: string | null | undefined;
|
|
44
|
+
sentAt?: string | null | undefined;
|
|
45
|
+
executedAt?: string | null | undefined;
|
|
46
|
+
expiresAt?: string | null | undefined;
|
|
47
|
+
voidedAt?: string | null | undefined;
|
|
48
|
+
}[];
|
|
49
|
+
total: number;
|
|
50
|
+
limit: number;
|
|
51
|
+
offset: number;
|
|
52
|
+
}, Error>;
|
|
53
|
+
//# 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,21 @@
|
|
|
1
|
+
import type { LegalContractTemplateDefaultFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseDefaultLegalContractTemplateOptions extends LegalContractTemplateDefaultFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useDefaultLegalContractTemplate(options?: UseDefaultLegalContractTemplateOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
name: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
9
|
+
language: string;
|
|
10
|
+
body: string;
|
|
11
|
+
active: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
description: string | null;
|
|
14
|
+
isDefault: boolean;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
channelId?: string | null | undefined;
|
|
18
|
+
variableSchema?: Record<string, unknown> | null | undefined;
|
|
19
|
+
currentVersionId?: string | null | undefined;
|
|
20
|
+
}, Error>;
|
|
21
|
+
//# sourceMappingURL=use-default-contract-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-default-contract-template.d.ts","sourceRoot":"","sources":["../../src/hooks/use-default-contract-template.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAA;AAG3E,MAAM,WAAW,sCACf,SAAQ,mCAAmC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,sCAA2C;;;;;;;;;;;;;;;UASrD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantLegalContext } from "../provider.js";
|
|
4
|
+
import { getDefaultLegalContractTemplateQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useDefaultLegalContractTemplate(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getDefaultLegalContractTemplateQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface EvaluateCancellationInput {
|
|
2
|
+
daysBeforeDeparture: number;
|
|
3
|
+
totalCents: number;
|
|
4
|
+
currency?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UseEvaluateCancellationOptions {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Evaluates a cancellation policy as a cacheable query. Returns the refund
|
|
11
|
+
* percent/amount/type and the applied rule. Runs automatically when all of
|
|
12
|
+
* policyId/daysBeforeDeparture/totalCents are provided and `enabled` is true.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useEvaluateCancellation(policyId: string | null | undefined, input: EvaluateCancellationInput | null | undefined, options?: UseEvaluateCancellationOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
15
|
+
data: {
|
|
16
|
+
refundPercent: number;
|
|
17
|
+
refundCents: number;
|
|
18
|
+
refundType: "cash" | "credit" | "cash_or_credit" | "none";
|
|
19
|
+
appliedRule: {
|
|
20
|
+
daysBeforeDeparture: number | null;
|
|
21
|
+
refundPercent: number | null;
|
|
22
|
+
refundType: "cash" | "credit" | "cash_or_credit" | "none" | null;
|
|
23
|
+
flatAmountCents: number | null;
|
|
24
|
+
label: string | null;
|
|
25
|
+
id?: string | undefined;
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
}, Error>;
|
|
29
|
+
/**
|
|
30
|
+
* Imperative mutation variant of the cancellation evaluation for cases where
|
|
31
|
+
* the caller needs to trigger evaluation manually (e.g. with ad-hoc inputs).
|
|
32
|
+
*/
|
|
33
|
+
export declare function useEvaluateCancellationMutation(policyId: string | null | undefined): import("@tanstack/react-query").UseMutationResult<{
|
|
34
|
+
refundPercent: number;
|
|
35
|
+
refundCents: number;
|
|
36
|
+
refundType: "cash" | "credit" | "cash_or_credit" | "none";
|
|
37
|
+
appliedRule: {
|
|
38
|
+
daysBeforeDeparture: number | null;
|
|
39
|
+
refundPercent: number | null;
|
|
40
|
+
refundType: "cash" | "credit" | "cash_or_credit" | "none" | null;
|
|
41
|
+
flatAmountCents: number | null;
|
|
42
|
+
label: string | null;
|
|
43
|
+
id?: string | undefined;
|
|
44
|
+
} | null;
|
|
45
|
+
}, Error, EvaluateCancellationInput, unknown>;
|
|
46
|
+
//# sourceMappingURL=use-evaluate-cancellation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-evaluate-cancellation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-evaluate-cancellation.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,KAAK,EAAE,yBAAyB,GAAG,IAAI,GAAG,SAAS,EACnD,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;UAsB7C;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;8CAiBlF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { queryOptions, useMutation, useQuery } 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 { cancellationResultResponse } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates a cancellation policy as a cacheable query. Returns the refund
|
|
9
|
+
* percent/amount/type and the applied rule. Runs automatically when all of
|
|
10
|
+
* policyId/daysBeforeDeparture/totalCents are provided and `enabled` is true.
|
|
11
|
+
*/
|
|
12
|
+
export function useEvaluateCancellation(policyId, input, options = {}) {
|
|
13
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
14
|
+
const { enabled = true } = options;
|
|
15
|
+
const shouldRun = Boolean(policyId) && Boolean(input) && enabled;
|
|
16
|
+
return useQuery({
|
|
17
|
+
...queryOptions({
|
|
18
|
+
queryKey: [...legalQueryKeys.policies(), "evaluate", policyId, input],
|
|
19
|
+
queryFn: () => {
|
|
20
|
+
if (!policyId || !input)
|
|
21
|
+
throw new Error("policyId and input required");
|
|
22
|
+
return fetchWithValidation(`/v1/admin/legal/policies/${policyId}/evaluate`, cancellationResultResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
enabled: shouldRun,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Imperative mutation variant of the cancellation evaluation for cases where
|
|
30
|
+
* the caller needs to trigger evaluation manually (e.g. with ad-hoc inputs).
|
|
31
|
+
*/
|
|
32
|
+
export function useEvaluateCancellationMutation(policyId) {
|
|
33
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
34
|
+
return useMutation({
|
|
35
|
+
mutationFn: async (input) => {
|
|
36
|
+
if (!policyId) {
|
|
37
|
+
throw new Error("policyId is required");
|
|
38
|
+
}
|
|
39
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/policies/${policyId}/evaluate`, cancellationResultResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
40
|
+
return data;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { insertContractNumberSeriesSchema, updateContractNumberSeriesSchema } from "@voyant-travel/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
|
+
name: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
separator: string;
|
|
10
|
+
padLength: number;
|
|
11
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
12
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
active: boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
currentSequence: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
externalProvider?: string | null | undefined;
|
|
20
|
+
externalConfigKey?: string | null | undefined;
|
|
21
|
+
resetAt?: string | null | undefined;
|
|
22
|
+
}, Error, {
|
|
23
|
+
name: string;
|
|
24
|
+
prefix: string;
|
|
25
|
+
separator?: string | undefined;
|
|
26
|
+
padLength?: number | undefined;
|
|
27
|
+
resetStrategy?: "never" | "annual" | "monthly" | undefined;
|
|
28
|
+
scope?: "other" | "customer" | "supplier" | "partner" | "channel" | undefined;
|
|
29
|
+
isDefault?: boolean | undefined;
|
|
30
|
+
externalProvider?: string | null | undefined;
|
|
31
|
+
externalConfigKey?: string | null | undefined;
|
|
32
|
+
active?: boolean | undefined;
|
|
33
|
+
}, unknown>;
|
|
34
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
35
|
+
name: string;
|
|
36
|
+
prefix: string;
|
|
37
|
+
separator: string;
|
|
38
|
+
padLength: number;
|
|
39
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
40
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
41
|
+
isDefault: boolean;
|
|
42
|
+
active: boolean;
|
|
43
|
+
id: string;
|
|
44
|
+
currentSequence: number;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
externalProvider?: string | null | undefined;
|
|
48
|
+
externalConfigKey?: string | null | undefined;
|
|
49
|
+
resetAt?: string | null | undefined;
|
|
50
|
+
}, Error, {
|
|
51
|
+
id: string;
|
|
52
|
+
input: UpdateLegalContractNumberSeriesInput;
|
|
53
|
+
}, unknown>;
|
|
54
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}, Error, string, unknown>;
|
|
57
|
+
};
|
|
58
|
+
//# 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,2CAA2C,CAAA;AAClD,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,24 @@
|
|
|
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
|
+
name: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
separator: string;
|
|
10
|
+
padLength: number;
|
|
11
|
+
resetStrategy: "never" | "annual" | "monthly";
|
|
12
|
+
scope: "other" | "customer" | "supplier" | "partner" | "channel";
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
active: boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
currentSequence: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
externalProvider?: string | null | undefined;
|
|
20
|
+
externalConfigKey?: string | null | undefined;
|
|
21
|
+
resetAt?: string | null | undefined;
|
|
22
|
+
}[];
|
|
23
|
+
}, Error>;
|
|
24
|
+
//# 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,26 @@
|
|
|
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
|
+
targetKind?: "booking" | "quote_version" | "program" | "product" | "inventory_item" | "supplier_channel_relationship" | "provider_source_ref" | null | undefined;
|
|
15
|
+
targetId?: string | null | undefined;
|
|
16
|
+
targetProvider?: string | null | undefined;
|
|
17
|
+
targetSourceRef?: string | null | undefined;
|
|
18
|
+
legacyTransactionOfferId?: string | null | undefined;
|
|
19
|
+
legacyTransactionOrderId?: string | null | undefined;
|
|
20
|
+
acceptedBy?: string | null | undefined;
|
|
21
|
+
ipAddress?: string | null | undefined;
|
|
22
|
+
userAgent?: string | null | undefined;
|
|
23
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
24
|
+
}[];
|
|
25
|
+
}, Error>;
|
|
26
|
+
//# 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
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { insertPolicyAssignmentSchema, updatePolicyAssignmentSchema } from "@voyant-travel/legal/policies/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalPolicyAssignmentInput = z.input<typeof insertPolicyAssignmentSchema>;
|
|
4
|
+
export type UpdateLegalPolicyAssignmentInput = z.input<typeof updatePolicyAssignmentSchema>;
|
|
5
|
+
export declare function useLegalPolicyAssignmentMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
policyId: string;
|
|
8
|
+
scope: "product" | "supplier" | "channel" | "market" | "organization" | "global";
|
|
9
|
+
priority: number;
|
|
10
|
+
id: string;
|
|
11
|
+
productId: string | null;
|
|
12
|
+
channelId: string | null;
|
|
13
|
+
supplierId: string | null;
|
|
14
|
+
marketId: string | null;
|
|
15
|
+
organizationId: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
validFrom?: string | null | undefined;
|
|
19
|
+
validTo?: string | null | undefined;
|
|
20
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}, Error, {
|
|
22
|
+
policyId: string;
|
|
23
|
+
scope: "product" | "supplier" | "channel" | "market" | "organization" | "global";
|
|
24
|
+
productId?: string | null | undefined;
|
|
25
|
+
channelId?: string | null | undefined;
|
|
26
|
+
supplierId?: string | null | undefined;
|
|
27
|
+
marketId?: string | null | undefined;
|
|
28
|
+
organizationId?: string | null | undefined;
|
|
29
|
+
validFrom?: string | null | undefined;
|
|
30
|
+
validTo?: string | null | undefined;
|
|
31
|
+
priority?: number | undefined;
|
|
32
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
}, unknown>;
|
|
34
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
35
|
+
policyId: string;
|
|
36
|
+
scope: "product" | "supplier" | "channel" | "market" | "organization" | "global";
|
|
37
|
+
priority: number;
|
|
38
|
+
id: string;
|
|
39
|
+
productId: string | null;
|
|
40
|
+
channelId: string | null;
|
|
41
|
+
supplierId: string | null;
|
|
42
|
+
marketId: string | null;
|
|
43
|
+
organizationId: string | null;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
validFrom?: string | null | undefined;
|
|
47
|
+
validTo?: string | null | undefined;
|
|
48
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
49
|
+
}, Error, {
|
|
50
|
+
id: string;
|
|
51
|
+
input: UpdateLegalPolicyAssignmentInput;
|
|
52
|
+
}, unknown>;
|
|
53
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
54
|
+
policyId: string;
|
|
55
|
+
data: {
|
|
56
|
+
success: boolean;
|
|
57
|
+
};
|
|
58
|
+
}, Error, {
|
|
59
|
+
policyId: string;
|
|
60
|
+
id: string;
|
|
61
|
+
}, unknown>;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=use-policy-assignment-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-policy-assignment-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-assignment-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,0CAA0C,CAAA;AACjD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAM5B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAsBJ,MAAM;eAAS,gCAAgC;;;;;;;;kBAiBtC,MAAM;YAAM,MAAM;;EAetE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { legalPolicyAssignmentSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useLegalPolicyAssignmentMutation() {
|
|
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/policies/assignments", legalPolicyAssignmentSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({
|
|
17
|
+
queryKey: legalQueryKeys.policyAssignments({ policyId: data.policyId }),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const update = useMutation({
|
|
22
|
+
mutationFn: async ({ id, input }) => {
|
|
23
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/policies/assignments/${id}`, legalPolicyAssignmentSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
24
|
+
return data;
|
|
25
|
+
},
|
|
26
|
+
onSuccess: (data) => {
|
|
27
|
+
void queryClient.invalidateQueries({
|
|
28
|
+
queryKey: legalQueryKeys.policyAssignments({ policyId: data.policyId }),
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const remove = useMutation({
|
|
33
|
+
mutationFn: async ({ policyId, id }) => fetchWithValidation(`/v1/admin/legal/policies/assignments/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }).then((data) => ({ policyId, data })),
|
|
34
|
+
onSuccess: ({ policyId }) => {
|
|
35
|
+
void queryClient.invalidateQueries({
|
|
36
|
+
queryKey: legalQueryKeys.policyAssignments({ policyId }),
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return { create, update, remove };
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LegalPolicyAssignmentsListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseLegalPolicyAssignmentsOptions extends LegalPolicyAssignmentsListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLegalPolicyAssignments(options?: UseLegalPolicyAssignmentsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
policyId: string;
|
|
8
|
+
scope: "product" | "supplier" | "channel" | "market" | "organization" | "global";
|
|
9
|
+
priority: number;
|
|
10
|
+
id: string;
|
|
11
|
+
productId: string | null;
|
|
12
|
+
channelId: string | null;
|
|
13
|
+
supplierId: string | null;
|
|
14
|
+
marketId: string | null;
|
|
15
|
+
organizationId: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
validFrom?: string | null | undefined;
|
|
19
|
+
validTo?: string | null | undefined;
|
|
20
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
}, Error>;
|
|
23
|
+
//# sourceMappingURL=use-policy-assignments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-policy-assignments.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-assignments.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 { getLegalPolicyAssignmentsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useLegalPolicyAssignments(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantLegalContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getLegalPolicyAssignmentsQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { insertPolicySchema, updatePolicySchema } from "@voyant-travel/legal/policies/validation";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateLegalPolicyInput = z.input<typeof insertPolicySchema>;
|
|
4
|
+
export type UpdateLegalPolicyInput = z.input<typeof updatePolicySchema>;
|
|
5
|
+
export declare function useLegalPolicyMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
kind: "other" | "payment" | "cancellation" | "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
|
+
}, Error, {
|
|
18
|
+
kind: "other" | "payment" | "cancellation" | "terms_and_conditions" | "privacy" | "refund" | "commission" | "guarantee";
|
|
19
|
+
name: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
description?: string | null | undefined;
|
|
22
|
+
language?: string | undefined;
|
|
23
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
24
|
+
}, unknown>;
|
|
25
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
26
|
+
kind: "other" | "payment" | "cancellation" | "terms_and_conditions" | "privacy" | "refund" | "commission" | "guarantee";
|
|
27
|
+
name: string;
|
|
28
|
+
slug: string;
|
|
29
|
+
language: string;
|
|
30
|
+
id: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
35
|
+
currentVersionId?: string | null | undefined;
|
|
36
|
+
}, Error, {
|
|
37
|
+
id: string;
|
|
38
|
+
input: UpdateLegalPolicyInput;
|
|
39
|
+
}, unknown>;
|
|
40
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}, Error, string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=use-policy-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-policy-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0CAA0C,CAAA;AACjD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAM5B,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AACvE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEvE,wBAAgB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBM,MAAM;eAAS,sBAAsB;;;;;EAgChF"}
|