@marketrix.ai/widget 3.8.489 → 3.8.491

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.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import type { MarketrixConfig } from '../types';
2
+ import type { ValidWidgetConfig } from '../types';
3
3
  interface WidgetRootProps {
4
- config: MarketrixConfig;
4
+ config: ValidWidgetConfig;
5
5
  }
6
6
  export declare const WidgetRoot: React.FC<WidgetRootProps>;
7
7
  export {};
@@ -5,13 +5,14 @@ export interface UIState {
5
5
  activeView: WidgetView;
6
6
  currentMode: InstructionType;
7
7
  error?: string;
8
+ errorRetryable?: boolean;
8
9
  }
9
10
  export interface UIStateActions {
10
11
  setActiveView: (view: WidgetView) => void;
11
12
  toggleWidget: () => void;
12
13
  closeWidget: () => void;
13
14
  setMode: (mode: InstructionType) => void;
14
- setError: (error: string | undefined) => void;
15
+ setError: (error: string | undefined, retryable?: boolean) => void;
15
16
  applyState: (payload: Partial<UIState>) => void;
16
17
  }
17
18
  interface UIStateContextType {
@@ -1,5 +1,4 @@
1
- import type { MarketrixConfig, WidgetSettingsData, WidgetState } from '../types';
2
- export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetSettingsData>>;
1
+ import type { ValidWidgetConfig, WidgetState } from '../types';
3
2
  /** Every setting resolved: API settings plus the position and script-tag overrides WidgetRoot layers on top. */
4
3
  export declare const WidgetConfigContext: import("react").Context<ValidWidgetConfig | null>;
5
4
  export declare const useWidgetConfig: () => ValidWidgetConfig;
@@ -19,7 +18,7 @@ export declare const useWidget: () => {
19
18
  toggleWidget: () => void;
20
19
  closeWidget: () => void;
21
20
  setMode: (mode: import("..").InstructionType) => void;
22
- setError: (error: string | undefined) => void;
21
+ setError: (error: string | undefined, retryable?: boolean) => void;
23
22
  applyState: (payload: Partial<import("../context/UIStateContext").UIState>) => void;
24
23
  };
25
24
  };
@@ -6,7 +6,7 @@ declare global {
6
6
  }
7
7
  }
8
8
  import React from 'react';
9
- import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetProps } from './types';
9
+ import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetProps, ValidWidgetConfig } from './types';
10
10
  import { getCurrentConfig } from './utils/bootstrap';
11
11
  export declare const initWidget: (config: MarketrixConfig, container?: HTMLElement) => Promise<void>;
12
12
  export declare const unmountWidget: () => void;
@@ -28,6 +28,6 @@ declare const _default: {
28
28
  mtxId?: string;
29
29
  mtxKey?: string;
30
30
  }) => Promise<void>;
31
- getCurrentConfig: () => MarketrixConfig | null;
31
+ getCurrentConfig: () => ValidWidgetConfig | null;
32
32
  };
33
33
  export default _default;
@@ -5,6 +5,7 @@ export declare const WorkspacePackageSchema: z.ZodEnum<{
5
5
  growth: "growth";
6
6
  enterprise: "enterprise";
7
7
  }>;
