glitchgrab 1.65.1 → 1.66.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/README.md +13 -5
- package/dist/index.d.mts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +603 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +602 -116
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +47 -4
- package/dist/server.d.ts +47 -4
- package/dist/server.js +29 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +28 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
FeedbackButton: () => FeedbackButton,
|
|
37
37
|
GLITCHGRAB_SHORTCUT: () => GLITCHGRAB_SHORTCUT2,
|
|
38
38
|
GLITCHGRAB_SHORTCUT_MAC: () => GLITCHGRAB_SHORTCUT_MAC2,
|
|
39
|
+
GlitchgrabCallIssue: () => GlitchgrabCallIssue,
|
|
39
40
|
GlitchgrabErrorBoundary: () => GlitchgrabErrorBoundary,
|
|
40
41
|
GlitchgrabProvider: () => GlitchgrabProvider,
|
|
41
42
|
ReportButton: () => ReportButton,
|
|
@@ -3269,6 +3270,7 @@ function AssistSheet({
|
|
|
3269
3270
|
setShowChats(false);
|
|
3270
3271
|
setViewingChat(null);
|
|
3271
3272
|
resumeAskRef.current = (last == null ? void 0 : last.role) === "user";
|
|
3273
|
+
seedPendingRef.current = false;
|
|
3272
3274
|
}
|
|
3273
3275
|
(0, import_react3.useEffect)(() => {
|
|
3274
3276
|
if (!resumeAskRef.current) return;
|
|
@@ -3302,6 +3304,79 @@ function AssistSheet({
|
|
|
3302
3304
|
const otherChats = savedChats.filter((c) => c.id !== chatIdRef.current);
|
|
3303
3305
|
const resumable = (_a = otherChats.find((c) => c.status === "open" && c.messages.length > 0)) != null ? _a : null;
|
|
3304
3306
|
const empty = (phase === "chat" || phase === "type") && messages.length === 0 && !busy;
|
|
3307
|
+
const resumeCard = resumable ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3308
|
+
"div",
|
|
3309
|
+
{
|
|
3310
|
+
"data-gg-resume-chat": "",
|
|
3311
|
+
style: {
|
|
3312
|
+
display: "flex",
|
|
3313
|
+
flexDirection: "column",
|
|
3314
|
+
gap: "8px",
|
|
3315
|
+
padding: "10px 12px",
|
|
3316
|
+
borderRadius: "10px",
|
|
3317
|
+
border: `1px solid ${t.accent}55`,
|
|
3318
|
+
backgroundColor: t.bgSecondary,
|
|
3319
|
+
minWidth: 0
|
|
3320
|
+
},
|
|
3321
|
+
children: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
|
|
3323
|
+
"Pick up where you left off \xB7 ",
|
|
3324
|
+
chatAge(resumable.updatedAt)
|
|
3325
|
+
] }),
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3327
|
+
"span",
|
|
3328
|
+
{
|
|
3329
|
+
style: {
|
|
3330
|
+
fontSize: "13px",
|
|
3331
|
+
lineHeight: 1.45,
|
|
3332
|
+
overflowWrap: "anywhere"
|
|
3333
|
+
},
|
|
3334
|
+
children: resumable.title
|
|
3335
|
+
}
|
|
3336
|
+
),
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3339
|
+
"button",
|
|
3340
|
+
{
|
|
3341
|
+
type: "button",
|
|
3342
|
+
"data-gg-resume-continue": "",
|
|
3343
|
+
onClick: () => resumeChat(resumable),
|
|
3344
|
+
style: {
|
|
3345
|
+
border: "none",
|
|
3346
|
+
borderRadius: "999px",
|
|
3347
|
+
backgroundColor: t.accent,
|
|
3348
|
+
color: t.accentText,
|
|
3349
|
+
padding: "7px 13px",
|
|
3350
|
+
fontSize: "12px",
|
|
3351
|
+
fontWeight: 600,
|
|
3352
|
+
fontFamily: "inherit",
|
|
3353
|
+
cursor: "pointer"
|
|
3354
|
+
},
|
|
3355
|
+
children: "Continue this chat"
|
|
3356
|
+
}
|
|
3357
|
+
),
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3359
|
+
"button",
|
|
3360
|
+
{
|
|
3361
|
+
type: "button",
|
|
3362
|
+
onClick: () => setShowChats(true),
|
|
3363
|
+
style: {
|
|
3364
|
+
border: `1px solid ${t.inputBorder}`,
|
|
3365
|
+
borderRadius: "999px",
|
|
3366
|
+
background: "transparent",
|
|
3367
|
+
color: t.textMuted,
|
|
3368
|
+
padding: "7px 13px",
|
|
3369
|
+
fontSize: "12px",
|
|
3370
|
+
fontFamily: "inherit",
|
|
3371
|
+
cursor: "pointer"
|
|
3372
|
+
},
|
|
3373
|
+
children: "All chats"
|
|
3374
|
+
}
|
|
3375
|
+
)
|
|
3376
|
+
] })
|
|
3377
|
+
]
|
|
3378
|
+
}
|
|
3379
|
+
) : null;
|
|
3305
3380
|
function renderChatList() {
|
|
3306
3381
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-gg-chat-list": "", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3307
3382
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
@@ -3695,6 +3770,7 @@ function AssistSheet({
|
|
|
3695
3770
|
},
|
|
3696
3771
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: showChats ? "none" : "contents" }, children: [
|
|
3697
3772
|
phase === "severity" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
3773
|
+
resumeCard,
|
|
3698
3774
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
3699
3775
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Avatar, { who: "assistant", theme: t }),
|
|
3700
3776
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -3868,79 +3944,7 @@ function AssistSheet({
|
|
|
3868
3944
|
)
|
|
3869
3945
|
] }),
|
|
3870
3946
|
empty && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
3871
|
-
|
|
3872
|
-
"div",
|
|
3873
|
-
{
|
|
3874
|
-
"data-gg-resume-chat": "",
|
|
3875
|
-
style: {
|
|
3876
|
-
display: "flex",
|
|
3877
|
-
flexDirection: "column",
|
|
3878
|
-
gap: "8px",
|
|
3879
|
-
padding: "10px 12px",
|
|
3880
|
-
borderRadius: "10px",
|
|
3881
|
-
border: `1px solid ${t.accent}55`,
|
|
3882
|
-
backgroundColor: t.bgSecondary,
|
|
3883
|
-
minWidth: 0
|
|
3884
|
-
},
|
|
3885
|
-
children: [
|
|
3886
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
|
|
3887
|
-
"Pick up where you left off \xB7 ",
|
|
3888
|
-
chatAge(resumable.updatedAt)
|
|
3889
|
-
] }),
|
|
3890
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3891
|
-
"span",
|
|
3892
|
-
{
|
|
3893
|
-
style: {
|
|
3894
|
-
fontSize: "13px",
|
|
3895
|
-
lineHeight: 1.45,
|
|
3896
|
-
overflowWrap: "anywhere"
|
|
3897
|
-
},
|
|
3898
|
-
children: resumable.title
|
|
3899
|
-
}
|
|
3900
|
-
),
|
|
3901
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
|
|
3902
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3903
|
-
"button",
|
|
3904
|
-
{
|
|
3905
|
-
type: "button",
|
|
3906
|
-
"data-gg-resume-continue": "",
|
|
3907
|
-
onClick: () => resumeChat(resumable),
|
|
3908
|
-
style: {
|
|
3909
|
-
border: "none",
|
|
3910
|
-
borderRadius: "999px",
|
|
3911
|
-
backgroundColor: t.accent,
|
|
3912
|
-
color: t.accentText,
|
|
3913
|
-
padding: "7px 13px",
|
|
3914
|
-
fontSize: "12px",
|
|
3915
|
-
fontWeight: 600,
|
|
3916
|
-
fontFamily: "inherit",
|
|
3917
|
-
cursor: "pointer"
|
|
3918
|
-
},
|
|
3919
|
-
children: "Continue this chat"
|
|
3920
|
-
}
|
|
3921
|
-
),
|
|
3922
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3923
|
-
"button",
|
|
3924
|
-
{
|
|
3925
|
-
type: "button",
|
|
3926
|
-
onClick: () => setShowChats(true),
|
|
3927
|
-
style: {
|
|
3928
|
-
border: `1px solid ${t.inputBorder}`,
|
|
3929
|
-
borderRadius: "999px",
|
|
3930
|
-
background: "transparent",
|
|
3931
|
-
color: t.textMuted,
|
|
3932
|
-
padding: "7px 13px",
|
|
3933
|
-
fontSize: "12px",
|
|
3934
|
-
fontFamily: "inherit",
|
|
3935
|
-
cursor: "pointer"
|
|
3936
|
-
},
|
|
3937
|
-
children: "All chats"
|
|
3938
|
-
}
|
|
3939
|
-
)
|
|
3940
|
-
] })
|
|
3941
|
-
]
|
|
3942
|
-
}
|
|
3943
|
-
),
|
|
3947
|
+
resumeCard,
|
|
3944
3948
|
phase !== "type" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
3945
3949
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
3946
3950
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Avatar, { who: "assistant", theme: t }),
|
|
@@ -6705,8 +6709,8 @@ function ReportDialog({
|
|
|
6705
6709
|
}
|
|
6706
6710
|
};
|
|
6707
6711
|
(0, import_react.useEffect)(() => {
|
|
6708
|
-
setSimilarIssues(null);
|
|
6709
|
-
setPickedSimilar(null);
|
|
6712
|
+
if (similarIssues !== null) setSimilarIssues(null);
|
|
6713
|
+
if (pickedSimilar !== null) setPickedSimilar(null);
|
|
6710
6714
|
}, [description]);
|
|
6711
6715
|
const handleSubmit = async (opts) => {
|
|
6712
6716
|
var _a2, _b, _c;
|
|
@@ -9032,7 +9036,7 @@ function getPlaceholder(type, idx = 0, hasVoice = false) {
|
|
|
9032
9036
|
case "OTHER":
|
|
9033
9037
|
return "Tell us what's on your mind...";
|
|
9034
9038
|
case "VIDEO_SCRIPT":
|
|
9035
|
-
return "
|
|
9039
|
+
return "Describe the video or paste a script, and say which screens it should show...";
|
|
9036
9040
|
}
|
|
9037
9041
|
}
|
|
9038
9042
|
function getTypeIcon(type, color, size = 24) {
|
|
@@ -9159,6 +9163,70 @@ function getTypeIcon(type, color, size = 24) {
|
|
|
9159
9163
|
// src/booking-dialog.tsx
|
|
9160
9164
|
var import_react5 = require("react");
|
|
9161
9165
|
|
|
9166
|
+
// src/calendar-links.ts
|
|
9167
|
+
function stamp(iso) {
|
|
9168
|
+
return new Date(iso).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
9169
|
+
}
|
|
9170
|
+
function details(ev) {
|
|
9171
|
+
return [ev.description, ev.meetUrl ? `Join: ${ev.meetUrl}` : null].filter(Boolean).join("\n\n");
|
|
9172
|
+
}
|
|
9173
|
+
function googleCalendarUrl(ev) {
|
|
9174
|
+
const params = new URLSearchParams({
|
|
9175
|
+
action: "TEMPLATE",
|
|
9176
|
+
text: ev.title,
|
|
9177
|
+
dates: `${stamp(ev.startsAt)}/${stamp(ev.endsAt)}`,
|
|
9178
|
+
details: details(ev)
|
|
9179
|
+
});
|
|
9180
|
+
if (ev.meetUrl) params.set("location", ev.meetUrl);
|
|
9181
|
+
return `https://calendar.google.com/calendar/render?${params.toString()}`;
|
|
9182
|
+
}
|
|
9183
|
+
function esc(s) {
|
|
9184
|
+
return s.replace(/\\/g, "\\\\").replace(/;/g, ";").replace(/,/g, "\\,").replace(/\r?\n/g, "\\n");
|
|
9185
|
+
}
|
|
9186
|
+
function fold(line) {
|
|
9187
|
+
const out = [];
|
|
9188
|
+
let rest = line;
|
|
9189
|
+
while (rest.length > 74) {
|
|
9190
|
+
out.push(rest.slice(0, 74));
|
|
9191
|
+
rest = ` ${rest.slice(74)}`;
|
|
9192
|
+
}
|
|
9193
|
+
out.push(rest);
|
|
9194
|
+
return out.join("\r\n");
|
|
9195
|
+
}
|
|
9196
|
+
function buildIcs(ev) {
|
|
9197
|
+
const lines = [
|
|
9198
|
+
"BEGIN:VCALENDAR",
|
|
9199
|
+
"VERSION:2.0",
|
|
9200
|
+
"PRODID:-//Glitchgrab//Booking//EN",
|
|
9201
|
+
"CALSCALE:GREGORIAN",
|
|
9202
|
+
"METHOD:PUBLISH",
|
|
9203
|
+
"BEGIN:VEVENT",
|
|
9204
|
+
`UID:${ev.id}@glitchgrab.dev`,
|
|
9205
|
+
`DTSTAMP:${stamp((/* @__PURE__ */ new Date()).toISOString())}`,
|
|
9206
|
+
`DTSTART:${stamp(ev.startsAt)}`,
|
|
9207
|
+
`DTEND:${stamp(ev.endsAt)}`,
|
|
9208
|
+
`SUMMARY:${esc(ev.title)}`,
|
|
9209
|
+
`DESCRIPTION:${esc(details(ev))}`,
|
|
9210
|
+
...ev.meetUrl ? [`LOCATION:${esc(ev.meetUrl)}`, `URL:${ev.meetUrl}`] : [],
|
|
9211
|
+
// 15 minutes before — the calendar's own reminder, the point of the feature.
|
|
9212
|
+
"BEGIN:VALARM",
|
|
9213
|
+
"ACTION:DISPLAY",
|
|
9214
|
+
"DESCRIPTION:Demo starts in 15 minutes",
|
|
9215
|
+
"TRIGGER:-PT15M",
|
|
9216
|
+
"END:VALARM",
|
|
9217
|
+
"END:VEVENT",
|
|
9218
|
+
"END:VCALENDAR"
|
|
9219
|
+
];
|
|
9220
|
+
return lines.map(fold).join("\r\n") + "\r\n";
|
|
9221
|
+
}
|
|
9222
|
+
function icsDownloadUrl(ev) {
|
|
9223
|
+
try {
|
|
9224
|
+
return URL.createObjectURL(new Blob([buildIcs(ev)], { type: "text/calendar;charset=utf-8" }));
|
|
9225
|
+
} catch (e) {
|
|
9226
|
+
return null;
|
|
9227
|
+
}
|
|
9228
|
+
}
|
|
9229
|
+
|
|
9162
9230
|
// src/phone.ts
|
|
9163
9231
|
var COUNTRIES = [
|
|
9164
9232
|
{ iso: "IN", name: "India", dial: "91" },
|
|
@@ -9226,10 +9294,12 @@ function readQuestions(value) {
|
|
|
9226
9294
|
if (!Array.isArray(value)) return [];
|
|
9227
9295
|
return value.flatMap((row) => {
|
|
9228
9296
|
if (!row || typeof row !== "object") return [];
|
|
9229
|
-
const { id, label, options, required } = row;
|
|
9230
|
-
if (typeof id !== "string" || typeof label !== "string"
|
|
9297
|
+
const { id, label, options, required, type } = row;
|
|
9298
|
+
if (typeof id !== "string" || typeof label !== "string") return [];
|
|
9299
|
+
if (type === "text") return [{ id, label, type: "text", options: [], required: required !== false }];
|
|
9300
|
+
if (!Array.isArray(options)) return [];
|
|
9231
9301
|
const choices = options.filter((o) => typeof o === "string" && o !== "");
|
|
9232
|
-
return choices.length > 0 ? [{ id, label, options: choices, required: required !== false }] : [];
|
|
9302
|
+
return choices.length > 0 ? [{ id, label, type: "choice", options: choices, required: required !== false }] : [];
|
|
9233
9303
|
});
|
|
9234
9304
|
}
|
|
9235
9305
|
var LIGHT = {
|
|
@@ -9393,6 +9463,7 @@ function BookingDialog({
|
|
|
9393
9463
|
const [dial, setDial] = (0, import_react5.useState)(() => defaultDialForZone(localZone()));
|
|
9394
9464
|
const [phoneTouched, setPhoneTouched] = (0, import_react5.useState)(false);
|
|
9395
9465
|
const [tried, setTried] = (0, import_react5.useState)(false);
|
|
9466
|
+
const [toast, setToast] = (0, import_react5.useState)(null);
|
|
9396
9467
|
const [questions, setQuestions] = (0, import_react5.useState)([]);
|
|
9397
9468
|
const [answers, setAnswers] = (0, import_react5.useState)({});
|
|
9398
9469
|
const [pageLoaded, setPageLoaded] = (0, import_react5.useState)(false);
|
|
@@ -9496,8 +9567,14 @@ function BookingDialog({
|
|
|
9496
9567
|
const daySlots = day ? (_d = byDay.get(day)) != null ? _d : [] : [];
|
|
9497
9568
|
const atFirstMonth = month <= today.slice(0, 7);
|
|
9498
9569
|
const pastHorizon = monthLoaded && !error && byDay.size === 0 && !atFirstMonth;
|
|
9499
|
-
const
|
|
9500
|
-
|
|
9570
|
+
const isAnswered = (q) => {
|
|
9571
|
+
var _a2;
|
|
9572
|
+
return q.type === "text" ? Boolean((_a2 = answers[q.id]) == null ? void 0 : _a2.trim()) : q.options.includes(answers[q.id]);
|
|
9573
|
+
};
|
|
9574
|
+
const given = questions.flatMap(
|
|
9575
|
+
(q) => isAnswered(q) ? [{ ...q, answer: q.type === "text" ? answers[q.id].trim() : answers[q.id] }] : []
|
|
9576
|
+
);
|
|
9577
|
+
const unanswered = questions.filter((q) => q.required && !isAnswered(q));
|
|
9501
9578
|
const phoneError = phoneProblem(dial, phone);
|
|
9502
9579
|
const nameMissing = !name.trim();
|
|
9503
9580
|
const emailMissing = !email.includes("@");
|
|
@@ -9508,12 +9585,25 @@ function BookingDialog({
|
|
|
9508
9585
|
...unanswered.map((q) => `an answer to \u201C${q.label}\u201D`),
|
|
9509
9586
|
...selected ? [] : ["a day and time"]
|
|
9510
9587
|
];
|
|
9588
|
+
(0, import_react5.useEffect)(() => {
|
|
9589
|
+
if (!toast) return;
|
|
9590
|
+
const id = setTimeout(() => setToast(null), 4500);
|
|
9591
|
+
return () => clearTimeout(id);
|
|
9592
|
+
}, [toast]);
|
|
9511
9593
|
const roomy = step === "pick";
|
|
9512
9594
|
async function startBooking() {
|
|
9513
|
-
var _a2, _b2, _c2;
|
|
9595
|
+
var _a2, _b2, _c2, _d2;
|
|
9514
9596
|
if (missing.length > 0 || !selected) {
|
|
9515
9597
|
setTried(true);
|
|
9516
9598
|
setPhoneTouched(true);
|
|
9599
|
+
const parts = [
|
|
9600
|
+
...nameMissing ? ["your name"] : [],
|
|
9601
|
+
...phoneError ? ["a valid mobile number"] : [],
|
|
9602
|
+
...emailMissing ? ["your email"] : [],
|
|
9603
|
+
...unanswered.length ? [unanswered.length === 1 ? "1 required answer" : `${unanswered.length} required answers`] : [],
|
|
9604
|
+
...selected ? [] : ["a day and time"]
|
|
9605
|
+
];
|
|
9606
|
+
setToast(`Add ${parts.length > 1 ? `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}` : parts[0]}`);
|
|
9517
9607
|
return;
|
|
9518
9608
|
}
|
|
9519
9609
|
if (preview) {
|
|
@@ -9545,9 +9635,10 @@ function BookingDialog({
|
|
|
9545
9635
|
return;
|
|
9546
9636
|
}
|
|
9547
9637
|
if (json.data.confirmed) {
|
|
9548
|
-
|
|
9638
|
+
setBookingId((_b2 = json.data.bookingId) != null ? _b2 : null);
|
|
9639
|
+
setMeetUrl((_c2 = json.data.meetUrl) != null ? _c2 : null);
|
|
9549
9640
|
setStep("done");
|
|
9550
|
-
reportBooked(json.data.bookingId, (
|
|
9641
|
+
reportBooked(json.data.bookingId, (_d2 = json.data.meetUrl) != null ? _d2 : null);
|
|
9551
9642
|
return;
|
|
9552
9643
|
}
|
|
9553
9644
|
setBookingId(json.data.bookingId);
|
|
@@ -9594,6 +9685,7 @@ function BookingDialog({
|
|
|
9594
9685
|
const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
|
|
9595
9686
|
const monthDate = new Date(keyToUtc(`${month}-01`));
|
|
9596
9687
|
const muted = { color: t.muted };
|
|
9688
|
+
const calendarEvent = step === "done" && bookingId && selected && selectedEnd ? { id: bookingId, title: page.title, startsAt: selected.startsAt, endsAt: selectedEnd, meetUrl } : null;
|
|
9597
9689
|
const credit = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
9598
9690
|
"div",
|
|
9599
9691
|
{
|
|
@@ -10031,7 +10123,7 @@ function BookingDialog({
|
|
|
10031
10123
|
}
|
|
10032
10124
|
)
|
|
10033
10125
|
] });
|
|
10034
|
-
const
|
|
10126
|
+
const details2 = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
10035
10127
|
"div",
|
|
10036
10128
|
{
|
|
10037
10129
|
style: {
|
|
@@ -10085,7 +10177,22 @@ function BookingDialog({
|
|
|
10085
10177
|
),
|
|
10086
10178
|
!pageLoaded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, ...muted }, children: "Loading\u2026" }),
|
|
10087
10179
|
questions.map((q) => {
|
|
10180
|
+
var _a2;
|
|
10088
10181
|
const gap = tried && unanswered.includes(q);
|
|
10182
|
+
if (q.type === "text") {
|
|
10183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
10184
|
+
Field,
|
|
10185
|
+
{
|
|
10186
|
+
t,
|
|
10187
|
+
label: q.required ? q.label : `${q.label} (optional)`,
|
|
10188
|
+
value: (_a2 = answers[q.id]) != null ? _a2 : "",
|
|
10189
|
+
onChange: (v) => setAnswers((prev) => ({ ...prev, [q.id]: v })),
|
|
10190
|
+
maxLength: 300,
|
|
10191
|
+
error: gap ? "Please fill this in" : null
|
|
10192
|
+
},
|
|
10193
|
+
q.id
|
|
10194
|
+
);
|
|
10195
|
+
}
|
|
10089
10196
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": q.label, children: [
|
|
10090
10197
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 13, fontWeight: 500, overflowWrap: "anywhere" }, children: [
|
|
10091
10198
|
q.label,
|
|
@@ -10174,7 +10281,7 @@ function BookingDialog({
|
|
|
10174
10281
|
onClick: startBooking,
|
|
10175
10282
|
disabled: busy,
|
|
10176
10283
|
"aria-disabled": missing.length > 0,
|
|
10177
|
-
style: { ...primaryStyle(t, busy
|
|
10284
|
+
style: { ...primaryStyle(t, busy), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
|
|
10178
10285
|
children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
|
|
10179
10286
|
}
|
|
10180
10287
|
)
|
|
@@ -10226,6 +10333,41 @@ function BookingDialog({
|
|
|
10226
10333
|
email,
|
|
10227
10334
|
", and we'll send a WhatsApp reminder before the call."
|
|
10228
10335
|
] }),
|
|
10336
|
+
calendarEvent && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: [
|
|
10337
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
10338
|
+
"a",
|
|
10339
|
+
{
|
|
10340
|
+
href: googleCalendarUrl(calendarEvent),
|
|
10341
|
+
target: "_blank",
|
|
10342
|
+
rel: "noreferrer",
|
|
10343
|
+
style: { ...primaryStyle(t, false), textDecoration: "none" },
|
|
10344
|
+
children: "Add to Google Calendar"
|
|
10345
|
+
}
|
|
10346
|
+
),
|
|
10347
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
10348
|
+
"button",
|
|
10349
|
+
{
|
|
10350
|
+
type: "button",
|
|
10351
|
+
onClick: () => {
|
|
10352
|
+
const url = icsDownloadUrl(calendarEvent);
|
|
10353
|
+
if (!url) return;
|
|
10354
|
+
const a = document.createElement("a");
|
|
10355
|
+
a.href = url;
|
|
10356
|
+
a.download = "demo.ics";
|
|
10357
|
+
a.click();
|
|
10358
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
10359
|
+
},
|
|
10360
|
+
style: {
|
|
10361
|
+
...primaryStyle(t, false),
|
|
10362
|
+
background: "transparent",
|
|
10363
|
+
color: t.ink,
|
|
10364
|
+
border: `1px solid ${t.border}`,
|
|
10365
|
+
cursor: "pointer"
|
|
10366
|
+
},
|
|
10367
|
+
children: "Download .ics (Outlook, Apple)"
|
|
10368
|
+
}
|
|
10369
|
+
)
|
|
10370
|
+
] }),
|
|
10229
10371
|
meetUrl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
10230
10372
|
"a",
|
|
10231
10373
|
{
|
|
@@ -10299,6 +10441,30 @@ function BookingDialog({
|
|
|
10299
10441
|
lineHeight: 1.4
|
|
10300
10442
|
},
|
|
10301
10443
|
children: [
|
|
10444
|
+
toast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
10445
|
+
"div",
|
|
10446
|
+
{
|
|
10447
|
+
role: "status",
|
|
10448
|
+
"aria-live": "polite",
|
|
10449
|
+
style: {
|
|
10450
|
+
position: "fixed",
|
|
10451
|
+
left: "50%",
|
|
10452
|
+
bottom: wide ? 88 : 96,
|
|
10453
|
+
transform: "translateX(-50%)",
|
|
10454
|
+
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
10455
|
+
padding: "10px 16px",
|
|
10456
|
+
borderRadius: 10,
|
|
10457
|
+
background: t.ink,
|
|
10458
|
+
color: t.onInk,
|
|
10459
|
+
fontSize: 13,
|
|
10460
|
+
lineHeight: 1.5,
|
|
10461
|
+
fontWeight: 600,
|
|
10462
|
+
boxShadow: "0 8px 24px rgba(0,0,0,.35)",
|
|
10463
|
+
zIndex: 2147483647
|
|
10464
|
+
},
|
|
10465
|
+
children: toast
|
|
10466
|
+
}
|
|
10467
|
+
),
|
|
10302
10468
|
summary,
|
|
10303
10469
|
roomy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
10304
10470
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -10313,7 +10479,7 @@ function BookingDialog({
|
|
|
10313
10479
|
overflowY: wide && !split ? "auto" : void 0
|
|
10314
10480
|
},
|
|
10315
10481
|
children: [
|
|
10316
|
-
|
|
10482
|
+
details2,
|
|
10317
10483
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
10318
10484
|
"div",
|
|
10319
10485
|
{
|
|
@@ -10447,6 +10613,7 @@ function Field({
|
|
|
10447
10613
|
type = "text",
|
|
10448
10614
|
autoComplete,
|
|
10449
10615
|
inputMode,
|
|
10616
|
+
maxLength,
|
|
10450
10617
|
error
|
|
10451
10618
|
}) {
|
|
10452
10619
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
|
|
@@ -10458,6 +10625,7 @@ function Field({
|
|
|
10458
10625
|
value,
|
|
10459
10626
|
autoComplete,
|
|
10460
10627
|
inputMode,
|
|
10628
|
+
maxLength,
|
|
10461
10629
|
"aria-invalid": Boolean(error),
|
|
10462
10630
|
onChange: (e) => onChange(e.target.value),
|
|
10463
10631
|
style: {
|
|
@@ -10645,11 +10813,11 @@ function describeRejection(reason) {
|
|
|
10645
10813
|
const source = reason;
|
|
10646
10814
|
const nestedError = source.error;
|
|
10647
10815
|
const message = (_h = (_g = (_f = (_e = (_d = (_c = (_b = readString(source.message)) != null ? _b : readString(nestedError)) != null ? _c : readString(nestedError == null ? void 0 : nestedError.message)) != null ? _d : readScalar(source.code)) != null ? _e : readString(source.name)) != null ? _f : readScalar(source.status)) != null ? _g : readString(source.statusText)) != null ? _h : "";
|
|
10648
|
-
const
|
|
10816
|
+
const details2 = serialize(reason);
|
|
10649
10817
|
return {
|
|
10650
10818
|
message: message || (isEventLike(reason) ? describeEvent(reason) : describeShape(reason)),
|
|
10651
10819
|
stack,
|
|
10652
|
-
details
|
|
10820
|
+
details: details2
|
|
10653
10821
|
};
|
|
10654
10822
|
} catch (e) {
|
|
10655
10823
|
return { message: "" };
|
|
@@ -11491,19 +11659,337 @@ function FeedbackButton({
|
|
|
11491
11659
|
);
|
|
11492
11660
|
}
|
|
11493
11661
|
|
|
11494
|
-
// src/
|
|
11662
|
+
// src/call-issue-dialog.tsx
|
|
11495
11663
|
var import_react8 = require("react");
|
|
11664
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
11665
|
+
var DEFAULT_BASE_URL3 = "https://glitchgrab.dev";
|
|
11666
|
+
var ApiError = class extends Error {
|
|
11667
|
+
constructor(message, status, code) {
|
|
11668
|
+
super(message);
|
|
11669
|
+
this.status = status;
|
|
11670
|
+
this.code = code;
|
|
11671
|
+
}
|
|
11672
|
+
};
|
|
11673
|
+
function formatDuration2(sec) {
|
|
11674
|
+
if (!sec || sec < 1) return "";
|
|
11675
|
+
return `${Math.floor(sec / 60)}:${String(Math.round(sec % 60)).padStart(2, "0")}`;
|
|
11676
|
+
}
|
|
11677
|
+
function readDraft(value) {
|
|
11678
|
+
if (!value || typeof value !== "object") return null;
|
|
11679
|
+
const v = value;
|
|
11680
|
+
if (typeof v.id !== "string" || typeof v.title !== "string") return null;
|
|
11681
|
+
return {
|
|
11682
|
+
id: v.id,
|
|
11683
|
+
title: v.title,
|
|
11684
|
+
body: typeof v.body === "string" ? v.body : "",
|
|
11685
|
+
labels: Array.isArray(v.labels) ? v.labels.filter((l) => typeof l === "string") : [],
|
|
11686
|
+
quotes: Array.isArray(v.quotes) ? v.quotes.filter((q) => !!q && typeof q.text === "string").slice(0, 3) : [],
|
|
11687
|
+
status: typeof v.status === "string" ? v.status : "DRAFT",
|
|
11688
|
+
githubNumber: typeof v.githubNumber === "number" ? v.githubNumber : null,
|
|
11689
|
+
githubUrl: typeof v.githubUrl === "string" ? v.githubUrl : null
|
|
11690
|
+
};
|
|
11691
|
+
}
|
|
11692
|
+
function GlitchgrabCallIssue({ callId, open, onClose, getToken, baseUrl, onFiled }) {
|
|
11693
|
+
var _a, _b;
|
|
11694
|
+
const base = (baseUrl || DEFAULT_BASE_URL3).replace(/\/+$/, "");
|
|
11695
|
+
const tokenRef = (0, import_react8.useRef)(null);
|
|
11696
|
+
const [loaded, setLoaded] = (0, import_react8.useState)(null);
|
|
11697
|
+
const [busy, setBusy] = (0, import_react8.useState)(null);
|
|
11698
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
11699
|
+
const [picked, setPicked] = (0, import_react8.useState)(/* @__PURE__ */ new Set());
|
|
11700
|
+
const [filed, setFiled] = (0, import_react8.useState)([]);
|
|
11701
|
+
const [fixing, setFixing] = (0, import_react8.useState)(null);
|
|
11702
|
+
const [fixText, setFixText] = (0, import_react8.useState)("");
|
|
11703
|
+
const [fixBusy, setFixBusy] = (0, import_react8.useState)(false);
|
|
11704
|
+
const dark = typeof window !== "undefined" ? detectDark() : false;
|
|
11705
|
+
const accent = (_a = typeof window !== "undefined" ? detectHostAccent() : null) != null ? _a : { accent: "#3b82f6", accentText: "#fff" };
|
|
11706
|
+
const c = dark ? { bg: "#18181b", pane: "#222226", border: "#3f3f46", text: "#fafafa", muted: "#a1a1aa" } : { bg: "#ffffff", pane: "#f6f6f7", border: "#e4e4e7", text: "#18181b", muted: "#71717a" };
|
|
11707
|
+
const call = (0, import_react8.useCallback)(
|
|
11708
|
+
async (path, init = {}) => {
|
|
11709
|
+
var _a2, _b2, _c;
|
|
11710
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
11711
|
+
if (!tokenRef.current) tokenRef.current = await getToken(callId);
|
|
11712
|
+
const res = await fetch(`${base}/api/v1/sdk/call-issue/${encodeURIComponent(callId)}${path}`, {
|
|
11713
|
+
method: (_a2 = init.method) != null ? _a2 : "GET",
|
|
11714
|
+
headers: {
|
|
11715
|
+
Authorization: `Bearer ${tokenRef.current}`,
|
|
11716
|
+
...init.body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
11717
|
+
},
|
|
11718
|
+
...init.body === void 0 ? {} : { body: JSON.stringify(init.body) }
|
|
11719
|
+
});
|
|
11720
|
+
const json = await res.json().catch(() => null);
|
|
11721
|
+
if (res.ok && (json == null ? void 0 : json.success)) return json.data;
|
|
11722
|
+
if (res.status === 401 && attempt === 0) {
|
|
11723
|
+
tokenRef.current = null;
|
|
11724
|
+
continue;
|
|
11725
|
+
}
|
|
11726
|
+
throw new ApiError((_b2 = json == null ? void 0 : json.error) != null ? _b2 : `HTTP ${res.status}`, res.status, (_c = json == null ? void 0 : json.code) != null ? _c : null);
|
|
11727
|
+
}
|
|
11728
|
+
throw new ApiError("Could not reach Glitchgrab", 0, null);
|
|
11729
|
+
},
|
|
11730
|
+
[base, callId, getToken]
|
|
11731
|
+
);
|
|
11732
|
+
const apply = (0, import_react8.useCallback)((data) => {
|
|
11733
|
+
const d = data != null ? data : {};
|
|
11734
|
+
const drafts = (Array.isArray(d.drafts) ? d.drafts : []).map(readDraft).filter((x) => x !== null);
|
|
11735
|
+
const callRaw = d.call;
|
|
11736
|
+
setLoaded((prev) => {
|
|
11737
|
+
var _a2, _b2;
|
|
11738
|
+
return {
|
|
11739
|
+
drafts,
|
|
11740
|
+
canExtract: d.canExtract !== false,
|
|
11741
|
+
extractedAt: typeof d.extractedAt === "string" ? d.extractedAt : (_a2 = prev == null ? void 0 : prev.extractedAt) != null ? _a2 : null,
|
|
11742
|
+
call: callRaw && typeof callRaw.pageUrl === "string" ? {
|
|
11743
|
+
title: typeof callRaw.title === "string" ? callRaw.title : null,
|
|
11744
|
+
at: typeof callRaw.at === "string" ? callRaw.at : "",
|
|
11745
|
+
durationSec: typeof callRaw.durationSec === "number" ? callRaw.durationSec : null,
|
|
11746
|
+
pageUrl: callRaw.pageUrl
|
|
11747
|
+
} : (_b2 = prev == null ? void 0 : prev.call) != null ? _b2 : null
|
|
11748
|
+
};
|
|
11749
|
+
});
|
|
11750
|
+
setPicked(new Set(drafts.filter((x) => x.status === "DRAFT").map((x) => x.id)));
|
|
11751
|
+
}, []);
|
|
11752
|
+
const read = (0, import_react8.useCallback)(async () => {
|
|
11753
|
+
setBusy("read");
|
|
11754
|
+
setError(null);
|
|
11755
|
+
try {
|
|
11756
|
+
const data = await call("/drafts", { method: "POST" });
|
|
11757
|
+
apply({ ...data, canExtract: true, extractedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
11758
|
+
} catch (e) {
|
|
11759
|
+
setError(e instanceof Error ? e.message : "Could not read this call.");
|
|
11760
|
+
} finally {
|
|
11761
|
+
setBusy(null);
|
|
11762
|
+
}
|
|
11763
|
+
}, [apply, call]);
|
|
11764
|
+
(0, import_react8.useEffect)(() => {
|
|
11765
|
+
if (!open) return;
|
|
11766
|
+
let cancelled = false;
|
|
11767
|
+
setLoaded(null);
|
|
11768
|
+
setFiled([]);
|
|
11769
|
+
setError(null);
|
|
11770
|
+
setBusy("load");
|
|
11771
|
+
(async () => {
|
|
11772
|
+
try {
|
|
11773
|
+
const data = await call("/drafts");
|
|
11774
|
+
if (cancelled) return;
|
|
11775
|
+
apply(data);
|
|
11776
|
+
const hasDrafts = Array.isArray(data.drafts) && data.drafts.length > 0;
|
|
11777
|
+
if (!hasDrafts && data.canExtract !== false && !data.extractedAt) {
|
|
11778
|
+
setBusy(null);
|
|
11779
|
+
await read();
|
|
11780
|
+
}
|
|
11781
|
+
} catch (e) {
|
|
11782
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Could not open this call.");
|
|
11783
|
+
} finally {
|
|
11784
|
+
if (!cancelled) setBusy((b) => b === "load" ? null : b);
|
|
11785
|
+
}
|
|
11786
|
+
})();
|
|
11787
|
+
return () => {
|
|
11788
|
+
cancelled = true;
|
|
11789
|
+
};
|
|
11790
|
+
}, [open, callId]);
|
|
11791
|
+
(0, import_react8.useEffect)(() => {
|
|
11792
|
+
if (!open) return;
|
|
11793
|
+
const onKey = (e) => e.key === "Escape" && onClose();
|
|
11794
|
+
window.addEventListener("keydown", onKey);
|
|
11795
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
11796
|
+
}, [open, onClose]);
|
|
11797
|
+
if (!open) return null;
|
|
11798
|
+
const active = ((_b = loaded == null ? void 0 : loaded.drafts) != null ? _b : []).filter((d) => d.status === "DRAFT");
|
|
11799
|
+
const chosen = active.filter((d) => picked.has(d.id));
|
|
11800
|
+
const discard = async (id) => {
|
|
11801
|
+
try {
|
|
11802
|
+
await call(`/drafts/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
11803
|
+
setLoaded((l) => l ? { ...l, drafts: l.drafts.filter((d) => d.id !== id) } : l);
|
|
11804
|
+
setPicked((p) => {
|
|
11805
|
+
const next = new Set(p);
|
|
11806
|
+
next.delete(id);
|
|
11807
|
+
return next;
|
|
11808
|
+
});
|
|
11809
|
+
} catch (e) {
|
|
11810
|
+
setError(e instanceof Error ? e.message : "Could not remove it.");
|
|
11811
|
+
}
|
|
11812
|
+
};
|
|
11813
|
+
const correct = async (id) => {
|
|
11814
|
+
if (!fixText.trim()) return;
|
|
11815
|
+
setFixBusy(true);
|
|
11816
|
+
setError(null);
|
|
11817
|
+
try {
|
|
11818
|
+
const data = await call(`/drafts/${encodeURIComponent(id)}/chat`, {
|
|
11819
|
+
method: "POST",
|
|
11820
|
+
body: { message: fixText }
|
|
11821
|
+
});
|
|
11822
|
+
const next = readDraft(data.draft);
|
|
11823
|
+
if (next) setLoaded((l) => l ? { ...l, drafts: l.drafts.map((d) => d.id === id ? { ...d, ...next } : d) } : l);
|
|
11824
|
+
setFixing(null);
|
|
11825
|
+
setFixText("");
|
|
11826
|
+
} catch (e) {
|
|
11827
|
+
setError(e instanceof Error ? e.message : "Could not rewrite it.");
|
|
11828
|
+
} finally {
|
|
11829
|
+
setFixBusy(false);
|
|
11830
|
+
}
|
|
11831
|
+
};
|
|
11832
|
+
const file = async () => {
|
|
11833
|
+
var _a2, _b2, _c, _d, _e;
|
|
11834
|
+
setBusy("file");
|
|
11835
|
+
setError(null);
|
|
11836
|
+
try {
|
|
11837
|
+
const data = await call("/create", { method: "POST", body: { draftIds: chosen.map((d) => d.id) } });
|
|
11838
|
+
const done = [...(_a2 = data.created) != null ? _a2 : [], ...(_b2 = data.already) != null ? _b2 : []];
|
|
11839
|
+
setFiled(done);
|
|
11840
|
+
if (((_c = data.created) != null ? _c : []).length > 0) onFiled == null ? void 0 : onFiled((_d = data.created) != null ? _d : []);
|
|
11841
|
+
if ((_e = data.failed) == null ? void 0 : _e.length) setError(`${data.failed.length} could not be filed: ${data.failed[0].error}`);
|
|
11842
|
+
const doneIds = new Set(done.map((d) => d.id));
|
|
11843
|
+
setLoaded((l) => l ? { ...l, drafts: l.drafts.filter((d) => !doneIds.has(d.id)) } : l);
|
|
11844
|
+
} catch (e) {
|
|
11845
|
+
setError(e instanceof Error ? e.message : "Could not file the issues.");
|
|
11846
|
+
} finally {
|
|
11847
|
+
setBusy(null);
|
|
11848
|
+
}
|
|
11849
|
+
};
|
|
11850
|
+
const button = (primary, disabled) => ({
|
|
11851
|
+
padding: "8px 14px",
|
|
11852
|
+
borderRadius: 8,
|
|
11853
|
+
border: primary ? 0 : `1px solid ${c.border}`,
|
|
11854
|
+
background: primary ? accent.accent : "transparent",
|
|
11855
|
+
color: primary ? accent.accentText : c.text,
|
|
11856
|
+
fontSize: 13,
|
|
11857
|
+
fontWeight: 500,
|
|
11858
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
11859
|
+
opacity: disabled ? 0.55 : 1
|
|
11860
|
+
});
|
|
11861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
11862
|
+
"div",
|
|
11863
|
+
{
|
|
11864
|
+
role: "dialog",
|
|
11865
|
+
"aria-modal": "true",
|
|
11866
|
+
"aria-label": "Create issues from this call",
|
|
11867
|
+
onClick: (e) => e.target === e.currentTarget && onClose(),
|
|
11868
|
+
style: { position: "fixed", inset: 0, zIndex: 2147483e3, background: "rgba(0,0,0,0.45)", display: "flex", justifyContent: "flex-end" },
|
|
11869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
11870
|
+
"div",
|
|
11871
|
+
{
|
|
11872
|
+
style: {
|
|
11873
|
+
width: "min(560px, 100vw)",
|
|
11874
|
+
height: "100%",
|
|
11875
|
+
background: c.bg,
|
|
11876
|
+
color: c.text,
|
|
11877
|
+
borderLeft: `1px solid ${c.border}`,
|
|
11878
|
+
display: "flex",
|
|
11879
|
+
flexDirection: "column",
|
|
11880
|
+
fontFamily: "inherit",
|
|
11881
|
+
boxSizing: "border-box"
|
|
11882
|
+
},
|
|
11883
|
+
children: [
|
|
11884
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: "16px 18px", borderBottom: `1px solid ${c.border}`, display: "flex", gap: 12, alignItems: "flex-start" }, children: [
|
|
11885
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
11886
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 15, fontWeight: 600 }, children: "Create issues from this call" }),
|
|
11887
|
+
(loaded == null ? void 0 : loaded.call) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 12, color: c.muted, marginTop: 4, overflowWrap: "anywhere" }, children: [
|
|
11888
|
+
loaded.call.title ? `${loaded.call.title} \xB7 ` : "",
|
|
11889
|
+
loaded.call.at ? new Date(loaded.call.at).toLocaleString() : "",
|
|
11890
|
+
formatDuration2(loaded.call.durationSec) ? ` \xB7 ${formatDuration2(loaded.call.durationSec)}` : "",
|
|
11891
|
+
" \xB7 ",
|
|
11892
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href: loaded.call.pageUrl, target: "_blank", rel: "noreferrer", style: { color: accent.accent }, children: "Open in Glitchgrab \u2197" })
|
|
11893
|
+
] })
|
|
11894
|
+
] }),
|
|
11895
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: onClose, "aria-label": "Close", style: { ...button(false, false), padding: "4px 10px" }, children: "\u2715" })
|
|
11896
|
+
] }),
|
|
11897
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, overflowY: "auto", padding: 18, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
11898
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { role: "alert", style: { padding: "10px 12px", borderRadius: 8, border: "1px solid #ef4444", color: "#ef4444", fontSize: 13 }, children: error }),
|
|
11899
|
+
(busy === "load" || busy === "read") && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { color: c.muted, fontSize: 13 }, children: busy === "read" ? "Reading the call\u2026 this takes about 20\u201340 seconds." : "Opening the call\u2026" }),
|
|
11900
|
+
filed.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 12, borderRadius: 8, background: c.pane, fontSize: 13 }, children: [
|
|
11901
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontWeight: 600, marginBottom: 6 }, children: [
|
|
11902
|
+
"\u2713 Filed ",
|
|
11903
|
+
filed.length === 1 ? "1 issue" : `${filed.length} issues`
|
|
11904
|
+
] }),
|
|
11905
|
+
filed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { overflowWrap: "anywhere" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("a", { href: f.url, target: "_blank", rel: "noreferrer", style: { color: accent.accent }, children: [
|
|
11906
|
+
"#",
|
|
11907
|
+
f.number,
|
|
11908
|
+
" ",
|
|
11909
|
+
f.title,
|
|
11910
|
+
" \u2197"
|
|
11911
|
+
] }) }, f.id)),
|
|
11912
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { color: c.muted, marginTop: 6 }, children: "Each carries the call id, a link to the call and the lines it came from." })
|
|
11913
|
+
] }),
|
|
11914
|
+
!busy && loaded && !loaded.canExtract && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { color: c.muted, fontSize: 13 }, children: "This call has no transcript yet. It is ready a few minutes after the call ends." }),
|
|
11915
|
+
!busy && loaded && loaded.canExtract && active.length === 0 && filed.length === 0 && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { color: c.muted, fontSize: 13 }, children: "Nothing in this call needs an issue." }),
|
|
11916
|
+
active.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { border: `1px solid ${c.border}`, borderRadius: 10, padding: 12, background: c.pane }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 10, alignItems: "flex-start" }, children: [
|
|
11917
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
11918
|
+
"input",
|
|
11919
|
+
{
|
|
11920
|
+
type: "checkbox",
|
|
11921
|
+
"aria-label": `Select ${d.title}`,
|
|
11922
|
+
checked: picked.has(d.id),
|
|
11923
|
+
onChange: () => setPicked((p) => {
|
|
11924
|
+
const next = new Set(p);
|
|
11925
|
+
if (next.has(d.id)) next.delete(d.id);
|
|
11926
|
+
else next.add(d.id);
|
|
11927
|
+
return next;
|
|
11928
|
+
}),
|
|
11929
|
+
style: { marginTop: 3 }
|
|
11930
|
+
}
|
|
11931
|
+
),
|
|
11932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
11933
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 14, fontWeight: 600, overflowWrap: "anywhere" }, children: [
|
|
11934
|
+
i + 1,
|
|
11935
|
+
". ",
|
|
11936
|
+
d.title
|
|
11937
|
+
] }),
|
|
11938
|
+
d.labels.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: c.muted, marginTop: 2 }, children: d.labels.join(" \xB7 ") }),
|
|
11939
|
+
d.quotes.map((q, qi) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 12, color: c.muted, marginTop: 6, borderLeft: `2px solid ${c.border}`, paddingLeft: 8, overflowWrap: "anywhere" }, children: [
|
|
11940
|
+
q.speaker ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("b", { children: [
|
|
11941
|
+
q.speaker,
|
|
11942
|
+
": "
|
|
11943
|
+
] }) : null,
|
|
11944
|
+
q.text
|
|
11945
|
+
] }, qi)),
|
|
11946
|
+
fixing === d.id ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 6, marginTop: 8 }, children: [
|
|
11947
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
11948
|
+
"input",
|
|
11949
|
+
{
|
|
11950
|
+
value: fixText,
|
|
11951
|
+
onChange: (e) => setFixText(e.target.value),
|
|
11952
|
+
onKeyDown: (e) => e.key === "Enter" && !fixBusy && void correct(d.id),
|
|
11953
|
+
placeholder: "attendance here means WhatsApp check-in, not a biometric device",
|
|
11954
|
+
"aria-label": "What should change in this draft",
|
|
11955
|
+
style: { flex: 1, padding: "7px 9px", borderRadius: 8, border: `1px solid ${c.border}`, background: c.bg, color: c.text, fontSize: 12 }
|
|
11956
|
+
}
|
|
11957
|
+
),
|
|
11958
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", disabled: fixBusy || !fixText.trim(), onClick: () => void correct(d.id), style: button(true, fixBusy || !fixText.trim()), children: fixBusy ? "Rewriting\u2026" : "Send" })
|
|
11959
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 12, marginTop: 8, fontSize: 12 }, children: [
|
|
11960
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => {
|
|
11961
|
+
setFixing(d.id);
|
|
11962
|
+
setFixText("");
|
|
11963
|
+
}, style: { background: "none", border: 0, padding: 0, color: accent.accent, cursor: "pointer" }, children: "Not what we meant" }),
|
|
11964
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => void discard(d.id), style: { background: "none", border: 0, padding: 0, color: c.muted, cursor: "pointer" }, children: "Remove" })
|
|
11965
|
+
] })
|
|
11966
|
+
] })
|
|
11967
|
+
] }) }, d.id))
|
|
11968
|
+
] }),
|
|
11969
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: "12px 18px", borderTop: `1px solid ${c.border}`, display: "flex", gap: 10, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
11970
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", disabled: busy !== null || !(loaded == null ? void 0 : loaded.canExtract), onClick: () => void read(), style: button(false, busy !== null || !(loaded == null ? void 0 : loaded.canExtract)), children: "Read the call again" }),
|
|
11971
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", disabled: busy !== null || chosen.length === 0, onClick: () => void file(), style: button(true, busy !== null || chosen.length === 0), children: busy === "file" ? "Creating\u2026" : chosen.length === 1 ? "Create 1 issue" : `Create ${chosen.length} issues` })
|
|
11972
|
+
] })
|
|
11973
|
+
]
|
|
11974
|
+
}
|
|
11975
|
+
)
|
|
11976
|
+
}
|
|
11977
|
+
);
|
|
11978
|
+
}
|
|
11979
|
+
|
|
11980
|
+
// src/use-reports.ts
|
|
11981
|
+
var import_react9 = require("react");
|
|
11496
11982
|
var BASE_URL = "https://glitchgrab.dev";
|
|
11497
11983
|
function useGlitchgrabReports({
|
|
11498
11984
|
token,
|
|
11499
11985
|
userId,
|
|
11500
11986
|
limit = 100
|
|
11501
11987
|
}) {
|
|
11502
|
-
const [reports, setReports] = (0,
|
|
11503
|
-
const [isLoading, setIsLoading] = (0,
|
|
11504
|
-
const [isFetching, setIsFetching] = (0,
|
|
11505
|
-
const [error, setError] = (0,
|
|
11506
|
-
const fetchReports = (0,
|
|
11988
|
+
const [reports, setReports] = (0, import_react9.useState)([]);
|
|
11989
|
+
const [isLoading, setIsLoading] = (0, import_react9.useState)(true);
|
|
11990
|
+
const [isFetching, setIsFetching] = (0, import_react9.useState)(false);
|
|
11991
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
11992
|
+
const fetchReports = (0, import_react9.useCallback)(async () => {
|
|
11507
11993
|
var _a, _b;
|
|
11508
11994
|
if (!token || !userId) {
|
|
11509
11995
|
setIsLoading(false);
|
|
@@ -11529,7 +12015,7 @@ function useGlitchgrabReports({
|
|
|
11529
12015
|
setIsFetching(false);
|
|
11530
12016
|
}
|
|
11531
12017
|
}, [token, userId, limit]);
|
|
11532
|
-
(0,
|
|
12018
|
+
(0, import_react9.useEffect)(() => {
|
|
11533
12019
|
fetchReports();
|
|
11534
12020
|
}, [fetchReports]);
|
|
11535
12021
|
return { reports, isLoading, isFetching, error, refetch: fetchReports };
|
|
@@ -11566,9 +12052,9 @@ function useGlitchgrabActions({
|
|
|
11566
12052
|
onSuccess,
|
|
11567
12053
|
onError
|
|
11568
12054
|
}) {
|
|
11569
|
-
const [isPending, setIsPending] = (0,
|
|
11570
|
-
const [error, setError] = (0,
|
|
11571
|
-
const run = (0,
|
|
12055
|
+
const [isPending, setIsPending] = (0, import_react9.useState)(false);
|
|
12056
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
12057
|
+
const run = (0, import_react9.useCallback)(
|
|
11572
12058
|
async (reportId, body) => {
|
|
11573
12059
|
setIsPending(true);
|
|
11574
12060
|
setError(null);
|
|
@@ -11632,12 +12118,12 @@ function useGlitchgrabReportThread({
|
|
|
11632
12118
|
reporterEmail
|
|
11633
12119
|
}) {
|
|
11634
12120
|
var _a;
|
|
11635
|
-
const [report, setReport] = (0,
|
|
11636
|
-
const [isLoading, setIsLoading] = (0,
|
|
11637
|
-
const [isFetching, setIsFetching] = (0,
|
|
11638
|
-
const [isPosting, setIsPosting] = (0,
|
|
11639
|
-
const [error, setError] = (0,
|
|
11640
|
-
const refetch = (0,
|
|
12121
|
+
const [report, setReport] = (0, import_react9.useState)(null);
|
|
12122
|
+
const [isLoading, setIsLoading] = (0, import_react9.useState)(!!reportId);
|
|
12123
|
+
const [isFetching, setIsFetching] = (0, import_react9.useState)(false);
|
|
12124
|
+
const [isPosting, setIsPosting] = (0, import_react9.useState)(false);
|
|
12125
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
12126
|
+
const refetch = (0, import_react9.useCallback)(async () => {
|
|
11641
12127
|
if (!token || !reportId) {
|
|
11642
12128
|
setReport(null);
|
|
11643
12129
|
setIsLoading(false);
|
|
@@ -11654,10 +12140,10 @@ function useGlitchgrabReportThread({
|
|
|
11654
12140
|
setIsFetching(false);
|
|
11655
12141
|
}
|
|
11656
12142
|
}, [token, reportId]);
|
|
11657
|
-
(0,
|
|
12143
|
+
(0, import_react9.useEffect)(() => {
|
|
11658
12144
|
refetch();
|
|
11659
12145
|
}, [refetch]);
|
|
11660
|
-
const addComment = (0,
|
|
12146
|
+
const addComment = (0, import_react9.useCallback)(
|
|
11661
12147
|
async (message) => {
|
|
11662
12148
|
if (!token || !reportId || !message.trim()) return false;
|
|
11663
12149
|
setIsPosting(true);
|
|
@@ -11679,8 +12165,8 @@ function useGlitchgrabReportThread({
|
|
|
11679
12165
|
}
|
|
11680
12166
|
|
|
11681
12167
|
// src/use-feedback.ts
|
|
11682
|
-
var
|
|
11683
|
-
var
|
|
12168
|
+
var import_react10 = require("react");
|
|
12169
|
+
var DEFAULT_BASE_URL4 = "https://glitchgrab.dev";
|
|
11684
12170
|
function buildUrl({
|
|
11685
12171
|
approvedOnly,
|
|
11686
12172
|
userId,
|
|
@@ -11692,7 +12178,7 @@ function buildUrl({
|
|
|
11692
12178
|
if (approvedOnly) params.set("approved", "true");
|
|
11693
12179
|
if (userId) params.set("reporterPrimaryKey", userId);
|
|
11694
12180
|
if (minRating) params.set("minRating", String(minRating));
|
|
11695
|
-
return `${baseUrl != null ? baseUrl :
|
|
12181
|
+
return `${baseUrl != null ? baseUrl : DEFAULT_BASE_URL4}/api/v1/sdk/feedback?${params.toString()}`;
|
|
11696
12182
|
}
|
|
11697
12183
|
async function fetchGlitchgrabFeedback(query) {
|
|
11698
12184
|
var _a, _b;
|
|
@@ -11705,11 +12191,11 @@ async function fetchGlitchgrabFeedback(query) {
|
|
|
11705
12191
|
}
|
|
11706
12192
|
function useGlitchgrabFeedback(query) {
|
|
11707
12193
|
const { token, approvedOnly, userId, minRating, limit, baseUrl } = query;
|
|
11708
|
-
const [feedback, setFeedback] = (0,
|
|
11709
|
-
const [isLoading, setIsLoading] = (0,
|
|
11710
|
-
const [isFetching, setIsFetching] = (0,
|
|
11711
|
-
const [error, setError] = (0,
|
|
11712
|
-
const load = (0,
|
|
12194
|
+
const [feedback, setFeedback] = (0, import_react10.useState)([]);
|
|
12195
|
+
const [isLoading, setIsLoading] = (0, import_react10.useState)(true);
|
|
12196
|
+
const [isFetching, setIsFetching] = (0, import_react10.useState)(false);
|
|
12197
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
12198
|
+
const load = (0, import_react10.useCallback)(async () => {
|
|
11713
12199
|
if (!token) {
|
|
11714
12200
|
setIsLoading(false);
|
|
11715
12201
|
return;
|
|
@@ -11733,7 +12219,7 @@ function useGlitchgrabFeedback(query) {
|
|
|
11733
12219
|
setIsFetching(false);
|
|
11734
12220
|
}
|
|
11735
12221
|
}, [token, approvedOnly, userId, minRating, limit, baseUrl]);
|
|
11736
|
-
(0,
|
|
12222
|
+
(0, import_react10.useEffect)(() => {
|
|
11737
12223
|
load();
|
|
11738
12224
|
}, [load]);
|
|
11739
12225
|
return { feedback, isLoading, isFetching, error, refetch: load };
|
|
@@ -11745,6 +12231,7 @@ function useGlitchgrabFeedback(query) {
|
|
|
11745
12231
|
FeedbackButton,
|
|
11746
12232
|
GLITCHGRAB_SHORTCUT,
|
|
11747
12233
|
GLITCHGRAB_SHORTCUT_MAC,
|
|
12234
|
+
GlitchgrabCallIssue,
|
|
11748
12235
|
GlitchgrabErrorBoundary,
|
|
11749
12236
|
GlitchgrabProvider,
|
|
11750
12237
|
ReportButton,
|