@commentkit/comment-kit 1.0.0-beta.0 → 1.0.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 (52) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +99 -7
  3. package/SECURITY.md +7 -2
  4. package/dist/npm/chunks/Guest-VNoofLxw.js +157 -0
  5. package/dist/npm/chunks/MarkupEditor-DTXrS3DD.js +199 -0
  6. package/dist/npm/chunks/Panel-B88JYH52.js +438 -0
  7. package/dist/npm/chunks/Shortcuts-BSOKdMHt.js +56 -0
  8. package/dist/npm/chunks/ThreadCard-izybwXIC.js +817 -0
  9. package/dist/npm/chunks/ar-O7EPv0mI.js +222 -0
  10. package/dist/npm/chunks/art-DK1JwPIo.js +155 -0
  11. package/dist/npm/chunks/{client-D1vrh_5G.js → client-Iegfv6ZC.js} +95 -65
  12. package/dist/npm/chunks/de-PGyZVNHX.js +211 -0
  13. package/dist/npm/chunks/es-Bq1idl8M.js +211 -0
  14. package/dist/npm/chunks/extension-B7SelsS0.js +54 -0
  15. package/dist/npm/chunks/extension-DSA8S8Qz.js +26 -0
  16. package/dist/npm/chunks/format-B5tJGtPC.js +524 -0
  17. package/dist/npm/chunks/fr-BVB9GGco.js +211 -0
  18. package/dist/npm/chunks/hi-DyBvrjzQ.js +211 -0
  19. package/dist/npm/chunks/{html2canvas-_mjSRP3G.js → html2canvas-DfGb8yka.js} +1145 -1132
  20. package/dist/npm/chunks/it-BlMMMwZh.js +211 -0
  21. package/dist/npm/chunks/ja-lAioBCJv.js +211 -0
  22. package/dist/npm/chunks/live-YFyP1GnP.js +34 -0
  23. package/dist/npm/chunks/mount-Dx_8NhX3.js +1484 -0
  24. package/dist/npm/chunks/nl-DR8mLHnn.js +211 -0
  25. package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
  26. package/dist/npm/chunks/pt-BR-D7j6aDPx.js +211 -0
  27. package/dist/npm/chunks/{pusher-DRKlokR8.js → pusher-BSsQoE1K.js} +1 -1
  28. package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
  29. package/dist/npm/chunks/report-DoDVi1qT.js +28 -0
  30. package/dist/npm/chunks/{rolldown-runtime-VHNaYcLd.js → rolldown-runtime-Y_bBpyJl.js} +10 -3
  31. package/dist/npm/chunks/src-C1Qp94nr.js +549 -0
  32. package/dist/npm/chunks/zh-CN-tzYg9NPH.js +211 -0
  33. package/dist/npm/element.js +28 -11
  34. package/dist/npm/headless.js +2 -2
  35. package/dist/npm/index.js +3 -3
  36. package/dist/npm/react.js +12 -3
  37. package/dist/npm/svelte.js +12 -3
  38. package/dist/npm/types/adapters/react.d.ts +2 -0
  39. package/dist/npm/types/adapters/svelte.d.ts +1 -1
  40. package/dist/npm/types/adapters/vue.d.ts +72 -0
  41. package/dist/npm/types/anchor/index.d.ts +0 -1
  42. package/dist/npm/types/core/api.d.ts +2 -0
  43. package/dist/npm/types/core/auth.d.ts +42 -5
  44. package/dist/npm/types/core/client.d.ts +22 -7
  45. package/dist/npm/types/core/types.d.ts +50 -6
  46. package/dist/npm/types/element.d.ts +4 -1
  47. package/dist/npm/types/index.d.ts +3 -1
  48. package/dist/npm/vue.js +46 -7
  49. package/package.json +8 -2
  50. package/dist/npm/chunks/mount-Ce1MZrcm.js +0 -2485
  51. package/dist/npm/chunks/realtime-5SvAvTUU.js +0 -23
  52. package/dist/npm/chunks/src-DJjfvVsa.js +0 -330
