@arbidocs/react 0.5.150 → 0.5.152
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/{chunk-VAHVEHKM.cjs → chunk-6RRKO4ZK.cjs} +3 -3
- package/dist/{chunk-VAHVEHKM.cjs.map → chunk-6RRKO4ZK.cjs.map} +1 -1
- package/dist/chunk-BI7HFGXF.cjs +507 -0
- package/dist/chunk-BI7HFGXF.cjs.map +1 -0
- package/dist/{chunk-HCUPZGAY.cjs → chunk-SKJWJ3OY.cjs} +26 -249
- package/dist/chunk-SKJWJ3OY.cjs.map +1 -0
- package/dist/{chunk-BCUKXFB6.cjs → chunk-WJIRX5MS.cjs} +5 -5
- package/dist/chunk-WJIRX5MS.cjs.map +1 -0
- package/dist/datasets/rows-source.js.map +2 -2
- package/dist/datasets/sources/activity.js +1 -1
- package/dist/datasets/sources/activity.js.map +2 -2
- package/dist/datasets/sources/conversations.js +1 -1
- package/dist/datasets/sources/conversations.js.map +2 -2
- package/dist/datasets/sources/database.js +17 -9
- package/dist/datasets/sources/database.js.map +2 -2
- package/dist/datasets/sources/documents.js +1 -1
- package/dist/datasets/sources/documents.js.map +2 -2
- package/dist/datasets/sources/facts.js +1 -1
- package/dist/datasets/sources/facts.js.map +2 -2
- package/dist/datasets/sources/projects.js +1 -1
- package/dist/datasets/sources/projects.js.map +2 -2
- package/dist/datasets/sources/tags.js +1 -1
- package/dist/datasets/sources/tags.js.map +2 -2
- package/dist/datasets/sources/usage.js +5 -4
- package/dist/datasets/sources/usage.js.map +2 -2
- package/dist/datasets/sources/workflows.js +1 -1
- package/dist/datasets/sources/workflows.js.map +2 -2
- package/dist/datasets/sources/workspaces.js +1 -1
- package/dist/datasets/sources/workspaces.js.map +2 -2
- package/dist/datasets/types.js.map +1 -1
- package/dist/directmessages/file-shares.js +88 -0
- package/dist/directmessages/file-shares.js.map +7 -0
- package/dist/directmessages/index.js +8 -0
- package/dist/directmessages/index.js.map +2 -2
- package/dist/document-tools/core.cjs +157 -149
- package/dist/document-tools/core.d.ts +5 -477
- package/dist/document-tools/core.js +4 -0
- package/dist/document-tools/core.js.map +2 -2
- package/dist/document-tools/file-shares.js +24 -5
- package/dist/document-tools/file-shares.js.map +2 -2
- package/dist/document-tools/index.cjs +159 -151
- package/dist/document-tools/index.d.ts +5 -5
- package/dist/{query-keys.d-BZolSssa.d.ts → file-shares.d-CamKxNLC.d.ts} +517 -1
- package/dist/index.cjs +431 -326
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-DbcrFwS6.d.ts → index.d-Dy_Pz6Vl.d.ts} +4 -0
- package/dist/index.d.ts +125 -15
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/index.js.map +2 -2
- package/dist/notifications/server-notifications.js +29 -7
- package/dist/notifications/server-notifications.js.map +2 -2
- package/dist/shell/index.cjs +38 -38
- package/dist/ui/card.js +2 -2
- package/dist/ui/card.js.map +2 -2
- package/dist/ui/index.cjs +160 -160
- package/dist/ui/index.d.ts +1 -1
- package/package.json +3 -3
- package/dist/chunk-ASL7H2TF.cjs +0 -264
- package/dist/chunk-ASL7H2TF.cjs.map +0 -1
- package/dist/chunk-BCUKXFB6.cjs.map +0 -1
- package/dist/chunk-HCUPZGAY.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var chunkP2DPOZBS_cjs = require('./chunk-P2DPOZBS.cjs');
|
|
3
|
+
var chunkBI7HFGXF_cjs = require('./chunk-BI7HFGXF.cjs');
|
|
5
4
|
var chunkSUZORMAB_cjs = require('./chunk-SUZORMAB.cjs');
|
|
6
5
|
var chunk2IJP73ZG_cjs = require('./chunk-2IJP73ZG.cjs');
|
|
6
|
+
var chunkP2DPOZBS_cjs = require('./chunk-P2DPOZBS.cjs');
|
|
7
7
|
var chunkKULS4YWP_cjs = require('./chunk-KULS4YWP.cjs');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var reactQuery = require('@tanstack/react-query');
|
|
@@ -210,7 +210,7 @@ function versionsWithMarkup(versions) {
|
|
|
210
210
|
}
|
|
211
211
|
var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
|
|
212
212
|
function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
|
|
213
|
-
const { client, notify, saveFile, onDocumentsChanged } =
|
|
213
|
+
const { client, notify, saveFile, onDocumentsChanged } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
214
214
|
const documentId = documentData?.external_id;
|
|
215
215
|
const currentVersion = documentData?.current_version ?? 1;
|
|
216
216
|
const shownVersion = snapshotVersion ?? currentVersion;
|
|
@@ -241,11 +241,11 @@ function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false)
|
|
|
241
241
|
const downloadMarkup = react.useCallback(async () => {
|
|
242
242
|
if (!documentId) return;
|
|
243
243
|
if (currentSigned) {
|
|
244
|
-
notify(
|
|
244
|
+
notify(chunkBI7HFGXF_cjs.SIGNED_LOCKED_REASON, "info");
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
247
|
try {
|
|
248
|
-
const { blob, fileName } = await
|
|
248
|
+
const { blob, fileName } = await chunkBI7HFGXF_cjs.fetchMarkupPdf(
|
|
249
249
|
client,
|
|
250
250
|
documentId,
|
|
251
251
|
snapshotVersion ? snapshotVersion : void 0
|
|
@@ -383,7 +383,7 @@ function useIsOnline() {
|
|
|
383
383
|
);
|
|
384
384
|
}
|
|
385
385
|
function useDocumentBytes(documentRef, options) {
|
|
386
|
-
const { client } =
|
|
386
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
387
387
|
const { version, kind, enabled = true, fallback, retryMissing = 0 } = options;
|
|
388
388
|
return reactQuery.useQuery({
|
|
389
389
|
queryKey: chunkP2DPOZBS_cjs.documentBytesKey(documentRef, version ?? null, kind),
|
|
@@ -393,7 +393,7 @@ function useDocumentBytes(documentRef, options) {
|
|
|
393
393
|
if (offline) return offline;
|
|
394
394
|
}
|
|
395
395
|
try {
|
|
396
|
-
return await (kind === "original" ?
|
|
396
|
+
return await (kind === "original" ? chunkBI7HFGXF_cjs.fetchDocumentFile : chunkBI7HFGXF_cjs.fetchDocumentPdf)(
|
|
397
397
|
client,
|
|
398
398
|
documentRef,
|
|
399
399
|
{ signal, version: chunkKULS4YWP_cjs.parseVersionRef(documentRef).version ?? version }
|
|
@@ -421,115 +421,6 @@ function useDocumentBytes(documentRef, options) {
|
|
|
421
421
|
refetchOnReconnect: "always"
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
|
-
function intentText(signer) {
|
|
425
|
-
return `I, ${signer.name.trim()}, sign this document electronically. I intend this electronic signature to have the same effect as my handwritten signature.`;
|
|
426
|
-
}
|
|
427
|
-
async function sha256Hex(blob) {
|
|
428
|
-
const digest = await crypto.subtle.digest("SHA-256", new Uint8Array(await blob.arrayBuffer()));
|
|
429
|
-
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
430
|
-
}
|
|
431
|
-
function toAppearance(box) {
|
|
432
|
-
return { page: box.page - 1, x: box.rect.x, y: box.rect.y, width: box.rect.w, height: box.rect.h };
|
|
433
|
-
}
|
|
434
|
-
var MIN_SIGNATURE_BOX = { width: 0.3, height: 0.07 };
|
|
435
|
-
function isLegibleSignatureBox(rect) {
|
|
436
|
-
return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height;
|
|
437
|
-
}
|
|
438
|
-
var SIGNATURES_PATH = "/v1/document/{document_ext_id}/signatures";
|
|
439
|
-
function errorDetail(error, fallback) {
|
|
440
|
-
const detail3 = error?.detail;
|
|
441
|
-
return typeof detail3 === "string" ? detail3 : fallback;
|
|
442
|
-
}
|
|
443
|
-
async function fetchDocumentSignatures(client, documentRef) {
|
|
444
|
-
const { docId, version } = chunkKULS4YWP_cjs.parseVersionRef(documentRef);
|
|
445
|
-
const { data, error } = await client.GET(SIGNATURES_PATH, {
|
|
446
|
-
params: { path: { document_ext_id: docId }, ...version ? { query: { version } } : {} }
|
|
447
|
-
});
|
|
448
|
-
if (!data) throw new Error(errorDetail(error, "The signatures could not be read"));
|
|
449
|
-
return data;
|
|
450
|
-
}
|
|
451
|
-
function useDocumentSignatures(documentId, enabled = true) {
|
|
452
|
-
const { client } = chunkASL7H2TF_cjs.useDocumentTools();
|
|
453
|
-
const { docId, version } = chunkKULS4YWP_cjs.parseVersionRef(documentId);
|
|
454
|
-
return reactQuery.useQuery({
|
|
455
|
-
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
|
|
456
|
-
queryFn: () => fetchDocumentSignatures(client, documentId),
|
|
457
|
-
enabled: enabled && !!docId,
|
|
458
|
-
staleTime: 6e4
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
var SigningError = class extends Error {
|
|
462
|
-
reason;
|
|
463
|
-
constructor(message, reason) {
|
|
464
|
-
super(message);
|
|
465
|
-
this.name = "SigningError";
|
|
466
|
-
this.reason = reason;
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
function signingErrorReason(detail3) {
|
|
470
|
-
if (/still being prepared/i.test(detail3)) return "preparing";
|
|
471
|
-
if (/no longer the current version/i.test(detail3)) return "stale";
|
|
472
|
-
return "failed";
|
|
473
|
-
}
|
|
474
|
-
function signingError(error, fallback) {
|
|
475
|
-
const detail3 = errorDetail(error, fallback);
|
|
476
|
-
return new SigningError(detail3, signingErrorReason(detail3));
|
|
477
|
-
}
|
|
478
|
-
var PREPARE_RETRIES = 3;
|
|
479
|
-
var PREPARE_RETRY_DELAY_MS = 1500;
|
|
480
|
-
var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
481
|
-
async function signDocument(client$1, deploymentDomain, {
|
|
482
|
-
documentId,
|
|
483
|
-
pdfBlob,
|
|
484
|
-
email,
|
|
485
|
-
password,
|
|
486
|
-
signer,
|
|
487
|
-
appearance,
|
|
488
|
-
includeDate = false,
|
|
489
|
-
version
|
|
490
|
-
}) {
|
|
491
|
-
const path = { document_ext_id: documentId };
|
|
492
|
-
const body = {
|
|
493
|
-
signer: { name: signer.name },
|
|
494
|
-
...appearance ? { appearance } : {},
|
|
495
|
-
include_date: includeDate,
|
|
496
|
-
...version ? { version } : {}
|
|
497
|
-
};
|
|
498
|
-
const prepare = () => client$1.POST("/v1/document/{document_ext_id}/sign/prepare", { params: { path }, body });
|
|
499
|
-
let prepared = await prepare();
|
|
500
|
-
for (let attempt = 0; !prepared.data && attempt < PREPARE_RETRIES; attempt++) {
|
|
501
|
-
if (signingError(prepared.error, "").reason !== "preparing") break;
|
|
502
|
-
await wait(PREPARE_RETRY_DELAY_MS);
|
|
503
|
-
prepared = await prepare();
|
|
504
|
-
}
|
|
505
|
-
if (!prepared.data) throw signingError(prepared.error, "Could not prepare signing");
|
|
506
|
-
const { statement, intent, source_sha256, timestamp } = prepared.data;
|
|
507
|
-
if (await sha256Hex(pdfBlob) !== source_sha256) {
|
|
508
|
-
throw new Error("The document changed since it was opened. Reopen it and sign again.");
|
|
509
|
-
}
|
|
510
|
-
if (intent !== intentText(signer)) throw new Error("Signing statement mismatch; not signed.");
|
|
511
|
-
const identity = await client.unlockIdentityWithPassword(email, password, deploymentDomain);
|
|
512
|
-
const signed = await client$1.POST("/v1/document/{document_ext_id}/sign", {
|
|
513
|
-
params: { path },
|
|
514
|
-
body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
|
|
515
|
-
});
|
|
516
|
-
if (!signed.data) throw signingError(signed.error, "Signing failed");
|
|
517
|
-
return signed.data;
|
|
518
|
-
}
|
|
519
|
-
function useSignDocument() {
|
|
520
|
-
const env = chunkASL7H2TF_cjs.useDocumentTools();
|
|
521
|
-
const queryClient = reactQuery.useQueryClient();
|
|
522
|
-
return reactQuery.useMutation({
|
|
523
|
-
mutationFn: (vars) => {
|
|
524
|
-
if (!env.deploymentDomain) throw new Error("Signing is not set up: no deployment domain");
|
|
525
|
-
return signDocument(env.client, env.deploymentDomain, vars);
|
|
526
|
-
},
|
|
527
|
-
onSuccess: async (result) => {
|
|
528
|
-
await env.onDocumentsChanged?.([result.doc_ext_id], "signed");
|
|
529
|
-
await queryClient.invalidateQueries({ queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.documentSignatures() });
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
424
|
var VERIFY_PATH = "/v1/sign/verify/{reference}";
|
|
534
425
|
var REFERENCE = /^sig-[0-9a-f]{32}$/;
|
|
535
426
|
function isSignatureReference(reference) {
|
|
@@ -563,7 +454,7 @@ async function fetchSignatureVerification(client, reference) {
|
|
|
563
454
|
return data;
|
|
564
455
|
}
|
|
565
456
|
function useSignatureVerification(reference) {
|
|
566
|
-
const { client } =
|
|
457
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
567
458
|
return reactQuery.useQuery({
|
|
568
459
|
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
|
|
569
460
|
queryFn: () => fetchSignatureVerification(client, reference),
|
|
@@ -572,7 +463,7 @@ function useSignatureVerification(reference) {
|
|
|
572
463
|
});
|
|
573
464
|
}
|
|
574
465
|
async function matchSignedCopy(file, verification) {
|
|
575
|
-
const hash = await sha256Hex(file);
|
|
466
|
+
const hash = await chunkBI7HFGXF_cjs.sha256Hex(file);
|
|
576
467
|
if (hash === verification.document_sha256.toLowerCase()) return { kind: "current" };
|
|
577
468
|
const signature = verification.signatures.find((s) => s.sha256.toLowerCase() === hash);
|
|
578
469
|
return signature ? { kind: "earlier", signature } : { kind: "none" };
|
|
@@ -672,7 +563,7 @@ async function fetchDocumentSignatureRequests(client, documentId) {
|
|
|
672
563
|
return data;
|
|
673
564
|
}
|
|
674
565
|
function useDocumentSignatureRequests(documentId, enabled = true) {
|
|
675
|
-
const { client } =
|
|
566
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
676
567
|
return reactQuery.useQuery({
|
|
677
568
|
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
|
|
678
569
|
queryFn: () => fetchDocumentSignatureRequests(client, documentId),
|
|
@@ -720,7 +611,7 @@ function useInvalidateRequests() {
|
|
|
720
611
|
return () => queryClient.invalidateQueries({ queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.signatureRequests() });
|
|
721
612
|
}
|
|
722
613
|
function useSaveSignatureRequest() {
|
|
723
|
-
const { client } =
|
|
614
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
724
615
|
const invalidate = useInvalidateRequests();
|
|
725
616
|
return reactQuery.useMutation({
|
|
726
617
|
mutationFn: (vars) => saveSignatureRequest(client, vars),
|
|
@@ -728,7 +619,7 @@ function useSaveSignatureRequest() {
|
|
|
728
619
|
});
|
|
729
620
|
}
|
|
730
621
|
function useVoidSignatureRequest() {
|
|
731
|
-
const { client } =
|
|
622
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
732
623
|
const invalidate = useInvalidateRequests();
|
|
733
624
|
return reactQuery.useMutation({
|
|
734
625
|
mutationFn: async (requestId) => {
|
|
@@ -742,7 +633,7 @@ function useVoidSignatureRequest() {
|
|
|
742
633
|
});
|
|
743
634
|
}
|
|
744
635
|
function useDeclineSignatureRequest() {
|
|
745
|
-
const { client } =
|
|
636
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
746
637
|
const invalidate = useInvalidateRequests();
|
|
747
638
|
return reactQuery.useMutation({
|
|
748
639
|
mutationFn: async ({ requestId, reason }) => {
|
|
@@ -764,13 +655,13 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
|
|
|
764
655
|
body
|
|
765
656
|
});
|
|
766
657
|
if (!prepared.data) {
|
|
767
|
-
throw new SigningError(detail(prepared.error, "Could not prepare signing"), "failed");
|
|
658
|
+
throw new chunkBI7HFGXF_cjs.SigningError(detail(prepared.error, "Could not prepare signing"), "failed");
|
|
768
659
|
}
|
|
769
660
|
const { statement, intent, source_sha256, timestamp } = prepared.data;
|
|
770
|
-
if (source_sha256 !== request.source_sha256 || await sha256Hex(pdfBlob) !== source_sha256) {
|
|
771
|
-
throw new SigningError("The document changed since it was sent. Ask for it again.", "stale");
|
|
661
|
+
if (source_sha256 !== request.source_sha256 || await chunkBI7HFGXF_cjs.sha256Hex(pdfBlob) !== source_sha256) {
|
|
662
|
+
throw new chunkBI7HFGXF_cjs.SigningError("The document changed since it was sent. Ask for it again.", "stale");
|
|
772
663
|
}
|
|
773
|
-
if (intent !== intentText({ name: adopted.name })) {
|
|
664
|
+
if (intent !== chunkBI7HFGXF_cjs.intentText({ name: adopted.name })) {
|
|
774
665
|
throw new Error("Signing statement mismatch; not signed.");
|
|
775
666
|
}
|
|
776
667
|
const identity = await client.unlockIdentityWithPassword(email, password, deploymentDomain);
|
|
@@ -778,11 +669,11 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
|
|
|
778
669
|
params: { path },
|
|
779
670
|
body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
|
|
780
671
|
});
|
|
781
|
-
if (!signed.data) throw new SigningError(detail(signed.error, "Signing failed"), "failed");
|
|
672
|
+
if (!signed.data) throw new chunkBI7HFGXF_cjs.SigningError(detail(signed.error, "Signing failed"), "failed");
|
|
782
673
|
return signed.data;
|
|
783
674
|
}
|
|
784
675
|
function useSignSignatureRequest() {
|
|
785
|
-
const env =
|
|
676
|
+
const env = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
786
677
|
const invalidate = useInvalidateRequests();
|
|
787
678
|
const queryClient = reactQuery.useQueryClient();
|
|
788
679
|
return reactQuery.useMutation({
|
|
@@ -800,7 +691,7 @@ function useSignSignatureRequest() {
|
|
|
800
691
|
});
|
|
801
692
|
}
|
|
802
693
|
function useSignerCandidates(enabled = true) {
|
|
803
|
-
const { client, user } =
|
|
694
|
+
const { client, user } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
804
695
|
const { workspaceId, read } = useOpenWorkspaceRead();
|
|
805
696
|
return reactQuery.useQuery({
|
|
806
697
|
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.signatureCandidates(workspaceId ?? ""),
|
|
@@ -841,7 +732,7 @@ async function inviteSigners(client, documentId, emails) {
|
|
|
841
732
|
}
|
|
842
733
|
}
|
|
843
734
|
function useInviteSigners() {
|
|
844
|
-
const { client } =
|
|
735
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
845
736
|
const invalidate = useInvalidateRequests();
|
|
846
737
|
const queryClient = reactQuery.useQueryClient();
|
|
847
738
|
return reactQuery.useMutation({
|
|
@@ -885,7 +776,7 @@ async function deleteSavedSignature(client) {
|
|
|
885
776
|
if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
|
|
886
777
|
}
|
|
887
778
|
function useSavedSignature(enabled = true) {
|
|
888
|
-
const { client } =
|
|
779
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
889
780
|
return reactQuery.useQuery({
|
|
890
781
|
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.savedSignature(),
|
|
891
782
|
queryFn: () => fetchSavedSignature(client),
|
|
@@ -895,7 +786,7 @@ function useSavedSignature(enabled = true) {
|
|
|
895
786
|
});
|
|
896
787
|
}
|
|
897
788
|
function useStoreSavedSignature() {
|
|
898
|
-
const { client } =
|
|
789
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
899
790
|
const queryClient = reactQuery.useQueryClient();
|
|
900
791
|
return reactQuery.useMutation({
|
|
901
792
|
mutationFn: (signature) => storeSavedSignature(client, signature),
|
|
@@ -903,7 +794,7 @@ function useStoreSavedSignature() {
|
|
|
903
794
|
});
|
|
904
795
|
}
|
|
905
796
|
function useDeleteSavedSignature() {
|
|
906
|
-
const { client } =
|
|
797
|
+
const { client } = chunkBI7HFGXF_cjs.useDocumentTools();
|
|
907
798
|
const queryClient = reactQuery.useQueryClient();
|
|
908
799
|
return reactQuery.useMutation({
|
|
909
800
|
mutationFn: () => deleteSavedSignature(client),
|
|
@@ -921,103 +812,6 @@ function pngSize(base64) {
|
|
|
921
812
|
const view = new DataView(bytes.buffer);
|
|
922
813
|
return { width: view.getUint32(16), height: view.getUint32(20) };
|
|
923
814
|
}
|
|
924
|
-
function failure(error) {
|
|
925
|
-
const detail3 = error?.detail;
|
|
926
|
-
return new Error(typeof detail3 === "string" ? detail3 : "The shared file request failed");
|
|
927
|
-
}
|
|
928
|
-
async function createFileShare(client, documentId, body) {
|
|
929
|
-
const result = await client.POST("/v1/document/{document_ext_id}/file-shares", {
|
|
930
|
-
params: { path: { document_ext_id: documentId } },
|
|
931
|
-
body
|
|
932
|
-
});
|
|
933
|
-
if (!result.data) throw failure(result.error);
|
|
934
|
-
return result.data;
|
|
935
|
-
}
|
|
936
|
-
async function getFileShare(client, id) {
|
|
937
|
-
const result = await client.GET("/v1/file-shares/{share_id}", {
|
|
938
|
-
params: { path: { share_id: id } }
|
|
939
|
-
});
|
|
940
|
-
if (!result.data) throw failure(result.error);
|
|
941
|
-
return result.data;
|
|
942
|
-
}
|
|
943
|
-
async function fileShareBytes(client, id, kind) {
|
|
944
|
-
const result = await client.GET("/v1/file-shares/{share_id}/file", {
|
|
945
|
-
params: { path: { share_id: id }, query: { kind } },
|
|
946
|
-
parseAs: "blob"
|
|
947
|
-
});
|
|
948
|
-
if (!result.data) throw failure(result.error);
|
|
949
|
-
return result.data;
|
|
950
|
-
}
|
|
951
|
-
function fileShareSigningRequest(share) {
|
|
952
|
-
return {
|
|
953
|
-
external_id: share.external_id,
|
|
954
|
-
doc_ext_id: share.document_ext_id,
|
|
955
|
-
version: share.version,
|
|
956
|
-
source_sha256: share.source_sha256,
|
|
957
|
-
fields: share.fields,
|
|
958
|
-
message: share.message,
|
|
959
|
-
status: share.status === "signing" ? "sent" : share.status === "completed" ? "completed" : "voided",
|
|
960
|
-
signers: share.recipients.filter((r) => r.permission === "sign").map((r) => ({
|
|
961
|
-
external_id: r.email,
|
|
962
|
-
email: r.email,
|
|
963
|
-
name: r.email,
|
|
964
|
-
status: r.status === "signed" ? "signed" : "pending",
|
|
965
|
-
progress: r.status === "signed" ? "signed" : "registered",
|
|
966
|
-
fields: share.fields.filter((f) => f.signer === r.email).length
|
|
967
|
-
})),
|
|
968
|
-
created_at: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
969
|
-
stale: false
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
async function signFileShare(client$1, domain, vars) {
|
|
973
|
-
const path = { share_id: vars.request.external_id };
|
|
974
|
-
const body = { adopted: vars.adopted, fields: vars.fields };
|
|
975
|
-
const prepared = await client$1.POST("/v1/file-shares/{share_id}/sign/prepare", {
|
|
976
|
-
params: { path },
|
|
977
|
-
body
|
|
978
|
-
});
|
|
979
|
-
if (!prepared.data) throw failure(prepared.error);
|
|
980
|
-
const { statement, timestamp, source_sha256, intent } = prepared.data;
|
|
981
|
-
if (source_sha256 !== vars.request.source_sha256 || await sha256Hex(vars.pdfBlob) !== source_sha256)
|
|
982
|
-
throw new Error("The shared file changed. Ask the sender for a new request.");
|
|
983
|
-
if (intent !== intentText({ name: vars.adopted.name }))
|
|
984
|
-
throw new Error("Signing statement mismatch");
|
|
985
|
-
const identity = await client.unlockIdentityWithPassword(vars.email, vars.password, domain);
|
|
986
|
-
const result = await client$1.POST("/v1/file-shares/{share_id}/sign", {
|
|
987
|
-
params: { path },
|
|
988
|
-
body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
|
|
989
|
-
});
|
|
990
|
-
if (!result.data) throw failure(result.error);
|
|
991
|
-
return {
|
|
992
|
-
request: fileShareSigningRequest(result.data),
|
|
993
|
-
completed: result.data.status === "completed"
|
|
994
|
-
};
|
|
995
|
-
}
|
|
996
|
-
function useFileShare(client, shareId, signing) {
|
|
997
|
-
return reactQuery.useQuery({
|
|
998
|
-
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.fileShare(shareId),
|
|
999
|
-
queryFn: () => getFileShare(client, shareId),
|
|
1000
|
-
refetchInterval: signing ? false : 5e3
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
function useFileSharePdf(client, shareId, share) {
|
|
1004
|
-
return reactQuery.useQuery({
|
|
1005
|
-
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.fileSharePdf(shareId, share?.status),
|
|
1006
|
-
queryFn: () => fileShareBytes(client, shareId, share?.status === "completed" ? "signed" : "view"),
|
|
1007
|
-
enabled: !!share?.can_preview,
|
|
1008
|
-
staleTime: Infinity
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
function useFileShares(client) {
|
|
1012
|
-
return reactQuery.useQuery({
|
|
1013
|
-
queryKey: chunkP2DPOZBS_cjs.arbiQueryKeys.fileShares(),
|
|
1014
|
-
queryFn: async () => {
|
|
1015
|
-
const result = await client.GET("/v1/file-shares");
|
|
1016
|
-
if (!result.data) throw new Error("Could not load shared files");
|
|
1017
|
-
return result.data;
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
815
|
|
|
1022
816
|
exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
|
|
1023
817
|
exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
|
|
@@ -1030,30 +824,22 @@ exports.SIGNATURE_FIELD_TYPES = SIGNATURE_FIELD_TYPES;
|
|
|
1030
824
|
exports.SIGNED_UNCHANGED = SIGNED_UNCHANGED;
|
|
1031
825
|
exports.SIGNER_PROGRESS_LABELS = SIGNER_PROGRESS_LABELS;
|
|
1032
826
|
exports.SignatureVerificationError = SignatureVerificationError;
|
|
1033
|
-
exports.SigningError = SigningError;
|
|
1034
827
|
exports.VERIFY_PATH = VERIFY_PATH;
|
|
1035
828
|
exports.addToMarkup = addToMarkup;
|
|
1036
829
|
exports.canAnnotate = canAnnotate;
|
|
1037
830
|
exports.copyOpenThreads = copyOpenThreads;
|
|
1038
|
-
exports.createFileShare = createFileShare;
|
|
1039
831
|
exports.createMarkupStore = createMarkupStore;
|
|
1040
832
|
exports.deleteSavedSignature = deleteSavedSignature;
|
|
1041
833
|
exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
|
|
1042
|
-
exports.fetchDocumentSignatures = fetchDocumentSignatures;
|
|
1043
834
|
exports.fetchSavedSignature = fetchSavedSignature;
|
|
1044
835
|
exports.fetchSignatureVerification = fetchSignatureVerification;
|
|
1045
836
|
exports.fieldsFromSuggestions = fieldsFromSuggestions;
|
|
1046
837
|
exports.fieldsInSigningOrder = fieldsInSigningOrder;
|
|
1047
|
-
exports.fileShareBytes = fileShareBytes;
|
|
1048
|
-
exports.fileShareSigningRequest = fileShareSigningRequest;
|
|
1049
838
|
exports.forgetLegacyLayer = forgetLegacyLayer;
|
|
1050
839
|
exports.frozenCopyName = frozenCopyName;
|
|
1051
|
-
exports.getFileShare = getFileShare;
|
|
1052
840
|
exports.initialsOf = initialsOf;
|
|
1053
|
-
exports.intentText = intentText;
|
|
1054
841
|
exports.inviteSigners = inviteSigners;
|
|
1055
842
|
exports.isEmailSigner = isEmailSigner;
|
|
1056
|
-
exports.isLegibleSignatureBox = isLegibleSignatureBox;
|
|
1057
843
|
exports.isSignatureReference = isSignatureReference;
|
|
1058
844
|
exports.marksByVersion = marksByVersion;
|
|
1059
845
|
exports.matchSignedCopy = matchSignedCopy;
|
|
@@ -1066,35 +852,26 @@ exports.readLegacyLayer = readLegacyLayer;
|
|
|
1066
852
|
exports.redactionLogName = redactionLogName;
|
|
1067
853
|
exports.saveSignatureRequest = saveSignatureRequest;
|
|
1068
854
|
exports.sendBlocker = sendBlocker;
|
|
1069
|
-
exports.sha256Hex = sha256Hex;
|
|
1070
|
-
exports.signDocument = signDocument;
|
|
1071
|
-
exports.signFileShare = signFileShare;
|
|
1072
855
|
exports.signSignatureRequest = signSignatureRequest;
|
|
1073
856
|
exports.signatureFieldSuggestions = signatureFieldSuggestions;
|
|
1074
857
|
exports.splitSuggestions = splitSuggestions;
|
|
1075
858
|
exports.storeSavedSignature = storeSavedSignature;
|
|
1076
859
|
exports.suggestSignatureFields = suggestSignatureFields;
|
|
1077
|
-
exports.toAppearance = toAppearance;
|
|
1078
860
|
exports.uploadFrozenCopy = uploadFrozenCopy;
|
|
1079
861
|
exports.useDeclineSignatureRequest = useDeclineSignatureRequest;
|
|
1080
862
|
exports.useDeleteSavedSignature = useDeleteSavedSignature;
|
|
1081
863
|
exports.useDocumentBytes = useDocumentBytes;
|
|
1082
864
|
exports.useDocumentMarkup = useDocumentMarkup;
|
|
1083
865
|
exports.useDocumentSignatureRequests = useDocumentSignatureRequests;
|
|
1084
|
-
exports.useDocumentSignatures = useDocumentSignatures;
|
|
1085
|
-
exports.useFileShare = useFileShare;
|
|
1086
|
-
exports.useFileSharePdf = useFileSharePdf;
|
|
1087
|
-
exports.useFileShares = useFileShares;
|
|
1088
866
|
exports.useInviteSigners = useInviteSigners;
|
|
1089
867
|
exports.useIsOnline = useIsOnline;
|
|
1090
868
|
exports.useSaveSignatureRequest = useSaveSignatureRequest;
|
|
1091
869
|
exports.useSavedSignature = useSavedSignature;
|
|
1092
|
-
exports.useSignDocument = useSignDocument;
|
|
1093
870
|
exports.useSignSignatureRequest = useSignSignatureRequest;
|
|
1094
871
|
exports.useSignatureVerification = useSignatureVerification;
|
|
1095
872
|
exports.useSignerCandidates = useSignerCandidates;
|
|
1096
873
|
exports.useStoreSavedSignature = useStoreSavedSignature;
|
|
1097
874
|
exports.useVoidSignatureRequest = useVoidSignatureRequest;
|
|
1098
875
|
exports.versionsWithMarkup = versionsWithMarkup;
|
|
1099
|
-
//# sourceMappingURL=chunk-
|
|
1100
|
-
//# sourceMappingURL=chunk-
|
|
876
|
+
//# sourceMappingURL=chunk-SKJWJ3OY.cjs.map
|
|
877
|
+
//# sourceMappingURL=chunk-SKJWJ3OY.cjs.map
|