@marketrix.ai/widget 3.8.408 → 3.8.425

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 CHANGED
@@ -71,13 +71,14 @@ All modes also accept the common options below.
71
71
 
72
72
  These apply to every mode (script attribute → config key):
73
73
 
74
- | Config key | Script attribute | Type | Description |
75
- | ----------------- | --------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
76
- | `mtxApiHost` | `mtx-api-host` | string | API server URL, e.g. `https://api.marketrix.ai`. The widget has no baked-in API host — you must supply it. |
77
- | `container` | — | `HTMLElement` | Element to mount inside (programmatic only). Defaults to a container appended to `<body>`. |
78
- | `userId` | — | number | Associates widget activity with one of your users. |
79
- | `show_widget` | — | boolean | When `false`, the widget initializes fully but its UI stays hidden. Default `true`. |
80
- | `use_screenshare` | `mtx-use-screenshare` | boolean | When `false`, screen-share requests are auto-denied and the Share Screen button is hidden. Default `true`. Disable via `mtx-use-screenshare="false"`. |
74
+ | Config key | Script attribute | Type | Description |
75
+ | ------------------------- | --------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | `mtxApiHost` | `mtx-api-host` | string | API server URL, e.g. `https://api.marketrix.ai`. The widget has no baked-in API host — you must supply it. |
77
+ | `container` | — | `HTMLElement` | Element to mount inside (programmatic only). Defaults to a container appended to `<body>`. |
78
+ | `userId` | — | number | Associates widget activity with one of your users. |
79
+ | `widget_position_z_index` | — | number | `z-index` floor for the launcher and panel. Raised to the widget's own layer token if you pass a lower value. |
80
+ | `show_widget` | | boolean | When `false`, the widget initializes fully but its UI stays hidden. Default `true`. |
81
+ | `use_screenshare` | `mtx-use-screenshare` | boolean | When `false`, screen-share requests are auto-denied and the Share Screen button is hidden. Default `true`. Disable via `mtx-use-screenshare="false"`. |
81
82
 
82
83
  Widget **appearance and behavior** (position, colors, sizing, border radius, animation, enabled Tell/Show/Do/Human features, device visibility, visibility, greeting toast, optional session recording, header/body/greeting text, and quick-action chips) are configured in the Marketrix dashboard and fetched from the API at init. A hidden widget stays visible in the dashboard preview.
83
84
 
package/dist/loader.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // Injects a React importmap (merging with any existing one), loads widget.mjs from the same origin,
2
2
  // and passes through every mtx-* attribute. MUST sit in <head> before any <script type="module">.
