@marketrix.ai/widget 3.8.301 → 3.8.329
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 +2 -13
- package/dist/src/context/ChatContext.d.ts +5 -5
- package/dist/src/context/sseReducer.d.ts +2 -2
- package/dist/src/design-system/semantic-tokens.d.ts +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/sdk/contract.d.ts +0 -17
- package/dist/src/sdk/contracts/application.d.ts +3 -0
- package/dist/src/sdk/contracts/widget.d.ts +0 -51
- package/dist/src/sdk/index.d.ts +0 -17
- package/dist/src/services/StorageService.d.ts +0 -1
- package/dist/widget.mjs +8 -8
- package/dist/widget.mjs.map +1 -1
- package/package.json +8 -11
- package/dist/src/services/RrwebSessionRecorder.d.ts +0 -31
package/README.md
CHANGED
|
@@ -131,9 +131,6 @@ import {
|
|
|
131
131
|
unmountWidget,
|
|
132
132
|
updateMarketrixConfig,
|
|
133
133
|
getCurrentConfig,
|
|
134
|
-
startRecording,
|
|
135
|
-
stopRecording,
|
|
136
|
-
getRecordingState,
|
|
137
134
|
MarketrixWidget,
|
|
138
135
|
} from '@marketrix.ai/widget';
|
|
139
136
|
```
|
|
@@ -155,7 +152,7 @@ await mountWidget({ settings: { widget_enabled: true, widget_position: 'bottom_r
|
|
|
155
152
|
|
|
156
153
|
### `initWidget(config, container?): Promise<void>`
|
|
157
154
|
|
|
158
|
-
Lower-level production/dev initializer. Validates credentials, fetches settings from the API, mounts into a closed Shadow DOM, opens the event stream
|
|
155
|
+
Lower-level production/dev initializer. Validates credentials, fetches settings from the API, mounts into a closed Shadow DOM, and opens the event stream. Optionally mounts inside a specific `container`. Concurrent and duplicate calls are deduplicated; only one production widget runs per page.
|
|
159
156
|
|
|
160
157
|
```ts
|
|
161
158
|
await initWidget({ mtxId, mtxKey, mtxApiHost }, document.getElementById('my-container')!);
|
|
@@ -163,7 +160,7 @@ await initWidget({ mtxId, mtxKey, mtxApiHost }, document.getElementById('my-cont
|
|
|
163
160
|
|
|
164
161
|
### `unmountWidget(): void`
|
|
165
162
|
|
|
166
|
-
Destroys the widget,
|
|
163
|
+
Destroys the widget, closes the stream connection, and cleans up all resources.
|
|
167
164
|
|
|
168
165
|
### `updateMarketrixConfig(partial): Promise<void>`
|
|
169
166
|
|
|
@@ -173,14 +170,6 @@ Merges `partial` into the current config and re-initializes (unmount + `initWidg
|
|
|
173
170
|
|
|
174
171
|
Returns the active configuration, or `null` if the widget isn't initialized.
|
|
175
172
|
|
|
176
|
-
### Session recording
|
|
177
|
-
|
|
178
|
-
Automatic session recording (via rrweb) is currently **disabled** — the widget no longer captures or transmits sessions on init. The control helpers remain exported for API compatibility but are inert while recording is disabled:
|
|
179
|
-
|
|
180
|
-
- `startRecording(): Promise<void>` — currently rejects (no recorder is created while recording is disabled).
|
|
181
|
-
- `stopRecording(): void` — no-op.
|
|
182
|
-
- `getRecordingState(): boolean` — always `false`.
|
|
183
|
-
|
|
184
173
|
### `MarketrixWidget` — React component (preview)
|
|
185
174
|
|
|
186
175
|
For previewing appearance inside a React app (e.g. a settings/configuration screen). Renders into its own Shadow DOM and makes no network calls.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
import type { UIStateActions } from './UIStateContext';
|
|
4
|
-
export interface
|
|
4
|
+
export interface TaskState {
|
|
5
5
|
activeTaskId: string | null;
|
|
6
6
|
isTaskRunning: boolean;
|
|
7
7
|
}
|
|
@@ -16,7 +16,7 @@ export interface ChatActions {
|
|
|
16
16
|
clearMessages: () => void;
|
|
17
17
|
messageDispatch: (content: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => Promise<void>;
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface TaskActions {
|
|
20
20
|
setTaskState: (payload: {
|
|
21
21
|
activeTaskId: string | null;
|
|
22
22
|
isTaskRunning: boolean;
|
|
@@ -26,8 +26,8 @@ export interface SimulationActions {
|
|
|
26
26
|
interface ChatContextType {
|
|
27
27
|
chatState: ChatState;
|
|
28
28
|
chatActions: ChatActions;
|
|
29
|
-
taskState:
|
|
30
|
-
taskActions:
|
|
29
|
+
taskState: TaskState;
|
|
30
|
+
taskActions: TaskActions;
|
|
31
31
|
}
|
|
32
32
|
interface ChatProviderProps {
|
|
33
33
|
children: React.ReactNode;
|
|
@@ -35,7 +35,7 @@ interface ChatProviderProps {
|
|
|
35
35
|
currentMode: InstructionType;
|
|
36
36
|
uiActions: Pick<UIStateActions, 'setLoading' | 'setAgentAvailable' | 'setError'>;
|
|
37
37
|
initialMessages?: ChatMessage[];
|
|
38
|
-
initialTask?:
|
|
38
|
+
initialTask?: TaskState;
|
|
39
39
|
}
|
|
40
40
|
export declare const ChatProvider: React.FC<ChatProviderProps>;
|
|
41
41
|
export declare const useChatContext: () => ChatContextType;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { WidgetEvent } from '../sdk';
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
|
-
export interface
|
|
3
|
+
export interface SseTaskState {
|
|
4
4
|
activeTaskId: string | null;
|
|
5
5
|
isTaskRunning: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface SseState {
|
|
8
8
|
messages: ChatMessage[];
|
|
9
|
-
task:
|
|
9
|
+
task: SseTaskState;
|
|
10
10
|
}
|
|
11
11
|
/** Side effects the wiring layer must run after applying a reduced state. */
|
|
12
12
|
export type SseEffect = {
|
|
@@ -33,5 +33,4 @@ export type SemanticTokens = {
|
|
|
33
33
|
export type WidgetStyleSettingsDefaults = Pick<WidgetSettingsData, 'widget_background_color' | 'widget_text_color' | 'widget_border_color' | 'widget_accent_color' | 'widget_secondary_color' | 'widget_border_radius' | 'widget_font_size' | 'widget_width' | 'widget_height' | 'widget_shadow' | 'widget_animation_duration' | 'widget_fade_duration'>;
|
|
34
34
|
export declare const WIDGET_STYLE_SETTINGS_DEFAULTS: WidgetStyleSettingsDefaults;
|
|
35
35
|
export declare function mapWidgetSettingsToSemanticTokens(settings: WidgetStyleSettingsDefaults): SemanticTokens;
|
|
36
|
-
export declare const DEFAULT_SEMANTIC_TOKENS: SemanticTokens;
|
|
37
36
|
export declare function semanticTokensToCssCustomProperties(tokens: SemanticTokens): Record<string, string>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -10,9 +10,6 @@ import type { AddWidgetConfig, MarketrixConfig, MarketrixWidgetProps } from './t
|
|
|
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;
|
|
13
|
-
export declare const stopRecording: () => void;
|
|
14
|
-
export declare const startRecording: () => Promise<void>;
|
|
15
|
-
export declare const getRecordingState: () => boolean;
|
|
16
13
|
export declare const updateMarketrixConfig: (newConfig: Partial<MarketrixConfig>) => Promise<void>;
|
|
17
14
|
export { getCurrentConfig };
|
|
18
15
|
export declare const MarketrixWidget: React.FC<MarketrixWidgetProps>;
|
|
@@ -26,8 +23,5 @@ declare const _default: {
|
|
|
26
23
|
unmountWidget: () => void;
|
|
27
24
|
updateMarketrixConfig: (newConfig: Partial<MarketrixConfig>) => Promise<void>;
|
|
28
25
|
getCurrentConfig: () => MarketrixConfig | null;
|
|
29
|
-
startRecording: () => Promise<void>;
|
|
30
|
-
stopRecording: () => void;
|
|
31
|
-
getRecordingState: () => boolean;
|
|
32
26
|
};
|
|
33
27
|
export default _default;
|
|
@@ -341,23 +341,6 @@ export declare const widgetContract: {
|
|
|
341
341
|
success: import("zod").ZodBoolean;
|
|
342
342
|
data: import("zod").ZodOptional<import("zod").ZodString>;
|
|
343
343
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
344
|
-
state_version: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
345
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
346
|
-
type: import("zod").ZodLiteral<"rrweb/metadata">;
|
|
347
|
-
rrweb_session_id: import("zod").ZodString;
|
|
348
|
-
chat_id: import("zod").ZodString;
|
|
349
|
-
application_id: import("zod").ZodNumber;
|
|
350
|
-
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
351
|
-
user_agent: import("zod").ZodOptional<import("zod").ZodString>;
|
|
352
|
-
timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
353
|
-
viewport: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
354
|
-
width: import("zod").ZodNumber;
|
|
355
|
-
height: import("zod").ZodNumber;
|
|
356
|
-
}, import("zod/v4/core").$strip>>;
|
|
357
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
358
|
-
type: import("zod").ZodLiteral<"rrweb/events">;
|
|
359
|
-
rrweb_session_id: import("zod").ZodString;
|
|
360
|
-
events: import("zod").ZodArray<import("zod").ZodUnknown>;
|
|
361
344
|
}, import("zod/v4/core").$strip>], "type">;
|
|
362
345
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
363
346
|
ok: import("zod").ZodBoolean;
|
|
@@ -20,6 +20,7 @@ export declare const ApplicationUpdateSchema: z.ZodObject<{
|
|
|
20
20
|
id: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
21
21
|
created_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
22
22
|
updated_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
23
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
23
24
|
type: z.ZodOptional<z.ZodEnum<{
|
|
24
25
|
app: "app";
|
|
25
26
|
website: "website";
|
|
@@ -269,6 +270,7 @@ export declare const applicationUpdate: import("@orpc/contract").ContractProcedu
|
|
|
269
270
|
id: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
270
271
|
created_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
271
272
|
updated_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
273
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
272
274
|
type: z.ZodOptional<z.ZodEnum<{
|
|
273
275
|
app: "app";
|
|
274
276
|
website: "website";
|
|
@@ -538,6 +540,7 @@ export declare const applicationRoutes: {
|
|
|
538
540
|
id: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
539
541
|
created_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
540
542
|
updated_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
543
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
541
544
|
type: z.ZodOptional<z.ZodEnum<{
|
|
542
545
|
app: "app";
|
|
543
546
|
website: "website";
|
|
@@ -279,23 +279,6 @@ export declare const WidgetCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
279
279
|
success: z.ZodBoolean;
|
|
280
280
|
data: z.ZodOptional<z.ZodString>;
|
|
281
281
|
error: z.ZodOptional<z.ZodString>;
|
|
282
|
-
state_version: z.ZodOptional<z.ZodNumber>;
|
|
283
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
-
type: z.ZodLiteral<"rrweb/metadata">;
|
|
285
|
-
rrweb_session_id: z.ZodString;
|
|
286
|
-
chat_id: z.ZodString;
|
|
287
|
-
application_id: z.ZodNumber;
|
|
288
|
-
url: z.ZodOptional<z.ZodString>;
|
|
289
|
-
user_agent: z.ZodOptional<z.ZodString>;
|
|
290
|
-
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
291
|
-
viewport: z.ZodOptional<z.ZodObject<{
|
|
292
|
-
width: z.ZodNumber;
|
|
293
|
-
height: z.ZodNumber;
|
|
294
|
-
}, z.core.$strip>>;
|
|
295
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
-
type: z.ZodLiteral<"rrweb/events">;
|
|
297
|
-
rrweb_session_id: z.ZodString;
|
|
298
|
-
events: z.ZodArray<z.ZodUnknown>;
|
|
299
282
|
}, z.core.$strip>], "type">;
|
|
300
283
|
export type WidgetCommand = z.infer<typeof WidgetCommandSchema>;
|
|
301
284
|
export declare const widgetCreate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -785,23 +768,6 @@ export declare const widgetMessage: import("@orpc/contract").ContractProcedureBu
|
|
|
785
768
|
success: z.ZodBoolean;
|
|
786
769
|
data: z.ZodOptional<z.ZodString>;
|
|
787
770
|
error: z.ZodOptional<z.ZodString>;
|
|
788
|
-
state_version: z.ZodOptional<z.ZodNumber>;
|
|
789
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
790
|
-
type: z.ZodLiteral<"rrweb/metadata">;
|
|
791
|
-
rrweb_session_id: z.ZodString;
|
|
792
|
-
chat_id: z.ZodString;
|
|
793
|
-
application_id: z.ZodNumber;
|
|
794
|
-
url: z.ZodOptional<z.ZodString>;
|
|
795
|
-
user_agent: z.ZodOptional<z.ZodString>;
|
|
796
|
-
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
797
|
-
viewport: z.ZodOptional<z.ZodObject<{
|
|
798
|
-
width: z.ZodNumber;
|
|
799
|
-
height: z.ZodNumber;
|
|
800
|
-
}, z.core.$strip>>;
|
|
801
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
802
|
-
type: z.ZodLiteral<"rrweb/events">;
|
|
803
|
-
rrweb_session_id: z.ZodString;
|
|
804
|
-
events: z.ZodArray<z.ZodUnknown>;
|
|
805
771
|
}, z.core.$strip>], "type">;
|
|
806
772
|
}, z.core.$strip>, z.ZodObject<{
|
|
807
773
|
ok: z.ZodBoolean;
|
|
@@ -1294,23 +1260,6 @@ export declare const widgetRoutes: {
|
|
|
1294
1260
|
success: z.ZodBoolean;
|
|
1295
1261
|
data: z.ZodOptional<z.ZodString>;
|
|
1296
1262
|
error: z.ZodOptional<z.ZodString>;
|
|
1297
|
-
state_version: z.ZodOptional<z.ZodNumber>;
|
|
1298
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1299
|
-
type: z.ZodLiteral<"rrweb/metadata">;
|
|
1300
|
-
rrweb_session_id: z.ZodString;
|
|
1301
|
-
chat_id: z.ZodString;
|
|
1302
|
-
application_id: z.ZodNumber;
|
|
1303
|
-
url: z.ZodOptional<z.ZodString>;
|
|
1304
|
-
user_agent: z.ZodOptional<z.ZodString>;
|
|
1305
|
-
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
1306
|
-
viewport: z.ZodOptional<z.ZodObject<{
|
|
1307
|
-
width: z.ZodNumber;
|
|
1308
|
-
height: z.ZodNumber;
|
|
1309
|
-
}, z.core.$strip>>;
|
|
1310
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1311
|
-
type: z.ZodLiteral<"rrweb/events">;
|
|
1312
|
-
rrweb_session_id: z.ZodString;
|
|
1313
|
-
events: z.ZodArray<z.ZodUnknown>;
|
|
1314
1263
|
}, z.core.$strip>], "type">;
|
|
1315
1264
|
}, z.core.$strip>, z.ZodObject<{
|
|
1316
1265
|
ok: z.ZodBoolean;
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -346,23 +346,6 @@ export declare const sdk: {
|
|
|
346
346
|
success: import("zod").ZodBoolean;
|
|
347
347
|
data: import("zod").ZodOptional<import("zod").ZodString>;
|
|
348
348
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
349
|
-
state_version: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
350
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
351
|
-
type: import("zod").ZodLiteral<"rrweb/metadata">;
|
|
352
|
-
rrweb_session_id: import("zod").ZodString;
|
|
353
|
-
chat_id: import("zod").ZodString;
|
|
354
|
-
application_id: import("zod").ZodNumber;
|
|
355
|
-
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
356
|
-
user_agent: import("zod").ZodOptional<import("zod").ZodString>;
|
|
357
|
-
timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
358
|
-
viewport: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
359
|
-
width: import("zod").ZodNumber;
|
|
360
|
-
height: import("zod").ZodNumber;
|
|
361
|
-
}, import("zod/v4/core").$strip>>;
|
|
362
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
363
|
-
type: import("zod").ZodLiteral<"rrweb/events">;
|
|
364
|
-
rrweb_session_id: import("zod").ZodString;
|
|
365
|
-
events: import("zod").ZodArray<import("zod").ZodUnknown>;
|
|
366
349
|
}, import("zod/v4/core").$strip>], "type">;
|
|
367
350
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
368
351
|
ok: import("zod").ZodBoolean;
|
|
@@ -35,7 +35,6 @@ declare class StorageService {
|
|
|
35
35
|
private isValidChatId;
|
|
36
36
|
/** window.name takes priority over localStorage — it persists across page navigations. */
|
|
37
37
|
getChatId(): string | null;
|
|
38
|
-
/** Dispatches a 'marketrix:chatid' event so other services (e.g. RrwebSessionRecorder) can react. */
|
|
39
38
|
setChatId(chatId: string | null): void;
|
|
40
39
|
getMessages(): StoredMessage[];
|
|
41
40
|
setMessages(messages: StoredMessage[]): void;
|