@epam/ai-dial-chat-visualizer-connector 0.50.0-dev.2 → 0.50.0-dev.21
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 +46 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -127,6 +127,12 @@ Both flags are independent and can be combined:
|
|
|
127
127
|
}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
### 3. Custom Viewers
|
|
131
|
+
|
|
132
|
+
The same connector powers **Custom Viewers**, which replace the entire chat UI for an application instead of rendering an attachment. Custom Viewers are not configured through `CUSTOM_VISUALIZERS` / `APPLICATION_VISUALIZERS` — they are configured per-application via `viewer_url` or an application type schema, receive conversation context instead of attachment data, and can send conversation events back to the chat.
|
|
133
|
+
|
|
134
|
+
See [Custom Viewers](../../docs/CUSTOM-VIEWERS.md) for the full contract.
|
|
135
|
+
|
|
130
136
|
## Data Structures
|
|
131
137
|
|
|
132
138
|
### Single Attachment Data (CUSTOM_VISUALIZERS)
|
|
@@ -140,6 +146,7 @@ export interface AttachmentData {
|
|
|
140
146
|
export interface CustomVisualizerDataLayout {
|
|
141
147
|
width: number;
|
|
142
148
|
height: number;
|
|
149
|
+
mobileHeight?: number;
|
|
143
150
|
themeId?: string;
|
|
144
151
|
logInHint?: string;
|
|
145
152
|
providerId?: string;
|
|
@@ -164,11 +171,12 @@ export interface GroupedAttachmentsData {
|
|
|
164
171
|
export interface AttachmentItem {
|
|
165
172
|
url: string;
|
|
166
173
|
mimeType: string;
|
|
167
|
-
contentType: string;
|
|
168
174
|
visualizerData: CustomVisualizerData;
|
|
169
175
|
}
|
|
170
176
|
```
|
|
171
177
|
|
|
178
|
+
_Note: DIAL Chat additionally sets a `contentType` field on each attachment item at runtime (mirroring `mimeType`). It is not part of the exported interface — do not rely on it._
|
|
179
|
+
|
|
172
180
|
## Integration Guide
|
|
173
181
|
|
|
174
182
|
### 1. Install library
|
|
@@ -260,7 +268,6 @@ const content = useMemo(() => {
|
|
|
260
268
|
return groupedData.attachments.map((att) => ({
|
|
261
269
|
url: att.url,
|
|
262
270
|
mimeType: att.mimeType,
|
|
263
|
-
contentType: att.contentType,
|
|
264
271
|
data: att.visualizerData,
|
|
265
272
|
}));
|
|
266
273
|
}
|
|
@@ -399,7 +406,7 @@ constructor(
|
|
|
399
406
|
|
|
400
407
|
**Parameters:**
|
|
401
408
|
|
|
402
|
-
- `dialHost` - DIAL CHAT host URL(s)
|
|
409
|
+
- `dialHost` - DIAL CHAT host URL(s). Accepts a single host or an array. Incoming messages are accepted only from these origins, and outgoing messages sent without an explicit `dialHost` are broadcast to all of them. Passing `'*'` as the first (or only) host disables the origin check — **development only**.
|
|
403
410
|
- `appName` - Visualizer name (must match `title` in configuration)
|
|
404
411
|
- `dataCallback` - Either a single callback function or a `ChatVisualizerCallbacks` object
|
|
405
412
|
|
|
@@ -414,13 +421,40 @@ interface ChatVisualizerCallbacks {
|
|
|
414
421
|
|
|
415
422
|
#### Methods
|
|
416
423
|
|
|
417
|
-
| Method | Description
|
|
418
|
-
| ------------------------------------ |
|
|
419
|
-
| `sendReady()` | Notify DIAL Chat that visualizer is loaded (hides loader)
|
|
420
|
-
| `sendReadyToInteract()` | Notify DIAL Chat that visualizer is ready to receive data
|
|
421
|
-
| `sendMessage(content: string)` | Send a message to the chat
|
|
422
|
-
| `send({ type, payload, dialHost? })` | Send
|
|
423
|
-
| `
|
|
424
|
+
| Method | Description |
|
|
425
|
+
| ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
426
|
+
| `sendReady()` | Notify DIAL Chat that visualizer is loaded (hides loader) |
|
|
427
|
+
| `sendReadyToInteract()` | Notify DIAL Chat that visualizer is ready to receive data |
|
|
428
|
+
| `sendMessage(content: string)` | Send a message to the chat |
|
|
429
|
+
| `send({ type, payload, dialHost? })` | Send any `VisualizerConnectorEvents` event to DIAL Chat |
|
|
430
|
+
| `sendPMResponse(requestParams)` | Acknowledge a request by `requestId`. Called automatically for incoming data — rarely needed manually |
|
|
431
|
+
| `destroy()` | Clean up event listeners |
|
|
432
|
+
|
|
433
|
+
Events that have no dedicated helper method (the conversation and application events below) are sent with `send()`.
|
|
434
|
+
|
|
435
|
+
#### Event and request types
|
|
436
|
+
|
|
437
|
+
Events the visualizer/viewer sends **to** DIAL Chat (`VisualizerConnectorEvents`):
|
|
438
|
+
|
|
439
|
+
| Member | Value | Purpose |
|
|
440
|
+
| ---------------------------- | ------------------------------ | ------------------------------------------------------------------------- |
|
|
441
|
+
| `ready` | `READY` | Visualizer loaded — hides the loader |
|
|
442
|
+
| `readyToInteract` | `READY_TO_INTERACT` | Visualizer ready to receive data — unblocks data delivery |
|
|
443
|
+
| `sendMessage` | `SEND_MESSAGE` | Send a message into the conversation |
|
|
444
|
+
| `createdConversationSuccess` | `CREATED_CONVERSATION_SUCCESS` | Custom Viewers: a conversation was created, add and select it in the chat |
|
|
445
|
+
| `updatedConversationSuccess` | `UPDATED_CONVERSATION_SUCCESS` | Custom Viewers: a conversation was updated, apply it in the chat |
|
|
446
|
+
| `updatedApplicationSuccess` | `UPDATED_APPLICATION_SUCCESS` | Applications editor: an application was updated, apply it in the chat |
|
|
447
|
+
| `initReady` | `INIT_READY` | _Reserved — not handled for visualizers_ |
|
|
448
|
+
|
|
449
|
+
Requests DIAL Chat sends **to** the visualizer/viewer (`VisualizerConnectorRequests`):
|
|
450
|
+
|
|
451
|
+
| Member | Value | Delivered to |
|
|
452
|
+
| -------------------------- | ----------------------------- | ------------------------------------------------------------ |
|
|
453
|
+
| `sendVisualizeData` | `SEND_VISUALIZE_DATA` | `onData` (single attachment / Custom Viewer context payload) |
|
|
454
|
+
| `sendGroupedVisualizeData` | `SEND_GROUPED_VISUALIZE_DATA` | `onGroupedData` (grouped attachments) |
|
|
455
|
+
| `setVisualizerOptions` | `SET_VISUALIZER_OPTIONS` | _Reserved — currently never sent_ |
|
|
456
|
+
|
|
457
|
+
Both enums are exported from `@epam/ai-dial-shared`. Incoming requests are acknowledged automatically by the connector.
|
|
424
458
|
|
|
425
459
|
### Sending to a particular host when multiple were passed
|
|
426
460
|
|
|
@@ -467,6 +501,7 @@ Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does
|
|
|
467
501
|
|
|
468
502
|
**Checklist:**
|
|
469
503
|
|
|
470
|
-
1. `appName` must match `title` in `CUSTOM_VISUALIZERS` or `APPLICATION_VISUALIZERS`
|
|
504
|
+
1. `appName` must match `title` in `CUSTOM_VISUALIZERS` or `APPLICATION_VISUALIZERS` (for Custom Viewers, the application or schema display name)
|
|
471
505
|
2. For `APPLICATION_VISUALIZERS`, the key must match the `applicationId` from messages
|
|
472
506
|
3. `sendReady()` and `sendReadyToInteract()` must be called after connector creation
|
|
507
|
+
4. `dialHost` must list the DIAL Chat origin — messages from other origins are dropped before reaching your callbacks
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@epam/ai-dial-chat-visualizer-connector",
|
|
3
3
|
"description": "Package for custom visualizer to connect with DIAL Chat",
|
|
4
4
|
"homepage": "https://dialx.ai",
|
|
5
|
-
"version": "0.50.0-dev.
|
|
5
|
+
"version": "0.50.0-dev.21",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@epam/ai-dial-shared": "0.50.0-dev.
|
|
7
|
+
"@epam/ai-dial-shared": "0.50.0-dev.21"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bugs": {
|