@alliance-droid/status-feedback-system 4.1.3 → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.5
4
+
5
+ ### Fixed
6
+
7
+ - `<DevFeedback>` console-error capture: arguments are now serialized properly before being attached to a bug report. Previously `console.error(obj)` / `console.error('msg', { detail })` were captured via `String()`, which produced `[object Object]` — so the resulting ADO work item listed each console error as `[object Object]`. Errors now serialize to their stack, plain objects/arrays to JSON (with circular-reference safety), and primitives via `String()`. Extracted to `formatConsoleArg` / `formatConsoleArgs` with unit coverage.
8
+
9
+ ## 4.1.4
10
+
11
+ ### Changed
12
+
13
+ - `<DevFeedback>` modal: removed the "Submitting as <email>" line at the top of the form, and increased the modal padding (`p-5`/`px-5` → `p-6`/`px-6` on the header, body, and footer) for more breathing room.
14
+
3
15
  ## 4.1.3
4
16
 
5
17
  ### Fixed
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { createStatusClient, type StatusClient } from '../api.js';
3
3
  import { FEEDBACK_CATEGORIES } from '../types.js';
4
+ import { formatConsoleArgs } from '../console-format.js';
4
5
  import PasteImageInput from './shared/PasteImageInput.svelte';
5
6
  import {
6
7
  Card,
@@ -209,7 +210,7 @@
209
210
  // Capture recent console errors to attach to bug reports.
210
211
  const originalConsoleError = console.error;
211
212
  console.error = (...args: unknown[]) => {
212
- consoleErrors.push(args.map(String).join(' '));
213
+ consoleErrors.push(formatConsoleArgs(args));
213
214
  if (consoleErrors.length > maxConsoleErrors) consoleErrors.shift();
214
215
  originalConsoleError.apply(console, args);
215
216
  };
@@ -419,7 +420,7 @@
419
420
  <!-- Header (draggable) -->
420
421
  <div
421
422
  role="presentation"
422
- class="flex items-center justify-between px-5 py-4 border-b border-border shrink-0 select-none"
423
+ class="flex items-center justify-between px-6 py-4 border-b border-border shrink-0 select-none"
423
424
  style="cursor: {isDragging ? 'grabbing' : 'grab'};"
424
425
  onmousedown={handleDragStart}
425
426
  >
@@ -443,7 +444,7 @@
443
444
  </div>
444
445
 
445
446
  <!-- Body (scrollable) -->
446
- <div class="p-5 space-y-4 overflow-y-auto">
447
+ <div class="p-6 space-y-4 overflow-y-auto">
447
448
  {#if submitResult === 'success'}
448
449
  <div class="text-center py-6">
449
450
  <i class="fa-solid fa-check-circle text-3xl text-green-400"></i>
@@ -453,11 +454,6 @@
453
454
  </p>
454
455
  </div>
455
456
  {:else}
456
- <div class="flex items-center gap-1.5 text-xs text-foreground-tertiary">
457
- <i class="fa-solid fa-user" aria-hidden="true"></i>
458
- <span>Submitting as <span class="font-medium text-foreground-secondary">{userEmail}</span></span>
459
- </div>
460
-
461
457
  <Input
462
458
  bind:value={formTitle}
463
459
  placeholder={formType === 'bug' ? 'Brief summary of the bug' : 'Feature title'}
@@ -545,7 +541,7 @@
545
541
 
546
542
  <!-- Footer -->
547
543
  {#if submitResult !== 'success' && hasUserEmail}
548
- <div class="flex justify-end gap-2 px-5 py-4 border-t border-border shrink-0">
544
+ <div class="flex justify-end gap-2 px-6 py-4 border-t border-border shrink-0">
549
545
  <Button variant="neutral" style="outline" onclick={() => (formOpen = false)}>
550
546
  Cancel
551
547
  </Button>
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Serialize console.error arguments into useful strings for bug-report capture.
3
+ *
4
+ * The naive `args.map(String).join(' ')` turns any object argument into the
5
+ * useless `"[object Object]"` and drops an Error's stack — so a captured
6
+ * `console.error(err)` or `console.error('msg', { detail })` reaches the ADO
7
+ * work item as `[object Object]`. These helpers serialize each argument by shape.
8
+ */
9
+ /** Serialize a single console.error argument to a useful string. */
10
+ export declare function formatConsoleArg(arg: unknown): string;
11
+ /** Serialize a console.error argument list into a single line. */
12
+ export declare function formatConsoleArgs(args: unknown[]): string;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Serialize console.error arguments into useful strings for bug-report capture.
3
+ *
4
+ * The naive `args.map(String).join(' ')` turns any object argument into the
5
+ * useless `"[object Object]"` and drops an Error's stack — so a captured
6
+ * `console.error(err)` or `console.error('msg', { detail })` reaches the ADO
7
+ * work item as `[object Object]`. These helpers serialize each argument by shape.
8
+ */
9
+ /** Serialize a single console.error argument to a useful string. */
10
+ export function formatConsoleArg(arg) {
11
+ if (typeof arg === 'string')
12
+ return arg;
13
+ if (arg instanceof Error)
14
+ return arg.stack || `${arg.name}: ${arg.message}`;
15
+ if (arg === null)
16
+ return 'null';
17
+ if (arg === undefined)
18
+ return 'undefined';
19
+ if (typeof arg === 'object') {
20
+ const seen = new WeakSet();
21
+ try {
22
+ const json = JSON.stringify(arg, (_key, value) => {
23
+ if (value instanceof Error)
24
+ return value.stack || `${value.name}: ${value.message}`;
25
+ if (typeof value === 'object' && value !== null) {
26
+ if (seen.has(value))
27
+ return '[Circular]';
28
+ seen.add(value);
29
+ }
30
+ return value;
31
+ });
32
+ // JSON.stringify returns undefined for unserializable roots and "{}"
33
+ // for objects with no enumerable props — fall back to String() then.
34
+ if (json && json !== '{}')
35
+ return json;
36
+ }
37
+ catch {
38
+ /* fall through to String() */
39
+ }
40
+ }
41
+ return String(arg);
42
+ }
43
+ /** Serialize a console.error argument list into a single line. */
44
+ export function formatConsoleArgs(args) {
45
+ return args.map(formatConsoleArg).join(' ');
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alliance-droid/status-feedback-system",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "type": "module",
5
5
  "description": "Drop-in system status pages and user feedback forms for SvelteKit apps",
6
6
  "svelte": "./dist/index.js",