superdoc 2.28.0-next.11 → 2.28.0-next.12

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/superdoc.cjs CHANGED
@@ -260,7 +260,7 @@ var v_click_outside_default = {
260
260
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
261
261
  function getSuperdocVersion() {
262
262
  try {
263
- return "2.28.0-next.11";
263
+ return "2.28.0-next.12";
264
264
  } catch {
265
265
  return "unknown";
266
266
  }
@@ -5529,13 +5529,22 @@ function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
5529
5529
  reason: "mixed-auth",
5530
5530
  message: "SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."
5531
5531
  };
5532
+ const baseUrlRaw = candidate.baseUrl;
5533
+ const baseUrl = baseUrlRaw === void 0 ? void 0 : normalizeHttpUrl(baseUrlRaw);
5534
+ if (baseUrl === null) return {
5535
+ ok: false,
5536
+ reason: "invalid-base-url",
5537
+ message: "SuperDoc v2 Liveblocks collaboration requires baseUrl to be an absolute http(s) URL."
5538
+ };
5539
+ const baseUrlOption = baseUrl ? { baseUrl } : {};
5532
5540
  if (publicApiKey) return {
5533
5541
  ok: true,
5534
5542
  target: {
5535
5543
  providerFamily: "liveblocks",
5536
5544
  documentId,
5537
5545
  roomMode,
5538
- publicApiKey
5546
+ publicApiKey,
5547
+ ...baseUrlOption
5539
5548
  }
5540
5549
  };
5541
5550
  const authEndpoint = normalizeHttpUrl(authEndpointRaw, authEndpointBaseUrl);
@@ -5550,7 +5559,8 @@ function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
5550
5559
  providerFamily: "liveblocks",
5551
5560
  documentId,
5552
5561
  roomMode,
5553
- authEndpoint
5562
+ authEndpoint,
5563
+ ...baseUrlOption
5554
5564
  }
5555
5565
  };
5556
5566
  }
@@ -21261,8 +21271,11 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21261
21271
  else if (severity === "error") diagnosticCode = "RENDER_ERROR";
21262
21272
  else return null;
21263
21273
  const message = reason || code;
