@harbour-enterprises/superdoc 0.29.0-next.6 → 0.29.0-next.8
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/chunks/{PdfViewer-DBfl4V6j.es.js → PdfViewer-D52oZlMN.es.js} +2 -2
- package/dist/chunks/{PdfViewer-kTifNldY.cjs → PdfViewer-DN5OVJ2m.cjs} +1 -1
- package/dist/chunks/{eventemitter3-xrnx5jJP.es.js → eventemitter3-D4gv5QOO.es.js} +1 -1
- package/dist/chunks/{index-Caa0JKTo.es.js → index-Ckp6Xz_9.es.js} +166 -121
- package/dist/chunks/{index-D9lamqZc-xeA1gYMV.cjs → index-D08c3nkG-CEL2t8xk.cjs} +1 -1
- package/dist/chunks/{index-D9lamqZc-CwcGCvi6.es.js → index-D08c3nkG-DhTHMiRT.es.js} +1 -1
- package/dist/chunks/{index-kFJxUsf3.cjs → index-l9QIxky6.cjs} +164 -119
- package/dist/chunks/{jszip-9Y3n05fi.es.js → jszip-Bhl-Iudl.es.js} +1 -1
- package/dist/chunks/{super-editor.es-D6Olq3ex.es.js → super-editor.es-BMKdFBfO.es.js} +148 -112
- package/dist/chunks/{super-editor.es-DkfNbRLe.cjs → super-editor.es-DfufVFpB.cjs} +146 -110
- package/dist/chunks/{vue-DVNiXx7E.es.js → vue-D1vcEBAQ.es.js} +17 -17
- package/dist/chunks/xml-js-jMPlIVKT.es.js +2 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/comment-schemas.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/helpers.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/types.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/use-conversation.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/PdfViewer/helpers/range.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/PdfViewer/helpers/read-file.d.ts.map +1 -0
- package/dist/packages/superdoc/src/components/PdfViewer/pdf/pdf-adapter.d.ts.map +1 -0
- package/dist/packages/superdoc/src/composables/use-ai.d.ts.map +1 -0
- package/dist/packages/superdoc/src/composables/use-document.d.ts.map +1 -0
- package/dist/packages/superdoc/src/composables/use-field.d.ts.map +1 -0
- package/dist/packages/superdoc/src/composables/use-high-contrast-mode.d.ts.map +1 -0
- package/dist/packages/superdoc/src/composables/use-selected-text.d.ts.map +1 -0
- package/dist/{core → packages/superdoc/src/core}/SuperDoc.d.ts +1 -1
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/collaboration/permissions.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/create-app.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/helpers/export.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/helpers/file.d.ts.map +1 -0
- package/dist/{core → packages/superdoc/src/core}/index.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -0
- package/dist/packages/superdoc/src/helpers/floor.d.ts.map +1 -0
- package/dist/packages/superdoc/src/helpers/group-changes.d.ts.map +1 -0
- package/dist/packages/superdoc/src/helpers/use-selection.d.ts.map +1 -0
- package/dist/{icons.d.ts.map → packages/superdoc/src/icons.d.ts.map} +1 -1
- package/dist/{index.d.ts → packages/superdoc/src/index.d.ts} +5 -5
- package/dist/packages/superdoc/src/index.d.ts.map +1 -0
- package/dist/packages/superdoc/src/main.d.ts.map +1 -0
- package/dist/{stores → packages/superdoc/src/stores}/comments-store.d.ts +36 -36
- package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -0
- package/dist/packages/superdoc/src/stores/hrbr-fields-store.d.ts.map +1 -0
- package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts +110 -110
- package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts.map +1 -1
- package/dist/{super-editor.d.ts.map → packages/superdoc/src/super-editor.d.ts.map} +1 -1
- package/dist/shared/common/Telemetry.d.ts +237 -0
- package/dist/shared/common/Telemetry.d.ts.map +1 -0
- package/dist/shared/common/collaboration/awareness.d.ts +39 -0
- package/dist/shared/common/collaboration/awareness.d.ts.map +1 -0
- package/dist/shared/common/document-types.d.ts +10 -0
- package/dist/shared/common/document-types.d.ts.map +1 -0
- package/dist/shared/common/event-types.d.ts +14 -0
- package/dist/shared/common/event-types.d.ts.map +1 -0
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts +8 -0
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts.map +1 -0
- package/dist/shared/common/helpers/get-file-object.d.ts +50 -0
- package/dist/shared/common/helpers/get-file-object.d.ts.map +1 -0
- package/dist/shared/common/helpers/v-click-outside.d.ts +11 -0
- package/dist/shared/common/helpers/v-click-outside.d.ts.map +1 -0
- package/dist/shared/common/index.d.ts +10 -0
- package/dist/shared/common/index.d.ts.map +1 -0
- package/dist/shared/common/key-transform.d.ts +44 -0
- package/dist/shared/common/key-transform.d.ts.map +1 -0
- package/dist/style.css +56 -56
- package/dist/super-editor/ai-writer.es.js +3 -3
- package/dist/super-editor/chunks/{converter-6BwN6uD7.js → converter-CqYeAv65.js} +331 -50
- package/dist/super-editor/chunks/{docx-zipper-uOVWdyXU.js → docx-zipper-C97RawM-.js} +1 -1
- package/dist/super-editor/chunks/{editor-D-ahyJjH.js → editor-BrxCRICL.js} +7 -6
- package/dist/super-editor/chunks/{index-D9lamqZc.js → index-D08c3nkG.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DlZ3uQM7.js → toolbar-B33VzEsn.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -2
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +29 -29
- package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/index.d.ts +0 -1
- package/dist/super-editor/super-editor/src/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor.es.js +77 -50
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +3 -3
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +2 -3
- package/dist/superdoc.es.js +2 -3
- package/dist/superdoc.umd.js +44279 -44198
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/xml-js-ByyNjzYS.es.js +0 -2
- package/dist/components/CommentsLayer/comment-schemas.d.ts.map +0 -1
- package/dist/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +0 -1
- package/dist/components/CommentsLayer/helpers.d.ts.map +0 -1
- package/dist/components/CommentsLayer/types.d.ts.map +0 -1
- package/dist/components/CommentsLayer/use-comment.d.ts.map +0 -1
- package/dist/components/CommentsLayer/use-conversation.d.ts.map +0 -1
- package/dist/components/CommentsLayer/use-floating-comment.d.ts.map +0 -1
- package/dist/components/PdfViewer/helpers/range.d.ts.map +0 -1
- package/dist/components/PdfViewer/helpers/read-file.d.ts.map +0 -1
- package/dist/components/PdfViewer/pdf/pdf-adapter.d.ts.map +0 -1
- package/dist/composables/use-ai.d.ts.map +0 -1
- package/dist/composables/use-document.d.ts.map +0 -1
- package/dist/composables/use-field.d.ts.map +0 -1
- package/dist/composables/use-high-contrast-mode.d.ts.map +0 -1
- package/dist/composables/use-selected-text.d.ts.map +0 -1
- package/dist/core/SuperDoc.d.ts.map +0 -1
- package/dist/core/collaboration/collaboration-comments.d.ts.map +0 -1
- package/dist/core/collaboration/collaboration.d.ts.map +0 -1
- package/dist/core/collaboration/helpers.d.ts.map +0 -1
- package/dist/core/collaboration/permissions.d.ts.map +0 -1
- package/dist/core/create-app.d.ts.map +0 -1
- package/dist/core/helpers/export.d.ts.map +0 -1
- package/dist/core/helpers/file.d.ts.map +0 -1
- package/dist/core/types/index.d.ts.map +0 -1
- package/dist/helpers/floor.d.ts.map +0 -1
- package/dist/helpers/group-changes.d.ts.map +0 -1
- package/dist/helpers/use-selection.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/stores/comments-store.d.ts.map +0 -1
- package/dist/stores/hrbr-fields-store.d.ts.map +0 -1
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/comment-schemas.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/commentsList/super-comments-list.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/helpers.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/types.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-comment.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-conversation.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-floating-comment.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/range.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/read-file.d.ts +0 -0
- /package/dist/{components → packages/superdoc/src/components}/PdfViewer/pdf/pdf-adapter.d.ts +0 -0
- /package/dist/{composables → packages/superdoc/src/composables}/use-ai.d.ts +0 -0
- /package/dist/{composables → packages/superdoc/src/composables}/use-document.d.ts +0 -0
- /package/dist/{composables → packages/superdoc/src/composables}/use-field.d.ts +0 -0
- /package/dist/{composables → packages/superdoc/src/composables}/use-high-contrast-mode.d.ts +0 -0
- /package/dist/{composables → packages/superdoc/src/composables}/use-selected-text.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration-comments.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/collaboration/helpers.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/collaboration/permissions.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/create-app.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/helpers/export.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/helpers/file.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/index.d.ts +0 -0
- /package/dist/{core → packages/superdoc/src/core}/types/index.d.ts +0 -0
- /package/dist/{helpers → packages/superdoc/src/helpers}/floor.d.ts +0 -0
- /package/dist/{helpers → packages/superdoc/src/helpers}/group-changes.d.ts +0 -0
- /package/dist/{helpers → packages/superdoc/src/helpers}/use-selection.d.ts +0 -0
- /package/dist/{icons.d.ts → packages/superdoc/src/icons.d.ts} +0 -0
- /package/dist/{main.d.ts → packages/superdoc/src/main.d.ts} +0 -0
- /package/dist/{stores → packages/superdoc/src/stores}/hrbr-fields-store.d.ts +0 -0
- /package/dist/{super-editor.d.ts → packages/superdoc/src/super-editor.d.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
-
const vue = require("./vue-BQxRC6G7.cjs");
|
|
2
|
+
const superEditor_es = require("./super-editor.es-DfufVFpB.cjs");
|
|
4
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
4
|
const eventemitter3 = require("./eventemitter3-BvTILlBo.cjs");
|
|
6
5
|
const provider = require("@hocuspocus/provider");
|
|
6
|
+
const vue = require("./vue-BQxRC6G7.cjs");
|
|
7
7
|
const Y = require("yjs");
|
|
8
8
|
const jszip = require("./jszip-B0BPx_cv.cjs");
|
|
9
9
|
const uuid = require("./uuid-R7L08bOx.cjs");
|
|
@@ -32,7 +32,7 @@ const documentTypes = {
|
|
|
32
32
|
pdf: PDF,
|
|
33
33
|
html: HTML
|
|
34
34
|
};
|
|
35
|
-
const comments_module_events =
|
|
35
|
+
const comments_module_events = {
|
|
36
36
|
RESOLVED: "resolved",
|
|
37
37
|
NEW: "new",
|
|
38
38
|
ADD: "add",
|
|
@@ -45,16 +45,54 @@ const comments_module_events = Object.freeze({
|
|
|
45
45
|
// Tracked changes
|
|
46
46
|
CHANGE_ACCEPTED: "change-accepted",
|
|
47
47
|
CHANGE_REJECTED: "change-rejected"
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
|
+
class FileObjectError extends Error {
|
|
50
|
+
constructor(message, cause) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.cause = cause;
|
|
53
|
+
this.name = "FileObjectError";
|
|
54
|
+
if (typeof Error.captureStackTrace === "function") {
|
|
55
|
+
Error.captureStackTrace(this, FileObjectError);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class InvalidDataUriError extends FileObjectError {
|
|
60
|
+
constructor(uri) {
|
|
61
|
+
super(`Invalid data URI format: URI must contain exactly one comma separator`);
|
|
62
|
+
this.uri = uri;
|
|
63
|
+
this.name = "InvalidDataUriError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class FetchFailedError extends FileObjectError {
|
|
67
|
+
constructor(url, cause) {
|
|
68
|
+
super(`Failed to fetch file from URL: ${url}`, cause);
|
|
69
|
+
this.url = url;
|
|
70
|
+
this.name = "FetchFailedError";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
49
73
|
const getFileObject = async (fileUrl, name, type) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
try {
|
|
75
|
+
if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
|
|
76
|
+
const parts = fileUrl.split(",");
|
|
77
|
+
if (parts.length !== 2) {
|
|
78
|
+
throw new InvalidDataUriError(fileUrl);
|
|
79
|
+
}
|
|
80
|
+
const binary = atob(parts[1]);
|
|
81
|
+
const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
|
|
82
|
+
return new File([bytes], name, { type });
|
|
83
|
+
}
|
|
84
|
+
const response = await fetch(fileUrl);
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
throw new FetchFailedError(fileUrl, new Error(`HTTP ${response.status}: ${response.statusText}`));
|
|
87
|
+
}
|
|
88
|
+
const blob = await response.blob();
|
|
89
|
+
return new File([blob], name, { type });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof FileObjectError) {
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
throw new FileObjectError("Failed to create file object", error);
|
|
95
|
+
}
|
|
58
96
|
};
|
|
59
97
|
function compareVersions(version1, version2) {
|
|
60
98
|
const v1Parts = version1.split(".").map(Number);
|
|
@@ -71,68 +109,62 @@ const vClickOutside = {
|
|
|
71
109
|
mounted(el, binding) {
|
|
72
110
|
const clickOutsideHandler = (event) => {
|
|
73
111
|
if (!el.contains(event.target)) {
|
|
74
|
-
binding.value(event);
|
|
112
|
+
binding.value?.(event);
|
|
75
113
|
}
|
|
76
114
|
};
|
|
77
115
|
document.addEventListener("click", clickOutsideHandler);
|
|
78
116
|
el.__clickOutsideHandler = clickOutsideHandler;
|
|
79
117
|
},
|
|
80
118
|
unmounted(el) {
|
|
81
|
-
|
|
82
|
-
|
|
119
|
+
if (el.__clickOutsideHandler) {
|
|
120
|
+
document.removeEventListener("click", el.__clickOutsideHandler);
|
|
121
|
+
delete el.__clickOutsideHandler;
|
|
122
|
+
}
|
|
83
123
|
}
|
|
84
124
|
};
|
|
125
|
+
function getCrypto() {
|
|
126
|
+
if (typeof globalThis === "undefined") {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
const cryptoObj = globalThis.crypto ?? globalThis.msCrypto;
|
|
130
|
+
if (cryptoObj?.getRandomValues) {
|
|
131
|
+
return cryptoObj;
|
|
132
|
+
}
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
85
135
|
function randomBytes(length2) {
|
|
86
136
|
const array = new Uint8Array(length2);
|
|
137
|
+
const cryptoObj = getCrypto();
|
|
138
|
+
if (cryptoObj) {
|
|
139
|
+
cryptoObj.getRandomValues(array);
|
|
140
|
+
return array;
|
|
141
|
+
}
|
|
87
142
|
for (let i = 0; i < length2; i++) {
|
|
88
143
|
array[i] = Math.floor(Math.random() * 256);
|
|
89
144
|
}
|
|
90
145
|
return array;
|
|
91
146
|
}
|
|
92
147
|
class Telemetry {
|
|
93
|
-
/** @type {boolean} */
|
|
94
|
-
enabled;
|
|
95
|
-
/** @type {string} */
|
|
96
|
-
documentGuid;
|
|
97
|
-
/** @type {string} */
|
|
98
|
-
documentIdentifier;
|
|
99
|
-
/** @type {string} */
|
|
100
|
-
superdocVersion;
|
|
101
|
-
/** @type {string} */
|
|
102
|
-
licenseKey;
|
|
103
|
-
/** @type {string} */
|
|
104
|
-
endpoint;
|
|
105
|
-
/** @type {string} */
|
|
106
|
-
sessionId;
|
|
107
|
-
/** @type {Object} */
|
|
108
|
-
statistics = {
|
|
109
|
-
nodeTypes: {},
|
|
110
|
-
markTypes: {},
|
|
111
|
-
attributes: {},
|
|
112
|
-
errorCount: 0
|
|
113
|
-
};
|
|
114
|
-
/** @type {Array} */
|
|
115
|
-
unknownElements = [];
|
|
116
|
-
/** @type {Array} */
|
|
117
|
-
errors = [];
|
|
118
|
-
/** @type {Object} */
|
|
119
|
-
fileStructure = {
|
|
120
|
-
totalFiles: 0,
|
|
121
|
-
maxDepth: 0,
|
|
122
|
-
totalNodes: 0,
|
|
123
|
-
files: []
|
|
124
|
-
};
|
|
125
|
-
/** @type {Object} */
|
|
126
|
-
documentInfo = null;
|
|
127
|
-
/** @type {string} */
|
|
128
|
-
static COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
|
|
129
|
-
/** @type {string} */
|
|
130
|
-
static DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
131
148
|
/**
|
|
132
149
|
* Initialize telemetry service
|
|
133
|
-
* @param
|
|
150
|
+
* @param config - Telemetry configuration
|
|
134
151
|
*/
|
|
135
|
-
constructor(config
|
|
152
|
+
constructor(config) {
|
|
153
|
+
this.statistics = {
|
|
154
|
+
nodeTypes: {},
|
|
155
|
+
markTypes: {},
|
|
156
|
+
attributes: {},
|
|
157
|
+
errorCount: 0
|
|
158
|
+
};
|
|
159
|
+
this.unknownElements = [];
|
|
160
|
+
this.errors = [];
|
|
161
|
+
this.fileStructure = {
|
|
162
|
+
totalFiles: 0,
|
|
163
|
+
maxDepth: 0,
|
|
164
|
+
totalNodes: 0,
|
|
165
|
+
files: []
|
|
166
|
+
};
|
|
167
|
+
this.documentInfo = null;
|
|
136
168
|
this.enabled = config.enabled ?? true;
|
|
137
169
|
this.licenseKey = config.licenseKey ?? Telemetry.COMMUNITY_LICENSE_KEY;
|
|
138
170
|
this.endpoint = config.endpoint ?? Telemetry.DEFAULT_ENDPOINT;
|
|
@@ -141,9 +173,15 @@ class Telemetry {
|
|
|
141
173
|
this.superdocVersion = config.superdocVersion;
|
|
142
174
|
this.sessionId = this.generateId();
|
|
143
175
|
}
|
|
176
|
+
static {
|
|
177
|
+
this.COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
|
|
178
|
+
}
|
|
179
|
+
static {
|
|
180
|
+
this.DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
181
|
+
}
|
|
144
182
|
/**
|
|
145
183
|
* Get browser environment information
|
|
146
|
-
* @returns
|
|
184
|
+
* @returns Browser information
|
|
147
185
|
*/
|
|
148
186
|
getBrowserInfo() {
|
|
149
187
|
return {
|
|
@@ -159,8 +197,8 @@ class Telemetry {
|
|
|
159
197
|
}
|
|
160
198
|
/**
|
|
161
199
|
* Track document usage event
|
|
162
|
-
* @param
|
|
163
|
-
* @param
|
|
200
|
+
* @param name - Event name (use TelemetryEventNames for standard events)
|
|
201
|
+
* @param properties - Additional properties
|
|
164
202
|
*/
|
|
165
203
|
async trackUsage(name, properties = {}) {
|
|
166
204
|
if (!this.enabled) return;
|
|
@@ -181,16 +219,17 @@ class Telemetry {
|
|
|
181
219
|
};
|
|
182
220
|
await this.sendDataToTelemetry(event);
|
|
183
221
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
222
|
+
trackStatistic(categoryOrData, legacyData) {
|
|
223
|
+
let data;
|
|
224
|
+
if (typeof categoryOrData === "string") {
|
|
225
|
+
data = { ...legacyData, category: categoryOrData };
|
|
226
|
+
} else {
|
|
227
|
+
data = categoryOrData;
|
|
228
|
+
}
|
|
229
|
+
if (data.category === "node") {
|
|
191
230
|
this.statistics.nodeTypes[data.elementName] = (this.statistics.nodeTypes[data.elementName] || 0) + 1;
|
|
192
231
|
this.fileStructure.totalNodes++;
|
|
193
|
-
} else if (category === "unknown") {
|
|
232
|
+
} else if (data.category === "unknown") {
|
|
194
233
|
const addedElement = this.unknownElements.find((e) => e.elementName === data.elementName);
|
|
195
234
|
if (addedElement) {
|
|
196
235
|
addedElement.count += 1;
|
|
@@ -200,15 +239,16 @@ class Telemetry {
|
|
|
200
239
|
};
|
|
201
240
|
} else {
|
|
202
241
|
this.unknownElements.push({
|
|
203
|
-
|
|
204
|
-
count: 1
|
|
242
|
+
elementName: data.elementName,
|
|
243
|
+
count: 1,
|
|
244
|
+
attributes: data.attributes
|
|
205
245
|
});
|
|
206
246
|
}
|
|
207
|
-
} else if (category === "error") {
|
|
247
|
+
} else if (data.category === "error") {
|
|
208
248
|
this.errors.push(data);
|
|
209
249
|
this.statistics.errorCount++;
|
|
210
250
|
}
|
|
211
|
-
if (data.marks?.length) {
|
|
251
|
+
if (data.category === "node" && data.marks?.length) {
|
|
212
252
|
data.marks.forEach((mark) => {
|
|
213
253
|
this.statistics.markTypes[mark.type] = (this.statistics.markTypes[mark.type] || 0) + 1;
|
|
214
254
|
});
|
|
@@ -237,11 +277,11 @@ class Telemetry {
|
|
|
237
277
|
}
|
|
238
278
|
/**
|
|
239
279
|
* Track file structure
|
|
240
|
-
* @param
|
|
241
|
-
* @param
|
|
242
|
-
* @param
|
|
243
|
-
* @param
|
|
244
|
-
* @param
|
|
280
|
+
* @param structure - File structure information
|
|
281
|
+
* @param fileSource - original file
|
|
282
|
+
* @param documentId - document GUID
|
|
283
|
+
* @param documentIdentifier - document identifier (GUID or hash)
|
|
284
|
+
* @param internalId - document ID from settings.xml
|
|
245
285
|
*/
|
|
246
286
|
async trackFileStructure(structure, fileSource, documentId, documentIdentifier, internalId) {
|
|
247
287
|
this.fileStructure = structure;
|
|
@@ -255,14 +295,14 @@ class Telemetry {
|
|
|
255
295
|
}
|
|
256
296
|
/**
|
|
257
297
|
* Process document metadata
|
|
258
|
-
* @param
|
|
259
|
-
* @param
|
|
260
|
-
* @returns
|
|
298
|
+
* @param file - Document file
|
|
299
|
+
* @param options - Additional options
|
|
300
|
+
* @returns Document metadata
|
|
261
301
|
*/
|
|
262
302
|
async processDocument(file, options = {}) {
|
|
263
303
|
if (!file) {
|
|
264
304
|
console.warn("Telemetry: missing file source");
|
|
265
|
-
return
|
|
305
|
+
return null;
|
|
266
306
|
}
|
|
267
307
|
return {
|
|
268
308
|
guid: options.guid,
|
|
@@ -278,14 +318,12 @@ class Telemetry {
|
|
|
278
318
|
};
|
|
279
319
|
}
|
|
280
320
|
isTelemetryDataChanged() {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (Object.keys(this.statistics.nodeTypes).length <= 1) return;
|
|
284
|
-
return this.statistics !== initialStatistics || initialFileStructure !== this.fileStructure || this.errors.length > 0 || this.unknownElements.length > 0;
|
|
321
|
+
if (Object.keys(this.statistics.nodeTypes).length <= 1) return false;
|
|
322
|
+
return Object.keys(this.statistics.nodeTypes).length > 0 || Object.keys(this.statistics.markTypes).length > 0 || Object.keys(this.statistics.attributes).length > 0 || this.statistics.errorCount > 0 || this.fileStructure.totalFiles > 0 || this.fileStructure.maxDepth > 0 || this.fileStructure.totalNodes > 0 || this.fileStructure.files.length > 0 || this.errors.length > 0 || this.unknownElements.length > 0;
|
|
285
323
|
}
|
|
286
324
|
/**
|
|
287
325
|
* Sends current report
|
|
288
|
-
* @returns
|
|
326
|
+
* @returns Promise that resolves when report is sent
|
|
289
327
|
*/
|
|
290
328
|
async sendReport() {
|
|
291
329
|
if (!this.enabled || !this.isTelemetryDataChanged()) return;
|
|
@@ -295,7 +333,8 @@ class Telemetry {
|
|
|
295
333
|
type: "parsing",
|
|
296
334
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
297
335
|
sessionId: this.sessionId,
|
|
298
|
-
|
|
336
|
+
documentGuid: this.documentGuid,
|
|
337
|
+
documentIdentifier: this.documentIdentifier,
|
|
299
338
|
superdocVersion: this.superdocVersion,
|
|
300
339
|
file: this.documentInfo,
|
|
301
340
|
browser: this.getBrowserInfo(),
|
|
@@ -309,8 +348,8 @@ class Telemetry {
|
|
|
309
348
|
}
|
|
310
349
|
/**
|
|
311
350
|
* Sends data to the service
|
|
312
|
-
* @
|
|
313
|
-
* @returns
|
|
351
|
+
* @param data - Payload to send
|
|
352
|
+
* @returns Promise that resolves when data is sent
|
|
314
353
|
*/
|
|
315
354
|
async sendDataToTelemetry(data) {
|
|
316
355
|
try {
|
|
@@ -333,12 +372,12 @@ class Telemetry {
|
|
|
333
372
|
}
|
|
334
373
|
/**
|
|
335
374
|
* Generate unique identifier
|
|
336
|
-
* @returns
|
|
375
|
+
* @returns Unique ID
|
|
337
376
|
* @private
|
|
338
377
|
*/
|
|
339
378
|
generateId() {
|
|
340
379
|
const timestamp = Date.now();
|
|
341
|
-
const random = randomBytes(4).toString("
|
|
380
|
+
const random = Array.from(randomBytes(4)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
342
381
|
return `${timestamp}-${random}`;
|
|
343
382
|
}
|
|
344
383
|
/**
|
|
@@ -348,8 +387,7 @@ class Telemetry {
|
|
|
348
387
|
this.statistics = {
|
|
349
388
|
nodeTypes: {},
|
|
350
389
|
markTypes: {},
|
|
351
|
-
|
|
352
|
-
unknownElements: [],
|
|
390
|
+
attributes: {},
|
|
353
391
|
errorCount: 0
|
|
354
392
|
};
|
|
355
393
|
this.fileStructure = {
|
|
@@ -362,6 +400,38 @@ class Telemetry {
|
|
|
362
400
|
this.errors = [];
|
|
363
401
|
}
|
|
364
402
|
}
|
|
403
|
+
function hasUser(entry) {
|
|
404
|
+
return entry[1].user !== void 0;
|
|
405
|
+
}
|
|
406
|
+
const awarenessStatesToArray = (context, states) => {
|
|
407
|
+
const seenUsers = /* @__PURE__ */ new Set();
|
|
408
|
+
return Array.from(states.entries()).filter(hasUser).filter(([, value]) => {
|
|
409
|
+
const userEmail = value.user.email;
|
|
410
|
+
if (seenUsers.has(userEmail)) return false;
|
|
411
|
+
seenUsers.add(userEmail);
|
|
412
|
+
return true;
|
|
413
|
+
}).map(([key, value]) => {
|
|
414
|
+
const email = value.user.email;
|
|
415
|
+
let color = context.userColorMap.get(email);
|
|
416
|
+
if (!color) {
|
|
417
|
+
color = context.config.colors[context.colorIndex % context.config.colors.length];
|
|
418
|
+
context.userColorMap.set(email, color);
|
|
419
|
+
context.colorIndex++;
|
|
420
|
+
}
|
|
421
|
+
return {
|
|
422
|
+
clientId: key,
|
|
423
|
+
...value.user,
|
|
424
|
+
color
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
};
|
|
428
|
+
const shuffleArray = (array) => {
|
|
429
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
430
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
431
|
+
[array[i], array[j]] = [array[j], array[i]];
|
|
432
|
+
}
|
|
433
|
+
return array;
|
|
434
|
+
};
|
|
365
435
|
function set(target, key, val) {
|
|
366
436
|
if (Array.isArray(target)) {
|
|
367
437
|
target.length = Math.max(target.length, key);
|
|
@@ -3167,31 +3237,6 @@ class WebsocketProvider extends ObservableV2 {
|
|
|
3167
3237
|
}
|
|
3168
3238
|
}
|
|
3169
3239
|
}
|
|
3170
|
-
const awarenessStatesToArray = (context, states) => {
|
|
3171
|
-
const seenUsers = /* @__PURE__ */ new Set();
|
|
3172
|
-
return Array.from(states.entries()).filter(([, value]) => {
|
|
3173
|
-
if (!value.user) return false;
|
|
3174
|
-
return !seenUsers.has(value.user?.email) && seenUsers.add(value.user?.email);
|
|
3175
|
-
}).map(([key, value]) => {
|
|
3176
|
-
const email = value.user.email;
|
|
3177
|
-
if (!context.userColorMap.has(email)) {
|
|
3178
|
-
context.userColorMap.set(email, context.config.colors[context.colorIndex % context.config.colors.length]);
|
|
3179
|
-
context.colorIndex++;
|
|
3180
|
-
}
|
|
3181
|
-
return {
|
|
3182
|
-
clientId: key,
|
|
3183
|
-
...value.user,
|
|
3184
|
-
color: context.userColorMap.get(email)
|
|
3185
|
-
};
|
|
3186
|
-
});
|
|
3187
|
-
};
|
|
3188
|
-
const shuffleArray = (array) => {
|
|
3189
|
-
for (let i = array.length - 1; i > 0; i--) {
|
|
3190
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
3191
|
-
[array[i], array[j]] = [array[j], array[i]];
|
|
3192
|
-
}
|
|
3193
|
-
return array;
|
|
3194
|
-
};
|
|
3195
3240
|
function awarenessHandler(context, { changes = {}, states }) {
|
|
3196
3241
|
const { added = [], removed = [] } = changes;
|
|
3197
3242
|
const awarenessArray = awarenessStatesToArray(context, states);
|
|
@@ -17173,7 +17218,7 @@ const _sfc_main = {
|
|
|
17173
17218
|
__name: "SuperDoc",
|
|
17174
17219
|
emits: ["selection-update"],
|
|
17175
17220
|
setup(__props, { emit: __emit }) {
|
|
17176
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17221
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DN5OVJ2m.cjs")));
|
|
17177
17222
|
const superdocStore = useSuperdocStore();
|
|
17178
17223
|
const commentsStore = useCommentsStore();
|
|
17179
17224
|
const {
|
|
@@ -17767,7 +17812,7 @@ const _sfc_main = {
|
|
|
17767
17812
|
};
|
|
17768
17813
|
}
|
|
17769
17814
|
};
|
|
17770
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17815
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-29e35f23"]]);
|
|
17771
17816
|
const createSuperdocVueApp = () => {
|
|
17772
17817
|
const app = vue.createApp(App);
|
|
17773
17818
|
const pinia = createPinia();
|
|
@@ -17937,7 +17982,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
17937
17982
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17938
17983
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17939
17984
|
this.colorIndex = 0;
|
|
17940
|
-
this.version = "0.29.0-next.
|
|
17985
|
+
this.version = "0.29.0-next.8";
|
|
17941
17986
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17942
17987
|
this.superdocId = config.superdocId || uuid.v4();
|
|
17943
17988
|
this.colors = this.config.colors;
|