@commentkit/comment-kit 0.6.9 → 0.7.1

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 (73) hide show
  1. package/CHANGELOG.md +63 -4
  2. package/LICENSE +18 -2
  3. package/README.md +133 -88
  4. package/SECURITY.md +48 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +284 -0
  6. package/dist/angular.es.js +25 -12
  7. package/dist/comment-kit.es.js +25 -13
  8. package/dist/demo.es.js +148 -70
  9. package/dist/headless.es.js +3 -3
  10. package/dist/preact.es.js +3 -3
  11. package/dist/qwik.es.js +1 -110
  12. package/dist/qwik.qwik.mjs +114 -0
  13. package/dist/react.es.js +3 -3
  14. package/dist/shared/annotation-icons-Dh-bmNYK.js +172 -0
  15. package/dist/shared/annotation-toolbar-cGC1p-SP.js +1093 -0
  16. package/dist/shared/attachment-refresh-CzQFXHkL.js +94 -0
  17. package/dist/shared/{bridge-DRE03N9X.js → bridge-CJoGYngu.js} +6 -3
  18. package/dist/shared/{button-group-CHfMRXyA.js → button-group-CWdKaOlC.js} +14 -16
  19. package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
  20. package/dist/shared/comment-drawing-canvas-DdXlMgbF.js +124 -0
  21. package/dist/shared/comment-icon-Dg9ZWpz-.js +608 -0
  22. package/dist/shared/comment-image-lightbox-B7iHjnAz.js +190 -0
  23. package/dist/shared/comment-images-content-D7YNUgo5.js +214 -0
  24. package/dist/shared/{comment-kit-core-D0kY00St.js → comment-kit-core-C862uNAm.js} +1371 -853
  25. package/dist/shared/comment-kit-ui-0vd-DY4S.js +19977 -0
  26. package/dist/shared/comment-screenshot-annotator-DcaSSuWB.js +151 -0
  27. package/dist/shared/comment-screenshot-overlay-D_nFoJmM.js +207 -0
  28. package/dist/shared/{dev-export-panel-BLngcr5q.js → dev-export-panel-pWBlhlse.js} +8 -8
  29. package/dist/shared/dev-grab-eQ9EgEGY.js +210 -0
  30. package/dist/shared/dist-De294MVF.js +623 -0
  31. package/dist/shared/{element-selector-CtFzgHvq.js → element-selector-DC-_XJ0k.js} +350 -305
  32. package/dist/shared/{icons-BSHCWYO1.js → icons-nzMOLzrm.js} +2 -3
  33. package/dist/shared/{mount-ui-CVivB_eQ.js → mount-ui-B68j8r6I.js} +4 -4
  34. package/dist/shared/{pusher-BEl7Qn-8.js → pusher-C1FHQGXV.js} +1 -1
  35. package/dist/shared/realtime-Diqz7G_y.js +317 -0
  36. package/dist/shared/realtime-recovery-DJ_adc-H.js +135 -0
  37. package/dist/shared/{separator-DusFNTs-.js → separator-XDBsaWyw.js} +891 -785
  38. package/dist/shared/{shadow-root-CmYXiSRR.js → shadow-root-CrO75sED.js} +1 -1
  39. package/dist/shared/styles-C9Jwvm0Q.js +2 -0
  40. package/dist/shared/useRender-D1z_X_BY.js +5 -0
  41. package/dist/shared/{useValueChanged-DQXLia-2.js → useValueChanged-CrzfD8l-.js} +15 -15
  42. package/dist/shared/{validation-C7QG8j7Z.js → validation-D-8u4M7I.js} +14 -1
  43. package/dist/shared/{websocket-manager-BTRqNTB7.js → websocket-manager-CFak_YHy.js} +148 -89
  44. package/dist/solid.es.js +3 -3
  45. package/dist/svelte.es.js +3 -3
  46. package/dist/types/adapters/bridge.d.ts +9 -12
  47. package/dist/types/angular/index.d.ts +15 -5
  48. package/dist/types/core/api-client.d.ts +24 -18
  49. package/dist/types/core/comment-kit-core.d.ts +28 -11
  50. package/dist/types/core/local-demo.d.ts +1 -0
  51. package/dist/types/core/types.d.ts +103 -0
  52. package/dist/types/core/websocket-manager.d.ts +12 -0
  53. package/dist/types/core/write-access.d.ts +9 -0
  54. package/dist/types/headless.d.ts +1 -1
  55. package/dist/types/index.d.ts +8 -4
  56. package/dist/types/qwik/index.d.ts +4 -1
  57. package/dist/vue.es.js +3 -3
  58. package/docs/api-reference.md +378 -0
  59. package/docs/local-demo.md +60 -0
  60. package/package.json +17 -6
  61. package/dist/shared/annotation-toolbar-pX17NLmJ.js +0 -1104
  62. package/dist/shared/clamp-CcFVX0vC.js +0 -55
  63. package/dist/shared/comment-drawing-canvas-CYu5SwRf.js +0 -126
  64. package/dist/shared/comment-image-lightbox-0VdAs2iT.js +0 -178
  65. package/dist/shared/comment-kit-ui-D2j2gvnm.js +0 -16685
  66. package/dist/shared/comment-screenshot-annotator-BuojwviY.js +0 -137
  67. package/dist/shared/comment-screenshot-overlay-BZX0Vcb8.js +0 -144
  68. package/dist/shared/dev-grab-pDAfH2lr.js +0 -203
  69. package/dist/shared/local-demo-context-BohlYbHt.js +0 -6
  70. package/dist/shared/realtime-BG_t_ze7.js +0 -281
  71. package/dist/shared/resolveAriaLabelledBy-CIKpnjNJ.js +0 -669
  72. package/dist/shared/styles-D_FEJZ9G.js +0 -2
  73. package/dist/shared/useLabelableId-DGbfdMi_.js +0 -155
