@arbidocs/react 0.5.153 → 0.5.154

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.
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkNJWQPNGD_cjs = require('./chunk-NJWQPNGD.cjs');
3
+ var chunkH2TP7JWR_cjs = require('./chunk-H2TP7JWR.cjs');
4
4
  var chunkSUZORMAB_cjs = require('./chunk-SUZORMAB.cjs');
5
5
  var chunk2IJP73ZG_cjs = require('./chunk-2IJP73ZG.cjs');
6
6
  var chunk5ZNO77YB_cjs = require('./chunk-5ZNO77YB.cjs');
7
- var chunkDQODLWFX_cjs = require('./chunk-DQODLWFX.cjs');
7
+ var chunkKULS4YWP_cjs = require('./chunk-KULS4YWP.cjs');
8
8
  var react = require('react');
9
9
  var reactQuery = require('@tanstack/react-query');
10
10
  var client = require('@arbidocs/client');
@@ -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 } = chunkNJWQPNGD_cjs.useDocumentTools();
213
+ const { client, notify, saveFile, onDocumentsChanged } = chunkH2TP7JWR_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(chunkNJWQPNGD_cjs.SIGNED_LOCKED_REASON, "info");
244
+ notify(chunkH2TP7JWR_cjs.SIGNED_LOCKED_REASON, "info");
245
245
  return;
246
246
  }
