@marketrix.ai/widget 3.8.471 → 3.8.473

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/loader.js CHANGED
@@ -1,27 +1,15 @@
1
1
  // Must sit in <head> before any <script type="module"> — it defines the importmap they resolve against.
2
2
  (function () {
3
- var existing = {};
4
- var oldMap = document.querySelector('script[type="importmap"]');
5
- if (oldMap) {
6
- try {
7
- existing = JSON.parse(oldMap.textContent).imports || {};
8
- } catch (e) {}
9
- oldMap.remove();
10
- }
11
-
12
- // Host mappings win — `existing` is spread last so a host already on React 19 keeps its own build.
13
- var defaults = {
14
- react: 'https://esm.sh/react@19',
15
- 'react-dom': 'https://esm.sh/react-dom@19',
16
- 'react-dom/client': 'https://esm.sh/react-dom@19/client',
17
- 'react/jsx-runtime': 'https://esm.sh/react@19/jsx-runtime',
18
- };
19
-
20
- var merged = Object.assign({}, defaults, existing);
21
-
22
3
  var map = document.createElement('script');
23
4
  map.type = 'importmap';
24
- map.textContent = JSON.stringify({ imports: merged });
5
+ map.textContent = JSON.stringify({
6
+ imports: {
7
+ react: 'https://esm.sh/react@19',
8
+ 'react-dom': 'https://esm.sh/react-dom@19',
9
+ 'react-dom/client': 'https://esm.sh/react-dom@19/client',
10
+ 'react/jsx-runtime': 'https://esm.sh/react@19/jsx-runtime',
11
+ },
12
+ });
25
13
  document.head.appendChild(map);
26
14
 
27
15
  var self = document.currentScript;
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
+ import type { InstructionType } from '../../types';
2
3
  import type { IconName } from '../base/icons';
3
4
  export interface ChatInputMode {
4
- id: string;
5
+ id: InstructionType;
5
6
  icon: IconName;
6
7
  label: string;
7
8
  }
@@ -10,8 +11,8 @@ export interface ChatInputProps {
10
11
  onChange: (value: string) => void;
11
12
  onSubmit: () => void;
12
13
  modes?: ChatInputMode[];
13
- activeMode?: string;
14
- onModeChange?: (mode: string) => void;
14
+ activeMode?: InstructionType;
15
+ onModeChange?: (mode: InstructionType) => void;
15
16
  disabled?: boolean;
16
17
  taskRunning?: boolean;
17
18
  onStop?: () => void;
@@ -4,7 +4,6 @@ export interface UIState {
4
4
  isOpen: boolean;
5
5
  activeView: WidgetView;
6
6
  currentMode: InstructionType;
7
- isLoading: boolean;
8
7
  error?: string;
9
8
  }
10
9
  export interface UIStateActions {
@@ -12,7 +11,6 @@ export interface UIStateActions {
12
11
  toggleWidget: () => void;
13
12
  closeWidget: () => void;
14
13
  setMode: (mode: InstructionType) => void;
15
- setLoading: (loading: boolean) => void;
16
14
  setError: (error: string | undefined) => void;
17
15
  applyState: (payload: Partial<UIState>) => void;
18
16
  }
@@ -7,17 +7,14 @@ export interface SseState {
7
7
  messages: ChatMessage[];
8
8
  task: TaskState;
9
9
  }
10
- export type SseEffect = {
10
+ export interface SseEffect {
11
11
  type: 'executeTool';
12
12
  toolCallId: string;
13
13
  tool: string;
14
14
  args: Record<string, unknown>;
15
15
  mode: InstructionType;
16
16
  explanation: string;
17
- } | {
18
- type: 'setLoading';
19
- value: boolean;
20
- };
17
+ }
21
18
  export interface ReduceResult {
22
19
  state: SseState;
23
20
  effects: SseEffect[];
@@ -37,10 +34,11 @@ export declare function reduceError(state: SseState, messageId: string, text: st
37
34
  /** The transport gave up, so no id-bearing event is coming for whatever is still pending. */
38
35
  export declare function reduceTransportFailure(state: SseState, text: string): SseState;
39
36
  /**
40
- * A per-request watchdog: the stream can stay healthy (no `StreamGaveUpError`) while a single
41
- * dispatch's reply never arrives — a dropped correlation or a silent backend failure before it ever
42
- * acknowledges the request. `reduceTransportFailure` cannot see that, since nothing told the transport
43
- * it failed, so without this the bubble sits on "thinking" and the composer stays disabled forever.
37
+ * The stream can stay healthy (no `StreamGaveUpError`) while a single dispatch's reply never arrives —
38
+ * a dropped correlation, a silent backend failure before it ever acknowledges the request, or a reload
39
+ * into the gap where the api has no tab to push to. `reduceTransportFailure` cannot see that, since
40
+ * nothing told the transport it failed, so without this the bubble sits on "thinking" and the composer
41
+ * stays disabled forever.
44
42
  *
45
43
  * Only fires on a message that received ZERO signs of life — still `thinking` with no progress line
46
44
  * and no streamed text. A `do`/`show` task that is genuinely still running has already advanced past
@@ -1,6 +1,7 @@
1
1
  export type LayerTokens = {
2
+ screenEdgeGlow: number;
2
3
  panel: number;
3
- overlay: number;
4
+ dialog: number;
4
5
  toast: number;
5
6
  };
6
7
  export declare const LAYER_TOKENS: LayerTokens;
@@ -18,11 +18,12 @@ export interface UseScreenShareOptions {
18
18
  }
19
19
  export interface UseScreenShareReturn {
20
20
  isScreenSharing: boolean;
21
+ isAwaitingScreenAccess: boolean;
21
22
  showScreenAccessDialog: boolean;
22
23
  handleScreenAccessDialogAllow: () => Promise<void>;
23
- handleScreenAccessDialogDeny: () => void;
24
- handleScreenAccessAllow: () => Promise<void>;
25
- handleScreenAccessDeny: () => void;
24
+ handleScreenAccessDialogDismiss: () => void;
25
+ handleScreenAccessRequestAllow: () => Promise<void>;
26
+ handleScreenAccessRequestDeny: () => void;
26
27
  requestScreenAccess: (mode: InstructionType) => void;
27
28
  }
28
29
  export declare function useScreenShare({ onScreenSharingChange, onStartScreenShareRef, onStopScreenShareRef, onAddMessage, onUpdateMessage, onRemoveMessage, onSendMessage, pendingMessage, setPendingMessage, }: UseScreenShareOptions): UseScreenShareReturn;
@@ -19,7 +19,6 @@ export declare const useWidget: () => {
19
19
  toggleWidget: () => void;
20
20
  closeWidget: () => void;
21
21
  setMode: (mode: import("..").InstructionType) => void;
22
- setLoading: (loading: boolean) => void;
23
22
  setError: (error: string | undefined) => void;
24
23
  applyState: (payload: Partial<import("../context/UIStateContext").UIState>) => void;
25
24
  };
@@ -20,7 +20,7 @@ export interface ToolExecutionResult<T = TextData> {
20
20
  success: boolean;
21
21
  data: T;
22
22
  error?: string;
23
- afterResponseSent?: () => void;
23
+ afterResponseAttempt?: () => void;
24
24
  }
25
25
  export declare class BrowserToolService {
26
26
  executeTool(browserToolName: string, args: Record<string, unknown>, mode?: string, explanation?: string): Promise<ToolExecutionResult<unknown>>;
@@ -41,7 +41,6 @@ export declare class BrowserToolService {
41
41
  /** Native value setter so React/Vue controlled inputs pick up the change. */
42
42
  private setNativeValue;
43
43
  private setValueAndCaret;
44
- private uploadFile;
45
44
  private closeTab;
46
45
  private done;
47
46
  private getHtml;
@@ -1,7 +1,6 @@
1
1
  import type { ChatMessage, InstructionType } from '../types';
2
2
  import { type ChatSnapshot } from './StorageService';
3
3
  export declare class ChatService {
4
- private restored;
5
4
  restore(): ChatSnapshot;
6
5
  persist(snapshot: ChatSnapshot): void;
7
6
  }
@@ -5,11 +5,11 @@ export interface ValidatedElementResult {
5
5
  export declare class DomService {
6
6
  private index;
7
7
  private elementToSequence;
8
- private generateSelector;
8
+ private generateAnchoredSelector;
9
9
  private staleReason;
10
10
  private indexInteractableElements;
11
11
  /** `data-id` is the whole contract: the agent parses the snapshot for `[data-id]` and reads nothing else off it. */
12
- getSnapshotHtml(): string;
12
+ reindexAndSnapshot(): string;
13
13
  getSequenceForElement(element: Element): number | undefined;
14
14
  private clearIndex;
15
15
  checkElementInteractable(element: HTMLElement, index: number): string | null;
@@ -2,8 +2,6 @@ import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
2
2
  export type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
3
3
  timestamp: string;
4
4
  };
5
- /** The durable half of the widget's React state. `isLoading` is deliberately absent — restoring it would
6
- * leave the FAB glowing for a request that died with the previous page. */
7
5
  export interface ChatSnapshot {
8
6
  messages: ChatMessage[];
9
7
  isTaskRunning: boolean;
@@ -29,7 +27,7 @@ declare class StorageService {
29
27
  getChatId(): string | null;
30
28
  setChatId(chatId: string): void;
31
29
  getCredentialedConfig(): CredentialedConfig | null;
32
- setConfig(config: MarketrixConfig): void;
30
+ setConfig(config: CredentialedConfig): void;
33
31
  }
34
32
  export declare const storageService: StorageService;
35
33
  export {};
@@ -1,6 +1,7 @@
1
1
  import { type WidgetSettingsData } from '../sdk';
2
2
  import type { MarketrixConfig } from '../types';
3
+ import type { CredentialedConfig } from './StorageService';
3
4
  export declare function createConfigFromSettings(widgetSettings: WidgetSettingsData, baseConfig?: Partial<MarketrixConfig>): MarketrixConfig;
4
5
  /** Per-tenant scope for browser-local keys: the credential id, else the application id. */
5
6
  export declare function tenantScope(config: MarketrixConfig): string;
6
- export declare function loadWidgetConfig(config: MarketrixConfig): Promise<MarketrixConfig>;
7
+ export declare function loadWidgetConfig(config: MarketrixConfig): Promise<CredentialedConfig>;
@@ -39,7 +39,7 @@ export interface MessagePart {
39
39
  export type WidgetView = 'home' | 'chat';
40
40
  export interface WidgetState {
41
41
  isOpen: boolean;
42
- isLoading: boolean;
42
+ isAwaitingReply: boolean;
43
43
  messages: ChatMessage[];
44
44
  currentMode: InstructionType;
45
45
  error?: string;
@@ -68,7 +68,4 @@ export type AddWidgetConfig = ({
68
68
  export interface MarketrixWidgetProps {
69
69
  settings: WidgetSettingsData;
70
70
  container?: HTMLElement;
71
- mtxId?: string;
72
- mtxKey?: string;
73
- mtxApiHost?: string;
74
71
  }
@@ -12,9 +12,8 @@ export declare function findMessageForProgress({ messages, isTaskRunning, curren
12
12
  message: ChatMessage;
13
13
  } | null;
14
14
  export declare const WAIT_FOR_USER_TOOLS: Set<string>;
15
- export declare function filterCancellationText(content: string): string;
16
15
  export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
17
- export declare const markProgressLineComplete: (message: ChatMessage) => ChatMessage;
16
+ export declare const markProgressLineComplete: (message: ChatMessage, browserToolName: string) => ChatMessage;
18
17
  export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
19
18
  /** Tool id -> the phrase shown in the activity log. Also the allowlist of tools the agent may call. */
20
19
  export declare const BROWSER_TOOLS: Map<string, string>;
@@ -1 +1,2 @@
1
+ export declare const WIDGET_SHADOW_HOST_CLASS = "marketrix-widget-container";
1
2
  export declare function isInteractable(el: Element | null): boolean;