@commentkit/comment-kit 0.7.0 → 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 +41 -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 +36 -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-mQw-L7hB.js +94 -0
- package/dist/shared/{button-group-Cl9CrvvU.js → button-group-C285iSkZ.js} +14 -16
- package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
- package/dist/shared/capture-privacy-DUROnio5.js +77 -0
- package/dist/shared/{comment-drawing-canvas-Dzb5YoFw.js → comment-drawing-canvas-CYFFKgCm.js} +2 -2
- package/dist/shared/{comment-utils-BycYTSxA.js → comment-icon-4SQd3nlz.js} +30 -24
- package/dist/shared/comment-image-lightbox-DmTNxuqX.js +190 -0
- package/dist/shared/comment-images-content-BX4DQ9Ol.js +214 -0
- package/dist/shared/{comment-kit-core-BaSuMzp9.js → comment-kit-core-VuIidMeu.js} +1096 -793
- package/dist/shared/{comment-kit-ui-CzfdAZs2.js → comment-kit-ui-BjJ1ZLiv.js} +6091 -6486
- package/dist/shared/{comment-screenshot-annotator-C7X-_bm6.js → comment-screenshot-annotator-CMOG1md7.js} +5 -5
- package/dist/shared/{comment-screenshot-overlay-wIrZrcRy.js → comment-screenshot-overlay-iWW-V-Iw.js} +114 -118
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
- package/dist/shared/{dev-export-panel-FwFVdady.js → dev-export-panel-CrRENbMn.js} +9 -10
- package/dist/shared/dev-grab-Ca4MlS2Y.js +196 -0
- package/dist/shared/{element-selector-BhJm-NSs.js → element-selector-g1bTvdEA.js} +450 -408
- package/dist/shared/{mount-ui--ijs8pWT.js → mount-ui-Dz5QLq4W.js} +121 -106
- package/dist/shared/{pusher-ipHMJnO_.js → pusher-ue0D83de.js} +1 -1
- package/dist/shared/realtime-CieWAnsW.js +321 -0
- package/dist/shared/realtime-recovery-BSVMwsXJ.js +135 -0
- 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-C5v-T8lQ.js → shadow-root-Cv1aLuFf.js} +31 -31
- package/dist/shared/{styles-D3yMtaec.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/useRender-D1z_X_BY.js +5 -0
- package/dist/shared/{validation-C7QG8j7Z.js → validation-3wbbbuX0.js} +26 -1
- package/dist/shared/websocket-manager-BnK55c3U.js +381 -0
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +11 -2
- package/dist/types/core/comment-kit-core.d.ts +11 -5
- package/dist/types/core/types.d.ts +54 -2
- package/dist/types/core/websocket-manager.d.ts +13 -0
- package/dist/types/core/write-access.d.ts +9 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +25 -4
- package/package.json +3 -2
- package/dist/shared/annotation-toolbar-B9SxYqoF.js +0 -1093
- package/dist/shared/comment-image-lightbox-BPYJT1sB.js +0 -183
- package/dist/shared/dev-grab-DDqg0LQf.js +0 -203
- package/dist/shared/realtime-Dk41VwKg.js +0 -302
- package/dist/shared/websocket-manager-DhLWh3Jr.js +0 -302
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ 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
|
+
|
|
22
|
+
## [0.7.1] - 2026-10-16
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Restore secure realtime WebSocket connections and authorize presence using the current SDK session. Keep numeric channel identities separate from project URL slugs, and discard authorization responses after reconnecting, switching accounts, or disconnecting.
|
|
27
|
+
- Normalize nullable author fields from Laravel broadcasts and retry failed channel authorization without duplicating subscriptions.
|
|
28
|
+
- Fetch oversized comment and reply updates through the authenticated API when the backend sends a compact refresh event. Reconcile missed changes after authorized resubscription while retaining loaded pages, filters, the selected thread and drafts; ignore stale reads and retry transient failures within a bounded window.
|
|
29
|
+
- Match current-page comments to query-string URLs, keeping the panel and page markers consistent during SPA navigation.
|
|
30
|
+
- Clear text-selection tools when their live DOM range collapses after host content is removed.
|
|
31
|
+
- Let an open widget popup handle Escape before closing the underlying comments panel.
|
|
32
|
+
- Preserve the configured deployment branch for new feedback independently of the branch being viewed, including highlight, drawing, screenshot and offline creation.
|
|
33
|
+
- Restore the production toolbar and pins after submitting a comment, while preserving deliberate visibility changes and cancellation. Hide saved highlight targets during placement so they cannot intercept new pins on the same text.
|
|
34
|
+
- Capture pages using OKLCH, Display P3 and other modern CSS colors by normalizing only the temporary screenshot clone. Keep the converter lazy, preserve redaction, and leave the host page unchanged.
|
|
35
|
+
- Save Element-tool attachments and device context through the shared composer flow. Retain failed drafts for retry and prevent canceled uploads from creating feedback afterward.
|
|
36
|
+
- Confirm comment and reply saves using their own operation results. Concurrent realtime comments cannot clear a rejected draft, and another reply being removed cannot make a successful reply appear to fail.
|
|
37
|
+
- Include full thread, attachment, annotation and deployment context in agent handoffs. Identify incomplete loaded snapshots and treat feedback as untrusted data; do not resolve another page's element against the current document.
|
|
38
|
+
- Preserve a reader's scroll position when new replies arrive while they are reading older messages.
|
|
39
|
+
- Expose authorized reply deletion with confirmation and keep parent and reply identifiers separate.
|
|
40
|
+
- Apply backend read-only capabilities to comment mutations, uploads and offline replay. Distinguish an expired plan from project settings and individual storage or tool limits.
|
|
41
|
+
- Keep a visible sign-in action for read-only projects, so members can still authenticate to read and export feedback. Resume retained offline edits when write access returns.
|
|
42
|
+
- Explain that panel search and filters cover loaded comments, and keep pagination available when a search has no matches yet.
|
|
43
|
+
- Refresh expired private attachment links without discarding loaded pages, the open lightbox or local drafts. Replace broken documentation links with the hosted developer guide and terms.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Enforce the existing statement, branch, function, and line coverage targets in CI and the npm publication checks. Expand lifecycle, offline, tool, authentication, and browser workflow regressions without reducing coverage scope or thresholds.
|
|
48
|
+
|
|
8
49
|
## [0.7.0] - 2026-10-16
|
|
9
50
|
|
|
10
51
|
### Added
|
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 {
|
|
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,8 @@ var S = class {
|
|
|
174
174
|
setEnvironment() {},
|
|
175
175
|
setOnAuthExpired() {},
|
|
176
176
|
validateApiKey: async () => this.unavailable(),
|
|
177
|
+
verifySession: async () => this.unavailable(),
|
|
178
|
+
authorizeChannel: async () => this.unavailable(),
|
|
177
179
|
requestOtp: async () => this.unavailable(),
|
|
178
180
|
verifyOtp: async () => this.unavailable(),
|
|
179
181
|
validateInvite: async () => this.unavailable(),
|
|
@@ -242,10 +244,10 @@ var S = class {
|
|
|
242
244
|
r?.replyTo && (i.replyTo = this.quote(e, r.replyTo)), e.replies.push(i), p(e, "open");
|
|
243
245
|
}).replies.find((e) => e.id === i.id);
|
|
244
246
|
},
|
|
245
|
-
updateReply: async (e, t,
|
|
247
|
+
updateReply: async (e, t, n, i) => i?.attachmentIds?.length ? this.unavailable() : this.modify(e, (e) => {
|
|
246
248
|
let a = e.replies.find((e) => e.id === t);
|
|
247
|
-
if (!a) throw new
|
|
248
|
-
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));
|
|
249
251
|
}).replies.find((e) => e.id === t),
|
|
250
252
|
deleteReply: async (e, t) => {
|
|
251
253
|
this.modify(e, (e) => {
|
|
@@ -255,10 +257,10 @@ var S = class {
|
|
|
255
257
|
resolveComment: async (e) => this.modify(e, (e) => p(e, "resolved")),
|
|
256
258
|
unresolveComment: async (e) => this.modify(e, (e) => p(e, "open")),
|
|
257
259
|
markComplete: async (e) => this.modify(e, (e) => p(e, "complete")),
|
|
258
|
-
addReaction: async (e, t,
|
|
260
|
+
addReaction: async (e, t, n) => {
|
|
259
261
|
this.modify(e, (e) => {
|
|
260
|
-
let i =
|
|
261
|
-
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);
|
|
262
264
|
i.reactions = [...(i.reactions ?? []).filter((e) => e.emoji !== t), {
|
|
263
265
|
emoji: t,
|
|
264
266
|
count: 1,
|
|
@@ -266,10 +268,10 @@ var S = class {
|
|
|
266
268
|
}];
|
|
267
269
|
});
|
|
268
270
|
},
|
|
269
|
-
removeReaction: async (e, t,
|
|
271
|
+
removeReaction: async (e, t, n) => {
|
|
270
272
|
this.modify(e, (e) => {
|
|
271
|
-
let i =
|
|
272
|
-
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);
|
|
273
275
|
i.reactions = (i.reactions ?? []).filter((e) => e.emoji !== t);
|
|
274
276
|
});
|
|
275
277
|
},
|
|
@@ -324,7 +326,7 @@ var S = class {
|
|
|
324
326
|
}
|
|
325
327
|
persist() {
|
|
326
328
|
let e = JSON.stringify(this.data);
|
|
327
|
-
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);
|
|
328
330
|
if (this.storage) try {
|
|
329
331
|
this.storage.setItem(this.storageKey, e), this.lastSerialized = e;
|
|
330
332
|
} catch {
|
|
@@ -389,22 +391,22 @@ var S = class {
|
|
|
389
391
|
this.checkExpiry() && this.reset();
|
|
390
392
|
}
|
|
391
393
|
write(e) {
|
|
392
|
-
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);
|
|
393
395
|
let t = structuredClone(this.data.comments);
|
|
394
|
-
if (e(t), t.length > o) throw new
|
|
395
|
-
let
|
|
396
|
-
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);
|
|
397
399
|
let i = {
|
|
398
400
|
...this.data,
|
|
399
|
-
comments:
|
|
401
|
+
comments: n
|
|
400
402
|
};
|
|
401
|
-
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);
|
|
402
404
|
this.data = i, this.persist(), this.notify("persist");
|
|
403
405
|
}
|
|
404
406
|
find(e, t) {
|
|
405
|
-
let
|
|
406
|
-
if (!
|
|
407
|
-
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;
|
|
408
410
|
}
|
|
409
411
|
modify(e, t) {
|
|
410
412
|
return this.write((n) => {
|
|
@@ -413,17 +415,17 @@ var S = class {
|
|
|
413
415
|
}), this.getComments().find((t) => t.id === e);
|
|
414
416
|
}
|
|
415
417
|
quote(e, t) {
|
|
416
|
-
let
|
|
417
|
-
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);
|
|
418
420
|
return {
|
|
419
|
-
id:
|
|
421
|
+
id: n.id,
|
|
420
422
|
type: t.type,
|
|
421
423
|
authorName: l.name,
|
|
422
|
-
body:
|
|
424
|
+
body: n.content
|
|
423
425
|
};
|
|
424
426
|
}
|
|
425
427
|
unavailable() {
|
|
426
|
-
throw new
|
|
428
|
+
throw new r("demo_unavailable", "This action is unavailable in the private browser demo.", 400);
|
|
427
429
|
}
|
|
428
430
|
destroy() {
|
|
429
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);
|
|
@@ -434,7 +436,7 @@ async function w(e = {}) {
|
|
|
434
436
|
if (C || document.querySelector("[data-commentkit], [data-commentkit-host]")) throw Error("Destroy the existing CommentKit widget before starting a demo");
|
|
435
437
|
let t = new S(e);
|
|
436
438
|
C = !0;
|
|
437
|
-
let
|
|
439
|
+
let r = new n({
|
|
438
440
|
apiKey: "",
|
|
439
441
|
ui: {
|
|
440
442
|
...e.ui,
|
|
@@ -442,26 +444,26 @@ async function w(e = {}) {
|
|
|
442
444
|
}
|
|
443
445
|
}, t), i;
|
|
444
446
|
try {
|
|
445
|
-
let { mountCommentKitUI: e } = await import("./shared/mount-ui
|
|
446
|
-
i = await e(
|
|
447
|
+
let { mountCommentKitUI: e } = await import("./shared/mount-ui-Dz5QLq4W.js").then((e) => e.n);
|
|
448
|
+
i = await e(r);
|
|
447
449
|
} catch (e) {
|
|
448
|
-
throw
|
|
450
|
+
throw r.destroy(), C = !1, e;
|
|
449
451
|
}
|
|
450
452
|
let a = !1, o = {
|
|
451
453
|
start() {
|
|
452
|
-
a ||
|
|
454
|
+
a || r.startLocalDemo();
|
|
453
455
|
},
|
|
454
456
|
reset() {
|
|
455
|
-
a || (t.reset(),
|
|
457
|
+
a || (t.reset(), r.startLocalDemo());
|
|
456
458
|
},
|
|
457
459
|
destroy() {
|
|
458
|
-
a || (a = !0, i.unmount(),
|
|
460
|
+
a || (a = !0, i.unmount(), r.destroy(), C = !1);
|
|
459
461
|
},
|
|
460
462
|
getSession() {
|
|
461
463
|
return t.getSession();
|
|
462
464
|
},
|
|
463
465
|
getCore() {
|
|
464
|
-
return
|
|
466
|
+
return r;
|
|
465
467
|
},
|
|
466
468
|
onSessionChange(e) {
|
|
467
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 {
|
|
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 };
|