@kanda-libs/ks-component-ts 0.3.52 → 0.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12466 -12466
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +3 -3
- package/package.json +1 -1
- package/src/field/components/CompanyLookupInput/SearchResults/useSearch.ts +10 -3
- package/src/field/components/FingerprintBooleanInput/FingerprintBooleanInputUncontrolled/useFingerprintBooleanInputUncontrolled.ts +9 -1
- package/src/generated/widget/index.tsx +62448 -62448
- package/src/hooks/useDownloadDocument/index.ts +10 -3
- package/src/hooks/useDownloadPdf/index.ts +24 -4
|
@@ -2,6 +2,7 @@ import { useToast } from "@kanda-libs/ks-design-library";
|
|
|
2
2
|
import { services, useSubmit } from "@kanda-libs/ks-frontend-services";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { downloadBase64 } from "../../helpers";
|
|
5
|
+
import { GetDocumentRequestFunction } from "~/generated/operations/getDocument";
|
|
5
6
|
|
|
6
7
|
export interface DownloadDocumentHook {
|
|
7
8
|
downloadDocument: (id: string) => void;
|
|
@@ -9,9 +10,15 @@ export interface DownloadDocumentHook {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export default function useDownloadDocument(): DownloadDocumentHook {
|
|
12
|
-
const
|
|
13
|
-
services.document.getDocument
|
|
14
|
-
|
|
13
|
+
const service = {
|
|
14
|
+
key: services.document.getDocument.key,
|
|
15
|
+
method: (
|
|
16
|
+
services.document.getDocument
|
|
17
|
+
.method as unknown as () => GetDocumentRequestFunction
|
|
18
|
+
)(),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const { submit: getDocument, isSubmitting = false } = useSubmit(service);
|
|
15
22
|
|
|
16
23
|
const { showError } = useToast();
|
|
17
24
|
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
import { useCallback, useState } from "react";
|
|
9
9
|
import { isJobCustom } from "./helpers";
|
|
10
10
|
import { downloadBase64 } from "../../helpers";
|
|
11
|
+
import { GetJobRequestFunction } from "~/generated/operations/getJob";
|
|
12
|
+
import { GetDocumentRequestFunction } from "~/generated/operations/getDocument";
|
|
13
|
+
import { JobCompanyInfoRequestFunction } from "~/generated/operations/jobCompanyInfo";
|
|
11
14
|
|
|
12
15
|
export interface DownloadPdfHook {
|
|
13
16
|
downloadPdf: (id: string) => void;
|
|
@@ -15,9 +18,26 @@ export interface DownloadPdfHook {
|
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export default function useDownloadPdf(): DownloadPdfHook {
|
|
18
|
-
const { submit: getJob } = useSubmit(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const { submit: getJob } = useSubmit({
|
|
22
|
+
key: services.job.getJob.key,
|
|
23
|
+
method: (
|
|
24
|
+
services.job.getJob.method as unknown as () => GetJobRequestFunction
|
|
25
|
+
)(),
|
|
26
|
+
});
|
|
27
|
+
const { submit: getDocument } = useSubmit({
|
|
28
|
+
key: services.document.getDocument.key,
|
|
29
|
+
method: (
|
|
30
|
+
services.document.getDocument
|
|
31
|
+
.method as unknown as () => GetDocumentRequestFunction
|
|
32
|
+
)(),
|
|
33
|
+
});
|
|
34
|
+
const { submit: jobCompanyInfo } = useSubmit({
|
|
35
|
+
key: services.job.jobCompanyInfo.key,
|
|
36
|
+
method: (
|
|
37
|
+
services.job.jobCompanyInfo
|
|
38
|
+
.method as unknown as () => JobCompanyInfoRequestFunction
|
|
39
|
+
)(),
|
|
40
|
+
});
|
|
21
41
|
|
|
22
42
|
const { showError } = useToast();
|
|
23
43
|
const { createPdf } = useQuoteDownload();
|
|
@@ -25,7 +45,7 @@ export default function useDownloadPdf(): DownloadPdfHook {
|
|
|
25
45
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
26
46
|
|
|
27
47
|
const customDownload = useCallback(
|
|
28
|
-
(job
|
|
48
|
+
(job) => {
|
|
29
49
|
const id = job?.job_items[0]?.quote_document?.id;
|
|
30
50
|
if (!id) {
|
|
31
51
|
setIsSubmitting(false);
|