@epam/ai-dial-overlay 0.43.0-rc.9 → 0.43.0
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 +11 -7
- package/index.esm.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# DIAL Overlay
|
|
2
2
|
|
|
3
|
-
DIAL Overlay is a library designed for using DIAL Chat in an overlay format.
|
|
3
|
+
DIAL Overlay is a library designed for using DIAL Chat in an overlay format. In this format, you can use DIAL Chat via an iframe event-based protocol.
|
|
4
|
+
|
|
5
|
+
## Deployment Highlights
|
|
6
|
+
|
|
7
|
+
Regular DIAL Chat web application and DIAL Chat Overlay should be deployed as separate instances.
|
|
4
8
|
|
|
5
9
|
## Public Classes to Use
|
|
6
10
|
|
|
7
|
-
- `ChatOverlay` - a class which creates an iframe with DIAL and enables the interaction with it (send/receive messages). Types for configuration options is `ChatOverlayOptions`. Use it if you need nothing more than **1 iframe** and API to for interaction.
|
|
11
|
+
- `ChatOverlay` - a class which creates an iframe with DIAL Chat and enables the interaction with it (send/receive messages). Types for configuration options is `ChatOverlayOptions`. Use it if you need nothing more than **1 iframe** and API to for interaction.
|
|
8
12
|
- `ChatOverlayManager` - a class which provides an overlay factory, different styles and animation for overlay (for example: opening animation, auto placement, fullscreen button, etc.). Types for configuration options is `ChatOverlayManagerOptions`. Use it if what you need is **several iframes** with API and you want it placed with predefined styles options.
|
|
9
13
|
|
|
10
14
|
## Prerequisites
|
|
11
15
|
|
|
12
16
|
[DIAL Chat application configuration](https://github.com/epam/ai-dial-chat/blob/development/apps/chat/README.md):
|
|
13
17
|
|
|
14
|
-
- `IS_IFRAME`: set this flag to `true` to enable Overlay.
|
|
18
|
+
- `IS_IFRAME`: set this flag to `true` to enable Overlay. **Note**: In the Overlay mode, DIAL Chat works properly only inside the iFrame created by the overlay library.
|
|
15
19
|
- `ALLOWED_IFRAME_ORIGINS`: list all hosts where you are using the Overlay library. Note: For development purposes you can set `*`.
|
|
16
20
|
|
|
17
21
|
```
|
|
@@ -23,19 +27,19 @@ ALLOWED_IFRAME_ORIGINS=http://localhost:8000
|
|
|
23
27
|
|
|
24
28
|
Follow these steps to integrate the Overlay library with the DIAL Chat application:
|
|
25
29
|
|
|
26
|
-
1. Install the Overlay library
|
|
30
|
+
1. Install the Overlay library:
|
|
27
31
|
|
|
28
32
|
```bash
|
|
29
33
|
npm i @epam/ai-dial-overlay
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
2. Add a file to the serving folder in your application or just import it in code
|
|
36
|
+
2. Add a file to the serving folder in your application or just import it in code:
|
|
33
37
|
|
|
34
38
|
```typescript
|
|
35
39
|
import { ChatOverlay, ChatOverlayManager, ChatOverlayOptions } from '@epam/ai-dial-overlay';
|
|
36
40
|
```
|
|
37
41
|
|
|
38
|
-
3. Create an instance of `ChatOverlay` (to use just one overlay and nothing more) or `ChatOverlayManager` (if you want to create more than one ChatOverlay
|
|
42
|
+
3. Create an instance of `ChatOverlay` (to use just one overlay and nothing more) or `ChatOverlayManager` (if you want to create more than one `ChatOverlay`, or additional style options, like positions, animations, etc.)
|
|
39
43
|
|
|
40
44
|
`ChatOverlay`:
|
|
41
45
|
|
|
@@ -112,7 +116,7 @@ const run = async () => {
|
|
|
112
116
|
|
|
113
117
|
`ChatOverlayManager`:
|
|
114
118
|
|
|
115
|
-
The same principle applies to `ChatOverlayManager` as
|
|
119
|
+
The same principle applies to `ChatOverlayManager` as to `ChatOverlay` but with minor changes. Specify overlay displaying options and id for a new instance.
|
|
116
120
|
|
|
117
121
|
```typescript
|
|
118
122
|
ChatOverlayManager.createOverlay({
|
package/index.esm.js
CHANGED
|
@@ -62,6 +62,10 @@ class ChatOverlay {
|
|
|
62
62
|
*/
|
|
63
63
|
this.process = (event) => {
|
|
64
64
|
var _a, _b, _c, _d;
|
|
65
|
+
// Only process messages from this specific iframe instance
|
|
66
|
+
if (event.source !== this.iframe.contentWindow) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
65
69
|
if (event.data.type === `${overlayAppName}/${OverlayEvents.initReady}`) {
|
|
66
70
|
this.showLoader();
|
|
67
71
|
if (this.options.loaderHideEvent === OverlayEvents.initReady) {
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@epam/ai-dial-overlay",
|
|
3
3
|
"description": "Package for opening dial in overlay",
|
|
4
4
|
"homepage": "https://dialx.ai",
|
|
5
|
-
"version": "0.43.0
|
|
5
|
+
"version": "0.43.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@epam/ai-dial-shared": "0.43.0
|
|
7
|
+
"@epam/ai-dial-shared": "0.43.0"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bugs": {
|