21274
+ const error = new Error(typeof diag.error?.message === "string" ? diag.error.message : message);
21275
+ if (typeof diag.error?.name === "string") error.name = diag.error.name;
21276
+ if (typeof diag.error?.stack === "string") error.stack = diag.error.stack;
21264
21277
  return {
21265
- error: new Error(message),
21278
+ error,
21266
21279
  diagnosticCode,
21267
21280
  diagnosticStage: unusableFurniture ? "parse" : "render",
21268
21281
  severity,
@@ -23463,6 +23476,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23463
23476
  case "collaboration-room-corrupt": return "SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";
23464
23477
  case "collaboration-v2-room-missing": return "SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: \"create\" only when creating a new room.";
23465
23478
  case "collaboration-v2-room-already-exists": return "SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: \"join\" to open it.";
23479
+ case "collaboration-session-invalidated": return "This collaboration session is no longer current. Please reopen the shared document with roomMode: \"join\".";
23466
23480
  case "collaboration-v2-room-initializing": return "The SuperDoc v2 collaboration room has not completed initialization. This open attempt did not modify it.";
23467
23481
  case "collaboration-v2-room-bootstrap-stalled": return "The SuperDoc v2 collaboration room bootstrap appears stalled. This open attempt did not modify it. Preserve the room data if a create retry cannot recover it.";
23468
23482
  case "collaboration-open-intent-invalid": return "SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";
@@ -23473,10 +23487,17 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23473
23487
  const normalizeV2EditorFailureDetail = (detail) => typeof detail === "string" && detail.trim().length > 0 ? detail.trim() : null;
23474
23488
  const onV2EditorFailed = (payload) => {
23475
23489
  documents.value.find((doc) => doc.id === payload?.documentId)?.loadScope?.finish();
23476
- clearActiveV2EditorFacade(payload?.documentId ?? null);
23477
23490
  const reason = typeof payload?.reason === "string" && payload.reason.length > 0 ? payload.reason : "open-failed";
23478
23491
  const detail = normalizeV2EditorFailureDetail(payload?.detail);
23479
23492
  const documentId = typeof payload?.documentId === "string" && payload.documentId.length > 0 ? payload.documentId : null;
23493
+ const retiredDocument = reason === "collaboration-session-invalidated" && documentId ? getDocument(documentId) : null;
23494
+ const retiredExporter = retiredDocument?.getEditor?.();
23495
+ clearActiveV2EditorFacade(payload?.documentId ?? null);
23496
+ if (retiredExporter?.editorVersion === 2 && typeof retiredExporter.exportDocx === "function") {
23497
+ retiredDocument.isReady = false;
23498
+ if (v2Runtimes.has(documentId)) clearV2RuntimeRegistration(documentId);
23499
+ retiredDocument.setEditor?.(retiredExporter);
23500
+ }
23480
23501
  if (reason === "worker-transport-failed") {
23481
23502
  proxy.$superdoc.emit("exception", {
23482
23503
  error: /* @__PURE__ */ new Error("Worker transport failed."),
@@ -23503,7 +23524,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23503
23524
  ...workerFailure ? { workerFailure } : {},
23504
23525
  reason
23505
23526
  };
23506
- if (reason === "collaboration-v1-config-unsupported" || reason === "collaboration-room-format-unsupported" || reason === "collaboration-room-format-conflict" || reason === "collaboration-room-corrupt" || reason === "collaboration-v2-room-missing" || reason === "collaboration-v2-room-already-exists" || reason === "collaboration-v2-room-initializing" || reason === "collaboration-v2-room-bootstrap-stalled" || reason === "collaboration-open-intent-invalid" || reason === "collaboration-config-invalid") console.warn(`[SuperDoc] ${message}`, logContext);
23527
+ if (reason === "collaboration-v1-config-unsupported" || reason === "collaboration-room-format-unsupported" || reason === "collaboration-room-format-conflict" || reason === "collaboration-room-corrupt" || reason === "collaboration-v2-room-missing" || reason === "collaboration-v2-room-already-exists" || reason === "collaboration-session-invalidated" || reason === "collaboration-v2-room-initializing" || reason === "collaboration-v2-room-bootstrap-stalled" || reason === "collaboration-open-intent-invalid" || reason === "collaboration-config-invalid") console.warn(`[SuperDoc] ${message}`, logContext);
23507
23528
  else console.error(`[SuperDoc] ${message}`, logContext);
23508
23529
  proxy.$superdoc.emit("exception", collaborationException && reason !== "collaboration-config-invalid" ? collaborationException : {
23509
23530
  error: new Error(message),
@@ -24734,7 +24755,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
24734
24755
  ], 46, _hoisted_1$17);
24735
24756
  };
24736
24757
  }
24737
- }, [["__scopeId", "data-v-f2db957f"]]);
24758
+ }, [["__scopeId", "data-v-3ac816de"]]);
24738
24759
  //#endregion
24739
24760
  //#region src/core/create-app.js
24740
24761
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46466,7 +46487,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46466
46487
  }
46467
46488
  this.userColorMap = /* @__PURE__ */ new Map();
46468
46489
  this.colorIndex = 0;
46469
- this.version = "2.28.0-next.11";
46490
+ this.version = "2.28.0-next.12";
46470
46491
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46471
46492
  this.superdocId = config.superdocId || require_uuid.v4();
46472
46493
  this.colors = this.config.colors ?? [];
@@ -47173,7 +47194,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
47173
47194
  roomMode: target.roomMode,
47174
47195
  ...syncTimeoutOption,
47175
47196
  ...target.publicApiKey ? { publicApiKey: target.publicApiKey } : {},
47176
- ...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {}
47197
+ ...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {},
47198
+ ...target.baseUrl ? { baseUrl: target.baseUrl } : {}
47177
47199
  };
