@commentkit/comment-kit 1.5.1 → 2.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 (141) hide show
  1. package/CHANGELOG.md +281 -582
  2. package/README.md +334 -154
  3. package/SECURITY.md +47 -46
  4. package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
  5. package/dist/node/browser.js +17 -0
  6. package/dist/node/cli/api.js +226 -0
  7. package/dist/node/cli/bin.js +18 -0
  8. package/dist/node/cli/credentials.js +268 -0
  9. package/dist/node/cli/doctor.js +725 -0
  10. package/dist/node/cli/format.js +54 -0
  11. package/dist/node/cli/init.js +372 -0
  12. package/dist/node/cli/main.js +519 -0
  13. package/dist/node/cli/mcp.js +114 -0
  14. package/dist/node/cli/open.js +20 -0
  15. package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
  16. package/dist/node/plugins/astro.js +26 -0
  17. package/dist/node/plugins/git-BIXLbL3f.js +92 -0
  18. package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
  19. package/dist/node/plugins/next.js +48 -0
  20. package/dist/node/plugins/options-THop1K92.js +71 -0
  21. package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
  22. package/dist/node/plugins/vite-BdAYUW10.js +74 -0
  23. package/dist/node/plugins/vite.js +1 -0
  24. package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
  25. package/dist/node/plugins/webpack-loader.cjs +21 -0
  26. package/dist/node/plugins/webpack-loader.js +18 -0
  27. package/dist/node/plugins/webpack.js +1 -0
  28. package/dist/node/shared/endpoint.js +26 -0
  29. package/dist/node/shared/format.js +63 -0
  30. package/dist/node/types/astro.d.ts +11 -0
  31. package/dist/node/types/next.d.ts +34 -0
  32. package/dist/node/types/options.d.ts +59 -0
  33. package/dist/node/types/vite.d.ts +11 -0
  34. package/dist/node/types/webpack-loader.d.ts +22 -0
  35. package/dist/node/types/webpack.d.ts +27 -0
  36. package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
  37. package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
  38. package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
  39. package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
  40. package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
  41. package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
  42. package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
  43. package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
  44. package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
  45. package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
  46. package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
  47. package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
  48. package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
  49. package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
  50. package/dist/npm/chunks/{agent-CqDO3JMA.js → agent-C1OQzBAm.js} +20 -21
  51. package/dist/npm/chunks/{anchor-OCQnjp_6.js → anchor-BsQNVkHj.js} +109 -87
  52. package/dist/npm/chunks/{ar-BQ9K9Oqf.js → ar-CAJ3XT8e.js} +73 -20
  53. package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
  54. package/dist/npm/chunks/{client-dZeNdizE.js → client-kNAo2TTG.js} +292 -285
  55. package/dist/npm/chunks/{colors-CAjY4jxf.js → colors-CWAn_swA.js} +1 -2
  56. package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
  57. package/dist/npm/chunks/context-B8UAzve0.js +20 -0
  58. package/dist/npm/chunks/context-BuMl7A07.js +48 -0
  59. package/dist/npm/chunks/{de-CcPi8xdC.js → de-Dl18G48t.js} +64 -19
  60. package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
  61. package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
  62. package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
  63. package/dist/npm/chunks/{es-DXgkjDCG.js → es-Dxk79lS9.js} +64 -19
  64. package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
  65. package/dist/npm/chunks/{extension-BFkXOmX5.js → extension-E81hWyiT.js} +21 -14
  66. package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
  67. package/dist/npm/chunks/{fr-IjJaUbWh.js → fr-8BebGKYD.js} +121 -76
  68. package/dist/npm/chunks/{hi-BhKQK2MU.js → hi-BIN6Yy_p.js} +65 -20
  69. package/dist/npm/chunks/{html2canvas-pro.esm-lgs6tb4C.js → html2canvas-pro.esm-B7b8p5Wr.js} +608 -528
  70. package/dist/npm/chunks/i18n-DOBt8e9U.js +936 -0
  71. package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
  72. package/dist/npm/chunks/{it-DKiSCkiD.js → it-Cr6EwpPQ.js} +83 -38
  73. package/dist/npm/chunks/{ja-BI1WagDg.js → ja-Iy3s5aur.js} +62 -17
  74. package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
  75. package/dist/npm/chunks/live-CelVeZfP.js +85 -0
  76. package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
  77. package/dist/npm/chunks/{lock-C82sC17d.js → lock-B1JLlOhz.js} +0 -1
  78. package/dist/npm/chunks/{nl-CJw3VUQ5.js → nl-B84WHqqe.js} +65 -20
  79. package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
  80. package/dist/npm/chunks/{pick-dDDLxCDI.js → pick-yTyqtxN0.js} +46 -46
  81. package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
  82. package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
  83. package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
  84. package/dist/npm/chunks/{pt-BR-CjBolC5g.js → pt-BR-DOkdlfoe.js} +64 -19
  85. package/dist/npm/chunks/{realtime-D22tI_AS.js → realtime-C79zF50C.js} +16 -15
  86. package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
  87. package/dist/npm/chunks/{rolldown-runtime-Y_bBpyJl.js → rolldown-runtime-QGRDbDUS.js} +1 -2
  88. package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
  89. package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
  90. package/dist/npm/chunks/{source-BQS2_xfB.js → source-pXVve2Cx.js} +2 -3
  91. package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
  92. package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
  93. package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
  94. package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
  95. package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
  96. package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
  97. package/dist/npm/chunks/{zh-CN-BrZGx2S0.js → zh-CN-Z5fQCb7G.js} +63 -18
  98. package/dist/npm/element.js +59 -23
  99. package/dist/npm/headless.js +7 -3
  100. package/dist/npm/index.js +3 -3
  101. package/dist/npm/react.js +19 -13
  102. package/dist/npm/svelte.js +29 -14
  103. package/dist/npm/types/adapters/react.d.ts +4 -1
  104. package/dist/npm/types/adapters/svelte.d.ts +4 -1
  105. package/dist/npm/types/adapters/vue.d.ts +35 -2
  106. package/dist/npm/types/anchor/index.d.ts +19 -0
  107. package/dist/npm/types/capture/privacy.d.ts +14 -0
  108. package/dist/npm/types/core/api.d.ts +20 -1
  109. package/dist/npm/types/core/auth.d.ts +47 -14
  110. package/dist/npm/types/core/client.d.ts +60 -4
  111. package/dist/npm/types/core/page-key.d.ts +42 -0
  112. package/dist/npm/types/core/types.d.ts +87 -4
  113. package/dist/npm/types/element.d.ts +17 -7
  114. package/dist/npm/types/headless.d.ts +2 -1
  115. package/dist/npm/types/index.d.ts +16 -6
  116. package/dist/npm/vue.js +45 -11
  117. package/package.json +95 -21
  118. package/dist/npm/chunks/AgentSend-DjFZSC0S.js +0 -64
  119. package/dist/npm/chunks/Checklist-BEz4IZdT.js +0 -259
  120. package/dist/npm/chunks/Composer-D1wbmdjF.js +0 -681
  121. package/dist/npm/chunks/Guest-CtyRy8Kz.js +0 -170
  122. package/dist/npm/chunks/MarkupEditor-CPH4yKx4.js +0 -334
  123. package/dist/npm/chunks/Panel-DSoUAlbQ.js +0 -863
  124. package/dist/npm/chunks/Settings-C_qV4n7J.js +0 -206
  125. package/dist/npm/chunks/Shortcuts-ChnaribX.js +0 -60
  126. package/dist/npm/chunks/StyleEditor-DqZd6C5o.js +0 -44
  127. package/dist/npm/chunks/StylePanel-DMC3riYK.js +0 -199
  128. package/dist/npm/chunks/TaskFields-BfjjllMx.js +0 -272
  129. package/dist/npm/chunks/ThreadCard-DmKAelSL.js +0 -1026
  130. package/dist/npm/chunks/Viewer-mw69qSI5.js +0 -110
  131. package/dist/npm/chunks/card-bits-C7bIk5KX.js +0 -126
  132. package/dist/npm/chunks/confetti-DKeKR7-6.js +0 -41
  133. package/dist/npm/chunks/drafts-CpQdHhcK.js +0 -51
  134. package/dist/npm/chunks/extension-Gvei3opb.js +0 -54
  135. package/dist/npm/chunks/i18n-DAJGndZ2.js +0 -904
  136. package/dist/npm/chunks/live-MvvBdoGd.js +0 -34
  137. package/dist/npm/chunks/report-DoDVi1qT.js +0 -28
  138. package/dist/npm/chunks/src-C_oUnL0i.js +0 -150
  139. package/dist/npm/chunks/start-C5-rebEU.js +0 -1783
  140. package/dist/npm/chunks/upload-CzPAjktW.js +0 -42
  141. package/dist/npm/chunks/uploads-tpLjiJdH.js +0 -541
