@marketrix.ai/widget 3.8.489 → 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.
- package/dist/src/hooks/useWidget.d.ts +3 -2
- package/dist/src/sdk/contracts/entities.d.ts +1 -0
- package/dist/src/services/WidgetService.d.ts +2 -1
- package/dist/src/test/fixtures.d.ts +4 -2
- package/dist/src/types/index.d.ts +2 -1
- package/dist/src/utils/validation.d.ts +7 -2
- package/dist/widget.mjs +64 -64
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { MarketrixConfig,
|
|
2
|
-
|
|
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,5 +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
|
+
export declare function createConfigFromSettings(widgetSettings: WidgetSettingsData | WidgetRenderedSettings, baseConfig?: Partial<MarketrixConfig>): MarketrixConfig;
|
|
5
6
|
export declare function loadWidgetConfig(config: MarketrixConfig): Promise<CredentialedConfig>;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { MarketrixConfig } from '../types';
|
|
2
|
-
|
|
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<
|
|
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:
|
|
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 {};
|