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/dist/index.mjs CHANGED
@@ -3210,6 +3210,7 @@ function AssistSheet({
3210
3210
  setShowChats(false);
3211
3211
  setViewingChat(null);
3212
3212
  resumeAskRef.current = (last == null ? void 0 : last.role) === "user";
3213
+ seedPendingRef.current = false;
3213
3214
  }
3214
3215
  useEffect2(() => {
3215
3216
  if (!resumeAskRef.current) return;
@@ -3243,6 +3244,79 @@ function AssistSheet({
3243
3244
  const otherChats = savedChats.filter((c) => c.id !== chatIdRef.current);
3244
3245
  const resumable = (_a = otherChats.find((c) => c.status === "open" && c.messages.length > 0)) != null ? _a : null;
3245
3246
  const empty = (phase === "chat" || phase === "type") && messages.length === 0 && !busy;
3247
+ const resumeCard = resumable ? /* @__PURE__ */ jsxs3(
3248
+ "div",
3249
+ {
3250
+ "data-gg-resume-chat": "",
3251
+ style: {
3252
+ display: "flex",
3253
+ flexDirection: "column",
3254
+ gap: "8px",
3255
+ padding: "10px 12px",
3256
+ borderRadius: "10px",
3257
+ border: `1px solid ${t.accent}55`,
3258
+ backgroundColor: t.bgSecondary,
3259
+ minWidth: 0
3260
+ },
3261
+ children: [
3262
+ /* @__PURE__ */ jsxs3("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
3263
+ "Pick up where you left off \xB7 ",
3264
+ chatAge(resumable.updatedAt)
3265
+ ] }),
3266
+ /* @__PURE__ */ jsx3(
3267
+ "span",
3268
+ {
3269
+ style: {
3270
+ fontSize: "13px",
3271
+ lineHeight: 1.45,
3272
+ overflowWrap: "anywhere"
3273
+ },
3274
+ children: resumable.title
3275
+ }
3276
+ ),
3277
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
3278
+ /* @__PURE__ */ jsx3(
3279
+ "button",
3280
+ {
3281
+ type: "button",
3282
+ "data-gg-resume-continue": "",
3283
+ onClick: () => resumeChat(resumable),
3284
+ style: {
3285
+ border: "none",
3286
+ borderRadius: "999px",
3287
+ backgroundColor: t.accent,
3288
+ color: t.accentText,
3289
+ padding: "7px 13px",
3290
+ fontSize: "12px",
3291
+ fontWeight: 600,
3292
+ fontFamily: "inherit",
3293
+ cursor: "pointer"
3294
+ },
3295
+ children: "Continue this chat"
3296
+ }
3297
+ ),
3298
+ /* @__PURE__ */ jsx3(
3299
+ "button",
3300
+ {
3301
+ type: "button",
3302
+ onClick: () => setShowChats(true),
3303
+ style: {
3304
+ border: `1px solid ${t.inputBorder}`,
3305
+ borderRadius: "999px",
3306
+ background: "transparent",
3307
+ color: t.textMuted,
3308
+ padding: "7px 13px",
3309
+ fontSize: "12px",
3310
+ fontFamily: "inherit",
3311
+ cursor: "pointer"
3312
+ },
3313
+ children: "All chats"
3314
+ }
3315
+ )
3316
+ ] })
3317
+ ]
3318
+ }
3319
+ ) : null;
3246
3320
  function renderChatList() {
3247
3321
  return /* @__PURE__ */ jsxs3("div", { "data-gg-chat-list": "", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
3248
3322
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
@@ -3636,6 +3710,7 @@ function AssistSheet({
3636
3710
  },
3637
3711
  children: /* @__PURE__ */ jsxs3("div", { style: { display: showChats ? "none" : "contents" }, children: [
3638
3712
  phase === "severity" && /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3713
+ resumeCard,
3639
3714
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
3640
3715
  /* @__PURE__ */ jsx3(Avatar, { who: "assistant", theme: t }),
3641
3716
  /* @__PURE__ */ jsx3(
@@ -3809,79 +3884,7 @@ function AssistSheet({
3809
3884
  )
3810
3885
  ] }),
3811
3886
  empty && /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3812
- resumable && /* @__PURE__ */ jsxs3(
3813
- "div",
3814
- {
3815
- "data-gg-resume-chat": "",
3816
- style: {
3817
- display: "flex",
3818
- flexDirection: "column",
3819
- gap: "8px",
3820
- padding: "10px 12px",
3821
- borderRadius: "10px",
3822
- border: `1px solid ${t.accent}55`,
3823
- backgroundColor: t.bgSecondary,
3824
- minWidth: 0
3825
- },
3826
- children: [
3827
- /* @__PURE__ */ jsxs3("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
3828
- "Pick up where you left off \xB7 ",
3829
- chatAge(resumable.updatedAt)
3830
- ] }),
3831
- /* @__PURE__ */ jsx3(
3832
- "span",
3833
- {
3834
- style: {
3835
- fontSize: "13px",
3836
- lineHeight: 1.45,
3837
- overflowWrap: "anywhere"
3838
- },
3839
- children: resumable.title
3840
- }
3841
- ),
3842
- /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
3843
- /* @__PURE__ */ jsx3(
3844
- "button",
3845
- {
3846
- type: "button",
3847
- "data-gg-resume-continue": "",
3848
- onClick: () => resumeChat(resumable),
3849
- style: {
3850
- border: "none",
3851
- borderRadius: "999px",
3852
- backgroundColor: t.accent,
3853
- color: t.accentText,
3854
- padding: "7px 13px",
3855
- fontSize: "12px",
3856
- fontWeight: 600,
3857
- fontFamily: "inherit",
3858
- cursor: "pointer"
3859
- },
3860
- children: "Continue this chat"
3861
- }
3862
- ),
3863
- /* @__PURE__ */ jsx3(
3864
- "button",
3865
- {
3866
- type: "button",
3867
- onClick: () => setShowChats(true),
3868
- style: {
3869
- border: `1px solid ${t.inputBorder}`,
3870
- borderRadius: "999px",
3871
- background: "transparent",
3872
- color: t.textMuted,
3873
- padding: "7px 13px",
3874
- fontSize: "12px",
3875
- fontFamily: "inherit",
3876
- cursor: "pointer"
3877
- },
3878
- children: "All chats"
3879
- }
3880
- )
3881
- ] })
3882
- ]
3883
- }
3884
- ),
3887
+ resumeCard,
3885
3888
  phase !== "type" && /* @__PURE__ */ jsxs3(Fragment2, { children: [
3886
3889
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
3887
3890
  /* @__PURE__ */ jsx3(Avatar, { who: "assistant", theme: t }),
@@ -6646,8 +6649,8 @@ function ReportDialog({
6646
6649
  }
6647
6650
  };
6648
6651
  useEffect4(() => {
6649
- setSimilarIssues(null);
6650
- setPickedSimilar(null);
6652
+ if (similarIssues !== null) setSimilarIssues(null);
6653
+ if (pickedSimilar !== null) setPickedSimilar(null);
6651
6654
  }, [description]);
6652
6655
  const handleSubmit = async (opts) => {
6653
6656
  var _a2, _b, _c;
@@ -8973,7 +8976,7 @@ function getPlaceholder(type, idx = 0, hasVoice = false) {
8973
8976
  case "OTHER":
8974
8977
  return "Tell us what's on your mind...";
8975
8978
  case "VIDEO_SCRIPT":
8976
- return "Paste the script, and say which screens the video should show...";
8979
+ return "Describe the video or paste a script, and say which screens it should show...";
8977
8980
  }
8978
8981
  }
8979
8982
  function getTypeIcon(type, color, size = 24) {
@@ -9100,6 +9103,70 @@ function getTypeIcon(type, color, size = 24) {
9100
9103
  // src/booking-dialog.tsx
9101
9104
  import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useState as useState5 } from "react";
9102
9105
 
9106
+ // src/calendar-links.ts
9107
+ function stamp(iso) {
9108
+ return new Date(iso).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
9109
+ }
9110
+ function details(ev) {
9111
+ return [ev.description, ev.meetUrl ? `Join: ${ev.meetUrl}` : null].filter(Boolean).join("\n\n");
9112
+ }
9113
+ function googleCalendarUrl(ev) {
9114
+ const params = new URLSearchParams({
9115
+ action: "TEMPLATE",
9116
+ text: ev.title,
9117
+ dates: `${stamp(ev.startsAt)}/${stamp(ev.endsAt)}`,
9118
+ details: details(ev)
9119
+ });
9120
+ if (ev.meetUrl) params.set("location", ev.meetUrl);
9121
+ return `https://calendar.google.com/calendar/render?${params.toString()}`;
9122
+ }
9123
+ function esc(s) {
9124
+ return s.replace(/\\/g, "\\\\").replace(/;/g, ";").replace(/,/g, "\\,").replace(/\r?\n/g, "\\n");
9125
+ }
9126
+ function fold(line) {
9127
+ const out = [];
9128
+ let rest = line;
9129
+ while (rest.length > 74) {
9130
+ out.push(rest.slice(0, 74));
9131
+ rest = ` ${rest.slice(74)}`;
9132
+ }
9133
+ out.push(rest);
9134
+ return out.join("\r\n");
9135
+ }
9136
+ function buildIcs(ev) {
9137
+ const lines = [
9138
+ "BEGIN:VCALENDAR",
9139
+ "VERSION:2.0",
9140
+ "PRODID:-//Glitchgrab//Booking//EN",
9141
+ "CALSCALE:GREGORIAN",
9142
+ "METHOD:PUBLISH",
9143
+ "BEGIN:VEVENT",
9144
+ `UID:${ev.id}@glitchgrab.dev`,
9145
+ `DTSTAMP:${stamp((/* @__PURE__ */ new Date()).toISOString())}`,
9146
+ `DTSTART:${stamp(ev.startsAt)}`,
9147
+ `DTEND:${stamp(ev.endsAt)}`,
9148
+ `SUMMARY:${esc(ev.title)}`,
9149
+ `DESCRIPTION:${esc(details(ev))}`,
9150
+ ...ev.meetUrl ? [`LOCATION:${esc(ev.meetUrl)}`, `URL:${ev.meetUrl}`] : [],
9151
+ // 15 minutes before — the calendar's own reminder, the point of the feature.
9152
+ "BEGIN:VALARM",
9153
+ "ACTION:DISPLAY",
9154
+ "DESCRIPTION:Demo starts in 15 minutes",
9155
+ "TRIGGER:-PT15M",
9156
+ "END:VALARM",
9157
+ "END:VEVENT",
9158
+ "END:VCALENDAR"
9159
+ ];
9160
+ return lines.map(fold).join("\r\n") + "\r\n";
9161
+ }
9162
+ function icsDownloadUrl(ev) {
9163
+ try {
9164
+ return URL.createObjectURL(new Blob([buildIcs(ev)], { type: "text/calendar;charset=utf-8" }));
9165
+ } catch (e) {
9166
+ return null;
9167
+ }
9168
+ }
9169
+
9103
9170
  // src/phone.ts
9104
9171
  var COUNTRIES = [
9105
9172
  { iso: "IN", name: "India", dial: "91" },
@@ -9167,10 +9234,12 @@ function readQuestions(value) {
9167
9234
  if (!Array.isArray(value)) return [];
9168
9235
  return value.flatMap((row) => {
9169
9236
  if (!row || typeof row !== "object") return [];
9170
- const { id, label, options, required } = row;
9171
- if (typeof id !== "string" || typeof label !== "string" || !Array.isArray(options)) return [];
9237
+ const { id, label, options, required, type } = row;
9238
+ if (typeof id !== "string" || typeof label !== "string") return [];
9239
+ if (type === "text") return [{ id, label, type: "text", options: [], required: required !== false }];
9240
+ if (!Array.isArray(options)) return [];
9172
9241
  const choices = options.filter((o) => typeof o === "string" && o !== "");
9173
- return choices.length > 0 ? [{ id, label, options: choices, required: required !== false }] : [];
9242
+ return choices.length > 0 ? [{ id, label, type: "choice", options: choices, required: required !== false }] : [];
9174
9243
  });
9175
9244
  }
9176
9245
  var LIGHT = {
@@ -9334,6 +9403,7 @@ function BookingDialog({
9334
9403
  const [dial, setDial] = useState5(() => defaultDialForZone(localZone()));
9335
9404
  const [phoneTouched, setPhoneTouched] = useState5(false);
9336
9405
  const [tried, setTried] = useState5(false);
9406
+ const [toast, setToast] = useState5(null);
9337
9407
  const [questions, setQuestions] = useState5([]);
9338
9408
  const [answers, setAnswers] = useState5({});
9339
9409
  const [pageLoaded, setPageLoaded] = useState5(false);
@@ -9437,8 +9507,14 @@ function BookingDialog({
9437
9507
  const daySlots = day ? (_d = byDay.get(day)) != null ? _d : [] : [];
9438
9508
  const atFirstMonth = month <= today.slice(0, 7);
9439
9509
  const pastHorizon = monthLoaded && !error && byDay.size === 0 && !atFirstMonth;
9440
- const given = questions.flatMap((q) => q.options.includes(answers[q.id]) ? [{ ...q, answer: answers[q.id] }] : []);
9441
- const unanswered = questions.filter((q) => q.required && !q.options.includes(answers[q.id]));
9510
+ const isAnswered = (q) => {
9511
+ var _a2;
9512
+ return q.type === "text" ? Boolean((_a2 = answers[q.id]) == null ? void 0 : _a2.trim()) : q.options.includes(answers[q.id]);
9513
+ };
9514
+ const given = questions.flatMap(
9515
+ (q) => isAnswered(q) ? [{ ...q, answer: q.type === "text" ? answers[q.id].trim() : answers[q.id] }] : []
9516
+ );
9517
+ const unanswered = questions.filter((q) => q.required && !isAnswered(q));
9442
9518
  const phoneError = phoneProblem(dial, phone);
9443
9519
  const nameMissing = !name.trim();
9444
9520
  const emailMissing = !email.includes("@");
@@ -9449,12 +9525,25 @@ function BookingDialog({
9449
9525
  ...unanswered.map((q) => `an answer to \u201C${q.label}\u201D`),
9450
9526
  ...selected ? [] : ["a day and time"]
9451
9527
  ];
9528
+ useEffect5(() => {
9529
+ if (!toast) return;
9530
+ const id = setTimeout(() => setToast(null), 4500);
9531
+ return () => clearTimeout(id);
9532
+ }, [toast]);
9452
9533
  const roomy = step === "pick";
9453
9534
  async function startBooking() {
9454
- var _a2, _b2, _c2;
9535
+ var _a2, _b2, _c2, _d2;
9455
9536
  if (missing.length > 0 || !selected) {
9456
9537
  setTried(true);
9457
9538
  setPhoneTouched(true);
9539
+ const parts = [
9540
+ ...nameMissing ? ["your name"] : [],
9541
+ ...phoneError ? ["a valid mobile number"] : [],
9542
+ ...emailMissing ? ["your email"] : [],
9543
+ ...unanswered.length ? [unanswered.length === 1 ? "1 required answer" : `${unanswered.length} required answers`] : [],
9544
+ ...selected ? [] : ["a day and time"]
9545
+ ];
9546
+ setToast(`Add ${parts.length > 1 ? `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}` : parts[0]}`);
9458
9547
  return;
9459
9548
  }
9460
9549
  if (preview) {
@@ -9486,9 +9575,10 @@ function BookingDialog({
9486
9575
  return;
9487
9576
  }
9488
9577
  if (json.data.confirmed) {
9489
- setMeetUrl((_b2 = json.data.meetUrl) != null ? _b2 : null);
9578
+ setBookingId((_b2 = json.data.bookingId) != null ? _b2 : null);
9579
+ setMeetUrl((_c2 = json.data.meetUrl) != null ? _c2 : null);
9490
9580
  setStep("done");
9491
- reportBooked(json.data.bookingId, (_c2 = json.data.meetUrl) != null ? _c2 : null);
9581
+ reportBooked(json.data.bookingId, (_d2 = json.data.meetUrl) != null ? _d2 : null);
9492
9582
  return;
9493
9583
  }
9494
9584
  setBookingId(json.data.bookingId);
@@ -9535,6 +9625,7 @@ function BookingDialog({
9535
9625
  const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
9536
9626
  const monthDate = new Date(keyToUtc(`${month}-01`));
9537
9627
  const muted = { color: t.muted };
9628
+ const calendarEvent = step === "done" && bookingId && selected && selectedEnd ? { id: bookingId, title: page.title, startsAt: selected.startsAt, endsAt: selectedEnd, meetUrl } : null;
9538
9629
  const credit = /* @__PURE__ */ jsx6(
9539
9630
  "div",
9540
9631
  {
@@ -9972,7 +10063,7 @@ function BookingDialog({
9972
10063
  }
9973
10064
  )
9974
10065
  ] });
9975
- const details = /* @__PURE__ */ jsxs6(
10066
+ const details2 = /* @__PURE__ */ jsxs6(
9976
10067
  "div",
9977
10068
  {
9978
10069
  style: {
@@ -10026,7 +10117,22 @@ function BookingDialog({
10026
10117
  ),
10027
10118
  !pageLoaded && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, ...muted }, children: "Loading\u2026" }),
10028
10119
  questions.map((q) => {
10120
+ var _a2;
10029
10121
  const gap = tried && unanswered.includes(q);
10122
+ if (q.type === "text") {
10123
+ return /* @__PURE__ */ jsx6(
10124
+ Field,
10125
+ {
10126
+ t,
10127
+ label: q.required ? q.label : `${q.label} (optional)`,
10128
+ value: (_a2 = answers[q.id]) != null ? _a2 : "",
10129
+ onChange: (v) => setAnswers((prev) => ({ ...prev, [q.id]: v })),
10130
+ maxLength: 300,
10131
+ error: gap ? "Please fill this in" : null
10132
+ },
10133
+ q.id
10134
+ );
10135
+ }
10030
10136
  return /* @__PURE__ */ jsxs6("div", { role: "group", "aria-label": q.label, children: [
10031
10137
  /* @__PURE__ */ jsxs6("div", { style: { fontSize: 13, fontWeight: 500, overflowWrap: "anywhere" }, children: [
10032
10138
  q.label,
@@ -10115,7 +10221,7 @@ function BookingDialog({
10115
10221
  onClick: startBooking,
10116
10222
  disabled: busy,
10117
10223
  "aria-disabled": missing.length > 0,
10118
- style: { ...primaryStyle(t, busy || missing.length > 0), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
10224
+ style: { ...primaryStyle(t, busy), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
10119
10225
  children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
10120
10226
  }
10121
10227
  )
@@ -10167,6 +10273,41 @@ function BookingDialog({
10167
10273
  email,
10168
10274
  ", and we'll send a WhatsApp reminder before the call."
10169
10275
  ] }),
10276
+ calendarEvent && /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: [
10277
+ /* @__PURE__ */ jsx6(
10278
+ "a",
10279
+ {
10280
+ href: googleCalendarUrl(calendarEvent),
10281
+ target: "_blank",
10282
+ rel: "noreferrer",
10283
+ style: { ...primaryStyle(t, false), textDecoration: "none" },
10284
+ children: "Add to Google Calendar"
10285
+ }
10286
+ ),
10287
+ /* @__PURE__ */ jsx6(
10288
+ "button",
10289
+ {
10290
+ type: "button",
10291
+ onClick: () => {
10292
+ const url = icsDownloadUrl(calendarEvent);
10293
+ if (!url) return;
10294
+ const a = document.createElement("a");
10295
+ a.href = url;
10296
+ a.download = "demo.ics";
10297
+ a.click();
10298
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
10299
+ },
10300
+ style: {
10301
+ ...primaryStyle(t, false),
10302
+ background: "transparent",
10303
+ color: t.ink,
10304
+ border: `1px solid ${t.border}`,
10305
+ cursor: "pointer"
10306
+ },
10307
+ children: "Download .ics (Outlook, Apple)"
10308
+ }
10309
+ )
10310
+ ] }),
10170
10311
  meetUrl && /* @__PURE__ */ jsx6(
10171
10312
  "a",
10172
10313
  {
@@ -10240,6 +10381,30 @@ function BookingDialog({
10240
10381
  lineHeight: 1.4
10241
10382
  },
10242
10383
  children: [
10384
+ toast && /* @__PURE__ */ jsx6(
10385
+ "div",
10386
+ {
10387
+ role: "status",
10388
+ "aria-live": "polite",
10389
+ style: {
10390
+ position: "fixed",
10391
+ left: "50%",
10392
+ bottom: wide ? 88 : 96,
10393
+ transform: "translateX(-50%)",
10394
+ maxWidth: "min(480px, calc(100vw - 32px))",
10395
+ padding: "10px 16px",
10396
+ borderRadius: 10,
10397
+ background: t.ink,
10398
+ color: t.onInk,
10399
+ fontSize: 13,
10400
+ lineHeight: 1.5,
10401
+ fontWeight: 600,
10402
+ boxShadow: "0 8px 24px rgba(0,0,0,.35)",
10403
+ zIndex: 2147483647
10404
+ },
10405
+ children: toast
10406
+ }
10407
+ ),
10243
10408
  summary,
10244
10409
  roomy ? /* @__PURE__ */ jsxs6("div", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", flexDirection: "column" }, children: [
10245
10410
  /* @__PURE__ */ jsxs6(
@@ -10254,7 +10419,7 @@ function BookingDialog({
10254
10419
  overflowY: wide && !split ? "auto" : void 0
10255
10420
  },
10256
10421
  children: [
10257
- details,
10422
+ details2,
10258
10423
  /* @__PURE__ */ jsxs6(
10259
10424
  "div",
10260
10425
  {
@@ -10388,6 +10553,7 @@ function Field({
10388
10553
  type = "text",
10389
10554
  autoComplete,
10390
10555
  inputMode,
10556
+ maxLength,
10391
10557
  error
10392
10558
  }) {
10393
10559
  return /* @__PURE__ */ jsxs6("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
@@ -10399,6 +10565,7 @@ function Field({
10399
10565
  value,
10400
10566
  autoComplete,
10401
10567
  inputMode,
10568
+ maxLength,
10402
10569
  "aria-invalid": Boolean(error),
10403
10570
  onChange: (e) => onChange(e.target.value),
10404
10571
  style: {
@@ -10586,11 +10753,11 @@ function describeRejection(reason) {
10586
10753
  const source = reason;
10587
10754
  const nestedError = source.error;
10588
10755
  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 : "";
10589
- const details = serialize(reason);
10756
+ const details2 = serialize(reason);
10590
10757
  return {
10591
10758
  message: message || (isEventLike(reason) ? describeEvent(reason) : describeShape(reason)),
10592
10759
  stack,
10593
- details
10760
+ details: details2
10594
10761
  };
10595
10762
  } catch (e) {
10596
10763
  return { message: "" };
@@ -11432,19 +11599,337 @@ function FeedbackButton({
11432
11599
  );
11433
11600
  }
11434
11601
 
11602
+ // src/call-issue-dialog.tsx
11603
+ import { useCallback as useCallback4, useEffect as useEffect7, useRef as useRef6, useState as useState8 } from "react";
11604
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
11605
+ var DEFAULT_BASE_URL3 = "https://glitchgrab.dev";
11606
+ var ApiError = class extends Error {
11607
+ constructor(message, status, code) {
11608
+ super(message);
11609
+ this.status = status;
11610
+ this.code = code;
11611
+ }
11612
+ };
11613
+ function formatDuration2(sec) {
11614
+ if (!sec || sec < 1) return "";
11615
+ return `${Math.floor(sec / 60)}:${String(Math.round(sec % 60)).padStart(2, "0")}`;
11616
+ }
11617
+ function readDraft(value) {
11618
+ if (!value || typeof value !== "object") return null;
11619
+ const v = value;
11620
+ if (typeof v.id !== "string" || typeof v.title !== "string") return null;
11621
+ return {
11622
+ id: v.id,
11623
+ title: v.title,
11624
+ body: typeof v.body === "string" ? v.body : "",
11625
+ labels: Array.isArray(v.labels) ? v.labels.filter((l) => typeof l === "string") : [],
11626
+ quotes: Array.isArray(v.quotes) ? v.quotes.filter((q) => !!q && typeof q.text === "string").slice(0, 3) : [],
11627
+ status: typeof v.status === "string" ? v.status : "DRAFT",
11628
+ githubNumber: typeof v.githubNumber === "number" ? v.githubNumber : null,
11629
+ githubUrl: typeof v.githubUrl === "string" ? v.githubUrl : null
11630
+ };
11631
+ }
11632
+ function GlitchgrabCallIssue({ callId, open, onClose, getToken, baseUrl, onFiled }) {
11633
+ var _a, _b;
11634
+ const base = (baseUrl || DEFAULT_BASE_URL3).replace(/\/+$/, "");
11635
+ const tokenRef = useRef6(null);
11636
+ const [loaded, setLoaded] = useState8(null);
11637
+ const [busy, setBusy] = useState8(null);
11638
+ const [error, setError] = useState8(null);
11639
+ const [picked, setPicked] = useState8(/* @__PURE__ */ new Set());
11640
+ const [filed, setFiled] = useState8([]);
11641
+ const [fixing, setFixing] = useState8(null);
11642
+ const [fixText, setFixText] = useState8("");
11643
+ const [fixBusy, setFixBusy] = useState8(false);
11644
+ const dark = typeof window !== "undefined" ? detectDark() : false;
11645
+ const accent = (_a = typeof window !== "undefined" ? detectHostAccent() : null) != null ? _a : { accent: "#3b82f6", accentText: "#fff" };
11646
+ const c = dark ? { bg: "#18181b", pane: "#222226", border: "#3f3f46", text: "#fafafa", muted: "#a1a1aa" } : { bg: "#ffffff", pane: "#f6f6f7", border: "#e4e4e7", text: "#18181b", muted: "#71717a" };
11647
+ const call = useCallback4(
11648
+ async (path, init = {}) => {
11649
+ var _a2, _b2, _c;
11650
+ for (let attempt = 0; attempt < 2; attempt++) {
11651
+ if (!tokenRef.current) tokenRef.current = await getToken(callId);
11652
+ const res = await fetch(`${base}/api/v1/sdk/call-issue/${encodeURIComponent(callId)}${path}`, {
11653
+ method: (_a2 = init.method) != null ? _a2 : "GET",
11654
+ headers: {
11655
+ Authorization: `Bearer ${tokenRef.current}`,
11656
+ ...init.body === void 0 ? {} : { "Content-Type": "application/json" }
11657
+ },
11658
+ ...init.body === void 0 ? {} : { body: JSON.stringify(init.body) }
11659
+ });
11660
+ const json = await res.json().catch(() => null);
11661
+ if (res.ok && (json == null ? void 0 : json.success)) return json.data;
11662
+ if (res.status === 401 && attempt === 0) {
11663
+ tokenRef.current = null;
11664
+ continue;
11665
+ }
11666
+ 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);
11667
+ }
11668
+ throw new ApiError("Could not reach Glitchgrab", 0, null);
11669
+ },
11670
+ [base, callId, getToken]
11671
+ );
11672
+ const apply = useCallback4((data) => {
11673
+ const d = data != null ? data : {};
11674
+ const drafts = (Array.isArray(d.drafts) ? d.drafts : []).map(readDraft).filter((x) => x !== null);
11675
+ const callRaw = d.call;
11676
+ setLoaded((prev) => {
11677
+ var _a2, _b2;
11678
+ return {
11679
+ drafts,
11680
+ canExtract: d.canExtract !== false,
11681
+ extractedAt: typeof d.extractedAt === "string" ? d.extractedAt : (_a2 = prev == null ? void 0 : prev.extractedAt) != null ? _a2 : null,
11682
+ call: callRaw && typeof callRaw.pageUrl === "string" ? {
11683
+ title: typeof callRaw.title === "string" ? callRaw.title : null,
11684
+ at: typeof callRaw.at === "string" ? callRaw.at : "",
11685
+ durationSec: typeof callRaw.durationSec === "number" ? callRaw.durationSec : null,
11686
+ pageUrl: callRaw.pageUrl
11687
+ } : (_b2 = prev == null ? void 0 : prev.call) != null ? _b2 : null
11688
+ };
11689
+ });
11690
+ setPicked(new Set(drafts.filter((x) => x.status === "DRAFT").map((x) => x.id)));
11691
+ }, []);
11692
+ const read = useCallback4(async () => {
11693
+ setBusy("read");
11694
+ setError(null);
11695
+ try {
11696
+ const data = await call("/drafts", { method: "POST" });
11697
+ apply({ ...data, canExtract: true, extractedAt: (/* @__PURE__ */ new Date()).toISOString() });
11698
+ } catch (e) {
11699
+ setError(e instanceof Error ? e.message : "Could not read this call.");
11700
+ } finally {
11701
+ setBusy(null);
11702
+ }
11703
+ }, [apply, call]);
11704
+ useEffect7(() => {
11705
+ if (!open) return;
11706
+ let cancelled = false;
11707
+ setLoaded(null);
11708
+ setFiled([]);
11709
+ setError(null);
11710
+ setBusy("load");
11711
+ (async () => {
11712
+ try {
11713
+ const data = await call("/drafts");
11714
+ if (cancelled) return;
11715
+ apply(data);
11716
+ const hasDrafts = Array.isArray(data.drafts) && data.drafts.length > 0;
11717
+ if (!hasDrafts && data.canExtract !== false && !data.extractedAt) {
11718
+ setBusy(null);
11719
+ await read();
11720
+ }
11721
+ } catch (e) {
11722
+ if (!cancelled) setError(e instanceof Error ? e.message : "Could not open this call.");
11723
+ } finally {
11724
+ if (!cancelled) setBusy((b) => b === "load" ? null : b);
11725
+ }
11726
+ })();
11727
+ return () => {
11728
+ cancelled = true;
11729
+ };
11730
+ }, [open, callId]);
11731
+ useEffect7(() => {
11732
+ if (!open) return;
11733
+ const onKey = (e) => e.key === "Escape" && onClose();
11734
+ window.addEventListener("keydown", onKey);
11735
+ return () => window.removeEventListener("keydown", onKey);
11736
+ }, [open, onClose]);
11737
+ if (!open) return null;
11738
+ const active = ((_b = loaded == null ? void 0 : loaded.drafts) != null ? _b : []).filter((d) => d.status === "DRAFT");
11739
+ const chosen = active.filter((d) => picked.has(d.id));
11740
+ const discard = async (id) => {
11741
+ try {
11742
+ await call(`/drafts/${encodeURIComponent(id)}`, { method: "DELETE" });
11743
+ setLoaded((l) => l ? { ...l, drafts: l.drafts.filter((d) => d.id !== id) } : l);
11744
+ setPicked((p) => {
11745
+ const next = new Set(p);
11746
+ next.delete(id);
11747
+ return next;
11748
+ });
11749
+ } catch (e) {
11750
+ setError(e instanceof Error ? e.message : "Could not remove it.");
11751
+ }
11752
+ };
11753
+ const correct = async (id) => {
11754
+ if (!fixText.trim()) return;
11755
+ setFixBusy(true);
11756
+ setError(null);
11757
+ try {
11758
+ const data = await call(`/drafts/${encodeURIComponent(id)}/chat`, {
11759
+ method: "POST",
11760
+ body: { message: fixText }
11761
+ });
11762
+ const next = readDraft(data.draft);
11763
+ if (next) setLoaded((l) => l ? { ...l, drafts: l.drafts.map((d) => d.id === id ? { ...d, ...next } : d) } : l);
11764
+ setFixing(null);
11765
+ setFixText("");
11766
+ } catch (e) {
11767
+ setError(e instanceof Error ? e.message : "Could not rewrite it.");
11768
+ } finally {
11769
+ setFixBusy(false);
11770
+ }
11771
+ };
11772
+ const file = async () => {
11773
+ var _a2, _b2, _c, _d, _e;
11774
+ setBusy("file");
11775
+ setError(null);
11776
+ try {
11777
+ const data = await call("/create", { method: "POST", body: { draftIds: chosen.map((d) => d.id) } });
11778
+ const done = [...(_a2 = data.created) != null ? _a2 : [], ...(_b2 = data.already) != null ? _b2 : []];
11779
+ setFiled(done);
11780
+ if (((_c = data.created) != null ? _c : []).length > 0) onFiled == null ? void 0 : onFiled((_d = data.created) != null ? _d : []);
11781
+ if ((_e = data.failed) == null ? void 0 : _e.length) setError(`${data.failed.length} could not be filed: ${data.failed[0].error}`);
11782
+ const doneIds = new Set(done.map((d) => d.id));
11783
+ setLoaded((l) => l ? { ...l, drafts: l.drafts.filter((d) => !doneIds.has(d.id)) } : l);
11784
+ } catch (e) {
11785
+ setError(e instanceof Error ? e.message : "Could not file the issues.");
11786
+ } finally {
11787
+ setBusy(null);
11788
+ }
11789
+ };
11790
+ const button = (primary, disabled) => ({
11791
+ padding: "8px 14px",
11792
+ borderRadius: 8,
11793
+ border: primary ? 0 : `1px solid ${c.border}`,
11794
+ background: primary ? accent.accent : "transparent",
11795
+ color: primary ? accent.accentText : c.text,
11796
+ fontSize: 13,
11797
+ fontWeight: 500,
11798
+ cursor: disabled ? "not-allowed" : "pointer",
11799
+ opacity: disabled ? 0.55 : 1
11800
+ });
11801
+ return /* @__PURE__ */ jsx11(
11802
+ "div",
11803
+ {
11804
+ role: "dialog",
11805
+ "aria-modal": "true",
11806
+ "aria-label": "Create issues from this call",
11807
+ onClick: (e) => e.target === e.currentTarget && onClose(),
11808
+ style: { position: "fixed", inset: 0, zIndex: 2147483e3, background: "rgba(0,0,0,0.45)", display: "flex", justifyContent: "flex-end" },
11809
+ children: /* @__PURE__ */ jsxs10(
11810
+ "div",
11811
+ {
11812
+ style: {
11813
+ width: "min(560px, 100vw)",
11814
+ height: "100%",
11815
+ background: c.bg,
11816
+ color: c.text,
11817
+ borderLeft: `1px solid ${c.border}`,
11818
+ display: "flex",
11819
+ flexDirection: "column",
11820
+ fontFamily: "inherit",
11821
+ boxSizing: "border-box"
11822
+ },
11823
+ children: [
11824
+ /* @__PURE__ */ jsxs10("div", { style: { padding: "16px 18px", borderBottom: `1px solid ${c.border}`, display: "flex", gap: 12, alignItems: "flex-start" }, children: [
11825
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
11826
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 15, fontWeight: 600 }, children: "Create issues from this call" }),
11827
+ (loaded == null ? void 0 : loaded.call) && /* @__PURE__ */ jsxs10("div", { style: { fontSize: 12, color: c.muted, marginTop: 4, overflowWrap: "anywhere" }, children: [
11828
+ loaded.call.title ? `${loaded.call.title} \xB7 ` : "",
11829
+ loaded.call.at ? new Date(loaded.call.at).toLocaleString() : "",
11830
+ formatDuration2(loaded.call.durationSec) ? ` \xB7 ${formatDuration2(loaded.call.durationSec)}` : "",
11831
+ " \xB7 ",
11832
+ /* @__PURE__ */ jsx11("a", { href: loaded.call.pageUrl, target: "_blank", rel: "noreferrer", style: { color: accent.accent }, children: "Open in Glitchgrab \u2197" })
11833
+ ] })
11834
+ ] }),
11835
+ /* @__PURE__ */ jsx11("button", { type: "button", onClick: onClose, "aria-label": "Close", style: { ...button(false, false), padding: "4px 10px" }, children: "\u2715" })
11836
+ ] }),
11837
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, overflowY: "auto", padding: 18, display: "flex", flexDirection: "column", gap: 12 }, children: [
11838
+ error && /* @__PURE__ */ jsx11("div", { role: "alert", style: { padding: "10px 12px", borderRadius: 8, border: "1px solid #ef4444", color: "#ef4444", fontSize: 13 }, children: error }),
11839
+ (busy === "load" || busy === "read") && /* @__PURE__ */ jsx11("div", { style: { color: c.muted, fontSize: 13 }, children: busy === "read" ? "Reading the call\u2026 this takes about 20\u201340 seconds." : "Opening the call\u2026" }),
11840
+ filed.length > 0 && /* @__PURE__ */ jsxs10("div", { style: { padding: 12, borderRadius: 8, background: c.pane, fontSize: 13 }, children: [
11841
+ /* @__PURE__ */ jsxs10("div", { style: { fontWeight: 600, marginBottom: 6 }, children: [
11842
+ "\u2713 Filed ",
11843
+ filed.length === 1 ? "1 issue" : `${filed.length} issues`
11844
+ ] }),
11845
+ filed.map((f) => /* @__PURE__ */ jsx11("div", { style: { overflowWrap: "anywhere" }, children: /* @__PURE__ */ jsxs10("a", { href: f.url, target: "_blank", rel: "noreferrer", style: { color: accent.accent }, children: [
11846
+ "#",
11847
+ f.number,
11848
+ " ",
11849
+ f.title,
11850
+ " \u2197"
11851
+ ] }) }, f.id)),
11852
+ /* @__PURE__ */ jsx11("div", { style: { color: c.muted, marginTop: 6 }, children: "Each carries the call id, a link to the call and the lines it came from." })
11853
+ ] }),
11854
+ !busy && loaded && !loaded.canExtract && /* @__PURE__ */ jsx11("div", { style: { color: c.muted, fontSize: 13 }, children: "This call has no transcript yet. It is ready a few minutes after the call ends." }),
11855
+ !busy && loaded && loaded.canExtract && active.length === 0 && filed.length === 0 && !error && /* @__PURE__ */ jsx11("div", { style: { color: c.muted, fontSize: 13 }, children: "Nothing in this call needs an issue." }),
11856
+ active.map((d, i) => /* @__PURE__ */ jsx11("div", { style: { border: `1px solid ${c.border}`, borderRadius: 10, padding: 12, background: c.pane }, children: /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: 10, alignItems: "flex-start" }, children: [
11857
+ /* @__PURE__ */ jsx11(
11858
+ "input",
11859
+ {
11860
+ type: "checkbox",
11861
+ "aria-label": `Select ${d.title}`,
11862
+ checked: picked.has(d.id),
11863
+ onChange: () => setPicked((p) => {
11864
+ const next = new Set(p);
11865
+ if (next.has(d.id)) next.delete(d.id);
11866
+ else next.add(d.id);
11867
+ return next;
11868
+ }),
11869
+ style: { marginTop: 3 }
11870
+ }
11871
+ ),
11872
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
11873
+ /* @__PURE__ */ jsxs10("div", { style: { fontSize: 14, fontWeight: 600, overflowWrap: "anywhere" }, children: [
11874
+ i + 1,
11875
+ ". ",
11876
+ d.title
11877
+ ] }),
11878
+ d.labels.length > 0 && /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: c.muted, marginTop: 2 }, children: d.labels.join(" \xB7 ") }),
11879
+ d.quotes.map((q, qi) => /* @__PURE__ */ jsxs10("div", { style: { fontSize: 12, color: c.muted, marginTop: 6, borderLeft: `2px solid ${c.border}`, paddingLeft: 8, overflowWrap: "anywhere" }, children: [
11880
+ q.speaker ? /* @__PURE__ */ jsxs10("b", { children: [
11881
+ q.speaker,
11882
+ ": "
11883
+ ] }) : null,
11884
+ q.text
11885
+ ] }, qi)),
11886
+ fixing === d.id ? /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: 6, marginTop: 8 }, children: [
11887
+ /* @__PURE__ */ jsx11(
11888
+ "input",
11889
+ {
11890
+ value: fixText,
11891
+ onChange: (e) => setFixText(e.target.value),
11892
+ onKeyDown: (e) => e.key === "Enter" && !fixBusy && void correct(d.id),
11893
+ placeholder: "attendance here means WhatsApp check-in, not a biometric device",
11894
+ "aria-label": "What should change in this draft",
11895
+ style: { flex: 1, padding: "7px 9px", borderRadius: 8, border: `1px solid ${c.border}`, background: c.bg, color: c.text, fontSize: 12 }
11896
+ }
11897
+ ),
11898
+ /* @__PURE__ */ jsx11("button", { type: "button", disabled: fixBusy || !fixText.trim(), onClick: () => void correct(d.id), style: button(true, fixBusy || !fixText.trim()), children: fixBusy ? "Rewriting\u2026" : "Send" })
11899
+ ] }) : /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: 12, marginTop: 8, fontSize: 12 }, children: [
11900
+ /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => {
11901
+ setFixing(d.id);
11902
+ setFixText("");
11903
+ }, style: { background: "none", border: 0, padding: 0, color: accent.accent, cursor: "pointer" }, children: "Not what we meant" }),
11904
+ /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => void discard(d.id), style: { background: "none", border: 0, padding: 0, color: c.muted, cursor: "pointer" }, children: "Remove" })
11905
+ ] })
11906
+ ] })
11907
+ ] }) }, d.id))
11908
+ ] }),
11909
+ /* @__PURE__ */ jsxs10("div", { style: { padding: "12px 18px", borderTop: `1px solid ${c.border}`, display: "flex", gap: 10, justifyContent: "space-between", alignItems: "center" }, children: [
11910
+ /* @__PURE__ */ jsx11("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" }),
11911
+ /* @__PURE__ */ jsx11("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` })
11912
+ ] })
11913
+ ]
11914
+ }
11915
+ )
11916
+ }
11917
+ );
11918
+ }
11919
+
11435
11920
  // src/use-reports.ts
11436
- import { useState as useState8, useEffect as useEffect7, useCallback as useCallback4 } from "react";
11921
+ import { useState as useState9, useEffect as useEffect8, useCallback as useCallback5 } from "react";
11437
11922
  var BASE_URL = "https://glitchgrab.dev";
11438
11923
  function useGlitchgrabReports({
11439
11924
  token,
11440
11925
  userId,
11441
11926
  limit = 100
11442
11927
  }) {
11443
- const [reports, setReports] = useState8([]);
11444
- const [isLoading, setIsLoading] = useState8(true);
11445
- const [isFetching, setIsFetching] = useState8(false);
11446
- const [error, setError] = useState8(null);
11447
- const fetchReports = useCallback4(async () => {
11928
+ const [reports, setReports] = useState9([]);
11929
+ const [isLoading, setIsLoading] = useState9(true);
11930
+ const [isFetching, setIsFetching] = useState9(false);
11931
+ const [error, setError] = useState9(null);
11932
+ const fetchReports = useCallback5(async () => {
11448
11933
  var _a, _b;
11449
11934
  if (!token || !userId) {
11450
11935
  setIsLoading(false);
@@ -11470,7 +11955,7 @@ function useGlitchgrabReports({
11470
11955
  setIsFetching(false);
11471
11956
  }
11472
11957
  }, [token, userId, limit]);
11473
- useEffect7(() => {
11958
+ useEffect8(() => {
11474
11959
  fetchReports();
11475
11960
  }, [fetchReports]);
11476
11961
  return { reports, isLoading, isFetching, error, refetch: fetchReports };
@@ -11507,9 +11992,9 @@ function useGlitchgrabActions({
11507
11992
  onSuccess,
11508
11993
  onError
11509
11994
  }) {
11510
- const [isPending, setIsPending] = useState8(false);
11511
- const [error, setError] = useState8(null);
11512
- const run = useCallback4(
11995
+ const [isPending, setIsPending] = useState9(false);
11996
+ const [error, setError] = useState9(null);
11997
+ const run = useCallback5(
11513
11998
  async (reportId, body) => {
11514
11999
  setIsPending(true);
11515
12000
  setError(null);
@@ -11573,12 +12058,12 @@ function useGlitchgrabReportThread({
11573
12058
  reporterEmail
11574
12059
  }) {
11575
12060
  var _a;
11576
- const [report, setReport] = useState8(null);
11577
- const [isLoading, setIsLoading] = useState8(!!reportId);
11578
- const [isFetching, setIsFetching] = useState8(false);
11579
- const [isPosting, setIsPosting] = useState8(false);
11580
- const [error, setError] = useState8(null);
11581
- const refetch = useCallback4(async () => {
12061
+ const [report, setReport] = useState9(null);
12062
+ const [isLoading, setIsLoading] = useState9(!!reportId);
12063
+ const [isFetching, setIsFetching] = useState9(false);
12064
+ const [isPosting, setIsPosting] = useState9(false);
12065
+ const [error, setError] = useState9(null);
12066
+ const refetch = useCallback5(async () => {
11582
12067
  if (!token || !reportId) {
11583
12068
  setReport(null);
11584
12069
  setIsLoading(false);
@@ -11595,10 +12080,10 @@ function useGlitchgrabReportThread({
11595
12080
  setIsFetching(false);
11596
12081
  }
11597
12082
  }, [token, reportId]);
11598
- useEffect7(() => {
12083
+ useEffect8(() => {
11599
12084
  refetch();
11600
12085
  }, [refetch]);
11601
- const addComment = useCallback4(
12086
+ const addComment = useCallback5(
11602
12087
  async (message) => {
11603
12088
  if (!token || !reportId || !message.trim()) return false;
11604
12089
  setIsPosting(true);
@@ -11620,8 +12105,8 @@ function useGlitchgrabReportThread({
11620
12105
  }
11621
12106
 
11622
12107
  // src/use-feedback.ts
11623
- import { useState as useState9, useEffect as useEffect8, useCallback as useCallback5 } from "react";
11624
- var DEFAULT_BASE_URL3 = "https://glitchgrab.dev";
12108
+ import { useState as useState10, useEffect as useEffect9, useCallback as useCallback6 } from "react";
12109
+ var DEFAULT_BASE_URL4 = "https://glitchgrab.dev";
11625
12110
  function buildUrl({
11626
12111
  approvedOnly,
11627
12112
  userId,
@@ -11633,7 +12118,7 @@ function buildUrl({
11633
12118
  if (approvedOnly) params.set("approved", "true");
11634
12119
  if (userId) params.set("reporterPrimaryKey", userId);
11635
12120
  if (minRating) params.set("minRating", String(minRating));
11636
- return `${baseUrl != null ? baseUrl : DEFAULT_BASE_URL3}/api/v1/sdk/feedback?${params.toString()}`;
12121
+ return `${baseUrl != null ? baseUrl : DEFAULT_BASE_URL4}/api/v1/sdk/feedback?${params.toString()}`;
11637
12122
  }
11638
12123
  async function fetchGlitchgrabFeedback(query) {
11639
12124
  var _a, _b;
@@ -11646,11 +12131,11 @@ async function fetchGlitchgrabFeedback(query) {
11646
12131
  }
11647
12132
  function useGlitchgrabFeedback(query) {
11648
12133
  const { token, approvedOnly, userId, minRating, limit, baseUrl } = query;
11649
- const [feedback, setFeedback] = useState9([]);
11650
- const [isLoading, setIsLoading] = useState9(true);
11651
- const [isFetching, setIsFetching] = useState9(false);
11652
- const [error, setError] = useState9(null);
11653
- const load = useCallback5(async () => {
12134
+ const [feedback, setFeedback] = useState10([]);
12135
+ const [isLoading, setIsLoading] = useState10(true);
12136
+ const [isFetching, setIsFetching] = useState10(false);
12137
+ const [error, setError] = useState10(null);
12138
+ const load = useCallback6(async () => {
11654
12139
  if (!token) {
11655
12140
  setIsLoading(false);
11656
12141
  return;
@@ -11674,7 +12159,7 @@ function useGlitchgrabFeedback(query) {
11674
12159
  setIsFetching(false);
11675
12160
  }
11676
12161
  }, [token, approvedOnly, userId, minRating, limit, baseUrl]);
11677
- useEffect8(() => {
12162
+ useEffect9(() => {
11678
12163
  load();
11679
12164
  }, [load]);
11680
12165
  return { feedback, isLoading, isFetching, error, refetch: load };
@@ -11685,6 +12170,7 @@ export {
11685
12170
  FeedbackButton,
11686
12171
  GLITCHGRAB_SHORTCUT2 as GLITCHGRAB_SHORTCUT,
11687
12172
  GLITCHGRAB_SHORTCUT_MAC2 as GLITCHGRAB_SHORTCUT_MAC,
12173
+ GlitchgrabCallIssue,
11688
12174
  GlitchgrabErrorBoundary,
11689
12175
  GlitchgrabProvider,
11690
12176
  ReportButton,