@lightworkai.official/debug-capture 0.13.0 → 0.14.1

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/src/requests.ts CHANGED
@@ -3,18 +3,19 @@
3
3
  *
4
4
  * A report is "something broke": it carries a screenshot and the page's logs,
5
5
  * because those are what make it reproducible. A request is "please do this"
6
- * — reset my password, give me access — and nothing about the screen helps,
7
- * so it asks for no screen share and sends no bundle. The desk decides what
8
- * may be asked (its request types opened to reporters, GET
6
+ * — reset my password, fix this record — and the logs do not help, but the
7
+ * picture of the page often does (the record to fix is on it): a request
8
+ * keeps the picture and the page's address, and sends no bundle. The desk
9
+ * decides what may be asked (its request types opened to reporters, GET
9
10
  * /ingest/request-types); where it opens none, the widget is exactly what it
10
11
  * was.
11
12
  *
12
- * Read AHEAD of a launch, not at it: `getDisplayMedia` must be called inside
13
- * the click that opened the widget, so a launch cannot wait on the network to
14
- * find out whether to ask "report or request?" first. Installing the widget
15
- * starts the read; a launch uses whatever has arrived.
13
+ * Asked IN the report form, never before it (docs/WIDGET-ASK-PLAN.md): the
14
+ * press takes the screen as always, and the form offers เป็นคำขอ? whenever
15
+ * this read has landed. Installing the widget starts the read.
16
16
  */
17
17
  import { getConfig, appInfo, resolveModule } from "./config";
18
+ import { compressScreenshot } from "./screenshot";
18
19
  import { failureOf, identityHeader, ReportError, type FiledTicket } from "./submit";
19
20
 
20
21
  export interface RequestTypeOption {
@@ -74,7 +75,7 @@ export function resetRequestTypes(): void {
74
75
  * same request into one. Who is asking comes from the identity token when the
75
76
  * host has one, as for a report.
76
77
  */
77
- export async function submitRequest(input: { ticketTypeId: string; title: string; description: string }): Promise<FiledTicket> {
78
+ export async function submitRequest(input: { ticketTypeId: string; title: string; description: string; screenshotDataUrl?: string | null }): Promise<FiledTicket> {
78
79
  const config = getConfig();
79
80
  let user: { email?: string | null; fullName?: string | null } = {};
80
81
  try {
@@ -93,6 +94,8 @@ export async function submitRequest(input: { ticketTypeId: string; title: string
93
94
  priority: "MEDIUM",
94
95
  requesterEmail: user.email ?? undefined,
95
96
  requesterName: user.fullName ?? undefined,
97
+ // The picture of the page, resized as a report's is — never the logs.
98
+ attachments: input.screenshotDataUrl ? [{ dataUri: await compressScreenshot(input.screenshotDataUrl), filename: "screenshot.jpg" }] : undefined,
96
99
  };
97
100
  const res = await fetch(`${hostOf()}/ingest/tickets`, {
98
101
  method: "POST",
@@ -621,6 +621,8 @@ export function createAnnotator(
621
621
  event.preventDefault();
622
622
  deleteSelected();
623
623
  } else if (event.key === "Escape") {
624
+ // Handled: the dialog around the picture must not also close on it.
625
+ event.preventDefault();
624
626
  selected = -1;
625
627
  render();
626
628
  }