@@ -1,5 +1,5 @@
1
- import { c as e, i as t, l as n, o as r, s as i, u as a } from "./validation-C7QG8j7Z.js";
2
- import { i as o } from "./comment-kit-core-D0kY00St.js";
1
+ import { c as e, d as t, i as n, l as r, o as i, u as a } from "./validation-D-8u4M7I.js";
2
+ import { i as o } from "./comment-kit-core-C862uNAm.js";
3
3
  var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.getOwnPropertyNames, d = Object.getPrototypeOf, f = Object.prototype.hasOwnProperty, p = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), m = (e, t) => {
4
4
  let n = {};
5
5
  for (var r in e) c(n, r, {
@@ -16,93 +16,131 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
16
16
  }, g = (e, t, n) => (n = e == null ? {} : s(d(e)), h(t || !e || !e.__esModule || !f.call(e, "default") ? c(n, "default", {
17
17
  value: e,
18
18
  enumerable: !0
19
- }) : n, e)), _ = null;
20
- function v() {
21
- return _ ||= import("./pusher-BEl7Qn-8.js").then((e) => /* @__PURE__ */ g(e.default, 1)).then((e) => e.default ?? e), _;
19
+ }) : n, e));
20
+ function _(e, t) {
21
+ let n = { ...e };
22
+ for (let e of t) n[e] === null && delete n[e];
23
+ return n;
22
24
  }
