@marketrix.ai/widget 3.8.487 → 3.8.489
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/dist/src/components/views/ChatView.d.ts +1 -2
- package/dist/src/hooks/useScreenShare.d.ts +4 -11
- package/dist/src/services/ApiService.d.ts +1 -1
- package/dist/src/services/ChatService.d.ts +1 -1
- package/dist/src/services/DomService.d.ts +1 -1
- package/dist/src/services/ScreenShareService.d.ts +1 -0
- package/dist/src/services/ShowModeService.d.ts +1 -1
- package/dist/src/services/StorageService.d.ts +3 -0
- package/dist/src/services/WidgetService.d.ts +0 -2
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/utils/chat.d.ts +1 -0
- package/dist/widget.mjs +15 -15
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ChatViewProps {
|
|
3
3
|
onScreenSharingChange: (isSharing: boolean) => void;
|
|
4
|
-
|
|
5
|
-
stopScreenShareRef: React.MutableRefObject<(() => void) | null>;
|
|
4
|
+
toggleScreenShareRef: React.MutableRefObject<(() => void) | null>;
|
|
6
5
|
messageInputRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
7
6
|
}
|
|
8
7
|
export declare const ChatView: React.FC<ChatViewProps>;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import type { InstructionType } from '../sdk';
|
|
2
2
|
import type { ChatMessage } from '../types';
|
|
3
|
-
export interface PendingMessage {
|
|
4
|
-
content: string;
|
|
5
|
-
mode?: InstructionType;
|
|
6
|
-
alreadyAdded?: boolean;
|
|
7
|
-
}
|
|
8
3
|
export interface UseScreenShareOptions {
|
|
9
4
|
onScreenSharingChange?: (isSharing: boolean) => void;
|
|
10
|
-
|
|
11
|
-
stopScreenShareRef?: React.MutableRefObject<(() => void) | null>;
|
|
5
|
+
toggleScreenShareRef?: React.MutableRefObject<(() => void) | null>;
|
|
12
6
|
onAddMessage: (message: ChatMessage) => void;
|
|
13
7
|
onUpdateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
14
8
|
onRemoveMessage?: (messageId: string) => void;
|
|
15
9
|
onSendMessage: (message: string, mode?: InstructionType, skipUserMessage?: boolean) => void;
|
|
16
|
-
|
|
17
|
-
setPendingMessage: (message: PendingMessage | null) => void;
|
|
10
|
+
messages: ChatMessage[];
|
|
18
11
|
}
|
|
19
12
|
export interface UseScreenShareReturn {
|
|
20
13
|
isScreenSharing: boolean;
|
|
@@ -24,6 +17,6 @@ export interface UseScreenShareReturn {
|
|
|
24
17
|
handleScreenAccessDialogDismiss: () => void;
|
|
25
18
|
handleScreenAccessRequestAllow: () => Promise<void>;
|
|
26
19
|
handleScreenAccessRequestDeny: () => void;
|
|
27
|
-
requestScreenAccess: (mode: InstructionType) => void;
|
|
20
|
+
requestScreenAccess: (mode: InstructionType, content: string) => void;
|
|
28
21
|
}
|
|
29
|
-
export declare function useScreenShare({ onScreenSharingChange,
|
|
22
|
+
export declare function useScreenShare({ onScreenSharingChange, toggleScreenShareRef, onAddMessage, onUpdateMessage, onRemoveMessage, onSendMessage, messages, }: UseScreenShareOptions): UseScreenShareReturn;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type InstructionType } from '../sdk';
|
|
2
2
|
import { type CredentialedConfig } from './StorageService';
|
|
3
3
|
/** The reply does not come back from here — it arrives asynchronously as a chat/response event on the stream. */
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function chatPost(config: CredentialedConfig, message: string, mode: InstructionType, requestId: string): Promise<void>;
|
|
@@ -8,5 +8,5 @@ export declare const chatService: ChatService;
|
|
|
8
8
|
export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
|
|
9
9
|
export declare const createAgentMessage: (content: string) => ChatMessage;
|
|
10
10
|
export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
|
|
11
|
-
export declare const createScreenAccessRequestMessage: (mode?:
|
|
11
|
+
export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
|
|
12
12
|
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|
|
@@ -12,7 +12,7 @@ export declare class DomService {
|
|
|
12
12
|
reindexAndSnapshot(): string;
|
|
13
13
|
getSequenceForElement(element: Element): number | undefined;
|
|
14
14
|
private clearIndex;
|
|
15
|
-
|
|
15
|
+
notInteractableReason(element: HTMLElement, index: number): string | null;
|
|
16
16
|
getValidatedElement(index: number): ValidatedElementResult;
|
|
17
17
|
}
|
|
18
18
|
export declare const domService: DomService;
|
|
@@ -26,7 +26,7 @@ export declare class ShowModeService {
|
|
|
26
26
|
private updatePopupPosition;
|
|
27
27
|
private setupClickHandler;
|
|
28
28
|
private setupContinueButton;
|
|
29
|
-
/**
|
|
29
|
+
/** notInteractableReason's first test is `document.body.contains`, so this one watchdog also covers removal. */
|
|
30
30
|
private setupVisibilityMonitoring;
|
|
31
31
|
private failShowAction;
|
|
32
32
|
private escapeHtml;
|
|
@@ -17,9 +17,12 @@ export type MarketrixChatContext = Omit<ChatSnapshot, 'messages'> & {
|
|
|
17
17
|
config: MarketrixConfig | null;
|
|
18
18
|
timestamp: number;
|
|
19
19
|
};
|
|
20
|
+
/** Per-tenant scope for browser-local keys: the credential id, else the application id. */
|
|
21
|
+
export declare function tenantScope(config: MarketrixConfig): string;
|
|
20
22
|
export declare function readLocal(key: string): string | null;
|
|
21
23
|
export declare function writeLocal(key: string, value: string): void;
|
|
22
24
|
declare class StorageService {
|
|
25
|
+
private key;
|
|
23
26
|
private context;
|
|
24
27
|
getContext(): MarketrixChatContext;
|
|
25
28
|
updateContext(updates: Partial<MarketrixChatContext>): void;
|
|
@@ -2,6 +2,4 @@ import { type WidgetSettingsData } from '../sdk';
|
|
|
2
2
|
import type { MarketrixConfig } from '../types';
|
|
3
3
|
import type { CredentialedConfig } from './StorageService';
|
|
4
4
|
export declare function createConfigFromSettings(widgetSettings: WidgetSettingsData, baseConfig?: Partial<MarketrixConfig>): MarketrixConfig;
|
|
5
|
-
/** Per-tenant scope for browser-local keys: the credential id, else the application id. */
|
|
6
|
-
export declare function tenantScope(config: MarketrixConfig): string;
|
|
7
5
|
export declare function loadWidgetConfig(config: MarketrixConfig): Promise<CredentialedConfig>;
|
|
@@ -24,6 +24,8 @@ export interface ChatMessage {
|
|
|
24
24
|
videoStream?: MediaStream;
|
|
25
25
|
isScreenAccessRequest?: boolean;
|
|
26
26
|
screenShareStatus?: 'allowed' | 'denied';
|
|
27
|
+
/** The message queued behind an open screen-access request, sent once it resolves. */
|
|
28
|
+
pendingContent?: string;
|
|
27
29
|
isSystemMessage?: boolean;
|
|
28
30
|
isPlaceholder?: boolean;
|
|
29
31
|
placeholderState?: 'thinking' | 'waiting-for-user';
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface FindMessageOptions {
|
|
|
6
6
|
isTaskRunning: boolean;
|
|
7
7
|
currentMode: InstructionType;
|
|
8
8
|
}
|
|
9
|
+
export declare function lastIndexWhere<T>(items: T[], matches: (item: T) => boolean): number;
|
|
9
10
|
/** Ranked predicates: the first rank matching anything wins, and within it the newest message. */
|
|
10
11
|
export declare function findMessageForProgress({ messages, isTaskRunning, currentMode, }: FindMessageOptions): {
|
|
11
12
|
index: number;
|