@marketrix.ai/widget 3.8.345 → 3.8.347
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 +15 -8
- package/dist/src/sdk/contract.d.ts +0 -1
- package/dist/src/sdk/contracts/widget.d.ts +0 -2
- package/dist/src/sdk/index.d.ts +0 -1
- package/dist/src/services/ValidationService.d.ts +4 -3
- package/dist/src/services/WidgetService.d.ts +1 -1
- package/dist/src/types/index.d.ts +0 -7
- package/dist/widget.mjs +16 -16
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,12 +56,11 @@ await mountWidget({
|
|
|
56
56
|
|
|
57
57
|
## Credential modes
|
|
58
58
|
|
|
59
|
-
The widget supports
|
|
59
|
+
The widget supports two modes, auto-detected from the credentials you provide.
|
|
60
60
|
|
|
61
61
|
| Mode | Credentials | Script attributes | Network |
|
|
62
62
|
| -------------- | -------------------------------- | -------------------- | --------------------------------------------------------------- |
|
|
63
63
|
| **Production** | `mtxId` + `mtxKey` | `mtx-id` + `mtx-key` | Fetches settings from the API, opens the live stream |
|
|
64
|
-
| **Dev** | `mtxApp` (application id) | `mtx-app` | Same as production, keyed by id instead of credentials |
|
|
65
64
|
| **Preview** | `settings` object passed in code | — | No network — renders appearance only from the supplied settings |
|
|
66
65
|
|
|
67
66
|
All modes also accept the common options below.
|
|
@@ -143,9 +142,6 @@ Auto-detects the mode (preview / production / dev) from `config` and initializes
|
|
|
143
142
|
// Production
|
|
144
143
|
await mountWidget({ mtxId, mtxKey, mtxApiHost });
|
|
145
144
|
|
|
146
|
-
// Dev
|
|
147
|
-
await mountWidget({ mtxApp: 123, mtxApiHost });
|
|
148
|
-
|
|
149
145
|
// Preview (no network — just renders the appearance)
|
|
150
146
|
await mountWidget({ settings: { widget_enabled: true, widget_position: 'bottom_right' /* ... */ } });
|
|
151
147
|
```
|
|
@@ -174,6 +170,17 @@ Returns the active configuration, or `null` if the widget isn't initialized.
|
|
|
174
170
|
|
|
175
171
|
Widget settings are managed in the dashboard. `widget_appearance: 'hidden'` keeps the widget initialized but suppresses its visible UI on the host page; previews remain visible. `widget_greeting_toast` controls the welcome toast, and `widget_recording` enables rrweb session recording. Recording is off by default.
|
|
176
172
|
|
|
173
|
+
#### Session recording privacy
|
|
174
|
+
|
|
175
|
+
When recording is enabled, **every input value is masked** — recordings capture that a field was typed into, never what was typed. To exclude more of your page, add either class to any element:
|
|
176
|
+
|
|
177
|
+
| Class | Effect |
|
|
178
|
+
| ------------------------ | ----------------------------------------------------------- |
|
|
179
|
+
| `mtx-mask` / `rr-mask` | Text content inside the element is masked |
|
|
180
|
+
| `mtx-block` / `rr-block` | The element is replaced by a placeholder and never recorded |
|
|
181
|
+
|
|
182
|
+
Both the `mtx-` and rrweb's native `rr-` prefixes are honoured, so existing `rr-block` / `rr-mask` markup keeps working.
|
|
183
|
+
|
|
177
184
|
### `MarketrixWidget` — React component (preview)
|
|
178
185
|
|
|
179
186
|
For previewing appearance inside a React app (e.g. a settings/configuration screen). Renders into its own Shadow DOM and makes no network calls.
|
|
@@ -207,8 +214,8 @@ Props: `settings` (required), `container?`, `mtxId?`, `mtxKey?`, `mtxApiHost?`.
|
|
|
207
214
|
|
|
208
215
|
TypeScript types are bundled with the package:
|
|
209
216
|
|
|
210
|
-
- `MarketrixConfig` — full config for `initWidget` / `updateMarketrixConfig` (`mtxId`, `mtxKey`, `
|
|
211
|
-
- `AddWidgetConfig` — discriminated config for `mountWidget` (production /
|
|
217
|
+
- `MarketrixConfig` — full config for `initWidget` / `updateMarketrixConfig` (`mtxId`, `mtxKey`, `mtxApiHost`, `userId`, `show_widget`, `use_screenshare`, plus all widget appearance settings, optional).
|
|
218
|
+
- `AddWidgetConfig` — discriminated config for `mountWidget` (production / preview variants + common options).
|
|
212
219
|
- `MarketrixWidgetProps` — props for the `MarketrixWidget` component.
|
|
213
220
|
- `ChatMessage`, `WidgetState`, `InstructionType` (`'tell' | 'show' | 'do'`).
|
|
214
221
|
|
|
@@ -218,7 +225,7 @@ TypeScript types are bundled with the package:
|
|
|
218
225
|
|
|
219
226
|
- **React 19** (`react`/`react-dom` `^19.2.3`) on the host page — peer dependency, not bundled. The script-tag loader provides it via importmap; npm consumers supply it from their app.
|
|
220
227
|
- A reachable Marketrix API host (`mtxApiHost` / `mtx-api-host`).
|
|
221
|
-
- Valid credentials
|
|
228
|
+
- Valid credentials (`mtxId` + `mtxKey`) for production mode.
|
|
222
229
|
|
|
223
230
|
---
|
|
224
231
|
|
|
@@ -375,7 +375,6 @@ export declare const widgetContract: {
|
|
|
375
375
|
tab_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
376
376
|
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
377
377
|
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
378
|
-
application_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
379
378
|
}, import("zod/v4/core").$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
380
379
|
type: "registered";
|
|
381
380
|
chat_id: string;
|
|
@@ -723,7 +723,6 @@ export declare const widgetStream: import("@orpc/contract").ContractProcedureBui
|
|
|
723
723
|
tab_id: z.ZodOptional<z.ZodString>;
|
|
724
724
|
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
725
725
|
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
726
|
-
application_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
727
726
|
}, z.core.$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
728
727
|
type: "registered";
|
|
729
728
|
chat_id: string;
|
|
@@ -1249,7 +1248,6 @@ export declare const widgetRoutes: {
|
|
|
1249
1248
|
tab_id: z.ZodOptional<z.ZodString>;
|
|
1250
1249
|
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
1251
1250
|
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
1252
|
-
application_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
1253
1251
|
}, z.core.$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
1254
1252
|
type: "registered";
|
|
1255
1253
|
chat_id: string;
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -380,7 +380,6 @@ export declare const sdk: {
|
|
|
380
380
|
tab_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
381
381
|
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
382
382
|
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
383
|
-
application_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
384
383
|
}, import("zod/v4/core").$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
385
384
|
type: "registered";
|
|
386
385
|
chat_id: string;
|
|
@@ -7,8 +7,9 @@ export interface WidgetValidationResult {
|
|
|
7
7
|
application?: ApplicationData;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Validates widget config:
|
|
11
|
-
*
|
|
10
|
+
* Validates widget config: the widget (marketrix_id + marketrix_key) and its application exist.
|
|
11
|
+
*
|
|
12
|
+
* The keyless `mtxApp` mode is retired — an application id is a guessable integer, not a secret, so
|
|
13
|
+
* it authenticated nothing while granting full agent access under the owning workspace.
|
|
12
14
|
*/
|
|
13
|
-
/** Handles both the mtxId+mtxKey and mtxApp cases. */
|
|
14
15
|
export declare function validateConfig(config: MarketrixConfig): Promise<WidgetValidationResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type WidgetData, type WidgetSettingsData } from '../sdk';
|
|
2
2
|
export declare function getWidgetSettings(widget: WidgetData): WidgetSettingsData | null;
|
|
3
3
|
/** Default settings merged with the matched widget's settings; null with no credentials (preview mode). */
|
|
4
|
-
export declare function fetchWidgetSettings(mtxId?: string, mtxKey?: string
|
|
4
|
+
export declare function fetchWidgetSettings(mtxId?: string, mtxKey?: string): Promise<WidgetData | null>;
|
|
@@ -66,17 +66,10 @@ export type AddWidgetConfig = ({
|
|
|
66
66
|
settings: WidgetSettingsData;
|
|
67
67
|
mtxId?: never;
|
|
68
68
|
mtxKey?: never;
|
|
69
|
-
mtxApp?: never;
|
|
70
69
|
} | {
|
|
71
70
|
settings?: never;
|
|
72
71
|
mtxId: string;
|
|
73
72
|
mtxKey: string;
|
|
74
|
-
mtxApp?: never;
|
|
75
|
-
} | {
|
|
76
|
-
settings?: never;
|
|
77
|
-
mtxId?: never;
|
|
78
|
-
mtxKey?: never;
|
|
79
|
-
mtxApp: number;
|
|
80
73
|
}) & {
|
|
81
74
|
container?: HTMLElement;
|
|
82
75
|
mtxApiHost?: string;
|