@lightworkai.official/debug-capture 0.19.2 → 0.19.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/README.md +4 -1
- package/dist/debug-capture.js +29 -13
- package/dist/index.mjs +16 -16
- package/dist/ui/chatBubble.d.ts +2 -0
- package/package.json +1 -1
- package/src/ui/chatBubble.ts +14 -2
package/dist/ui/chatBubble.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** The panel's address: the support host's page, told the realm, signing in by hand-off (no token in the address). */
|
|
2
2
|
export declare function supportFrameUrl(host: string, realmKey: string): string;
|
|
3
|
+
/** Where the panel's เปิดในระบบแจ้งปัญหา may land: the person's chat or their เรื่อง — anything else, their chat. Pure. */
|
|
4
|
+
export declare function portalPath(path: string): string;
|
|
3
5
|
/** The desk's face on the button — the support host's public file, the same picture as its replies (0.19.2). */
|
|
4
6
|
export declare function supportFaceUrl(host: string): string;
|
|
5
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightworkai.official/debug-capture",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
4
4
|
"description": "Report-a-problem widget: rolling network/console/action capture, optional rrweb session replay, annotated screenshot, and submission to a Lightwork Support host",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.mjs",
|
package/src/ui/chatBubble.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { chatPlace, getConfig } from "../config";
|
|
17
17
|
import { hostToken, onLiveFrame } from "../live";
|
|
18
|
+
import { openSupportPortal } from "../portal";
|
|
18
19
|
import { launch } from "../reporter";
|
|
19
20
|
import { followHostFont, OWN_FONTS } from "./hostFont";
|
|
20
21
|
import { strings } from "./strings";
|
|
@@ -110,6 +111,10 @@ export function supportFrameUrl(host: string, realmKey: string): string {
|
|
|
110
111
|
url.searchParams.set("hand", "1");
|
|
111
112
|
return url.toString();
|
|
112
113
|
}
|
|
114
|
+
/** Where the panel's เปิดในระบบแจ้งปัญหา may land: the person's chat or their เรื่อง — anything else, their chat. Pure. */
|
|
115
|
+
export function portalPath(path: string): string {
|
|
116
|
+
return /^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(path) ? path : "/me/chat";
|
|
117
|
+
}
|
|
113
118
|
/** The desk's face on the button — the support host's public file, the same picture as its replies (0.19.2). */
|
|
114
119
|
export function supportFaceUrl(host: string): string {
|
|
115
120
|
return new URL("support-face.webp", base(host)).toString();
|
|
@@ -389,11 +394,18 @@ function post(message: Record<string, unknown>): void {
|
|
|
389
394
|
|
|
390
395
|
async function onFrame(e: MessageEvent): Promise<void> {
|
|
391
396
|
if (!frame || e.source !== frame.contentWindow) return;
|
|
392
|
-
const d = e.data as { source?: unknown; type?: unknown; total?: unknown; phase?: unknown; x?: unknown; y?: unknown } | null;
|
|
397
|
+
const d = e.data as { source?: unknown; type?: unknown; total?: unknown; phase?: unknown; x?: unknown; y?: unknown; path?: unknown } | null;
|
|
393
398
|
if (!d || d.source !== FRAME) return;
|
|
394
399
|
if (d.type === "hello") {
|
|
395
400
|
const token = await hostToken();
|
|
396
|
-
|
|
401
|
+
// What this widget does for the panel — it shows only buttons that work here (0.19.3: the portal hand-off).
|
|
402
|
+
if (token) post({ type: "token", token, can: ["portal"] });
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (d.type === "portal") {
|
|
406
|
+
// เปิดในระบบแจ้งปัญหา: the whole portal at that page, by the usual hand-off — its countdown over the open panel,
|
|
407
|
+
// a fresh sign-in, a new tab. Only the reporter's own pages; the portal checks again on arrival.
|
|
408
|
+
void openSupportPortal({ returnTo: portalPath(typeof d.path === "string" ? d.path : "") });
|
|
397
409
|
return;
|
|
398
410
|
}
|
|
399
411
|
if (d.type === "ready") return post({ type: isOpen ? "shown" : "hidden" });
|