@epam/ai-dial-overlay 0.31.0-rc.6 → 0.31.0-rc.61

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 CHANGED
@@ -67,6 +67,15 @@ const run = async () => {
67
67
  overlayConversationId: 'some-conversation-id',
68
68
  // optional, if DIAL should redirect to sign in the same browser window
69
69
  signInInSameWindow: false,
70
+ // optional, auto-sign in options
71
+ signInOptions: {
72
+ // optional, If the DIAL should automatically sign in without user interaction (provided there is an active provider session)
73
+ autoSignIn: true,
74
+ //provider which will be used for the sign in
75
+ signInProvider: 'provider_name',
76
+ //optional, should be true if provider page couldn't be open in iframe and hostDomain and DIAL have different providers or application id within one provider
77
+ signInInNewWindow: true,
78
+ },
70
79
  });
71
80
 
72
81
  // overlay loaded application and ready to send and receive information from the application
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
@@ -289,6 +298,72 @@ class ChatOverlay {
289
298
  return this.send(OverlayRequests.selectConversation, request);
290
299
  });
291
300
  }
301
+ /**
302
+ * Delete conversation
303
+ * @param {string} id - id of conversation to delete
304
+ */
305
+ deleteConversation(id) {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ const request = {
308
+ id,
309
+ };
310
+ return this.send(OverlayRequests.deleteConversation, request);
311
+ });
312
+ }
313
+ /**
314
+ * Rename conversation
315
+ * @param {string} id - id of conversation to rename
316
+ * @param {string} newName - new name of conversation
317
+ * @returns Returns renamed conversation info
318
+ */
319
+ renameConversation(id, newName) {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
+ const request = {
322
+ id,
323
+ newName,
324
+ };
325
+ return this.send(OverlayRequests.renameConversation, request);
326
+ });
327
+ }
328
+ /**
329
+ * Create playback conversation
330
+ * @param {string} id - id of conversation from create playback
331
+ * @returns Returns newly created playback conversation info
332
+ */
333
+ createPlaybackConversation(id) {
334
+ return __awaiter(this, void 0, void 0, function* () {
335
+ const request = {
336
+ id,
337
+ };
338
+ return this.send(OverlayRequests.createPlaybackConversation, request);
339
+ });
340
+ }
341
+ /**
342
+ * Export conversation
343
+ * @param {string} id - id of conversation to export
344
+ * @returns Returns exported conversation object
345
+ */
346
+ exportConversation(id) {
347
+ return __awaiter(this, void 0, void 0, function* () {
348
+ const request = {
349
+ id,
350
+ };
351
+ return this.send(OverlayRequests.exportConversation, request);
352
+ });
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
+ }
292
367
  /**
293
368
  * Create conversation
294
369
  * @param {string} parentPath - path to create conversation in. If not defined or null conversation will be created in user Root
@@ -574,44 +649,44 @@ class ChatOverlayManager {
574
649
  }
575
650
  /**
576
651
  * Destroys overlay with specified id and removes from this.overlays
577
- * @param id {string} id of overlay that should be deleted
652
+ * @param overlayId {string} id of overlay that should be deleted
578
653
  */