3
3
  (function () {
4
- // Collect existing importmap entries (if any)
5
4
  var existing = {};
6
5
  var oldMap = document.querySelector('script[type="importmap"]');
7
6
  if (oldMap) {
@@ -11,7 +10,7 @@
11
10
  oldMap.remove();
12
11
  }
13
12
 
14
- // React dependencies — host mappings win, our defaults fill gaps
13
+ // Host mappings win `existing` is spread last so a host already on React 19 keeps its own build.
15
14
  var defaults = {
16
15
  react: 'https://esm.sh/react@19',
17
16
  'react-dom': 'https://esm.sh/react-dom@19',
@@ -26,16 +25,13 @@
26
25
  map.textContent = JSON.stringify({ imports: merged });
27
26
  document.head.appendChild(map);
28
27
 
29
- // Derive base URL from our own script src
30
28
  var self = document.currentScript;
31
29
  var base = new URL('.', self.src).href;
32
30
 
33
- // Create module script for the widget
34
31
  var widget = document.createElement('script');
35
32
  widget.type = 'module';
36
33
  widget.src = base + 'widget.mjs';
37
34
 
38
- // Pass through all mtx-* attributes
39
35
  Array.from(self.attributes).forEach(function (attr) {
40
36
  if (attr.name.startsWith('mtx-')) widget.setAttribute(attr.name, attr.value);
41
37
  });
@@ -16,7 +16,6 @@ export interface ChatViewProps {
16
16
  onScreenSharingChange?: (isSharing: boolean) => void;
17
17
  onStartScreenShareRef?: React.MutableRefObject<(() => void) | null>;
18
18
  onStopScreenShareRef?: React.MutableRefObject<(() => void) | null>;
19
- /** Optional ref for focus trap to focus the message input */
20
19
  messageInputRef?: React.RefObject<HTMLTextAreaElement | null>;
21
20
  }
22
21
  export declare const ChatView: React.FC<ChatViewProps>;
@@ -36,14 +36,14 @@ export declare const PaginationSchema: z.ZodObject<{
36
36
  * and `?enabled=false` would match enabled rows. `.optional()` is outermost so the object key stays omittable.
37
37
  */
38
38
  export declare const booleanQueryParam: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>, z.ZodTransform<boolean | undefined, string | boolean>>>;
39
- /** Paginated list for unbounded queries — includes total/limit/offset for pagination */
39
+ /** Paginated list for unbounded queries */
40
40
  export declare const paginatedListOf: <T extends z.ZodTypeAny>(schema: T) => z.ZodObject<{
41
41
  items: z.ZodArray<T>;
42
42
  total: z.ZodNumber;
43
43
  limit: z.ZodNumber;
44
44
  offset: z.ZodNumber;
45
45
  }, z.core.$strip>;
46
- /** Simple list for bounded results (scoped to parent entity) — includes count */
46
+ /** Simple list for bounded results (scoped to parent entity) */
47
47
  export declare const listOf: <T extends z.ZodTypeAny>(schema: T) => z.ZodObject<{
48
48
  items: z.ZodArray<T>;
49
49
  count: z.ZodNumber;
@@ -70,18 +70,12 @@ export declare const ToolCallRecordSchema: z.ZodObject<{
70
70
  * malformed input.
71
71
  */
72
72
  export declare const SlackWebhookUrlSchema: z.ZodString;
73
- /**
74
- * Graph edge schema - transition from one node to another via an action
75
- */
76
73
  export declare const GraphEdgeSchema: z.ZodObject<{
77
74
  start: z.ZodString;
78
75
  end: z.ZodString;
79
76
  action: z.ZodString;
80
77
  }, z.core.$loose>;
81
78
  export type GraphEdgeData = z.infer<typeof GraphEdgeSchema>;
82
- /**
83
- * Graph section schema - functional UI section within a page node
84
- */
85
79
  export declare const GraphSectionSchema: z.ZodObject<{
86
80
  id: z.ZodString;
87
81
  label: z.ZodString;
@@ -328,10 +328,7 @@ export declare const ApplicationEntitySchema: z.ZodObject<{
328
328
  allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
329
329
  }, z.core.$strip>;
330
330
  export type ApplicationData = z.infer<typeof ApplicationEntitySchema>;
331
- /**
332
- * Application read schema — entity minus password. Used for all API
333
- * responses; password is write-only and never returned to clients.
334
- */
331
+ /** Used for all API responses; password is write-only and never returned to clients. */
335
332
  export declare const ApplicationReadSchema: z.ZodObject<{
336
333
  id: z.ZodOptional<z.ZodNumber>;
337
334
  created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
@@ -476,10 +473,7 @@ export declare const WidgetEntitySchema: z.ZodObject<{
476
473
  snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
477
474
  }, z.core.$strip>;
478
475
  export type WidgetData = z.infer<typeof WidgetEntitySchema>;
479
- /**
480
- * State Trigger entity schema - stores URL patterns and messages to show in widget
481
- * `message` is one or more chip texts shown by the widget when the URL pattern matches.
482
- */
476
+ /** `message` is one or more chip texts shown by the widget when the URL pattern matches. */
483
477
  export declare const StateTriggerEntitySchema: z.ZodObject<{
484
478
  id: z.ZodOptional<z.ZodNumber>;
485
479
  created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
@@ -1,7 +1,4 @@
1
- /**
2
- * Re-initialize the SDK client with a new base URL
3
- * Must be called before any SDK operations
4
- */
1
+ /** Must be called before any SDK operation — the widget has no baked-in API host. */
5
2
  export declare const configureSdk: (apiUrl: string) => void;
6
3
  export declare const sdk: {
7
4
  activityLogCreate: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
@@ -33,11 +33,8 @@ export declare class DomService {
33
33
  static getInstance(): DomService;
34
34
  private generateSelector;
35
35
  private generateFingerprint;
36
- /** Strict match against a stored fingerprint — fails if any key attribute differs. */
37
36
  private matchesFingerprint;
38
- /** Check the element at an index still matches its fingerprint; no recovery. */
39
37
  private validateElementAtIndex;
40
- /** Index all interactable elements in the live DOM, clearing any previous index first. */
41
38
  indexInteractableElements(): Array<[number, Element]>;
42
39
  private getElementCoordinates;
43
40
  private isStackingContext;
@@ -58,13 +55,11 @@ export declare class DomService {
58
55
  }>;
59
56
  getSequenceForElement(element: Element): number | undefined;
60
57
  clearIndex(): void;
61
- /** Returns an error string if the element isn't interactable (hidden/obscured/off-screen), null if OK. */
62
58
  private checkInteractability;
63
59
  /** Public interactability check for ShowModeService. */
64
60
  checkElementInteractable(element: HTMLElement, index: number): string | null;
65
- /** Look up an element by index; returns it only if interactable, else null + error. */
66
61
  getElementByIndex(index: number): ElementLookupResult;
67
- /** Main entry point for BrowserToolService: validate against fingerprint, then return if interactable. */
62
+ /** Main entry point for BrowserToolService prefer this over the looser getElementByIndex. */
68
63
  getValidatedElement(index: number): ValidatedElementResult;
69
64
  }
70
65
  export declare const domService: DomService;
@@ -1,4 +1,4 @@
1
- /** Unified widget localStorage (key `marketrix_chat_context`). Canonical StorageService — `app/src/services/StorageService.ts` must stay byte-identical (modulo its `'../types'` import); change semantics here first, then copy to the app mirror. */
1
+ /** Unified widget localStorage (key `marketrix_chat_context`). */
2
2
  import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
3
3
  /** Serializable ChatMessage: timestamp as string, no videoStream. */
4
4
  type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
@@ -16,7 +16,6 @@ export interface MarketrixChatContext {
16
16
  config: MarketrixConfig | null;
17
17
  timestamp: number;
18
18
  }
19
- /** Singleton wrapper around `localStorage` for the unified widget chat context. Canonical — see file header. */
20
19
  declare class StorageService {
21
20
  private static instance;
22
21
  private context;
@@ -6,10 +6,6 @@ export type MarketrixConfig = Partial<WidgetSettingsData> & {
6
6
  mtxApp?: number;
7
7
  userId?: number;
8
8
  mtxApiHost?: string;
9
- widget_position_offset?: {
10
- x?: number;
11
- y?: number;
12
- };
13
9
  widget_position_z_index?: number;
14
10
  isPreviewMode?: boolean;
15
11
  /** When false, widget initializes fully but UI is hidden. Default: true */
@@ -74,14 +70,10 @@ export type AddWidgetConfig = ({
74
70
  container?: HTMLElement;
75
71
  mtxApiHost?: string;
76
72
  userId?: number;
77
- widget_position_offset?: {
78
- x?: number;
79
- y?: number;
80
- };
81
73
  widget_position_z_index?: number;
82
- /** Controls visual rendering of the widget. When false, widget initializes fully but UI is hidden. Default: true */
74
+ /** When false, widget initializes fully but UI is hidden. Default: true */
83
75
  show_widget?: boolean;
84
- /** Controls screen sharing prompts and button. When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
76
+ /** When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
85
77
  use_screenshare?: boolean;
86
78
  };
87
79
  export interface MarketrixWidgetProps {
@@ -1,4 +1,3 @@
1
- /** Error-handling helpers for API calls. */
2
1
  import type { MarketrixConfig } from '../types';
3
2
  export declare function extractErrorMessage(error: unknown, fallback?: string): string;
4
3
  export declare function handleApiError(error: unknown, context?: string, config?: Partial<MarketrixConfig>): {
@@ -1,14 +1,12 @@
1
1
  import type React from 'react';
2
2
  import type { WidgetPosition } from '../types';
3
3
  export declare const getPositionClasses: (position: WidgetPosition) => string;
4
- /** Panel position inline styles — anchored to same corner as the launcher button. */
4
+ /** Anchored to the same corner as the launcher button. */
5
5
  export declare const getPanelPositionStyle: (position: WidgetPosition) => React.CSSProperties;
6
- /** Anchor top-left of widget (px) for a corner, given viewport and widget size. */
7
6
  export declare const getAnchorTopLeft: (position: WidgetPosition, vw: number, vh: number, w: number, h: number) => {
8
7
  x: number;
9
8
  y: number;
10
9
  };
11
- /** Nearest corner by translation distance (for velocity-based snap, Next.js style). */
12
10
  export declare const getNearestCornerByTranslation: (translation: {
13
11
  dx: number;
14
12
  dy: number;