@commentkit/comment-kit 1.0.1 → 1.5.1
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 +129 -1
- package/README.md +12 -5
- package/SECURITY.md +3 -1
- package/dist/npm/THIRD_PARTY_NOTICES.txt +22 -23
- package/dist/npm/chunks/AgentSend-DjFZSC0S.js +64 -0
- package/dist/npm/chunks/Checklist-BEz4IZdT.js +259 -0
- package/dist/npm/chunks/Composer-D1wbmdjF.js +681 -0
- package/dist/npm/chunks/Guest-CtyRy8Kz.js +170 -0
- package/dist/npm/chunks/MarkupEditor-CPH4yKx4.js +334 -0
- package/dist/npm/chunks/Panel-DSoUAlbQ.js +863 -0
- package/dist/npm/chunks/Settings-C_qV4n7J.js +206 -0
- package/dist/npm/chunks/{Shortcuts-3AOERWBh.js → Shortcuts-ChnaribX.js} +21 -17
- package/dist/npm/chunks/StyleEditor-DqZd6C5o.js +44 -0
- package/dist/npm/chunks/StylePanel-DMC3riYK.js +199 -0
- package/dist/npm/chunks/TaskFields-BfjjllMx.js +272 -0
- package/dist/npm/chunks/ThreadCard-DmKAelSL.js +1026 -0
- package/dist/npm/chunks/Viewer-mw69qSI5.js +110 -0
- package/dist/npm/chunks/agent-CqDO3JMA.js +146 -0
- package/dist/npm/chunks/anchor-OCQnjp_6.js +294 -0
- package/dist/npm/chunks/{ar-BVQ4ToG2.js → ar-BQ9K9Oqf.js} +188 -7
- package/dist/npm/chunks/card-bits-C7bIk5KX.js +126 -0
- package/dist/npm/chunks/client-dZeNdizE.js +754 -0
- package/dist/npm/chunks/colors-CAjY4jxf.js +137 -0
- package/dist/npm/chunks/confetti-DKeKR7-6.js +41 -0
- package/dist/npm/chunks/{de-CamSq76K.js → de-CcPi8xdC.js} +159 -7
- package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
- package/dist/npm/chunks/{es-BBIlcnsU.js → es-DXgkjDCG.js} +159 -7
- package/dist/npm/chunks/extension-BFkXOmX5.js +50 -0
- package/dist/npm/chunks/{extension-CLm_T7Vj.js → extension-Gvei3opb.js} +2 -2
- package/dist/npm/chunks/{fr-BXsff0Zz.js → fr-IjJaUbWh.js} +159 -7
- package/dist/npm/chunks/{hi-y-APBuxh.js → hi-BhKQK2MU.js} +159 -7
- package/dist/npm/chunks/html2canvas-pro.esm-lgs6tb4C.js +8378 -0
- package/dist/npm/chunks/i18n-DAJGndZ2.js +904 -0
- package/dist/npm/chunks/{it-C5MH_Ktv.js → it-DKiSCkiD.js} +159 -7
- package/dist/npm/chunks/{ja-s1JJld2J.js → ja-BI1WagDg.js} +159 -7
- package/dist/npm/chunks/{live-CkVrNM1-.js → live-MvvBdoGd.js} +1 -1
- package/dist/npm/chunks/lock-C82sC17d.js +30 -0
- package/dist/npm/chunks/{nl-CFzRMEfl.js → nl-CJw3VUQ5.js} +159 -7
- package/dist/npm/chunks/pick-dDDLxCDI.js +120 -0
- package/dist/npm/chunks/{pt-BR-DE_r-5UM.js → pt-BR-CjBolC5g.js} +159 -7
- package/dist/npm/chunks/{pusher-BSsQoE1K.js → realtime-D22tI_AS.js} +58 -4
- package/dist/npm/chunks/source-BQS2_xfB.js +146 -0
- package/dist/npm/chunks/src-C_oUnL0i.js +150 -0
- package/dist/npm/chunks/start-C5-rebEU.js +1783 -0
- package/dist/npm/chunks/upload-CzPAjktW.js +42 -0
- package/dist/npm/chunks/uploads-tpLjiJdH.js +541 -0
- package/dist/npm/chunks/{zh-CN--gibO2l7.js → zh-CN-BrZGx2S0.js} +159 -7
- package/dist/npm/element.js +4 -5
- package/dist/npm/headless.js +3 -3
- package/dist/npm/index.js +2 -2
- package/dist/npm/react.js +1 -1
- package/dist/npm/svelte.js +1 -1
- package/dist/npm/types/adapters/vue.d.ts +14 -0
- package/dist/npm/types/anchor/index.d.ts +22 -1
- package/dist/npm/types/core/api.d.ts +3 -0
- package/dist/npm/types/core/auth.d.ts +11 -0
- package/dist/npm/types/core/client.d.ts +128 -6
- package/dist/npm/types/core/types.d.ts +78 -4
- package/dist/npm/types/headless.d.ts +1 -1
- package/dist/npm/types/index.d.ts +6 -1
- package/dist/npm/vue.js +5 -1
- package/package.json +6 -3
- package/dist/npm/chunks/Guest-CdfnuD8T.js +0 -157
- package/dist/npm/chunks/MarkupEditor-Clb17Tse.js +0 -199
- package/dist/npm/chunks/Panel-CgvEbZXr.js +0 -438
- package/dist/npm/chunks/ThreadCard-DuGKe-gE.js +0 -817
- package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
- package/dist/npm/chunks/art-Bn9_ANNS.js +0 -155
- package/dist/npm/chunks/client-CS5oL_LQ.js +0 -620
- package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
- package/dist/npm/chunks/extension-DWHHer7j.js +0 -26
- package/dist/npm/chunks/format-CP2xZaec.js +0 -524
- package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
- package/dist/npm/chunks/mount-VmnAiANB.js +0 -1507
- package/dist/npm/chunks/privacy-DLhezjyi.js +0 -30
- package/dist/npm/chunks/realtime-CBRW9BB3.js +0 -34
- package/dist/npm/chunks/src-DG8ehgE9.js +0 -549
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public types of the CommentKit v1 browser SDK. They mirror the /api/v1
|
|
3
|
-
* contract
|
|
3
|
+
* contract: openapi/v1.yaml in the API repo, copied here as contract/openapi-v1.yaml.
|
|
4
4
|
*/
|
|
5
5
|
export type ThreadStatus = "open" | "in_progress" | "in_review" | "resolved" | "closed";
|
|
6
6
|
export type ThreadPriority = "none" | "low" | "medium" | "high" | "urgent";
|
|
@@ -14,8 +14,25 @@ export interface Person {
|
|
|
14
14
|
/** Where feedback points. Several strategies are stored so it can be found again after the page changes. */
|
|
15
15
|
export interface Anchor {
|
|
16
16
|
type: "element" | "region" | "text" | "page";
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Source location, e.g. "src/Hero.tsx:12:4": from data-ck-src (build plugin), or in development
|
|
19
|
+
* builds without it, read from the framework's dev data (React, Vue, Svelte, Preact).
|
|
20
|
+
*/
|
|
18
21
|
source?: string | null;
|
|
22
|
+
/** Component that rendered the element, in development builds (e.g. "PricingCard"). At most 120 characters. */
|
|
23
|
+
component?: string | null;
|
|
24
|
+
/** Open shadow roots the element is inside: each host's selector, outermost first. */
|
|
25
|
+
shadow_path?: string[] | null;
|
|
26
|
+
/** Selector of the same-origin iframe the element is inside (in the top page). */
|
|
27
|
+
frame?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The way through nested same-origin iframes (depth 2 to 4), or through an iframe that sits in a
|
|
30
|
+
* shadow root: one hop per iframe, outermost first. A hop is the iframe's selector in its document,
|
|
31
|
+
* after the selectors of any open shadow hosts around it, joined by " >>> " (e.g.
|
|
32
|
+
* "#app >>> iframe#editor"). `shadow_path` is then the shadow hosts inside the innermost iframe.
|
|
33
|
+
* When set, `frame` repeats the first hop if that is a plain selector, for readers of the one-level field.
|
|
34
|
+
*/
|
|
35
|
+
frames?: string[] | null;
|
|
19
36
|
/** Developer-provided stable id (data-ck-id). */
|
|
20
37
|
ck_id?: string | null;
|
|
21
38
|
selector?: string | null;
|
|
@@ -72,12 +89,33 @@ export interface Message {
|
|
|
72
89
|
} | null;
|
|
73
90
|
attachments?: Attachment[];
|
|
74
91
|
reactions?: Reaction[];
|
|
92
|
+
/** Version of this message: sent back as If-Match when editing it (older servers leave it out). */
|
|
93
|
+
etag?: string;
|
|
75
94
|
edited_at: string | null;
|
|
76
95
|
created_at: string;
|
|
77
96
|
}
|
|
97
|
+
/** Fields team members (capabilities.triage) can set while writing; the server ignores them for anyone else. */
|
|
98
|
+
export interface TaskInput {
|
|
99
|
+
priority?: ThreadPriority;
|
|
100
|
+
assignee_id?: number | null;
|
|
101
|
+
/** Several people; the first is the primary. */
|
|
102
|
+
assignee_ids?: number[];
|
|
103
|
+
label_ids?: number[];
|
|
104
|
+
}
|
|
105
|
+
/** A CSS property a reviewer may suggest a new value for (the composer's "Adjust style" panel). */
|
|
106
|
+
export type StyleProperty = "font-size" | "font-weight" | "line-height" | "letter-spacing" | "text-align" | "color" | "background-color" | "border-color" | "border-width" | "border-style" | "border-radius" | "opacity" | "margin" | "padding" | "width" | "height" | "gap" | "display";
|
|
107
|
+
/** One suggested style change on the commented element. `to: null` means "remove this value". */
|
|
108
|
+
export interface StyleChange {
|
|
109
|
+
property: StyleProperty;
|
|
110
|
+
/** The value on the page when it was suggested. */
|
|
111
|
+
from?: string | null;
|
|
112
|
+
to: string | null;
|
|
113
|
+
}
|
|
78
114
|
export interface MarkupShape {
|
|
79
|
-
tool: "arrow" | "rect" | "pen" | "blur" | "text";
|
|
115
|
+
tool: "arrow" | "rect" | "pen" | "blur" | "text" | "line" | "ellipse";
|
|
80
116
|
color?: string | null;
|
|
117
|
+
/** Stroke width in screenshot pixels. */
|
|
118
|
+
width?: number | null;
|
|
81
119
|
points?: number[] | null;
|
|
82
120
|
text?: string | null;
|
|
83
121
|
}
|
|
@@ -119,6 +157,13 @@ export interface Thread {
|
|
|
119
157
|
status: ThreadStatus;
|
|
120
158
|
priority: ThreadPriority;
|
|
121
159
|
assignee: Person | null;
|
|
160
|
+
/** Everyone assigned, the primary (`assignee`) first. Older servers send only `assignee`. */
|
|
161
|
+
assignees?: Person[];
|
|
162
|
+
/** Extra detail under the comment. */
|
|
163
|
+
description?: string | null;
|
|
164
|
+
checklist?: ChecklistItem[];
|
|
165
|
+
/** Style changes the reviewer suggested for the commented element. Older servers leave it out. */
|
|
166
|
+
style_changes?: StyleChange[];
|
|
122
167
|
due_at: string | null;
|
|
123
168
|
labels?: Label[];
|
|
124
169
|
page: {
|
|
@@ -184,6 +229,12 @@ export interface Session {
|
|
|
184
229
|
capabilities: Capabilities;
|
|
185
230
|
/** Opaque key that live-update pings carry in `by` when this person made the change. */
|
|
186
231
|
realtime_key?: string;
|
|
232
|
+
/** This project in the CommentKit dashboard, for members (absent for guests and older servers). */
|
|
233
|
+
dashboard_url?: string | null;
|
|
234
|
+
/** The linked GitHub repository (owner/name), team members only: agents open in its clone. */
|
|
235
|
+
repository?: string | null;
|
|
236
|
+
/** The signed-in person's email, shown in Settings (absent on older servers). */
|
|
237
|
+
email?: string | null;
|
|
187
238
|
}
|
|
188
239
|
export interface WidgetConfig {
|
|
189
240
|
project: {
|
|
@@ -235,15 +286,24 @@ export interface WidgetConfig {
|
|
|
235
286
|
auth_endpoint: string;
|
|
236
287
|
} | null;
|
|
237
288
|
}
|
|
289
|
+
export interface ChecklistItem {
|
|
290
|
+
id: string;
|
|
291
|
+
body: string;
|
|
292
|
+
done: boolean;
|
|
293
|
+
}
|
|
238
294
|
export interface Label {
|
|
239
295
|
id: number;
|
|
240
296
|
name: string;
|
|
241
297
|
color: string;
|
|
242
298
|
}
|
|
243
299
|
export type Position = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
300
|
+
/** Where the reader dragged the toolbar on this device: a corner, or the middle of the top or bottom edge. */
|
|
301
|
+
export type DockPosition = Position | "bottom-center" | "top-center";
|
|
302
|
+
/** What a notification is about (the API's inbox `kind`). */
|
|
303
|
+
export type InboxKind = "mention" | "assigned" | "ready_for_review" | "reopened" | "reply" | "resolved" | "closed" | "new_feedback" | "due_soon" | "overdue" | "agent_request";
|
|
244
304
|
export interface InboxItem {
|
|
245
305
|
id: string;
|
|
246
|
-
kind:
|
|
306
|
+
kind: InboxKind;
|
|
247
307
|
actor: Person;
|
|
248
308
|
thread_id: string;
|
|
249
309
|
reference: string | null;
|
|
@@ -293,6 +353,16 @@ export interface CommentKitOptions {
|
|
|
293
353
|
* (WCAG 2.1.4). Esc and Cmd/Ctrl+Shift+K keep working.
|
|
294
354
|
*/
|
|
295
355
|
shortcuts?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Turn parts of the comment tools off on this site. Each one defaults to on (screenshots also
|
|
358
|
+
* follow the dashboard setting). `text: false` stops selected text from becoming a quoted comment.
|
|
359
|
+
*/
|
|
360
|
+
tools?: {
|
|
361
|
+
screenshots?: boolean;
|
|
362
|
+
markup?: boolean;
|
|
363
|
+
text?: boolean;
|
|
364
|
+
attachments?: boolean;
|
|
365
|
+
};
|
|
296
366
|
}
|
|
297
367
|
export interface CommentKitEvents {
|
|
298
368
|
ready: {
|
|
@@ -310,6 +380,10 @@ export interface CommentKitEvents {
|
|
|
310
380
|
"message:created": {
|
|
311
381
|
message: Message;
|
|
312
382
|
};
|
|
383
|
+
/** Comment mode started or stopped (from the Comment button, the C key or `comment()`). */
|
|
384
|
+
mode: {
|
|
385
|
+
commenting: boolean;
|
|
386
|
+
};
|
|
313
387
|
error: {
|
|
314
388
|
error: CommentKitError;
|
|
315
389
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Headless client for custom UIs, extensions and tests. No UI, no globals. */
|
|
2
|
-
export { CommentKitClient, currentPageUrl, SDK_VERSION } from "./core/client.js";
|
|
2
|
+
export { CommentKitClient, currentPageUrl, EDIT_CONFLICT, SDK_VERSION } from "./core/client.js";
|
|
3
3
|
export { ApiClient } from "./core/api.js";
|
|
4
4
|
export { AuthManager } from "./core/auth.js";
|
|
5
5
|
export { createAnchor, resolveAnchor, stableSelector } from "./anchor/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommentKitClient, SDK_VERSION } from "./core/client.js";
|
|
2
2
|
import { type CommentKitEvents, type CommentKitOptions, type 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";
|
|
3
|
+
export type { Anchor, Attachment, Capabilities, CaptureInput, ChecklistItem, CommentKitEvents, CommentKitOptions, Environment, InboxItem, MarkupShape, Message, Page, Person, Position, Reaction, Session, StyleChange, StyleProperty, Thread, TaskInput, ThreadPriority, ThreadStatus, WidgetConfig, } from "./core/types.js";
|
|
4
4
|
export { CommentKitError } from "./core/types.js";
|
|
5
5
|
export { SDK_VERSION };
|
|
6
6
|
export interface CommentKit {
|
|
@@ -10,6 +10,11 @@ export interface CommentKit {
|
|
|
10
10
|
hide(): void;
|
|
11
11
|
/** Show the widget and open one conversation, by id or reference ("CK-12"). */
|
|
12
12
|
open(thread: string): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Start comment mode, as if the Comment button was pressed: for your own "Leave feedback" button.
|
|
15
|
+
* `comment(false)` stops it. Listen to the `mode` event to follow it.
|
|
16
|
+
*/
|
|
17
|
+
comment(on?: boolean): Promise<void>;
|
|
13
18
|
/** Open the sign-in window. Call from a click handler. */
|
|
14
19
|
signIn(): Promise<boolean>;
|
|
15
20
|
signOut(): Promise<void>;
|
package/dist/npm/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./chunks/src-
|
|
1
|
+
import { t as e } from "./chunks/src-C_oUnL0i.js";
|
|
2
2
|
import { defineComponent as t, onBeforeUnmount as n, onMounted as r } from "vue";
|
|
3
3
|
//#region src/adapters/vue.ts
|
|
4
4
|
function i(e) {
|
|
@@ -58,6 +58,10 @@ var a = t({
|
|
|
58
58
|
shortcuts: {
|
|
59
59
|
type: Boolean,
|
|
60
60
|
default: void 0
|
|
61
|
+
},
|
|
62
|
+
tools: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: void 0
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
setup(t) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commentkit/comment-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
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",
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"test:e2e": "playwright test",
|
|
77
77
|
"test:visual": "playwright test e2e/specs/visual.spec.ts --project=chromium",
|
|
78
78
|
"test:host-matrix": "node scripts/host-matrix.mjs",
|
|
79
|
+
"test:wordpress": "node scripts/wordpress-check.mjs",
|
|
80
|
+
"test:wordpress:real": "node e2e/wordpress-real/run.mjs",
|
|
79
81
|
"typecheck": "tsc -p tsconfig.json",
|
|
80
82
|
"check": "npm run typecheck && npm run test && npm run build",
|
|
81
83
|
"prepublishOnly": "npm run check && node scripts/check-pack.mjs",
|
|
@@ -91,7 +93,7 @@
|
|
|
91
93
|
"@playwright/test": "1.64.1",
|
|
92
94
|
"@types/react": "19.3.0",
|
|
93
95
|
"@vitest/coverage-v8": "5.0.5",
|
|
94
|
-
"html2canvas": "
|
|
96
|
+
"html2canvas-pro": "2.5.2",
|
|
95
97
|
"jsdom": "30.1.3",
|
|
96
98
|
"preact": "11.0.1",
|
|
97
99
|
"pusher-js": "8.6.0",
|
|
@@ -102,7 +104,8 @@
|
|
|
102
104
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
103
105
|
"vite-plus": "1.3.0",
|
|
104
106
|
"vitest": "5.0.5",
|
|
105
|
-
"vue": "3.5.44"
|
|
107
|
+
"vue": "3.5.44",
|
|
108
|
+
"yaml": "2.9.1"
|
|
106
109
|
},
|
|
107
110
|
"peerDependencies": {
|
|
108
111
|
"react": ">=18",
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./src-DG8ehgE9.js";
|
|
2
|
-
import { c as t } from "./client-CS5oL_LQ.js";
|
|
3
|
-
import { d as n, f as r, h as i, n as a, p as o } from "./format-CP2xZaec.js";
|
|
4
|
-
import { o as s, p as c } from "./mount-VmnAiANB.js";
|
|
5
|
-
//#region src/ui/Guest.tsx
|
|
6
|
-
async function l(n, r) {
|
|
7
|
-
try {
|
|
8
|
-
let e = await n.api.request("/guest/start", {
|
|
9
|
-
method: "POST",
|
|
10
|
-
anonymous: !0,
|
|
11
|
-
body: {
|
|
12
|
-
client_id: n.options.project,
|
|
13
|
-
share: r.share,
|
|
14
|
-
name: r.name.trim(),
|
|
15
|
-
email: r.email.trim()
|
|
16
|
-
}
|
|
17
|
-
}), t = Date.parse(e.pending_session.expires_at);
|
|
18
|
-
return n.auth.setPending({
|
|
19
|
-
token: e.access_token,
|
|
20
|
-
email: e.pending_session.email,
|
|
21
|
-
expiresAt: Number.isFinite(t) ? t : Date.now() + e.expires_in * 1e3
|
|
22
|
-
}), "started";
|
|
23
|
-
} catch (n) {
|
|
24
|
-
if (n instanceof t && n.code === "origin_not_allowed") return "popup";
|
|
25
|
-
throw n instanceof t && (n.code === "share_expired" || n.status === 410 || n.errors?.share) ? new t(410, "share_expired", e("shareExpired")) : n;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function u({ client: l, email: u, onDone: f, onDifferentEmail: p, onClose: m }) {
|
|
29
|
-
let [h, g] = i(""), [_, v] = i(!1), [y, b] = i(null), [x, S] = i(null), C = o(null);
|
|
30
|
-
r(() => C.current?.focus({ preventScroll: !0 }), []);
|
|
31
|
-
let w = async () => {
|
|
32
|
-
if (/^\d{6}$/.test(h) && !_) {
|
|
33
|
-
v(!0), b(null);
|
|
34
|
-
try {
|
|
35
|
-
let e = await l.api.request("/guest/verify", {
|
|
36
|
-
method: "POST",
|
|
37
|
-
body: { code: h }
|
|
38
|
-
});
|
|
39
|
-
l.auth.adopt(e), await l.loadSession().catch(() => null), f(e.published_thread_ids ?? []);
|
|
40
|
-
} catch (n) {
|
|
41
|
-
if ((n instanceof t ? n.status : 0) === 422) return b({
|
|
42
|
-
text: e("verifyWrong"),
|
|
43
|
-
tone: "warning"
|
|
44
|
-
});
|
|
45
|
-
let r = d(n);
|
|
46
|
-
r && (l.auth.setPending(null), S(r === "expired" ? "again" : "stop")), b({
|
|
47
|
-
text: r ? e(r === "link" ? "verifyLinkExpired" : r === "removed" ? "verifyRemoved" : "verifyExpired") : c(n),
|
|
48
|
-
tone: "warning"
|
|
49
|
-
});
|
|
50
|
-
} finally {
|
|
51
|
-
v(!1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, T = async () => {
|
|
55
|
-
try {
|
|
56
|
-
await l.api.request("/guest/resend", { method: "POST" }), b({ text: e("verifyResent") });
|
|
57
|
-
} catch (n) {
|
|
58
|
-
b({
|
|
59
|
-
text: n instanceof t && n.status === 429 ? e("verifyWait") : e("errorGeneric"),
|
|
60
|
-
tone: "warning"
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return /* @__PURE__ */ n("div", {
|
|
65
|
-
class: "ck-card",
|
|
66
|
-
style: s({
|
|
67
|
-
x: innerWidth / 2 - 190,
|
|
68
|
-
y: 80
|
|
69
|
-
}),
|
|
70
|
-
role: "dialog",
|
|
71
|
-
"aria-labelledby": "ck-verify-title",
|
|
72
|
-
"data-commentkit-ui": !0,
|
|
73
|
-
onKeyDown: (e) => e.key === "Escape" && m(),
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ n("div", {
|
|
76
|
-
class: "ck-card-head",
|
|
77
|
-
children: [/* @__PURE__ */ n("h2", {
|
|
78
|
-
class: "ck-card-title",
|
|
79
|
-
id: "ck-verify-title",
|
|
80
|
-
children: e("verifyTitle")
|
|
81
|
-
}), /* @__PURE__ */ n("button", {
|
|
82
|
-
class: "ck-ghost",
|
|
83
|
-
"aria-label": e("close"),
|
|
84
|
-
onClick: m,
|
|
85
|
-
children: /* @__PURE__ */ n(a, { name: "close" })
|
|
86
|
-
})]
|
|
87
|
-
}),
|
|
88
|
-
/* @__PURE__ */ n("div", {
|
|
89
|
-
class: "ck-card-body",
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ n("p", {
|
|
92
|
-
class: "ck-verify-text",
|
|
93
|
-
children: e("verifyBody", { email: u })
|
|
94
|
-
}),
|
|
95
|
-
/* @__PURE__ */ n("label", {
|
|
96
|
-
class: "ck-field",
|
|
97
|
-
children: [/* @__PURE__ */ n("span", { children: e("verifyCode") }), /* @__PURE__ */ n("input", {
|
|
98
|
-
ref: C,
|
|
99
|
-
class: "ck-input ck-code",
|
|
100
|
-
inputMode: "numeric",
|
|
101
|
-
autoComplete: "one-time-code",
|
|
102
|
-
pattern: "[0-9]*",
|
|
103
|
-
maxLength: 6,
|
|
104
|
-
value: h,
|
|
105
|
-
onInput: (e) => g(e.target.value.replace(/\D/g, "").slice(0, 6)),
|
|
106
|
-
onKeyDown: (e) => {
|
|
107
|
-
e.stopPropagation(), e.key === "Enter" && w(), e.key === "Escape" && m();
|
|
108
|
-
}
|
|
109
|
-
})]
|
|
110
|
-
}),
|
|
111
|
-
y ? /* @__PURE__ */ n("div", {
|
|
112
|
-
class: "ck-note",
|
|
113
|
-
role: y.tone ? "alert" : "status",
|
|
114
|
-
"data-tone": y.tone,
|
|
115
|
-
children: y.text
|
|
116
|
-
}) : null,
|
|
117
|
-
x ? null : /* @__PURE__ */ n("div", {
|
|
118
|
-
class: "ck-actions",
|
|
119
|
-
children: [/* @__PURE__ */ n("button", {
|
|
120
|
-
class: "ck-chip",
|
|
121
|
-
onClick: () => void T(),
|
|
122
|
-
children: e("verifyResend")
|
|
123
|
-
}), /* @__PURE__ */ n("button", {
|
|
124
|
-
class: "ck-chip",
|
|
125
|
-
onClick: () => {
|
|
126
|
-
l.auth.setPending(null), p();
|
|
127
|
-
},
|
|
128
|
-
children: e("verifyDifferent")
|
|
129
|
-
})]
|
|
130
|
-
})
|
|
131
|
-
]
|
|
132
|
-
}),
|
|
133
|
-
/* @__PURE__ */ n("div", {
|
|
134
|
-
class: "ck-card-foot",
|
|
135
|
-
children: [/* @__PURE__ */ n("span", { class: "ck-spacer" }), x === "again" ? /* @__PURE__ */ n("button", {
|
|
136
|
-
class: "ck-btn ck-primary",
|
|
137
|
-
onClick: p,
|
|
138
|
-
children: e("writeAgain")
|
|
139
|
-
}) : x === "stop" ? /* @__PURE__ */ n("button", {
|
|
140
|
-
class: "ck-btn",
|
|
141
|
-
onClick: m,
|
|
142
|
-
children: e("close")
|
|
143
|
-
}) : /* @__PURE__ */ n("button", {
|
|
144
|
-
class: "ck-btn ck-primary",
|
|
145
|
-
disabled: _ || h.length !== 6,
|
|
146
|
-
onClick: () => void w(),
|
|
147
|
-
children: e(_ ? "sending" : "verifyPublish")
|
|
148
|
-
})]
|
|
149
|
-
})
|
|
150
|
-
]
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function d(e) {
|
|
154
|
-
return e instanceof t ? e.code === "share_expired" || e.status === 410 ? "link" : e.code === "guest_removed" ? "removed" : e.status === 403 ? /\blink\b/i.test(e.message) ? "link" : "removed" : e.status === 409 || e.status === 401 ? "expired" : null : null;
|
|
155
|
-
}
|
|
156
|
-
//#endregion
|
|
157
|
-
export { u as GuestVerify, l as startGuest };
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./src-DG8ehgE9.js";
|
|
2
|
-
import { a as t, d as n, f as r, h as i, p as a } from "./format-CP2xZaec.js";
|
|
3
|
-
//#region src/ui/MarkupEditor.tsx
|
|
4
|
-
var o = [
|
|
5
|
-
"#ff3b30",
|
|
6
|
-
"#ff9500",
|
|
7
|
-
"#34c759",
|
|
8
|
-
"#007aff",
|
|
9
|
-
"#121316"
|
|
10
|
-
], s = [
|
|
11
|
-
"color_red",
|
|
12
|
-
"color_orange",
|
|
13
|
-
"color_green",
|
|
14
|
-
"color_blue",
|
|
15
|
-
"color_black"
|
|
16
|
-
];
|
|
17
|
-
function c({ image: c, onDone: u, onCancel: d }) {
|
|
18
|
-
let f = a(null), [p, m] = i(null), [h, g] = i("arrow"), [_, v] = i(o[0]), [y, b] = i([]), x = a(null), [S, C] = i(null), w = a(null), T = a(null);
|
|
19
|
-
r(() => (w.current ?? T.current)?.focus({ preventScroll: !0 }), [!!S]);
|
|
20
|
-
let E = () => {
|
|
21
|
-
let e = S?.text.trim().slice(0, 500);
|
|
22
|
-
S && e && b([...y, {
|
|
23
|
-
tool: "text",
|
|
24
|
-
color: _,
|
|
25
|
-
points: [S.x, S.y],
|
|
26
|
-
text: e
|
|
27
|
-
}]), T.current?.focus({ preventScroll: !0 }), C(null);
|
|
28
|
-
};
|
|
29
|
-
r(() => {
|
|
30
|
-
createImageBitmap(c).then(m);
|
|
31
|
-
}, [c]), r(() => D(), [p, y]);
|
|
32
|
-
let D = (e) => {
|
|
33
|
-
let t = f.current;
|
|
34
|
-
if (!t || !p) return;
|
|
35
|
-
t.width = p.width, t.height = p.height;
|
|
36
|
-
let n = t.getContext("2d");
|
|
37
|
-
n.drawImage(p, 0, 0);
|
|
38
|
-
for (let t of e ? [...y, e] : y) l(n, t, p);
|
|
39
|
-
}, O = (e) => {
|
|
40
|
-
let t = f.current, n = t.getBoundingClientRect();
|
|
41
|
-
return [Math.round((e.clientX - n.left) / n.width * t.width), Math.round((e.clientY - n.top) / n.height * t.height)];
|
|
42
|
-
};
|
|
43
|
-
return /* @__PURE__ */ n("div", {
|
|
44
|
-
class: "ck-markup",
|
|
45
|
-
ref: T,
|
|
46
|
-
tabIndex: -1,
|
|
47
|
-
role: "dialog",
|
|
48
|
-
"aria-label": e("markup"),
|
|
49
|
-
"data-commentkit-ui": !0,
|
|
50
|
-
onKeyDown: (e) => {
|
|
51
|
-
e.key === "Escape" && (e.stopPropagation(), S ? (T.current?.focus({ preventScroll: !0 }), C(null)) : d());
|
|
52
|
-
},
|
|
53
|
-
children: [
|
|
54
|
-
/* @__PURE__ */ n("div", {
|
|
55
|
-
class: "ck-markup-tools",
|
|
56
|
-
children: [
|
|
57
|
-
[
|
|
58
|
-
"arrow",
|
|
59
|
-
"rect",
|
|
60
|
-
"pen",
|
|
61
|
-
"blur",
|
|
62
|
-
"text"
|
|
63
|
-
].map((t) => /* @__PURE__ */ n("button", {
|
|
64
|
-
class: "ck-chip",
|
|
65
|
-
"aria-pressed": h === t,
|
|
66
|
-
onClick: () => g(t),
|
|
67
|
-
children: e(`tool_${t}`)
|
|
68
|
-
})),
|
|
69
|
-
o.map((t, r) => /* @__PURE__ */ n("button", {
|
|
70
|
-
class: "ck-chip",
|
|
71
|
-
"aria-pressed": _ === t,
|
|
72
|
-
"aria-label": e(s[r]),
|
|
73
|
-
style: {
|
|
74
|
-
width: "28px",
|
|
75
|
-
padding: 0,
|
|
76
|
-
background: t
|
|
77
|
-
},
|
|
78
|
-
onClick: () => v(t)
|
|
79
|
-
})),
|
|
80
|
-
/* @__PURE__ */ n("button", {
|
|
81
|
-
class: "ck-chip",
|
|
82
|
-
disabled: !y.length,
|
|
83
|
-
onClick: () => b(y.slice(0, -1)),
|
|
84
|
-
children: e("undo")
|
|
85
|
-
}),
|
|
86
|
-
/* @__PURE__ */ n("button", {
|
|
87
|
-
class: "ck-chip",
|
|
88
|
-
onClick: d,
|
|
89
|
-
children: e("cancel")
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ n("button", {
|
|
92
|
-
class: "ck-chip ck-primary",
|
|
93
|
-
onClick: () => {
|
|
94
|
-
let e = S?.text.trim().slice(0, 500), t = S && e ? {
|
|
95
|
-
tool: "text",
|
|
96
|
-
color: _,
|
|
97
|
-
points: [S.x, S.y],
|
|
98
|
-
text: e
|
|
99
|
-
} : null;
|
|
100
|
-
t && D(t), f.current?.toBlob((e) => e && u(e, t ? [...y, t] : y), "image/webp", .88);
|
|
101
|
-
},
|
|
102
|
-
children: e("markupDone")
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
}),
|
|
106
|
-
/* @__PURE__ */ n("canvas", {
|
|
107
|
-
ref: f,
|
|
108
|
-
onPointerDown: (e) => {
|
|
109
|
-
let [t, n] = O(e);
|
|
110
|
-
h === "text" ? (e.preventDefault(), E(), C({
|
|
111
|
-
x: t,
|
|
112
|
-
y: n,
|
|
113
|
-
left: Math.min(e.clientX, innerWidth - 240),
|
|
114
|
-
top: Math.max(8, e.clientY - 18),
|
|
115
|
-
text: ""
|
|
116
|
-
})) : (x.current = {
|
|
117
|
-
tool: h,
|
|
118
|
-
color: _,
|
|
119
|
-
points: [
|
|
120
|
-
t,
|
|
121
|
-
n,
|
|
122
|
-
t,
|
|
123
|
-
n
|
|
124
|
-
]
|
|
125
|
-
}, f.current?.setPointerCapture(e.pointerId));
|
|
126
|
-
},
|
|
127
|
-
onPointerMove: (e) => {
|
|
128
|
-
let t = x.current;
|
|
129
|
-
if (!t?.points) return;
|
|
130
|
-
let [n, r] = O(e);
|
|
131
|
-
t.tool === "pen" ? t.points.length < 4e3 && t.points.push(n, r) : (t.points[2] = n, t.points[3] = r), D(t);
|
|
132
|
-
},
|
|
133
|
-
onPointerUp: () => {
|
|
134
|
-
x.current && b([...y, x.current]), x.current = null;
|
|
135
|
-
}
|
|
136
|
-
}),
|
|
137
|
-
S ? /* @__PURE__ */ n("div", {
|
|
138
|
-
class: "ck-label-box",
|
|
139
|
-
style: t(S.left, S.top),
|
|
140
|
-
children: [/* @__PURE__ */ n("input", {
|
|
141
|
-
ref: w,
|
|
142
|
-
class: "ck-input",
|
|
143
|
-
maxLength: 500,
|
|
144
|
-
value: S.text,
|
|
145
|
-
placeholder: e("markupTextPrompt"),
|
|
146
|
-
"aria-label": e("markupTextPrompt"),
|
|
147
|
-
style: { color: _ },
|
|
148
|
-
onInput: (e) => C({
|
|
149
|
-
...S,
|
|
150
|
-
text: e.target.value
|
|
151
|
-
}),
|
|
152
|
-
onKeyDown: (e) => {
|
|
153
|
-
e.key === "Enter" && (e.preventDefault(), E());
|
|
154
|
-
}
|
|
155
|
-
}), /* @__PURE__ */ n("button", {
|
|
156
|
-
class: "ck-chip ck-primary",
|
|
157
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
158
|
-
onClick: E,
|
|
159
|
-
children: e("markupTextAdd")
|
|
160
|
-
})]
|
|
161
|
-
}) : null
|
|
162
|
-
]
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
function l(e, t, n) {
|
|
166
|
-
let r = t.points ?? [], i = Math.max(3, Math.round(n.width / 300));
|
|
167
|
-
e.save(), e.strokeStyle = e.fillStyle = t.color ?? "#ff3b30", e.lineWidth = i, e.lineCap = e.lineJoin = "round";
|
|
168
|
-
let [a = 0, o = 0, s = 0, c = 0] = r;
|
|
169
|
-
switch (t.tool) {
|
|
170
|
-
case "rect":
|
|
171
|
-
e.strokeRect(Math.min(a, s), Math.min(o, c), Math.abs(s - a), Math.abs(c - o));
|
|
172
|
-
break;
|
|
173
|
-
case "arrow": {
|
|
174
|
-
let t = Math.atan2(c - o, s - a), n = i * 5;
|
|
175
|
-
e.beginPath(), e.moveTo(a, o), e.lineTo(s, c), e.stroke(), e.beginPath(), e.moveTo(s, c), e.lineTo(s - n * Math.cos(t - .45), c - n * Math.sin(t - .45)), e.lineTo(s - n * Math.cos(t + .45), c - n * Math.sin(t + .45)), e.closePath(), e.fill();
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
case "pen":
|
|
179
|
-
e.beginPath();
|
|
180
|
-
for (let t = 0; t < r.length; t += 2) (t ? e.lineTo : e.moveTo).call(e, r[t], r[t + 1]);
|
|
181
|
-
e.stroke();
|
|
182
|
-
break;
|
|
183
|
-
case "blur": {
|
|
184
|
-
let t = Math.min(a, s), n = Math.min(o, c), r = Math.abs(s - a), i = Math.abs(c - o);
|
|
185
|
-
if (r > 2 && i > 2) {
|
|
186
|
-
let a = Math.max(8, Math.round(Math.min(r, i) / 6)), o = e.getImageData(t, n, r, i);
|
|
187
|
-
for (let s = 0; s < i; s += a) for (let i = 0; i < r; i += a) {
|
|
188
|
-
let c = (s * r + i) * 4;
|
|
189
|
-
e.fillStyle = `rgb(${o.data[c]},${o.data[c + 1]},${o.data[c + 2]})`, e.fillRect(t + i, n + s, a, a);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
case "text": e.font = `bold ${i * 6}px system-ui, sans-serif`, e.lineWidth = i * 1.5, e.strokeStyle = "#ffffff", e.strokeText(t.text ?? "", a, o), e.fillText(t.text ?? "", a, o);
|
|
195
|
-
}
|
|
196
|
-
e.restore();
|
|
197
|
-
}
|
|
198
|
-
//#endregion
|
|
199
|
-
export { c as MarkupEditor };
|