47178
47200
  if (target.providerFamily === "hocuspocus") return {
47179
47201
  providerType: "hocuspocus",
@@ -258,7 +258,7 @@ var v_click_outside_default = {
258
258
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
259
259
  function getSuperdocVersion() {
260
260
  try {
261
- return "2.28.0-next.11";
261
+ return "2.28.0-next.12";
262
262
  } catch {
263
263
  return "unknown";
264
264
  }
@@ -5527,13 +5527,22 @@ function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
5527
5527
  reason: "mixed-auth",
5528
5528
  message: "SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."
5529
5529
  };
5530
+ const baseUrlRaw = candidate.baseUrl;
5531
+ const baseUrl = baseUrlRaw === void 0 ? void 0 : normalizeHttpUrl(baseUrlRaw);
5532
+ if (baseUrl === null) return {
5533
+ ok: false,
5534
+ reason: "invalid-base-url",
5535
+ message: "SuperDoc v2 Liveblocks collaboration requires baseUrl to be an absolute http(s) URL."
5536
+ };
5537
+ const baseUrlOption = baseUrl ? { baseUrl } : {};
5530
5538
  if (publicApiKey) return {
5531
5539
  ok: true,
5532
5540
  target: {
5533
5541
  providerFamily: "liveblocks",
5534
5542
  documentId,
5535
5543
  roomMode,
5536
- publicApiKey
5544
+ publicApiKey,
5545
+ ...baseUrlOption
5537
5546
  }
5538
5547
  };
5539
5548
  const authEndpoint = normalizeHttpUrl(authEndpointRaw, authEndpointBaseUrl);
@@ -5548,7 +5557,8 @@ function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
5548
5557
  providerFamily: "liveblocks",
5549
5558
  documentId,
5550
5559
  roomMode,
5551
- authEndpoint
5560
+ authEndpoint,
5561
+ ...baseUrlOption
5552
5562
  }
5553
5563
  };
5554
5564
  }
@@ -21229,8 +21239,11 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21229
21239
  else if (severity === "error") diagnosticCode = "RENDER_ERROR";
21230
21240
  else return null;
21231
21241
  const message = reason || code;
