@arbidocs/react 0.4.166 → 0.4.168

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 (97) hide show
  1. package/dist/artifacts/index.cjs +15 -12
  2. package/dist/artifacts/index.cjs.map +1 -1
  3. package/dist/artifacts/index.js +6 -3
  4. package/dist/artifacts/index.js.map +1 -1
  5. package/dist/calls/livekit/index.cjs +977 -0
  6. package/dist/calls/livekit/index.cjs.map +1 -0
  7. package/dist/calls/livekit/index.d.cts +280 -0
  8. package/dist/calls/livekit/index.d.ts +280 -0
  9. package/dist/calls/livekit/index.js +961 -0
  10. package/dist/calls/livekit/index.js.map +1 -0
  11. package/dist/{chunk-ON4PL6DQ.cjs → chunk-2M4B4FFA.cjs} +48 -4
  12. package/dist/chunk-2M4B4FFA.cjs.map +1 -0
  13. package/dist/chunk-3J7MEBOW.cjs +2551 -0
  14. package/dist/chunk-3J7MEBOW.cjs.map +1 -0
  15. package/dist/chunk-3NVSUYUV.js +528 -0
  16. package/dist/chunk-3NVSUYUV.js.map +1 -0
  17. package/dist/{chunk-QJHCVQ6C.js → chunk-3WIBD44F.js} +4734 -4673
  18. package/dist/chunk-3WIBD44F.js.map +1 -0
  19. package/dist/chunk-5B4PPJNW.cjs +1035 -0
  20. package/dist/chunk-5B4PPJNW.cjs.map +1 -0
  21. package/dist/chunk-5HDC43MF.js +145 -0
  22. package/dist/chunk-5HDC43MF.js.map +1 -0
  23. package/dist/{chunk-D66JCVBB.cjs → chunk-7NHOKV7N.cjs} +4093 -4040
  24. package/dist/chunk-7NHOKV7N.cjs.map +1 -0
  25. package/dist/chunk-APZZQZ6P.js +147 -0
  26. package/dist/chunk-APZZQZ6P.js.map +1 -0
  27. package/dist/{chunk-I5ZBQ63Y.js → chunk-DGMK3EUN.js} +188 -181
  28. package/dist/chunk-DGMK3EUN.js.map +1 -0
  29. package/dist/chunk-DPYBZDJB.js +18 -0
  30. package/dist/chunk-DPYBZDJB.js.map +1 -0
  31. package/dist/chunk-EEIYXVM4.cjs +181 -0
  32. package/dist/chunk-EEIYXVM4.cjs.map +1 -0
  33. package/dist/chunk-H3LMKO3T.js +2362 -0
  34. package/dist/chunk-H3LMKO3T.js.map +1 -0
  35. package/dist/{chunk-JSSKEXRR.js → chunk-KGCGA452.js} +2 -2
  36. package/dist/chunk-KGCGA452.js.map +1 -0
  37. package/dist/chunk-MJNZLWJD.js +986 -0
  38. package/dist/chunk-MJNZLWJD.js.map +1 -0
  39. package/dist/chunk-N73IMVFF.cjs +21 -0
  40. package/dist/chunk-N73IMVFF.cjs.map +1 -0
  41. package/dist/chunk-NVAIVJID.js +298 -0
  42. package/dist/chunk-NVAIVJID.js.map +1 -0
  43. package/dist/{chunk-GTJ667CP.cjs → chunk-QQ7SCJRY.cjs} +2 -2
  44. package/dist/chunk-QQ7SCJRY.cjs.map +1 -0
  45. package/dist/chunk-S4PCA3ES.cjs +572 -0
  46. package/dist/chunk-S4PCA3ES.cjs.map +1 -0
  47. package/dist/chunk-VAMPYLQ4.cjs +157 -0
  48. package/dist/chunk-VAMPYLQ4.cjs.map +1 -0
  49. package/dist/chunk-VLK52VXC.cjs +307 -0
  50. package/dist/chunk-VLK52VXC.cjs.map +1 -0
  51. package/dist/{chunk-SVHGCX25.js → chunk-YWYCEEBF.js} +43 -4
  52. package/dist/chunk-YWYCEEBF.js.map +1 -0
  53. package/dist/{chunk-EUC2BTNS.cjs → chunk-ZI2VJOID.cjs} +206 -199
  54. package/dist/chunk-ZI2VJOID.cjs.map +1 -0
  55. package/dist/document-tools/index.cjs +85 -109
  56. package/dist/document-tools/index.cjs.map +1 -1
  57. package/dist/document-tools/index.d.cts +19 -5
  58. package/dist/document-tools/index.d.ts +19 -5
  59. package/dist/document-tools/index.js +28 -70
  60. package/dist/document-tools/index.js.map +1 -1
  61. package/dist/index.cjs +12692 -9494
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/{index.d-DfCFKora.d.cts → index.d-Bvp6rKNo.d.cts} +139 -1
  64. package/dist/{index.d-DfCFKora.d.ts → index.d-Bvp6rKNo.d.ts} +139 -1
  65. package/dist/{index.d-DCjYj7YK.d.ts → index.d-Dx9sGkW2.d.cts} +20 -8
  66. package/dist/{index.d-DCjYj7YK.d.cts → index.d-Dx9sGkW2.d.ts} +20 -8
  67. package/dist/index.d.cts +5465 -2291
  68. package/dist/index.d.ts +5465 -2291
  69. package/dist/index.js +11047 -8858
  70. package/dist/index.js.map +1 -1
  71. package/dist/query-keys.d-Kw0JMoff.d.cts +308 -0
  72. package/dist/query-keys.d-Kw0JMoff.d.ts +308 -0
  73. package/dist/shell/index.cjs +78 -21
  74. package/dist/shell/index.d.cts +1 -1
  75. package/dist/shell/index.d.ts +1 -1
  76. package/dist/shell/index.js +6 -1
  77. package/dist/ui/index.cjs +200 -195
  78. package/dist/ui/index.d.cts +1 -1
  79. package/dist/ui/index.d.ts +1 -1
  80. package/dist/ui/index.js +4 -3
  81. package/dist/useAudioRecorder.d-CWFDsb_S.d.cts +778 -0
  82. package/dist/useAudioRecorder.d-CWFDsb_S.d.ts +778 -0
  83. package/dist/viewers/index.cjs +2 -2
  84. package/dist/viewers/index.js +1 -1
  85. package/package.json +13 -3
  86. package/dist/chunk-6MTKKT2O.cjs +0 -999
  87. package/dist/chunk-6MTKKT2O.cjs.map +0 -1
  88. package/dist/chunk-CEZCFQ47.js +0 -932
  89. package/dist/chunk-CEZCFQ47.js.map +0 -1
  90. package/dist/chunk-D66JCVBB.cjs.map +0 -1
  91. package/dist/chunk-EUC2BTNS.cjs.map +0 -1
  92. package/dist/chunk-GTJ667CP.cjs.map +0 -1
  93. package/dist/chunk-I5ZBQ63Y.js.map +0 -1
  94. package/dist/chunk-JSSKEXRR.js.map +0 -1
  95. package/dist/chunk-ON4PL6DQ.cjs.map +0 -1
  96. package/dist/chunk-QJHCVQ6C.js.map +0 -1
  97. package/dist/chunk-SVHGCX25.js.map +0 -1