@@ -120,11 +120,7 @@ export interface Thread {
120
120
  priority: ThreadPriority;
121
121
  assignee: Person | null;
122
122
  due_at: string | null;
123
- labels?: {
124
- id: number;
125
- name: string;
126
- color: string;
127
- }[];
123
+ labels?: Label[];
128
124
  page: {
129
125
  url: string;
130
126
  path: string;
@@ -147,12 +143,29 @@ export interface Thread {
147
143
  console: CaptureInput["console"] | null;
148
144
  network: CaptureInput["network"] | null;
149
145
  } | null;
146
+ /** Only in the answer to a share-link guest's own first comment, until they enter the emailed code. */
147
+ pending_verification?: boolean;
148
+ /** Whether you get notifications about this thread, when the server says (PUT / DELETE /threads/{id}/watch change it). */
149
+ watching?: boolean;
150
150
  last_activity_at: string;
151
151
  resolved_at: string | null;
152
152
  closed_at: string | null;
153
153
  created_at: string;
154
154
  updated_at: string;
155
155
  }
156
+ /**
157
+ * A realtime change ping. Ids only: the widget fetches the thread again over HTTP. `actor` (and `by`, on
158
+ * newer servers) say who made the change ("user:1", "guest:9"); `page_path` says which page the thread is
159
+ * on. Any of them can be missing on older servers.
160
+ */
161
+ export interface FeedbackPing {
162
+ type: string;
163
+ thread_id: string;
164
+ message_id?: string | null;
165
+ actor?: string | null;
166
+ by?: string | null;
167
+ page_path?: string | null;
168
+ }
156
169
  export interface Capabilities {
157
170
  comment: boolean;
158
171
  triage: boolean;
@@ -169,6 +182,8 @@ export interface Session {
169
182
  };
170
183
  environment: Environment;
171
184
  capabilities: Capabilities;
185
+ /** Opaque key that live-update pings carry in `by` when this person made the change. */
186
+ realtime_key?: string;
172
187
  }
173
188
  export interface WidgetConfig {
174
189
  project: {
@@ -183,6 +198,11 @@ export interface WidgetConfig {
183
198
  realtime: boolean;
184
199
  console_capture: boolean;
185
200
  network_capture: boolean;
201
+ /**
202
+ * When console or network capture is on, reviewers choose per comment whether to include it.
203
+ * true: the "Include browser errors" box starts checked. Absent or false: unchecked.
204
+ */
205
+ capture_consent_default?: boolean;
186
206
  };
187
207
  appearance: {
188
208
  theme: "auto" | "light" | "dark";
@@ -195,8 +215,17 @@ export interface WidgetConfig {
195
215
  limits: {
196
216
  max_upload_bytes: number;
197
217
  };
218
+ /** First read of a page only: proves a real widget load when reporting the widget's own crash. */
219
+ reporting?: {
220
+ nonce?: string;
221
+ };
222
+ /**
223
+ * remember: keep people signed in on this device after the tab closes (true, the default when absent),
224
+ * or only for this tab (false: the refresh token lives in sessionStorage).
225
+ */
198
226
  auth: {
199
227
  authorize_url: string;
228
+ remember?: boolean;
200
229
  };
201
230
  realtime?: {
202
231
  key: string;
@@ -206,6 +235,11 @@ export interface WidgetConfig {
206
235
  auth_endpoint: string;
207
236
  } | null;
208
237
  }
238
+ export interface Label {
239
+ id: number;
240
+ name: string;
241
+ color: string;
242
+ }
209
243
  export type Position = "bottom-right" | "bottom-left" | "top-right" | "top-left";
210
244
  export interface InboxItem {
211
245
  id: string;
@@ -242,13 +276,23 @@ export interface CommentKitOptions {
242
276
  position?: Position;
243
277
  /** CSS selectors whose content is never captured in screenshots. */
244
278
  redact?: string[];
245
- /** Interface language. Defaults to the browser language. */
279
+ /**
280
+ * Interface language, e.g. "fr" or "pt-BR". Defaults to the page's <html lang>,
281
+ * then the browser language. Built in: en, es, fr, de, pt-BR, it, nl, ja, zh-CN,
282
+ * hi, ar (right to left). Anything else falls back to English.
283
+ */
246
284
  locale?: string;
247
285
  /**
248
286
  * How sign-in opens: "auto" (default) uses a popup on desktop and a full-page
249
287
  * redirect inside in-app browsers or when popups are blocked.
250
288
  */
251
289
  auth?: "auto" | "popup" | "redirect";
290
+ /**
291
+ * Single-key shortcuts while the widget is shown: C to comment, J / K for next or previous,
292
+ * E to resolve, ? for the list. Default true. Set false when your app has its own shortcuts
293
+ * (WCAG 2.1.4). Esc and Cmd/Ctrl+Shift+K keep working.
294
+ */
295
+ shortcuts?: boolean;
252
296
  }
253
297
  export interface CommentKitEvents {
254
298
  ready: {
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * <comment-kit project="pk_live_…" branch="main"></comment-kit>
3
- * Works in any framework or plain HTML.
3
+ * Works in any framework or plain HTML. Attributes: project (required), branch, commit, locale,
4
+ * theme, position, auth, endpoint, deployment-url, hide-on-production="false", shortcuts="false". Changing project
5
+ * restarts the widget.
4
6
  */
5
7
  export declare class CommentKitElement extends HTMLElement {
6
8
  static observedAttributes: string[];
7
9
  private kit;
10
+ attributeChangedCallback(_name: string, before: string | null, after: string | null): void;
8
11
  connectedCallback(): void;
9
12
  disconnectedCallback(): void;
10
13
  }
@@ -1,5 +1,5 @@
1
1
  import { CommentKitClient, SDK_VERSION } from "./core/client.js";
2
- import type { CommentKitEvents, CommentKitOptions, Session } from "./core/types.js";
2
+ import { type CommentKitEvents, type CommentKitOptions, type Session } from "./core/types.js";
3
3
  export type { Anchor, Attachment, Capabilities, CaptureInput, CommentKitEvents, CommentKitOptions, Environment, InboxItem, MarkupShape, Message, Page, Person, Position, Reaction, Session, Thread, ThreadPriority, ThreadStatus, WidgetConfig, } from "./core/types.js";
4
4
  export { CommentKitError } from "./core/types.js";
5
5
  export { SDK_VERSION };
@@ -8,6 +8,8 @@ export interface CommentKit {
8
8
  show(): Promise<void>;
9
9
  /** Hide the widget. Feedback stays on the server. */
10
10
  hide(): void;
11
+ /** Show the widget and open one conversation, by id or reference ("CK-12"). */
12
+ open(thread: string): Promise<void>;
11
13
  /** Open the sign-in window. Call from a click handler. */
12
14
  signIn(): Promise<boolean>;
13
15
  signOut(): Promise<void>;
package/dist/npm/vue.js CHANGED
@@ -1,7 +1,14 @@
1
- import { t as e } from "./chunks/src-DJjfvVsa.js";
1
+ import { t as e } from "./chunks/src-C1Qp94nr.js";
2
2
  import { defineComponent as t, onBeforeUnmount as n, onMounted as r } from "vue";
3
3
  //#region src/adapters/vue.ts
4
- var i = t({
4
+ function i(e) {
5
+ try {
6
+ return e();
7
+ } catch (e) {
8
+ return console.warn("[CommentKit] The widget could not start.", e), null;
9
+ }
10
+ }
11
+ var a = t({
5
12
  name: "CommentKit",
6
13
  props: {
7
14
  project: {
@@ -19,14 +26,46 @@ var i = t({
19
26
  endpoint: {
20
27
  type: String,
21
28
  default: void 0
29
+ },
30
+ deploymentUrl: {
31
+ type: String,
32
+ default: void 0
33
+ },
34
+ hideOnProduction: {
35
+ type: Boolean,
36
+ default: void 0
37
+ },
38
+ theme: {
39
+ type: String,
40
+ default: void 0
41
+ },
42
+ position: {
43
+ type: String,
44
+ default: void 0
45
+ },
46
+ redact: {
47
+ type: Array,
48
+ default: void 0
49
+ },
50
+ locale: {
51
+ type: String,
52
+ default: void 0
53
+ },
54
+ auth: {
55
+ type: String,
56
+ default: void 0
57
+ },
58
+ shortcuts: {
59
+ type: Boolean,
60
+ default: void 0
22
61
  }
23
62
  },
24
63
  setup(t) {
25
- let i = null;
26
- return r(() => i = e({ ...t })), n(() => i?.destroy()), () => null;
64
+ let a = null, o = () => Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0));
65
+ return r(() => a = i(() => e(o()))), n(() => i(() => a?.destroy())), () => null;
27
66
  }
28
- }), a = { install(t, n) {
29
- typeof window < "u" && e(n);
67
+ }), o = { install(t, n) {
68
+ typeof window < "u" && i(() => e(n));
30
69
  } };
31
70
  //#endregion
32
- export { i as CommentKit, a as CommentKitPlugin, e as init };
71
+ export { a as CommentKit, o as CommentKitPlugin, e as init };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commentkit/comment-kit",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0",
4
4
  "description": "Figma-style comments for any website. Clients pin feedback with an automatic screenshot; developers see it on localhost and hand it to their AI agent.",
5
5
  "keywords": [
6
6
  "comments",
@@ -75,14 +75,20 @@
75
75
  "test:watch": "vp test watch",
76
76
  "test:coverage": "vp test run --coverage",
77
77
  "test:e2e": "playwright test",
78
+ "test:visual": "playwright test e2e/specs/visual.spec.ts --project=chromium",
79
+ "test:host-matrix": "node scripts/host-matrix.mjs",
78
80
  "typecheck": "tsc -p tsconfig.json",
79
81
  "check": "npm run typecheck && npm run test && npm run build",
80
82
  "prepublishOnly": "npm run check && node scripts/check-pack.mjs",
81
83
  "ci": "bash scripts/ci.sh",
82
- "contract:sync": "bash scripts/contract-sync.sh"
84
+ "contract:sync": "bash scripts/contract-sync.sh",
85
+ "changeset": "changeset",
86
+ "version": "changeset version",
87
+ "release:status": "changeset status --verbose"
83
88
  },
84
89
  "devDependencies": {
85
90
  "@axe-core/playwright": "4.13.0",
91
+ "@changesets/cli": "3.0.3",
86
92
  "@playwright/test": "1.64.1",
87
93
  "@types/react": "19.3.0",
88
94
  "@vitest/coverage-v8": "5.0.5",