@marketrix.ai/widget 3.8.488 → 3.8.490

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,5 +1,6 @@
1
- import type { MarketrixConfig, WidgetSettingsData, WidgetState } from '../types';
2
- export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetSettingsData>>;
1
+ import type { MarketrixConfig, WidgetState } from '../types';
2
+ import type { WidgetRenderedSettings } from '../utils/validation';
3
+ export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetRenderedSettings>>;
3
4
  /** Every setting resolved: API settings plus the position and script-tag overrides WidgetRoot layers on top. */
4
5
  export declare const WidgetConfigContext: import("react").Context<ValidWidgetConfig | null>;
5
6
  export declare const useWidgetConfig: () => ValidWidgetConfig;
@@ -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
+ export declare function activeScreenStream(): MediaStream | null;
1
2
  export declare function startScreenShare(): Promise<MediaStream>;
2
3
  export declare function stopScreenShare(): void;
3
4
  export declare function isScreenSharing(): boolean;
@@ -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;
@@ -1,7 +1,6 @@
1
1
  import { type WidgetSettingsData } from '../sdk';
2
2
  import type { MarketrixConfig } from '../types';
3
+ import { type WidgetRenderedSettings } from '../utils/validation';
3
4
  import type { CredentialedConfig } from './StorageService';
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;
5
+ export declare function createConfigFromSettings(widgetSettings: WidgetSettingsData | WidgetRenderedSettings, baseConfig?: Partial<MarketrixConfig>): MarketrixConfig;
7
6
  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,7 +10,7 @@ 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;
@@ -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 {};