@epam/ai-dial-overlay 0.31.0-rc.57 → 0.31.0-rc.58
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/index.esm.js +78 -44
- package/package.json +2 -2
- package/src/lib/ChatOverlay.d.ts +13 -2
- package/src/lib/ChatOverlayManager.d.ts +26 -24
package/index.esm.js
CHANGED
|
@@ -276,6 +276,15 @@ class ChatOverlay {
|
|
|
276
276
|
return this.send(OverlayRequests.getConversations);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Get all selected conversations
|
|
281
|
+
* @returns {OverlayConversation[]} all selected conversations visible in chat
|
|
282
|
+
*/
|
|
283
|
+
getSelectedConversations() {
|
|
284
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
return this.send(OverlayRequests.getSelectedConversations);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
279
288
|
/**
|
|
280
289
|
* Select conversation
|
|
281
290
|
* @param {string} id - id of conversation to select
|
|
@@ -332,7 +341,7 @@ class ChatOverlay {
|
|
|
332
341
|
/**
|
|
333
342
|
* Export conversation
|
|
334
343
|
* @param {string} id - id of conversation to export
|
|
335
|
-
* @returns Returns
|
|
344
|
+
* @returns Returns exported conversation object
|
|
336
345
|
*/
|
|
337
346
|
exportConversation(id) {
|
|
338
347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -342,6 +351,19 @@ class ChatOverlay {
|
|
|
342
351
|
return this.send(OverlayRequests.exportConversation, request);
|
|
343
352
|
});
|
|
344
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Import conversation
|
|
356
|
+
* @param {LatestExportConversationsFormat} importedConversation - conversation object to import
|
|
357
|
+
* @returns Returns imported conversation info
|
|
358
|
+
*/
|
|
359
|
+
importConversation(importedConversation) {
|
|
360
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
361
|
+
const request = {
|
|
362
|
+
importConversation: importedConversation,
|
|
363
|
+
};
|
|
364
|
+
return this.send(OverlayRequests.importConversation, request);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
345
367
|
/**
|
|
346
368
|
* Create conversation
|
|
347
369
|
* @param {string} parentPath - path to create conversation in. If not defined or null conversation will be created in user Root
|
|
@@ -627,44 +649,44 @@ class ChatOverlayManager {
|
|
|
627
649
|
}
|
|
628
650
|
/**
|
|
629
651
|
* Destroys overlay with specified id and removes from this.overlays
|
|
630
|
-
* @param
|
|
652
|
+
* @param overlayId {string} id of overlay that should be deleted
|
|
631
653
|
*/
|
|
632
|
-
removeOverlay(
|
|
633
|
-
const { overlay, container, toggleButton } = this.getOverlay(
|
|
654
|
+
removeOverlay(overlayId) {
|
|
655
|
+
const { overlay, container, toggleButton } = this.getOverlay(overlayId);
|
|
634
656
|
overlay.destroy();
|
|
635
|
-
this.overlays = this.overlays.filter(({ options }) => options.id !==
|
|
657
|
+
this.overlays = this.overlays.filter(({ options }) => options.id !== overlayId);
|
|
636
658
|
document.body.removeChild(container);
|
|
637
659
|
document.body.removeChild(toggleButton);
|
|
638
660
|
}
|
|
639
|
-
openFullscreen(
|
|
640
|
-
const { overlay } = this.getOverlay(
|
|
661
|
+
openFullscreen(overlayId) {
|
|
662
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
641
663
|
overlay.openFullscreen();
|
|
642
664
|
}
|
|
643
665
|
/**
|
|
644
666
|
* Shows overlay with specified id
|
|
645
|
-
* @param
|
|
667
|
+
* @param overlayId {string} id of overlay that should be shown
|
|
646
668
|
*/
|
|
647
|
-
showOverlay(
|
|
648
|
-
const overlay = this.getOverlay(
|
|
669
|
+
showOverlay(overlayId) {
|
|
670
|
+
const overlay = this.getOverlay(overlayId);
|
|
649
671
|
overlay.isHidden = false;
|
|
650
672
|
overlay.container.style.transform = 'scale(1) translate(0, 0)';
|
|
651
673
|
}
|
|
652
674
|
/**
|
|
653
675
|
* Hides overlay with specified id
|
|
654
|
-
* @param
|
|
676
|
+
* @param overlayId {string} id of overlay that should be hidden
|
|
655
677
|
*/
|
|
656
|
-
hideOverlay(
|
|
657
|
-
const overlay = this.getOverlay(
|
|
678
|
+
hideOverlay(overlayId) {
|
|
679
|
+
const overlay = this.getOverlay(overlayId);
|
|
658
680
|
overlay.isHidden = true;
|
|
659
681
|
overlay.container.style.transform = `scale(1) ${overlay.position.transform}`;
|
|
660
682
|
}
|
|
661
683
|
/**
|
|
662
684
|
* Checks the current viewport and updates position, styles if needed
|
|
663
|
-
* @param
|
|
685
|
+
* @param overlayId {string} id of overlay that should be updated
|
|
664
686
|
*/
|
|
665
|
-
updateOverlay(
|
|
687
|
+
updateOverlay(overlayId) {
|
|
666
688
|
var _a;
|
|
667
|
-
const { container, options, isHidden } = this.getOverlay(
|
|
689
|
+
const { container, options, isHidden } = this.getOverlay(overlayId);
|
|
668
690
|
const mobileHeight = `${window.innerHeight}px`;
|
|
669
691
|
const isMobileView = this.isMobileView();
|
|
670
692
|
const position = getPosition()[(_a = options.position) !== null && _a !== void 0 ? _a : 'right-bottom'];
|
|
@@ -687,84 +709,96 @@ class ChatOverlayManager {
|
|
|
687
709
|
: options.height || defaultOverlayPlacementOptions.height,
|
|
688
710
|
});
|
|
689
711
|
}
|
|
690
|
-
setSystemPrompt(
|
|
691
|
-
const { overlay } = this.getOverlay(
|
|
712
|
+
setSystemPrompt(overlayId, systemPrompt) {
|
|
713
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
692
714
|
return overlay.setSystemPrompt(systemPrompt);
|
|
693
715
|
}
|
|
694
|
-
getMessages(
|
|
716
|
+
getMessages(overlayId) {
|
|
695
717
|
return __awaiter(this, void 0, void 0, function* () {
|
|
696
|
-
const { overlay } = this.getOverlay(
|
|
718
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
697
719
|
return overlay.getMessages();
|
|
698
720
|
});
|
|
699
721
|
}
|
|
700
|
-
sendMessage(
|
|
722
|
+
sendMessage(overlayId, content) {
|
|
701
723
|
return __awaiter(this, void 0, void 0, function* () {
|
|
702
|
-
const { overlay } = this.getOverlay(
|
|
724
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
703
725
|
return overlay.sendMessage(content);
|
|
704
726
|
});
|
|
705
727
|
}
|
|
706
|
-
getConversations(
|
|
728
|
+
getConversations(overlayId) {
|
|
707
729
|
return __awaiter(this, void 0, void 0, function* () {
|
|
708
|
-
const { overlay } = this.getOverlay(
|
|
730
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
709
731
|
return overlay.getConversations();
|
|
710
732
|
});
|
|
711
733
|
}
|
|
712
|
-
|
|
734
|
+
getSelectedConversations(overlayId) {
|
|
713
735
|
return __awaiter(this, void 0, void 0, function* () {
|
|
714
|
-
const { overlay } = this.getOverlay(
|
|
736
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
737
|
+
return overlay.getSelectedConversations();
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
createConversation(overlayId, parentPath) {
|
|
741
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
742
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
715
743
|
return overlay.createConversation(parentPath);
|
|
716
744
|
});
|
|
717
745
|
}
|
|
718
|
-
selectConversation(
|
|
746
|
+
selectConversation(overlayId, conversationId) {
|
|
719
747
|
return __awaiter(this, void 0, void 0, function* () {
|
|
720
|
-
const { overlay } = this.getOverlay(
|
|
748
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
721
749
|
return overlay.selectConversation(conversationId);
|
|
722
750
|
});
|
|
723
751
|
}
|
|
724
|
-
renameConversation(
|
|
752
|
+
renameConversation(overlayId, conversationId, newName) {
|
|
725
753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
726
|
-
const { overlay } = this.getOverlay(
|
|
754
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
727
755
|
return overlay.renameConversation(conversationId, newName);
|
|
728
756
|
});
|
|
729
757
|
}
|
|
730
|
-
setOverlayOptions(
|
|
758
|
+
setOverlayOptions(overlayId, options) {
|
|
731
759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
-
const { overlay } = this.getOverlay(
|
|
760
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
733
761
|
return overlay.setOverlayOptions(options);
|
|
734
762
|
});
|
|
735
763
|
}
|
|
736
|
-
deleteConversation(
|
|
764
|
+
deleteConversation(overlayId, conversationId) {
|
|
737
765
|
return __awaiter(this, void 0, void 0, function* () {
|
|
738
|
-
const { overlay } = this.getOverlay(
|
|
766
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
739
767
|
return overlay.deleteConversation(conversationId);
|
|
740
768
|
});
|
|
741
769
|
}
|
|
742
|
-
replayConversation(
|
|
770
|
+
replayConversation(overlayId, conversationId) {
|
|
743
771
|
return __awaiter(this, void 0, void 0, function* () {
|
|
744
|
-
const { overlay } = this.getOverlay(
|
|
772
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
745
773
|
return overlay.createPlaybackConversation(conversationId);
|
|
746
774
|
});
|
|
747
775
|
}
|
|
748
|
-
exportConversation(
|
|
776
|
+
exportConversation(overlayId, conversationId) {
|
|
749
777
|
return __awaiter(this, void 0, void 0, function* () {
|
|
750
|
-
const { overlay } = this.getOverlay(
|
|
778
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
751
779
|
return overlay.exportConversation(conversationId);
|
|
752
780
|
});
|
|
753
781
|
}
|
|
754
|
-
|
|
755
|
-
|
|
782
|
+
importConversation(overlayId, importedConversation) {
|
|
783
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
784
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
785
|
+
return overlay.importConversation(importedConversation);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
subscribe(overlayId, eventType, callback) {
|
|
789
|
+
const { overlay } = this.getOverlay(overlayId);
|
|
756
790
|
return overlay.subscribe(eventType, callback);
|
|
757
791
|
}
|
|
758
792
|
/**
|
|
759
793
|
* Get reference to overlay from this.overlay with specified id
|
|
760
794
|
* Throws exception if there is no such overlay with specified id
|
|
761
|
-
* @param
|
|
795
|
+
* @param overlayId {string} id of overlay that should be returned
|
|
762
796
|
* @returns {Overlay} reference to overlay with specified id
|
|
763
797
|
*/
|
|
764
|
-
getOverlay(
|
|
765
|
-
const overlay = this.overlays.find(({ options }) => options.id ===
|
|
798
|
+
getOverlay(overlayId) {
|
|
799
|
+
const overlay = this.overlays.find(({ options }) => options.id === overlayId);
|
|
766
800
|
if (!overlay)
|
|
767
|
-
throw new Error(`There is no overlay with ${
|
|
801
|
+
throw new Error(`There is no overlay with ${overlayId}`);
|
|
768
802
|
return overlay;
|
|
769
803
|
}
|
|
770
804
|
/**
|
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://epam-rail.com",
|
|
5
|
-
"version": "0.31.0-rc.
|
|
5
|
+
"version": "0.31.0-rc.58",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@epam/ai-dial-shared": "0.31.0-rc.
|
|
7
|
+
"@epam/ai-dial-shared": "0.31.0-rc.58"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bugs": {
|
package/src/lib/ChatOverlay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatOverlayOptions, CreateConversationResponse, CreatePlaybackConversationResponse, DeferredRequest, ExportConversationResponse, GetConversationsResponse, GetMessagesResponse, OverlayRequest, OverlayRequests, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetSystemPromptResponse, Styles, Task } from '@epam/ai-dial-shared';
|
|
1
|
+
import { ChatOverlayOptions, CreateConversationResponse, CreatePlaybackConversationResponse, DeferredRequest, ExportConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, ImportConversationResponse, LatestExportConversationsFormat, OverlayRequest, OverlayRequests, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetSystemPromptResponse, Styles, Task } from '@epam/ai-dial-shared';
|
|
2
2
|
interface Subscription {
|
|
3
3
|
eventType: string;
|
|
4
4
|
callback: (payload: unknown) => void;
|
|
@@ -94,6 +94,11 @@ export declare class ChatOverlay {
|
|
|
94
94
|
* @returns {OverlayConversation[]} all conversations visible in chat
|
|
95
95
|
*/
|
|
96
96
|
getConversations(): Promise<GetConversationsResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Get all selected conversations
|
|
99
|
+
* @returns {OverlayConversation[]} all selected conversations visible in chat
|
|
100
|
+
*/
|
|
101
|
+
getSelectedConversations(): Promise<GetSelectedConversationsResponse>;
|
|
97
102
|
/**
|
|
98
103
|
* Select conversation
|
|
99
104
|
* @param {string} id - id of conversation to select
|
|
@@ -121,9 +126,15 @@ export declare class ChatOverlay {
|
|
|
121
126
|
/**
|
|
122
127
|
* Export conversation
|
|
123
128
|
* @param {string} id - id of conversation to export
|
|
124
|
-
* @returns Returns
|
|
129
|
+
* @returns Returns exported conversation object
|
|
125
130
|
*/
|
|
126
131
|
exportConversation(id: string): Promise<ExportConversationResponse>;
|
|
132
|
+
/**
|
|
133
|
+
* Import conversation
|
|
134
|
+
* @param {LatestExportConversationsFormat} importedConversation - conversation object to import
|
|
135
|
+
* @returns Returns imported conversation info
|
|
136
|
+
*/
|
|
137
|
+
importConversation(importedConversation: LatestExportConversationsFormat): Promise<ImportConversationResponse>;
|
|
127
138
|
/**
|
|
128
139
|
* Create conversation
|
|
129
140
|
* @param {string} parentPath - path to create conversation in. If not defined or null conversation will be created in user Root
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatOverlay } from './ChatOverlay';
|
|
2
|
-
import { ChatOverlayOptions } from '@epam/ai-dial-shared';
|
|
2
|
+
import { ChatOverlayOptions, LatestExportConversationsFormat } from '@epam/ai-dial-shared';
|
|
3
3
|
export type OverlayPosition = 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
4
4
|
export interface Position {
|
|
5
5
|
top: string;
|
|
@@ -64,44 +64,46 @@ export declare class ChatOverlayManager {
|
|
|
64
64
|
createCloseButton(): HTMLButtonElement;
|
|
65
65
|
/**
|
|
66
66
|
* Destroys overlay with specified id and removes from this.overlays
|
|
67
|
-
* @param
|
|
67
|
+
* @param overlayId {string} id of overlay that should be deleted
|
|
68
68
|
*/
|
|
69
|
-
removeOverlay(
|
|
70
|
-
openFullscreen(
|
|
69
|
+
removeOverlay(overlayId: string): void;
|
|
70
|
+
openFullscreen(overlayId: string): void;
|
|
71
71
|
/**
|
|
72
72
|
* Shows overlay with specified id
|
|
73
|
-
* @param
|
|
73
|
+
* @param overlayId {string} id of overlay that should be shown
|
|
74
74
|
*/
|
|
75
|
-
showOverlay(
|
|
75
|
+
showOverlay(overlayId: string): void;
|
|
76
76
|
/**
|
|
77
77
|
* Hides overlay with specified id
|
|
78
|
-
* @param
|
|
78
|
+
* @param overlayId {string} id of overlay that should be hidden
|
|
79
79
|
*/
|
|
80
|
-
hideOverlay(
|
|
80
|
+
hideOverlay(overlayId: string): void;
|
|
81
81
|
/**
|
|
82
82
|
* Checks the current viewport and updates position, styles if needed
|
|
83
|
-
* @param
|
|
83
|
+
* @param overlayId {string} id of overlay that should be updated
|
|
84
84
|
*/
|
|
85
|
-
updateOverlay(
|
|
86
|
-
setSystemPrompt(
|
|
87
|
-
getMessages(
|
|
88
|
-
sendMessage(
|
|
89
|
-
getConversations(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
updateOverlay(overlayId: string): void;
|
|
86
|
+
setSystemPrompt(overlayId: string, systemPrompt: string): Promise<void>;
|
|
87
|
+
getMessages(overlayId: string): Promise<import("@epam/ai-dial-shared").GetMessagesResponse>;
|
|
88
|
+
sendMessage(overlayId: string, content: string): Promise<void>;
|
|
89
|
+
getConversations(overlayId: string): Promise<import("@epam/ai-dial-shared").GetConversationsResponse>;
|
|
90
|
+
getSelectedConversations(overlayId: string): Promise<import("@epam/ai-dial-shared").GetSelectedConversationsResponse>;
|
|
91
|
+
createConversation(overlayId: string, parentPath?: string | null): Promise<import("@epam/ai-dial-shared").CreateConversationResponse>;
|
|
92
|
+
selectConversation(overlayId: string, conversationId: string): Promise<import("@epam/ai-dial-shared").SelectConversationResponse>;
|
|
93
|
+
renameConversation(overlayId: string, conversationId: string, newName: string): Promise<import("@epam/ai-dial-shared").RenameConversationResponse>;
|
|
94
|
+
setOverlayOptions(overlayId: string, options: ChatOverlayOptions): Promise<void>;
|
|
95
|
+
deleteConversation(overlayId: string, conversationId: string): Promise<void>;
|
|
96
|
+
replayConversation(overlayId: string, conversationId: string): Promise<import("@epam/ai-dial-shared").CreatePlaybackConversationResponse>;
|
|
97
|
+
exportConversation(overlayId: string, conversationId: string): Promise<import("@epam/ai-dial-shared").ExportConversationResponse>;
|
|
98
|
+
importConversation(overlayId: string, importedConversation: LatestExportConversationsFormat): Promise<import("@epam/ai-dial-shared").ImportConversationResponse>;
|
|
99
|
+
subscribe(overlayId: string, eventType: string, callback: (payload?: unknown) => void): () => void;
|
|
98
100
|
/**
|
|
99
101
|
* Get reference to overlay from this.overlay with specified id
|
|
100
102
|
* Throws exception if there is no such overlay with specified id
|
|
101
|
-
* @param
|
|
103
|
+
* @param overlayId {string} id of overlay that should be returned
|
|
102
104
|
* @returns {Overlay} reference to overlay with specified id
|
|
103
105
|
*/
|
|
104
|
-
protected getOverlay(
|
|
106
|
+
protected getOverlay(overlayId: string): Overlay;
|
|
105
107
|
/**
|
|
106
108
|
* Checks that window has mobile view
|
|
107
109
|
* @returns {boolean} Returns true if window has mobile view
|