@commentkit/comment-kit 2.0.0 → 2.1.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 +57 -0
- package/README.md +123 -19
- package/SECURITY.md +2 -2
- package/dist/node/cli/api.js +61 -15
- package/dist/node/cli/credentials.js +8 -0
- package/dist/node/cli/doctor.js +152 -25
- package/dist/node/cli/init.js +349 -35
- package/dist/node/cli/main.js +310 -69
- package/dist/node/cli/mcp.js +187 -6
- package/dist/node/cli/website.js +140 -0
- package/dist/node/shared/dashboard-places.js +33 -0
- package/dist/node/types/next.d.ts +4 -4
- package/dist/npm/THIRD_PARTY_NOTICES.txt +47 -0
- package/dist/npm/chunks/{AgentSend-DxRJIYiz.js → AgentSend-pA7Ufvye.js} +16 -16
- package/dist/npm/chunks/Checklist-Cn9skOYK.js +269 -0
- package/dist/npm/chunks/Composer-D7H-pzGa.js +734 -0
- package/dist/npm/chunks/DatePicker-Nta5a1xD.js +161 -0
- package/dist/npm/chunks/{Guest-vvNPz8h-.js → Guest-Bi7hlzhs.js} +63 -59
- package/dist/npm/chunks/{MarkupEditor-VCOXh9d2.js → MarkupEditor-WU3USeTk.js} +46 -39
- package/dist/npm/chunks/Panel-DhAzbUbC.js +1210 -0
- package/dist/npm/chunks/{Settings-BGoZS2iV.js → Settings-BmKqPX40.js} +91 -90
- package/dist/npm/chunks/{Shortcuts-B2OMvczr.js → Shortcuts-Bl-c0Sez.js} +25 -23
- package/dist/npm/chunks/SignInFirst-CmGvSYkQ.js +35 -0
- package/dist/npm/chunks/{StyleEditor-CJ_d8Huf.js → StyleEditor-D6fUnlwq.js} +10 -10
- package/dist/npm/chunks/{StylePanel-yQzHHlY7.js → StylePanel-C-Gikxt1.js} +61 -61
- package/dist/npm/chunks/TaskFields-CaKi523b.js +617 -0
- package/dist/npm/chunks/ThreadCard-d_3pUB5V.js +1142 -0
- package/dist/npm/chunks/Viewer-BULQsi9-.js +115 -0
- package/dist/npm/chunks/{agent-C1OQzBAm.js → agent-DHdhIJ3s.js} +1 -1
- package/dist/npm/chunks/{ar-CAJ3XT8e.js → ar-B5UszrQp.js} +53 -12
- package/dist/npm/chunks/card-bits-cV8GdFWX.js +55 -0
- package/dist/npm/chunks/{client-kNAo2TTG.js → client-Cv8ddtuM.js} +13 -11
- package/dist/npm/chunks/{confetti-CkBdSu19.js → confetti-B9zlyILU.js} +1 -1
- package/dist/npm/chunks/{context-B8UAzve0.js → context-CsHnabaA.js} +1 -1
- package/dist/npm/chunks/{de-Dl18G48t.js → de-BE0Aaq8u.js} +53 -12
- package/dist/npm/chunks/{dialog-GO04oC3D.js → dialog-DvdIkCW0.js} +1 -1
- package/dist/npm/chunks/{dpop-U48QIQd7.js → dpop-CwW9ifkq.js} +1 -1
- package/dist/npm/chunks/entrance-Bn_5M9uO.js +90 -0
- package/dist/npm/chunks/{es-Dxk79lS9.js → es-BQviao4d.js} +53 -12
- package/dist/npm/chunks/{extension-E81hWyiT.js → extension-CnQTDC1j.js} +2 -2
- package/dist/npm/chunks/{extension-CKFpPWmi.js → extension-DXhz81XD.js} +1 -1
- package/dist/npm/chunks/{files-DyD5BZgp.js → files-DLEr_wmh.js} +2 -2
- package/dist/npm/chunks/{fr-8BebGKYD.js → fr-C5gu6A06.js} +53 -12
- package/dist/npm/chunks/{hi-BIN6Yy_p.js → hi-DXfQ5EvY.js} +53 -12
- package/dist/npm/chunks/{i18n-DOBt8e9U.js → i18n-Mgs9VOuk.js} +63 -58
- package/dist/npm/chunks/icons-_C6ZWmBY.js +141 -0
- package/dist/npm/chunks/{identify-CN-3xzqL.js → identify-BnQGJOa0.js} +4 -4
- package/dist/npm/chunks/{it-Cr6EwpPQ.js → it-BPHt13FV.js} +53 -12
- package/dist/npm/chunks/{ja-Iy3s5aur.js → ja-BkCqyKR0.js} +52 -11
- package/dist/npm/chunks/late-words-D4Oo_yhJ.js +57 -0
- package/dist/npm/chunks/{live-CelVeZfP.js → live-DXcxj_Af.js} +28 -22
- package/dist/npm/chunks/{nl-B84WHqqe.js → nl-DZxdLLMU.js} +53 -12
- package/dist/npm/chunks/{page-key-DepmJzC1.js → page-key-UqAozdZi.js} +1 -1
- package/dist/npm/chunks/{pick-yTyqtxN0.js → pick-C20RVUas.js} +1 -1
- package/dist/npm/chunks/{pkce-ChKGSW_4.js → pkce-BPvWoBrr.js} +1 -1
- package/dist/npm/chunks/{pt-BR-DOkdlfoe.js → pt-BR-lA9mJ05F.js} +53 -12
- package/dist/npm/chunks/{report-CrIqQZDI.js → report-BjUgUNnT.js} +1 -1
- package/dist/npm/chunks/show-BinoJyED.js +97 -0
- package/dist/npm/chunks/signin-C2jjsxz9.js +101 -0
- package/dist/npm/chunks/{source-pXVve2Cx.js → source-NuflODx3.js} +1 -1
- package/dist/npm/chunks/src-9o2Ocq8d.js +221 -0
- package/dist/npm/chunks/start-Cbx6rMrr.js +1904 -0
- package/dist/npm/chunks/states-DLMCvwes.js +3 -0
- package/dist/npm/chunks/{upload-MgPYqPyE.js → upload-C4NpM-jE.js} +1 -1
- package/dist/npm/chunks/uploads-CY4bDbaI.js +1236 -0
- package/dist/npm/chunks/{wrap-Bl0gbnFa.js → wrap-D-xTKIzj.js} +20 -20
- package/dist/npm/chunks/{zh-CN-Z5fQCb7G.js → zh-CN-yqaDHwBx.js} +53 -12
- package/dist/npm/element.js +7 -1
- package/dist/npm/headless.js +2 -2
- 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 +12 -0
- package/dist/npm/types/core/auth.d.ts +1 -0
- package/dist/npm/types/core/client.d.ts +5 -1
- package/dist/npm/types/core/types.d.ts +19 -4
- package/dist/npm/vue.js +5 -1
- package/package.json +4 -1
- package/dist/npm/chunks/Checklist-CnlfeSbc.js +0 -282
- package/dist/npm/chunks/Composer-B1bBVszY.js +0 -725
- package/dist/npm/chunks/Panel-F37vIL1K.js +0 -1206
- package/dist/npm/chunks/TaskFields-fmy6_HtK.js +0 -289
- package/dist/npm/chunks/ThreadCard-D51slKST.js +0 -1113
- package/dist/npm/chunks/Viewer-BOBadqmC.js +0 -111
- package/dist/npm/chunks/card-bits-CAnzrqx3.js +0 -53
- package/dist/npm/chunks/late-words-B2bmZceJ.js +0 -12
- package/dist/npm/chunks/show-BgVC8gWY.js +0 -97
- package/dist/npm/chunks/signin-Dd1rb2BP.js +0 -75
- package/dist/npm/chunks/src-BTMy4Gyc.js +0 -208
- package/dist/npm/chunks/start-DtVlpt7p.js +0 -1878
- package/dist/npm/chunks/states-sfTbjZz8.js +0 -3
- package/dist/npm/chunks/uploads-D49mywwz.js +0 -1146
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { _ as e, c as t, l as n, m as r, n as i, u as a } from "./i18n-Mgs9VOuk.js";
|
|
2
|
+
import { n as o } from "./icons-_C6ZWmBY.js";
|
|
3
|
+
import { c as s } from "./start-Cbx6rMrr.js";
|
|
4
|
+
// src/ui/DatePicker.tsx
|
|
5
|
+
s(".ck-date-quick{border-bottom:1px solid var(--ck-hairline);flex-wrap:wrap;gap:4px;margin-bottom:4px;padding-bottom:8px;display:flex}.ck-date-chip{white-space:nowrap;border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);height:24px;color:var(--ck-text);font-size:var(--ck-fs-sm);transition:background-color var(--ck-fast);border:0;padding:0 5px;font-weight:500}.ck-date-clear{color:var(--ck-text-muted);background:0 0;margin-inline-start:auto;padding:0 4px}.ck-date-head{justify-content:space-between;align-items:center;height:28px;margin:4px 0;display:flex}.ck-date-title{font-size:var(--ck-fs-md);font-weight:600}.ck-root[dir=rtl] .ck-date-step svg{scale:-1 1}.ck-date-grid{gap:2px;display:grid}.ck-date-row{grid-template-columns:repeat(7,1fr);gap:2px;display:grid}.ck-date-wd{height:24px;color:var(--ck-text-muted);font-size:var(--ck-fs-xs);place-items:center;font-weight:500;display:grid}.ck-date-wd abbr{text-decoration:none}.ck-date-day{border-radius:var(--ck-radius-sm);width:100%;height:30px;color:var(--ck-text);font-size:var(--ck-fs-md);font-variant-numeric:tabular-nums;transition:background-color var(--ck-fast);background:0 0;border:0;padding:0}.ck-date-day[data-other]{color:var(--ck-text-muted)}.ck-date-day[data-today]{box-shadow:inset 0 0 0 1px var(--ck-control);font-weight:600}.ck-date-day[data-selected]{background:var(--ck-accent);color:var(--ck-accent-ink);box-shadow:none;font-weight:600}.ck-date-day:focus-visible{outline-offset:0}@media (hover:hover){.ck-date-chip:hover,.ck-date-day:not([data-selected]):hover{background:var(--ck-bg-hover)}}@media (pointer:coarse){.ck-date-day{height:40px}.ck-date-chip{height:36px}}@media (forced-colors:active){.ck-date-day[data-selected]{color:highlighttext;background:highlight}}");
|
|
6
|
+
var c = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, l = (e) => {
|
|
7
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
8
|
+
return new Date(t, n - 1, r);
|
|
9
|
+
}, u = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t), d = (e, t) => {
|
|
10
|
+
let n = new Date(e.getFullYear(), e.getMonth() + t + 1, 0).getDate();
|
|
11
|
+
return new Date(e.getFullYear(), e.getMonth() + t, Math.min(e.getDate(), n));
|
|
12
|
+
};
|
|
13
|
+
function f(e) {
|
|
14
|
+
try {
|
|
15
|
+
let t = new Intl.Locale(e), n = (t.getWeekInfo?.() ?? t.weekInfo)?.firstDay;
|
|
16
|
+
if (n) return n % 7;
|
|
17
|
+
} catch {}
|
|
18
|
+
return /^(en(-(US|CA))?|ja(-JP)?|ko(-KR)?|he(-IL)?|hi(-IN)?|pt-BR|zh-(TW|HK))$/i.test(e) ? 0 : /^ar(-(AF|BH|DJ|DZ|EG|IQ|IR|JO|KW|LY|OM|QA|SD|SY))?$/i.test(e) ? 6 : 1;
|
|
19
|
+
}
|
|
20
|
+
function p({ value: s, onPick: p }) {
|
|
21
|
+
let m = i(), h = /* @__PURE__ */ new Date(), g = c(h), [_, v] = e(() => s ? l(s) : new Date(h.getFullYear(), h.getMonth(), h.getDate())), y = f(m), b = new Date(_.getFullYear(), _.getMonth(), 1), x = u(b, -((b.getDay() - y + 7) % 7)), S = Array.from({ length: 42 }, (e, t) => u(x, t)), C = n() === "rtl", w = (e, t) => {
|
|
22
|
+
try {
|
|
23
|
+
return e.toLocaleDateString(m, t);
|
|
24
|
+
} catch {
|
|
25
|
+
return e.toDateString();
|
|
26
|
+
}
|
|
27
|
+
}, T = r(!0), [E] = e(() => (e) => void (T.current && e?.focus({ preventScroll: !0 }))), D = (e, t) => {
|
|
28
|
+
T.current = t, v(e);
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ a("div", {
|
|
31
|
+
class: "ck-date-pick",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ a("div", {
|
|
34
|
+
class: "ck-date-quick",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ a("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
class: "ck-date-chip",
|
|
39
|
+
onClick: () => p(g),
|
|
40
|
+
children: t("today")
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ a("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
class: "ck-date-chip",
|
|
45
|
+
onClick: () => p(c(u(h, 1))),
|
|
46
|
+
children: t("tomorrow")
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ a("button", {
|
|
49
|
+
type: "button",
|
|
50
|
+
class: "ck-date-chip",
|
|
51
|
+
onClick: () => p(c(u(h, 7))),
|
|
52
|
+
children: t("nextWeek")
|
|
53
|
+
}),
|
|
54
|
+
s ? /* @__PURE__ */ a("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
class: "ck-date-chip ck-date-clear",
|
|
57
|
+
onClick: () => p(null),
|
|
58
|
+
children: t("clear")
|
|
59
|
+
}) : null
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ a("div", {
|
|
63
|
+
class: "ck-date-head",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ a("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
class: "ck-icon ck-date-step",
|
|
68
|
+
"aria-label": t("previousMonth"),
|
|
69
|
+
onClick: () => D(d(_, -1), !1),
|
|
70
|
+
children: /* @__PURE__ */ a(o, { name: "chevronLeft" })
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ a("span", {
|
|
73
|
+
class: "ck-date-title",
|
|
74
|
+
"aria-live": "polite",
|
|
75
|
+
children: w(b, {
|
|
76
|
+
month: "long",
|
|
77
|
+
year: "numeric"
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ a("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
class: "ck-icon ck-date-step",
|
|
83
|
+
"aria-label": t("nextMonth"),
|
|
84
|
+
onClick: () => D(d(_, 1), !1),
|
|
85
|
+
children: /* @__PURE__ */ a(o, { name: "chevronRight" })
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ a("div", {
|
|
90
|
+
class: "ck-date-grid",
|
|
91
|
+
role: "grid",
|
|
92
|
+
"aria-label": w(b, {
|
|
93
|
+
month: "long",
|
|
94
|
+
year: "numeric"
|
|
95
|
+
}),
|
|
96
|
+
onKeyDown: (e) => {
|
|
97
|
+
let t = e.key, n = null;
|
|
98
|
+
if (t === "ArrowLeft") n = u(_, C ? 1 : -1);
|
|
99
|
+
else if (t === "ArrowRight") n = u(_, C ? -1 : 1);
|
|
100
|
+
else if (t === "ArrowUp") n = u(_, -7);
|
|
101
|
+
else if (t === "ArrowDown") n = u(_, 7);
|
|
102
|
+
else if (t === "Home") n = u(_, -((_.getDay() - y + 7) % 7));
|
|
103
|
+
else if (t === "End") n = u(_, 6 - (_.getDay() - y + 7) % 7);
|
|
104
|
+
else if (t === "PageUp") n = d(_, e.shiftKey ? -12 : -1);
|
|
105
|
+
else if (t === "PageDown") n = d(_, e.shiftKey ? 12 : 1);
|
|
106
|
+
else if (t === "Enter" || t === " ") return e.preventDefault(), p(c(_));
|
|
107
|
+
else return;
|
|
108
|
+
e.preventDefault(), D(n, !0);
|
|
109
|
+
},
|
|
110
|
+
children: [/* @__PURE__ */ a("div", {
|
|
111
|
+
role: "row",
|
|
112
|
+
class: "ck-date-row",
|
|
113
|
+
children: S.slice(0, 7).map((e) => /* @__PURE__ */ a("span", {
|
|
114
|
+
role: "columnheader",
|
|
115
|
+
class: "ck-date-wd",
|
|
116
|
+
children: /* @__PURE__ */ a("abbr", {
|
|
117
|
+
title: w(e, { weekday: "long" }),
|
|
118
|
+
children: w(e, { weekday: "narrow" })
|
|
119
|
+
})
|
|
120
|
+
}))
|
|
121
|
+
}), [
|
|
122
|
+
0,
|
|
123
|
+
1,
|
|
124
|
+
2,
|
|
125
|
+
3,
|
|
126
|
+
4,
|
|
127
|
+
5
|
|
128
|
+
].map((e) => /* @__PURE__ */ a("div", {
|
|
129
|
+
role: "row",
|
|
130
|
+
class: "ck-date-row",
|
|
131
|
+
children: S.slice(e * 7, e * 7 + 7).map((e) => {
|
|
132
|
+
let t = c(e), n = t === c(_);
|
|
133
|
+
return /* @__PURE__ */ a("span", {
|
|
134
|
+
role: "gridcell",
|
|
135
|
+
"aria-selected": t === s,
|
|
136
|
+
children: /* @__PURE__ */ a("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
class: "ck-date-day",
|
|
139
|
+
tabIndex: n ? 0 : -1,
|
|
140
|
+
ref: n ? E : void 0,
|
|
141
|
+
"data-other": e.getMonth() !== b.getMonth() || void 0,
|
|
142
|
+
"data-today": t === g || void 0,
|
|
143
|
+
"aria-current": t === g ? "date" : void 0,
|
|
144
|
+
"data-selected": t === s || void 0,
|
|
145
|
+
"aria-label": w(e, {
|
|
146
|
+
weekday: "long",
|
|
147
|
+
month: "long",
|
|
148
|
+
day: "numeric",
|
|
149
|
+
year: "numeric"
|
|
150
|
+
}),
|
|
151
|
+
onClick: () => p(t),
|
|
152
|
+
children: e.getDate()
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
})
|
|
156
|
+
}))]
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
export { p as DatePicker, f as weekStart, c as ymd };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { b as e, o as t, v as n } from "./client-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { b as e, o as t, v as n } from "./client-Cv8ddtuM.js";
|
|
2
|
+
import { _ as r, c as i, d as a, f as o, m as s, n as c, u as l } from "./i18n-Mgs9VOuk.js";
|
|
3
|
+
import { n as u } from "./icons-_C6ZWmBY.js";
|
|
4
|
+
import { r as d } from "./card-bits-cV8GdFWX.js";
|
|
5
|
+
import { c as f, h as p } from "./start-Cbx6rMrr.js";
|
|
5
6
|
// src/ui/Guest.tsx
|
|
6
|
-
|
|
7
|
-
async function m(e,
|
|
7
|
+
f(".ck-verify-text{text-wrap:pretty;overflow-wrap:anywhere;margin:0 0 12px;line-height:1.5}.ck-verify .ck-code{height:48px;font-family:var(--ck-mono);font-size:var(--ck-fs-xl);letter-spacing:.32em;text-align:center;font-variant-numeric:tabular-nums;padding-inline-start:calc(12px + .32em);padding-inline-end:12px}.ck-verify .ck-actions .ck-chip{font-variant-numeric:tabular-nums}.ck-verify .ck-chip:disabled{opacity:.5;cursor:default}.ck-verify .ck-note{margin:12px 0 0}@media (hover:hover){.ck-verify .ck-chip:disabled:hover{background:var(--ck-bg);color:var(--ck-text-muted)}}@media (pointer:coarse){.ck-verify .ck-chip{min-height:44px}}");
|
|
8
|
+
async function m(e, r) {
|
|
8
9
|
try {
|
|
9
10
|
let n = await e.api.request("/guest/start", {
|
|
10
11
|
method: "POST",
|
|
@@ -12,21 +13,21 @@ async function m(e, i) {
|
|
|
12
13
|
proof: !0,
|
|
13
14
|
body: {
|
|
14
15
|
client_id: e.options.project,
|
|
15
|
-
share:
|
|
16
|
-
name:
|
|
17
|
-
email:
|
|
18
|
-
locale:
|
|
16
|
+
share: r.share,
|
|
17
|
+
name: r.name.trim(),
|
|
18
|
+
email: r.email.trim(),
|
|
19
|
+
locale: c(),
|
|
19
20
|
page_url: t()
|
|
20
21
|
}
|
|
21
|
-
}),
|
|
22
|
+
}), i = Date.parse(n.pending_session.expires_at);
|
|
22
23
|
return e.auth.setPending({
|
|
23
24
|
token: n.access_token,
|
|
24
25
|
email: n.pending_session.email,
|
|
25
|
-
expiresAt: Number.isFinite(
|
|
26
|
+
expiresAt: Number.isFinite(i) ? i : Date.now() + n.expires_in * 1e3
|
|
26
27
|
}), "started";
|
|
27
28
|
} catch (e) {
|
|
28
29
|
if (e instanceof n && e.code === "origin_not_allowed") return "popup";
|
|
29
|
-
throw e instanceof n && (e.code === "share_expired" || e.status === 410 || e.errors?.share) ? new n(410, "share_expired",
|
|
30
|
+
throw e instanceof n && (e.code === "share_expired" || e.status === 410 || e.errors?.share) ? new n(410, "share_expired", i("shareExpired")) : e;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
function h() {
|
|
@@ -38,40 +39,40 @@ function h() {
|
|
|
38
39
|
}
|
|
39
40
|
return {
|
|
40
41
|
...e && e.length <= 64 ? { timezone: e } : {},
|
|
41
|
-
locale:
|
|
42
|
+
locale: c()
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
function g({ client: t, email:
|
|
45
|
-
let [y, b] =
|
|
46
|
-
|
|
47
|
-
let O =
|
|
48
|
-
|
|
45
|
+
function g({ client: t, email: c, onDone: f, onDifferentEmail: m, onClose: g }) {
|
|
46
|
+
let [y, b] = r(""), [x, S] = r(!1), [C, w] = r(null), [T, E] = r(null), D = s(null);
|
|
47
|
+
o(() => D.current?.focus({ preventScroll: !0 }), []);
|
|
48
|
+
let O = s({}), [k, A] = r(_);
|
|
49
|
+
a(() => {
|
|
49
50
|
if (k <= 0) return;
|
|
50
51
|
let e = setTimeout(() => A((e) => e - 1), 1e3);
|
|
51
52
|
return () => clearTimeout(e);
|
|
52
53
|
}, [k]);
|
|
53
|
-
let j = async (
|
|
54
|
-
if (/^\d{6}$/.test(
|
|
54
|
+
let j = async (r = y) => {
|
|
55
|
+
if (/^\d{6}$/.test(r) && !x) {
|
|
55
56
|
S(!0), w(null);
|
|
56
57
|
try {
|
|
57
58
|
var a;
|
|
58
59
|
let n = {
|
|
59
|
-
code:
|
|
60
|
+
code: r,
|
|
60
61
|
...h()
|
|
61
|
-
},
|
|
62
|
+
}, i = await t.api.request("/guest/verify", {
|
|
62
63
|
method: "POST",
|
|
63
64
|
body: n,
|
|
64
|
-
idempotencyKey: (a = O.current)[
|
|
65
|
+
idempotencyKey: (a = O.current)[r] ?? (a[r] = e(16))
|
|
65
66
|
});
|
|
66
|
-
t.auth.adopt(
|
|
67
|
+
t.auth.adopt(i), await t.loadSession().catch(() => null), f(i.published_thread_ids ?? []);
|
|
67
68
|
} catch (e) {
|
|
68
69
|
if ((e instanceof n ? e.status : 0) === 422) return b(""), D.current?.focus({ preventScroll: !0 }), w({
|
|
69
|
-
text:
|
|
70
|
+
text: i("verifyWrong"),
|
|
70
71
|
tone: "warning"
|
|
71
72
|
});
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
text:
|
|
73
|
+
let r = v(e);
|
|
74
|
+
r && (t.auth.setPending(null), E(r === "expired" ? "again" : "stop")), w({
|
|
75
|
+
text: r ? i(r === "link" ? "verifyLinkExpired" : r === "removed" ? "verifyRemoved" : "verifyExpired") : p(e),
|
|
75
76
|
tone: "warning"
|
|
76
77
|
});
|
|
77
78
|
} finally {
|
|
@@ -79,26 +80,26 @@ function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g })
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
}, M = async () => {
|
|
82
|
-
let
|
|
83
|
+
let r = { "Idempotency-Key": e(16) }, a = () => t.api.request("/guest/resend", {
|
|
83
84
|
method: "POST",
|
|
84
|
-
headers:
|
|
85
|
+
headers: r
|
|
85
86
|
});
|
|
86
87
|
try {
|
|
87
88
|
await a().catch((e) => {
|
|
88
89
|
if (e instanceof n && e.status === 0) return a();
|
|
89
90
|
throw e;
|
|
90
|
-
}), w({ text:
|
|
91
|
+
}), w({ text: i("verifyResent") }), A(_);
|
|
91
92
|
} catch (e) {
|
|
92
93
|
let t = e instanceof n && e.code === "guest_codes_paused";
|
|
93
94
|
w({
|
|
94
|
-
text: t ?
|
|
95
|
+
text: t ? i("guestCodesPaused") : e instanceof n && e.status === 429 ? i("verifyWait") : i("errorGeneric"),
|
|
95
96
|
tone: "warning"
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
100
|
return /* @__PURE__ */ l("div", {
|
|
100
101
|
class: "ck-card ck-verify",
|
|
101
|
-
style:
|
|
102
|
+
style: d({
|
|
102
103
|
x: innerWidth / 2 - 190,
|
|
103
104
|
y: 80
|
|
104
105
|
}),
|
|
@@ -112,13 +113,13 @@ function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g })
|
|
|
112
113
|
children: [/* @__PURE__ */ l("h2", {
|
|
113
114
|
class: "ck-card-title",
|
|
114
115
|
id: "ck-verify-title",
|
|
115
|
-
children:
|
|
116
|
+
children: i("verifyTitle")
|
|
116
117
|
}), /* @__PURE__ */ l("button", {
|
|
117
118
|
class: "ck-ghost",
|
|
118
|
-
"aria-label":
|
|
119
|
-
title:
|
|
119
|
+
"aria-label": i("closeVerify"),
|
|
120
|
+
title: i("closeVerify"),
|
|
120
121
|
onClick: () => g(),
|
|
121
|
-
children: /* @__PURE__ */ l(
|
|
122
|
+
children: /* @__PURE__ */ l(u, { name: "clear" })
|
|
122
123
|
})]
|
|
123
124
|
}),
|
|
124
125
|
/* @__PURE__ */ l("div", {
|
|
@@ -126,15 +127,15 @@ function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g })
|
|
|
126
127
|
children: [
|
|
127
128
|
/* @__PURE__ */ l("p", {
|
|
128
129
|
class: "ck-verify-text",
|
|
129
|
-
children:
|
|
130
|
+
children: i("verifyBody", { email: c })
|
|
130
131
|
}),
|
|
131
132
|
/* @__PURE__ */ l("p", {
|
|
132
133
|
class: "ck-verify-text",
|
|
133
|
-
children:
|
|
134
|
+
children: i("verifyLookFor", { website: t.state.get().config?.project?.name ?? "" })
|
|
134
135
|
}),
|
|
135
136
|
/* @__PURE__ */ l("label", {
|
|
136
137
|
class: "ck-field",
|
|
137
|
-
children: [/* @__PURE__ */ l("span", { children:
|
|
138
|
+
children: [/* @__PURE__ */ l("span", { children: i("verifyCode") }), /* @__PURE__ */ l("input", {
|
|
138
139
|
ref: D,
|
|
139
140
|
class: "ck-input ck-code",
|
|
140
141
|
"aria-invalid": C?.tone === "warning" || void 0,
|
|
@@ -166,13 +167,13 @@ function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g })
|
|
|
166
167
|
class: "ck-chip",
|
|
167
168
|
"aria-disabled": k > 0 || void 0,
|
|
168
169
|
onClick: () => k > 0 || void M(),
|
|
169
|
-
children: k > 0 ?
|
|
170
|
+
children: k > 0 ? i("verifyResendIn", { n: k }) : i("verifyResend")
|
|
170
171
|
}), /* @__PURE__ */ l("button", {
|
|
171
172
|
class: "ck-chip",
|
|
172
173
|
onClick: () => {
|
|
173
174
|
t.auth.setPending(null), m();
|
|
174
175
|
},
|
|
175
|
-
children:
|
|
176
|
+
children: i("verifyDifferent")
|
|
176
177
|
})]
|
|
177
178
|
})
|
|
178
179
|
]
|
|
@@ -182,17 +183,17 @@ function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g })
|
|
|
182
183
|
children: [/* @__PURE__ */ l("span", { class: "ck-spacer" }), T === "again" ? /* @__PURE__ */ l("button", {
|
|
183
184
|
class: "ck-btn ck-primary",
|
|
184
185
|
onClick: m,
|
|
185
|
-
children:
|
|
186
|
+
children: i("writeAgain")
|
|
186
187
|
}) : T === "stop" ? /* @__PURE__ */ l("button", {
|
|
187
188
|
class: "ck-btn",
|
|
188
189
|
onClick: () => g(),
|
|
189
|
-
children:
|
|
190
|
+
children: i("close")
|
|
190
191
|
}) : /* @__PURE__ */ l("button", {
|
|
191
192
|
class: "ck-btn ck-primary",
|
|
192
193
|
"aria-disabled": x || y.length !== 6 || void 0,
|
|
193
194
|
"aria-busy": x || void 0,
|
|
194
195
|
onClick: () => void j(),
|
|
195
|
-
children:
|
|
196
|
+
children: i(x ? "sending" : "verifyPublish")
|
|
196
197
|
})]
|
|
197
198
|
})
|
|
198
199
|
]
|
|
@@ -202,8 +203,8 @@ var _ = 60;
|
|
|
202
203
|
function v(e) {
|
|
203
204
|
return e instanceof n ? 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;
|
|
204
205
|
}
|
|
205
|
-
function y({ client: e, position: t, notify:
|
|
206
|
-
let [s, c] =
|
|
206
|
+
function y({ client: e, position: t, notify: a, onOpen: o }) {
|
|
207
|
+
let [s, c] = r(e.auth.finishLink), [u, d] = r(!1), [f, m] = r(null);
|
|
207
208
|
if (!s) return null;
|
|
208
209
|
let g = () => {
|
|
209
210
|
e.auth.finishLink = null, c(null);
|
|
@@ -221,18 +222,18 @@ function y({ client: e, position: t, notify: i, onOpen: a }) {
|
|
|
221
222
|
...h()
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
|
-
g(), e.auth.adopt(t), await e.loadSession().catch(() => null),
|
|
225
|
-
text:
|
|
225
|
+
g(), e.auth.adopt(t), await e.loadSession().catch(() => null), a({
|
|
226
|
+
text: i("sentGuest"),
|
|
226
227
|
tone: "success"
|
|
227
|
-
}), t.published_thread_ids?.[0] &&
|
|
228
|
+
}), t.published_thread_ids?.[0] && o(t.published_thread_ids[0]);
|
|
228
229
|
} catch (t) {
|
|
229
|
-
let
|
|
230
|
+
let r = t instanceof n ? t.code : "";
|
|
230
231
|
[
|
|
231
232
|
402,
|
|
232
233
|
403,
|
|
233
234
|
410,
|
|
234
235
|
422
|
|
235
|
-
].includes(t instanceof n ? t.status : 0) && (e.auth.finishLink = null), m(
|
|
236
|
+
].includes(t instanceof n ? t.status : 0) && (e.auth.finishLink = null), m(r === "finish_link_expired" ? i("finishExpired") : p(t)), d(!1);
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
};
|
|
@@ -245,23 +246,26 @@ function y({ client: e, position: t, notify: i, onOpen: a }) {
|
|
|
245
246
|
children: [
|
|
246
247
|
/* @__PURE__ */ l("h2", {
|
|
247
248
|
id: "ck-finish-title",
|
|
248
|
-
children:
|
|
249
|
+
children: i("finishTitle")
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ l("p", {
|
|
252
|
+
role: f ? "alert" : void 0,
|
|
253
|
+
children: f ?? i("finishBody")
|
|
249
254
|
}),
|
|
250
|
-
/* @__PURE__ */ l("p", { children: p ?? r("finishBody") }),
|
|
251
255
|
/* @__PURE__ */ l("div", {
|
|
252
256
|
class: "ck-actions",
|
|
253
|
-
children:
|
|
257
|
+
children: f && !e.auth.finishLink ? /* @__PURE__ */ l("button", {
|
|
254
258
|
class: "ck-btn",
|
|
255
259
|
onClick: g,
|
|
256
|
-
children:
|
|
260
|
+
children: i("close")
|
|
257
261
|
}) : /* @__PURE__ */ l("button", {
|
|
258
262
|
class: "ck-btn ck-primary",
|
|
259
263
|
"aria-busy": u || void 0,
|
|
260
264
|
onClick: () => void _(),
|
|
261
|
-
children:
|
|
265
|
+
children: i(u ? "sending" : "finishSend")
|
|
262
266
|
})
|
|
263
267
|
})
|
|
264
268
|
]
|
|
265
269
|
});
|
|
266
270
|
}
|
|
267
|
-
export { y as GuestFinish, g as GuestVerify, m as startGuest };
|
|
271
|
+
export { y as GuestFinish, g as GuestVerify, h as readerSettings, m as startGuest, v as verifyOutcome };
|