579
- removeOverlay(id) {
580
- const { overlay, container, toggleButton } = this.getOverlay(id);
654
+ removeOverlay(overlayId) {
655
+ const { overlay, container, toggleButton } = this.getOverlay(overlayId);
581
656
  overlay.destroy();
582
- this.overlays = this.overlays.filter(({ options }) => options.id !== id);
657
+ this.overlays = this.overlays.filter(({ options }) => options.id !== overlayId);
583
658
  document.body.removeChild(container);
584
659
  document.body.removeChild(toggleButton);
585
660
  }
586
- openFullscreen(id) {
587
- const { overlay } = this.getOverlay(id);
661
+ openFullscreen(overlayId) {
662
+ const { overlay } = this.getOverlay(overlayId);
588
663
  overlay.openFullscreen();
589
664
  }
590
665
  /**
591
666
  * Shows overlay with specified id
592
- * @param id {string} id of overlay that should be shown
667
+ * @param overlayId {string} id of overlay that should be shown
593
668
  */
594
- showOverlay(id) {
595
- const overlay = this.getOverlay(id);
669
+ showOverlay(overlayId) {
670
+ const overlay = this.getOverlay(overlayId);
596
671
  overlay.isHidden = false;
597
672
  overlay.container.style.transform = 'scale(1) translate(0, 0)';
598
673
  }
599
674
  /**
600
675
  * Hides overlay with specified id
601
- * @param id {string} id of overlay that should be hidden
676
+ * @param overlayId {string} id of overlay that should be hidden
602
677
  */
603
- hideOverlay(id) {
604
- const overlay = this.getOverlay(id);
678
+ hideOverlay(overlayId) {
679
+ const overlay = this.getOverlay(overlayId);
605
680
  overlay.isHidden = true;
606
681
  overlay.container.style.transform = `scale(1) ${overlay.position.transform}`;
607
682
  }
608
683
  /**
609
684
  * Checks the current viewport and updates position, styles if needed
610
- * @param id {string} id of overlay that should be updated
685
+ * @param overlayId {string} id of overlay that should be updated
611
686
  */
612
- updateOverlay(id) {
687
+ updateOverlay(overlayId) {
613
688
  var _a;
614
- const { container, options, isHidden } = this.getOverlay(id);
689
+ const { container, options, isHidden } = this.getOverlay(overlayId);
615
690
  const mobileHeight = `${window.innerHeight}px`;
616
691
  const isMobileView = this.isMobileView();
617
692
  const position = getPosition()[(_a = options.position) !== null && _a !== void 0 ? _a : 'right-bottom'];
@@ -634,60 +709,96 @@ class ChatOverlayManager {
634
709
  : options.height || defaultOverlayPlacementOptions.height,
635
710
  });
636
711
  }
637
- setSystemPrompt(id, systemPrompt) {
638
- const { overlay } = this.getOverlay(id);
712
+ setSystemPrompt(overlayId, systemPrompt) {
713
+ const { overlay } = this.getOverlay(overlayId);
639
714
  return overlay.setSystemPrompt(systemPrompt);
640
715
  }
641
- getMessages(id) {
716
+ getMessages(overlayId) {
642
717
  return __awaiter(this, void 0, void 0, function* () {
643
- const { overlay } = this.getOverlay(id);
718
+ const { overlay } = this.getOverlay(overlayId);
644
719
  return overlay.getMessages();
645
720
  });
646
721
  }
647
- sendMessage(id, content) {
722
+ sendMessage(overlayId, content) {
648
723
  return __awaiter(this, void 0, void 0, function* () {
649
- const { overlay } = this.getOverlay(id);
724
+ const { overlay } = this.getOverlay(overlayId);
650
725
  return overlay.sendMessage(content);
651
726
  });
652
727
  }
653
- getConversations(id) {
728
+ getConversations(overlayId) {
654
729
  return __awaiter(this, void 0, void 0, function* () {
655
- const { overlay } = this.getOverlay(id);
730
+ const { overlay } = this.getOverlay(overlayId);
656
731
  return overlay.getConversations();
657
732
  });
658
733
  }
659
- createConversation(id, parentPath) {
734
+ getSelectedConversations(overlayId) {
735
+ return __awaiter(this, void 0, void 0, function* () {
736
+ const { overlay } = this.getOverlay(overlayId);
737
+ return overlay.getSelectedConversations();
738
+ });
739
+ }
740
+ createConversation(overlayId, parentPath) {
660
741
  return __awaiter(this, void 0, void 0, function* () {
661
- const { overlay } = this.getOverlay(id);
742
+ const { overlay } = this.getOverlay(overlayId);
662
743
  return overlay.createConversation(parentPath);
663
744
  });
664
745
  }
665
- selectConversation(id, conversationId) {
746
+ selectConversation(overlayId, conversationId) {
666
747
  return __awaiter(this, void 0, void 0, function* () {
667
- const { overlay } = this.getOverlay(id);
748
+ const { overlay } = this.getOverlay(overlayId);
668
749
  return overlay.selectConversation(conversationId);
669
750
  });
670
751
  }
671
- setOverlayOptions(id, options) {
752
+ renameConversation(overlayId, conversationId, newName) {
672
753
  return __awaiter(this, void 0, void 0, function* () {
673
- const { overlay } = this.getOverlay(id);
754
+ const { overlay } = this.getOverlay(overlayId);
755
+ return overlay.renameConversation(conversationId, newName);
756
+ });
757
+ }
758
+ setOverlayOptions(overlayId, options) {
759
+ return __awaiter(this, void 0, void 0, function* () {
760
+ const { overlay } = this.getOverlay(overlayId);
674
761
  return overlay.setOverlayOptions(options);
675
762
  });
676
763
  }
677
- subscribe(id, eventType, callback) {
678
- const { overlay } = this.getOverlay(id);
764
+ deleteConversation(overlayId, conversationId) {
765
+ return __awaiter(this, void 0, void 0, function* () {
766
+ const { overlay } = this.getOverlay(overlayId);
767
+ return overlay.deleteConversation(conversationId);
768
+ });
769
+ }
770
+ replayConversation(overlayId, conversationId) {
771
+ return __awaiter(this, void 0, void 0, function* () {
772
+ const { overlay } = this.getOverlay(overlayId);
773
+ return overlay.createPlaybackConversation(conversationId);
774
+ });
775
+ }
776
+ exportConversation(overlayId, conversationId) {
777
+ return __awaiter(this, void 0, void 0, function* () {
778
+ const { overlay } = this.getOverlay(overlayId);
779
+ return overlay.exportConversation(conversationId);
780
+ });
781
+ }
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);
679
790
  return overlay.subscribe(eventType, callback);
680
791
  }
681
792
  /**
682
793
  * Get reference to overlay from this.overlay with specified id
683
794
  * Throws exception if there is no such overlay with specified id
684
- * @param id {string} id of overlay that should be returned
795
+ * @param overlayId {string} id of overlay that should be returned
685
796
  * @returns {Overlay} reference to overlay with specified id
686
797
  */
687
- getOverlay(id) {
688
- const overlay = this.overlays.find(({ options }) => options.id === id);
798
+ getOverlay(overlayId) {
799
+ const overlay = this.overlays.find(({ options }) => options.id === overlayId);
689
800
  if (!overlay)
690
- throw new Error(`There is no overlay with ${id}`);
801
+ throw new Error(`There is no overlay with ${overlayId}`);
691
802
  return overlay;
692
803
  }
693
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.6",
5
+ "version": "0.31.0-rc.61",
6
6
  "dependencies": {
7
- "@epam/ai-dial-shared": "0.31.0-rc.6"
7
+ "@epam/ai-dial-shared": "0.31.0-rc.61"
8
8
  },
9
9
  "type": "module",
10
10
  "bugs": {
@@ -1,4 +1,4 @@
1
- import { ChatOverlayOptions, CreateConversationResponse, DeferredRequest, GetConversationsResponse, GetMessagesResponse, OverlayRequest, OverlayRequests, 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,12 +94,47 @@ 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
100
105
  * @returns Returns selected conversation info
101
106
  */
102
107
  selectConversation(id: string): Promise<SelectConversationResponse>;
108
+ /**
109
+ * Delete conversation
110
+ * @param {string} id - id of conversation to delete
111
+ */
112
+ deleteConversation(id: string): Promise<void>;
113
+ /**
114
+ * Rename conversation
115
+ * @param {string} id - id of conversation to rename
116
+ * @param {string} newName - new name of conversation
117
+ * @returns Returns renamed conversation info
118
+ */
119
+ renameConversation(id: string, newName: string): Promise<RenameConversationResponse>;
120
+ /**
121
+ * Create playback conversation
122
+ * @param {string} id - id of conversation from create playback
123
+ * @returns Returns newly created playback conversation info
124
+ */
125
+ createPlaybackConversation(id: string): Promise<CreatePlaybackConversationResponse>;
126
+ /**
127
+ * Export conversation
128
+ * @param {string} id - id of conversation to export
129
+ * @returns Returns exported conversation object
130
+ */
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>;
103
138
  /**
104
139
  * Create conversation
105
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,40 +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 id {string} id of overlay that should be deleted
67
+ * @param overlayId {string} id of overlay that should be deleted
68
68
  */
69
- removeOverlay(id: string): void;
70
- openFullscreen(id: string): void;
69
+ removeOverlay(overlayId: string): void;
70
+ openFullscreen(overlayId: string): void;
71
71
  /**
72
72
  * Shows overlay with specified id
73
- * @param id {string} id of overlay that should be shown
73
+ * @param overlayId {string} id of overlay that should be shown
74
74
  */
75
- showOverlay(id: string): void;
75
+ showOverlay(overlayId: string): void;
76
76
  /**
77
77
  * Hides overlay with specified id
78
- * @param id {string} id of overlay that should be hidden
78
+ * @param overlayId {string} id of overlay that should be hidden
79
79
  */
80
- hideOverlay(id: string): void;
80
+ hideOverlay(overlayId: string): void;
81
81
  /**
82
82
  * Checks the current viewport and updates position, styles if needed
83
- * @param id {string} id of overlay that should be updated
83
+ * @param overlayId {string} id of overlay that should be updated
84
84
  */
85
- updateOverlay(id: string): void;
86
- setSystemPrompt(id: string, systemPrompt: string): Promise<void>;
87
- getMessages(id: string): Promise<import("@epam/ai-dial-shared").GetMessagesResponse>;
88
- sendMessage(id: string, content: string): Promise<void>;
89
- getConversations(id: string): Promise<import("@epam/ai-dial-shared").GetConversationsResponse>;
90
- createConversation(id: string, parentPath?: string | null): Promise<import("@epam/ai-dial-shared").CreateConversationResponse>;
91
- selectConversation(id: string, conversationId: string): Promise<import("@epam/ai-dial-shared").SelectConversationResponse>;
92
- setOverlayOptions(id: string, options: ChatOverlayOptions): Promise<void>;
93
- subscribe(id: string, eventType: string, callback: (payload?: unknown) => void): () => void;
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;
94
100
  /**
95
101
  * Get reference to overlay from this.overlay with specified id
96
102
  * Throws exception if there is no such overlay with specified id
97
- * @param id {string} id of overlay that should be returned
103
+ * @param overlayId {string} id of overlay that should be returned
98
104
  * @returns {Overlay} reference to overlay with specified id
99
105
  */
100
- protected getOverlay(id: string): Overlay;
106
+ protected getOverlay(overlayId: string): Overlay;
101
107
  /**
102
108
  * Checks that window has mobile view
103
109
  * @returns {boolean} Returns true if window has mobile view