@commentkit/comment-kit 0.6.9 → 0.7.0

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 (62) hide show
  1. package/CHANGELOG.md +36 -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 +23 -11
  8. package/dist/demo.es.js +146 -69
  9. package/dist/headless.es.js +2 -2
  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-B9SxYqoF.js +1093 -0
  16. package/dist/shared/{bridge-DRE03N9X.js → bridge-CJoGYngu.js} +6 -3
  17. package/dist/shared/{button-group-CHfMRXyA.js → button-group-Cl9CrvvU.js} +1 -1
  18. package/dist/shared/comment-drawing-canvas-Dzb5YoFw.js +124 -0
  19. package/dist/shared/{comment-image-lightbox-0VdAs2iT.js → comment-image-lightbox-BPYJT1sB.js} +62 -57
  20. package/dist/shared/{comment-kit-core-D0kY00St.js → comment-kit-core-BaSuMzp9.js} +1027 -729
  21. package/dist/shared/comment-kit-ui-CzfdAZs2.js +20181 -0
  22. package/dist/shared/comment-screenshot-annotator-C7X-_bm6.js +151 -0
  23. package/dist/shared/comment-screenshot-overlay-wIrZrcRy.js +206 -0
  24. package/dist/shared/comment-utils-BycYTSxA.js +602 -0
  25. package/dist/shared/{dev-export-panel-BLngcr5q.js → dev-export-panel-FwFVdady.js} +8 -8
  26. package/dist/shared/{dev-grab-pDAfH2lr.js → dev-grab-DDqg0LQf.js} +1 -1
  27. package/dist/shared/dist-De294MVF.js +623 -0
  28. package/dist/shared/{element-selector-CtFzgHvq.js → element-selector-BhJm-NSs.js} +294 -288
  29. package/dist/shared/{icons-BSHCWYO1.js → icons-nzMOLzrm.js} +2 -3
  30. package/dist/shared/{mount-ui-CVivB_eQ.js → mount-ui--ijs8pWT.js} +4 -4
  31. package/dist/shared/{pusher-BEl7Qn-8.js → pusher-ipHMJnO_.js} +1 -1
  32. package/dist/shared/{realtime-BG_t_ze7.js → realtime-Dk41VwKg.js} +71 -50
  33. package/dist/shared/{separator-DusFNTs-.js → separator-XDBsaWyw.js} +891 -785
  34. package/dist/shared/{shadow-root-CmYXiSRR.js → shadow-root-C5v-T8lQ.js} +1 -1
  35. package/dist/shared/styles-D3yMtaec.js +2 -0
  36. package/dist/shared/{useValueChanged-DQXLia-2.js → useValueChanged-CrzfD8l-.js} +15 -15
  37. package/dist/shared/{websocket-manager-BTRqNTB7.js → websocket-manager-DhLWh3Jr.js} +2 -2
  38. package/dist/solid.es.js +3 -3
  39. package/dist/svelte.es.js +3 -3
  40. package/dist/types/adapters/bridge.d.ts +9 -12
  41. package/dist/types/angular/index.d.ts +15 -5
  42. package/dist/types/core/api-client.d.ts +16 -17
  43. package/dist/types/core/comment-kit-core.d.ts +19 -11
  44. package/dist/types/core/local-demo.d.ts +1 -0
  45. package/dist/types/core/types.d.ts +68 -0
  46. package/dist/types/headless.d.ts +1 -1
  47. package/dist/types/index.d.ts +8 -4
  48. package/dist/types/qwik/index.d.ts +4 -1
  49. package/dist/vue.es.js +3 -3
  50. package/docs/api-reference.md +372 -0
  51. package/docs/local-demo.md +60 -0
  52. package/package.json +16 -6
  53. package/dist/shared/annotation-toolbar-pX17NLmJ.js +0 -1104
  54. package/dist/shared/clamp-CcFVX0vC.js +0 -55
  55. package/dist/shared/comment-drawing-canvas-CYu5SwRf.js +0 -126
  56. package/dist/shared/comment-kit-ui-D2j2gvnm.js +0 -16685
  57. package/dist/shared/comment-screenshot-annotator-BuojwviY.js +0 -137
  58. package/dist/shared/comment-screenshot-overlay-BZX0Vcb8.js +0 -144
  59. package/dist/shared/local-demo-context-BohlYbHt.js +0 -6
  60. package/dist/shared/resolveAriaLabelledBy-CIKpnjNJ.js +0 -669
  61. package/dist/shared/styles-D_FEJZ9G.js +0 -2
  62. package/dist/shared/useLabelableId-DGbfdMi_.js +0 -155
package/CHANGELOG.md CHANGED
@@ -5,28 +5,60 @@ 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
- ## [Unreleased]
8
+ ## [0.7.0] - 2026-10-16
9
9
 
10
10
  ### Added
11
11
 
12
+ - Automated packed-archive checks for public documentation, license notices, version consistency and excluded development artifacts.
13
+ - A coordinated release checklist and expanded browser/framework consumer verification before publishing.
14
+
15
+ - A complete, hashed inventory of all 477 reference files with per-file UI, logic, and API audit results in five-file batches.
16
+ - Persistent reply quotes, reply reactions, composer file uploads, checklist and assignee creation, and parent metadata editing.
17
+ - Stored resolution/completion timestamps with readable labels, idempotent transitions and correct clearing when replies reopen a thread.
18
+ - Authenticated project context for real members, roles, storage usage and saved branches, plus `branch`, `setBranch()` and `reloadProjectContext()` integration APIs.
19
+
12
20
  - A dedicated `@commentkit/comment-kit/headless` entry for the engine and protocol types without React, widget mounting, or browser global registration.
13
21
  - A dedicated `@commentkit/comment-kit/demo` entry for the private browser-local sandbox. The original root export remains as a deprecated lazy wrapper.
14
22
  - Package, initial-load, first-open, and tool-activation size budgets, plus isolated consumer checks for the packed artifact.
15
23
  - A complete development stylesheet and dependency guards that preserve all 46 primitive families while checking production CSS coverage.
