glitchgrab 1.68.1 → 1.68.3

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
@@ -2036,18 +2036,6 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
2036
2036
  }
2037
2037
  );
2038
2038
  }
2039
- var SEVERITY_LEVELS = [
2040
- "low",
2041
- "medium",
2042
- "high",
2043
- "critical"
2044
- ];
2045
- var SEVERITY_LABELS = {
2046
- low: "Low",
2047
- medium: "Medium",
2048
- high: "High",
2049
- critical: "Critical"
2050
- };
2051
2039
  var MAX_ASSIST_IMAGES = 3;
2052
2040
  var MAX_ASSIST_IMAGE_CHARS = 35e5;
2053
2041
  var MAX_ASSIST_FILES = 3;
@@ -2824,11 +2812,7 @@ function AssistSheet({
2824
2812
  onDescriptionChange,
2825
2813
  issueTitle,
2826
2814
  onIssueTitleChange,
2827
- severity,
2828
- onSeverityChange,
2829
- showSeverity,
2830
2815
  validationError,
2831
- severityRefused = false,
2832
2816
  onDuplicateChange,
2833
2817
  onConversationChange,
2834
2818
  isSubmitting,
@@ -2844,7 +2828,6 @@ function AssistSheet({
2844
2828
  }) {
2845
2829
  var _a;
2846
2830
  const narrow = useIsNarrow();
2847
- const severityAsked = showSeverity && currentTile === "BUG";
2848
2831
  const [messages, setMessages] = useState2([]);
2849
2832
  const [input, setInput] = useState2("");
2850
2833
  const [busy, setBusy] = useState2(false);
@@ -2870,15 +2853,13 @@ function AssistSheet({
2870
2853
  const [duplicate, setDuplicate] = useState2(null);
2871
2854
  const [glitchgrabOffer, setGlitchgrabOffer] = useState2(false);
2872
2855
  const [solved, setSolved] = useState2(null);
2873
- const needsSeverity = (tile) => showSeverity && tile === "BUG" && !severity;
2874
2856
  const [phase, setPhase] = useState2(
2875
- () => !typePicked ? "type" : currentTile === "RATING" ? "rating" : needsSeverity(currentTile) ? "severity" : "chat"
2857
+ () => !typePicked ? "type" : currentTile === "RATING" ? "rating" : "chat"
2876
2858
  );
2877
2859
  const scrollRef = useRef2(null);
2878
2860
  const draftRef = useRef2(null);
2879
2861
  const composerRef = useRef2(null);
2880
2862
  const seededRef = useRef2(false);
2881
- const seedPendingRef = useRef2(false);
2882
2863
  const resumeAskRef = useRef2(false);
2883
2864
  const eventsRef = useRef2([]);
2884
2865
  const inferredTypeRef = useRef2(false);
@@ -2947,6 +2928,12 @@ function AssistSheet({
2947
2928
  var _a2;
2948
2929
  if (phase === "draft") (_a2 = draftRef.current) == null ? void 0 : _a2.focus();
2949
2930
  }, [phase]);
2931
+ useEffect2(() => {
2932
+ var _a2;
2933
+ if (validationError && phase === "draft") {
2934
+ (_a2 = draftRef.current) == null ? void 0 : _a2.scrollIntoView({ block: "center", behavior: "smooth" });
2935
+ }
2936
+ }, [validationError, phase]);
2950
2937
  useEffect2(() => {
2951
2938
  const el = composerRef.current;
2952
2939
  if (!el) return;
@@ -3146,10 +3133,6 @@ function AssistSheet({
3146
3133
  }
3147
3134
  return;
3148
3135
  }
3149
- if (phase === "severity") {
3150
- seedPendingRef.current = true;
3151
- return;
3152
- }
3153
3136
  seedFromDescription();
3154
3137
  }, []);
3155
3138
  function seedFromDescription() {
@@ -3159,14 +3142,6 @@ function AssistSheet({
3159
3142
  setMessages(history2);
3160
3143
  void runTurn(history2);
3161
3144
  }
3162
- function answerSeverity(value) {
3163
- onSeverityChange(value);
3164
- setPhase("chat");
3165
- if (seedPendingRef.current) {
3166
- seedPendingRef.current = false;
3167
- seedFromDescription();
3168
- }
3169
- }
3170
3145
  function send2(text) {
3171
3146
  const value = text.trim();
3172
3147
  if (!value || busy) return;
@@ -3259,7 +3234,6 @@ function AssistSheet({
3259
3234
  setShowChats(false);
3260
3235
  setViewingChat(null);
3261
3236
  resumeAskRef.current = (last == null ? void 0 : last.role) === "user";
3262
- seedPendingRef.current = false;
3263
3237
  }
3264
3238
  useEffect2(() => {
3265
3239
  if (!resumeAskRef.current) return;
@@ -3647,7 +3621,6 @@ function AssistSheet({
3647
3621
  ),
3648
3622
  /* @__PURE__ */ jsxs3("div", { style: { fontSize: "11.5px", color: t.textMuted, marginTop: "3px" }, children: [
3649
3623
  phase === "type" || !typePicked || inferredTypeRef.current && phase !== "draft" ? null : reportTypeLabel,
3650
- phase !== "type" && severityAsked && severity ? ` \xB7 ${SEVERITY_LABELS[severity]}` : null,
3651
3624
  projectSlot ? /* @__PURE__ */ jsx3("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3652
3625
  ] })
3653
3626
  ] }),
@@ -3758,63 +3731,6 @@ function AssistSheet({
3758
3731
  minWidth: 0
3759
3732
  },
3760
3733
  children: /* @__PURE__ */ jsxs3("div", { style: { display: showChats ? "none" : "contents" }, children: [
3761
- phase === "severity" && /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3762
- resumeCard,
3763
- /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
3764
- /* @__PURE__ */ jsx3(Avatar, { who: "assistant", theme: t }),
3765
- /* @__PURE__ */ jsx3(
3766
- "div",
3767
- {
3768
- style: {
3769
- padding: "9px 12px",
3770
- borderRadius: "12px 12px 12px 4px",
3771
- backgroundColor: t.bgSecondary,
3772
- fontSize: "13px",
3773
- lineHeight: 1.55,
3774
- maxWidth: "88%"
3775
- },
3776
- children: "How bad is it?"
3777
- }
3778
- )
3779
- ] }),
3780
- /* @__PURE__ */ jsx3(
3781
- "div",
3782
- {
3783
- role: "radiogroup",
3784
- "aria-label": "Severity",
3785
- style: {
3786
- display: "flex",
3787
- flexWrap: "wrap",
3788
- gap: "6px",
3789
- paddingLeft: "32px"
3790
- },
3791
- children: SEVERITY_LEVELS.map((s) => /* @__PURE__ */ jsx3(
3792
- "button",
3793
- {
3794
- type: "button",
3795
- role: "radio",
3796
- "aria-checked": severity === s,
3797
- "data-gg-chip": "",
3798
- "data-gg-severity": s,
3799
- onClick: () => answerSeverity(s),
3800
- style: {
3801
- border: `1px solid ${t.inputBorder}`,
3802
- background: "transparent",
3803
- color: t.textMuted,
3804
- borderRadius: "999px",
3805
- // Same as the picker and option chips — one chip size.
3806
- padding: "8px 12px",
3807
- fontSize: "12px",
3808
- fontFamily: "inherit",
3809
- cursor: "pointer"
3810
- },
3811
- children: SEVERITY_LABELS[s]
3812
- },
3813
- s
3814
- ))
3815
- }
3816
- )
3817
- ] }),
3818
3734
  phase === "rating" && !submitted && /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
3819
3735
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
3820
3736
  /* @__PURE__ */ jsx3(Avatar, { who: "assistant", theme: t }),
@@ -4417,71 +4333,7 @@ function AssistSheet({
4417
4333
  }
4418
4334
  }
4419
4335
  ),
4420
- severityAsked && /* @__PURE__ */ jsxs3("div", { children: [
4421
- /* @__PURE__ */ jsxs3(
4422
- "span",
4423
- {
4424
- style: {
4425
- fontSize: "11.5px",
4426
- color: t.textMuted,
4427
- display: "block",
4428
- marginBottom: "6px"
4429
- },
4430
- children: [
4431
- "How bad is it?",
4432
- !severity && /* @__PURE__ */ jsx3(
4433
- "span",
4434
- {
4435
- style: {
4436
- marginLeft: "6px",
4437
- fontSize: "11px",
4438
- color: severityRefused ? "#ef4444" : t.textMuted
4439
- },
4440
- children: "\xB7 required"
4441
- }
4442
- )
4443
- ]
4444
- }
4445
- ),
4446
- /* @__PURE__ */ jsx3(
4447
- "div",
4448
- {
4449
- role: "radiogroup",
4450
- "aria-label": "Severity",
4451
- style: { display: "flex", gap: "6px" },
4452
- children: SEVERITY_LEVELS.map((s) => {
4453
- const on = severity === s;
4454
- return /* @__PURE__ */ jsx3(
4455
- "button",
4456
- {
4457
- type: "button",
4458
- onClick: () => onSeverityChange(s),
4459
- role: "radio",
4460
- "aria-checked": on,
4461
- style: {
4462
- flex: 1,
4463
- minWidth: 0,
4464
- padding: "8px 2px",
4465
- borderRadius: "8px",
4466
- border: `1px solid ${on ? t.accent : severityRefused ? "#ef4444" : t.inputBorder}`,
4467
- backgroundColor: on ? t.accent : "transparent",
4468
- color: on ? t.accentText : t.textMuted,
4469
- fontSize: "12px",
4470
- fontWeight: 600,
4471
- fontFamily: "inherit",
4472
- whiteSpace: "nowrap",
4473
- overflow: "hidden",
4474
- textOverflow: "ellipsis",
4475
- cursor: "pointer"
4476
- },
4477
- children: SEVERITY_LABELS[s]
4478
- },
4479
- s
4480
- );
4481
- })
4482
- }
4483
- )
4484
- ] }),
4336
+ validationError && /* @__PURE__ */ jsx3("span", { role: "alert", style: { fontSize: "12px", color: "#ef4444" }, children: validationError }),
4485
4337
  attachmentCount > 0 && /* @__PURE__ */ jsxs3("span", { style: { fontSize: "11.5px", color: t.textMuted }, children: [
4486
4338
  attachmentCount,
4487
4339
  " ",
@@ -4537,7 +4389,7 @@ function AssistSheet({
4537
4389
  ]
4538
4390
  }
4539
4391
  ),
4540
- !submitted && !showChats && phase !== "severity" && /* @__PURE__ */ jsxs3(
4392
+ !submitted && !showChats && /* @__PURE__ */ jsxs3(
4541
4393
  "div",
4542
4394
  {
4543
4395
  style: {
@@ -5010,15 +4862,20 @@ function AssistSheet({
5010
4862
  ] })
5011
4863
  ] }),
5012
4864
  phase === "draft" && /* @__PURE__ */ jsxs3(Fragment2, { children: [
5013
- validationError && /* @__PURE__ */ jsx3(
4865
+ !similarSlot && /* @__PURE__ */ jsxs3(
5014
4866
  "p",
5015
4867
  {
5016
4868
  style: {
5017
4869
  margin: "8px 0 0",
5018
- color: "#ef4444",
5019
- fontSize: "12px"
4870
+ color: t.textMuted,
4871
+ fontSize: "11.5px"
5020
4872
  },
5021
- children: validationError
4873
+ children: [
4874
+ "Happy with it? Press",
4875
+ " ",
4876
+ /* @__PURE__ */ jsx3("strong", { children: duplicate ? `Add to #${duplicate.number}` : "Send Report" }),
4877
+ ". The arrow above only sends a change to the assistant."
4878
+ ]
5022
4879
  }
5023
4880
  ),
5024
4881
  similarSlot ? similarSlot : /* @__PURE__ */ jsx3(
@@ -5798,7 +5655,6 @@ function detectHostAccent() {
5798
5655
  return null;
5799
5656
  }
5800
5657
  }
5801
- var SEVERITY_REQUIRED = "Pick how bad it is before sending.";
5802
5658
  var SHOT_WAIT_MS = 3e3;
5803
5659
  var SIMILAR_WAIT_MS = 2500;
5804
5660
  var MAX_SIMILAR_SHOWN = 3;
@@ -5945,6 +5801,8 @@ function getTheme(dark) {
5945
5801
  function isLowQualityText(text) {
5946
5802
  const trimmed = text.trim();
5947
5803
  if (!trimmed) return null;
5804
+ const wordCount = trimmed.split(/\s+/).length;
5805
+ if (wordCount >= 6 || trimmed.length >= 40) return null;
5948
5806
  const throwaway = /^(done|ok|yes|no|hi|hello|hey|test|testing|asdf|qwerty|abc|xyz|foo|bar|baz|lol|lmao|idk|bruh|nice|cool|wow|sup|yo|nah|yep|nope|thanks|thx|ty|k|kk|hmm|hm|na|mm|mhm|aight|bet|gg|wp|rip|omg|pls|plz)$/i;
5949
5807
  if (throwaway.test(trimmed)) {
5950
5808
  return "Please describe the actual issue you're experiencing";
@@ -6029,7 +5887,6 @@ function ReportDialog({
6029
5887
  assistContext = null,
6030
5888
  transcribeAudio: transcribeAudio2,
6031
5889
  types,
6032
- showSeverity = true,
6033
5890
  captureScreenshot = captureDefaultScreenshot,
6034
5891
  reporter: reporter2,
6035
5892
  onClose,
@@ -6156,14 +6013,12 @@ function ReportDialog({
6156
6013
  }, [isOpen]);
6157
6014
  const [step, setStep] = useState4(1);
6158
6015
  const [reportType, setReportType] = useState4("BUG");
6159
- const [severity, setSeverity] = useState4(null);
6160
6016
  const [validationError, setValidationError] = useState4(null);
6161
6017
  const [placeholderIdx, setPlaceholderIdx] = useState4(0);
6162
6018
  const [rating, setRating] = useState4(0);
6163
6019
  const [hoveredStar, setHoveredStar] = useState4(0);
6164
6020
  const isRating = reportType === "RATING";
6165
6021
  const submitDisabled = isSubmitting || (isRating ? rating < 1 : !description.trim());
6166
- const needsSeverity = validationError === SEVERITY_REQUIRED && showSeverity && reportType === "BUG" && !severity;
6167
6022
  const availableTypes = types != null ? types : [
6168
6023
  "BUG",
6169
6024
  "FEATURE_REQUEST",
@@ -6508,7 +6363,6 @@ function ReportDialog({
6508
6363
  setPickedSimilar(null);
6509
6364
  setCheckingSimilar(false);
6510
6365
  setAttachingTo(null);
6511
- setSeverity(null);
6512
6366
  setValidationError(null);
6513
6367
  setSelfReportFrom(null);
6514
6368
  setVoiceError(null);
@@ -6734,11 +6588,6 @@ function ReportDialog({
6734
6588
  setStep(2);
6735
6589
  return;
6736
6590
  }
6737
- if (showSeverity && reportType === "BUG" && !severity) {
6738
- setValidationError(SEVERITY_REQUIRED);
6739
- setStep(2);
6740
- return;
6741
- }
6742
6591
  const duplicateOf = (_a2 = opts == null ? void 0 : opts.duplicateOf) != null ? _a2 : duplicateIssueNumber;
6743
6592
  const attachKind = (opts == null ? void 0 : opts.duplicateOf) ? (_b = opts.kind) != null ? _b : "duplicate" : duplicateKind;
6744
6593
  if (findSimilarIssues2 && !(opts == null ? void 0 : opts.skipSimilar) && !duplicateOf) {
@@ -6779,9 +6628,6 @@ function ReportDialog({
6779
6628
  const metadata = {};
6780
6629
  if (shots.length > 0) metadata.screenshots = JSON.stringify(shots);
6781
6630
  if (attachments.length > 0) metadata.attachments = JSON.stringify(attachments);
6782
- if (showSeverity && reportType === "BUG" && severity) {
6783
- metadata.severity = severity;
6784
- }
6785
6631
  if (duplicateOf) {
6786
6632
  metadata.duplicateIssueNumber = String(duplicateOf);
6787
6633
  if (attachKind === "related") metadata.duplicateKind = "related";
@@ -8547,82 +8393,6 @@ function ReportDialog({
8547
8393
  }
8548
8394
  )
8549
8395
  ] }),
8550
- showSeverity && reportType === "BUG" && /* @__PURE__ */ jsxs5("div", { style: { marginTop: "10px" }, children: [
8551
- /* @__PURE__ */ jsxs5(
8552
- "span",
8553
- {
8554
- style: {
8555
- fontSize: "12px",
8556
- color: t.textMuted,
8557
- marginBottom: "6px",
8558
- display: "flex",
8559
- alignItems: "center",
8560
- gap: "6px"
8561
- },
8562
- children: [
8563
- "How bad is it?",
8564
- /* @__PURE__ */ jsx5(
8565
- "span",
8566
- {
8567
- style: {
8568
- color: severity ? t.textMuted : needsSeverity ? "#ef4444" : t.textMuted,
8569
- fontSize: "11px"
8570
- },
8571
- children: severity ? "" : "\xB7 required"
8572
- }
8573
- )
8574
- ]
8575
- }
8576
- ),
8577
- /* @__PURE__ */ jsx5(
8578
- "div",
8579
- {
8580
- role: "radiogroup",
8581
- "aria-label": "Severity",
8582
- style: { display: "flex", gap: "6px" },
8583
- children: SEVERITY_LEVELS.map((s) => {
8584
- const on = severity === s;
8585
- return /* @__PURE__ */ jsx5(
8586
- "button",
8587
- {
8588
- type: "button",
8589
- role: "radio",
8590
- "aria-checked": on,
8591
- onClick: () => {
8592
- setSeverity(s);
8593
- if (validationError)
8594
- setValidationError(null);
8595
- },
8596
- style: {
8597
- flex: 1,
8598
- minWidth: 0,
8599
- // 9px + 12px line + borders clears a 36px
8600
- // tap target; 6px left it at ~29px.
8601
- padding: "9px 2px",
8602
- borderRadius: "6px",
8603
- border: `1px solid ${on ? t.accent : needsSeverity ? "#ef4444" : t.inputBorder}`,
8604
- background: on ? t.accent : "transparent",
8605
- color: on ? t.accentText : t.text,
8606
- fontSize: "12px",
8607
- fontWeight: 600,
8608
- cursor: "pointer",
8609
- fontFamily: "inherit",
8610
- whiteSpace: "nowrap",
8611
- // Four labels where there were three: clip
8612
- // rather than spill if a host squeezes the
8613
- // dialog below ~260px.
8614
- overflow: "hidden",
8615
- textOverflow: "ellipsis",
8616
- transition: "all 0.15s ease"
8617
- },
8618
- children: SEVERITY_LABELS[s]
8619
- },
8620
- s
8621
- );
8622
- })
8623
- }
8624
- )
8625
- ] }),
8626
8396
  validationError && /* @__PURE__ */ jsx5(
8627
8397
  "p",
8628
8398
  {
@@ -8973,14 +8743,6 @@ function ReportDialog({
8973
8743
  },
8974
8744
  issueTitle,
8975
8745
  onIssueTitleChange: setIssueTitle,
8976
- severity,
8977
- onSeverityChange: (value) => {
8978
- setSeverity(value);
8979
- if (validationError) setValidationError(null);
8980
- },
8981
- showSeverity,
8982
- validationError,
8983
- severityRefused: needsSeverity,
8984
8746
  isSubmitting,
8985
8747
  submitted,
8986
8748
  onSend: () => void handleSubmit(),
@@ -11021,7 +10783,6 @@ function GlitchgrabProviderInner({
11021
10783
  children,
11022
10784
  fallback,
11023
10785
  types,
11024
- showSeverity,
11025
10786
  ignoreErrors,
11026
10787
  release: release2,
11027
10788
  context: appContext2,
@@ -11596,7 +11357,6 @@ function GlitchgrabProviderInner({
11596
11357
  reportGlitchgrabProblem: glitchgrabReport ? reportGlitchgrabProblem : void 0,
11597
11358
  transcribeAudio: aiBlockedUnsigned ? void 0 : transcribe,
11598
11359
  types,
11599
- showSeverity,
11600
11360
  reporter: reporter2,
11601
11361
  chatHistoryKey: chatHistoryKey("sdk", token, session == null ? void 0 : session.userId),
11602
11362
  headerSlot: projectName ? /* @__PURE__ */ jsxs7("div", { style: { fontSize: 11, color: "#9aa0a6" }, children: [