@lightworkai.official/debug-capture 0.19.0 → 0.19.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/README.md +4 -1
- package/dist/debug-capture.js +13 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +16 -16
- package/dist/ui/chatBubble.d.ts +7 -0
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/ui/chatBubble.ts +16 -4
package/dist/ui/chatBubble.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
/**
|
|
4
|
+
* How far the call's card and frame rise from their own 16px so they clear the bubble — its offset, its size and the
|
|
5
|
+
* gap above it (0.19.1: 0.19.0 assumed the bubble at the corner, and a raised one sat under a ringing call). Pure.
|
|
6
|
+
*/
|
|
7
|
+
export declare function chatLift(bubbleY: number): number;
|
|
8
|
+
/** The panel above the bubble, never past the top of the window — its height for the bubble's offset (0.19.1). Pure. */
|
|
9
|
+
export declare function panelHeight(bubbleY: number): string;
|
|
3
10
|
/** The badge's number: `99+` past 99; nothing at 0. Pure, for the tests. */
|
|
4
11
|
export declare function badgeText(n: number): string;
|
|
5
12
|
/** Open the panel — from the bubble, or from the host app's own button (`openSupportChat`). */
|
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.1",
|
|
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/index.ts
CHANGED
|
@@ -77,7 +77,7 @@ export type { OpenPortalOptions } from "./portal";
|
|
|
77
77
|
* แชทกับทีม (0.19): `chat` in the config mounts the bubble on install; a host with its own button opens and closes
|
|
78
78
|
* the same panel. The panel is the support host's page, framed — as the tickets are, maintained where they live.
|
|
79
79
|
*/
|
|
80
|
-
export { openSupportChat, closeSupportChat, mountSupportChat, unmountSupportChat, supportFrameUrl, badgeText } from "./ui/chatBubble";
|
|
80
|
+
export { openSupportChat, closeSupportChat, mountSupportChat, unmountSupportChat, supportFrameUrl, badgeText, chatLift, panelHeight } from "./ui/chatBubble";
|
|
81
81
|
export type { ChatOptions } from "./config";
|
|
82
82
|
|
|
83
83
|
export type * from "./types";
|
package/src/ui/chatBubble.ts
CHANGED
|
@@ -52,7 +52,7 @@ const CSS = `
|
|
|
52
52
|
.panel iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
|
|
53
53
|
@keyframes in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
|
|
54
54
|
@media (max-width: 639px) {
|
|
55
|
-
.panel { inset: 0 !important; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
|
|
55
|
+
.panel { inset: 0 !important; width: 100vw !important; height: 100dvh !important; border-radius: 0; border: 0; }
|
|
56
56
|
.open .bubble { display: none; }
|
|
57
57
|
}
|
|
58
58
|
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble { transition: none; } }
|
|
@@ -84,6 +84,18 @@ export function supportFrameUrl(host: string, realmKey: string): string {
|
|
|
84
84
|
return url.toString();
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* How far the call's card and frame rise from their own 16px so they clear the bubble — its offset, its size and the
|
|
89
|
+
* gap above it (0.19.1: 0.19.0 assumed the bubble at the corner, and a raised one sat under a ringing call). Pure.
|
|
90
|
+
*/
|
|
91
|
+
export function chatLift(bubbleY: number): number {
|
|
92
|
+
return bubbleY + SIZE + GAP - 16;
|
|
93
|
+
}
|
|
94
|
+
/** The panel above the bubble, never past the top of the window — its height for the bubble's offset (0.19.1). Pure. */
|
|
95
|
+
export function panelHeight(bubbleY: number): string {
|
|
96
|
+
return `min(640px, calc(100vh - ${bubbleY + SIZE + GAP + 16}px))`;
|
|
97
|
+
}
|
|
98
|
+
|
|
87
99
|
/** The badge's number: `99+` past 99; nothing at 0. Pure, for the tests. */
|
|
88
100
|
export function badgeText(n: number): string {
|
|
89
101
|
return n <= 0 ? "" : n > 99 ? "99+" : String(n);
|
|
@@ -125,9 +137,9 @@ async function refreshUnread(): Promise<void> {
|
|
|
125
137
|
function show(on: boolean): void {
|
|
126
138
|
if (!root) return;
|
|
127
139
|
root.style.display = on ? "" : "none";
|
|
128
|
-
// The call's card and frame sit above the bubble while it is there (ring.ts, callFrame.ts).
|
|
140
|
+
// The call's card and frame sit above the bubble while it is there (ring.ts, callFrame.ts) — wherever `offset` put it.
|
|
129
141
|
const place = chatPlace(getConfig().chat);
|
|
130
|
-
if (on && place?.side === "right") document.documentElement.style.setProperty("--lw-chat-lift", `${
|
|
142
|
+
if (on && place?.side === "right") document.documentElement.style.setProperty("--lw-chat-lift", `${chatLift(place.y)}px`);
|
|
131
143
|
else document.documentElement.style.removeProperty("--lw-chat-lift");
|
|
132
144
|
}
|
|
133
145
|
|
|
@@ -217,7 +229,7 @@ export function mountSupportChat(): void {
|
|
|
217
229
|
bubble = shadow.querySelector(".bubble");
|
|
218
230
|
badge = shadow.querySelector(".badge");
|
|
219
231
|
Object.assign(bubble!.style, { [side]: `${place.x}px`, bottom: `${place.y}px` });
|
|
220
|
-
Object.assign(panel!.style, { [side]: `${place.x}px`, bottom: `${place.y + SIZE + GAP}px
|
|
232
|
+
Object.assign(panel!.style, { [side]: `${place.x}px`, bottom: `${place.y + SIZE + GAP}px`, height: panelHeight(place.y) });
|
|
221
233
|
bubble!.addEventListener("click", () => (isOpen ? closeSupportChat() : openSupportChat()));
|
|
222
234
|
document.body.append(root);
|
|
223
235
|
window.addEventListener("message", onMessage);
|