superdoc 2.20.1-next.5 → 2.20.1-next.7

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.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.20.1-next.5",
22
+ superdocVersion: "2.20.1-next.7",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.20.1-next.5",
21
+ superdocVersion: "2.20.1-next.7",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
package/dist/superdoc.cjs CHANGED
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
316
316
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
317
  function getSuperdocVersion() {
318
318
  try {
319
- return "2.20.1-next.5";
319
+ return "2.20.1-next.7";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -8923,6 +8923,11 @@ var useCommentsStore = defineStore("comments", () => {
8923
8923
  }
8924
8924
  superdoc?.activeEditor?.commands?.removeComment({ commentId: "pending" });
8925
8925
  };
8926
+ const getV2CreatedComment = ({ outcome, reconciled, documentId }) => {
8927
+ const createdId = normalizeCommentId(outcome?.createdCommentId);
8928
+ if (!createdId) return reconciled?.added ?? null;
8929
+ return commentsList.value.find((row) => String(row.commentId) === createdId && (documentId == null || String(row.fileId) === String(documentId))) ?? null;
8930
+ };
8926
8931
  /**
8927
8932
  * Add a new comment to the document
8928
8933
  *
@@ -8976,20 +8981,25 @@ var useCommentsStore = defineStore("comments", () => {
8976
8981
  documentId: v2Adapter.documentId,
8977
8982
  items: outcome.items
8978
8983
  });
8984
+ const created = getV2CreatedComment({
8985
+ outcome,
8986
+ reconciled,
8987
+ documentId: v2Adapter.documentId
8988
+ });
8979
8989
  const hadPendingComment = !!pendingComment.value;
8980
8990
  if (hadPendingComment) removePendingComment(superdoc);
8981
- const createdId = reconciled?.added?.commentId ?? null;
8991
+ const createdId = created?.commentId ?? null;
8982
8992
  if (hadPendingComment && createdId) {
8983
8993
  setActiveComment(superdoc, createdId);
8984
8994
  setActiveFloatingCommentInstance(createdId);
8985
8995
  }
8986
8996
  if (broadcastChanges) superdoc.emit("comments-update", {
8987
8997
  type: COMMENT_EVENTS.ADD,
8988
- comment: reconciled?.added?.getValues?.() ?? null
8998
+ comment: created?.getValues?.() ?? null
8989
8999
  });
8990
9000
  return {
8991
9001
  ok: true,
8992
- comment: reconciled?.added ?? null
9002
+ comment: created
8993
9003
  };
8994
9004
  });
8995
9005
  }
@@ -9548,9 +9558,13 @@ var useCommentsStore = defineStore("comments", () => {
9548
9558
  eventType: COMMENT_EVENTS.ADD,
9549
9559
  rejectionFallbackReason: "v2-reply-failed",
9550
9560
  rejectionEventExtras: parent ? { comment: getCommentEventPayload(parent) } : {},
9551
- successEventBuilder: ({ reconciled }) => ({
9561
+ successEventBuilder: ({ outcome, reconciled }) => ({
9552
9562
  type: COMMENT_EVENTS.ADD,
9553
- comment: reconciled?.added?.getValues?.() ?? null
9563
+ comment: getV2CreatedComment({
9564
+ outcome,
9565
+ reconciled,
9566
+ documentId: v2Adapter.documentId
9567
+ })?.getValues?.() ?? null
9554
9568
  })
9555
9569
  });
9556
9570
  };
@@ -46337,7 +46351,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46337
46351
  this.config.colors = shuffleArray(this.config.colors);
46338
46352
  this.userColorMap = /* @__PURE__ */ new Map();
46339
46353
  this.colorIndex = 0;
46340
- this.version = "2.20.1-next.5";
46354
+ this.version = "2.20.1-next.7";
46341
46355
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46342
46356
  this.superdocId = config.superdocId || require_uuid.v4();
46343
46357
  this.colors = this.config.colors ?? [];
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
314
314
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
315
315
  function getSuperdocVersion() {
316
316
  try {
317
- return "2.20.1-next.5";
317
+ return "2.20.1-next.7";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -8921,6 +8921,11 @@ var useCommentsStore = defineStore("comments", () => {
8921
8921
  }
8922
8922
  superdoc?.activeEditor?.commands?.removeComment({ commentId: "pending" });
8923
8923
  };
8924
+ const getV2CreatedComment = ({ outcome, reconciled, documentId }) => {
8925
+ const createdId = normalizeCommentId(outcome?.createdCommentId);
8926
+ if (!createdId) return reconciled?.added ?? null;
8927
+ return commentsList.value.find((row) => String(row.commentId) === createdId && (documentId == null || String(row.fileId) === String(documentId))) ?? null;
8928
+ };
8924
8929
  /**
8925
8930
  * Add a new comment to the document
8926
8931
  *
@@ -8974,20 +8979,25 @@ var useCommentsStore = defineStore("comments", () => {
8974
8979
  documentId: v2Adapter.documentId,
8975
8980
  items: outcome.items
8976
8981
  });
8982
+ const created = getV2CreatedComment({
8983
+ outcome,
8984
+ reconciled,
8985
+ documentId: v2Adapter.documentId
8986
+ });
8977
8987
  const hadPendingComment = !!pendingComment.value;
8978
8988
  if (hadPendingComment) removePendingComment(superdoc);
8979
- const createdId = reconciled?.added?.commentId ?? null;
8989
+ const createdId = created?.commentId ?? null;
8980
8990
  if (hadPendingComment && createdId) {
8981
8991
  setActiveComment(superdoc, createdId);
8982
8992
  setActiveFloatingCommentInstance(createdId);
8983
8993
  }
8984
8994
  if (broadcastChanges) superdoc.emit("comments-update", {
8985
8995
  type: COMMENT_EVENTS.ADD,
8986
- comment: reconciled?.added?.getValues?.() ?? null
8996
+ comment: created?.getValues?.() ?? null
8987
8997
  });
8988
8998
  return {
8989
8999
  ok: true,
8990
- comment: reconciled?.added ?? null
9000
+ comment: created
8991
9001
  };
8992
9002
  });
8993
9003
  }
@@ -9546,9 +9556,13 @@ var useCommentsStore = defineStore("comments", () => {
9546
9556
  eventType: COMMENT_EVENTS.ADD,
9547
9557
  rejectionFallbackReason: "v2-reply-failed",
9548
9558
  rejectionEventExtras: parent ? { comment: getCommentEventPayload(parent) } : {},
9549
- successEventBuilder: ({ reconciled }) => ({
9559
+ successEventBuilder: ({ outcome, reconciled }) => ({
9550
9560
  type: COMMENT_EVENTS.ADD,
9551
- comment: reconciled?.added?.getValues?.() ?? null
9561
+ comment: getV2CreatedComment({
9562
+ outcome,
9563
+ reconciled,
9564
+ documentId: v2Adapter.documentId
9565
+ })?.getValues?.() ?? null
9552
9566
  })
9553
9567
  });
9554
9568
  };
@@ -46266,7 +46280,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46266
46280
  this.config.colors = shuffleArray(this.config.colors);
46267
46281
  this.userColorMap = /* @__PURE__ */ new Map();
46268
46282
  this.colorIndex = 0;
46269
- this.version = "2.20.1-next.5";
46283
+ this.version = "2.20.1-next.7";
46270
46284
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46271
46285
  this.superdocId = config.superdocId || v4();
46272
46286
  this.colors = this.config.colors ?? [];