@@ -1,19 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkON4PL6DQ_cjs = require('../chunk-ON4PL6DQ.cjs');
3
+ var chunk2M4B4FFA_cjs = require('../chunk-2M4B4FFA.cjs');
4
4
  var chunkRDF2Q45F_cjs = require('../chunk-RDF2Q45F.cjs');
5
5
  var chunkLRBOMQ6Q_cjs = require('../chunk-LRBOMQ6Q.cjs');
6
+ var chunkVLK52VXC_cjs = require('../chunk-VLK52VXC.cjs');
6
7
  var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
7
8
  require('../chunk-VOFNX4P6.cjs');
8
9
  require('../chunk-WYZJLZ67.cjs');
9
- require('../chunk-Z3LLUO32.cjs');
10
10
  require('../chunk-HJDR5HEO.cjs');
11
+ require('../chunk-Z3LLUO32.cjs');
11
12
  require('../chunk-S6A6FSG7.cjs');
12
- require('../chunk-GTJ667CP.cjs');
13
+ require('../chunk-QQ7SCJRY.cjs');
13
14
  require('../chunk-RCKA7BEF.cjs');
14
15
  var react = require('react');
15
16
  var reactQuery = require('@tanstack/react-query');
16
17
  var client = require('@arbidocs/client');
18
+ var browser = require('@arbidocs/sdk/browser');
17
19
 
