@arbidocs/react 0.5.18 → 0.5.20

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 (98) hide show
  1. package/dist/{ProductionDialog.d-CttHqQAh.d.ts → ProductionDialog.d-BDJwBSzj.d.ts} +1 -1
  2. package/dist/{ProductionDialog.d-BD1osHeq.d.cts → ProductionDialog.d-DjRQFmQw.d.cts} +1 -1
  3. package/dist/annotations/freeze/index.cjs +15 -15
  4. package/dist/annotations/freeze/index.d.cts +1 -1
  5. package/dist/annotations/freeze/index.d.ts +1 -1
  6. package/dist/annotations/freeze/index.js +3 -3
  7. package/dist/annotations/index.cjs +56 -56
  8. package/dist/annotations/index.d.cts +5 -5
  9. package/dist/annotations/index.d.ts +5 -5
  10. package/dist/annotations/index.js +2 -2
  11. package/dist/artifacts/index.cjs +10 -10
  12. package/dist/artifacts/index.js +3 -3
  13. package/dist/bundle-DCWPYNGD.cjs +14 -0
  14. package/dist/{bundle-B5AN4B7H.cjs.map → bundle-DCWPYNGD.cjs.map} +1 -1
  15. package/dist/bundle-JCKKGEJE.js +5 -0
  16. package/dist/{bundle-4TKU5WEQ.js.map → bundle-JCKKGEJE.js.map} +1 -1
  17. package/dist/calls/livekit/index.cjs +42 -42
  18. package/dist/calls/livekit/index.js +3 -3
  19. package/dist/{chunk-YWYCEEBF.js → chunk-2HVCNYFH.js} +32 -3
  20. package/dist/chunk-2HVCNYFH.js.map +1 -0
  21. package/dist/{chunk-NSSGDZSL.cjs → chunk-2IJP73ZG.cjs} +2 -2
  22. package/dist/{chunk-NSSGDZSL.cjs.map → chunk-2IJP73ZG.cjs.map} +1 -1
  23. package/dist/{chunk-KFFH2JJM.cjs → chunk-4UDIA47U.cjs} +32 -32
  24. package/dist/{chunk-KFFH2JJM.cjs.map → chunk-4UDIA47U.cjs.map} +1 -1
  25. package/dist/{chunk-HUZB36QU.cjs → chunk-5YWIUUUT.cjs} +53 -2
  26. package/dist/chunk-5YWIUUUT.cjs.map +1 -0
  27. package/dist/{chunk-D63FAYES.js → chunk-A2XSLTIP.js} +5 -5
  28. package/dist/chunk-A2XSLTIP.js.map +1 -0
  29. package/dist/{chunk-EYOXZHXM.cjs → chunk-B6I2HRRF.cjs} +9 -9
  30. package/dist/chunk-B6I2HRRF.cjs.map +1 -0
  31. package/dist/{chunk-2M4B4FFA.cjs → chunk-CZP7FF3E.cjs} +31 -2
  32. package/dist/chunk-CZP7FF3E.cjs.map +1 -0
  33. package/dist/{chunk-GUCQMP6G.js → chunk-DUU537MW.js} +4 -4
  34. package/dist/{chunk-GUCQMP6G.js.map → chunk-DUU537MW.js.map} +1 -1
  35. package/dist/{chunk-4VQ3XHAQ.cjs → chunk-DYCONTUK.cjs} +41 -41
  36. package/dist/{chunk-4VQ3XHAQ.cjs.map → chunk-DYCONTUK.cjs.map} +1 -1
  37. package/dist/{chunk-CNRF5SLZ.cjs → chunk-FLAZSNC5.cjs} +33 -33
  38. package/dist/{chunk-CNRF5SLZ.cjs.map → chunk-FLAZSNC5.cjs.map} +1 -1
  39. package/dist/{chunk-WE7QWWJ4.js → chunk-KRAUMKBG.js} +4 -37
  40. package/dist/chunk-KRAUMKBG.js.map +1 -0
  41. package/dist/{chunk-J2GERLMU.js → chunk-LYGJVSNM.js} +3 -3
  42. package/dist/{chunk-J2GERLMU.js.map → chunk-LYGJVSNM.js.map} +1 -1
  43. package/dist/{chunk-GN33GLHR.js → chunk-MQ7LZWGP.js} +3 -3
  44. package/dist/{chunk-GN33GLHR.js.map → chunk-MQ7LZWGP.js.map} +1 -1
  45. package/dist/chunk-NA3FJX37.js +89 -0
  46. package/dist/chunk-NA3FJX37.js.map +1 -0
  47. package/dist/{chunk-RG2ZE7DF.js → chunk-PBXJFMES.js} +5 -2
  48. package/dist/chunk-PBXJFMES.js.map +1 -0
  49. package/dist/{chunk-H4FGDXYB.cjs → chunk-RRWAX52L.cjs} +5 -2
  50. package/dist/chunk-RRWAX52L.cjs.map +1 -0
  51. package/dist/{chunk-ALLWAYMB.cjs → chunk-SUZORMAB.cjs} +157 -65
  52. package/dist/chunk-SUZORMAB.cjs.map +1 -0
  53. package/dist/{chunk-XTWUMTCQ.js → chunk-T3USOSVN.js} +2 -2
  54. package/dist/{chunk-XTWUMTCQ.js.map → chunk-T3USOSVN.js.map} +1 -1
  55. package/dist/{chunk-2XMHFQ7M.js → chunk-T4CLW3DN.js} +141 -49
  56. package/dist/chunk-T4CLW3DN.js.map +1 -0
  57. package/dist/{chunk-XTYG5SIL.cjs → chunk-YBIW7T66.cjs} +5 -39
  58. package/dist/chunk-YBIW7T66.cjs.map +1 -0
  59. package/dist/document-tools/index.cjs +174 -69
  60. package/dist/document-tools/index.cjs.map +1 -1
  61. package/dist/document-tools/index.d.cts +99 -6
  62. package/dist/document-tools/index.d.ts +99 -6
  63. package/dist/document-tools/index.js +107 -10
  64. package/dist/document-tools/index.js.map +1 -1
  65. package/dist/index.cjs +911 -802
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/{index.d-Dx9sGkW2.d.cts → index.d-DscWCwr2.d.cts} +15 -1
  68. package/dist/{index.d-Dx9sGkW2.d.ts → index.d-DscWCwr2.d.ts} +15 -1
  69. package/dist/index.d.cts +70 -22
  70. package/dist/index.d.ts +70 -22
  71. package/dist/index.js +122 -15
  72. package/dist/index.js.map +1 -1
  73. package/dist/{model.d-D63gedpb.d.cts → model.d-CNtRWKVK.d.cts} +1 -1
  74. package/dist/{model.d-D63gedpb.d.ts → model.d-CNtRWKVK.d.ts} +1 -1
  75. package/dist/{query-keys.d-ClYiYNBR.d.cts → query-keys.d-DM2N5pzN.d.cts} +3 -0
  76. package/dist/{query-keys.d-ClYiYNBR.d.ts → query-keys.d-DM2N5pzN.d.ts} +3 -0
  77. package/dist/shell/index.cjs +34 -34
  78. package/dist/shell/index.js +3 -3
  79. package/dist/ui/index.cjs +16 -12
  80. package/dist/ui/index.d.cts +1 -1
  81. package/dist/ui/index.d.ts +1 -1
  82. package/dist/ui/index.js +2 -2
  83. package/package.json +3 -3
  84. package/dist/bundle-4TKU5WEQ.js +0 -5
  85. package/dist/bundle-B5AN4B7H.cjs +0 -14
  86. package/dist/chunk-2M4B4FFA.cjs.map +0 -1
  87. package/dist/chunk-2XMHFQ7M.js.map +0 -1
  88. package/dist/chunk-ALLWAYMB.cjs.map +0 -1
  89. package/dist/chunk-D63FAYES.js.map +0 -1
  90. package/dist/chunk-EYOXZHXM.cjs.map +0 -1
  91. package/dist/chunk-H4FGDXYB.cjs.map +0 -1
  92. package/dist/chunk-HUZB36QU.cjs.map +0 -1
  93. package/dist/chunk-RG2ZE7DF.js.map +0 -1
  94. package/dist/chunk-W4H6XAIU.js +0 -39
  95. package/dist/chunk-W4H6XAIU.js.map +0 -1
  96. package/dist/chunk-WE7QWWJ4.js.map +0 -1
  97. package/dist/chunk-XTYG5SIL.cjs.map +0 -1
  98. package/dist/chunk-YWYCEEBF.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunk2M4B4FFA_cjs = require('../chunk-2M4B4FFA.cjs');