@@ -1,34 +0,0 @@
1
- import { i as e } from "./client-dZeNdizE.js";
2
- //#region src/ui/live.ts
3
- var t = 1500, n = 1e4;
4
- function r(e, r, a, o = Math.random) {
5
- let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = (e) => c.set(e, Date.now()), u = [
6
- e.on("thread:created", ({ thread: e }) => l(e.id)),
7
- e.on("thread:updated", ({ thread: e }) => l(e.id)),
8
- e.on("message:created", ({ message: e }) => l(e.thread_id))
9
- ], d = (t) => e.state.get().threads.some((e) => e.id === t), f = () => e.state.get().session?.realtime_key ?? null, p = (e) => r() === e.thread_id || d(e.thread_id) ? !0 : e.page_path == null || e.page_path === i(), m = (t) => {
10
- s.delete(t), e.refreshThread(t), r() === t && !d(t) && a(t);
11
- };
12
- return {
13
- onPing(r) {
14
- let i = r?.thread_id;
15
- if (typeof i != "string" || !i) return;
16
- if (r.type === "thread.deleted") {
17
- clearTimeout(s.get(i)), s.delete(i), e.state.set((e) => ({ threads: e.threads.filter((e) => e.id !== i) }));
18
- return;
19
- }
20
- let a = r.by ?? r.actor ?? null, l = c.get(i);
21
- a && a === f() && l !== void 0 && Date.now() - l < n || !s.has(i) && p(r) && s.set(i, setTimeout(() => m(i), Math.floor(o() * t)));
22
- },
23
- stop() {
24
- for (let e of s.values()) clearTimeout(e);
25
- s.clear(), u.forEach((e) => e());
26
- }
27
- };
28
- }
29
- function i() {
30
- let t = new URL(e());
31
- return t.pathname + (t.hash.startsWith("#/") ? t.hash : "");
32
- }
33
- //#endregion
34
- export { r as liveUpdates };
@@ -1,28 +0,0 @@
1
- //#region src/core/report.ts
2
- var e = 0, t = (e) => e.replace(/(https?:\/\/[^\s?#)]+)[?#][^\s)]*/g, "$1");
3
- function n(n, r, i, a, o = "crash", s) {
4
- if (e >= 3 || typeof fetch != "function") return;
5
- e++;
6
- let c = a instanceof Error ? a : Error(String(a));
7
- try {
8
- fetch(`${n}/api/v1/client-errors`, {
9
- method: "POST",
10
- keepalive: !0,
11
- credentials: "omit",
12
- headers: {
13
- "Content-Type": "application/json",
14
- "X-CommentKit-SDK": i
15
- },
16
- body: JSON.stringify({
17
- key: r,
18
- version: i,
19
- kind: o,
20
- message: t(`${c.name}: ${c.message}`).slice(0, 300),
21
- stack: t(c.stack ?? "").slice(0, 2e3),
22
- ...s ? { nonce: s } : {}
23
- })
24
- }).catch(() => void 0);
25
- } catch {}
26
- }
27
- //#endregion
28
- export { n as reportCrash };
@@ -1,150 +0,0 @@
1
- import { c as e, o as t, p as n, t as r } from "./client-dZeNdizE.js";
2
- //#region src/activation.ts
3
- var i = "commentkit:active", a = "data-commentkit-extension";
4
- function o() {
5
- return document.documentElement.hasAttribute(a);
6
- }
7
- function s(e = location.origin) {
8
- let t = new URL(e).hostname;
9
- return t === "localhost" || t === "127.0.0.1" || t === "[::1]" || t.endsWith(".localhost") || t.endsWith(".test");
10
- }
11
- function c(e, t = !0) {
12
- if (!t || s() || o()) return !0;
13
- let n = new URLSearchParams(location.search);
14
- if (n.has("ck") || n.has("ck_thread") || n.has("ck_code")) return !0;
15
- try {
16
- let t = `commentkit:v1:${e}`;
17
- return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem(i) === "1";
18
- } catch {
19
- return !1;
20
- }
21
- }
22
- function l(e) {
23
- try {
24
- e ? localStorage.setItem(i, "1") : localStorage.removeItem(i);
25
- } catch {}
26
- }
27
- function u(e) {
28
- let t = (t) => {
29
- (t.metaKey || t.ctrlKey) && t.shiftKey && t.key.toLowerCase() === "k" && (t.preventDefault(), t.stopImmediatePropagation(), e());
30
- };
31
- return addEventListener("keydown", t, !0), () => removeEventListener("keydown", t, !0);
32
- }
33
- //#endregion
34
- //#region src/index.ts
35
- var d = null;
36
- function f() {
37
- let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
38
- try {
39
- let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
40
- if (typeof t == "string" && (t = JSON.parse(t)), !t || typeof t != "object") return {
41
- branch: null,
42
- commit: null
43
- };
44
- let n = t;
45
- return {
46
- branch: e(n.branch),
47
- commit: e(n.commit)
48
- };
49
- } catch {
50
- return {
51
- branch: null,
52
- commit: null
53
- };
54
- }
55
- }
56
- function p(e) {
57
- if (d) return d;
58
- if (typeof window > "u") return g();
59
- try {
60
- return m(e);
61
- } catch (e) {
62
- return console.warn("[CommentKit] The widget could not start.", e), g();
63
- }
64
- }
65
- function m(i) {
66
- if (!i?.project || !t.test(i.project)) return console.warn("[CommentKit] init() needs your publishable project key (pk_live_… or pk_test_…). Find it in your CommentKit project under Setup."), g();
67
- let a = f(), s = {
68
- ...i,
69
- ...e(i.branch || a.branch, i.commit || a.commit)
70
- }, p = new r(s), m = null, _ = null, v = null, y = null, b = h(), x = () => {
71
- let e = Date.now(), t = () => {
72
- document.visibilityState === "hidden" || Date.now() - e < 15e3 || (e = Date.now(), p.loadConfig().then((e) => !e.enabled && !b && C(), () => void 0));
73
- }, n = setInterval(t, 6e4);
74
- return document.addEventListener("visibilitychange", t), () => {
75
- clearInterval(n), document.removeEventListener("visibilitychange", t);
76
- };
77
- }, S = () => m ? Promise.resolve() : (v ?? (v = (async () => {
78
- try {
79
- let e = await p.loadConfig();
80
- if (!e.enabled && !b) return;
81
- let t = import("./start-C5-rebEU.js").then((e) => e.t), n = t.then((e) => e.setLocale(s.locale));
82
- t.catch(() => void 0), n.catch(() => void 0), await p.auth.completeRedirect().catch(() => !1), o() && await import("./extension-BFkXOmX5.js").then((e) => e.extensionHandoff(p.auth)).catch(() => !1), await p.loadSession().catch(() => null);
83
- let { installDiagnostics: r, mountWidget: i } = await t;
84
- _ = r({
85
- console: e.features.console_capture,
86
- network: e.features.network_capture,
87
- endpoint: p.endpoint
88
- }), await n, m = i(p, C, () => {
89
- C(), l(!1);
90
- }), y = x(), p.emit("ready", { session: p.state.get().session });
91
- } catch (e) {
92
- let t = e instanceof n;
93
- console.warn(t ? `[CommentKit] The widget could not start: ${e.message} (${e.code}). See https://commentkit.dev/docs/errors#${e.code}` : "[CommentKit] The widget could not start.", e), t && p.emit("error", { error: e }), (!t || e.status >= 500) && p.reportCrash(e, "start");
94
- } finally {
95
- v = null;
96
- }
97
- })()), v), C = () => {
98
- y?.(), y = null, m?.(), m = null, _?.(), _ = null;
99
- }, w = u(() => {
100
- m ? p.state.set({ request: {
101
- kind: "inbox",
102
- at: Date.now()
103
- } }) : (l(!0), S());
104
- });
105
- return o() && import("./extension-BFkXOmX5.js").then((e) => e.extensionHello()).catch(() => void 0), c(s.project, s.hideOnProduction ?? !0) && S(), d = {
106
- client: p,
107
- show: S,
108
- hide: C,
109
- open: (e) => (p.state.set({ opening: String(e).slice(0, 64) }), S()),
110
- comment: async (e = !0) => {
111
- e && l(!0), await S(), p.state.set({ request: {
112
- kind: e ? "comment" : "stop",
113
- at: Date.now()
114
- } });
115
- },
116
- signIn: async () => await p.signIn() === "signed_in",
117
- signOut: () => p.signOut(),
118
- session: () => p.state.get().session,
119
- on: (e, t) => p.on(e, t),
120
- destroy() {
121
- C(), w(), p.destroy(), d = null;
122
- }
123
- }, d;
124
- }
125
- function h() {
126
- let e = new URLSearchParams(location.search);
127
- if (e.has("ck") || e.has("ck_thread")) return !0;
128
- try {
129
- return !!sessionStorage.getItem("commentkit:share");
130
- } catch {
131
- return !1;
132
- }
133
- }
134
- function g() {
135
- let e = async () => void 0;
136
- return {
137
- client: void 0,
138
- show: e,
139
- hide: () => void 0,
140
- open: e,
141
- comment: e,
142
- signIn: async () => !1,
143
- signOut: e,
144
- session: () => null,
145
- on: () => () => void 0,
146
- destroy: () => void 0
147
- };
148
- }
149
- //#endregion
150
- export { o as n, p as t };