247
247
  try {
248
- const { blob, fileName } = await chunkNJWQPNGD_cjs.fetchMarkupPdf(
248
+ const { blob, fileName } = await chunkH2TP7JWR_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 } = chunkNJWQPNGD_cjs.useDocumentTools();
386
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
387
387
  const { version, kind, enabled = true, fallback, retryMissing = 0 } = options;
388
388
  return reactQuery.useQuery({
389
389
  queryKey: chunk5ZNO77YB_cjs.documentBytesKey(documentRef, version ?? null, kind),
@@ -393,10 +393,10 @@ function useDocumentBytes(documentRef, options) {
393
393
  if (offline) return offline;
394
394
  }
395
395
  try {
396
- return await (kind === "original" ? chunkNJWQPNGD_cjs.fetchDocumentFile : chunkNJWQPNGD_cjs.fetchDocumentPdf)(
396
+ return await (kind === "original" ? chunkH2TP7JWR_cjs.fetchDocumentFile : chunkH2TP7JWR_cjs.fetchDocumentPdf)(
397
397
  client,
398
398
  documentRef,
399
- { signal, version: chunkDQODLWFX_cjs.parseVersionRef(documentRef).version ?? version }
399
+ { signal, version: chunkKULS4YWP_cjs.parseVersionRef(documentRef).version ?? version }
400
400
  );
401
401
  } catch (error) {
402
402
  const offline = await fallback?.();
@@ -454,7 +454,7 @@ async function fetchSignatureVerification(client, reference) {
454
454
  return data;
455
455
  }
456
456
  function useSignatureVerification(reference) {
457
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
457
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
458
458
  return reactQuery.useQuery({
459
459
  queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
460
460
  queryFn: () => fetchSignatureVerification(client, reference),
@@ -463,7 +463,7 @@ function useSignatureVerification(reference) {
463
463
  });
464
464
  }
465
465
  async function matchSignedCopy(file, verification) {
466
- const hash = await chunkNJWQPNGD_cjs.sha256Hex(file);
466
+ const hash = await chunkH2TP7JWR_cjs.sha256Hex(file);
467
467
  if (hash === verification.document_sha256.toLowerCase()) return { kind: "current" };
468
468
  const signature = verification.signatures.find((s) => s.sha256.toLowerCase() === hash);
469
469
  return signature ? { kind: "earlier", signature } : { kind: "none" };
@@ -563,7 +563,7 @@ async function fetchDocumentSignatureRequests(client, documentId) {
563
563
  return data;
564
564
  }
565
565
  function useDocumentSignatureRequests(documentId, enabled = true) {
566
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
566
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
567
567
  return reactQuery.useQuery({
568
568
  queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
569
569
  queryFn: () => fetchDocumentSignatureRequests(client, documentId),
@@ -611,7 +611,7 @@ function useInvalidateRequests() {
611
611
  return () => queryClient.invalidateQueries({ queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.signatureRequests() });
612
612
  }
613
613
  function useSaveSignatureRequest() {
614
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
614
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
615
615
  const invalidate = useInvalidateRequests();
616
616
  return reactQuery.useMutation({
617
617
  mutationFn: (vars) => saveSignatureRequest(client, vars),
@@ -619,7 +619,7 @@ function useSaveSignatureRequest() {
619
619
  });
620
620
  }
621
621
  function useVoidSignatureRequest() {
622
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
622
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
623
623
  const invalidate = useInvalidateRequests();
624
624
  return reactQuery.useMutation({
625
625
  mutationFn: async (requestId) => {
@@ -633,7 +633,7 @@ function useVoidSignatureRequest() {
633
633
  });
634
634
  }
635
635
  function useDeclineSignatureRequest() {
636
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
636
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
637
637
  const invalidate = useInvalidateRequests();
638
638
  return reactQuery.useMutation({
639
639
  mutationFn: async ({ requestId, reason }) => {
@@ -655,13 +655,13 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
655
655
  body
656
656
  });
657
657
  if (!prepared.data) {
658
- throw new chunkNJWQPNGD_cjs.SigningError(detail(prepared.error, "Could not prepare signing"), "failed");
658
+ throw new chunkH2TP7JWR_cjs.SigningError(detail(prepared.error, "Could not prepare signing"), "failed");
659
659
  }
660
660
  const { statement, intent, source_sha256, timestamp } = prepared.data;
661
- if (source_sha256 !== request.source_sha256 || await chunkNJWQPNGD_cjs.sha256Hex(pdfBlob) !== source_sha256) {
662
- throw new chunkNJWQPNGD_cjs.SigningError("The document changed since it was sent. Ask for it again.", "stale");
661
+ if (source_sha256 !== request.source_sha256 || await chunkH2TP7JWR_cjs.sha256Hex(pdfBlob) !== source_sha256) {
662
+ throw new chunkH2TP7JWR_cjs.SigningError("The document changed since it was sent. Ask for it again.", "stale");
663
663
  }
664
- if (intent !== chunkNJWQPNGD_cjs.intentText({ name: adopted.name })) {
664
+ if (intent !== chunkH2TP7JWR_cjs.intentText({ name: adopted.name })) {
665
665
  throw new Error("Signing statement mismatch; not signed.");
666
666
  }
667
667
  const identity = await client.unlockIdentityWithPassword(email, password, deploymentDomain);
@@ -669,11 +669,11 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
669
669
  params: { path },
670
670
  body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
671
671
  });
672
- if (!signed.data) throw new chunkNJWQPNGD_cjs.SigningError(detail(signed.error, "Signing failed"), "failed");
672
+ if (!signed.data) throw new chunkH2TP7JWR_cjs.SigningError(detail(signed.error, "Signing failed"), "failed");
673
673
  return signed.data;
674
674
  }
675
675
  function useSignSignatureRequest() {
676
- const env = chunkNJWQPNGD_cjs.useDocumentTools();
676
+ const env = chunkH2TP7JWR_cjs.useDocumentTools();
677
677
  const invalidate = useInvalidateRequests();
678
678
  const queryClient = reactQuery.useQueryClient();
679
679
  return reactQuery.useMutation({
@@ -691,7 +691,7 @@ function useSignSignatureRequest() {
691
691
  });
692
692
  }
693
693
  function useSignerCandidates(enabled = true) {
694
- const { client, user } = chunkNJWQPNGD_cjs.useDocumentTools();
694
+ const { client, user } = chunkH2TP7JWR_cjs.useDocumentTools();
695
695
  const { workspaceId, read } = useOpenWorkspaceRead();
696
696
  return reactQuery.useQuery({
697
697
  queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.signatureCandidates(workspaceId ?? ""),
@@ -732,7 +732,7 @@ async function inviteSigners(client, documentId, emails) {
732
732
  }
733
733
  }
734
734
  function useInviteSigners() {
735
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
735
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
736
736
  const invalidate = useInvalidateRequests();
737
737
  const queryClient = reactQuery.useQueryClient();
738
738
  return reactQuery.useMutation({
@@ -776,7 +776,7 @@ async function deleteSavedSignature(client) {
776
776
  if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
777
777
  }
778
778
  function useSavedSignature(enabled = true) {
779
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
779
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
780
780
  return reactQuery.useQuery({
781
781
  queryKey: chunk5ZNO77YB_cjs.arbiQueryKeys.savedSignature(),
782
782
  queryFn: () => fetchSavedSignature(client),
@@ -786,7 +786,7 @@ function useSavedSignature(enabled = true) {
786
786
  });
787
787
  }
788
788
  function useStoreSavedSignature() {
789
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
789
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
790
790
  const queryClient = reactQuery.useQueryClient();
791
791
  return reactQuery.useMutation({
792
792
  mutationFn: (signature) => storeSavedSignature(client, signature),
@@ -794,7 +794,7 @@ function useStoreSavedSignature() {
794
794
  });
795
795
  }
796
796
  function useDeleteSavedSignature() {
797
- const { client } = chunkNJWQPNGD_cjs.useDocumentTools();
797
+ const { client } = chunkH2TP7JWR_cjs.useDocumentTools();
798
798
  const queryClient = reactQuery.useQueryClient();
799
799
  return reactQuery.useMutation({
800
800
  mutationFn: () => deleteSavedSignature(client),
@@ -873,5 +873,5 @@ exports.useSignerCandidates = useSignerCandidates;
873
873
  exports.useStoreSavedSignature = useStoreSavedSignature;
874
874
  exports.useVoidSignatureRequest = useVoidSignatureRequest;
875
875
  exports.versionsWithMarkup = versionsWithMarkup;
876
- //# sourceMappingURL=chunk-WWGUGZZN.cjs.map
877
- //# sourceMappingURL=chunk-WWGUGZZN.cjs.map
876
+ //# sourceMappingURL=chunk-ZELH6W5C.cjs.map
877
+ //# sourceMappingURL=chunk-ZELH6W5C.cjs.map