@arbidocs/react 0.4.154 → 0.4.156
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/artifacts/index.cjs +13 -13
- package/dist/artifacts/index.js +2 -2
- package/dist/{chunk-YYTX3W6C.js → chunk-2HNEVAXO.js} +68 -3
- package/dist/chunk-2HNEVAXO.js.map +1 -0
- package/dist/{chunk-KD7CKXWQ.js → chunk-6FGO7SCY.js} +182 -42
- package/dist/chunk-6FGO7SCY.js.map +1 -0
- package/dist/{chunk-L57RRAII.cjs → chunk-QKNJ6FRD.cjs} +71 -2
- package/dist/chunk-QKNJ6FRD.cjs.map +1 -0
- package/dist/{chunk-L66ZJ2UI.cjs → chunk-VKWGRGY6.cjs} +188 -40
- package/dist/chunk-VKWGRGY6.cjs.map +1 -0
- package/dist/document-tools/index.cjs +41 -93
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.js +3 -67
- package/dist/document-tools/index.js.map +1 -1
- package/dist/{index-BV7pBlgY.d.cts → index-CDTwtUr9.d.cts} +89 -1
- package/dist/{index-BV7pBlgY.d.ts → index-CDTwtUr9.d.ts} +89 -1
- package/dist/index.cjs +612 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +187 -3
- package/dist/index.d.ts +187 -3
- package/dist/index.js +340 -7
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +193 -161
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -2
- package/package.json +7 -5
- package/dist/chunk-KD7CKXWQ.js.map +0 -1
- package/dist/chunk-L57RRAII.cjs.map +0 -1
- package/dist/chunk-L66ZJ2UI.cjs.map +0 -1
- package/dist/chunk-YYTX3W6C.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQKNJ6FRD_cjs = require('../chunk-QKNJ6FRD.cjs');
|
|
4
4
|
var chunkL2PXZWJM_cjs = require('../chunk-L2PXZWJM.cjs');
|
|
5
5
|
var chunkSSOPIPEX_cjs = require('../chunk-SSOPIPEX.cjs');
|
|
6
6
|
var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
|
|
@@ -14,70 +14,6 @@ var react = require('react');
|
|
|
14
14
|
var reactQuery = require('@tanstack/react-query');
|
|
15
15
|
var client = require('@arbidocs/client');
|
|
16
16
|
|
|
17
|
-
// src/document-tools/document-pdf.ts
|
|
18
|
-
var DocumentFetchError = class extends Error {
|
|
19
|
-
status;
|
|
20
|
-
constructor(message, status) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = "DocumentFetchError";
|
|
23
|
-
this.status = status;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
async function fetchDocumentBytes(client, endpoint, documentRef, options, headers, what) {
|
|
27
|
-
const ref = chunkZWFMFOGP_cjs.parseVersionRef(documentRef);
|
|
28
|
-
const version = options.version ?? ref.version;
|
|
29
|
-
const { data, response } = await client.GET(endpoint, {
|
|
30
|
-
params: { path: { document_ext_id: ref.docId }, query: version ? { version } : {} },
|
|
31
|
-
headers,
|
|
32
|
-
parseAs: "blob",
|
|
33
|
-
signal: options.signal
|
|
34
|
-
});
|
|
35
|
-
if (!response.ok || !(data instanceof Blob)) {
|
|
36
|
-
throw new DocumentFetchError(
|
|
37
|
-
`${what} could not be loaded (${response.status})`,
|
|
38
|
-
response.status
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
return { blob: data, response };
|
|
42
|
-
}
|
|
43
|
-
function contentDispositionFileName(header) {
|
|
44
|
-
if (!header) return void 0;
|
|
45
|
-
const extended = /filename\*\s*=\s*(?:[\w-]+)?'[^']*'([^;]+)/i.exec(header);
|
|
46
|
-
if (extended) {
|
|
47
|
-
try {
|
|
48
|
-
return decodeURIComponent(extended[1].trim().replace(/^"|"$/g, "")) || void 0;
|
|
49
|
-
} catch {
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const plain = /filename\s*=\s*("((?:[^"\\]|\\.)*)"|[^;]+)/i.exec(header);
|
|
53
|
-
if (!plain) return void 0;
|
|
54
|
-
const name = plain[2] !== void 0 ? plain[2].replace(/\\(.)/g, "$1") : plain[1].trim();
|
|
55
|
-
return name || void 0;
|
|
56
|
-
}
|
|
57
|
-
async function fetchDocumentPdf(client, documentRef, options = {}) {
|
|
58
|
-
const { blob } = await fetchDocumentBytes(
|
|
59
|
-
client,
|
|
60
|
-
"/v1/document/{document_ext_id}/view",
|
|
61
|
-
documentRef,
|
|
62
|
-
options,
|
|
63
|
-
{ Accept: "application/pdf" },
|
|
64
|
-
"The PDF"
|
|
65
|
-
);
|
|
66
|
-
return blob;
|
|
67
|
-
}
|
|
68
|
-
async function fetchDocumentFile(client, documentRef, options = {}) {
|
|
69
|
-
const { blob, response } = await fetchDocumentBytes(
|
|
70
|
-
client,
|
|
71
|
-
"/v1/document/{document_ext_id}/download",
|
|
72
|
-
documentRef,
|
|
73
|
-
options,
|
|
74
|
-
{},
|
|
75
|
-
"The file"
|
|
76
|
-
);
|
|
77
|
-
const name = contentDispositionFileName(response.headers.get("Content-Disposition"));
|
|
78
|
-
return name ? new File([blob], name, { type: blob.type }) : blob;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
17
|
// src/document-tools/production.ts
|
|
82
18
|
var PRODUCTIONS_FOLDER = "Productions";
|
|
83
19
|
var extensionOf = (fileName) => {
|
|
@@ -103,9 +39,9 @@ async function fetchProductionPdf(client, doc) {
|
|
|
103
39
|
const pdf = isPdfDocument(doc);
|
|
104
40
|
let blob;
|
|
105
41
|
try {
|
|
106
|
-
blob = await (pdf ? fetchDocumentFile : fetchDocumentPdf)(client, doc.external_id);
|
|
42
|
+
blob = await (pdf ? chunkQKNJ6FRD_cjs.fetchDocumentFile : chunkQKNJ6FRD_cjs.fetchDocumentPdf)(client, doc.external_id);
|
|
107
43
|
} catch (e) {
|
|
108
|
-
if (!pdf && e instanceof DocumentFetchError) return null;
|
|
44
|
+
if (!pdf && e instanceof chunkQKNJ6FRD_cjs.DocumentFetchError) return null;
|
|
109
45
|
throw e;
|
|
110
46
|
}
|
|
111
47
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
@@ -449,7 +385,7 @@ async function fetchMarkupPdf(client, documentId, version) {
|
|
|
449
385
|
}
|
|
450
386
|
var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
|
|
451
387
|
function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
|
|
452
|
-
const { client, notify, saveFile, onDocumentsChanged } =
|
|
388
|
+
const { client, notify, saveFile, onDocumentsChanged } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
453
389
|
const documentId = documentData?.external_id;
|
|
454
390
|
const currentVersion = documentData?.current_version ?? 1;
|
|
455
391
|
const shownVersion = snapshotVersion ?? currentVersion;
|
|
@@ -622,7 +558,7 @@ function useIsOnline() {
|
|
|
622
558
|
}
|
|
623
559
|
var documentBytesKey = (documentRef, version, kind) => version === void 0 ? ["arbi", "documentBytes", documentRef] : ["arbi", "documentBytes", documentRef, version, kind ?? "pdf"];
|
|
624
560
|
function useDocumentBytes(documentRef, options) {
|
|
625
|
-
const { client } =
|
|
561
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
626
562
|
const { version, kind, enabled = true, fallback } = options;
|
|
627
563
|
return reactQuery.useQuery({
|
|
628
564
|
queryKey: documentBytesKey(documentRef, version ?? null, kind),
|
|
@@ -632,7 +568,7 @@ function useDocumentBytes(documentRef, options) {
|
|
|
632
568
|
if (offline) return offline;
|
|
633
569
|
}
|
|
634
570
|
try {
|
|
635
|
-
return await (kind === "original" ? fetchDocumentFile : fetchDocumentPdf)(
|
|
571
|
+
return await (kind === "original" ? chunkQKNJ6FRD_cjs.fetchDocumentFile : chunkQKNJ6FRD_cjs.fetchDocumentPdf)(
|
|
636
572
|
client,
|
|
637
573
|
documentRef,
|
|
638
574
|
{ signal }
|
|
@@ -678,7 +614,7 @@ async function fetchDocumentSignatures(client, documentRef) {
|
|
|
678
614
|
return data;
|
|
679
615
|
}
|
|
680
616
|
function useDocumentSignatures(documentId, enabled = true) {
|
|
681
|
-
const { client } =
|
|
617
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
682
618
|
const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentId);
|
|
683
619
|
return reactQuery.useQuery({
|
|
684
620
|
queryKey: [
|
|
@@ -749,7 +685,7 @@ async function signDocument(client$1, deploymentDomain, {
|
|
|
749
685
|
return signed.data;
|
|
750
686
|
}
|
|
751
687
|
function useSignDocument() {
|
|
752
|
-
const env =
|
|
688
|
+
const env = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
753
689
|
const queryClient = reactQuery.useQueryClient();
|
|
754
690
|
return reactQuery.useMutation({
|
|
755
691
|
mutationFn: (vars) => {
|
|
@@ -795,7 +731,7 @@ async function fetchSignatureVerification(client, reference) {
|
|
|
795
731
|
return data;
|
|
796
732
|
}
|
|
797
733
|
function useSignatureVerification(reference) {
|
|
798
|
-
const { client } =
|
|
734
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
799
735
|
return reactQuery.useQuery({
|
|
800
736
|
queryKey: ["get", VERIFY_PATH, { params: { path: { reference } } }],
|
|
801
737
|
queryFn: () => fetchSignatureVerification(client, reference),
|
|
@@ -883,7 +819,7 @@ async function fetchDocumentSignatureRequests(client, documentId) {
|
|
|
883
819
|
return data;
|
|
884
820
|
}
|
|
885
821
|
function useDocumentSignatureRequests(documentId, enabled = true) {
|
|
886
|
-
const { client } =
|
|
822
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
887
823
|
return reactQuery.useQuery({
|
|
888
824
|
queryKey: [...REQUESTS_KEY, "document", documentId],
|
|
889
825
|
queryFn: () => fetchDocumentSignatureRequests(client, documentId),
|
|
@@ -892,7 +828,7 @@ function useDocumentSignatureRequests(documentId, enabled = true) {
|
|
|
892
828
|
});
|
|
893
829
|
}
|
|
894
830
|
function useSignatureRequestsAwaitingMe(enabled = true) {
|
|
895
|
-
const { client } =
|
|
831
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
896
832
|
return reactQuery.useQuery({
|
|
897
833
|
queryKey: [...REQUESTS_KEY, "awaiting-me"],
|
|
898
834
|
queryFn: async () => {
|
|
@@ -907,7 +843,7 @@ function useSignatureRequestsAwaitingMe(enabled = true) {
|
|
|
907
843
|
});
|
|
908
844
|
}
|
|
909
845
|
function useSignatureRequest(requestId) {
|
|
910
|
-
const { client } =
|
|
846
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
911
847
|
return reactQuery.useQuery({
|
|
912
848
|
queryKey: [...REQUESTS_KEY, "one", requestId],
|
|
913
849
|
queryFn: async () => {
|
|
@@ -957,7 +893,7 @@ function useInvalidateRequests() {
|
|
|
957
893
|
return () => queryClient.invalidateQueries({ queryKey: REQUESTS_KEY });
|
|
958
894
|
}
|
|
959
895
|
function useSaveSignatureRequest() {
|
|
960
|
-
const { client } =
|
|
896
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
961
897
|
const invalidate = useInvalidateRequests();
|
|
962
898
|
return reactQuery.useMutation({
|
|
963
899
|
mutationFn: (vars) => saveSignatureRequest(client, vars),
|
|
@@ -965,7 +901,7 @@ function useSaveSignatureRequest() {
|
|
|
965
901
|
});
|
|
966
902
|
}
|
|
967
903
|
function useVoidSignatureRequest() {
|
|
968
|
-
const { client } =
|
|
904
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
969
905
|
const invalidate = useInvalidateRequests();
|
|
970
906
|
return reactQuery.useMutation({
|
|
971
907
|
mutationFn: async (requestId) => {
|
|
@@ -979,7 +915,7 @@ function useVoidSignatureRequest() {
|
|
|
979
915
|
});
|
|
980
916
|
}
|
|
981
917
|
function useDeclineSignatureRequest() {
|
|
982
|
-
const { client } =
|
|
918
|
+
const { client } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
983
919
|
const invalidate = useInvalidateRequests();
|
|
984
920
|
return reactQuery.useMutation({
|
|
985
921
|
mutationFn: async ({ requestId, reason }) => {
|
|
@@ -1019,7 +955,7 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
|
|
|
1019
955
|
return signed.data;
|
|
1020
956
|
}
|
|
1021
957
|
function useSignSignatureRequest() {
|
|
1022
|
-
const env =
|
|
958
|
+
const env = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
1023
959
|
const invalidate = useInvalidateRequests();
|
|
1024
960
|
const queryClient = reactQuery.useQueryClient();
|
|
1025
961
|
return reactQuery.useMutation({
|
|
@@ -1039,7 +975,7 @@ function useSignSignatureRequest() {
|
|
|
1039
975
|
});
|
|
1040
976
|
}
|
|
1041
977
|
function useSignerCandidates(enabled = true) {
|
|
1042
|
-
const { client, user } =
|
|
978
|
+
const { client, user } = chunkQKNJ6FRD_cjs.useDocumentTools();
|
|
1043
979
|
return reactQuery.useQuery({
|
|
1044
980
|
queryKey: [...REQUESTS_KEY, "candidates"],
|
|
1045
981
|
queryFn: async () => {
|
|
@@ -1061,40 +997,55 @@ function useSignerCandidates(enabled = true) {
|
|
|
1061
997
|
});
|
|
1062
998
|
}
|
|
1063
999
|
|
|
1000
|
+
Object.defineProperty(exports, "DocumentFetchError", {
|
|
1001
|
+
enumerable: true,
|
|
1002
|
+
get: function () { return chunkQKNJ6FRD_cjs.DocumentFetchError; }
|
|
1003
|
+
});
|
|
1064
1004
|
Object.defineProperty(exports, "DocumentToolsProvider", {
|
|
1065
1005
|
enumerable: true,
|
|
1066
|
-
get: function () { return
|
|
1006
|
+
get: function () { return chunkQKNJ6FRD_cjs.DocumentToolsProvider; }
|
|
1067
1007
|
});
|
|
1068
1008
|
Object.defineProperty(exports, "certificateLink", {
|
|
1069
1009
|
enumerable: true,
|
|
1070
|
-
get: function () { return
|
|
1010
|
+
get: function () { return chunkQKNJ6FRD_cjs.certificateLink; }
|
|
1071
1011
|
});
|
|
1072
1012
|
Object.defineProperty(exports, "clientUpload", {
|
|
1073
1013
|
enumerable: true,
|
|
1074
|
-
get: function () { return
|
|
1014
|
+
get: function () { return chunkQKNJ6FRD_cjs.clientUpload; }
|
|
1015
|
+
});
|
|
1016
|
+
Object.defineProperty(exports, "contentDispositionFileName", {
|
|
1017
|
+
enumerable: true,
|
|
1018
|
+
get: function () { return chunkQKNJ6FRD_cjs.contentDispositionFileName; }
|
|
1075
1019
|
});
|
|
1076
1020
|
Object.defineProperty(exports, "defaultCertificateUrl", {
|
|
1077
1021
|
enumerable: true,
|
|
1078
|
-
get: function () { return
|
|
1022
|
+
get: function () { return chunkQKNJ6FRD_cjs.defaultCertificateUrl; }
|
|
1079
1023
|
});
|
|
1080
1024
|
Object.defineProperty(exports, "downloadBlob", {
|
|
1081
1025
|
enumerable: true,
|
|
1082
|
-
get: function () { return
|
|
1026
|
+
get: function () { return chunkQKNJ6FRD_cjs.downloadBlob; }
|
|
1027
|
+
});
|
|
1028
|
+
Object.defineProperty(exports, "fetchDocumentFile", {
|
|
1029
|
+
enumerable: true,
|
|
1030
|
+
get: function () { return chunkQKNJ6FRD_cjs.fetchDocumentFile; }
|
|
1031
|
+
});
|
|
1032
|
+
Object.defineProperty(exports, "fetchDocumentPdf", {
|
|
1033
|
+
enumerable: true,
|
|
1034
|
+
get: function () { return chunkQKNJ6FRD_cjs.fetchDocumentPdf; }
|
|
1083
1035
|
});
|
|
1084
1036
|
Object.defineProperty(exports, "uploadQueryString", {
|
|
1085
1037
|
enumerable: true,
|
|
1086
|
-
get: function () { return
|
|
1038
|
+
get: function () { return chunkQKNJ6FRD_cjs.uploadQueryString; }
|
|
1087
1039
|
});
|
|
1088
1040
|
Object.defineProperty(exports, "useDocumentTools", {
|
|
1089
1041
|
enumerable: true,
|
|
1090
|
-
get: function () { return
|
|
1042
|
+
get: function () { return chunkQKNJ6FRD_cjs.useDocumentTools; }
|
|
1091
1043
|
});
|
|
1092
1044
|
Object.defineProperty(exports, "useOptionalDocumentTools", {
|
|
1093
1045
|
enumerable: true,
|
|
1094
|
-
get: function () { return
|
|
1046
|
+
get: function () { return chunkQKNJ6FRD_cjs.useOptionalDocumentTools; }
|
|
1095
1047
|
});
|
|
1096
1048
|
exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
|
|
1097
|
-
exports.DocumentFetchError = DocumentFetchError;
|
|
1098
1049
|
exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
|
|
1099
1050
|
exports.LEGACY_LAYER_PREFIX = LEGACY_LAYER_PREFIX;
|
|
1100
1051
|
exports.MARK_FIELD_TYPES = MARK_FIELD_TYPES;
|
|
@@ -1111,13 +1062,10 @@ exports.VERIFY_PATH = VERIFY_PATH;
|
|
|
1111
1062
|
exports.addToMarkup = addToMarkup;
|
|
1112
1063
|
exports.buildProduction = buildProduction;
|
|
1113
1064
|
exports.canAnnotate = canAnnotate;
|
|
1114
|
-
exports.contentDispositionFileName = contentDispositionFileName;
|
|
1115
1065
|
exports.copyOpenThreads = copyOpenThreads;
|
|
1116
1066
|
exports.createMarkupStore = createMarkupStore;
|
|
1117
1067
|
exports.currentHasMarkup = currentHasMarkup;
|
|
1118
1068
|
exports.documentBytesKey = documentBytesKey;
|
|
1119
|
-
exports.fetchDocumentFile = fetchDocumentFile;
|
|
1120
|
-
exports.fetchDocumentPdf = fetchDocumentPdf;
|
|
1121
1069
|
exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
|
|
1122
1070
|
exports.fetchDocumentSignatures = fetchDocumentSignatures;
|
|
1123
1071
|
exports.fetchMarkupPdf = fetchMarkupPdf;
|