4
- var chunkALLWAYMB_cjs = require('../chunk-ALLWAYMB.cjs');
5
- var chunkNSSGDZSL_cjs = require('../chunk-NSSGDZSL.cjs');
6
- var chunkH4FGDXYB_cjs = require('../chunk-H4FGDXYB.cjs');
3
+ var chunkCZP7FF3E_cjs = require('../chunk-CZP7FF3E.cjs');
4
+ var chunkRRWAX52L_cjs = require('../chunk-RRWAX52L.cjs');
5
+ var chunkSUZORMAB_cjs = require('../chunk-SUZORMAB.cjs');
6
+ var chunk2IJP73ZG_cjs = require('../chunk-2IJP73ZG.cjs');
7
7
  var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
8
8
  require('../chunk-VOFNX4P6.cjs');
9
9
  require('../chunk-WYZJLZ67.cjs');
10
- require('../chunk-HJDR5HEO.cjs');
11
10
  require('../chunk-Z3LLUO32.cjs');
11
+ require('../chunk-HJDR5HEO.cjs');
12
12
  require('../chunk-S6A6FSG7.cjs');
13
13
  require('../chunk-QQ7SCJRY.cjs');
14
14
  require('../chunk-RCKA7BEF.cjs');
@@ -42,9 +42,9 @@ async function fetchProductionPdf(client, doc) {
42
42
  const pdf = isPdfDocument(doc);
43
43
  let blob;
44
44
  try {
45
- blob = await (pdf ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(client, doc.external_id);
45
+ blob = await (pdf ? chunkCZP7FF3E_cjs.fetchDocumentFile : chunkCZP7FF3E_cjs.fetchDocumentPdf)(client, doc.external_id);
46
46
  } catch (e) {
47
- if (!pdf && e instanceof chunk2M4B4FFA_cjs.DocumentFetchError) return null;
47
+ if (!pdf && e instanceof chunkCZP7FF3E_cjs.DocumentFetchError) return null;
48
48
  throw e;
49
49
  }
50
50
  const bytes = new Uint8Array(await blob.arrayBuffer());
@@ -107,7 +107,7 @@ async function buildProduction(client, documents, choices, options) {
107
107
  if (items.length === 0) {
108
108
  throw new Error("None of these documents has a PDF version to number yet.");
109
109
  }
110
- const { buildBundle } = await import('../bundle-B5AN4B7H.cjs');
110
+ const { buildBundle } = await import('../bundle-DCWPYNGD.cjs');
111
111
  const result = await buildBundle(items, {
112
112
  layout: choices.layout,
113
113
  bates: {
@@ -169,7 +169,7 @@ async function call(request) {
169
169
  return await request();
170
170
  } catch (e) {
171
171
  if (e instanceof TypeError || typeof navigator !== "undefined" && !navigator.onLine) {
172
- throw new chunkALLWAYMB_cjs.AnnotationStoreOfflineError();
172
+ throw new chunkSUZORMAB_cjs.AnnotationStoreOfflineError();
173
173
  }
174
174
  throw e;
175
175
  }
@@ -198,8 +198,8 @@ function createMarkupStore({ version, client, onSaved }) {
198
198
  response.status
199
199
  );
200
200
  }
201
- const layer = chunkNSSGDZSL_cjs.parseLayer({
202
- schema: chunkNSSGDZSL_cjs.LAYER_SCHEMA_VERSION,
201
+ const layer = chunk2IJP73ZG_cjs.parseLayer({
202
+ schema: chunk2IJP73ZG_cjs.LAYER_SCHEMA_VERSION,
203
203
  documentId,
204
204
  annotations: data.annotations ?? [],
205
205
  updatedAt: data.updated_at ?? (/* @__PURE__ */ new Date()).toISOString()
@@ -252,7 +252,7 @@ function createMarkupStore({ version, client, onSaved }) {
252
252
  const deleted = new Set(
253
253
  [...seen].filter((id) => !mine.annotations.some((a) => a.id === id))
254
254
  );
255
- const merged = chunkALLWAYMB_cjs.mergeLayers({ base, mine, theirs: latest.layer, deleted });
255
+ const merged = chunkSUZORMAB_cjs.mergeLayers({ base, mine, theirs: latest.layer, deleted });
256
256
  revision = latest.revision;
257
257
  canEdit = latest.canEdit;
258
258
  base = latest.layer;
@@ -290,7 +290,7 @@ function readLegacyLayer(documentId) {
290
290
  try {
291
291
  const raw = storage()?.getItem(LEGACY_LAYER_PREFIX + documentId);
292
292
  if (!raw) return null;
293
- return chunkNSSGDZSL_cjs.parseLayer(JSON.parse(raw));
293
+ return chunk2IJP73ZG_cjs.parseLayer(JSON.parse(raw));
294
294
  } catch {
295
295
  return null;
296
296
  }
@@ -319,12 +319,12 @@ async function addToMarkup(documentId, version, marks, client) {
319
319
  const store = createMarkupStore({ version, client });
320
320
  const current = await store.load(documentId);
321
321
  const incoming = {
322
- ...chunkNSSGDZSL_cjs.emptyLayer(documentId, (/* @__PURE__ */ new Date()).toISOString()),
322
+ ...chunk2IJP73ZG_cjs.emptyLayer(documentId, (/* @__PURE__ */ new Date()).toISOString()),
323
323
  annotations: marks
324
324
  };
325
- const merged = chunkALLWAYMB_cjs.mergeLayers({ base: null, mine: current, theirs: incoming });
325
+ const merged = chunkSUZORMAB_cjs.mergeLayers({ base: null, mine: current, theirs: incoming });
326
326
  const added = merged.annotations.length - current.annotations.length;
327
- if (added > 0) await store.save(chunkNSSGDZSL_cjs.parseLayer({ ...merged, schema: chunkNSSGDZSL_cjs.LAYER_SCHEMA_VERSION }));
327
+ if (added > 0) await store.save(chunk2IJP73ZG_cjs.parseLayer({ ...merged, schema: chunk2IJP73ZG_cjs.LAYER_SCHEMA_VERSION }));
328
328
  return added;
329
329
  }
330
330
  async function migrateLegacyLayer(documentId, layer, versions, currentVersion, client) {
@@ -349,7 +349,7 @@ function versionsWithMarkup(versions) {
349
349
  }
350
350
  var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
351
351
  function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
352
- const { client, notify, saveFile, onDocumentsChanged } = chunk2M4B4FFA_cjs.useDocumentTools();
352
+ const { client, notify, saveFile, onDocumentsChanged } = chunkCZP7FF3E_cjs.useDocumentTools();
353
353
  const documentId = documentData?.external_id;
354
354
  const currentVersion = documentData?.current_version ?? 1;
355
355
  const shownVersion = snapshotVersion ?? currentVersion;
@@ -380,11 +380,11 @@ function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false)
380
380
  const downloadMarkup = react.useCallback(async () => {
381
381
  if (!documentId) return;
382
382
  if (currentSigned) {
383
- notify(chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON, "info");
383
+ notify(chunkCZP7FF3E_cjs.SIGNED_LOCKED_REASON, "info");
384
384
  return;
385
385
  }
386
386
  try {
387
- const { blob, fileName } = await chunk2M4B4FFA_cjs.fetchMarkupPdf(
387
+ const { blob, fileName } = await chunkCZP7FF3E_cjs.fetchMarkupPdf(
388
388
  client,
389
389
  documentId,
390
390
  snapshotVersion ? snapshotVersion : void 0
@@ -521,17 +521,17 @@ function useIsOnline() {
521
521
  );
522
522
  }
523
523
  function useDocumentBytes(documentRef, options) {
524
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
524
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
525
525
  const { version, kind, enabled = true, fallback } = options;
526
526
  return reactQuery.useQuery({
527
- queryKey: chunkH4FGDXYB_cjs.documentBytesKey(documentRef, version ?? null, kind),
527
+ queryKey: chunkRRWAX52L_cjs.documentBytesKey(documentRef, version ?? null, kind),
528
528
  queryFn: async ({ signal }) => {
529
529
  if (fallback && typeof navigator !== "undefined" && navigator.onLine === false) {
530
530
  const offline = await fallback();
531
531
  if (offline) return offline;
532
532
  }
533
533
  try {
534
- return await (kind === "original" ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(
534
+ return await (kind === "original" ? chunkCZP7FF3E_cjs.fetchDocumentFile : chunkCZP7FF3E_cjs.fetchDocumentPdf)(
535
535
  client,
536
536
  documentRef,
537
537
  { signal }
@@ -576,10 +576,10 @@ async function fetchDocumentSignatures(client, documentRef) {
576
576
  return data;
577
577
  }
578
578
  function useDocumentSignatures(documentId, enabled = true) {
579
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
579
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
580
580
  const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentId);
581
581
  return reactQuery.useQuery({
582
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
582
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
583
583
  queryFn: () => fetchDocumentSignatures(client, documentId),
584
584
  enabled: enabled && !!docId,
585
585
  staleTime: 6e4
@@ -644,7 +644,7 @@ async function signDocument(client$1, deploymentDomain, {
644
644
  return signed.data;
645
645
  }
646
646
  function useSignDocument() {
647
- const env = chunk2M4B4FFA_cjs.useDocumentTools();
647
+ const env = chunkCZP7FF3E_cjs.useDocumentTools();
648
648
  const queryClient = reactQuery.useQueryClient();
649
649
  return reactQuery.useMutation({
650
650
  mutationFn: (vars) => {
@@ -653,7 +653,7 @@ function useSignDocument() {
653
653
  },
654
654
  onSuccess: async (result) => {
655
655
  await env.onDocumentsChanged?.([result.doc_ext_id], "signed");
656
- await queryClient.invalidateQueries({ queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.documentSignatures() });
656
+ await queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.documentSignatures() });
657
657
  }
658
658
  });
659
659
  }
@@ -690,9 +690,9 @@ async function fetchSignatureVerification(client, reference) {
690
690
  return data;
691
691
  }
692
692
  function useSignatureVerification(reference) {
693
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
693
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
694
694
  return reactQuery.useQuery({
695
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
695
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
696
696
  queryFn: () => fetchSignatureVerification(client, reference),
697
697
  enabled: !!reference,
698
698
  retry: false
@@ -793,18 +793,18 @@ async function fetchDocumentSignatureRequests(client, documentId) {
793
793
  return data;
794
794
  }
795
795
  function useDocumentSignatureRequests(documentId, enabled = true) {
796
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
796
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
797
797
  return reactQuery.useQuery({
798
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
798
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
799
799
  queryFn: () => fetchDocumentSignatureRequests(client, documentId),
800
800
  enabled: enabled && !!documentId,
801
801
  staleTime: 15e3
802
802
  });
803
803
  }
804
804
  function useSignatureRequestsAwaitingMe(enabled = true) {
805
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
805
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
806
806
  return reactQuery.useQuery({
807
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureRequestsAwaitingMe(),
807
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureRequestsAwaitingMe(),
808
808
  queryFn: async () => {
809
809
  const { data, error } = await client.GET("/v1/signature-requests", {
810
810
  params: { query: { awaiting_me: true } }
@@ -817,9 +817,9 @@ function useSignatureRequestsAwaitingMe(enabled = true) {
817
817
  });
818
818
  }
819
819
  function useSignatureRequest(requestId) {
820
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
820
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
821
821
  return reactQuery.useQuery({
822
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureRequest(requestId ?? ""),
822
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureRequest(requestId ?? ""),
823
823
  queryFn: async () => {
824
824
  const { data, error } = await client.GET("/v1/signature-requests/{request_ext_id}", {
825
825
  params: { path: { request_ext_id: requestId } }
@@ -867,10 +867,10 @@ async function saveSignatureRequest(client, { documentId, version, fields, messa
867
867
  }
868
868
  function useInvalidateRequests() {
869
869
  const queryClient = reactQuery.useQueryClient();
870
- return () => queryClient.invalidateQueries({ queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureRequests() });
870
+ return () => queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureRequests() });
871
871
  }
872
872
  function useSaveSignatureRequest() {
873
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
873
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
874
874
  const invalidate = useInvalidateRequests();
875
875
  return reactQuery.useMutation({
876
876
  mutationFn: (vars) => saveSignatureRequest(client, vars),
@@ -878,7 +878,7 @@ function useSaveSignatureRequest() {
878
878
  });
879
879
  }
880
880
  function useVoidSignatureRequest() {
881
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
881
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
882
882
  const invalidate = useInvalidateRequests();
883
883
  return reactQuery.useMutation({
884
884
  mutationFn: async (requestId) => {
@@ -892,7 +892,7 @@ function useVoidSignatureRequest() {
892
892
  });
893
893
  }
894
894
  function useDeclineSignatureRequest() {
895
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
895
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
896
896
  const invalidate = useInvalidateRequests();
897
897
  return reactQuery.useMutation({
898
898
  mutationFn: async ({ requestId, reason }) => {
@@ -932,7 +932,7 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
932
932
  return signed.data;
933
933
  }
934
934
  function useSignSignatureRequest() {
935
- const env = chunk2M4B4FFA_cjs.useDocumentTools();
935
+ const env = chunkCZP7FF3E_cjs.useDocumentTools();
936
936
  const invalidate = useInvalidateRequests();
937
937
  const queryClient = reactQuery.useQueryClient();
938
938
  return reactQuery.useMutation({
@@ -944,15 +944,15 @@ function useSignSignatureRequest() {
944
944
  await invalidate();
945
945
  if (result.completed && result.request.doc_ext_id) {
946
946
  await env.onDocumentsChanged?.([result.request.doc_ext_id], "signed");
947
- await queryClient.invalidateQueries({ queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.documentSignatures() });
947
+ await queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.documentSignatures() });
948
948
  }
949
949
  }
950
950
  });
951
951
  }
952
952
  function useSignerCandidates(enabled = true) {
953
- const { client, user } = chunk2M4B4FFA_cjs.useDocumentTools();
953
+ const { client, user } = chunkCZP7FF3E_cjs.useDocumentTools();
954
954
  return reactQuery.useQuery({
955
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureCandidates(),
955
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureCandidates(),
956
956
  queryFn: async () => {
957
957
  const { data, error } = await client.GET("/v1/workspace/users");
958
958
  if (!data) throw new Error(detail(error, "The workspace members could not be read"));
@@ -990,18 +990,18 @@ async function inviteSigners(client, documentId, emails) {
990
990
  }
991
991
  }
992
992
  function useInviteSigners() {
993
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
993
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
994
994
  const invalidate = useInvalidateRequests();
995
995
  const queryClient = reactQuery.useQueryClient();
996
996
  return reactQuery.useMutation({
997
997
  mutationFn: ({ documentId, emails }) => inviteSigners(client, documentId, emails),
998
998
  onSuccess: async () => {
999
999
  await invalidate();
1000
- await queryClient.invalidateQueries({ queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.signatureCandidates() });
1000
+ await queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.signatureCandidates() });
1001
1001
  }
1002
1002
  });
1003
1003
  }
1004
- var INFORMAL_SIGNATURE_NOTE = "Informal signature: for verified signing, use Request signatures.";
1004
+ var INFORMAL_SIGNATURE_NOTE = "Your saved signature or initials are placed as an image on the document.";
1005
1005
  async function keypair(source = client.getUserEncryptionKeypair) {
1006
1006
  await client.initSodium();
1007
1007
  const pair = await source();
@@ -1034,9 +1034,9 @@ async function deleteSavedSignature(client) {
1034
1034
  if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
1035
1035
  }
1036
1036
  function useSavedSignature(enabled = true) {
1037
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1037
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
1038
1038
  return reactQuery.useQuery({
1039
- queryKey: chunkH4FGDXYB_cjs.arbiQueryKeys.savedSignature(),
1039
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.savedSignature(),
1040
1040
  queryFn: () => fetchSavedSignature(client),
1041
1041
  enabled,
1042
1042
  staleTime: 6e4,
@@ -1044,19 +1044,19 @@ function useSavedSignature(enabled = true) {
1044
1044
  });
1045
1045
  }
1046
1046
  function useStoreSavedSignature() {
1047
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1047
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
1048
1048
  const queryClient = reactQuery.useQueryClient();
1049
1049
  return reactQuery.useMutation({
1050
1050
  mutationFn: (signature) => storeSavedSignature(client, signature),
1051
- onSuccess: (_, signature) => queryClient.setQueryData(chunkH4FGDXYB_cjs.arbiQueryKeys.savedSignature(), signature)
1051
+ onSuccess: (_, signature) => queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.savedSignature(), signature)
1052
1052
  });
1053
1053
  }
1054
1054
  function useDeleteSavedSignature() {
1055
- const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
1055
+ const { client } = chunkCZP7FF3E_cjs.useDocumentTools();
1056
1056
  const queryClient = reactQuery.useQueryClient();
1057
1057
  return reactQuery.useMutation({
1058
1058
  mutationFn: () => deleteSavedSignature(client),
1059
- onSuccess: () => queryClient.setQueryData(chunkH4FGDXYB_cjs.arbiQueryKeys.savedSignature(), null)
1059
+ onSuccess: () => queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.savedSignature(), null)
1060
1060
  });
1061
1061
  }
1062
1062
  function pngBytes(base64) {
@@ -1070,78 +1070,175 @@ function pngSize(base64) {
1070
1070
  const view = new DataView(bytes.buffer);
1071
1071
  return { width: view.getUint32(16), height: view.getUint32(20) };
1072
1072
  }
1073
+ function failure(error) {
1074
+ const detail3 = error?.detail;
1075
+ return new Error(typeof detail3 === "string" ? detail3 : "The shared file request failed");
1076
+ }
1077
+ async function createFileShare(client, documentId, body) {
1078
+ const result = await client.POST("/v1/document/{document_ext_id}/file-shares", {
1079
+ params: { path: { document_ext_id: documentId } },
1080
+ body
1081
+ });
1082
+ if (!result.data) throw failure(result.error);
1083
+ return result.data;
1084
+ }
1085
+ async function getFileShare(client, id) {
1086
+ const result = await client.GET("/v1/file-shares/{share_id}", {
1087
+ params: { path: { share_id: id } }
1088
+ });
1089
+ if (!result.data) throw failure(result.error);
1090
+ return result.data;
1091
+ }
1092
+ async function fileShareBytes(client, id, kind) {
1093
+ const result = await client.GET("/v1/file-shares/{share_id}/file", {
1094
+ params: { path: { share_id: id }, query: { kind } },
1095
+ parseAs: "blob"
1096
+ });
1097
+ if (!result.data) throw failure(result.error);
1098
+ return result.data;
1099
+ }
1100
+ function fileShareSigningRequest(share) {
1101
+ return {
1102
+ external_id: share.external_id,
1103
+ doc_ext_id: share.document_ext_id,
1104
+ version: share.version,
1105
+ source_sha256: share.source_sha256,
1106
+ fields: share.fields,
1107
+ message: share.message,
1108
+ status: share.status === "signing" ? "sent" : share.status === "completed" ? "completed" : "voided",
1109
+ signers: share.recipients.filter((r) => r.permission === "sign").map((r) => ({
1110
+ external_id: r.email,
1111
+ email: r.email,
1112
+ name: r.email,
1113
+ status: r.status === "signed" ? "signed" : "pending",
1114
+ progress: r.status === "signed" ? "signed" : "registered",
1115
+ fields: share.fields.filter((f) => f.signer === r.email).length
1116
+ })),
1117
+ created_at: (/* @__PURE__ */ new Date(0)).toISOString(),
1118
+ stale: false
1119
+ };
1120
+ }
1121
+ async function signFileShare(client$1, domain, vars) {
1122
+ const path = { share_id: vars.request.external_id };
1123
+ const body = { adopted: vars.adopted, fields: vars.fields };
1124
+ const prepared = await client$1.POST("/v1/file-shares/{share_id}/sign/prepare", {
1125
+ params: { path },
1126
+ body
1127
+ });
1128
+ if (!prepared.data) throw failure(prepared.error);
1129
+ const { statement, timestamp, source_sha256, intent } = prepared.data;
1130
+ if (source_sha256 !== vars.request.source_sha256 || await sha256Hex(vars.pdfBlob) !== source_sha256)
1131
+ throw new Error("The shared file changed. Ask the sender for a new request.");
1132
+ if (intent !== intentText({ name: vars.adopted.name }))
1133
+ throw new Error("Signing statement mismatch");
1134
+ const identity = await client.unlockIdentityWithPassword(vars.email, vars.password, domain);
1135
+ const result = await client$1.POST("/v1/file-shares/{share_id}/sign", {
1136
+ params: { path },
1137
+ body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
1138
+ });
1139
+ if (!result.data) throw failure(result.error);
1140
+ return {
1141
+ request: fileShareSigningRequest(result.data),
1142
+ completed: result.data.status === "completed"
1143
+ };
1144
+ }
1145
+ function useFileShare(client, shareId, signing) {
1146
+ return reactQuery.useQuery({
1147
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.fileShare(shareId),
1148
+ queryFn: () => getFileShare(client, shareId),
1149
+ refetchInterval: signing ? false : 5e3
1150
+ });
1151
+ }
1152
+ function useFileSharePdf(client, shareId, share) {
1153
+ return reactQuery.useQuery({
1154
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.fileSharePdf(shareId, share?.status),
1155
+ queryFn: () => fileShareBytes(client, shareId, share?.status === "completed" ? "signed" : "view"),
1156
+ enabled: !!share?.can_preview,
1157
+ staleTime: Infinity
1158
+ });
1159
+ }
1160
+ function useFileShares(client) {
1161
+ return reactQuery.useQuery({
1162
+ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.fileShares(),
1163
+ queryFn: async () => {
1164
+ const result = await client.GET("/v1/file-shares");
1165
+ if (!result.data) throw new Error("Could not load shared files");
1166
+ return result.data;
1167
+ }
1168
+ });
1169
+ }
1073
1170
 
1074
1171
  Object.defineProperty(exports, "DocumentFetchError", {
1075
1172
  enumerable: true,
1076
- get: function () { return chunk2M4B4FFA_cjs.DocumentFetchError; }
1173
+ get: function () { return chunkCZP7FF3E_cjs.DocumentFetchError; }
1077
1174
  });
1078
1175
  Object.defineProperty(exports, "DocumentToolsProvider", {
1079
1176
  enumerable: true,
1080
- get: function () { return chunk2M4B4FFA_cjs.DocumentToolsProvider; }
1177
+ get: function () { return chunkCZP7FF3E_cjs.DocumentToolsProvider; }
1081
1178
  });
1082
1179
  Object.defineProperty(exports, "MarkupDownloadError", {
1083
1180
  enumerable: true,
1084
- get: function () { return chunk2M4B4FFA_cjs.MarkupDownloadError; }
1181
+ get: function () { return chunkCZP7FF3E_cjs.MarkupDownloadError; }
1085
1182
  });
1086
1183
  Object.defineProperty(exports, "SIGNED_LOCKED_REASON", {
1087
1184
  enumerable: true,
1088
- get: function () { return chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON; }
1185
+ get: function () { return chunkCZP7FF3E_cjs.SIGNED_LOCKED_REASON; }
1089
1186
  });
1090
1187
  Object.defineProperty(exports, "certificateLink", {
1091
1188
  enumerable: true,
1092
- get: function () { return chunk2M4B4FFA_cjs.certificateLink; }
1189
+ get: function () { return chunkCZP7FF3E_cjs.certificateLink; }
1093
1190
  });
1094
1191
  Object.defineProperty(exports, "clientUpload", {
1095
1192
  enumerable: true,
1096
- get: function () { return chunk2M4B4FFA_cjs.clientUpload; }
1193
+ get: function () { return chunkCZP7FF3E_cjs.clientUpload; }
1097
1194
  });
1098
1195
  Object.defineProperty(exports, "contentDispositionFileName", {
1099
1196
  enumerable: true,
1100
- get: function () { return chunk2M4B4FFA_cjs.contentDispositionFileName; }
1197
+ get: function () { return chunkCZP7FF3E_cjs.contentDispositionFileName; }
1101
1198
  });
1102
1199
  Object.defineProperty(exports, "currentHasMarkup", {
1103
1200
  enumerable: true,
1104
- get: function () { return chunk2M4B4FFA_cjs.currentHasMarkup; }
1201
+ get: function () { return chunkCZP7FF3E_cjs.currentHasMarkup; }
1105
1202
  });
1106
1203
  Object.defineProperty(exports, "defaultCertificateUrl", {
1107
1204
  enumerable: true,
1108
- get: function () { return chunk2M4B4FFA_cjs.defaultCertificateUrl; }
1205
+ get: function () { return chunkCZP7FF3E_cjs.defaultCertificateUrl; }
1109
1206
  });
1110
1207
  Object.defineProperty(exports, "downloadBlob", {
1111
1208
  enumerable: true,
1112
- get: function () { return chunk2M4B4FFA_cjs.downloadBlob; }
1209
+ get: function () { return chunkCZP7FF3E_cjs.downloadBlob; }
1113
1210
  });
1114
1211
  Object.defineProperty(exports, "fetchDocumentFile", {
1115
1212
  enumerable: true,
1116
- get: function () { return chunk2M4B4FFA_cjs.fetchDocumentFile; }
1213
+ get: function () { return chunkCZP7FF3E_cjs.fetchDocumentFile; }
1117
1214
  });
1118
1215
  Object.defineProperty(exports, "fetchDocumentPdf", {
1119
1216
  enumerable: true,
1120
- get: function () { return chunk2M4B4FFA_cjs.fetchDocumentPdf; }
1217
+ get: function () { return chunkCZP7FF3E_cjs.fetchDocumentPdf; }
1121
1218
  });
1122
1219
  Object.defineProperty(exports, "fetchMarkupPdf", {
1123
1220
  enumerable: true,
1124
- get: function () { return chunk2M4B4FFA_cjs.fetchMarkupPdf; }
1221
+ get: function () { return chunkCZP7FF3E_cjs.fetchMarkupPdf; }
1125
1222
  });
1126
1223
  Object.defineProperty(exports, "isSignedVersion", {
1127
1224
  enumerable: true,
1128
- get: function () { return chunk2M4B4FFA_cjs.isSignedVersion; }
1225
+ get: function () { return chunkCZP7FF3E_cjs.isSignedVersion; }
1129
1226
  });
1130
1227
  Object.defineProperty(exports, "uploadQueryString", {
1131
1228
  enumerable: true,
1132
- get: function () { return chunk2M4B4FFA_cjs.uploadQueryString; }
1229
+ get: function () { return chunkCZP7FF3E_cjs.uploadQueryString; }
1133
1230
  });
1134
1231
  Object.defineProperty(exports, "useDocumentTools", {
1135
1232
  enumerable: true,
1136
- get: function () { return chunk2M4B4FFA_cjs.useDocumentTools; }
1233
+ get: function () { return chunkCZP7FF3E_cjs.useDocumentTools; }
1137
1234
  });
1138
1235
  Object.defineProperty(exports, "useOptionalDocumentTools", {
1139
1236
  enumerable: true,
1140
- get: function () { return chunk2M4B4FFA_cjs.useOptionalDocumentTools; }
1237
+ get: function () { return chunkCZP7FF3E_cjs.useOptionalDocumentTools; }
1141
1238
  });
1142
1239
  Object.defineProperty(exports, "documentBytesKey", {
1143
1240
  enumerable: true,
1144
- get: function () { return chunkH4FGDXYB_cjs.documentBytesKey; }
1241
+ get: function () { return chunkRRWAX52L_cjs.documentBytesKey; }
1145
1242
  });
1146
1243
  exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
1147
1244
  exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
@@ -1161,6 +1258,7 @@ exports.addToMarkup = addToMarkup;
1161
1258
  exports.buildProduction = buildProduction;
1162
1259
  exports.canAnnotate = canAnnotate;
1163
1260
  exports.copyOpenThreads = copyOpenThreads;
1261
+ exports.createFileShare = createFileShare;
1164
1262
  exports.createMarkupStore = createMarkupStore;
1165
1263
  exports.deleteSavedSignature = deleteSavedSignature;
1166
1264
  exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
@@ -1170,8 +1268,11 @@ exports.fetchSavedSignature = fetchSavedSignature;
1170
1268
  exports.fetchSignatureVerification = fetchSignatureVerification;
1171
1269
  exports.fieldsFromSuggestions = fieldsFromSuggestions;
1172
1270
  exports.fieldsInSigningOrder = fieldsInSigningOrder;
1271
+ exports.fileShareBytes = fileShareBytes;
1272
+ exports.fileShareSigningRequest = fileShareSigningRequest;
1173
1273
  exports.forgetLegacyLayer = forgetLegacyLayer;
1174
1274
  exports.frozenCopyName = frozenCopyName;
1275
+ exports.getFileShare = getFileShare;
1175
1276
  exports.hasNoRendition = hasNoRendition;
1176
1277
  exports.initialsOf = initialsOf;
1177
1278
  exports.intentText = intentText;
@@ -1199,6 +1300,7 @@ exports.saveSignatureRequest = saveSignatureRequest;
1199
1300
  exports.sendBlocker = sendBlocker;
1200
1301
  exports.sha256Hex = sha256Hex;
1201
1302
  exports.signDocument = signDocument;
1303
+ exports.signFileShare = signFileShare;
1202
1304
  exports.signSignatureRequest = signSignatureRequest;
1203
1305
  exports.signatureFieldSuggestions = signatureFieldSuggestions;
1204
1306
  exports.splitSuggestions = splitSuggestions;
@@ -1212,6 +1314,9 @@ exports.useDocumentBytes = useDocumentBytes;
1212
1314
  exports.useDocumentMarkup = useDocumentMarkup;
1213
1315
  exports.useDocumentSignatureRequests = useDocumentSignatureRequests;
1214
1316
  exports.useDocumentSignatures = useDocumentSignatures;
1317
+ exports.useFileShare = useFileShare;
1318
+ exports.useFileSharePdf = useFileSharePdf;
1319
+ exports.useFileShares = useFileShares;
1215
1320
  exports.useInviteSigners = useInviteSigners;
1216
1321
  exports.useIsOnline = useIsOnline;
1217
1322
  exports.useSaveSignatureRequest = useSaveSignatureRequest;