@commentkit/comment-kit 0.7.1 → 0.7.2
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/CHANGELOG.md +14 -0
- package/README.md +10 -6
- package/SECURITY.md +14 -6
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +5 -5
- package/dist/demo.es.js +35 -34
- package/dist/headless.es.js +3 -3
- package/dist/preact.es.js +2 -2
- package/dist/qwik.qwik.mjs +2 -2
- package/dist/react.es.js +2 -2
- package/dist/shared/{ShadowRootContext-Bv-4aElu.js → ShadowRootContext-CjciYxVN.js} +4 -4
- package/dist/shared/annotation-toolbar-CZI1KVdW.js +1094 -0
- package/dist/shared/{attachment-refresh-CzQFXHkL.js → attachment-refresh-mQw-L7hB.js} +2 -2
- package/dist/shared/{button-group-CWdKaOlC.js → button-group-C285iSkZ.js} +1 -1
- package/dist/shared/capture-privacy-DUROnio5.js +77 -0
- package/dist/shared/{comment-drawing-canvas-DdXlMgbF.js → comment-drawing-canvas-CYFFKgCm.js} +2 -2
- package/dist/shared/{comment-icon-Dg9ZWpz-.js → comment-icon-4SQd3nlz.js} +1 -1
- package/dist/shared/{comment-image-lightbox-B7iHjnAz.js → comment-image-lightbox-DmTNxuqX.js} +5 -5
- package/dist/shared/{comment-images-content-D7YNUgo5.js → comment-images-content-BX4DQ9Ol.js} +3 -3
- package/dist/shared/{comment-kit-core-C862uNAm.js → comment-kit-core-VuIidMeu.js} +786 -703
- package/dist/shared/{comment-kit-ui-0vd-DY4S.js → comment-kit-ui-BjJ1ZLiv.js} +4429 -4620
- package/dist/shared/{comment-screenshot-annotator-DcaSSuWB.js → comment-screenshot-annotator-CMOG1md7.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-D_nFoJmM.js → comment-screenshot-overlay-iWW-V-Iw.js} +113 -118
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
- package/dist/shared/{dev-export-panel-pWBlhlse.js → dev-export-panel-CrRENbMn.js} +3 -4
- package/dist/shared/dev-grab-Ca4MlS2Y.js +196 -0
- package/dist/shared/{element-selector-DC-_XJ0k.js → element-selector-g1bTvdEA.js} +408 -405
- package/dist/shared/{mount-ui-B68j8r6I.js → mount-ui-Dz5QLq4W.js} +121 -106
- package/dist/shared/{pusher-C1FHQGXV.js → pusher-ue0D83de.js} +1 -1
- package/dist/shared/realtime-CieWAnsW.js +321 -0
- package/dist/shared/{realtime-recovery-DJ_adc-H.js → realtime-recovery-BSVMwsXJ.js} +1 -1
- package/dist/shared/request-activity-DQrAUwfA.js +11 -0
- package/dist/shared/{separator-XDBsaWyw.js → separator-aphZiRoJ.js} +1 -1
- package/dist/shared/{shadow-root-CrO75sED.js → shadow-root-Cv1aLuFf.js} +31 -31
- package/dist/shared/{styles-C9Jwvm0Q.js → styles-CnYsLS2f.js} +1 -1
- package/dist/shared/text-B4HHZNaa.js +23 -0
- package/dist/shared/token-session-CPQpt3-u.js +25 -0
- package/dist/shared/{validation-D-8u4M7I.js → validation-3wbbbuX0.js} +14 -2
- package/dist/shared/{websocket-manager-CFak_YHy.js → websocket-manager-BnK55c3U.js} +136 -116
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +3 -1
- package/dist/types/core/comment-kit-core.d.ts +2 -5
- package/dist/types/core/types.d.ts +22 -5
- package/dist/types/core/websocket-manager.d.ts +1 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +19 -4
- package/package.json +1 -1
- package/dist/shared/annotation-toolbar-cGC1p-SP.js +0 -1093
- package/dist/shared/dev-grab-eQ9EgEGY.js +0 -210
- package/dist/shared/realtime-Diqz7G_y.js +0 -317
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.2] - 2026-10-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Apply host redaction markers to element grabs and agent exports, including private descendants and nested shadow roots. Omit form values, embedded documents and sensitive attributes without changing the host DOM.
|
|
13
|
+
- Omit host cookies and referrers from API requests, reject ambiguous endpoint URLs, and stop unexpected redirects without silently replaying redirected writes.
|
|
14
|
+
- Reject executable page-navigation links and external SVG paint resources in untrusted feedback.
|
|
15
|
+
- Handle realtime capacity and service refusals without showing false presence or automatically retrying in a loop. Keep an explicit reconnect action available.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Document production integration requirements and the limits of SDK isolation. Shadow DOM is not a JavaScript security boundary.
|
|
20
|
+
- Allow 312 KB for cumulative first-open gzip to accommodate the reviewed security guards; keep all other package-size and coverage limits unchanged.
|
|
21
|
+
|
|
8
22
|
## [0.7.1] - 2026-10-16
|
|
9
23
|
|
|
10
24
|
### Fixed
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Drop-in SDK for React, Vue, Svelte, Angular, Solid.js, Qwik, Preact, and vanilla
|
|
|
36
36
|
| **Hold-to-Activate** | Configure select mode to be active only while a modifier key is held (`Alt`, `Meta`, `Control`, `Shift`) |
|
|
37
37
|
| **Animation Freeze** | While selecting, all host-page CSS animations, transitions, and Web Animations API tweens pause |
|
|
38
38
|
| **Touch Mode** | Long-press opens the context menu on touch devices |
|
|
39
|
-
| **MCP Companion** | Separate
|
|
39
|
+
| **MCP Companion** | Separate `comment-kit-mcp` package for authenticated, read-only agent access to feedback |
|
|
40
40
|
| **Keyboard Shortcuts** | Full keyboard navigation and tool shortcuts |
|
|
41
41
|
| **Shadow DOM Isolation** | UI is fully isolated from your app's styles |
|
|
42
42
|
| **Environment Scoping** | New comments are tagged to production, staging, preview, or dev |
|
|
@@ -627,7 +627,7 @@ The toolbar's **Element** tool (`E`) lets anyone — stakeholder or developer
|
|
|
627
627
|
|
|
628
628
|
In the same Element-tool composer, a **Grab for agent** button copies the selected element directly to the clipboard — no backend save. ⌘C / Ctrl+C on the hovered element does the same. The clipboard payload includes:
|
|
629
629
|
|
|
630
|
-
- A Markdown summary with tag name, component name (when resolved), source file location (`file:line:col`), component stack,
|
|
630
|
+
- A Markdown summary with tag name, component name (when resolved), source file location (`file:line:col`), component stack, a bounded and redacted structural HTML snapshot, and the page URL.
|
|
631
631
|
- An `image/png` clipboard MIME carrying the rendered element screenshot. Agents that accept image pastes (Claude Desktop, Cursor, Codex) drop both the text and the image in one paste.
|
|
632
632
|
|
|
633
633
|
```ts
|
|
@@ -661,7 +661,7 @@ const prompt = await commentKit.formatAgentContextAsync({ includeResolved: false
|
|
|
661
661
|
|
|
662
662
|
### MCP server
|
|
663
663
|
|
|
664
|
-
The separate `comment-kit-mcp` companion implements `list_comments`, `get_comment`, and `search_comments` for MCP clients. It is
|
|
664
|
+
The separate `comment-kit-mcp` companion implements `list_comments`, `get_comment`, and `search_comments` for MCP clients. It is installed independently from this browser SDK and requires a project key, project slug and authenticated member token. See its [package guide](https://www.npmjs.com/package/comment-kit-mcp) for installation and local stdio configuration.
|
|
665
665
|
|
|
666
666
|
Contributors with access to the private repository can follow the [MCP development guide](https://github.com/commentkit/comment-kit/blob/main/mcp/README.md). Clipboard-based agent handoff works directly from the SDK and does not require this companion.
|
|
667
667
|
|
|
@@ -723,7 +723,7 @@ To disable in production:
|
|
|
723
723
|
|
|
724
724
|
## Privacy & Security
|
|
725
725
|
|
|
726
|
-
CommentKit is designed
|
|
726
|
+
CommentKit is designed for production integration, but it runs with your page's JavaScript privileges. No embedded SDK can guarantee immunity from compromise. Review the [production host hardening guidance](./SECURITY.md#hardening-guidance-for-hosts), pin the reviewed package version, and verify your site's integration before enabling it for customers.
|
|
727
727
|
|
|
728
728
|
| Concern | How CommentKit handles it |
|
|
729
729
|
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -740,6 +740,8 @@ CommentKit is designed to be safe for production use on customer-facing websites
|
|
|
740
740
|
|
|
741
741
|
The retry queue uses project-scoped `localStorage` and binds each mutation to its authenticated user. It can outlive a tab; replay requires the same user to sign in again. Logout and expired sessions clear it. Browser storage is best-effort, and raw file uploads are not persisted for offline replay. Observe offline events to distinguish queued feedback from feedback saved on the server.
|
|
742
742
|
|
|
743
|
+
API requests send explicit SDK authentication headers, omit ambient host cookies and referrers, and reject redirects. Self-hosted integrations must configure the final HTTPS API endpoint directly. Browser project keys are public identifiers; never ship an admin token or a shared authenticated session in your website. All access decisions must remain on the backend.
|
|
744
|
+
|
|
743
745
|
### Backend API contract (SDK ↔ backend-v2)
|
|
744
746
|
|
|
745
747
|
- Base path is `/api` (not `/api/v1`). Default host: `https://api.commentkit.dev/api`.
|
|
@@ -761,7 +763,9 @@ An older API’s missing context route is tolerated during a rolling upgrade, bu
|
|
|
761
763
|
|
|
762
764
|
### Screenshot redaction
|
|
763
765
|
|
|
764
|
-
|
|
766
|
+
Built-in screenshots exclude password, hidden, payment-autocomplete and one-time-code fields. Mark other sensitive regions with `data-commentkit-redact`; the marker also excludes their content from element grabs and DOM context exports, including when an ancestor is selected. DOM exports omit form values, script/template/embedded-document contents, arbitrary data attributes, event handlers, and URL attributes while retaining structural context.
|
|
767
|
+
|
|
768
|
+
A custom `screenshotProvider` is responsible for masking private descendants in its image. These controls do not detect secrets in ordinary text, page URLs, titles, selected text, or files users attach. Keep CommentKit off sensitive routes until their capture and data-sharing behavior has been reviewed.
|
|
765
769
|
|
|
766
770
|
### Backend identity contract
|
|
767
771
|
|
|
@@ -769,7 +773,7 @@ Your realtime channel-auth endpoint must derive user identity from the authentic
|
|
|
769
773
|
|
|
770
774
|
### Host-page XSS
|
|
771
775
|
|
|
772
|
-
The widget runs in the host page's JavaScript context. Shadow DOM isolates **styles**, not JS — an XSS vulnerability on the host page can access the widget's session.
|
|
776
|
+
The widget runs in the host page's JavaScript context. Shadow DOM isolates **styles**, not JS — an XSS vulnerability on the host page can access the widget's session, and a compromised trusted dependency can affect its host. Use a reviewed, pinned release, a strict script CSP, and SRI where applicable to external scripts. Test CSP compatibility in staging: the widget uses inline style elements and attributes, so a nonce-only style policy is not currently a verified integration. Never enable `unsafe-eval` or weaken script policy to fix widget styling.
|
|
773
777
|
|
|
774
778
|
### Reporting vulnerabilities
|
|
775
779
|
|
package/SECURITY.md
CHANGED
|
@@ -39,10 +39,18 @@ Vulnerabilities in the hosted CommentKit backend (`api.commentkit.dev`, the dash
|
|
|
39
39
|
|
|
40
40
|
## Hardening Guidance for Hosts
|
|
41
41
|
|
|
42
|
-
CommentKit
|
|
42
|
+
CommentKit executes with the embedding page's JavaScript privileges. Shadow DOM isolates styles, not JavaScript or data. No in-page SDK, dependency audit, or test suite can guarantee that a customer website cannot be compromised. A compromised SDK release or another script already running on the page could access page data and JavaScript-readable storage. Installing the widget does not give CommentKit access to a host's server filesystem, but the host must still authorize every server request independently.
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
Use these controls before enabling a production integration:
|
|
45
|
+
|
|
46
|
+
1. **Review and pin the release.** Install an exact reviewed version, commit the lockfile, build it with your application, and deploy through your normal review process. Avoid a mutable CDN `latest` URL. Audit the resolved dependency graph and the optional peers you install. SRI applies to supported external script tags; it is not a replacement for checking your application bundle and lockfile.
|
|
47
|
+
2. **Separate public project identity from user authentication.** The browser project API key is visible to visitors. Never embed an admin token, server secret, npm token, or a pre-authenticated user's SDK token in application code. Configure exact allowed origins, verify membership and permissions on the backend, and keep legacy email-only authentication disabled. A hidden launcher, an `enabled` flag, or an origin allowlist alone is not authorization.
|
|
48
|
+
3. **Constrain the network.** Use HTTPS and a canonical API URL with no redirects, embedded credentials, query, or fragment. HTTP is supported only for local loopback development. SDK API fetches omit ambient cookies and the referrer, reject redirects, and use explicit SDK authentication headers. Allow only the required API and realtime hosts in CSP `connect-src`; limit image and font origins to the sources your integration needs. Leave `ui.loadRemoteFonts` off unless explicitly approved.
|
|
49
|
+
4. **Keep script policy strict.** CommentKit does not require `unsafe-eval` or executable user HTML. Test your actual CSP in staging before deployment. The widget uses inline style elements and dynamic style attributes; compatibility with a nonce-only style policy is not established. Do not weaken `script-src` to fix a styling failure. CSP reduces attack paths; it does not make a compromised trusted script harmless.
|
|
50
|
+
5. **Exclude private surfaces.** Avoid mounting on payment, password-reset, medical, financial, or other sensitive workflows unless their data handling has been reviewed. Mark private regions with `data-commentkit-redact`. Built-in capture excludes marked regions and password, hidden, payment-autocomplete, and one-time-code fields. DOM context export also omits form values, scripts/templates/embedded documents, arbitrary data attributes, event handlers, and URL attributes. It retains useful element identifiers and page metadata; it is not a general-purpose secret detector. Page URLs, titles, selections, submitted text, and attachments can still contain personal or confidential information.
|
|
51
|
+
6. **Review custom capture and exports.** A custom `screenshotProvider` receives the host element and is responsible for masking sensitive descendants in its image; the SDK cannot inspect its pixels for secrets. Agent exports are an explicit local clipboard action and may include feedback, authors, page context, and optional source locations. Review the preview before sharing it with an agent or external service. Treat feedback as untrusted data, not agent instructions.
|
|
52
|
+
7. **Limit access and preserve recovery.** Invite only authorized reviewers, use the least permissions they need, review team access, and test logout and revoked access. The session token is tab-scoped but readable by same-origin scripts. The offline retry queue can retain feedback in local storage until replay or logout. Confirm backup, retention, incident response, and rollback procedures with your CommentKit operator.
|
|
53
|
+
|
|
54
|
+
## Verification boundaries
|
|
55
|
+
|
|
56
|
+
Automated tests exercise escaping, unsafe links and SVG paint, API transport settings, private DOM capture, authentication, and lifecycle cleanup. A passing dependency audit means no known advisory was reported for that dependency graph at that time. Neither result is a penetration-test certificate or a guarantee against future vulnerabilities. Revalidate the packed artifact, host integration, backend authorization, and CSP for every release; keep independent security review and incident response in the release process.
|
package/dist/angular.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./shared/comment-kit-core-
|
|
1
|
+
import { t as e } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
2
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 { Inject as o, Injectable as s, InjectionToken as c, Optional as l } from "@angular/core";
|
|
@@ -247,7 +247,7 @@ var v = class {
|
|
|
247
247
|
}
|
|
248
248
|
async mountSharedUI(e, t, n) {
|
|
249
249
|
try {
|
|
250
|
-
let { mountCommentKitUI: n } = await import("./shared/mount-ui-
|
|
250
|
+
let { mountCommentKitUI: n } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
251
251
|
if (this.core !== e || this.lifecycleId !== t) return;
|
|
252
252
|
let r = await n(e);
|
|
253
253
|
if (this.core !== e || this.lifecycleId !== t) {
|
package/dist/comment-kit.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./shared/websocket-manager-
|
|
2
|
-
import { _ as t,
|
|
1
|
+
import { t as e } from "./shared/websocket-manager-BnK55c3U.js";
|
|
2
|
+
import { _ as t, b as n, h as r, l as i, m as a, n as o, t as s, x as c, y as l } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
3
3
|
import { a as u, c as d, d as f, f as p, i as m, l as h, m as g, n as _, o as v, p as y, r as b, s as x, t as S, u as C } from "./shared/dom-Bhf4WFtY.js";
|
|
4
4
|
import "./headless.es.js";
|
|
5
5
|
async function w(e) {
|
|
@@ -8,13 +8,13 @@ async function w(e) {
|
|
|
8
8
|
var T = typeof window < "u", E = class {
|
|
9
9
|
constructor(e) {
|
|
10
10
|
/* v8 ignore start -- isBrowser always true in jsdom */
|
|
11
|
-
this.mountedUI = null, this.destroyed = !1, this.core = new
|
|
11
|
+
this.mountedUI = null, this.destroyed = !1, this.core = new s(e), e.enabled !== !1 && T && this.mount();
|
|
12
12
|
/* v8 ignore stop */
|
|
13
13
|
}
|
|
14
14
|
async mount() {
|
|
15
15
|
let e = this.core;
|
|
16
16
|
try {
|
|
17
|
-
let { mountCommentKitUI: t } = await import("./shared/mount-ui-
|
|
17
|
+
let { mountCommentKitUI: t } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
18
18
|
if (this.destroyed) return;
|
|
19
19
|
let n = await t(e);
|
|
20
20
|
if (this.destroyed) {
|
|
@@ -215,4 +215,4 @@ var T = typeof window < "u", E = class {
|
|
|
215
215
|
/* v8 ignore start */
|
|
216
216
|
T && (window.CommentKit = E, window.CommentKitConfig && !window.CommentKitInstance && (window.CommentKitInstance = new E(window.CommentKitConfig)));
|
|
217
217
|
/* v8 ignore stop */
|
|
218
|
-
export {
|
|
218
|
+
export { t as ApiClient, E as CommentKit, s as CommentKitCore, i as EventEmitter, o as SDK_VERSION, e as WebSocketManager, a as createAgentContext, w as createCommentKitDemo, S as debounce, _ as findElement, r as formatAgentContext, l as formatMention, b as generateId, m as generateSelector, u as generateXPath, v as getCurrentPage, x as getElementBounds, d as getSelectionRange, h as getSelectionText, C as isElementVisible, f as isInteractiveElement, n as parseMentions, p as percentageToViewport, c as stripMentionMarkup, y as throttle, g as viewportToPercentage };
|
package/dist/demo.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as e, r as t } from "./shared/validation-
|
|
2
|
-
import {
|
|
1
|
+
import { o as e, r as t } from "./shared/validation-3wbbbuX0.js";
|
|
2
|
+
import { t as n, v as r } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
3
3
|
var i = 864e5, a = 512e3, o = 50, s = 20, c = "commentkit:demo:", l = {
|
|
4
4
|
id: "local-demo-you",
|
|
5
5
|
name: "You",
|
|
@@ -174,6 +174,7 @@ var S = class {
|
|
|
174
174
|
setEnvironment() {},
|
|
175
175
|
setOnAuthExpired() {},
|
|
176
176
|
validateApiKey: async () => this.unavailable(),
|
|
177
|
+
verifySession: async () => this.unavailable(),
|
|
177
178
|
authorizeChannel: async () => this.unavailable(),
|
|
178
179
|
requestOtp: async () => this.unavailable(),
|
|
179
180
|
verifyOtp: async () => this.unavailable(),
|
|
@@ -243,10 +244,10 @@ var S = class {
|
|
|
243
244
|
r?.replyTo && (i.replyTo = this.quote(e, r.replyTo)), e.replies.push(i), p(e, "open");
|
|
244
245
|
}).replies.find((e) => e.id === i.id);
|
|
245
246
|
},
|
|
246
|
-
updateReply: async (e, t,
|
|
247
|
+
updateReply: async (e, t, n, i) => i?.attachmentIds?.length ? this.unavailable() : this.modify(e, (e) => {
|
|
247
248
|
let a = e.replies.find((e) => e.id === t);
|
|
248
|
-
if (!a) throw new
|
|
249
|
-
a.content =
|
|
249
|
+
if (!a) throw new r("not_found", "This demo reply no longer exists.", 404);
|
|
250
|
+
a.content = n, a.isEdited = !0, i?.mentions !== void 0 && (a.mentions = i.mentions), i?.replyTo && (a.replyTo = this.quote(e, i.replyTo));
|
|
250
251
|
}).replies.find((e) => e.id === t),
|
|
251
252
|
deleteReply: async (e, t) => {
|
|
252
253
|
this.modify(e, (e) => {
|
|
@@ -256,10 +257,10 @@ var S = class {
|
|
|
256
257
|
resolveComment: async (e) => this.modify(e, (e) => p(e, "resolved")),
|
|
257
258
|
unresolveComment: async (e) => this.modify(e, (e) => p(e, "open")),
|
|
258
259
|
markComplete: async (e) => this.modify(e, (e) => p(e, "complete")),
|
|
259
|
-
addReaction: async (e, t,
|
|
260
|
+
addReaction: async (e, t, n) => {
|
|
260
261
|
this.modify(e, (e) => {
|
|
261
|
-
let i =
|
|
262
|
-
if (!i) throw new
|
|
262
|
+
let i = n ? e.replies.find((e) => e.id === n) : e;
|
|
263
|
+
if (!i) throw new r("not_found", "This demo reply no longer exists.", 404);
|
|
263
264
|
i.reactions = [...(i.reactions ?? []).filter((e) => e.emoji !== t), {
|
|
264
265
|
emoji: t,
|
|
265
266
|
count: 1,
|
|
@@ -267,10 +268,10 @@ var S = class {
|
|
|
267
268
|
}];
|
|
268
269
|
});
|
|
269
270
|
},
|
|
270
|
-
removeReaction: async (e, t,
|
|
271
|
+
removeReaction: async (e, t, n) => {
|
|
271
272
|
this.modify(e, (e) => {
|
|
272
|
-
let i =
|
|
273
|
-
if (!i) throw new
|
|
273
|
+
let i = n ? e.replies.find((e) => e.id === n) : e;
|
|
274
|
+
if (!i) throw new r("not_found", "This demo reply no longer exists.", 404);
|
|
274
275
|
i.reactions = (i.reactions ?? []).filter((e) => e.emoji !== t);
|
|
275
276
|
});
|
|
276
277
|
},
|
|
@@ -325,7 +326,7 @@ var S = class {
|
|
|
325
326
|
}
|
|
326
327
|
persist() {
|
|
327
328
|
let e = JSON.stringify(this.data);
|
|
328
|
-
if (e.length > a) throw new
|
|
329
|
+
if (e.length > a) throw new r("demo_full", "This demo is full. Reset it to start again.", 413);
|
|
329
330
|
if (this.storage) try {
|
|
330
331
|
this.storage.setItem(this.storageKey, e), this.lastSerialized = e;
|
|
331
332
|
} catch {
|
|
@@ -390,22 +391,22 @@ var S = class {
|
|
|
390
391
|
this.checkExpiry() && this.reset();
|
|
391
392
|
}
|
|
392
393
|
write(e) {
|
|
393
|
-
if (this.sync(), this.checkExpiry()) throw new
|
|
394
|
+
if (this.sync(), this.checkExpiry()) throw new r("demo_expired", "Your demo has expired. Start a new demo to continue.", 410);
|
|
394
395
|
let t = structuredClone(this.data.comments);
|
|
395
|
-
if (e(t), t.length > o) throw new
|
|
396
|
-
let
|
|
397
|
-
if (
|
|
396
|
+
if (e(t), t.length > o) throw new r("demo_full", "This demo holds up to 50 comments. Reset it to start again.", 413);
|
|
397
|
+
let n = t.map(b);
|
|
398
|
+
if (n.some((e) => !e)) throw new r("invalid_demo_data", "The demo comment is invalid or exceeds its limit.", 400);
|
|
398
399
|
let i = {
|
|
399
400
|
...this.data,
|
|
400
|
-
comments:
|
|
401
|
+
comments: n
|
|
401
402
|
};
|
|
402
|
-
if (JSON.stringify(i).length > a) throw new
|
|
403
|
+
if (JSON.stringify(i).length > a) throw new r("demo_full", "This demo is full. Reset it to start again.", 413);
|
|
403
404
|
this.data = i, this.persist(), this.notify("persist");
|
|
404
405
|
}
|
|
405
406
|
find(e, t) {
|
|
406
|
-
let
|
|
407
|
-
if (!
|
|
408
|
-
return
|
|
407
|
+
let n = e.find((e) => e.id === t);
|
|
408
|
+
if (!n) throw new r("not_found", "This demo comment no longer exists.", 404);
|
|
409
|
+
return n;
|
|
409
410
|
}
|
|
410
411
|
modify(e, t) {
|
|
411
412
|
return this.write((n) => {
|
|
@@ -414,17 +415,17 @@ var S = class {
|
|
|
414
415
|
}), this.getComments().find((t) => t.id === e);
|
|
415
416
|
}
|
|
416
417
|
quote(e, t) {
|
|
417
|
-
let
|
|
418
|
-
if (!
|
|
418
|
+
let n = t.type === "comment" && t.id === e.id ? e : t.type === "reply" ? e.replies.find((e) => e.id === t.id) : void 0;
|
|
419
|
+
if (!n) throw new r("not_found", "The quoted demo comment no longer exists.", 404);
|
|
419
420
|
return {
|
|
420
|
-
id:
|
|
421
|
+
id: n.id,
|
|
421
422
|
type: t.type,
|
|
422
423
|
authorName: l.name,
|
|
423
|
-
body:
|
|
424
|
+
body: n.content
|
|
424
425
|
};
|
|
425
426
|
}
|
|
426
427
|
unavailable() {
|
|
427
|
-
throw new
|
|
428
|
+
throw new r("demo_unavailable", "This action is unavailable in the private browser demo.", 400);
|
|
428
429
|
}
|
|
429
430
|
destroy() {
|
|
430
431
|
this.destroyed = !0, this.timer && clearTimeout(this.timer), this.listeners.clear(), window.removeEventListener("focus", this.onFocus), document.removeEventListener("visibilitychange", this.onFocus), window.removeEventListener("storage", this.onStorage);
|
|
@@ -435,7 +436,7 @@ async function w(e = {}) {
|
|
|
435
436
|
if (C || document.querySelector("[data-commentkit], [data-commentkit-host]")) throw Error("Destroy the existing CommentKit widget before starting a demo");
|
|
436
437
|
let t = new S(e);
|
|
437
438
|
C = !0;
|
|
438
|
-
let
|
|
439
|
+
let r = new n({
|
|
439
440
|
apiKey: "",
|
|
440
441
|
ui: {
|
|
441
442
|
...e.ui,
|
|
@@ -443,26 +444,26 @@ async function w(e = {}) {
|
|
|
443
444
|
}
|
|
444
445
|
}, t), i;
|
|
445
446
|
try {
|
|
446
|
-
let { mountCommentKitUI: e } = await import("./shared/mount-ui-
|
|
447
|
-
i = await e(
|
|
447
|
+
let { mountCommentKitUI: e } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
448
|
+
i = await e(r);
|
|
448
449
|
} catch (e) {
|
|
449
|
-
throw
|
|
450
|
+
throw r.destroy(), C = !1, e;
|
|
450
451
|
}
|
|
451
452
|
let a = !1, o = {
|
|
452
453
|
start() {
|
|
453
|
-
a ||
|
|
454
|
+
a || r.startLocalDemo();
|
|
454
455
|
},
|
|
455
456
|
reset() {
|
|
456
|
-
a || (t.reset(),
|
|
457
|
+
a || (t.reset(), r.startLocalDemo());
|
|
457
458
|
},
|
|
458
459
|
destroy() {
|
|
459
|
-
a || (a = !0, i.unmount(),
|
|
460
|
+
a || (a = !0, i.unmount(), r.destroy(), C = !1);
|
|
460
461
|
},
|
|
461
462
|
getSession() {
|
|
462
463
|
return t.getSession();
|
|
463
464
|
},
|
|
464
465
|
getCore() {
|
|
465
|
-
return
|
|
466
|
+
return r;
|
|
466
467
|
},
|
|
467
468
|
onSessionChange(e) {
|
|
468
469
|
return t.subscribe(() => e(t.getSession()));
|
package/dist/headless.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./shared/websocket-manager-
|
|
2
|
-
import { _ as t,
|
|
1
|
+
import { t as e } from "./shared/websocket-manager-BnK55c3U.js";
|
|
2
|
+
import { _ as t, b as n, h as r, l as i, m as a, n as o, t as s, x as c, y as l } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
3
3
|
import { a as u, c as d, d as f, f as p, i as m, l as h, m as g, n as _, o as v, p as y, r as b, s as x, t as S, u as C } from "./shared/dom-Bhf4WFtY.js";
|
|
4
|
-
export {
|
|
4
|
+
export { t as ApiClient, s as CommentKitCore, i as EventEmitter, o as SDK_VERSION, e as WebSocketManager, a as createAgentContext, S as debounce, _ as findElement, r as formatAgentContext, l as formatMention, b as generateId, m as generateSelector, u as generateXPath, v as getCurrentPage, x as getElementBounds, d as getSelectionRange, h as getSelectionText, C as isElementVisible, f as isInteractiveElement, n as parseMentions, p as percentageToViewport, c as stripMentionMarkup, y as throttle, g as viewportToPercentage };
|
package/dist/preact.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./shared/comment-kit-core-
|
|
1
|
+
import { t as e } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
2
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 { useEffect as o, useMemo as s, useRef as c, useState as l } from "preact/hooks";
|
|
@@ -34,7 +34,7 @@ function u(u) {
|
|
|
34
34
|
}
|
|
35
35
|
}, l = async (e) => {
|
|
36
36
|
try {
|
|
37
|
-
let { mountCommentKitUI: t } = await import("./shared/mount-ui-
|
|
37
|
+
let { mountCommentKitUI: t } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
38
38
|
if (r || d.current !== e) return;
|
|
39
39
|
let n = await t(e);
|
|
40
40
|
if (r || d.current !== e) {
|
package/dist/qwik.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./shared/comment-kit-core-
|
|
1
|
+
import { t as e } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
2
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 { noSerialize as o, useComputed$ as s, useSignal as c, useStore as l, useVisibleTask$ as u } from "@builder.io/qwik";
|
|
@@ -42,7 +42,7 @@ function d(d) {
|
|
|
42
42
|
}
|
|
43
43
|
}, b = async (e) => {
|
|
44
44
|
try {
|
|
45
|
-
let { mountCommentKitUI: t } = await import("./shared/mount-ui-
|
|
45
|
+
let { mountCommentKitUI: t } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
46
46
|
if (u || g.value !== e) return;
|
|
47
47
|
let n = await t(e);
|
|
48
48
|
if (u || g.value !== e) {
|
package/dist/react.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { t as e } from "./shared/comment-kit-core-
|
|
3
|
+
import { t as e } from "./shared/comment-kit-core-VuIidMeu.js";
|
|
4
4
|
import { n as t, r as n, t as r } from "./shared/bridge-CJoGYngu.js";
|
|
5
5
|
import { n as i, t as a } from "./shared/errors-Bu5ajEmB.js";
|
|
6
|
-
import { t as o } from "./shared/mount-ui-
|
|
6
|
+
import { t as o } from "./shared/mount-ui-Dz5QLq4W.js";
|
|
7
7
|
import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
|
|
8
8
|
import { Fragment as p, jsx as m } from "react/jsx-runtime";
|
|
9
9
|
function h(i, o = {}) {
|
|
@@ -5,9 +5,9 @@ process.env.NODE_ENV !== "production" && (r.displayName = "DirectionContext");
|
|
|
5
5
|
function i() {
|
|
6
6
|
return e.useContext(r)?.direction ?? "ltr";
|
|
7
7
|
}
|
|
8
|
-
var a = t(null), o = !1;
|
|
9
|
-
function
|
|
8
|
+
var a = t(null), o = t(!1), s = !1;
|
|
9
|
+
function c() {
|
|
10
10
|
let e = n(a);
|
|
11
|
-
return e === null && !
|
|
11
|
+
return e === null && !s && typeof process < "u" && process.env.NODE_ENV !== "production" && (s = !0, console.warn("[CommentKit] useShadowRoot() returned null — a portal primitive (Popover/Dialog/Select/etc.) is rendering outside <ShadowRootContext.Provider>. Portalled content will fall back to document.body, where ck-* styles are not present.")), e;
|
|
12
12
|
}
|
|
13
|
-
export { i,
|
|
13
|
+
export { i as a, r as i, a as n, c as r, o as t };
|