8
+ export type PlanTier = z.infer<typeof WorkspacePackageSchema>;
8
9
  export declare const ApplicationTypeSchema: z.ZodEnum<{
9
10
  app: "app";
10
11
  website: "website";
@@ -1,3 +1,4 @@
1
+ import type { InstructionType } from '../types';
1
2
  export interface TextData {
2
3
  text: string;
3
4
  }
@@ -23,7 +24,7 @@ export interface ToolExecutionResult<T = TextData> {
23
24
  afterResponseAttempt?: () => void;
24
25
  }
25
26
  export declare class BrowserToolService {
26
- executeTool(browserToolName: string, args: Record<string, unknown>, mode?: string, explanation?: string): Promise<ToolExecutionResult<unknown>>;
27
+ executeTool(browserToolName: string, args: Record<string, unknown>, mode: InstructionType, explanation?: string): Promise<ToolExecutionResult<unknown>>;
27
28
  private navigate;
28
29
  private search;
29
30
  private clickElement;
@@ -1,12 +1,4 @@
1
- import type { ChatMessage, InstructionType } from '../types';
2
- import { type ChatSnapshot } from './StorageService';
3
- export declare class ChatService {
4
- restore(): ChatSnapshot;
5
- persist(snapshot: ChatSnapshot): void;
6
- }
7
- export declare const chatService: ChatService;
8
- export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
9
- export declare const createAgentMessage: (content: string) => ChatMessage;
10
- export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
11
- export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
12
- export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
1
+ import { type InstructionType } from '../sdk';
2
+ import { type CredentialedConfig } from './StorageService';
3
+ /** The reply does not come back from here — it arrives asynchronously as a chat/response event on the stream. */
4
+ export declare function chatPost(config: CredentialedConfig, message: string, mode: InstructionType, requestId: string): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
1
+ import type { ChatMessage, InstructionType, MarketrixConfig, ValidWidgetConfig } from '../types';
2
2
  export type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
3
3
  timestamp: string;
4
4
  };
@@ -7,7 +7,7 @@ export interface ChatSnapshot {
7
7
  currentMode: InstructionType;
8
8
  isOpen: boolean;
9
9
  }
10
- export type CredentialedConfig = MarketrixConfig & {
10
+ export type CredentialedConfig = ValidWidgetConfig & {
11
11
  mtxId: string;
12
12
  mtxKey: string;
13
13
  };
@@ -32,4 +32,6 @@ declare class StorageService {
32
32
  setConfig(config: CredentialedConfig): void;
33
33
  }
34
34
  export declare const storageService: StorageService;
35
+ export declare function readChatSnapshot(): ChatSnapshot;
36
+ export declare function writeChatSnapshot(snapshot: ChatSnapshot): void;
35
37
  export {};
@@ -1,5 +1,5 @@
1
- import { type WidgetSettingsData } from '../sdk';
2
- import type { MarketrixConfig } from '../types';
1
+ import type { MarketrixConfig, ValidWidgetConfig } from '../types';
2
+ import { type WidgetRenderedSettings } from '../utils/validation';
3
3
  import type { CredentialedConfig } from './StorageService';
4
- export declare function createConfigFromSettings(widgetSettings: WidgetSettingsData, baseConfig?: Partial<MarketrixConfig>): MarketrixConfig;
4
+ export declare function createConfigFromSettings(widgetSettings: WidgetRenderedSettings, baseConfig?: Partial<MarketrixConfig>): ValidWidgetConfig;
5
5
  export declare function loadWidgetConfig(config: MarketrixConfig): Promise<CredentialedConfig>;
@@ -1,2 +1,4 @@
1
- import type { MarketrixConfig } from '../types';
2
- export declare function getMockWidgetConfig(overrides?: Partial<MarketrixConfig>): MarketrixConfig;
1
+ import type { MarketrixConfig, WidgetSettingsData } from '../types';
2
+ type MockWidgetConfig = MarketrixConfig & Pick<WidgetSettingsData, 'widget_border_radius' | 'widget_font_size' | 'widget_animation_duration' | 'widget_fade_duration'>;
3
+ export declare function getMockWidgetConfig(overrides?: Partial<MockWidgetConfig>): MockWidgetConfig;
4
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { InstructionType, WidgetSettingsData } from '../sdk';
2
+ import type { WidgetRenderedSettings } from '../utils/validation';
2
3
  export type { InstructionType, WidgetSettingsData } from '../sdk';
3
4
  export interface ClientOwnedConfig {
4
5
  mtxApiHost?: string;
@@ -9,12 +10,14 @@ export interface ClientOwnedConfig {
9
10
  /** When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
10
11
  use_screenshare?: boolean;
11
12
  }
12
- export type MarketrixConfig = Partial<WidgetSettingsData> & ClientOwnedConfig & {
13
+ export type MarketrixConfig = Partial<WidgetRenderedSettings> & ClientOwnedConfig & {
13
14
  mtxId?: string;
14
15
  mtxKey?: string;
15
16
  mtxApp?: number;
16
17
  isPreviewMode?: boolean;
17
18
  };
19
+ /** A MarketrixConfig that has been through parseWidgetSettings — every rendered setting present. */
20
+ export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetRenderedSettings>>;
18
21
  export interface ChatMessage {
19
22
  id: string;
20
23
  content: string;
@@ -50,6 +53,7 @@ export interface WidgetState {
50
53
  messages: ChatMessage[];
51
54
  currentMode: InstructionType;
52
55
  error?: string;
56
+ errorRetryable?: boolean;
53
57
  isTaskRunning: boolean;
54
58
  activeView: WidgetView;
55
59
  }
@@ -1,9 +1,9 @@
1
1
  import { type Root } from 'react-dom/client';
2
2
  import type { NotificationTone } from '../design-system/component-tokens';
3
- import type { MarketrixConfig } from '../types';
3
+ import type { MarketrixConfig, ValidWidgetConfig } from '../types';
4
4
  export interface WidgetMount {
5
5
  instance: Root;
6
- config: MarketrixConfig;
6
+ config: ValidWidgetConfig;
7
7
  container: HTMLElement;
8
8
  host: HTMLElement | undefined;
9
9
  previewMode: boolean;
@@ -16,9 +16,9 @@ export declare const createWidgetContainer: (parentContainer?: HTMLElement) => {
16
16
  shadowRoot: ShadowRoot;
17
17
  mountEl: HTMLElement;
18
18
  };
19
- export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: MarketrixConfig, previewMode?: boolean) => Root;
19
+ export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: ValidWidgetConfig, previewMode?: boolean) => Root;
20
20
  export declare const isWidgetInitialized: () => boolean;
21
- export declare const getCurrentConfig: () => MarketrixConfig | null;
21
+ export declare const getCurrentConfig: () => ValidWidgetConfig | null;
22
22
  export declare const showHostPageNotice: (message: string, tone?: NotificationTone) => void;
23
23
  export declare const hideHostPageNotice: () => void;
24
24
  export declare const autoInitializeWidget: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
@@ -18,3 +18,8 @@ export declare const markProgressLineComplete: (message: ChatMessage, browserToo
18
18
  export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
19
19
  export declare const TOOL_LABELS: Map<string, string>;
20
20
  export declare const getFriendlyToolName: (browserToolName: string) => string;
21
+ export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
22
+ export declare const createAgentMessage: (content: string) => ChatMessage;
23
+ export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
24
+ export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
25
+ export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
@@ -1,8 +1,11 @@
1
1
  import type { WidgetSettingsData } from '../sdk';
2
2
  export declare function isHTMLElement(element: Element | null): element is HTMLElement;
3
3
  export declare function isHTMLScriptElement(element: Element | null): element is HTMLScriptElement;
4
+ declare const RENDER_CONSTANT_NAMES: readonly ["widget_border_radius", "widget_font_size", "widget_animation_duration", "widget_fade_duration"];
5
+ /** The wire shape minus the fields the widget renders from its own constants — see WIDGET_RENDER_CONSTANTS. */
6
+ export type WidgetRenderedSettings = Omit<WidgetSettingsData, (typeof RENDER_CONSTANT_NAMES)[number]>;
4
7
  export type WidgetSettingsResult = {
5
- settings: WidgetSettingsData;
8
+ settings: WidgetRenderedSettings;
6
9
  invalidFields?: undefined;
7
10
  } | {
8
11
  settings?: undefined;
@@ -11,7 +14,9 @@ export type WidgetSettingsResult = {
11
14
  /**
12
15
  * Validates and PICKS, because stripping is load-bearing: `widgetDefaultGet` returns the render
13
16
  * constants too, and the settings object is spread into the widget config — passing unknown keys
14
- * through would leak them where zod used to drop them.
17
+ * through would leak them where zod used to drop them. The render constants are guarded (a legacy
18
+ * bundle's stored value must still pass) but dropped from the picked result, since nothing renders them.
15
19
  */
16
20
  export declare function parseWidgetSettings(value: unknown): WidgetSettingsResult;
17
21
  export declare const invalidSettingsMessage: (invalidFields: string[]) => string;
22
+ export {};