@arbidocs/blocks 0.4.142 → 0.4.144
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/agents/index.cjs +435 -432
- package/dist/agents/index.js +7 -4
- package/dist/chat/index.cjs +139 -138
- package/dist/chat/index.js +4 -3
- package/dist/{chunk-N5X37J3D.js → chunk-2FJMTZNJ.js} +8 -5
- package/dist/chunk-2FJMTZNJ.js.map +1 -0
- package/dist/chunk-33ZOUJXA.js +561 -0
- package/dist/chunk-33ZOUJXA.js.map +1 -0
- package/dist/{chunk-S24XEVPS.cjs → chunk-464YPRAE.cjs} +33 -2
- package/dist/chunk-464YPRAE.cjs.map +1 -0
- package/dist/{chunk-7YLJHTDC.cjs → chunk-5A2QQAF5.cjs} +11 -11
- package/dist/{chunk-7YLJHTDC.cjs.map → chunk-5A2QQAF5.cjs.map} +1 -1
- package/dist/chunk-76L6LOP3.cjs +308 -0
- package/dist/chunk-76L6LOP3.cjs.map +1 -0
- package/dist/{chunk-FXG7TFAG.js → chunk-7NGAWGA3.js} +3 -3
- package/dist/{chunk-FXG7TFAG.js.map → chunk-7NGAWGA3.js.map} +1 -1
- package/dist/chunk-A6J2IBUG.js +1602 -0
- package/dist/chunk-A6J2IBUG.js.map +1 -0
- package/dist/{chunk-DPGFEMVT.cjs → chunk-ABUO6PIQ.cjs} +51 -1659
- package/dist/chunk-ABUO6PIQ.cjs.map +1 -0
- package/dist/chunk-AOSUHWIL.js +98 -0
- package/dist/chunk-AOSUHWIL.js.map +1 -0
- package/dist/{chunk-GBS6QVGS.cjs → chunk-BUWBXJ2N.cjs} +5 -5
- package/dist/{chunk-GBS6QVGS.cjs.map → chunk-BUWBXJ2N.cjs.map} +1 -1
- package/dist/chunk-CQCC7LE7.js +210 -0
- package/dist/chunk-CQCC7LE7.js.map +1 -0
- package/dist/{chunk-UGCKUXRV.js → chunk-CSI2B2H5.js} +3 -3
- package/dist/{chunk-UGCKUXRV.js.map → chunk-CSI2B2H5.js.map} +1 -1
- package/dist/{chunk-JO3EMZ4X.js → chunk-GWSGIZQ5.js} +3 -3
- package/dist/{chunk-JO3EMZ4X.js.map → chunk-GWSGIZQ5.js.map} +1 -1
- package/dist/{chunk-OWCEQKAR.cjs → chunk-JSTKEZBS.cjs} +21 -318
- package/dist/chunk-JSTKEZBS.cjs.map +1 -0
- package/dist/{chunk-CKCBBYTA.js → chunk-KSHKTOY2.js} +5 -205
- package/dist/chunk-KSHKTOY2.js.map +1 -0
- package/dist/chunk-LJJJ6CYH.cjs +62 -0
- package/dist/chunk-LJJJ6CYH.cjs.map +1 -0
- package/dist/chunk-MHFF5N65.cjs +101 -0
- package/dist/chunk-MHFF5N65.cjs.map +1 -0
- package/dist/{chunk-GYAUJ4KT.js → chunk-MTSKK3BN.js} +32 -3
- package/dist/chunk-MTSKK3BN.js.map +1 -0
- package/dist/chunk-O2ODDTMA.cjs +1627 -0
- package/dist/chunk-O2ODDTMA.cjs.map +1 -0
- package/dist/{chunk-3BFGL2JL.cjs → chunk-ODRHHWHY.cjs} +4 -4
- package/dist/{chunk-3BFGL2JL.cjs.map → chunk-ODRHHWHY.cjs.map} +1 -1
- package/dist/{chunk-Y5KTM3V5.js → chunk-PDKM27DF.js} +17 -295
- package/dist/chunk-PDKM27DF.js.map +1 -0
- package/dist/{chunk-OAL3B2ZU.cjs → chunk-PLJ7PHWU.cjs} +5 -5
- package/dist/{chunk-OAL3B2ZU.cjs.map → chunk-PLJ7PHWU.cjs.map} +1 -1
- package/dist/chunk-RA3ZJ45L.cjs +574 -0
- package/dist/chunk-RA3ZJ45L.cjs.map +1 -0
- package/dist/chunk-RFIBUWLF.cjs +232 -0
- package/dist/chunk-RFIBUWLF.cjs.map +1 -0
- package/dist/{chunk-MIDXCYZB.cjs → chunk-RQ2Y7USX.cjs} +15 -235
- package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
- package/dist/chunk-SV65E4QW.js +58 -0
- package/dist/chunk-SV65E4QW.js.map +1 -0
- package/dist/chunk-TZGBRLPK.js +288 -0
- package/dist/chunk-TZGBRLPK.js.map +1 -0
- package/dist/{chunk-PROK33G6.js → chunk-X3TGXEFS.js} +11 -1596
- package/dist/chunk-X3TGXEFS.js.map +1 -0
- package/dist/{chunk-HIJUXAWS.cjs → chunk-XGZX22ET.cjs} +77 -74
- package/dist/chunk-XGZX22ET.cjs.map +1 -0
- package/dist/{chunk-5BXEYYH6.js → chunk-ZM26YEOT.js} +3 -3
- package/dist/{chunk-5BXEYYH6.js.map → chunk-ZM26YEOT.js.map} +1 -1
- package/dist/connect/docx.cjs +35 -6
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.d.ts +9 -2
- package/dist/connect/docx.js +29 -5
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +126 -339
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +15 -260
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/docx/ConnectedNativeDocxComparison.d.ts +5 -0
- package/dist/connection/docx/ConnectedNativeDocxEditor.d.ts +16 -0
- package/dist/connection/{ConnectedStreamedWordArtifact.d.ts → docx/ConnectedStreamedWordArtifact.d.ts} +1 -1
- package/dist/connection/docx/support.d.ts +27 -0
- package/dist/connection/docx/useConnectedDocxReferences.d.ts +2 -0
- package/dist/connection/docx/useConnectedHouseTemplate.d.ts +2 -0
- package/dist/docx/index.cjs +17 -63
- package/dist/docx/index.cjs.map +1 -1
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/index.js +2 -64
- package/dist/docx/index.js.map +1 -1
- package/dist/docx/template/candidates.d.ts +16 -0
- package/dist/index.cjs +625 -609
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/deep-link.d.ts +46 -0
- package/dist/settings/index.cjs +10 -9
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/studio/index.cjs +5 -4
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +4 -3
- package/dist/studio/index.js.map +1 -1
- package/dist/workflow-canvas/index.cjs +58 -55
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +7 -4
- package/dist/workflow-canvas/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-4TR5QCCX.cjs +0 -43
- package/dist/chunk-4TR5QCCX.cjs.map +0 -1
- package/dist/chunk-7NDW4KF4.cjs +0 -112
- package/dist/chunk-7NDW4KF4.cjs.map +0 -1
- package/dist/chunk-CKCBBYTA.js.map +0 -1
- package/dist/chunk-DPGFEMVT.cjs.map +0 -1
- package/dist/chunk-ETXYVO6E.js +0 -109
- package/dist/chunk-ETXYVO6E.js.map +0 -1
- package/dist/chunk-GYAUJ4KT.js.map +0 -1
- package/dist/chunk-HIJUXAWS.cjs.map +0 -1
- package/dist/chunk-MCKOZACC.js +0 -41
- package/dist/chunk-MCKOZACC.js.map +0 -1
- package/dist/chunk-MIDXCYZB.cjs.map +0 -1
- package/dist/chunk-N5X37J3D.js.map +0 -1
- package/dist/chunk-OWCEQKAR.cjs.map +0 -1
- package/dist/chunk-PROK33G6.js.map +0 -1
- package/dist/chunk-S24XEVPS.cjs.map +0 -1
- package/dist/chunk-Y5KTM3V5.js.map +0 -1
- package/dist/connection/ConnectedNativeDocxEditor.d.ts +0 -6
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type NativeDocxComparisonProps } from '../../docx/NativeDocxComparison';
|
|
2
|
+
/** The Word redline of two documents or versions, on the signed-in session. */
|
|
3
|
+
export declare function ConnectedNativeDocxComparison({ fontBaseUrl, ...props }: Omit<NativeDocxComparisonProps, 'adapter' | 'onCompared'> & {
|
|
4
|
+
fontBaseUrl?: string;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type NativeDocxAdapter, type NativeDocxEditorProps } from '../../docx/NativeDocxEditor';
|
|
2
|
+
export type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter'> & {
|
|
3
|
+
fontBaseUrl?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The native Word editor on the signed-in ARBI session, under any host (a `ConnectionProvider`, or
|
|
7
|
+
* the host's own `ArbiProvider` + session state). Until a live session has opened, a failure to
|
|
8
|
+
* open one falls back to the saved copy, read-only, so the document is still readable; later token
|
|
9
|
+
* refreshes are not guarded (switching modes would drop unsaved edits).
|
|
10
|
+
*/
|
|
11
|
+
export declare function ConnectedNativeDocxEditor({ fontBaseUrl, ...props }: ConnectedNativeDocxEditorProps): import("react").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The native Word adapter on the signed-in session: the editor transport, the people to mention,
|
|
14
|
+
* cross-references, the house template, and the host's extras (`NativeDocxSupportProvider`).
|
|
15
|
+
*/
|
|
16
|
+
export declare function useConnectedNativeDocxAdapter(fontBaseUrl?: string): NativeDocxAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StreamedWordArtifactProps } from '
|
|
1
|
+
import { type StreamedWordArtifactProps } from '../../docx/StreamedWordArtifact';
|
|
2
2
|
export declare function ConnectedStreamedWordArtifact({ fontBaseUrl, ...props }: Omit<StreamedWordArtifactProps, 'adapter'> & {
|
|
3
3
|
fontBaseUrl?: string;
|
|
4
4
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host adds to the connected Word editor that the platform API alone cannot give: the
|
|
3
|
+
* workspace's definitions (facts labelled "Definitions"), image generation (an assistant run), the
|
|
4
|
+
* host's leave-page guard, and a comment to open the editor at. Every field is optional; without a
|
|
5
|
+
* provider the editor simply offers less (no Defined term, no Generate image).
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { DefinitionSource } from '../../tags/definitions';
|
|
9
|
+
import type { DocxImageGeneration } from '../../docx/layout/GenerateImage';
|
|
10
|
+
export interface NativeDocxSupport {
|
|
11
|
+
/** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */
|
|
12
|
+
definitions?: () => Promise<DefinitionSource[]>;
|
|
13
|
+
/** The platform's image generation. Present: Insert offers Generate image. */
|
|
14
|
+
imageGeneration?: DocxImageGeneration;
|
|
15
|
+
/** The open editor has (or no longer has) unsaved changes. */
|
|
16
|
+
onDirtyChange?: (dirty: boolean) => void;
|
|
17
|
+
/** A comment thread to open when its document opens (a notification's link). */
|
|
18
|
+
commentTarget?: {
|
|
19
|
+
documentId: string;
|
|
20
|
+
commentId: string;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function NativeDocxSupportProvider({ value, children, }: {
|
|
24
|
+
value: NativeDocxSupport;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function useNativeDocxSupport(): NativeDocxSupport;
|
package/dist/docx/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkMHFF5N65_cjs = require('../chunk-MHFF5N65.cjs');
|
|
5
|
+
var chunk464YPRAE_cjs = require('../chunk-464YPRAE.cjs');
|
|
6
6
|
var chunkV5OAXIBN_cjs = require('../chunk-V5OAXIBN.cjs');
|
|
7
7
|
require('../chunk-5FYU7ZIU.cjs');
|
|
8
8
|
require('../chunk-I2QSDQQV.cjs');
|
|
@@ -12,73 +12,28 @@ require('../chunk-MHVNT4J3.cjs');
|
|
|
12
12
|
require('../chunk-DES3K4SD.cjs');
|
|
13
13
|
var react = require('@docx-editor.dev/react');
|
|
14
14
|
var hocuspocus = require('@arbidocs/coedit/hocuspocus');
|
|
15
|
-
var react$1 = require('react');
|
|
16
|
-
var artifacts = require('@arbidocs/react/artifacts');
|
|
17
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
18
15
|
|
|
19
|
-
function redlineQuery(baseId, revisedId) {
|
|
20
|
-
const base = artifacts.parseVersionRef(baseId);
|
|
21
|
-
const revised = artifacts.parseVersionRef(revisedId);
|
|
22
|
-
const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId });
|
|
23
|
-
if (base.version) query.set("base_version", String(base.version));
|
|
24
|
-
if (revised.version) query.set("revised_version", String(revised.version));
|
|
25
|
-
return query;
|
|
26
|
-
}
|
|
27
|
-
function NativeDocxComparison({
|
|
28
|
-
adapter,
|
|
29
|
-
baseId,
|
|
30
|
-
revisedId,
|
|
31
|
-
title,
|
|
32
|
-
onCompared
|
|
33
|
-
}) {
|
|
34
|
-
const host = react$1.useRef({ adapter, onCompared });
|
|
35
|
-
host.current = { adapter, onCompared };
|
|
36
|
-
const [documentId, setDocumentId] = react$1.useState("");
|
|
37
|
-
const [error, setError] = react$1.useState("");
|
|
38
|
-
const [attempt, setAttempt] = react$1.useState(0);
|
|
39
|
-
react$1.useEffect(() => {
|
|
40
|
-
let cancelled = false;
|
|
41
|
-
setDocumentId("");
|
|
42
|
-
setError("");
|
|
43
|
-
void host.current.adapter.request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: "POST" }).then((response) => response.json()).then((result) => {
|
|
44
|
-
if (!result.document_ext_id) throw new Error("Comparison did not return a Word document.");
|
|
45
|
-
if (!cancelled) {
|
|
46
|
-
setDocumentId(result.document_ext_id);
|
|
47
|
-
void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}).catch((error2) => {
|
|
51
|
-
if (!cancelled) setError(error2 instanceof Error ? error2.message : String(error2));
|
|
52
|
-
});
|
|
53
|
-
return () => {
|
|
54
|
-
cancelled = true;
|
|
55
|
-
};
|
|
56
|
-
}, [baseId, revisedId, attempt]);
|
|
57
|
-
if (error)
|
|
58
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "native-docx-error", role: "alert", children: [
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { children: error }),
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setAttempt((value) => value + 1), children: "Retry comparison" })
|
|
61
|
-
] });
|
|
62
|
-
if (!documentId)
|
|
63
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
|
|
64
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
-
chunkV5OAXIBN_cjs.NativeDocxEditor,
|
|
66
|
-
{
|
|
67
|
-
adapter,
|
|
68
|
-
documentId,
|
|
69
|
-
title: `${title.replace(/\.[^.]+$/, "")} (redline).docx`
|
|
70
|
-
},
|
|
71
|
-
documentId
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
16
|
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, "NativeDocxComparison", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkMHFF5N65_cjs.NativeDocxComparison; }
|
|
21
|
+
});
|
|
75
22
|
Object.defineProperty(exports, "StreamedWordArtifact", {
|
|
76
23
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkMHFF5N65_cjs.StreamedWordArtifact; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "groupCandidates", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunk464YPRAE_cjs.groupCandidates; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isCandidate", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunk464YPRAE_cjs.isCandidate; }
|
|
78
33
|
});
|
|
79
34
|
Object.defineProperty(exports, "loadDocxFonts", {
|
|
80
35
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunk464YPRAE_cjs.loadDocxFonts; }
|
|
82
37
|
});
|
|
83
38
|
Object.defineProperty(exports, "BUILTIN_TEMPLATE_NAME", {
|
|
84
39
|
enumerable: true,
|
|
@@ -264,6 +219,5 @@ Object.defineProperty(exports, "createHocuspocusCollaboration", {
|
|
|
264
219
|
enumerable: true,
|
|
265
220
|
get: function () { return hocuspocus.createHocuspocusCollaboration; }
|
|
266
221
|
});
|
|
267
|
-
exports.NativeDocxComparison = NativeDocxComparison;
|
|
268
222
|
//# sourceMappingURL=index.cjs.map
|
|
269
223
|
//# sourceMappingURL=index.cjs.map
|
package/dist/docx/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
|
package/dist/docx/index.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export { structuralPort, trackedOrNoted, type StructuralInsert, type StructuralO
|
|
|
23
23
|
export { DocxAuthorContext, useTrackedOrNoted } from './structural/useTrackedOrNoted';
|
|
24
24
|
export { contentPath } from './NativeDocxEditor';
|
|
25
25
|
export { HouseTemplateProvider, useHouseTemplate, builtinHouseTemplate, resolveHouseTemplate, templateFileName, BUILTIN_TEMPLATE_NAME, type HouseTemplate, type HouseTemplateHost, type HouseTemplateSource, } from './template/HouseTemplate';
|
|
26
|
+
export { groupCandidates, isCandidate, type CandidateGroup, type HouseTemplateCandidate, } from './template/candidates';
|
package/dist/docx/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { StreamedWordArtifact } from '../chunk-
|
|
3
|
-
export { loadDocxFonts } from '../chunk-
|
|
4
|
-
import { NativeDocxEditor } from '../chunk-2FL7QJKJ.js';
|
|
2
|
+
export { NativeDocxComparison, StreamedWordArtifact } from '../chunk-AOSUHWIL.js';
|
|
3
|
+
export { groupCandidates, isCandidate, loadDocxFonts } from '../chunk-MTSKK3BN.js';
|
|
5
4
|
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertCrossReference, insertDefinedTerm, insertDocumentReference, listTargets, normalizeDocxExport, paragraphNumber, referenceText, referencesPort, resolveHouseTemplate, reviewModule, shortTitle, structuralPort, templateFileName, trackedOrNoted, useCrossReferences, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing } from '../chunk-2FL7QJKJ.js';
|
|
6
5
|
import '../chunk-HFZ45FD3.js';
|
|
7
6
|
import '../chunk-QXMR5YHC.js';
|
|
@@ -11,66 +10,5 @@ import '../chunk-7F6CBP3Z.js';
|
|
|
11
10
|
import '../chunk-VUNV25KB.js';
|
|
12
11
|
export { DocxEditor, useDocxEditor, useEditorState } from '@docx-editor.dev/react';
|
|
13
12
|
export { createHocuspocusCollaboration } from '@arbidocs/coedit/hocuspocus';
|
|
14
|
-
import { useRef, useState, useEffect } from 'react';
|
|
15
|
-
import { parseVersionRef } from '@arbidocs/react/artifacts';
|
|
16
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
function redlineQuery(baseId, revisedId) {
|
|
19
|
-
const base = parseVersionRef(baseId);
|
|
20
|
-
const revised = parseVersionRef(revisedId);
|
|
21
|
-
const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId });
|
|
22
|
-
if (base.version) query.set("base_version", String(base.version));
|
|
23
|
-
if (revised.version) query.set("revised_version", String(revised.version));
|
|
24
|
-
return query;
|
|
25
|
-
}
|
|
26
|
-
function NativeDocxComparison({
|
|
27
|
-
adapter,
|
|
28
|
-
baseId,
|
|
29
|
-
revisedId,
|
|
30
|
-
title,
|
|
31
|
-
onCompared
|
|
32
|
-
}) {
|
|
33
|
-
const host = useRef({ adapter, onCompared });
|
|
34
|
-
host.current = { adapter, onCompared };
|
|
35
|
-
const [documentId, setDocumentId] = useState("");
|
|
36
|
-
const [error, setError] = useState("");
|
|
37
|
-
const [attempt, setAttempt] = useState(0);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
let cancelled = false;
|
|
40
|
-
setDocumentId("");
|
|
41
|
-
setError("");
|
|
42
|
-
void host.current.adapter.request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: "POST" }).then((response) => response.json()).then((result) => {
|
|
43
|
-
if (!result.document_ext_id) throw new Error("Comparison did not return a Word document.");
|
|
44
|
-
if (!cancelled) {
|
|
45
|
-
setDocumentId(result.document_ext_id);
|
|
46
|
-
void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}).catch((error2) => {
|
|
50
|
-
if (!cancelled) setError(error2 instanceof Error ? error2.message : String(error2));
|
|
51
|
-
});
|
|
52
|
-
return () => {
|
|
53
|
-
cancelled = true;
|
|
54
|
-
};
|
|
55
|
-
}, [baseId, revisedId, attempt]);
|
|
56
|
-
if (error)
|
|
57
|
-
return /* @__PURE__ */ jsxs("div", { className: "native-docx-error", role: "alert", children: [
|
|
58
|
-
/* @__PURE__ */ jsx("p", { children: error }),
|
|
59
|
-
/* @__PURE__ */ jsx("button", { onClick: () => setAttempt((value) => value + 1), children: "Retry comparison" })
|
|
60
|
-
] });
|
|
61
|
-
if (!documentId)
|
|
62
|
-
return /* @__PURE__ */ jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
64
|
-
NativeDocxEditor,
|
|
65
|
-
{
|
|
66
|
-
adapter,
|
|
67
|
-
documentId,
|
|
68
|
-
title: `${title.replace(/\.[^.]+$/, "")} (redline).docx`
|
|
69
|
-
},
|
|
70
|
-
documentId
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { NativeDocxComparison };
|
|
75
13
|
//# sourceMappingURL=index.js.map
|
|
76
14
|
//# sourceMappingURL=index.js.map
|
package/dist/docx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { components } from '@arbidocs/client';
|
|
2
|
+
/** A document a workspace may use as its house template (`GET /v1/workspace/house-template/candidates`). */
|
|
3
|
+
export type HouseTemplateCandidate = components['schemas']['HouseTemplateCandidate'];
|
|
4
|
+
export interface CandidateGroup {
|
|
5
|
+
/** "This workspace", or the public workspace's name. */
|
|
6
|
+
title: string;
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
candidates: HouseTemplateCandidate[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The picker's groups: this workspace's documents first, then each public workspace's, by name.
|
|
12
|
+
* `query` keeps the documents whose file name contains it (case-insensitive); empty groups go.
|
|
13
|
+
*/
|
|
14
|
+
export declare function groupCandidates(candidates: readonly HouseTemplateCandidate[], workspaceId: string | undefined, query?: string): CandidateGroup[];
|
|
15
|
+
/** Whether a document may be made the house template: it is one of the candidates. */
|
|
16
|
+
export declare function isCandidate(candidates: readonly HouseTemplateCandidate[] | undefined, documentId: string): boolean;
|