23
- var y = o.ID, b = o.NAME, x = o.EMAIL, S = o.PAGE, C = o.COLOR, w = o.DRAWING_PATH_DATA, T = o.DRAWING_TEXT, E = o.ONLINE_USERS, D = {
25
+ function v(e) {
26
+ return i(e) ? _(e, ["avatar", "organizationId"]) : e;
27
+ }
28
+ function y(e) {
29
+ return i(e) ? _(e, [
30
+ "thumbnail",
31
+ "filename",
32
+ "mimeType"
33
+ ]) : e;
34
+ }
35
+ function b(e) {
36
+ if (!i(e)) return e;
37
+ let t = _(e, ["replyTo"]);
38
+ return t.author = v(t.author), Array.isArray(t.attachments) && (t.attachments = t.attachments.map(y)), t;
39
+ }
40
+ function x(e) {
41
+ if (!i(e)) return e;
42
+ let t = _(e, [
43
+ "description",
44
+ "textSelection",
45
+ "drawingData",
46
+ "environment",
47
+ "branch",
48
+ "deviceInfo",
49
+ "resolvedAt",
50
+ "completedAt"
51
+ ]);
52
+ return t.author = v(t.author), "user" in t && (t.user = v(t.user)), i(t.position) && (t.position = _(t.position, ["element", "xpath"])), i(t.page) && t.page.title === null && (t.page = {
53
+ ...t.page,
54
+ title: ""
55
+ }), Array.isArray(t.assignees) && (t.assignees = t.assignees.map(v)), Array.isArray(t.replies) && (t.replies = t.replies.map(b)), Array.isArray(t.attachments) && (t.attachments = t.attachments.map(y)), t;
56
+ }
57
+ var S = null;
58
+ function C() {
59
+ return S ||= import("./pusher-C1FHQGXV.js").then((e) => /* @__PURE__ */ g(e.default, 1)).then((e) => e.default ?? e), S;
60
+ }
61
+ var w = o.ID, T = o.NAME, E = o.EMAIL, D = o.PAGE, O = o.COLOR, k = o.DRAWING_PATH_DATA, A = o.DRAWING_TEXT, j = o.ONLINE_USERS, M = {
24
62
  id: "unknown",
25
63
  name: "Unknown",
26
64
  email: "unknown@example.invalid"
27
- }, O = /* @__PURE__ */ new Set([
65
+ }, N = /* @__PURE__ */ new Set([
28
66
  "client-cursor_move",
29
67
  "client-cursor_leave",
30
68
  "client-drawing_stroke"
31
- ]), k = /* @__PURE__ */ new Set([
69
+ ]), P = /* @__PURE__ */ new Set([
32
70
  "path",
33
71
  "line",
34
72
  "rectangle",
35
73
  "circle",
36
74
  "text"
37
75
  ]);
38
- function A(e) {
39
- return n(e, y);
76
+ function F(e) {
77
+ return a(e, w);
40
78
  }
41
- function j(t) {
42
- return r(t) ? A(t.id) && n(t.name, b) && a(t.email) && e(t.avatar, S) : !1;
79
+ function I(e) {
80
+ return i(e) ? F(e.id) && a(e.name, T) && t(e.email) && r(e.avatar, D) : !1;
43
81
  }
44
- function M(e) {
45
- return r(e) ? A(e.id) && i(e.content, o.CONTENT) && A(e.userId) && r(e.position) && t(e.position.x) && t(e.position.y) && j(e.author) : !1;
82
+ function L(t) {
83
+ return i(t) ? F(t.id) && e(t.content, o.CONTENT) && F(t.userId) && i(t.position) && n(t.position.x) && n(t.position.y) && I(t.author) : !1;
46
84
  }
47
- function N(e) {
48
- return r(e) ? A(e.id) && i(e.content, o.CONTENT) && j(e.author) : !1;
85
+ function R(t) {
86
+ return i(t) ? F(t.id) && e(t.content, o.CONTENT) && I(t.author) : !1;
49
87
  }
50
- function P(e) {
51
- return r(e) ? t(e.x) && e.x >= 0 && e.x <= 100 && t(e.y) && e.y >= 0 && e.y <= 100 && n(e.page, S) : !1;
88
+ function z(e) {
89
+ return i(e) ? n(e.x) && e.x >= 0 && e.x <= 100 && n(e.y) && e.y >= 0 && e.y <= 100 && a(e.page, D) : !1;
52
90
  }
53
- function F(i) {
54
- return !r(i) || !n(i.type, 20) || !k.has(i.type) || !n(i.stroke, C) || !t(i.strokeWidth) || i.strokeWidth <= 0 || i.strokeWidth > 100 || !n(i.fill, C) ? !1 : e(i.d, w) && e(i.text, T) && (i.x === void 0 || t(i.x)) && (i.y === void 0 || t(i.y)) && (i.width === void 0 || t(i.width)) && (i.height === void 0 || t(i.height));
91
+ function B(e) {
92
+ return !i(e) || !a(e.type, 20) || !P.has(e.type) || !a(e.stroke, O) || !n(e.strokeWidth) || e.strokeWidth <= 0 || e.strokeWidth > 100 || !a(e.fill, O) ? !1 : r(e.d, k) && r(e.text, A) && (e.x === void 0 || n(e.x)) && (e.y === void 0 || n(e.y)) && (e.width === void 0 || n(e.width)) && (e.height === void 0 || n(e.height));
55
93
  }
56
- function I(e) {
94
+ function V(e) {
57
95
  return {
58
- id: e.id.slice(0, y),
59
- name: e.name.slice(0, b),
60
- email: e.email.slice(0, x),
61
- ...e.avatar ? { avatar: e.avatar.slice(0, S) } : {},
62
- ...e.organizationId ? { organizationId: e.organizationId.slice(0, y) } : {}
96
+ id: e.id.slice(0, w),
97
+ name: e.name.slice(0, T),
98
+ email: e.email.slice(0, E),
99
+ ...e.avatar ? { avatar: e.avatar.slice(0, D) } : {},
100
+ ...e.organizationId ? { organizationId: e.organizationId.slice(0, w) } : {}
63
101
  };
64
102
  }
65
- function L(e) {
66
- return n(e, S) ? e : "";
103
+ function H(e) {
104
+ return a(e, D) ? e : "";
67
105
  }
68
- function R(e) {
106
+ function U(e) {
69
107
  let t = e.toLowerCase().replace(/^\[|\]$/g, "");
70
108
  return t === "localhost" || t === "127.0.0.1" || t === "::1";
71
109
  }
72
- function z(e) {
73
- return n(e, 253) && (e === "localhost" || /^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(e));
110
+ function W(e) {
111
+ return a(e, 253) && (e === "localhost" || /^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(e));
74
112
  }
75
- function B() {
76
- return { ...D };
113
+ function G() {
114
+ return { ...M };
77
115
  }
78
- function V(e) {
79
- let t = String(e.projectId).trim();
80
- if (!A(t) || !/^[\w.-]+$/.test(t)) throw Error("Invalid WebSocket projectId");
116
+ function K(e) {
117
+ let n = String(e.projectId).trim();
118
+ if (!F(n) || !/^[\w.-]+$/.test(n)) throw Error("Invalid WebSocket projectId");
81
119
  let r;
82
120
  try {
83
121
  r = new URL(e.authEndpoint);
84
122
  } catch {
85
123
  throw Error("Invalid WebSocket auth endpoint");
86
124
  }
87
- if (r.protocol !== "https:" && !(r.protocol === "http:" && R(r.hostname))) throw Error("Invalid WebSocket auth endpoint");
88
- if (!n(e.key, 256)) throw Error("Invalid WebSocket key");
89
- if (!z(e.wsHost)) throw Error("Invalid WebSocket host");
90
- if (!n(e.apiKey, 512)) throw Error("Invalid WebSocket API key");
91
- if (e.userEmail && !a(e.userEmail)) throw Error("Invalid WebSocket user email");
92
- if (e.userInfo && !j(e.userInfo)) throw Error("Invalid WebSocket user info");
125
+ if (r.protocol !== "https:" && !(r.protocol === "http:" && U(r.hostname))) throw Error("Invalid WebSocket auth endpoint");
126
+ if (!a(e.key, 256)) throw Error("Invalid WebSocket key");
127
+ if (!W(e.wsHost)) throw Error("Invalid WebSocket host");
128
+ if (!a(e.apiKey, 512)) throw Error("Invalid WebSocket API key");
129
+ if (e.userEmail && !t(e.userEmail)) throw Error("Invalid WebSocket user email");
130
+ if (e.userInfo && !I(e.userInfo)) throw Error("Invalid WebSocket user info");
93
131
  return {
94
132
  ...e,
95
- projectId: t,
133
+ projectId: n,
96
134
  authEndpoint: r.toString(),
97
- userInfo: e.userInfo ? I(e.userInfo) : void 0
135
+ userInfo: e.userInfo ? V(e.userInfo) : void 0
98
136
  };
99
137
  }
100
- var H = class e {
138
+ var q = class e {
101
139
  static {
102
140
  this.MAX_LISTENERS_PER_EVENT = 100;
103
141
  }
104
142
  constructor(e) {
105
- this.listeners = /* @__PURE__ */ new Map(), this.pusher = null, this.presenceChannel = null, this.onlineUsers = /* @__PURE__ */ new Map(), this.lastCursorUpdate = 0, this.cursorThrottle = 50, this.reconnectAttempts = 0, this.connecting = null, this.destroyed = !1, this.config = V(e);
143
+ this.listeners = /* @__PURE__ */ new Map(), this.pusher = null, this.presenceChannel = null, this.onlineUsers = /* @__PURE__ */ new Map(), this.lastCursorUpdate = 0, this.cursorThrottle = 50, this.reconnectAttempts = 0, this.connecting = null, this.destroyed = !1, this.authorizationGeneration = 0, this.config = K(e);
106
144
  }
107
145
  on(t, n) {
108
146
  let r = this.listeners.get(t);
@@ -126,7 +164,7 @@ var H = class e {
126
164
  }
127
165
  async openConnection() {
128
166
  if (this.pusher || this.destroyed) return;
129
- let e = await v();
167
+ let e = await C();
130
168
  if (this.destroyed) return;
131
169
  let t = { "X-API-Key": this.config.apiKey };
132
170
  this.config.userEmail && (t["X-User-Email"] = this.config.userEmail), this.pusher = new e(this.config.key, {
@@ -135,9 +173,9 @@ var H = class e {
135
173
  wsPort: this.config.wsPort ?? 443,
136
174
  wssPort: this.config.wsPort ?? 443,
137
175
  forceTLS: this.config.forceTLS ?? !0,
138
- enabledTransports: this.config.forceTLS === !1 ? ["ws", "wss"] : ["wss"],
176
+ enabledTransports: ["ws"],
139
177
  disableStats: !0,
140
- channelAuthorization: {
178
+ channelAuthorization: this.config.authorizeChannel ? { customHandler: this.createChannelAuthorizer(this.config.authorizeChannel) } : {
141
179
  transport: "ajax",
142
180
  endpoint: this.config.authEndpoint,
143
181
  headers: t,
@@ -165,11 +203,27 @@ var H = class e {
165
203
  this.emit("error", /* @__PURE__ */ Error("WebSocket connection failed"));
166
204
  }), this.subscribeToChannel();
167
205
  }
206
+ createChannelAuthorizer(e) {
207
+ return (t, n) => {
208
+ let r = this.authorizationGeneration, i = () => !this.destroyed && r === this.authorizationGeneration && this.pusher?.connection.socket_id === t.socketId;
209
+ Promise.resolve().then(() => e(t.socketId, t.channelName)).then((e) => {
210
+ i() && n(null, e);
211
+ }, (e) => {
212
+ i() && n(e instanceof Error ? e : /* @__PURE__ */ Error("Channel authorization failed"), null);
213
+ });
214
+ };
215
+ }
168
216
  reconnect() {
169
- this.destroyed || (this.pusher ? this.pusher.connect() : this.connect());
217
+ if (this.destroyed) return;
218
+ if (!this.pusher) {
219
+ this.connect();
220
+ return;
221
+ }
222
+ let e = this.pusher;
223
+ this.authorizationGeneration++, this.reconnectAttempts++, this.onlineUsers.clear(), this.emit("presence:update", { users: [] }), e.disconnect(), !this.destroyed && this.pusher === e && e.connect();
170
224
  }
171
225
  disconnect() {
172
- this.presenceChannel &&= (this.pusher?.unsubscribe(`presence-project.${this.config.projectId}`), null), this.pusher &&= (this.pusher.disconnect(), null), this.onlineUsers.clear();
226
+ this.authorizationGeneration++, this.presenceChannel &&= (this.pusher?.unsubscribe(`presence-project.${this.config.projectId}`), null), this.pusher &&= (this.pusher.disconnect(), null), this.onlineUsers.clear();
173
227
  }
174
228
  isConnected() {
175
229
  return this.pusher?.connection.state === "connected";
@@ -182,64 +236,69 @@ var H = class e {
182
236
  let e = `presence-project.${this.config.projectId}`;
183
237
  this.presenceChannel = this.pusher.subscribe(e), this.presenceChannel.bind("pusher:subscription_succeeded", (e) => {
184
238
  this.onlineUsers.clear(), e.each((e) => {
185
- if (this.onlineUsers.size >= E) return;
239
+ if (this.onlineUsers.size >= j) return;
186
240
  let t = this.memberToUser(e);
187
241
  t && this.onlineUsers.set(t.id, t);
188
- }), this.emit("presence:update", { users: this.getOnlineUsers() });
242
+ }), this.emit("presence:update", { users: this.getOnlineUsers() }), this.emit("subscribed", void 0);
189
243
  }), this.presenceChannel.bind("pusher:member_added", (e) => {
190
244
  let t = this.memberToUser(e);
191
245
  if (t) {
192
- if (!this.onlineUsers.has(t.id) && this.onlineUsers.size >= E) return;
246
+ if (!this.onlineUsers.has(t.id) && this.onlineUsers.size >= j) return;
193
247
  this.onlineUsers.set(t.id, t), this.emit("user:joined", t), this.emit("presence:update", { users: this.getOnlineUsers() });
194
248
  }
195
249
  }), this.presenceChannel.bind("pusher:member_removed", (e) => {
196
- if (!A(e.id)) return;
250
+ if (!F(e.id)) return;
197
251
  let t = e.id;
198
252
  this.onlineUsers.delete(t), this.emit("user:left", { userId: t }), this.emit("presence:update", { users: this.getOnlineUsers() });
199
253
  }), this.presenceChannel.bind("pusher:subscription_error", (e) => {
200
254
  console.error("[CommentKit WS] Channel subscription error:", e);
201
- let t = n(e.type, 80) ? e.type : "unknown";
255
+ let t = a(e.type, 80) ? e.type : "unknown";
202
256
  this.emit("error", /* @__PURE__ */ Error(`Channel subscription failed: ${t}`));
203
257
  });
204
258
  let t = (e, t) => {
205
259
  this.presenceChannel?.bind(e, t), this.presenceChannel?.bind(`.${e}`, t);
206
- };
207
- t("comment_created", (e) => {
208
- M(e) && this.emit("comment:created", e);
209
- }), t("comment_updated", (e) => {
210
- M(e) && this.emit("comment:updated", e);
211
- }), t("comment_deleted", (e) => {
260
+ }, n = (e, n) => {
261
+ t(e, (e) => {
262
+ if (r(e, n)) return;
263
+ let t = x(e);
264
+ L(t) && this.emit(n, t);
265
+ });
266
+ }, r = (e, t) => !i(e) || e.refresh !== !0 || !F(e.commentId) ? !1 : (this.emit("comment:refresh", {
267
+ commentId: e.commentId.trim(),
268
+ event: t
269
+ }), !0);
270
+ n("comment_created", "comment:created"), n("comment_updated", "comment:updated"), t("comment_deleted", (e) => {
212
271
  let t = e;
213
- r(t) && A(t.id) && this.emit("comment:deleted", { id: t.id });
214
- }), t("comment_resolved", (e) => {
215
- M(e) && this.emit("comment:resolved", e);
216
- }), t("comment_completed", (e) => {
217
- M(e) && this.emit("comment:completed", e);
218
- }), t("reply_added", (e) => {
272
+ i(t) && F(t.id) && this.emit("comment:deleted", { id: t.id });
273
+ }), n("comment_resolved", "comment:resolved"), n("comment_completed", "comment:completed"), t("reply_added", (e) => {
274
+ if (r(e, "comment:updated")) return;
219
275
  let t = e;
220
- r(t) && A(t.commentId) && N(t.reply) && this.emit("reply:added", {
221
- commentId: t.commentId,
222
- reply: t.reply
223
- });
276
+ if (i(t) && F(t.commentId)) {
277
+ let e = b(t.reply);
278
+ R(e) && this.emit("reply:added", {
279
+ commentId: t.commentId,
280
+ reply: e
281
+ });
282
+ }
224
283
  }), t("reaction_added", (e) => {
225
284
  let t = e;
226
- r(t) && A(t.commentId) && n(t.emoji, 32) && A(t.userId) && this.emit("reaction:added", {
285
+ i(t) && F(t.commentId) && a(t.emoji, 32) && F(t.userId) && this.emit("reaction:added", {
227
286
  commentId: t.commentId,
228
- ...A(t.replyId) ? { replyId: t.replyId } : {},
287
+ ...F(t.replyId) ? { replyId: t.replyId } : {},
229
288
  emoji: t.emoji,
230
289
  userId: t.userId
231
290
  });
232
291
  }), t("reaction_removed", (e) => {
233
292
  let t = e;
234
- r(t) && A(t.commentId) && n(t.emoji, 32) && A(t.userId) && this.emit("reaction:removed", {
293
+ i(t) && F(t.commentId) && a(t.emoji, 32) && F(t.userId) && this.emit("reaction:removed", {
235
294
  commentId: t.commentId,
236
- ...A(t.replyId) ? { replyId: t.replyId } : {},
295
+ ...F(t.replyId) ? { replyId: t.replyId } : {},
237
296
  emoji: t.emoji,
238
297
  userId: t.userId
239
298
  });
240
299
  }), this.presenceChannel.bind("client-cursor_move", (e) => {
241
- if (P(e)) {
242
- let t = e, n = j(t.user) ? t.user : B();
300
+ if (z(e)) {
301
+ let t = v(e.user), n = I(t) ? V(t) : G();
243
302
  this.emit("cursor:move", {
244
303
  ...e,
245
304
  user: n
@@ -247,51 +306,51 @@ var H = class e {
247
306
  }
248
307
  }), this.presenceChannel.bind("client-cursor_leave", (e) => {
249
308
  let t = e;
250
- r(t) && A(t.userId) && this.emit("cursor:leave", { userId: t.userId });
309
+ i(t) && F(t.userId) && this.emit("cursor:leave", { userId: t.userId });
251
310
  }), this.presenceChannel.bind("client-drawing_stroke", (e) => {
252
311
  let t = e;
253
- r(t) && A(t.userId) && F(t.path) && this.emit("drawing:stroke", {
312
+ i(t) && F(t.userId) && B(t.path) && this.emit("drawing:stroke", {
254
313
  userId: t.userId,
255
314
  path: t.path
256
315
  });
257
316
  });
258
317
  }
259
318
  memberToUser(e) {
260
- if (!A(e.id)) return null;
319
+ if (!F(e.id)) return null;
261
320
  let t = e.info;
262
321
  if (!t) return null;
263
- let n = t.email == null || t.email === "" ? `${String(e.id)}@presence.invalid` : t.email, r = {
322
+ let n = t.email == null || t.email === "" ? `${String(e.id)}@presence.invalid` : t.email, r = v({
264
323
  id: String(e.id),
265
324
  name: t.name || "Anonymous",
266
325
  email: n,
267
326
  avatar: t.avatar
268
- };
269
- return j(r) ? I(r) : null;
327
+ });
328
+ return I(r) ? V(r) : null;
270
329
  }
271
330
  sendCursorMove(e, t, n) {
272
331
  if (!Number.isFinite(e) || !Number.isFinite(t)) return;
273
- let r = L(n);
332
+ let r = H(n);
274
333
  if (!r) return;
275
334
  let i = Math.max(0, Math.min(100, e)), a = Math.max(0, Math.min(100, t)), o = Date.now();
276
335
  o - this.lastCursorUpdate < this.cursorThrottle || (this.lastCursorUpdate = o, this.triggerClientEvent("client-cursor_move", {
277
336
  x: i,
278
337
  y: a,
279
338
  page: r,
280
- user: this.config.userInfo || B()
339
+ user: this.config.userInfo || G()
281
340
  }));
282
341
  }
283
342
  sendCursorLeave() {
284
343
  this.triggerClientEvent("client-cursor_leave", { userId: this.config.userInfo?.id || "unknown" });
285
344
  }
286
345
  sendDrawingStroke(e) {
287
- F(e) && this.triggerClientEvent("client-drawing_stroke", {
346
+ B(e) && this.triggerClientEvent("client-drawing_stroke", {
288
347
  userId: this.config.userInfo?.id || "unknown",
289
348
  path: e
290
349
  });
291
350
  }
292
351
  requestPresence() {}
293
352
  triggerClientEvent(e, t) {
294
- if (O.has(e) && this.presenceChannel) try {
353
+ if (N.has(e) && this.presenceChannel) try {
295
354
  this.presenceChannel.trigger(e, t);
296
355
  } catch {}
297
356
  }
@@ -299,4 +358,4 @@ var H = class e {
299
358
  this.destroyed = !0, this.disconnect(), this.listeners.clear();
300
359
  }
301
360
  };
302
- export { p as n, m as r, H as t };
361
+ export { p as a, v as i, x as n, m as o, b as r, q as t };
package/dist/solid.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as e } from "./shared/comment-kit-core-D0kY00St.js";
2
- import { n as t, r as n, t as r } from "./shared/bridge-DRE03N9X.js";
1
+ import { t as e } from "./shared/comment-kit-core-C862uNAm.js";
2
+ import { n as t, r as n, t as r } from "./shared/bridge-CJoGYngu.js";
3
3
  import { n as i, t as a } from "./shared/errors-Bu5ajEmB.js";
4
4
  import { createMemo as o, createSignal as s, onCleanup as c, onMount as l } from "solid-js";
5
5
  function u(u) {
@@ -24,7 +24,7 @@ function u(u) {
24
24
  }
25
25
  }, K = async (e) => {
26
26
  try {
27
- let { mountCommentKitUI: t } = await import("./shared/mount-ui-CVivB_eQ.js").then((e) => e.n);
27
+ let { mountCommentKitUI: t } = await import("./shared/mount-ui-B68j8r6I.js").then((e) => e.n);
28
28
  if (w || x !== e) return;
29
29
  let n = await t(e);
30
30
  if (w || x !== e) {
package/dist/svelte.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as e } from "./shared/comment-kit-core-D0kY00St.js";
2
- import { n as t, r as n, t as r } from "./shared/bridge-DRE03N9X.js";
1
+ import { t as e } from "./shared/comment-kit-core-C862uNAm.js";
2
+ import { n as t, r as n, t as r } from "./shared/bridge-CJoGYngu.js";
3
3
  import { n as i, t as a } from "./shared/errors-Bu5ajEmB.js";
4
4
  import { onDestroy as o } from "svelte";
5
5
  import { derived as s, get as c, writable as l } from "svelte/store";
@@ -23,7 +23,7 @@ function d(o) {
23
23
  } catch {}
24
24
  }, B = async (e) => {
25
25
  try {
26
- let { mountCommentKitUI: t } = await import("./shared/mount-ui-CVivB_eQ.js").then((e) => e.n);
26
+ let { mountCommentKitUI: t } = await import("./shared/mount-ui-B68j8r6I.js").then((e) => e.n);
27
27
  if (I || c(d) !== e) return;
28
28
  let n = await t(e);
29
29
  if (I || c(d) !== e) {
@@ -8,7 +8,7 @@
8
8
  * writable/derived, BehaviorSubject, signals, etc.).
9
9
  */
10
10
  import type { CommentKitCore } from "../core/comment-kit-core";
11
- import type { ApiError, AgentContextExport, AgentContextOptions, Comment, DevGrabBundle, DevGrabOptions, DevGrabResult, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User } from "../core/types";
11
+ import type { ApiError, AgentContextExport, AgentContextOptions, Comment, ReplyOptions, CommentCreateOptions, DevGrabBundle, DevGrabOptions, DevGrabResult, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User } from "../core/types";
12
12
  export interface AdapterMethods {
13
13
  validateInvite: (email: string) => Promise<void>;
14
14
  login: (email: string) => Promise<void>;
@@ -23,24 +23,21 @@ export interface AdapterMethods {
23
23
  toggleShortcutsOverlay: () => void;
24
24
  setPanelView: (view: PanelView) => void;
25
25
  loadMoreComments: () => Promise<void>;
26
+ reloadComments: () => Promise<void>;
27
+ setBranch: (branch: string | null) => Promise<void>;
28
+ reloadProjectContext: () => Promise<void>;
26
29
  getProjectMembers: () => Promise<User[]>;
27
- createComment: (type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
28
- description?: string;
29
- assignees?: User[];
30
- checklist?: TaskChecklistItem[];
31
- files?: File[];
32
- attachmentIds?: Array<string | number>;
33
- }) => Promise<void>;
30
+ createComment: (type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: CommentCreateOptions) => Promise<void>;
34
31
  updateComment: (commentId: string, updates: Partial<Comment>) => Promise<void>;
35
32
  deleteComment: (id: string) => Promise<void>;
36
33
  resolveComment: (id: string) => Promise<void>;
37
34
  unresolveComment: (id: string) => Promise<void>;
38
35
  completeComment: (id: string) => Promise<void>;
39
36
  selectComment: (comment: Comment | null) => void;
40
- addReply: (commentId: string, content: string) => Promise<void>;
41
- updateReply: (commentId: string, replyId: string, content: string) => Promise<void>;
37
+ addReply: (commentId: string, content: string, options?: ReplyOptions) => Promise<void>;
38
+ updateReply: (commentId: string, replyId: string, content: string, options?: ReplyOptions) => Promise<void>;
42
39
  deleteReply: (commentId: string, replyId: string) => Promise<void>;
43
- reactToComment: (commentId: string, emoji: string) => Promise<void>;
40
+ reactToComment: (commentId: string, emoji: string, replyId?: string) => Promise<void>;
44
41
  updateCommentPosition: (commentId: string, x: number, y: number) => Promise<void>;
45
42
  createHighlight: (textSelection: TextSelection, content: string) => Promise<void>;
46
43
  createDrawing: (drawingData: DrawingData, position: Position, content: string) => Promise<void>;
@@ -122,4 +119,4 @@ export declare const STATE_SELECTORS: {
122
119
  readonly activeDrawing: (s: CommentKitState | null) => DrawingData | null;
123
120
  readonly activeScreenshot: (s: CommentKitState | null) => ScreenshotResult | null;
124
121
  };
125
- export type { ApiError, Comment, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, };
122
+ export type { ApiError, Comment, ReplyOptions, CommentCreateOptions, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, };
@@ -67,6 +67,9 @@ export declare class CommentKitService implements OnDestroy {
67
67
  toggleShortcutsOverlay(): void;
68
68
  setPanelView(view: CommentKitState["panelView"]): void;
69
69
  loadMoreComments(): Promise<void>;
70
+ reloadComments(): Promise<void>;
71
+ setBranch(...args: Parameters<AdapterMethods["setBranch"]>): Promise<void>;
72
+ reloadProjectContext(): Promise<void>;
70
73
  getProjectMembers(): Promise<import("./index.ts").User[]>;
71
74
  createComment(...args: Parameters<AdapterMethods["createComment"]>): Promise<void>;
72
75
  updateComment(...args: Parameters<AdapterMethods["updateComment"]>): Promise<void>;
@@ -75,10 +78,10 @@ export declare class CommentKitService implements OnDestroy {
75
78
  unresolveComment(id: string): Promise<void>;
76
79
  completeComment(id: string): Promise<void>;
77
80
  selectComment(...args: Parameters<AdapterMethods["selectComment"]>): void;
78
- addReply(commentId: string, content: string): Promise<void>;
79
- updateReply(commentId: string, replyId: string, content: string): Promise<void>;
81
+ addReply(...args: Parameters<AdapterMethods["addReply"]>): Promise<void>;
82
+ updateReply(...args: Parameters<AdapterMethods["updateReply"]>): Promise<void>;
80
83
  deleteReply(commentId: string, replyId: string): Promise<void>;
81
- reactToComment(commentId: string, emoji: string): Promise<void>;
84
+ reactToComment(...args: Parameters<AdapterMethods["reactToComment"]>): Promise<void>;
82
85
  updateCommentPosition(commentId: string, x: number, y: number): Promise<void>;
83
86
  createHighlight(...args: Parameters<AdapterMethods["createHighlight"]>): Promise<void>;
84
87
  createDrawing(...args: Parameters<AdapterMethods["createDrawing"]>): Promise<void>;
@@ -87,7 +90,7 @@ export declare class CommentKitService implements OnDestroy {
87
90
  captureScreenshot(...args: Parameters<AdapterMethods["captureScreenshot"]>): Promise<import("./index.ts").ScreenshotResult | null>;
88
91
  uploadScreenshot(...args: Parameters<AdapterMethods["uploadScreenshot"]>): Promise<import("./index.ts").Comment | null>;
89
92
  setActiveScreenshot(...args: Parameters<AdapterMethods["setActiveScreenshot"]>): void;
90
- uploadFiles(files: File[]): Promise<string[]>;
93
+ uploadFiles(...args: Parameters<AdapterMethods["uploadFiles"]>): Promise<string[]>;
91
94
  markThreadSeen(threadId: string): void;
92
95
  isThreadNew(threadId: string): boolean;
93
96
  markAllActivitiesRead(): void;
@@ -116,7 +119,14 @@ export declare class CommentKitService implements OnDestroy {
116
119
  destroy(): void;
117
120
  }
118
121
  export declare function createCommentKitService(): CommentKitService;
119
- export declare function provideCommentKit(config: AngularCommentKitConfig): (typeof CommentKitService | {
122
+ export declare function provideCommentKit(config: AngularCommentKitConfig): ({
123
+ provide: typeof CommentKitService;
124
+ useFactory: (options: AngularCommentKitConfig) => CommentKitService;
125
+ deps: InjectionToken<CommentKitConfig>[];
126
+ useValue?: undefined;
127
+ } | {
128
+ useFactory?: undefined;
129
+ deps?: undefined;
120
130
  provide: InjectionToken<CommentKitConfig>;
121
131
  useValue: AngularCommentKitConfig;
122
132
  })[];
@@ -1,14 +1,17 @@
1
- import type { AuthResponse, Comment, CommentEnvironment, DrawingData, InviteValidationResponse, Mention, OtpResponse, OtpVerifyResponse, Position, ResolvedConfig, TaskChecklistItem, TextSelection, User } from "./types";
1
+ import type { AuthResponse, Comment, CommentEnvironment, CommentCreateOptions, CommentDeviceInfo, ProjectContext, ReplyOptions, DrawingData, InviteValidationResponse, Mention, OtpResponse, OtpVerifyResponse, Position, ResolvedConfig, TextSelection, User } from "./types";
2
2
  export declare class ApiClient {
3
3
  private baseUrl;
4
4
  private apiKey;
5
5
  private projectId;
6
+ private channelProjectId;
6
7
  private userEmail;
7
8
  private authToken;
9
+ private authRevision;
8
10
  private environment;
9
11
  private onAuthExpired;
10
12
  constructor(config: ResolvedConfig);
11
- setProject(projectId: string): void;
13
+ /** HTTP routes may use a slug while presence channels always use the project ID. */
14
+ setProject(projectId: string, channelProjectId?: string): void;
12
15
  setUserEmail(email: string | null): void;
13
16
  setAuthToken(token: string | null): void;
14
17
  setEnvironment(environment: CommentEnvironment | null): void;
@@ -20,10 +23,15 @@ export declare class ApiClient {
20
23
  private requestFormData;
21
24
  private requireProjectId;
22
25
  validateApiKey(): Promise<AuthResponse>;
26
+ /** Authorize presence using the current SDK session, never a copied bearer token. */
27
+ authorizeChannel(socketId: string, channelName: string): Promise<{
28
+ auth: string;
29
+ channel_data: string;
30
+ }>;
23
31
  requestOtp(email: string): Promise<OtpResponse>;
24
32
  verifyOtp(email: string, otp: string): Promise<OtpVerifyResponse>;
25
33
  validateInvite(token: string, email: string): Promise<InviteValidationResponse>;
26
- getComments(pagePath?: string, status?: "open" | "resolved" | "all", page?: number, limit?: number, environment?: CommentEnvironment): Promise<{
34
+ getComments(pagePath?: string, status?: "open" | "resolved" | "all", page?: number, limit?: number, environment?: CommentEnvironment, branch?: string | null): Promise<{
27
35
  comments: Comment[];
28
36
  pagination: {
29
37
  total: number;
@@ -32,6 +40,7 @@ export declare class ApiClient {
32
40
  limit: number;
33
41
  };
34
42
  }>;
43
+ getComment(commentId: string): Promise<Comment>;
35
44
  /**
36
45
  * Build an Idempotency-Key header from a client-supplied key. The backend
37
46
  * dedups retried creates/replies on this key, so an offline-queue replay (or
@@ -43,37 +52,30 @@ export declare class ApiClient {
43
52
  url: string;
44
53
  path: string;
45
54
  title: string;
46
- }, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
47
- description?: string;
48
- assignees?: User[];
49
- checklist?: TaskChecklistItem[];
50
- mentions?: Mention[];
51
- /** Link previously uploaded orphan attachment ids. */
52
- attachmentIds?: Array<string | number>;
53
- }, idempotencyKey?: string): Promise<Comment>;
54
- updateComment(commentId: string, updates: Partial<Pick<Comment, "content" | "status" | "priority" | "description" | "assignees" | "checklist" | "textSelection" | "drawingData"> & {
55
+ }, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: CommentCreateOptions, idempotencyKey?: string): Promise<Comment>;
56
+ updateComment(commentId: string, updates: Partial<Pick<Comment, "content" | "status" | "priority" | "description" | "assignees" | "checklist" | "textSelection" | "drawingData" | "mentions"> & {
55
57
  attachmentIds?: Array<string | number>;
56
58
  }>): Promise<Comment>;
57
59
  deleteComment(commentId: string): Promise<void>;
58
- addReply(commentId: string, content: string, idempotencyKey?: string): Promise<Comment["replies"][0]>;
59
- updateReply(commentId: string, replyId: string, content: string): Promise<Comment["replies"][0]>;
60
+ addReply(commentId: string, content: string, idempotencyKey?: string, options?: ReplyOptions): Promise<Comment["replies"][0]>;
61
+ updateReply(commentId: string, replyId: string, content: string, options?: ReplyOptions): Promise<Comment["replies"][0]>;
60
62
  deleteReply(commentId: string, replyId: string): Promise<void>;
61
63
  resolveComment(commentId: string): Promise<Comment>;
62
64
  unresolveComment(commentId: string): Promise<Comment>;
63
65
  markComplete(commentId: string): Promise<Comment>;
64
- addReaction(commentId: string, emoji: string): Promise<void>;
65
- removeReaction(commentId: string, emoji: string): Promise<void>;
66
+ addReaction(commentId: string, emoji: string, replyId?: string): Promise<void>;
67
+ removeReaction(commentId: string, emoji: string, replyId?: string): Promise<void>;
66
68
  updatePosition(commentId: string, position: Position): Promise<Comment>;
67
69
  createHighlight(content: string, textSelection: TextSelection, page: {
68
70
  url: string;
69
71
  path: string;
70
72
  title: string;
71
- }, priority?: "low" | "medium" | "high" | "urgent", idempotencyKey?: string): Promise<Comment>;
73
+ }, priority?: "low" | "medium" | "high" | "urgent", idempotencyKey?: string, options?: CommentCreateOptions): Promise<Comment>;
72
74
  createDrawing(content: string, drawingData: DrawingData, position: Position, page: {
73
75
  url: string;
74
76
  path: string;
75
77
  title: string;
76
- }, idempotencyKey?: string): Promise<Comment>;
78
+ }, idempotencyKey?: string, options?: CommentCreateOptions): Promise<Comment>;
77
79
  private validateFile;
78
80
  /**
79
81
  * Upload a file. Pass `commentId` (and optionally `replyId`) so the backend
@@ -90,6 +92,7 @@ export declare class ApiClient {
90
92
  url: string;
91
93
  thumbnail?: string;
92
94
  filename?: string;
95
+ mimeType?: string;
93
96
  size: number;
94
97
  }>;
95
98
  uploadScreenshot(file: File, metadata: {
@@ -100,11 +103,14 @@ export declare class ApiClient {
100
103
  path: string;
101
104
  title: string;
102
105
  };
106
+ branch?: string;
107
+ deviceInfo?: CommentDeviceInfo;
103
108
  }): Promise<Comment>;
104
109
  uploadFiles(files: File[], options?: {
105
110
  commentId?: string;
106
111
  replyId?: string;
107
112
  }): Promise<string[]>;
113
+ getProjectContext(): Promise<ProjectContext>;
108
114
  getProjectMembers(): Promise<User[]>;
109
115
  }
110
116
  /**