@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,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentTools } from '../chunk-
|
|
2
|
-
export { DocumentToolsProvider, certificateLink, clientUpload, defaultCertificateUrl, downloadBlob, uploadQueryString, useDocumentTools, useOptionalDocumentTools } from '../chunk-
|
|
1
|
+
import { fetchDocumentFile, fetchDocumentPdf, DocumentFetchError, useDocumentTools } from '../chunk-2HNEVAXO.js';
|
|
2
|
+
export { DocumentFetchError, DocumentToolsProvider, certificateLink, clientUpload, contentDispositionFileName, defaultCertificateUrl, downloadBlob, fetchDocumentFile, fetchDocumentPdf, uploadQueryString, useDocumentTools, useOptionalDocumentTools } from '../chunk-2HNEVAXO.js';
|
|
3
3
|
import { mergeLayers, AnnotationStoreOfflineError } from '../chunk-IHTBAY57.js';
|
|
4
4
|
import { parseLayer, emptyLayer, LAYER_SCHEMA_VERSION } from '../chunk-COWZGCL5.js';
|
|
5
5
|
import { parseVersionRef } from '../chunk-NNWMHMEC.js';
|
|
@@ -13,70 +13,6 @@ import { useMemo, useState, useCallback, useEffect, useSyncExternalStore } from
|
|
|
13
13
|
import { onlineManager, useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
14
14
|
import { unlockIdentityWithPassword, signMessage } from '@arbidocs/client';
|
|
15
15
|
|
|
16
|
-
// src/document-tools/document-pdf.ts
|
|
17
|
-
var DocumentFetchError = class extends Error {
|
|
18
|
-
status;
|
|
19
|
-
constructor(message, status) {
|
|
20
|
-
super(message);
|
|
21
|
-
this.name = "DocumentFetchError";
|
|
22
|
-
this.status = status;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
async function fetchDocumentBytes(client, endpoint, documentRef, options, headers, what) {
|
|
26
|
-
const ref = parseVersionRef(documentRef);
|
|
27
|
-
const version = options.version ?? ref.version;
|
|
28
|
-
const { data, response } = await client.GET(endpoint, {
|
|
29
|
-
params: { path: { document_ext_id: ref.docId }, query: version ? { version } : {} },
|
|
30
|
-
headers,
|
|
31
|
-
parseAs: "blob",
|
|
32
|
-
signal: options.signal
|
|
33
|
-
});
|
|
34
|
-
if (!response.ok || !(data instanceof Blob)) {
|
|
35
|
-
throw new DocumentFetchError(
|
|
36
|
-
`${what} could not be loaded (${response.status})`,
|
|
37
|
-
response.status
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
return { blob: data, response };
|
|
41
|
-
}
|
|
42
|
-
function contentDispositionFileName(header) {
|
|
43
|
-
if (!header) return void 0;
|
|
44
|
-
const extended = /filename\*\s*=\s*(?:[\w-]+)?'[^']*'([^;]+)/i.exec(header);
|
|
45
|
-
if (extended) {
|
|
46
|
-
try {
|
|
47
|
-
return decodeURIComponent(extended[1].trim().replace(/^"|"$/g, "")) || void 0;
|
|
48
|
-
} catch {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const plain = /filename\s*=\s*("((?:[^"\\]|\\.)*)"|[^;]+)/i.exec(header);
|
|
52
|
-
if (!plain) return void 0;
|
|
53
|
-
const name = plain[2] !== void 0 ? plain[2].replace(/\\(.)/g, "$1") : plain[1].trim();
|
|
54
|
-
return name || void 0;
|
|
55
|
-
}
|
|
56
|
-
async function fetchDocumentPdf(client, documentRef, options = {}) {
|
|
57
|
-
const { blob } = await fetchDocumentBytes(
|
|
58
|
-
client,
|
|
59
|
-
"/v1/document/{document_ext_id}/view",
|
|
60
|
-
documentRef,
|
|
61
|
-
options,
|
|
62
|
-
{ Accept: "application/pdf" },
|
|
63
|
-
"The PDF"
|
|
64
|
-
);
|
|
65
|
-
return blob;
|
|
66
|
-
}
|
|
67
|
-
async function fetchDocumentFile(client, documentRef, options = {}) {
|
|
68
|
-
const { blob, response } = await fetchDocumentBytes(
|
|
69
|
-
client,
|
|
70
|
-
"/v1/document/{document_ext_id}/download",
|
|
71
|
-
documentRef,
|
|
72
|
-
options,
|
|
73
|
-
{},
|
|
74
|
-
"The file"
|
|
75
|
-
);
|
|
76
|
-
const name = contentDispositionFileName(response.headers.get("Content-Disposition"));
|
|
77
|
-
return name ? new File([blob], name, { type: blob.type }) : blob;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
16
|
// src/document-tools/production.ts
|
|
81
17
|
var PRODUCTIONS_FOLDER = "Productions";
|
|
82
18
|
var extensionOf = (fileName) => {
|
|
@@ -1060,6 +996,6 @@ function useSignerCandidates(enabled = true) {
|
|
|
1060
996
|
});
|
|
1061
997
|
}
|
|
1062
998
|
|
|
1063
|
-
export { DEFAULT_FIELD_SIZE,
|
|
999
|
+
export { DEFAULT_FIELD_SIZE, FIELD_TYPE_LABELS, LEGACY_LAYER_PREFIX, MARK_FIELD_TYPES, MAX_MERGE_ATTEMPTS, MarkupDownloadError, MarkupStoreError, PRODUCTIONS_FOLDER, SIGNATURE_FIELD_TYPES, SIGNED_LOCKED_REASON, SIGNED_UNCHANGED, SignatureVerificationError, SigningError, VERIFY_PATH, addToMarkup, buildProduction, canAnnotate, copyOpenThreads, createMarkupStore, currentHasMarkup, documentBytesKey, fetchDocumentSignatureRequests, fetchDocumentSignatures, fetchMarkupPdf, fetchProductionPdf, fetchSignatureVerification, fieldsFromSuggestions, fieldsInSigningOrder, forgetLegacyLayer, frozenCopyName, hasNoRendition, initialsOf, intentText, isLegibleSignatureBox, isPdfDocument, isSignatureReference, isSignedVersion, marksByVersion, matchSignedCopy, migrateLegacyLayer, newFieldId, openThreadsOf, productionDocumentName, productionFileName, productionFolder, productionIndexCsv, productionTitle, readLegacyLayer, redactionLogName, saveProductionFiles, saveSignatureRequest, sendBlocker, sha256Hex, signDocument, signSignatureRequest, suggestSignatureFields, toAppearance, uploadFrozenCopy, useDeclineSignatureRequest, useDocumentBytes, useDocumentMarkup, useDocumentSignatureRequests, useDocumentSignatures, useIsOnline, useSaveSignatureRequest, useSignDocument, useSignSignatureRequest, useSignatureRequest, useSignatureRequestsAwaitingMe, useSignatureVerification, useSignerCandidates, useVoidSignatureRequest, versionsWithMarkup };
|
|
1064
1000
|
//# sourceMappingURL=index.js.map
|
|
1065
1001
|
//# sourceMappingURL=index.js.map
|