@hivegpt/hiveai-angular 0.0.353 → 0.0.355
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/bundles/hivegpt-hiveai-angular.umd.js +27 -8
- package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +12 -3
- package/esm2015/lib/components/conversation.service.js +17 -8
- package/fesm2015/hivegpt-hiveai-angular.js +27 -9
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +1 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts +4 -2
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -520,8 +520,9 @@
|
|
|
520
520
|
|
|
521
521
|
var ConversationService = /** @class */ (function () {
|
|
522
522
|
function ConversationService() {
|
|
523
|
-
this.
|
|
524
|
-
this.
|
|
523
|
+
this.conversationStorageKeyPrefix = 'conversationKey_';
|
|
524
|
+
this.sessionStorageKeyPrefix = 'sessionKey_';
|
|
525
|
+
this.userSpecificNotification = new rxjs.Subject();
|
|
525
526
|
}
|
|
526
527
|
ConversationService.prototype.generateKey = function () {
|
|
527
528
|
var timestamp = Math.floor(new Date().getTime() / 1000).toString(16);
|
|
@@ -532,7 +533,17 @@
|
|
|
532
533
|
};
|
|
533
534
|
ConversationService.prototype.getKey = function (botId, resetKey) {
|
|
534
535
|
if (resetKey === void 0) { resetKey = false; }
|
|
535
|
-
var storageKey = "
|
|
536
|
+
var storageKey = "" + this.conversationStorageKeyPrefix + botId;
|
|
537
|
+
var value = localStorage.getItem(storageKey);
|
|
538
|
+
if (!value || resetKey) {
|
|
539
|
+
value = this.generateKey();
|
|
540
|
+
localStorage.setItem(storageKey, value);
|
|
541
|
+
}
|
|
542
|
+
return value;
|
|
543
|
+
};
|
|
544
|
+
ConversationService.prototype.getSessionKey = function (sessionId, resetKey) {
|
|
545
|
+
if (resetKey === void 0) { resetKey = false; }
|
|
546
|
+
var storageKey = "" + this.sessionStorageKeyPrefix + sessionId;
|
|
536
547
|
var value = localStorage.getItem(storageKey);
|
|
537
548
|
if (!value || resetKey) {
|
|
538
549
|
value = this.generateKey();
|
|
@@ -541,11 +552,10 @@
|
|
|
541
552
|
return value;
|
|
542
553
|
};
|
|
543
554
|
ConversationService.prototype.sendValidatedUserData = function (message) {
|
|
544
|
-
|
|
545
|
-
this.userSepecificNotification.next(message);
|
|
555
|
+
this.userSpecificNotification.next(message);
|
|
546
556
|
};
|
|
547
557
|
ConversationService.prototype.getUserSpecificNotification = function () {
|
|
548
|
-
return this.
|
|
558
|
+
return this.userSpecificNotification.asObservable();
|
|
549
559
|
};
|
|
550
560
|
return ConversationService;
|
|
551
561
|
}());
|
|
@@ -755,6 +765,7 @@
|
|
|
755
765
|
this.showFeedBackIconsIndex = null;
|
|
756
766
|
this.temperature = 1;
|
|
757
767
|
this.speakers = [];
|
|
768
|
+
this.conSessionKey = '';
|
|
758
769
|
this.currentWorkflowActionProgress = 0;
|
|
759
770
|
this.currentWorkflowAction = '';
|
|
760
771
|
this.recognizedText = '';
|
|
@@ -1091,7 +1102,7 @@
|
|
|
1091
1102
|
_this.greetingMsg = res.Greeting;
|
|
1092
1103
|
_this.thumbsDownMessages = ((_a = res === null || res === void 0 ? void 0 : res.NegativeResponses) === null || _a === void 0 ? void 0 : _a.length) ? res.NegativeResponses
|
|
1093
1104
|
: [
|
|
1094
|
-
"We are sorry we've not been able to answer your question.<br/> However, our dedicated support team is happy to help. <span class='feedback-link' style='cursor: pointer; text-decoration: underline; font-weight: 700; color: #17235B;'><a style='color: inherit; text-decoration: none;'
|
|
1105
|
+
"We are sorry we've not been able to answer your question.<br/> However, our dedicated support team is happy to help. <span class='feedback-link' style='cursor: pointer; text-decoration: underline; font-weight: 700; color: #17235B;'><a style='color: inherit; text-decoration: none;' id='supportLink88' >Please click here</a></span> and a human agent will assist you as soon as possible",
|
|
1095
1106
|
];
|
|
1096
1107
|
_this.quickPrompts = res.QuickPrompts;
|
|
1097
1108
|
_this.cdr.markForCheck();
|
|
@@ -1106,7 +1117,8 @@
|
|
|
1106
1117
|
ChatDrawerComponent.prototype.fetchChatHistory = function () {
|
|
1107
1118
|
this.loading = true;
|
|
1108
1119
|
this.conversationKey = this.conversationService.getKey(this.botId, false);
|
|
1109
|
-
|
|
1120
|
+
this.conSessionKey = this.conversationService.getSessionKey(this.botId, false);
|
|
1121
|
+
var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey + "?session_id=" + this.conSessionKey;
|
|
1110
1122
|
var headers = new i1.HttpHeaders({
|
|
1111
1123
|
accept: 'application/json',
|
|
1112
1124
|
'x-api-key': this.apiKey,
|
|
@@ -1504,6 +1516,12 @@
|
|
|
1504
1516
|
(_this.thumbsDownMsgIndex + 1) % _this.thumbsDownMessages.length;
|
|
1505
1517
|
_this.scrollToBottom();
|
|
1506
1518
|
_this.cdr.markForCheck();
|
|
1519
|
+
setTimeout(function () {
|
|
1520
|
+
var supportLink = document.getElementById('supportLink88');
|
|
1521
|
+
if (supportLink) {
|
|
1522
|
+
supportLink.addEventListener('click', _this.triggerSupport.bind(_this));
|
|
1523
|
+
}
|
|
1524
|
+
}, 200);
|
|
1507
1525
|
_this.feedbackDone = false;
|
|
1508
1526
|
_this.showFeedBackIconsIndex = null;
|
|
1509
1527
|
});
|
|
@@ -2163,6 +2181,7 @@
|
|
|
2163
2181
|
user_id: this.userId,
|
|
2164
2182
|
bot_id: this.botId,
|
|
2165
2183
|
message_id: this.conversationService.generateKey(),
|
|
2184
|
+
session_id: this.conSessionKey,
|
|
2166
2185
|
agents: (_a = agents === null || agents === void 0 ? void 0 : agents.filter(function (p) { return p.selected; }).map(function (p) { return p.id; })) !== null && _a !== void 0 ? _a : [],
|
|
2167
2186
|
conversation_id: conversationId,
|
|
2168
2187
|
first_name: this.firstName,
|