16
24
  - An interactive `/design-system` catalog with all 46 primitive families, 111 examples, local brand fonts, light/dark modes, RTL, and mobile browser coverage. Gallery assets remain excluded from npm.
17
25
 
26
+ - A `/design-system/product` preview for the assembled widget, with real product components, production CSS, local fixtures and save-failure simulation.
27
+ - Read-only source comparisons for 39 main product states across desktop/mobile and light/dark themes, plus optional tools and primitive states.
28
+
18
29
  ### Changed
19
30
 
20
31
  - Build all framework entries together, sharing the engine, UI, styles, and lazy Pusher chunk. Remove private implementation declarations from the published archive while retaining public type dependencies.
21
32
  - Load the full widget on activation and specialist tools when used. Preserve access gates, drafts, dialogs, cleanup, and retry/cancel behavior.
22
- - Exclude 11 currently unused primitive styles from production; retain their complete source and parity coverage for the remaining reference UI port. Load tool styles inside the widget's Shadow DOM with their tools.
33
+ - Exclude currently unused primitive styles from production; retain their complete source and parity coverage in the catalog. Load tool styles inside the widget's Shadow DOM with their tools.
23
34
  - Upgrade development dependencies, including Base UI 1.9, TypeScript 7, Vite+ 1.3, Vitest 5, React 19.3, and the framework test runtimes. Use standard V8 coverage instead of the custom compatibility provider.
24
35
  - Mark React and ReactDOM as optional npm peers for headless installations. **Built-in UI consumers must explicitly install matching React and ReactDOM 18+ versions**, including vanilla and non-React adapters.
25
36
  - Allow the React client entry to be imported directly from a Next.js server layout; the widget mounts after hydration. A mandatory `next/dynamic` workaround is no longer needed.
26
- - Reduce measured React initial SDK gzip from 262.8 KB to 38.9 KB and the all-adapter npm archive from 2.33 MB to about 359 KB. First-open and full-feature totals are recorded separately in the performance audit; external peers are excluded from browser estimates.
37
+ - Reduce initial SDK loading with shared lazy bundles. The performance audit records the original 262.8 KB React initial gzip and the measurements before this feature port; the full port audit records the current build. External peers are excluded from browser estimates.
38
+
39
+ - Adopt Message/Bubble/MessageScroller replies, Attachment/AspectRatio media, Combobox assignees and Item settings rows. Keep current-user alignment, actual SDK shortcuts and real backend actions.
27
40
 
28
41
  ### Fixed
29
42
 
43
+ - Reconcile dependent offline edits, deletions and reply reactions without restoring removed comments or losing newer optimistic changes.
44
+ - Build an optimizer-compatible Qwik library, preserve the legacy hook alias, and keep the hook's bridge methods usable after client resumption.
45
+ - Avoid WebKit resize loops in nested assignee filters and History API limits during rapid gallery navigation.
46
+ - Return keyboard focus to the actual attachment thumbnail after closing saved-image or draft-preview lightboxes, including Safari pointer interactions.
47
+ - Prepare production Angular dependency injection without requiring the JIT compiler.
48
+ - Ignore obsolete authentication responses after OTP cancellation, account replacement, logout or destruction, including late 401 responses from a previous session.
49
+ - Forward vanilla attachment targets and expose the scoped Escape-release callback consistently with the core API.
50
+ - Correct SvelteKit/Nuxt lifecycle examples and include customer-facing API and security documentation in the npm archive.
51
+
52
+ - Fetch project-wide comments for the All tab, paginate within the selected branch, and retrieve shared-link targets beyond the first page.
53
+ - Keep drafts and successful uploads across failed saves; preserve quote, mention and branch metadata through offline replay and local-demo reloads.
54
+ - Ignore stale responses after logout, account changes, branch changes or link navigation; derive realtime reaction ownership for the recipient.
55
+ - Preserve drawing gestures, screenshot provider/crop/export behavior, nested highlight offsets and mobile tool containment.
56
+
57
+ - Include highlight and drawing threads in the sidebar, keep the panel aligned with the dragged toolbar, and collapse list filters on scroll with keyboard focus recovery.
58
+ - Keep nested Select/Combobox menus above the docked panel and mobile sheet.
59
+ - Preserve reply/edit drafts after failed saves, guard IME submission and draft length, invoke supplied upload cancellation/retry callbacks, and restore lightbox navigation and thumbnail reopen selection.
60
+ - Pass actual thread status to Resolve/Reopen controls and keep same-name assignees distinct by ID.
61
+
30
62
  - Prevent a redundant remote-cursor CSS import from emitting an unscoped document stylesheet.
31
63
  - Keep tool loading failures recoverable without resurrecting canceled or destroyed widgets.
32
64
  - Preserve link semantics for navigation controls after the Base UI upgrade.
