@arbidocs/react 0.4.153 → 0.4.155

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.
Files changed (37) hide show
  1. package/dist/artifacts/index.cjs +20 -20
  2. package/dist/artifacts/index.js +3 -3
  3. package/dist/{chunk-YYTX3W6C.js → chunk-2HNEVAXO.js} +68 -3
  4. package/dist/chunk-2HNEVAXO.js.map +1 -0
  5. package/dist/{chunk-I7UUV7FP.cjs → chunk-37TQBT7Y.cjs} +14 -3
  6. package/dist/chunk-37TQBT7Y.cjs.map +1 -0
  7. package/dist/{chunk-KD7CKXWQ.js → chunk-6FGO7SCY.js} +182 -42
  8. package/dist/chunk-6FGO7SCY.js.map +1 -0
  9. package/dist/{chunk-OKDZDDJM.js → chunk-HKIR456G.js} +15 -4
  10. package/dist/chunk-HKIR456G.js.map +1 -0
  11. package/dist/{chunk-L57RRAII.cjs → chunk-QKNJ6FRD.cjs} +71 -2
  12. package/dist/chunk-QKNJ6FRD.cjs.map +1 -0
  13. package/dist/{chunk-L66ZJ2UI.cjs → chunk-VKWGRGY6.cjs} +188 -40
  14. package/dist/chunk-VKWGRGY6.cjs.map +1 -0
  15. package/dist/document-tools/index.cjs +41 -93
  16. package/dist/document-tools/index.cjs.map +1 -1
  17. package/dist/document-tools/index.js +3 -67
  18. package/dist/document-tools/index.js.map +1 -1
  19. package/dist/{index-BV7pBlgY.d.ts → index-CDTwtUr9.d.cts} +89 -1
  20. package/dist/{index-BV7pBlgY.d.cts → index-CDTwtUr9.d.ts} +89 -1
  21. package/dist/index.cjs +850 -457
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +193 -3
  24. package/dist/index.d.ts +193 -3
  25. package/dist/index.js +350 -9
  26. package/dist/index.js.map +1 -1
  27. package/dist/ui/index.cjs +193 -161
  28. package/dist/ui/index.d.cts +1 -1
  29. package/dist/ui/index.d.ts +1 -1
  30. package/dist/ui/index.js +2 -2
  31. package/package.json +7 -5
  32. package/dist/chunk-I7UUV7FP.cjs.map +0 -1
  33. package/dist/chunk-KD7CKXWQ.js.map +0 -1
  34. package/dist/chunk-L57RRAII.cjs.map +0 -1
  35. package/dist/chunk-L66ZJ2UI.cjs.map +0 -1
  36. package/dist/chunk-OKDZDDJM.js.map +0 -1
  37. package/dist/chunk-YYTX3W6C.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { useDocumentTools } from '../chunk-YYTX3W6C.js';
2
- export { DocumentToolsProvider, certificateLink, clientUpload, defaultCertificateUrl, downloadBlob, uploadQueryString, useDocumentTools, useOptionalDocumentTools } from '../chunk-YYTX3W6C.js';
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, DocumentFetchError, 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, contentDispositionFileName, copyOpenThreads, createMarkupStore, currentHasMarkup, documentBytesKey, fetchDocumentFile, fetchDocumentPdf, 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 };
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