@marketrix.ai/widget 4.0.114 → 4.0.116
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.
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
* the allow/deny controls of a screen-access request, and a done/failed/stopped glyph in the tenant
|
|
6
6
|
* accent at a per-status opacity. The last message fades in.
|
|
7
7
|
*
|
|
8
|
+
* **Memoized, and `isTaskRunning` arrives as a prop rather than through `useWidget()`.** `MessageList`
|
|
9
|
+
* commits a whole new `messages` array on every `chat/delta` token (`ChatContext`'s reducer keeps
|
|
10
|
+
* reference equality for every message except the one being streamed into), so a `useWidget()`/
|
|
11
|
+
* `useChatContext()` call anywhere inside a list row re-subscribes that row to the token stream directly
|
|
12
|
+
* and defeats `React.memo` regardless of props — measured at ~21 `MessageItem`/`MessageBody` renders per
|
|
13
|
+
* token in a 20-message transcript before this change (one per row), ~1 after (only the streaming row).
|
|
14
|
+
* `onScreenAccessAllow`/`onScreenAccessDeny` must stay referentially stable (`ChatView`'s `useScreenShare`
|
|
15
|
+
* wraps them for exactly this) or the memo comparison never bails.
|
|
16
|
+
*
|
|
8
17
|
* `MessageBody` renders the message's `parts` — text and progress lines — and `Thinking` is the
|
|
9
18
|
* spinner-and-caption row shown while a reply is pending, its caption switching to name the visitor's
|
|
10
19
|
* action when the agent is blocked on them. Thinking shows while a placeholder carries no text yet, and
|
|
@@ -16,8 +25,9 @@ import type { ChatMessage } from '../../types';
|
|
|
16
25
|
interface MessageItemProps {
|
|
17
26
|
message: ChatMessage;
|
|
18
27
|
isLastMessage: boolean;
|
|
28
|
+
isTaskRunning: boolean;
|
|
19
29
|
onScreenAccessAllow?: () => void;
|
|
20
30
|
onScreenAccessDeny?: () => void;
|
|
21
31
|
}
|
|
22
|
-
export declare const MessageItem: React.
|
|
32
|
+
export declare const MessageItem: React.NamedExoticComponent<MessageItemProps>;
|
|
23
33
|
export {};
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
* `useScreenShare` (this file's only other consumer) owns the screen-share lifecycle: the in-transcript
|
|
22
22
|
* permission card, the browser picker, the live share message, and ending a share. `useLatest` keeps a
|
|
23
23
|
* value readable from a callback that must not be re-created (the polling interval below, mounted once);
|
|
24
|
-
its refs are listed in that effect's deps for the linter, but since `useRef` identity never changes,
|
|
25
|
-
listing them cannot re-arm the interval.
|
|
24
|
+
* its refs are listed in that effect's deps for the linter, but since `useRef` identity never changes,
|
|
25
|
+
* listing them cannot re-arm the interval. The same idiom stabilizes `handleScreenAccessRequestAllow`/
|
|
26
|
+
* `handleScreenAccessRequestDeny`: both are handed to every `MessageItem` through `MessageList`, and a
|
|
27
|
+
* fresh closure each render (the naive `beginScreenShare`/inline-arrow form) defeats `MessageItem`'s
|
|
28
|
+
* `React.memo` for the whole transcript on every SSE token, not just the streaming row.
|
|
26
29
|
* The hook returns `requestScreenAccess` — posting a request card carrying the queued turn, no-oping if
|
|
27
30
|
* one is already open — plus that card's Allow/Deny handlers, the toolbar dialog's Allow/Dismiss
|
|
28
31
|
* handlers, and `toggleScreenShareRef`, a toggle stopping a live share or opening that dialog.
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* `LAYER_TOKENS` is the z-index ladder (screen-edge glow < panel < dialog < toast), based just above the
|
|
10
10
|
* 2^31-ish ceiling most host pages use so the widget sits over everything without the values overflowing a
|
|
11
|
-
* 32-bit int.
|
|
11
|
+
* 32-bit int. `showHighlight`/`showPopup` are a separate, much higher pair near the int32 ceiling: Show
|
|
12
|
+
* mode's coaching overlay (`ShowModeService`) mounts to the HOST page, outside the shadow root, to point at
|
|
13
|
+
* the widget's OWN chrome — it must outrank every value in this ladder by a wide margin, not sit one step
|
|
14
|
+
* above `toast`.
|
|
12
15
|
*/
|
|
13
16
|
import type { CSSProperties } from 'react';
|
|
14
17
|
export type RadiusToken = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'pill';
|
|
@@ -33,6 +36,8 @@ export declare const LAYER_TOKENS: {
|
|
|
33
36
|
panel: number;
|
|
34
37
|
dialog: number;
|
|
35
38
|
toast: number;
|
|
39
|
+
showHighlight: number;
|
|
40
|
+
showPopup: number;
|
|
36
41
|
};
|
|
37
42
|
export declare const notificationToneStyles: Record<NotificationTone, {
|
|
38
43
|
background: string;
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
* highlight is sized and placed over its element, so the first paint and every reposition run through it;
|
|
18
18
|
* placement takes the first of right/left/above/below that fits then clamps, its 120px height an assumption,
|
|
19
19
|
* and the watchdog tests `document.body.contains` first, covering removal as well as occlusion.
|
|
20
|
+
* `ACCENT_COLOR`/`TEXT_COLOR` are raw literals rather than design-system tokens: the highlight and popup
|
|
21
|
+
* mount to `document.body` on the HOST page, outside the shadow root, so `index.css`'s `:host`-scoped
|
|
22
|
+
* CSS custom properties never reach them.
|
|
20
23
|
*/
|
|
21
24
|
interface ShowModeOptions {
|
|
22
25
|
element: HTMLElement;
|