@@ -335,7 +367,7 @@ End-to-end build smoke tests against a freshly scaffolded app per framework (ins
335
367
  - Keyboard shortcuts
336
368
  - Environment-scoped comments
337
369
 
338
- [Unreleased]: https://github.com/commentkit/comment-kit/compare/v0.6.1...HEAD
370
+ [0.7.0]: https://github.com/commentkit/comment-kit/pull/2
339
371
  [0.6.1]: https://github.com/commentkit/comment-kit/compare/v0.6.0...v0.6.1
340
372
  [0.6.0]: https://github.com/commentkit/comment-kit/compare/v0.5.3...v0.6.0
341
373
  [0.5.3]: https://github.com/commentkit/comment-kit/compare/v0.5.2...v0.5.3
package/LICENSE CHANGED
@@ -4,12 +4,28 @@ This software is provided under a proprietary license. You may use this
4
4
  package solely in connection with CommentKit's hosted services and in
5
5
  accordance with the CommentKit Terms of Service.
6
6
 
7
+ For that permitted use, you may install and copy the SDK, process it with
8
+ ordinary application build tools (including bundling, transpiling, tree-shaking
9
+ and minifying), and include the resulting SDK code in websites or applications
10
+ you own or are authorized to operate. You may deliver that embedded code to
11
+ end users solely as necessary for those websites or applications to use
12
+ CommentKit's hosted services. Preserve this license and applicable third-party
13
+ notices with the distributed application or its accompanying notices.
14
+
15
+ This permission does not authorize distributing the SDK as a standalone product,
16
+ offering a competing service, or transferring ownership of the software.
17
+
7
18
  You may NOT:
8
- - Modify, reverse-engineer, or create derivative works of this software
9
- - Redistribute, sublicense, or sell this software
19
+ - Modify or create derivative works except for the build processing permitted above
20
+ - Reverse-engineer this software except where applicable law permits it
21
+ - Redistribute, sublicense, or sell this software except for permitted embedding
10
22
  - Use this software independently of CommentKit's services
11
23
  - Remove or alter any proprietary notices
12
24
 
25
+ Third-party components and assets identified in dist/THIRD_PARTY_NOTICES.txt
26
+ remain subject to their own licenses. The restrictions above apply only to
27
+ CommentKit's proprietary code and do not limit rights granted by those licenses.
28
+
13
29
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
30
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
31
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
package/README.md CHANGED
@@ -5,8 +5,8 @@ Drop-in SDK for React, Vue, Svelte, Angular, Solid.js, Qwik, Preact, and vanilla
5
5
 
6
6
  [npm version](https://www.npmjs.com/package/@commentkit/comment-kit)
7
7
  [downloads](https://www.npmjs.com/package/@commentkit/comment-kit)
8
- [license](https://github.com/commentkit/comment-kit/blob/main/LICENSE)
9
- [docs](https://commentkit.dev/docs)
8
+ [license](./LICENSE)
9
+ [docs](https://commentkit.dev/developers)
10
10
 
11
11
  ---
12
12
 
@@ -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 Server** | The `comment-kit-mcp` sibling package lets agents read comments over Model Context Protocol — no clipboard needed |
39
+ | **MCP Companion** | Separate repository companion for MCP integrations; public npm distribution is not yet available |
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 |
@@ -62,17 +62,26 @@ npm install @commentkit/comment-kit react react-dom
62
62
 
63
63
  Every adapter renders the same React widget. React and ReactDOM are optional in package metadata so a headless installation can omit them; **all built-in UI integrations still need both**. Keep existing compatible React versions rather than upgrading them just to install CommentKit. Your adapter's framework is also a peer dependency.
64
64
 
65
+ The package is ESM-only; use `import`, not CommonJS `require()`. For default screenshots and image captures, also install `html2canvas`, or supply a custom `screenshotProvider`:
66
+
67
+ ```bash
68
+ npm install html2canvas
69
+ ```
70
+
65
71
  ### 2. Get Your API Key
66
72
 
67
73
  1. Sign up at [commentkit.dev](https://commentkit.dev)
68
74
  2. Create an organization
69
75
  3. Create a project inside the organization
70
- 4. Copy the **API key** from the project dashboard
76
+ 4. Add the website domains that may use this project to its **allowed domains**
77
+ 5. Copy the **API key** from the project dashboard
71
78
 
72
- Each project gets its own API key. The SDK reads everything else (project ID, WebSocket config, features) from the API automatically.
79
+ Each project gets its own browser-facing API key. The SDK reads the project ID, WebSocket configuration and features from the API automatically. An empty origin allowlist denies browser requests by default. The project key identifies the project; a verified user session is still required to read private context and mutate feedback. Never embed user Bearer tokens or server credentials in your application source.
73
80
 
74
81
  ### 3. Add to Your App
75
82
 
83
+ On localhost the toolbar is visible. On production, staging and preview sites, press **Cmd/Ctrl + Shift + K** to open sign-in, then verify your email with OTP. Mount one instance for the app and clean it up when its host unmounts.
84
+
76
85
  **Next.js (App Router)**
77
86
 
78
87
  Import the client entry directly from your layout. The published React entry retains its `"use client"` boundary, and browser UI mounting happens after hydration. A `next/dynamic` wrapper with `ssr: false` is no longer required.
@@ -173,25 +182,25 @@ const { isAuthenticated, comments, toggleOverlay } = useCommentKit({
173
182
  Or register as a plugin:
174
183
 
175
184
  ```ts
176
- // main.ts — makes useCommentKit available app-wide via provide/inject
185
+ // main.ts — registers the <CommentKit> component
177
186
  import { CommentKitPlugin } from "@commentkit/comment-kit/vue";
178
187
 
179
188
  app.use(CommentKitPlugin);
180
189
  ```
181
190
 
191
+ Then mount `<CommentKit api-key="your-api-key" />` once in your root template.
192
+
182
193
  **Nuxt 3 / Nuxt 4**
183
194
 
184
- CommentKit must never load on the Nitro server. The cleanest pattern is a component whose filename ends in `.client.vue` — Nuxt strips it from the SSR bundle entirely.
195
+ For a client-only Nuxt integration, use a component whose filename ends in `.client.vue`. Its setup registers the hook, and Nuxt handles client mounting.
185
196
 
186
197
  ```vue
187
198
  <!-- components/CommentKitClient.client.vue -->
188
199
  <script setup lang="ts">
189
- import { onMounted } from "vue";
190
200
  import { useCommentKit } from "@commentkit/comment-kit/vue";
191
201
 
192
- onMounted(() => {
193
- useCommentKit({ apiKey: "your-api-key" });
194
- });
202
+ // Register lifecycle hooks during setup; the .client.vue boundary handles SSR.
203
+ useCommentKit({ apiKey: "your-api-key" });
195
204
  </script>
196
205
 
197
206
  <template><div /></template>
@@ -227,18 +236,28 @@ onMounted(() => {
227
236
 
228
237
  **SvelteKit**
229
238
 
230
- SvelteKit prerenders pages on the server, so dynamic-import inside `onMount` (which is client-only by definition) keeps `@commentkit/comment-kit/svelte` off the SSR module graph entirely.
239
+ For an explicit client-only SvelteKit integration, create the store after a dynamic import and return synchronous teardown from `onMount`. `useCommentKit` registers Svelte lifecycle hooks, so call it during component initialization rather than after an `await`.
231
240
 
232
241
  ```svelte
233
242
  <!-- src/routes/+layout.svelte -->
234
243
  <script lang="ts">
235
244
  import { onMount } from "svelte";
236
- import { browser } from "$app/environment";
237
-
238
- onMount(async () => {
239
- if (!browser) return;
240
- const { useCommentKit } = await import("@commentkit/comment-kit/svelte");
241
- useCommentKit({ apiKey: "your-api-key" });
245
+ import type { SvelteCommentKitStore } from "@commentkit/comment-kit/svelte";
246
+
247
+ onMount(() => {
248
+ let disposed = false;
249
+ let store: SvelteCommentKitStore | undefined;
250
+
251
+ void import("@commentkit/comment-kit/svelte")
252
+ .then(({ createCommentKitStore }) => {
253
+ if (!disposed) store = createCommentKitStore({ apiKey: "your-api-key" });
254
+ })
255
+ .catch((error) => console.error("CommentKit could not load", error));
256
+
257
+ return () => {
258
+ disposed = true;
259
+ store?.destroy();
260
+ };
242
261
  });
243
262
  </script>
244
263
 
@@ -265,11 +284,12 @@ export const appConfig = {
265
284
 
266
285
  ```typescript
267
286
  // app.component.ts
287
+ import { Component, inject } from "@angular/core";
268
288
  import { CommentKitService } from "@commentkit/comment-kit/angular";
269
289
 
270
- @Component({ ... })
290
+ @Component({ selector: "app-root", standalone: true, template: "<main>Your app</main>" })
271
291
  export class AppComponent {
272
- constructor(private commentKit: CommentKitService) {}
292
+ private readonly commentKit = inject(CommentKitService);
273
293
 
274
294
  // RxJS observables — auto-emit on state changes
275
295
  comments$ = this.commentKit.comments$;
@@ -296,19 +316,27 @@ function App() {
296
316
 
297
317
  ```tsx
298
318
  import { component$ } from "@builder.io/qwik";
299
- import { useCommentKit$ } from "@commentkit/comment-kit/qwik";
319
+ import { useCommentKit } from "@commentkit/comment-kit/qwik";
300
320
 
301
321
  export default component$(() => {
302
- // Qwik signals — serializable, resumable.
303
- // Full UI mounts in Shadow DOM on the client (useVisibleTask$).
304
- const { state, isReady } = useCommentKit$({
322
+ // The hook uses useVisibleTask$ to mount only on the client.
323
+ // The Shadow DOM widget still requires React and ReactDOM.
324
+ const { core, isReady } = useCommentKit({
305
325
  apiKey: "your-api-key",
306
326
  });
307
327
 
308
- return <p>Ready: {isReady.value}</p>;
328
+ return (
329
+ <button disabled={!isReady.value} onClick$={() => core.value?.toggleOverlay()}>
330
+ Toggle comments
331
+ </button>
332
+ );
309
333
  });
310
334
  ```
311
335
 
336
+ Call the hook inside `component$`. In Qwik event handlers, access methods through the destructured `core` signal as above; do not capture plain bridge callbacks across an `onClick$` boundary. `useCommentKit$` remains a deprecated compatibility alias.
337
+
338
+ Use Qwik's optimizer and its supported Vite version to build the host app. Qwik 1.20.2 has an upstream declaration error that requires `skipLibCheck: true`; CommentKit's consumer API expressions are still checked. Client-only function options such as `screenshotProvider` cannot survive server serialization; Qwik callbacks that must resume should use `onReady$` and `onError$`.
339
+
312
340
  **Preact**
313
341
 
314
342
  ```tsx
@@ -364,10 +392,12 @@ Or use vanilla JS in any `.astro` page:
364
392
  </script>
365
393
  ```
366
394
 
367
- **Vanilla JavaScript**
395
+ **Vanilla JavaScript with a bundler**
396
+
397
+ The following package import is resolved by a bundler such as Vite. A standalone HTML page needs a browser-ready bundle or an import map for the SDK and its peers; browsers do not resolve bare npm package names by themselves.
368
398
 
369
399
  ```html
370
- <!-- CommentKit auto-mounts a floating toolbar on your page.
400
+ <!-- In a bundler-managed HTML entry, CommentKit mounts its widget on demand.
371
401
  Theme follows .dark class on <html> or system preference.
372
402
  Tooltips, dialogs, and panels are built-in. -->
373
403
  <script type="module">
@@ -411,7 +441,7 @@ const demo = await createCommentKitDemo({ storageKey: "website-demo" });
411
441
  // demo.reset() starts a fresh sandbox; demo.destroy() removes it.
412
442
  ```
413
443
 
414
- The real widget uses a private browser store with a fixed 24-hour lifetime and a memory fallback when storage is unavailable. No project key, OTP, production API writes, uploads, or realtime connection is created. The demo UI needs React and ReactDOM. The old root `createCommentKitDemo` export remains as a deprecated lazy compatibility wrapper.
444
+ The real widget uses a private browser store with a fixed 24-hour lifetime and a memory fallback when storage is unavailable. No project key, OTP, production API writes, uploads, or realtime connection is created. The demo UI needs React and ReactDOM. Its complete lifecycle and limits are in the included [private-demo guide](./docs/local-demo.md). The old root `createCommentKitDemo` export remains as a deprecated lazy compatibility wrapper.
415
445
 
416
446
  ## Member Invite Links
417
447
 
@@ -464,11 +494,11 @@ Every framework and meta-framework gets the full CommentKit UI — identical too
464
494
 
465
495
  **Svelte family** — `@commentkit/comment-kit/svelte`
466
496
 
467
- | Framework / Tool | Notes |
468
- | ------------------------ | ------------------------------------------------------- |
469
- | Svelte 5 | Vite, esbuild — same import |
470
- | SvelteKit | Gate on `browser` from `$app/environment` (see snippet) |
471
- | Laravel Inertia (Svelte) | Mount in `app.ts` |
497
+ | Framework / Tool | Notes |
498
+ | ------------------------ | --------------------------------------------------------------------- |
499
+ | Svelte 5 | Vite, esbuild — same import |
500
+ | SvelteKit | Create the store in `onMount` and destroy it on cleanup (see snippet) |
501
+ | Laravel Inertia (Svelte) | Mount in `app.ts` |
472
502
 
473
503
  **Angular family** — `@commentkit/comment-kit/angular`
474
504
 
@@ -488,10 +518,10 @@ Every framework and meta-framework gets the full CommentKit UI — identical too
488
518
 
489
519
  **Qwik family** — `@commentkit/comment-kit/qwik`
490
520
 
491
- | Framework / Tool | Notes |
492
- | ---------------- | ---------------------------------------------------- |
493
- | Qwik | Inside `useVisibleTask$` (client-only by definition) |
494
- | QwikCity | Same; mount in `root.tsx` |
521
+ | Framework / Tool | Notes |
522
+ | ---------------- | ----------------------------------------------------------------------- |
523
+ | Qwik | Call `useCommentKit` inside `component$`; the hook owns client mounting |
524
+ | QwikCity | Same; use in the root component or a shared layout |
495
525
 
496
526
  **Preact family** — `@commentkit/comment-kit/preact`
497
527
 
@@ -509,19 +539,19 @@ Every framework and meta-framework gets the full CommentKit UI — identical too
509
539
 
510
540
  **Vanilla / Web Components / HTML-first** — `@commentkit/comment-kit`
511
541
 
512
- | Framework / Tool | Notes |
513
- | -------------------------- | ------------------------------------------------------- |
514
- | Plain HTML (no framework) | `<script type="module">` + `new CommentKit({ apiKey })` |
515
- | Web Components / Lit | Mount in `connectedCallback` of a host component |
516
- | Stencil | Mount in `componentDidLoad` |
517
- | Marko (eBay) | Mount in client init |
518
- | Alpine.js / Petite-Vue | `<script>` tag at end of `<body>` |
519
- | htmx | Same as plain HTML |
520
- | Stimulus / Hotwire (Rails) | Mount in a Stimulus controller's `connect()` |
521
- | Phoenix LiveView | Mount in a `hook.mounted()` |
522
- | Laravel Livewire | Mount in Livewire hook |
523
- | Laravel Filament | Drop the `<script>` into a custom page layout |
524
- | Mitosis | Mount in the compiled framework's init |
542
+ | Framework / Tool | Notes |
543
+ | -------------------------- | --------------------------------------------------------------------- |
544
+ | Plain HTML (no framework) | Browser-ready bundle or import map, then `new CommentKit({ apiKey })` |
545
+ | Web Components / Lit | Mount in `connectedCallback` of a host component |
546
+ | Stencil | Mount in `componentDidLoad` |
547
+ | Marko (eBay) | Mount in client init |
548
+ | Alpine.js / Petite-Vue | `<script>` tag at end of `<body>` |
549
+ | htmx | Same as plain HTML |
550
+ | Stimulus / Hotwire (Rails) | Mount in a Stimulus controller's `connect()` |
551
+ | Phoenix LiveView | Mount in a `hook.mounted()` |
552
+ | Laravel Livewire | Mount in Livewire hook |
553
+ | Laravel Filament | Drop the `<script>` into a custom page layout |
554
+ | Mitosis | Mount in the compiled framework's init |
525
555
 
526
556
  **WebView / hybrid shells** — `@commentkit/comment-kit` (vanilla), works the same as a normal page
527
557
 
@@ -561,7 +591,7 @@ Every framework and meta-framework gets the full CommentKit UI — identical too
561
591
  | ? | Show shortcuts overlay |
562
592
  | Esc | Close / deselect / exit mode |
563
593
 
564
- > Shortcuts only activate when the overlay is visible and no input is focused. Cmd/Ctrl + C respects active text selections — system copy still wins when text is highlighted.
594
+ > Tool shortcuts require authentication and a visible overlay or active tool, with no input focused. Cmd/Ctrl + Shift + K also opens sign-in before authentication. Cmd/Ctrl + C respects active text selections — system copy still wins when text is highlighted.
565
595
 
566
596
  ---
567
597
 
@@ -577,7 +607,7 @@ Every framework and meta-framework gets the full CommentKit UI — identical too
577
607
  | `solid-js` | Only for Solid.js apps | `>=1.0.0` |
578
608
  | `@builder.io/qwik` | Only for Qwik apps | `>=1.0.0` |
579
609
  | `preact` | Only for Preact apps | `>=10.0.0` |
580
- | `html2canvas` | Only for screenshots | `>=1.4.0` |
610
+ | `html2canvas` | For default screenshots; not needed with a custom `screenshotProvider` | `>=1.4.0` |
581
611
  | `pusher-js` | Bundled — no install needed (inlined into the SDK for real-time) | — |
582
612
  | `element-source` | Optional — enables file:line + component stack in agent context and dev grabs | `>=0.0.5` |
583
613
 
@@ -618,7 +648,7 @@ Source resolution kicks in when the optional `element-source` peer dep is instal
618
648
 
619
649
  ### 3. Bulk export of stakeholder comments (developer, local)
620
650
 
621
- The toolbar's **Dev export** button (visible only on localhost) opens a side panel listing every open stakeholder comment from production / staging / preview. Select N comments, click **Copy N for agent**, and the clipboard receives one bundled Markdown payload — each comment's content, replies, author, page URL, the stakeholder's screenshot, the element's resolved source location (looked up against the developer's local build), and the selector / XPath fallback.
651
+ The toolbar's **Dev export** button (visible only on localhost) opens a side panel listing loaded open stakeholder comments from production / staging / preview. Load additional pages in the comments panel before exporting a larger selection. Select N comments, click **Copy N for agent**, and the clipboard receives one bundled Markdown payload — each comment's content, replies, author, page URL, the stakeholder's screenshot, the element's resolved source location (looked up against the developer's local build), and the selector / XPath fallback.
622
652
 
623
653
  ```ts
624
654
  await commentKit.copyAgentContext({
@@ -631,11 +661,9 @@ const prompt = await commentKit.formatAgentContextAsync({ includeResolved: false
631
661
 
632
662
  ### MCP server
633
663
 
634
- The [`comment-kit-mcp`](./mcp/README.md) sibling package exposes `list_comments`, `get_comment`, and `search_comments` as MCP tools. Agents that speak Model Context Protocol (Claude Desktop, Cursor, Claude Code, Codex CLI, Continue, Zed AI) can pull stakeholder feedback for the page they're working on without leaving the editor.
664
+ The separate `comment-kit-mcp` companion implements `list_comments`, `get_comment`, and `search_comments` for MCP clients. It is not included in this SDK, and that package name is not currently available from the public npm registry. Do not use an `npx comment-kit-mcp` command until its distribution is published.
635
665
 
636
- ```bash
637
- npx -y comment-kit-mcp
638
- ```
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.
639
667
 
640
668
  ---
641
669
 
@@ -646,6 +674,7 @@ Most apps only need `apiKey`. Everything else is auto-configured.
646
674
  ```typescript
647
675
  {
648
676
  apiKey: "your-api-key", // required — from dashboard
677
+ branch: "main", // optional — tag new feedback and filter this branch
649
678
  enabled: true, // optional — set false to disable completely
650
679
  screenshotProvider: async (el) => {...}, // optional — replaces html2canvas
651
680
  ui: {
@@ -664,12 +693,20 @@ Most apps only need `apiKey`. Everything else is auto-configured.
664
693
  }
665
694
  ```
666
695
 
696
+ ### Project context and branches
697
+
698
+ After authentication, the SDK retrieves the actual team members, roles, storage usage and saved branches from the backend. The panel's **All** tab spans project pages; **Page** filters loaded threads to the current path. Use **Load more comments** to retrieve additional records. Shared links retrieve their target even when it is not in the first page.
699
+
700
+ `core.setBranch("preview")` filters that branch and tags new comments. `core.setBranch(null)` shows all branches. `core.reloadProjectContext()` refreshes members and usage. These APIs require the backend upgrade described below; old untagged records stay visible under All branches. `core.reloadComments()` refreshes the first page of the active branch, while `loadMoreComments()` appends the next page.
701
+
702
+ The production composer uploads files before saving, reuses completed uploads when a save is retried, and sends description, checklist, assignee, mention and device context with the record. Reply quotes and reactions persist on the corresponding message. `ReplyOptions`, `ReplyTarget`, `CommentCreateOptions`, `CommentDeviceInfo` and `ProjectContext` are available from the headless entry.
703
+
667
704
  ### Realtime at scale
668
705
 
669
706
  Live cursors are the one realtime feature whose cost grows with the number of
670
707
  simultaneous viewers — each client can receive up to _(online peers × ~30fps)_
671
- cursor events. The SDK keeps this flat regardless of project size with three
672
- inbound bounds (per-peer ~30fps throttle, a distinct-cursor cap, and a global
708
+ cursor events. The SDK bounds rendered cursor state and updates with three
709
+ inbound limits (per-peer ~30fps throttle, a distinct-cursor cap, and a global
673
710
  per-second emit budget), and the online-users roster is capped at 500. For very
674
711
  high-concurrency projects where cursor sharing isn't worth the bandwidth, set
675
712
  `realtime.cursors: false` (stops outbound cursor whispers and drops inbound
@@ -688,27 +725,40 @@ To disable in production:
688
725
 
689
726
  CommentKit is designed to be safe for production use on customer-facing websites.
690
727
 
691
- | Concern | How CommentKit handles it |
692
- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
693
- | **No telemetry** | The SDK sends zero analytics, tracking, or telemetry data. No data is collected from your users. |
694
- | **No phone-home** | The SDK only communicates with `api.commentkit.dev` (your backend) by default. Google Fonts (`fonts.googleapis.com`) is contacted only when you opt in via `ui.loadRemoteFonts: true`. No other third-party services. |
695
- | **No install scripts** | `npm install` runs zero code. No `postinstall`, `preinstall`, or lifecycle scripts. |
696
- | **No dynamic code execution** | Zero `eval()`, `new Function()`, `innerHTML`, or `document.write`. |
697
- | **Shadow DOM isolation** | All UI renders inside Shadow DOM. CommentKit cannot read or modify your page's DOM, CSS, or JavaScript. Your page cannot interfere with CommentKit. |
698
- | **Source maps disabled** | No `.map` files ship. No `sourceMappingURL` in built files. |
699
- | **OTP authentication** | All commenters verify via email OTP. No passwords stored. |
700
- | **Session persistence** | Sanctum Bearer token is kept in **sessionStorage** (tab-scoped) so in-tab refresh keeps auth and the offline queue can drain. Closing the tab clears the session; logout / auth-expiry also clear the offline queue. Prefer Bearer over `X-User-Email` (spoofable). |
701
- | **Origin allowlist** | Browser requests must match the project's `allowed_domains` (wildcards like `*.example.com` supported). Empty allowlists deny browser traffic unless the backend enables `COMMENTKIT_ALLOW_EMPTY_ALLOWED_DOMAINS`. Server/MCP clients may omit `Origin`. |
702
- | **GDPR** | CommentKit stores only email and display name for authenticated commenters. No cookies. No fingerprinting. No cross-site tracking. |
728
+ | Concern | How CommentKit handles it |
729
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
730
+ | **No telemetry** | The SDK sends no analytics or tracking events. Submitted feedback includes its author, page, content, attachments and optional browser/OS/viewport context. |
731
+ | **Network requests** | API calls use `api.commentkit.dev` by default or your configured `baseUrl`; realtime connects to the host returned by project configuration. Displayed attachments and avatars load their supplied URLs. Google Fonts is contacted only when you opt in via `ui.loadRemoteFonts: true`. |
732
+ | **No install scripts** | This package declares no `preinstall`, `install` or `postinstall` hooks. Build and publication checks are separate maintainer scripts. |
733
+ | **No dynamic code execution** | Zero `eval()`, `new Function()`, `innerHTML`, or `document.write`. |
734
+ | **Shadow DOM isolation** | Widget styles are scoped inside Shadow DOM. Annotation, element capture and screenshots intentionally inspect the host page to attach feedback; host permissions and browser restrictions still apply. |
735
+ | **Source maps disabled** | No `.map` files ship. No `sourceMappingURL` in built files. |
736
+ | **OTP authentication** | All commenters verify via email OTP. No passwords stored. |
737
+ | **Session persistence** | Sanctum Bearer token is kept in **sessionStorage** (tab-scoped) so in-tab refresh keeps auth and the offline queue can drain. Closing the tab clears the session; logout / auth-expiry also clear the offline queue. Prefer Bearer over `X-User-Email` (spoofable). |
738
+ | **Origin allowlist** | Browser requests must match the project's `allowed_domains` (wildcards like `*.example.com` supported). Empty allowlists deny browser traffic unless the backend enables `COMMENTKIT_ALLOW_EMPTY_ALLOWED_DOMAINS`. Server/MCP clients may omit `Origin`. |
739
+ | **Stored data** | Authenticated comments store author identity, feedback and submitted context. The SDK uses tab-scoped session storage and a bounded local retry queue; the private demo uses a separate expiring browser store. |
740
+
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.
703
742
 
704
743
  ### Backend API contract (SDK ↔ backend-v2)
705
744
 
706
745
  - Base path is `/api` (not `/api/v1`). Default host: `https://api.commentkit.dev/api`.
707
746
  - Auth: `X-API-Key` on every route; user identity via `Authorization: Bearer` (Sanctum ability `sdk`). Prefer Bearer over `X-User-Email` (only honored when `COMMENTKIT_ALLOW_EMAIL_AUTH=true`).
708
- - Attachments: create a comment then `POST .../files` with `comment_id`, **or** upload first and pass `attachment_ids` on create/update. Unlinked orphans do not appear on comments.
747
+ - Attachments: upload drafts to `POST .../files`, then pass `attachment_ids` on comment/reply create or update. Direct uploads may target an authorized `comment_id` or `reply_id`. Unlinked drafts do not appear on comments.
709
748
  - MCP comment reads may use API key only when `COMMENTKIT_MACHINE_READ_ENABLED` is on; mutations still need Bearer.
710
749
  - Realtime: bind `comment_completed` separately from `comment_updated`.
711
750
 
751
+ ### Backend upgrade order
752
+
753
+ This release adds server-backed widget context, reply quotes/reactions, metadata and lifecycle timestamps. Customers using CommentKit’s hosted service only install the SDK after CommentKit has deployed its matching API. The following sequence is for operators of the backend-v2 deployment:
754
+
755
+ 1. Prepare a database backup and the matching backend release. Apply its additive migrations with the backend release’s `php artisan migrate --force` command before routing traffic to new server code. Required migrations are `2026_10_16_105715_add_widget_context_to_comments_and_replies` and `2026_10_16_114945_add_status_timestamps_to_comments_table`.
756
+ 2. Deploy that API, configure the project’s allowed domains, and verify OTP delivery, authenticated `/api/projects/{slug}/context`, comment/reply retrieval, attachments and realtime. Existing clients remain supported; historical lifecycle dates stay null.
757
+ 3. Install the candidate SDK in staging. Verify create/reply/edit/reaction/resolve/reopen and reload against that deployed API with a dedicated test project. The private local demo does not exercise the API or migrations.
758
+ 4. Release the website integration, then publish the new npm version only after the deployment checks and release approval. If the client must be rolled back, keep the additive schema in place; do not drop columns containing newly stored feedback.
759
+
760
+ An older API’s missing context route is tolerated during a rolling upgrade, but that fallback does not provide the new persistent workflows. Do not treat a working local demo as proof that the production backend is ready.
761
+
712
762
  ### Screenshot redaction
713
763
 
714
764
  Screenshots mask `input[type="password"]` fields by default. To exclude any other sensitive element from capture, mark it with the `data-commentkit-redact` attribute — redacted elements are blanked out before the image leaves the browser.
@@ -735,14 +785,14 @@ Measured from the current development build on 2026-10-16; KB below means 1,000
735
785
 
736
786
  | Measurement | Before | Current |
737
787
  | ----------------------------------------------------- | -------: | -------: |
738
- | React initial SDK code, gzip | 262.8 KB | 38.9 KB |
739
- | React through first widget open, cumulative gzip | — | 255.2 KB |
740
- | React with every reachable optional chunk, gzip | 289.3 KB | 312.6 KB |
741
- | Compressed npm archive, all adapters and declarations | 2.33 MB | 359.1 KB |
788
+ | React initial SDK code, gzip | 262.8 KB | 42.2 KB |
789
+ | React through first widget open, cumulative gzip | — | 306.3 KB |
790
+ | React with every reachable optional chunk, gzip | 289.3 KB | 368.1 KB |
791
+ | Compressed npm archive, all adapters and declarations | 2.33 MB | 432.9 KB |
742
792
 
743
- These are different measurements. Browser estimates sum each SDK chunk compressed with gzip level 9 and exclude React, ReactDOM, framework peers, `html2canvas`, and `element-source`. First-open size includes the initial code; it is not an additional 255.2 KB. The npm archive includes every adapter and is not a browser download. Host bundling, caching, and enabled realtime features affect actual requests.
793
+ These are different measurements. Browser estimates sum each SDK chunk compressed with gzip level 9 and exclude React, ReactDOM, framework peers, `html2canvas`, and `element-source`. First-open size includes the initial code; it is not an additional 306.3 KB. The npm archive includes every adapter and is not a browser download. Host bundling, caching, and enabled realtime features affect actual requests. Archive size is approximate and changes with included documentation.
744
794
 
745
- The initial React load is smaller because work is deferred; the complete optional feature set has not been removed. All 46 source primitive families remain available for the next UI port. See the [performance audit](./docs/package-performance-audit.md) for per-stage sizes, limitations, migration details, and reproduction commands. `npm run build` enforces the package and load-stage size budgets.
795
+ The initial React load is smaller because work is deferred; the complete optional feature set has not been removed. All 46 retained primitive families remain available; the main product screens now use their audited compositions. Contributors with repository access can read the [full port audit](https://github.com/commentkit/comment-kit/blob/main/docs/ui-full-port-audit.md) and [performance baseline](https://github.com/commentkit/comment-kit/blob/main/docs/package-performance-audit.md) for verification, limitations and reproduction commands. `npm run build` enforces the package and load-stage size budgets.
746
796
 
747
797
  ---
748
798
 
@@ -763,11 +813,7 @@ The initial React load is smaller because work is deferred; the complete optiona
763
813
 
764
814
  ## Browser Support
765
815
 
766
- | Browser | Version |
767
- | ------------- | ------- |
768
- | Chrome / Edge | 80+ |
769
- | Firefox | 80+ |
770
- | Safari | 14+ |
816
+ Use current evergreen Chrome, Edge, Firefox or Safari. The UI requires Shadow DOM, Pointer Events and modern CSS color functions (`oklch` and `color-mix`). The browser test matrix targets current Playwright Chromium, Firefox and WebKit engines; older browser versions are not validated.
771
817
 
772
818
  The published package declares **Node.js >=18**. Developing or building this repository requires **Node.js 24.15+** for the current Vite+, TypeScript, and framework toolchain. That development requirement does not raise the React 18 UI peer minimum.
773
819
 
@@ -777,7 +823,7 @@ The published package declares **Node.js >=18**. Developing or building this rep
777
823
 
778
824
  For custom integrations, events, selective subscriptions, and TypeScript types, see the [API Reference](./docs/api-reference.md).
779
825
 
780
- Repository contributors can run `npm run dev` and open `/design-system` to inspect all 46 internal primitive families in light/dark mode and RTL. The [development catalog guide](./dev/README.md) explains its 111 examples and browser checks; the [primitive audit](./docs/ui-primitive-parity-audit.md) records comparisons with the React reference. The gallery and its local fonts are development assets, excluded from the published package.
826
+ The repository is private. Contributors with access can run `npm run dev` and open `/design-system` to inspect all 46 internal primitive families in light/dark mode and RTL. The [development catalog guide](https://github.com/commentkit/comment-kit/blob/main/dev/README.md) explains its 111 examples and browser checks; the [primitive audit](https://github.com/commentkit/comment-kit/blob/main/docs/ui-primitive-parity-audit.md) records comparisons with the React reference. Open `/design-system/product` for the assembled panel, thread, composer, filters and settings with local fixture data and a simulated failed-save option. The [product audit](https://github.com/commentkit/comment-kit/blob/main/docs/ui-product-port-audit.md) records source comparisons and supported behavior. The gallery and its local fonts are development assets, excluded from the published package.
781
827
 
782
828
  ---
783
829
 
@@ -789,10 +835,9 @@ CommentKit is proprietary software. See [LICENSE](./LICENSE) for details.
789
835
 
790
836
  ## Links
791
837
 
792
- - [Documentation](https://commentkit.dev/docs)
793
- - [Dashboard](https://commentkit.dev/dashboard)
838
+ - [Developer guide](https://commentkit.dev/developers)
839
+ - [Sign in](https://commentkit.dev/auth/otp)
794
840
  - [Changelog](./CHANGELOG.md)
795
- - [GitHub](https://github.com/commentkit/comment-kit)
841
+ - [GitHub (private contributor repository)](https://github.com/commentkit/comment-kit)
796
842
  - [npm](https://www.npmjs.com/package/@commentkit/comment-kit)
797
843
  - [Twitter / X](https://x.com/commentkit)
798
- - [Discord](https://discord.gg/commentkit)
package/SECURITY.md ADDED
@@ -0,0 +1,48 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Release | Supported |
6
+ | ------------------------------ | ---------------------------------------------- |
7
+ | Latest published SDK release | Yes |
8
+ | Older published releases | Upgrade to the latest release |
9
+ | Unpublished release candidates | Test builds; not a production security release |
10
+
11
+ Only the latest published release receives security fixes. Preparing a new version does not end support for the current published version before its successor is released.
12
+
13
+ ## Reporting a Vulnerability
14
+
15
+ Please report security vulnerabilities privately to **<security@commentkit.dev>**. Do not open public GitHub issues for security problems.
16
+
17
+ Include, where possible:
18
+
19
+ - A description of the vulnerability and its impact
20
+ - Steps to reproduce (proof-of-concept code or a minimal host page)
21
+ - The affected package and version (`@commentkit/comment-kit` or `comment-kit-mcp`)
22
+
23
+ ### Response expectations
24
+
25
+ - **Acknowledgement:** within 2 business days
26
+ - **Triage and initial assessment:** within 7 days
27
+ - **Fix or mitigation plan:** communicated within 30 days for confirmed issues
28
+
29
+ We will credit reporters in release notes unless you prefer to remain anonymous.
30
+
31
+ ## Scope
32
+
33
+ This policy covers:
34
+
35
+ - **The CommentKit SDK** (`@commentkit/comment-kit` npm package) — all framework entry points (core, React, Vue, Svelte, Angular, Solid, Qwik, Preact)
36
+ - **The MCP server** (`comment-kit-mcp` sibling package in `mcp/`)
37
+
38
+ Vulnerabilities in the hosted CommentKit backend (`api.commentkit.dev`, the dashboard) are also welcome at the same address, but are handled by the platform team.
39
+
40
+ ## Hardening Guidance for Hosts
41
+
42
+ CommentKit runs inside your page's JavaScript context — Shadow DOM isolates styles, not JS. Recommended baseline for production sites embedding the widget:
43
+
44
+ - **Content Security Policy (CSP):** serve a strict CSP so a host-page XSS cannot exfiltrate the widget session or impersonate commenters.
45
+ - **Subresource Integrity (SRI):** use SRI hashes for any third-party scripts you load alongside the widget.
46
+ - **Redaction:** screenshots mask `input[type="password"]` fields by default; mark any other sensitive element with `data-commentkit-redact` to exclude it from screenshot capture.
47
+ - **HTTPS-only `baseUrl`:** if you configure a custom `baseUrl` (self-hosted or staging API), it must be HTTPS — never point the SDK at a plain-HTTP endpoint in production.
48
+ - **Backend identity:** your realtime channel-auth endpoint must derive identity from the session token, never from client-supplied `user_id` / `user_name` / `user_email` parameters.