18
20
  // src/document-tools/production.ts
19
21
  var PRODUCTIONS_FOLDER = "Productions";
@@ -40,9 +42,9 @@ async function fetchProductionPdf(client, doc) {
40
42
  const pdf = isPdfDocument(doc);
41
43
  let blob;
42
44
  try {
43
- blob = await (pdf ? chunkON4PL6DQ_cjs.fetchDocumentFile : chunkON4PL6DQ_cjs.fetchDocumentPdf)(client, doc.external_id);
45
+ blob = await (pdf ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(client, doc.external_id);
44
46
  } catch (e) {
45
- if (!pdf && e instanceof chunkON4PL6DQ_cjs.DocumentFetchError) return null;
47
+ if (!pdf && e instanceof chunk2M4B4FFA_cjs.DocumentFetchError) return null;
46
48
  throw e;
47
49
  }
48
50
  const bytes = new Uint8Array(await blob.arrayBuffer());
@@ -345,48 +347,9 @@ async function copyOpenThreads(documentId, fromVersion, client) {
345
347
  function versionsWithMarkup(versions) {
346
348
  return (versions ?? []).filter((v) => (v.markup_count ?? 0) > 0);
347
349
  }
348
-
349
- // src/document-tools/markup-download.ts
350
- var SIGNED_LOCKED_REASON = "Signed documents can't be changed \u2014 download the signed file instead";
351
- function isSignedVersion(doc, version) {
352
- const n = version ?? doc.current_version ?? 1;
353
- return (doc.versions ?? []).some((v) => v.n === n && v.reason === "signed");
354
- }
355
- var MarkupDownloadError = class extends Error {
356
- constructor(message, status) {
357
- super(message);
358
- this.status = status;
359
- this.name = "MarkupDownloadError";
360
- }
361
- status;
362
- };
363
- function currentHasMarkup(doc) {
364
- const n = doc.current_version ?? 1;
365
- return (doc.versions ?? []).some((v) => v.n === n && (v.markup_count ?? 0) > 0);
366
- }
367
- async function fetchMarkupPdf(client, documentId, version) {
368
- const { data, response } = await client.GET("/v1/document/{document_ext_id}/markup/pdf", {
369
- params: { path: { document_ext_id: documentId }, query: version ? { version } : {} },
370
- parseAs: "blob"
371
- });
372
- if (!response.ok || !data) {
373
- throw new MarkupDownloadError(
374
- response.status === 404 ? "This document has no markup yet" : (
375
- // The server refuses a signed version: its PDF takes no more changes.
376
- response.status === 409 ? SIGNED_LOCKED_REASON : "The markup could not be downloaded"
377
- ),
378
- response.status
379
- );
380
- }
381
- const disposition = response.headers.get("content-disposition") ?? "";
382
- const utf8 = /filename\*=UTF-8''([^;]+)/i.exec(disposition)?.[1];
383
- const plain = /filename="([^"]+)"/i.exec(disposition)?.[1];
384
- const fileName = utf8 ? decodeURIComponent(utf8) : plain ?? "markup.pdf";
385
- return { blob: data, fileName };
386
- }
387
350
  var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
388
351
  function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
389
- const { client, notify, saveFile, onDocumentsChanged } = chunkON4PL6DQ_cjs.useDocumentTools();
352
+ const { client, notify, saveFile, onDocumentsChanged } = chunk2M4B4FFA_cjs.useDocumentTools();
390
353
  const documentId = documentData?.external_id;
391
354
  const currentVersion = documentData?.current_version ?? 1;
392
355
  const shownVersion = snapshotVersion ?? currentVersion;
@@ -417,11 +380,11 @@ function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false)
417
380
  const downloadMarkup = react.useCallback(async () => {
418
381
  if (!documentId) return;
419
382
  if (currentSigned) {
420
- notify(SIGNED_LOCKED_REASON, "info");
383
+ notify(chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON, "info");
421
384
  return;
422
385
  }
423
386
  try {
424
- const { blob, fileName } = await fetchMarkupPdf(
387
+ const { blob, fileName } = await chunk2M4B4FFA_cjs.fetchMarkupPdf(
425
388
  client,
426
389
  documentId,
427
390
  snapshotVersion ? snapshotVersion : void 0
@@ -557,19 +520,18 @@ function useIsOnline() {
557
520
  () => true
558
521
  );
559
522
  }
560
- var documentBytesKey = (documentRef, version, kind) => version === void 0 ? ["arbi", "documentBytes", documentRef] : ["arbi", "documentBytes", documentRef, version, kind ?? "pdf"];
561
523
  function useDocumentBytes(documentRef, options) {
562
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
524
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
563
525
  const { version, kind, enabled = true, fallback } = options;
564
526
  return reactQuery.useQuery({
565
- queryKey: documentBytesKey(documentRef, version ?? null, kind),
527
+ queryKey: chunkVLK52VXC_cjs.documentBytesKey(documentRef, version ?? null, kind),
566
528
  queryFn: async ({ signal }) => {
567
529
  if (fallback && typeof navigator !== "undefined" && navigator.onLine === false) {
568
530
  const offline = await fallback();
569
531
  if (offline) return offline;
570
532
  }
571
533
  try {
572
- return await (kind === "original" ? chunkON4PL6DQ_cjs.fetchDocumentFile : chunkON4PL6DQ_cjs.fetchDocumentPdf)(
534
+ return await (kind === "original" ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(
573
535
  client,
574
536
  documentRef,
575
537
  { signal }
@@ -601,7 +563,6 @@ function isLegibleSignatureBox(rect) {
601
563
  return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height;
602
564
  }
603
565
  var SIGNATURES_PATH = "/v1/document/{document_ext_id}/signatures";
604
- var SIGNATURES_KEY = ["get", SIGNATURES_PATH];
605
566
  function errorDetail(error, fallback) {
606
567
  const detail3 = error?.detail;
607
568
  return typeof detail3 === "string" ? detail3 : fallback;
@@ -615,13 +576,10 @@ async function fetchDocumentSignatures(client, documentRef) {
615
576
  return data;
616
577
  }
617
578
  function useDocumentSignatures(documentId, enabled = true) {
618
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
579
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
619
580
  const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentId);
620
581
  return reactQuery.useQuery({
621
- queryKey: [
622
- ...SIGNATURES_KEY,
623
- { params: { path: { document_ext_id: docId }, ...version ? { query: { version } } : {} } }
624
- ],
582
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
625
583
  queryFn: () => fetchDocumentSignatures(client, documentId),
626
584
  enabled: enabled && !!docId,
627
585
  staleTime: 6e4
@@ -686,7 +644,7 @@ async function signDocument(client$1, deploymentDomain, {
686
644
  return signed.data;
687
645
  }
688
646
  function useSignDocument() {
689
- const env = chunkON4PL6DQ_cjs.useDocumentTools();
647
+ const env = chunk2M4B4FFA_cjs.useDocumentTools();
690
648
  const queryClient = reactQuery.useQueryClient();
691
649
  return reactQuery.useMutation({
692
650
  mutationFn: (vars) => {
@@ -695,7 +653,7 @@ function useSignDocument() {
695
653
  },
696
654
  onSuccess: async (result) => {
697
655
  await env.onDocumentsChanged?.([result.doc_ext_id], "signed");
698
- await queryClient.invalidateQueries({ queryKey: SIGNATURES_KEY });
656
+ await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures() });
699
657
  }
700
658
  });
701
659
  }
@@ -732,9 +690,9 @@ async function fetchSignatureVerification(client, reference) {
732
690
  return data;
733
691
  }
734
692
  function useSignatureVerification(reference) {
735
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
693
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
736
694
  return reactQuery.useQuery({
737
- queryKey: ["get", VERIFY_PATH, { params: { path: { reference } } }],
695
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
738
696
  queryFn: () => fetchSignatureVerification(client, reference),
739
697
  enabled: !!reference,
740
698
  retry: false
@@ -774,7 +732,6 @@ var SIGNER_PROGRESS_LABELS = {
774
732
  var EMAIL = /^[^@\s<>,;]{1,64}@[^@\s<>,;]{1,255}\.[^@\s<>,;]{1,63}$/;
775
733
  var isEmailSigner = (signer) => EMAIL.test(signer.trim());
776
734
  var MARK_FIELD_TYPES = ["signature", "initials"];
777
- var REQUESTS_KEY = ["signature-requests"];
778
735
  function detail(error, fallback) {
779
736
  const d = error?.detail;
780
737
  if (typeof d === "string") return d;
@@ -836,18 +793,18 @@ async function fetchDocumentSignatureRequests(client, documentId) {
836
793
  return data;
837
794
  }
838
795
  function useDocumentSignatureRequests(documentId, enabled = true) {
839
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
796
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
840
797
  return reactQuery.useQuery({
841
- queryKey: [...REQUESTS_KEY, "document", documentId],
798
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
842
799
  queryFn: () => fetchDocumentSignatureRequests(client, documentId),
843
800
  enabled: enabled && !!documentId,
844
801
  staleTime: 15e3
845
802
  });
846
803
  }
847
804
  function useSignatureRequestsAwaitingMe(enabled = true) {
848
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
805
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
849
806
  return reactQuery.useQuery({
850
- queryKey: [...REQUESTS_KEY, "awaiting-me"],
807
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequestsAwaitingMe(),
851
808
  queryFn: async () => {
852
809
  const { data, error } = await client.GET("/v1/signature-requests", {
853
810
  params: { query: { awaiting_me: true } }
@@ -860,9 +817,9 @@ function useSignatureRequestsAwaitingMe(enabled = true) {
860
817
  });
861
818
  }
862
819
  function useSignatureRequest(requestId) {
863
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
820
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
864
821
  return reactQuery.useQuery({
865
- queryKey: [...REQUESTS_KEY, "one", requestId],
822
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequest(requestId ?? ""),
866
823
  queryFn: async () => {
867
824
  const { data, error } = await client.GET("/v1/signature-requests/{request_ext_id}", {
868
825
  params: { path: { request_ext_id: requestId } }
@@ -873,7 +830,7 @@ function useSignatureRequest(requestId) {
873
830
  enabled: !!requestId
874
831
  });
875
832
  }
876
- async function suggestSignatureFields(client, documentId, version) {
833
+ async function signatureFieldSuggestions(client, documentId, version) {
877
834
  const { data, error } = await client.GET(
878
835
  "/v1/document/{document_ext_id}/signature-fields/suggest",
879
836
  {
@@ -881,7 +838,10 @@ async function suggestSignatureFields(client, documentId, version) {
881
838
  }
882
839
  );
883
840
  if (!data) throw new Error(detail(error, "Signature blocks could not be read"));
884
- return data.fields;
841
+ return { fields: data.fields, signers: data.signers ?? [] };
842
+ }
843
+ async function suggestSignatureFields(client, documentId, version) {
844
+ return (await signatureFieldSuggestions(client, documentId, version)).fields;
885
845
  }
886
846
  async function saveSignatureRequest(client, { documentId, version, fields, message, requestId, send }) {
887
847
  if (!requestId) {
@@ -907,10 +867,10 @@ async function saveSignatureRequest(client, { documentId, version, fields, messa
907
867
  }
908
868
  function useInvalidateRequests() {
909
869
  const queryClient = reactQuery.useQueryClient();
910
- return () => queryClient.invalidateQueries({ queryKey: REQUESTS_KEY });
870
+ return () => queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequests() });
911
871
  }
912
872
  function useSaveSignatureRequest() {
913
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
873
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
914
874
  const invalidate = useInvalidateRequests();
915
875
  return reactQuery.useMutation({
916
876
  mutationFn: (vars) => saveSignatureRequest(client, vars),
@@ -918,7 +878,7 @@ function useSaveSignatureRequest() {
918
878
  });
919
879
  }
920
880
  function useVoidSignatureRequest() {
921
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
881
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
922
882
  const invalidate = useInvalidateRequests();
923
883
  return reactQuery.useMutation({
924
884
  mutationFn: async (requestId) => {
@@ -932,7 +892,7 @@ function useVoidSignatureRequest() {
932
892
  });
933
893
  }
934
894
  function useDeclineSignatureRequest() {
935
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
895
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
936
896
  const invalidate = useInvalidateRequests();
937
897
  return reactQuery.useMutation({
938
898
  mutationFn: async ({ requestId, reason }) => {
@@ -972,7 +932,7 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
972
932
  return signed.data;
973
933
  }
974
934
  function useSignSignatureRequest() {
975
- const env = chunkON4PL6DQ_cjs.useDocumentTools();
935
+ const env = chunk2M4B4FFA_cjs.useDocumentTools();
976
936
  const invalidate = useInvalidateRequests();
977
937
  const queryClient = reactQuery.useQueryClient();
978
938
  return reactQuery.useMutation({
@@ -984,17 +944,15 @@ function useSignSignatureRequest() {
984
944
  await invalidate();
985
945
  if (result.completed && result.request.doc_ext_id) {
986
946
  await env.onDocumentsChanged?.([result.request.doc_ext_id], "signed");
987
- await queryClient.invalidateQueries({
988
- queryKey: ["get", "/v1/document/{document_ext_id}/signatures"]
989
- });
947
+ await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures() });
990
948
  }
991
949
  }
992
950
  });
993
951
  }
994
952
  function useSignerCandidates(enabled = true) {
995
- const { client, user } = chunkON4PL6DQ_cjs.useDocumentTools();
953
+ const { client, user } = chunk2M4B4FFA_cjs.useDocumentTools();
996
954
  return reactQuery.useQuery({
997
- queryKey: [...REQUESTS_KEY, "candidates"],
955
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureCandidates(),
998
956
  queryFn: async () => {
999
957
  const { data, error } = await client.GET("/v1/workspace/users");
1000
958
  if (!data) throw new Error(detail(error, "The workspace members could not be read"));
@@ -1016,13 +974,13 @@ function useSignerCandidates(enabled = true) {
1016
974
  async function inviteSigners(client, documentId, emails) {
1017
975
  if (!emails.length) return;
1018
976
  const { error, response } = await client.POST("/v1/workspace/users", {
1019
- body: {
977
+ body: browser.workspaces.addWorkspaceMembersBody({
1020
978
  emails,
1021
979
  role: "guest",
1022
980
  confirm_invite: true,
1023
981
  resource_type: "document",
1024
982
  resource_ext_id: documentId
1025
- }
983
+ })
1026
984
  });
1027
985
  if (response.status === 409) {
1028
986
  throw new Error("Share the document with the workspace before asking others to sign it.");
@@ -1032,19 +990,18 @@ async function inviteSigners(client, documentId, emails) {
1032
990
  }
1033
991
  }
1034
992
  function useInviteSigners() {
1035
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
993
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1036
994
  const invalidate = useInvalidateRequests();
1037
995
  const queryClient = reactQuery.useQueryClient();
1038
996
  return reactQuery.useMutation({
1039
997
  mutationFn: ({ documentId, emails }) => inviteSigners(client, documentId, emails),
1040
998
  onSuccess: async () => {
1041
999
  await invalidate();
1042
- await queryClient.invalidateQueries({ queryKey: [...REQUESTS_KEY, "candidates"] });
1000
+ await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureCandidates() });
1043
1001
  }
1044
1002
  });
1045
1003
  }
1046
1004
  var INFORMAL_SIGNATURE_NOTE = "Informal signature: for verified signing, use Request signatures.";
1047
- var KEY = ["saved-signature"];
1048
1005
  async function keypair(source = client.getUserEncryptionKeypair) {
1049
1006
  await client.initSodium();
1050
1007
  const pair = await source();
@@ -1077,9 +1034,9 @@ async function deleteSavedSignature(client) {
1077
1034
  if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
1078
1035
  }
1079
1036
  function useSavedSignature(enabled = true) {
1080
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
1037
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1081
1038
  return reactQuery.useQuery({
1082
- queryKey: KEY,
1039
+ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(),
1083
1040
  queryFn: () => fetchSavedSignature(client),
1084
1041
  enabled,
1085
1042
  staleTime: 6e4,
@@ -1087,19 +1044,19 @@ function useSavedSignature(enabled = true) {
1087
1044
  });
1088
1045
  }
1089
1046
  function useStoreSavedSignature() {
1090
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
1047
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1091
1048
  const queryClient = reactQuery.useQueryClient();
1092
1049
  return reactQuery.useMutation({
1093
1050
  mutationFn: (signature) => storeSavedSignature(client, signature),
1094
- onSuccess: (_, signature) => queryClient.setQueryData(KEY, signature)
1051
+ onSuccess: (_, signature) => queryClient.setQueryData(chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(), signature)
1095
1052
  });
1096
1053
  }
1097
1054
  function useDeleteSavedSignature() {
1098
- const { client } = chunkON4PL6DQ_cjs.useDocumentTools();
1055
+ const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1099
1056
  const queryClient = reactQuery.useQueryClient();
1100
1057
  return reactQuery.useMutation({
1101
1058
  mutationFn: () => deleteSavedSignature(client),
1102
- onSuccess: () => queryClient.setQueryData(KEY, null)
1059
+ onSuccess: () => queryClient.setQueryData(chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(), null)
1103
1060
  });
1104
1061
  }
1105
1062
  function pngBytes(base64) {
@@ -1116,51 +1073,75 @@ function pngSize(base64) {
1116
1073
 
1117
1074
  Object.defineProperty(exports, "DocumentFetchError", {
1118
1075
  enumerable: true,
1119
- get: function () { return chunkON4PL6DQ_cjs.DocumentFetchError; }
1076
+ get: function () { return chunk2M4B4FFA_cjs.DocumentFetchError; }
1120
1077
  });
1121
1078
  Object.defineProperty(exports, "DocumentToolsProvider", {
1122
1079
  enumerable: true,
1123
- get: function () { return chunkON4PL6DQ_cjs.DocumentToolsProvider; }
1080
+ get: function () { return chunk2M4B4FFA_cjs.DocumentToolsProvider; }
1081
+ });
1082
+ Object.defineProperty(exports, "MarkupDownloadError", {
1083
+ enumerable: true,
1084
+ get: function () { return chunk2M4B4FFA_cjs.MarkupDownloadError; }
1085
+ });
1086
+ Object.defineProperty(exports, "SIGNED_LOCKED_REASON", {
1087
+ enumerable: true,
1088
+ get: function () { return chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON; }
1124
1089
  });
1125
1090
  Object.defineProperty(exports, "certificateLink", {
1126
1091
  enumerable: true,
1127
- get: function () { return chunkON4PL6DQ_cjs.certificateLink; }
1092
+ get: function () { return chunk2M4B4FFA_cjs.certificateLink; }
1128
1093
  });
1129
1094
  Object.defineProperty(exports, "clientUpload", {
1130
1095
  enumerable: true,
1131
- get: function () { return chunkON4PL6DQ_cjs.clientUpload; }
1096
+ get: function () { return chunk2M4B4FFA_cjs.clientUpload; }
1132
1097
  });
1133
1098
  Object.defineProperty(exports, "contentDispositionFileName", {
1134
1099
  enumerable: true,
1135
- get: function () { return chunkON4PL6DQ_cjs.contentDispositionFileName; }
1100
+ get: function () { return chunk2M4B4FFA_cjs.contentDispositionFileName; }
1101
+ });
1102
+ Object.defineProperty(exports, "currentHasMarkup", {
1103
+ enumerable: true,
1104
+ get: function () { return chunk2M4B4FFA_cjs.currentHasMarkup; }
1136
1105
  });
1137
1106
  Object.defineProperty(exports, "defaultCertificateUrl", {
1138
1107
  enumerable: true,
1139
- get: function () { return chunkON4PL6DQ_cjs.defaultCertificateUrl; }
1108
+ get: function () { return chunk2M4B4FFA_cjs.defaultCertificateUrl; }
1140
1109
  });
1141
1110
  Object.defineProperty(exports, "downloadBlob", {
1142
1111
  enumerable: true,
1143
- get: function () { return chunkON4PL6DQ_cjs.downloadBlob; }
1112
+ get: function () { return chunk2M4B4FFA_cjs.downloadBlob; }
1144
1113
  });
1145
1114
  Object.defineProperty(exports, "fetchDocumentFile", {
1146
1115
  enumerable: true,
1147
- get: function () { return chunkON4PL6DQ_cjs.fetchDocumentFile; }
1116
+ get: function () { return chunk2M4B4FFA_cjs.fetchDocumentFile; }
1148
1117
  });
1149
1118
  Object.defineProperty(exports, "fetchDocumentPdf", {
1150
1119
  enumerable: true,
1151
- get: function () { return chunkON4PL6DQ_cjs.fetchDocumentPdf; }
1120
+ get: function () { return chunk2M4B4FFA_cjs.fetchDocumentPdf; }
1121
+ });
1122
+ Object.defineProperty(exports, "fetchMarkupPdf", {
1123
+ enumerable: true,
1124
+ get: function () { return chunk2M4B4FFA_cjs.fetchMarkupPdf; }
1125
+ });
1126
+ Object.defineProperty(exports, "isSignedVersion", {
1127
+ enumerable: true,
1128
+ get: function () { return chunk2M4B4FFA_cjs.isSignedVersion; }
1152
1129
  });
1153
1130
  Object.defineProperty(exports, "uploadQueryString", {
1154
1131
  enumerable: true,
1155
- get: function () { return chunkON4PL6DQ_cjs.uploadQueryString; }
1132
+ get: function () { return chunk2M4B4FFA_cjs.uploadQueryString; }
1156
1133
  });
1157
1134
  Object.defineProperty(exports, "useDocumentTools", {
1158
1135
  enumerable: true,
1159
- get: function () { return chunkON4PL6DQ_cjs.useDocumentTools; }
1136
+ get: function () { return chunk2M4B4FFA_cjs.useDocumentTools; }
1160
1137
  });
1161
1138
  Object.defineProperty(exports, "useOptionalDocumentTools", {
1162
1139
  enumerable: true,
1163
- get: function () { return chunkON4PL6DQ_cjs.useOptionalDocumentTools; }
1140
+ get: function () { return chunk2M4B4FFA_cjs.useOptionalDocumentTools; }
1141
+ });
1142
+ Object.defineProperty(exports, "documentBytesKey", {
1143
+ enumerable: true,
1144
+ get: function () { return chunkVLK52VXC_cjs.documentBytesKey; }
1164
1145
  });
1165
1146
  exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
1166
1147
  exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
@@ -1168,11 +1149,9 @@ exports.INFORMAL_SIGNATURE_NOTE = INFORMAL_SIGNATURE_NOTE;
1168
1149
  exports.LEGACY_LAYER_PREFIX = LEGACY_LAYER_PREFIX;
1169
1150
  exports.MARK_FIELD_TYPES = MARK_FIELD_TYPES;
1170
1151
  exports.MAX_MERGE_ATTEMPTS = MAX_MERGE_ATTEMPTS;
1171
- exports.MarkupDownloadError = MarkupDownloadError;
1172
1152
  exports.MarkupStoreError = MarkupStoreError;
1173
1153
  exports.PRODUCTIONS_FOLDER = PRODUCTIONS_FOLDER;
1174
1154
  exports.SIGNATURE_FIELD_TYPES = SIGNATURE_FIELD_TYPES;
1175
- exports.SIGNED_LOCKED_REASON = SIGNED_LOCKED_REASON;
1176
1155
  exports.SIGNED_UNCHANGED = SIGNED_UNCHANGED;
1177
1156
  exports.SIGNER_PROGRESS_LABELS = SIGNER_PROGRESS_LABELS;
1178
1157
  exports.SignatureVerificationError = SignatureVerificationError;
@@ -1183,12 +1162,9 @@ exports.buildProduction = buildProduction;
1183
1162
  exports.canAnnotate = canAnnotate;
1184
1163
  exports.copyOpenThreads = copyOpenThreads;
1185
1164
  exports.createMarkupStore = createMarkupStore;
1186
- exports.currentHasMarkup = currentHasMarkup;
1187
1165
  exports.deleteSavedSignature = deleteSavedSignature;
1188
- exports.documentBytesKey = documentBytesKey;
1189
1166
  exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
1190
1167
  exports.fetchDocumentSignatures = fetchDocumentSignatures;
1191
- exports.fetchMarkupPdf = fetchMarkupPdf;
1192
1168
  exports.fetchProductionPdf = fetchProductionPdf;
1193
1169
  exports.fetchSavedSignature = fetchSavedSignature;
1194
1170
  exports.fetchSignatureVerification = fetchSignatureVerification;
@@ -1204,7 +1180,6 @@ exports.isEmailSigner = isEmailSigner;
1204
1180
  exports.isLegibleSignatureBox = isLegibleSignatureBox;
1205
1181
  exports.isPdfDocument = isPdfDocument;
1206
1182
  exports.isSignatureReference = isSignatureReference;
1207
- exports.isSignedVersion = isSignedVersion;
1208
1183
  exports.marksByVersion = marksByVersion;
1209
1184
  exports.matchSignedCopy = matchSignedCopy;
1210
1185
  exports.migrateLegacyLayer = migrateLegacyLayer;
@@ -1225,6 +1200,7 @@ exports.sendBlocker = sendBlocker;
1225
1200
  exports.sha256Hex = sha256Hex;
1226
1201
  exports.signDocument = signDocument;
1227
1202
  exports.signSignatureRequest = signSignatureRequest;
1203
+ exports.signatureFieldSuggestions = signatureFieldSuggestions;
1228
1204
  exports.splitSuggestions = splitSuggestions;
1229
1205
  exports.storeSavedSignature = storeSavedSignature;
1230
1206
  exports.suggestSignatureFields = suggestSignatureFields;