21242
+ const error = new Error(typeof diag.error?.message === "string" ? diag.error.message : message);
21243
+ if (typeof diag.error?.name === "string") error.name = diag.error.name;
21244
+ if (typeof diag.error?.stack === "string") error.stack = diag.error.stack;
21232
21245
  return {
21233
- error: new Error(message),
21246
+ error,
21234
21247
  diagnosticCode,
21235
21248
  diagnosticStage: unusableFurniture ? "parse" : "render",
21236
21249
  severity,
@@ -23423,6 +23436,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23423
23436
  case "collaboration-room-corrupt": return "SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";
23424
23437
  case "collaboration-v2-room-missing": return "SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: \"create\" only when creating a new room.";
23425
23438
  case "collaboration-v2-room-already-exists": return "SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: \"join\" to open it.";
23439
+ case "collaboration-session-invalidated": return "This collaboration session is no longer current. Please reopen the shared document with roomMode: \"join\".";
23426
23440
  case "collaboration-v2-room-initializing": return "The SuperDoc v2 collaboration room has not completed initialization. This open attempt did not modify it.";
23427
23441
  case "collaboration-v2-room-bootstrap-stalled": return "The SuperDoc v2 collaboration room bootstrap appears stalled. This open attempt did not modify it. Preserve the room data if a create retry cannot recover it.";
23428
23442
  case "collaboration-open-intent-invalid": return "SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";
@@ -23433,10 +23447,17 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23433
23447
  const normalizeV2EditorFailureDetail = (detail) => typeof detail === "string" && detail.trim().length > 0 ? detail.trim() : null;
23434
23448
  const onV2EditorFailed = (payload) => {
23435
23449
  documents.value.find((doc) => doc.id === payload?.documentId)?.loadScope?.finish();
23436
- clearActiveV2EditorFacade(payload?.documentId ?? null);
23437
23450
  const reason = typeof payload?.reason === "string" && payload.reason.length > 0 ? payload.reason : "open-failed";
23438
23451
  const detail = normalizeV2EditorFailureDetail(payload?.detail);
23439
23452
  const documentId = typeof payload?.documentId === "string" && payload.documentId.length > 0 ? payload.documentId : null;
23453
+ const retiredDocument = reason === "collaboration-session-invalidated" && documentId ? getDocument(documentId) : null;
23454
+ const retiredExporter = retiredDocument?.getEditor?.();
23455
+ clearActiveV2EditorFacade(payload?.documentId ?? null);
23456
+ if (retiredExporter?.editorVersion === 2 && typeof retiredExporter.exportDocx === "function") {
23457
+ retiredDocument.isReady = false;
23458
+ if (v2Runtimes.has(documentId)) clearV2RuntimeRegistration(documentId);
23459
+ retiredDocument.setEditor?.(retiredExporter);
23460
+ }
23440
23461
  if (reason === "worker-transport-failed") {
23441
23462
  proxy.$superdoc.emit("exception", {
23442
23463
  error: /* @__PURE__ */ new Error("Worker transport failed."),
@@ -23463,7 +23484,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23463
23484
  ...workerFailure ? { workerFailure } : {},
23464
23485
  reason
23465
23486
  };
23466
- if (reason === "collaboration-v1-config-unsupported" || reason === "collaboration-room-format-unsupported" || reason === "collaboration-room-format-conflict" || reason === "collaboration-room-corrupt" || reason === "collaboration-v2-room-missing" || reason === "collaboration-v2-room-already-exists" || reason === "collaboration-v2-room-initializing" || reason === "collaboration-v2-room-bootstrap-stalled" || reason === "collaboration-open-intent-invalid" || reason === "collaboration-config-invalid") console.warn(`[SuperDoc] ${message}`, logContext);
23487
+ if (reason === "collaboration-v1-config-unsupported" || reason === "collaboration-room-format-unsupported" || reason === "collaboration-room-format-conflict" || reason === "collaboration-room-corrupt" || reason === "collaboration-v2-room-missing" || reason === "collaboration-v2-room-already-exists" || reason === "collaboration-session-invalidated" || reason === "collaboration-v2-room-initializing" || reason === "collaboration-v2-room-bootstrap-stalled" || reason === "collaboration-open-intent-invalid" || reason === "collaboration-config-invalid") console.warn(`[SuperDoc] ${message}`, logContext);
23467
23488
  else console.error(`[SuperDoc] ${message}`, logContext);
23468
23489
  proxy.$superdoc.emit("exception", collaborationException && reason !== "collaboration-config-invalid" ? collaborationException : {
23469
23490
  error: new Error(message),
@@ -24694,7 +24715,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
24694
24715
  ], 46, _hoisted_1$17);
24695
24716
  };
24696
24717
  }
24697
- }, [["__scopeId", "data-v-f2db957f"]]);
24718
+ }, [["__scopeId", "data-v-3ac816de"]]);
24698
24719
  //#endregion
24699
24720
  //#region src/core/create-app.js
24700
24721
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46394,7 +46415,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46394
46415
  }
46395
46416
  this.userColorMap = /* @__PURE__ */ new Map();
46396
46417
  this.colorIndex = 0;
46397
- this.version = "2.28.0-next.11";
46418
+ this.version = "2.28.0-next.12";
46398
46419
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46399
46420
  this.superdocId = config.superdocId || v4();
46400
46421
  this.colors = this.config.colors ?? [];
@@ -47101,7 +47122,8 @@ var SuperDoc = class extends import_eventemitter3.default {
47101
47122
  roomMode: target.roomMode,
47102
47123
  ...syncTimeoutOption,
47103
47124
  ...target.publicApiKey ? { publicApiKey: target.publicApiKey } : {},
47104
- ...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {}
47125
+ ...target.authEndpoint ? { authEndpoint: target.authEndpoint } : {},
47126
+ ...target.baseUrl ? { baseUrl: target.baseUrl } : {}
47105
47127
  };
47106
47128
  if (target.providerFamily === "hocuspocus") return {
47107
47129
  providerType: "hocuspocus",