@commentkit/comment-kit 0.7.6 → 1.0.0-beta.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.
- package/CHANGELOG.md +30 -0
- package/README.md +108 -762
- package/SECURITY.md +19 -14
- package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
- package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
- package/dist/npm/chunks/client-D1vrh_5G.js +590 -0
- package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
- package/dist/npm/chunks/html2canvas-_mjSRP3G.js +4011 -0
- package/dist/npm/chunks/mount-Ce1MZrcm.js +2485 -0
- package/dist/{shared/pusher-BUaiCkDJ.js → npm/chunks/pusher-DRKlokR8.js} +224 -222
- package/dist/npm/chunks/realtime-5SvAvTUU.js +23 -0
- package/dist/npm/chunks/rolldown-runtime-VHNaYcLd.js +13 -0
- package/dist/npm/chunks/src-DJjfvVsa.js +330 -0
- package/dist/npm/element.js +24 -0
- package/dist/npm/headless.js +3 -0
- package/dist/npm/index.js +3 -0
- package/dist/npm/react.js +17 -0
- package/dist/npm/svelte.js +8 -0
- package/dist/npm/types/adapters/react.d.ts +9 -0
- package/dist/npm/types/adapters/svelte.d.ts +9 -0
- package/dist/npm/types/adapters/vue.d.ts +46 -0
- package/dist/npm/types/anchor/index.d.ts +49 -0
- package/dist/npm/types/core/api.d.ts +29 -0
- package/dist/npm/types/core/auth.d.ts +48 -0
- package/dist/npm/types/core/client.d.ts +100 -0
- package/dist/npm/types/core/store.d.ts +7 -0
- package/dist/npm/types/core/types.d.ts +278 -0
- package/dist/npm/types/element.d.ts +10 -0
- package/dist/npm/types/headless.d.ts +7 -0
- package/dist/npm/types/index.d.ts +30 -0
- package/dist/npm/vue.js +32 -0
- package/package.json +65 -173
- package/dist/THIRD_PARTY_NOTICES.txt +0 -284
- package/dist/angular.es.js +0 -321
- package/dist/comment-kit.es.js +0 -218
- package/dist/demo.es.js +0 -483
- package/dist/headless.es.js +0 -4
- package/dist/preact.es.js +0 -117
- package/dist/qwik.es.js +0 -1
- package/dist/qwik.qwik.mjs +0 -114
- package/dist/react.es.js +0 -98
- package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
- package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
- package/dist/shared/annotation-toolbar-RSrb0Nku.js +0 -1086
- package/dist/shared/attachment-refresh-CSTYwRW-.js +0 -94
- package/dist/shared/bridge-CJoGYngu.js +0 -177
- package/dist/shared/button-D4GHW6oZ.js +0 -474
- package/dist/shared/button-group-BVR7iT-S.js +0 -91
- package/dist/shared/capture-privacy-DUROnio5.js +0 -77
- package/dist/shared/comment-drawing-canvas-DbuXP54N.js +0 -124
- package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
- package/dist/shared/comment-image-lightbox-zlIGEVA-.js +0 -190
- package/dist/shared/comment-images-content-aYbJb79_.js +0 -214
- package/dist/shared/comment-kit-core-B0k7XsMz.js +0 -3680
- package/dist/shared/comment-kit-ui-BXLJcZYQ.js +0 -19391
- package/dist/shared/comment-screenshot-annotator-ChWwYJzO.js +0 -151
- package/dist/shared/comment-screenshot-overlay-Bufg3rHz.js +0 -205
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
- package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
- package/dist/shared/dev-export-panel-DAZenvgD.js +0 -207
- package/dist/shared/dev-grab-O8q25zar.js +0 -197
- package/dist/shared/dist-D9A5k-N4.js +0 -617
- package/dist/shared/dom-Bhf4WFtY.js +0 -223
- package/dist/shared/element-selector-CYkwzfEr.js +0 -902
- package/dist/shared/error-boundary-D3PD74vI.js +0 -21
- package/dist/shared/errors-Bu5ajEmB.js +0 -22
- package/dist/shared/icons-nzMOLzrm.js +0 -266
- package/dist/shared/input-UPtAj0M6.js +0 -111
- package/dist/shared/mount-ui-BKaWBhKq.js +0 -208
- package/dist/shared/realtime-C0Z8dXXH.js +0 -334
- package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
- package/dist/shared/request-activity-DQrAUwfA.js +0 -11
- package/dist/shared/screenshot-B-ZfFItT.js +0 -199
- package/dist/shared/separator-UhJb0Row.js +0 -3955
- package/dist/shared/shadow-root-Cd3SLHyj.js +0 -133
- package/dist/shared/styles-CnYsLS2f.js +0 -2
- package/dist/shared/text-B4HHZNaa.js +0 -23
- package/dist/shared/token-session-DplW5QDx.js +0 -25
- package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
- package/dist/shared/useRender-Uxk1OPK-.js +0 -5
- package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
- package/dist/shared/validation-3wbbbuX0.js +0 -70
- package/dist/shared/websocket-manager-798cRDyL.js +0 -381
- package/dist/solid.es.js +0 -98
- package/dist/svelte.es.js +0 -130
- package/dist/types/adapters/bridge.d.ts +0 -122
- package/dist/types/angular/index.d.ts +0 -145
- package/dist/types/core/agent-context.d.ts +0 -17
- package/dist/types/core/api-client.d.ts +0 -155
- package/dist/types/core/comment-kit-core.d.ts +0 -254
- package/dist/types/core/local-demo.d.ts +0 -60
- package/dist/types/core/types.d.ts +0 -770
- package/dist/types/core/websocket-manager.d.ts +0 -125
- package/dist/types/core/write-access.d.ts +0 -11
- package/dist/types/demo.d.ts +0 -17
- package/dist/types/headless.d.ts +0 -8
- package/dist/types/index.d.ts +0 -87
- package/dist/types/preact/index.d.ts +0 -25
- package/dist/types/qwik/index.d.ts +0 -73
- package/dist/types/react/client.d.ts +0 -31
- package/dist/types/react/index.d.ts +0 -4
- package/dist/types/solid/index.d.ts +0 -37
- package/dist/types/svelte/index.d.ts +0 -55
- package/dist/types/utils/dom.d.ts +0 -59
- package/dist/types/utils/event-emitter.d.ts +0 -11
- package/dist/types/vue/index.d.ts +0 -87
- package/dist/vue.es.js +0 -148
- package/docs/api-reference.md +0 -405
- package/docs/local-demo.md +0 -60
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ApiClient } from "./api.js";
|
|
2
|
+
import { AuthManager, type SignInResult } from "./auth.js";
|
|
3
|
+
import { type Store } from "./store.js";
|
|
4
|
+
import type { Anchor, Attachment, CaptureInput, CommentKitEvents, CommentKitOptions, InboxItem, Message, Page, Person, Session, Thread, ThreadPriority, ThreadStatus, WidgetConfig } from "./types.js";
|
|
5
|
+
import { CommentKitError } from "./types.js";
|
|
6
|
+
export declare const SDK_VERSION: string;
|
|
7
|
+
export declare const DEFAULT_ENDPOINT = "https://commentkit.dev";
|
|
8
|
+
export interface ClientState {
|
|
9
|
+
config: WidgetConfig | null;
|
|
10
|
+
session: Session | null;
|
|
11
|
+
/** Threads on the current page, newest activity first. */
|
|
12
|
+
threads: Thread[];
|
|
13
|
+
loadingThreads: boolean;
|
|
14
|
+
/** Show feedback from every branch, not only the one this build came from. */
|
|
15
|
+
allBranches: boolean;
|
|
16
|
+
unread: number;
|
|
17
|
+
online: boolean;
|
|
18
|
+
error: CommentKitError | null;
|
|
19
|
+
}
|
|
20
|
+
type Listener<K extends keyof CommentKitEvents> = (payload: CommentKitEvents[K]) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Everything the widget needs from the server, independent of any UI.
|
|
23
|
+
* Also usable headless (custom UIs, tests, browser extensions).
|
|
24
|
+
*/
|
|
25
|
+
export declare class CommentKitClient {
|
|
26
|
+
readonly options: CommentKitOptions;
|
|
27
|
+
readonly auth: AuthManager;
|
|
28
|
+
readonly api: ApiClient;
|
|
29
|
+
readonly state: Store<ClientState>;
|
|
30
|
+
private listeners;
|
|
31
|
+
private realtime;
|
|
32
|
+
constructor(options: CommentKitOptions);
|
|
33
|
+
on<K extends keyof CommentKitEvents>(event: K, listener: Listener<K>): () => void;
|
|
34
|
+
emit<K extends keyof CommentKitEvents>(event: K, payload: CommentKitEvents[K]): void;
|
|
35
|
+
loadConfig(): Promise<WidgetConfig>;
|
|
36
|
+
loadSession(): Promise<Session | null>;
|
|
37
|
+
signIn(share?: string | null): Promise<SignInResult>;
|
|
38
|
+
signOut(): Promise<void>;
|
|
39
|
+
loadPageThreads(pageUrl?: string): Promise<Thread[]>;
|
|
40
|
+
/** The branch lists are limited to: this build's branch, unless "All branches" is on. */
|
|
41
|
+
branchFilter(): string | undefined;
|
|
42
|
+
/** Switch between this branch and all branches, and reload the page's feedback. */
|
|
43
|
+
setAllBranches(on: boolean): Promise<Thread[]>;
|
|
44
|
+
listThreads(query?: {
|
|
45
|
+
status?: string;
|
|
46
|
+
q?: string;
|
|
47
|
+
assignee?: string;
|
|
48
|
+
branch?: string;
|
|
49
|
+
cursor?: string;
|
|
50
|
+
limit?: number;
|
|
51
|
+
sort?: string;
|
|
52
|
+
}): Promise<Page<Thread>>;
|
|
53
|
+
getThread(id: string): Promise<Thread>;
|
|
54
|
+
createThread(input: {
|
|
55
|
+
anchor: Anchor;
|
|
56
|
+
body: string;
|
|
57
|
+
capture?: CaptureInput | null;
|
|
58
|
+
attachmentIds?: string[];
|
|
59
|
+
mentionIds?: number[];
|
|
60
|
+
}): Promise<Thread>;
|
|
61
|
+
updateThread(id: string, changes: {
|
|
62
|
+
status?: ThreadStatus;
|
|
63
|
+
priority?: ThreadPriority;
|
|
64
|
+
assignee_id?: number | null;
|
|
65
|
+
}): Promise<Thread>;
|
|
66
|
+
deleteThread(id: string): Promise<void>;
|
|
67
|
+
messages(threadId: string, cursor?: string): Promise<Page<Message>>;
|
|
68
|
+
reply(threadId: string, body: string, options?: {
|
|
69
|
+
replyTo?: string | null;
|
|
70
|
+
attachmentIds?: string[];
|
|
71
|
+
mentionIds?: number[];
|
|
72
|
+
}): Promise<Message>;
|
|
73
|
+
editMessage(id: string, body: string): Promise<Message>;
|
|
74
|
+
deleteMessage(id: string): Promise<void>;
|
|
75
|
+
react(messageId: string, emoji: string, on: boolean): Promise<void>;
|
|
76
|
+
watch(threadId: string, on: boolean): Promise<{
|
|
77
|
+
watching: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
people(): Promise<(Person & {
|
|
80
|
+
assignable: boolean;
|
|
81
|
+
})[]>;
|
|
82
|
+
inbox(): Promise<InboxItem[]>;
|
|
83
|
+
markRead(input: {
|
|
84
|
+
ids?: string[];
|
|
85
|
+
threadId?: string;
|
|
86
|
+
all?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
upload(file: Blob, name: string, kind?: "screenshot" | "file"): Promise<Attachment>;
|
|
89
|
+
connectRealtime(onChange: (event: {
|
|
90
|
+
type: string;
|
|
91
|
+
thread_id: string;
|
|
92
|
+
actor: string | null;
|
|
93
|
+
}) => void): Promise<void>;
|
|
94
|
+
refreshThread(id: string): Promise<void>;
|
|
95
|
+
private upsert;
|
|
96
|
+
destroy(): void;
|
|
97
|
+
}
|
|
98
|
+
/** Page identity: origin + path + query + hash routes, without our own params. */
|
|
99
|
+
export declare function currentPageUrl(): string;
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A tiny observable store. Enough for the widget; no framework required. */
|
|
2
|
+
export interface Store<T> {
|
|
3
|
+
get(): T;
|
|
4
|
+
set(next: Partial<T> | ((prev: T) => Partial<T>)): void;
|
|
5
|
+
subscribe(listener: (state: T) => void): () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createStore<T extends object>(initial: T): Store<T>;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types of the CommentKit v1 browser SDK. They mirror the /api/v1
|
|
3
|
+
* contract (openapi/v1.yaml in the API repo).
|
|
4
|
+
*/
|
|
5
|
+
export type ThreadStatus = "open" | "in_progress" | "in_review" | "resolved" | "closed";
|
|
6
|
+
export type ThreadPriority = "none" | "low" | "medium" | "high" | "urgent";
|
|
7
|
+
export type Environment = "development" | "preview" | "staging" | "production";
|
|
8
|
+
export interface Person {
|
|
9
|
+
type: "user" | "guest" | "agent" | "integration" | "system" | "deleted";
|
|
10
|
+
id: string | null;
|
|
11
|
+
name: string;
|
|
12
|
+
avatar_url: string | null;
|
|
13
|
+
}
|
|
14
|
+
/** Where feedback points. Several strategies are stored so it can be found again after the page changes. */
|
|
15
|
+
export interface Anchor {
|
|
16
|
+
type: "element" | "region" | "text" | "page";
|
|
17
|
+
/** Build-time source location (data-ck-src), e.g. "src/Hero.tsx:12:4". */
|
|
18
|
+
source?: string | null;
|
|
19
|
+
/** Developer-provided stable id (data-ck-id). */
|
|
20
|
+
ck_id?: string | null;
|
|
21
|
+
selector?: string | null;
|
|
22
|
+
xpath?: string | null;
|
|
23
|
+
/** Normalized text of the element and its neighbours. */
|
|
24
|
+
fingerprint?: string | null;
|
|
25
|
+
/** Selected text for text anchors. */
|
|
26
|
+
quote?: string | null;
|
|
27
|
+
/** Click point relative to the element box (0..1). */
|
|
28
|
+
offset?: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
} | null;
|
|
32
|
+
/** Region relative to the element box (0..1). */
|
|
33
|
+
rect?: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
w: number;
|
|
37
|
+
h: number;
|
|
38
|
+
} | null;
|
|
39
|
+
/** Fallback: x in % of document width, y in px from document top. */
|
|
40
|
+
page: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface Attachment {
|
|
46
|
+
id: string;
|
|
47
|
+
kind: "screenshot" | "file";
|
|
48
|
+
name: string;
|
|
49
|
+
mime: string;
|
|
50
|
+
bytes: number;
|
|
51
|
+
width: number | null;
|
|
52
|
+
height: number | null;
|
|
53
|
+
status: "pending" | "processing" | "ready" | "rejected";
|
|
54
|
+
url: string | null;
|
|
55
|
+
thumbnail_url: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface Reaction {
|
|
58
|
+
emoji: string;
|
|
59
|
+
count: number;
|
|
60
|
+
mine: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface Message {
|
|
63
|
+
id: string;
|
|
64
|
+
thread_id: string;
|
|
65
|
+
author: Person;
|
|
66
|
+
body: string;
|
|
67
|
+
source: string;
|
|
68
|
+
reply_to?: {
|
|
69
|
+
id: string;
|
|
70
|
+
author: Person;
|
|
71
|
+
excerpt: string;
|
|
72
|
+
} | null;
|
|
73
|
+
attachments?: Attachment[];
|
|
74
|
+
reactions?: Reaction[];
|
|
75
|
+
edited_at: string | null;
|
|
76
|
+
created_at: string;
|
|
77
|
+
}
|
|
78
|
+
export interface MarkupShape {
|
|
79
|
+
tool: "arrow" | "rect" | "pen" | "blur" | "text";
|
|
80
|
+
color?: string | null;
|
|
81
|
+
points?: number[] | null;
|
|
82
|
+
text?: string | null;
|
|
83
|
+
}
|
|
84
|
+
export interface CaptureInput {
|
|
85
|
+
screenshot_id?: string | null;
|
|
86
|
+
viewport: {
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
dpr?: number | null;
|
|
90
|
+
zoom?: number | null;
|
|
91
|
+
};
|
|
92
|
+
device: {
|
|
93
|
+
browser?: string | null;
|
|
94
|
+
browser_version?: string | null;
|
|
95
|
+
os?: string | null;
|
|
96
|
+
os_version?: string | null;
|
|
97
|
+
type?: "desktop" | "tablet" | "mobile" | null;
|
|
98
|
+
locale?: string | null;
|
|
99
|
+
color_scheme?: "light" | "dark" | null;
|
|
100
|
+
user_agent?: string | null;
|
|
101
|
+
};
|
|
102
|
+
console?: {
|
|
103
|
+
level: "error" | "warn";
|
|
104
|
+
message: string;
|
|
105
|
+
at?: string | null;
|
|
106
|
+
}[] | null;
|
|
107
|
+
network?: {
|
|
108
|
+
method: string;
|
|
109
|
+
url: string;
|
|
110
|
+
status: number;
|
|
111
|
+
duration_ms?: number | null;
|
|
112
|
+
}[] | null;
|
|
113
|
+
markup?: MarkupShape[] | null;
|
|
114
|
+
}
|
|
115
|
+
export interface Thread {
|
|
116
|
+
id: string;
|
|
117
|
+
number: number;
|
|
118
|
+
reference: string;
|
|
119
|
+
status: ThreadStatus;
|
|
120
|
+
priority: ThreadPriority;
|
|
121
|
+
assignee: Person | null;
|
|
122
|
+
due_at: string | null;
|
|
123
|
+
labels?: {
|
|
124
|
+
id: number;
|
|
125
|
+
name: string;
|
|
126
|
+
color: string;
|
|
127
|
+
}[];
|
|
128
|
+
page: {
|
|
129
|
+
url: string;
|
|
130
|
+
path: string;
|
|
131
|
+
title: string | null;
|
|
132
|
+
environment: Environment;
|
|
133
|
+
branch: string | null;
|
|
134
|
+
commit_sha: string | null;
|
|
135
|
+
deployment_url: string | null;
|
|
136
|
+
};
|
|
137
|
+
anchor: Anchor;
|
|
138
|
+
breakpoint: number | null;
|
|
139
|
+
author: Person;
|
|
140
|
+
message_count: number;
|
|
141
|
+
first_message?: Message;
|
|
142
|
+
capture?: {
|
|
143
|
+
screenshot: Attachment | null;
|
|
144
|
+
markup: MarkupShape[] | null;
|
|
145
|
+
viewport: CaptureInput["viewport"];
|
|
146
|
+
device: CaptureInput["device"];
|
|
147
|
+
console: CaptureInput["console"] | null;
|
|
148
|
+
network: CaptureInput["network"] | null;
|
|
149
|
+
} | null;
|
|
150
|
+
last_activity_at: string;
|
|
151
|
+
resolved_at: string | null;
|
|
152
|
+
closed_at: string | null;
|
|
153
|
+
created_at: string;
|
|
154
|
+
updated_at: string;
|
|
155
|
+
}
|
|
156
|
+
export interface Capabilities {
|
|
157
|
+
comment: boolean;
|
|
158
|
+
triage: boolean;
|
|
159
|
+
set_any_status: boolean;
|
|
160
|
+
manage: boolean;
|
|
161
|
+
export_for_agents: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface Session {
|
|
164
|
+
person: Person;
|
|
165
|
+
role: "admin" | "member" | "reviewer" | "guest";
|
|
166
|
+
project: {
|
|
167
|
+
id: string;
|
|
168
|
+
name: string;
|
|
169
|
+
};
|
|
170
|
+
environment: Environment;
|
|
171
|
+
capabilities: Capabilities;
|
|
172
|
+
}
|
|
173
|
+
export interface WidgetConfig {
|
|
174
|
+
project: {
|
|
175
|
+
name: string;
|
|
176
|
+
};
|
|
177
|
+
enabled: boolean;
|
|
178
|
+
read_only: boolean;
|
|
179
|
+
environment: Environment;
|
|
180
|
+
local_only_for_members: boolean;
|
|
181
|
+
features: {
|
|
182
|
+
screenshots: boolean;
|
|
183
|
+
realtime: boolean;
|
|
184
|
+
console_capture: boolean;
|
|
185
|
+
network_capture: boolean;
|
|
186
|
+
};
|
|
187
|
+
appearance: {
|
|
188
|
+
theme: "auto" | "light" | "dark";
|
|
189
|
+
position: Position;
|
|
190
|
+
accent: string | null;
|
|
191
|
+
};
|
|
192
|
+
privacy: {
|
|
193
|
+
redact_selectors: string[];
|
|
194
|
+
};
|
|
195
|
+
limits: {
|
|
196
|
+
max_upload_bytes: number;
|
|
197
|
+
};
|
|
198
|
+
auth: {
|
|
199
|
+
authorize_url: string;
|
|
200
|
+
};
|
|
201
|
+
realtime?: {
|
|
202
|
+
key: string;
|
|
203
|
+
host: string;
|
|
204
|
+
port: number;
|
|
205
|
+
scheme: "http" | "https";
|
|
206
|
+
auth_endpoint: string;
|
|
207
|
+
} | null;
|
|
208
|
+
}
|
|
209
|
+
export type Position = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
210
|
+
export interface InboxItem {
|
|
211
|
+
id: string;
|
|
212
|
+
kind: string;
|
|
213
|
+
actor: Person;
|
|
214
|
+
thread_id: string;
|
|
215
|
+
reference: string | null;
|
|
216
|
+
excerpt: string | null;
|
|
217
|
+
page_url: string | null;
|
|
218
|
+
read: boolean;
|
|
219
|
+
created_at: string;
|
|
220
|
+
}
|
|
221
|
+
export interface Page<T> {
|
|
222
|
+
data: T[];
|
|
223
|
+
next_cursor: string | null;
|
|
224
|
+
}
|
|
225
|
+
/** The only options a site owner needs. Everything else is configured in the dashboard. */
|
|
226
|
+
export interface CommentKitOptions {
|
|
227
|
+
/** Publishable project key, pk_live_… or pk_test_… */
|
|
228
|
+
project: string;
|
|
229
|
+
/** Deployment branch, so developers can filter feedback per branch. */
|
|
230
|
+
branch?: string | null;
|
|
231
|
+
/** Deployment commit SHA. */
|
|
232
|
+
commit?: string | null;
|
|
233
|
+
/** Preview deployment URL, if any. */
|
|
234
|
+
deploymentUrl?: string | null;
|
|
235
|
+
/** Override the CommentKit server (self-hosting, staging). */
|
|
236
|
+
endpoint?: string;
|
|
237
|
+
/** Start without showing the launcher on non-local sites until Cmd/Ctrl+Shift+K. Default true. */
|
|
238
|
+
hideOnProduction?: boolean;
|
|
239
|
+
/** Force a color scheme. Defaults to the dashboard setting. */
|
|
240
|
+
theme?: "auto" | "light" | "dark";
|
|
241
|
+
/** Where the launcher sits. Defaults to the dashboard setting. */
|
|
242
|
+
position?: Position;
|
|
243
|
+
/** CSS selectors whose content is never captured in screenshots. */
|
|
244
|
+
redact?: string[];
|
|
245
|
+
/** Interface language. Defaults to the browser language. */
|
|
246
|
+
locale?: string;
|
|
247
|
+
/**
|
|
248
|
+
* How sign-in opens: "auto" (default) uses a popup on desktop and a full-page
|
|
249
|
+
* redirect inside in-app browsers or when popups are blocked.
|
|
250
|
+
*/
|
|
251
|
+
auth?: "auto" | "popup" | "redirect";
|
|
252
|
+
}
|
|
253
|
+
export interface CommentKitEvents {
|
|
254
|
+
ready: {
|
|
255
|
+
session: Session | null;
|
|
256
|
+
};
|
|
257
|
+
"session:change": {
|
|
258
|
+
session: Session | null;
|
|
259
|
+
};
|
|
260
|
+
"thread:created": {
|
|
261
|
+
thread: Thread;
|
|
262
|
+
};
|
|
263
|
+
"thread:updated": {
|
|
264
|
+
thread: Thread;
|
|
265
|
+
};
|
|
266
|
+
"message:created": {
|
|
267
|
+
message: Message;
|
|
268
|
+
};
|
|
269
|
+
error: {
|
|
270
|
+
error: CommentKitError;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
export declare class CommentKitError extends Error {
|
|
274
|
+
readonly status: number;
|
|
275
|
+
readonly code: string;
|
|
276
|
+
readonly errors?: Record<string, string[]> | undefined;
|
|
277
|
+
constructor(status: number, code: string, message: string, errors?: Record<string, string[]> | undefined);
|
|
278
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <comment-kit project="pk_live_…" branch="main"></comment-kit>
|
|
3
|
+
* Works in any framework or plain HTML.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CommentKitElement extends HTMLElement {
|
|
6
|
+
static observedAttributes: string[];
|
|
7
|
+
private kit;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Headless client for custom UIs, extensions and tests. No UI, no globals. */
|
|
2
|
+
export { CommentKitClient, currentPageUrl, SDK_VERSION } from "./core/client.js";
|
|
3
|
+
export { ApiClient } from "./core/api.js";
|
|
4
|
+
export { AuthManager } from "./core/auth.js";
|
|
5
|
+
export { createAnchor, resolveAnchor, stableSelector } from "./anchor/index.js";
|
|
6
|
+
export type * from "./core/types.js";
|
|
7
|
+
export { CommentKitError } from "./core/types.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CommentKitClient, SDK_VERSION } from "./core/client.js";
|
|
2
|
+
import type { CommentKitEvents, CommentKitOptions, Session } from "./core/types.js";
|
|
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
|
+
export { CommentKitError } from "./core/types.js";
|
|
5
|
+
export { SDK_VERSION };
|
|
6
|
+
export interface CommentKit {
|
|
7
|
+
/** Show the widget (same as pressing Cmd/Ctrl+Shift+K). */
|
|
8
|
+
show(): Promise<void>;
|
|
9
|
+
/** Hide the widget. Feedback stays on the server. */
|
|
10
|
+
hide(): void;
|
|
11
|
+
/** Open the sign-in window. Call from a click handler. */
|
|
12
|
+
signIn(): Promise<boolean>;
|
|
13
|
+
signOut(): Promise<void>;
|
|
14
|
+
/** Current person, if signed in. */
|
|
15
|
+
session(): Session | null;
|
|
16
|
+
on<K extends keyof CommentKitEvents>(event: K, listener: (payload: CommentKitEvents[K]) => void): () => void;
|
|
17
|
+
/** Remove the widget and every listener from the page. */
|
|
18
|
+
destroy(): void;
|
|
19
|
+
readonly client: CommentKitClient;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Add CommentKit to any website:
|
|
23
|
+
*
|
|
24
|
+
* import { init } from "@commentkit/comment-kit";
|
|
25
|
+
* init({ project: "pk_live_…" });
|
|
26
|
+
*
|
|
27
|
+
* Safe to call more than once: later calls return the same instance.
|
|
28
|
+
* Never throws into the host page.
|
|
29
|
+
*/
|
|
30
|
+
export declare function init(input: CommentKitOptions): CommentKit;
|
package/dist/npm/vue.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as e } from "./chunks/src-DJjfvVsa.js";
|
|
2
|
+
import { defineComponent as t, onBeforeUnmount as n, onMounted as r } from "vue";
|
|
3
|
+
//#region src/adapters/vue.ts
|
|
4
|
+
var i = t({
|
|
5
|
+
name: "CommentKit",
|
|
6
|
+
props: {
|
|
7
|
+
project: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: !0
|
|
10
|
+
},
|
|
11
|
+
branch: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: null
|
|
14
|
+
},
|
|
15
|
+
commit: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
endpoint: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: void 0
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(t) {
|
|
25
|
+
let i = null;
|
|
26
|
+
return r(() => i = e({ ...t })), n(() => i?.destroy()), () => null;
|
|
27
|
+
}
|
|
28
|
+
}), a = { install(t, n) {
|
|
29
|
+
typeof window < "u" && e(n);
|
|
30
|
+
} };
|
|
31
|
+
//#endregion
|
|
32
|
+
export { i as CommentKit, a as CommentKitPlugin, e as init };
|