@hivegpt/hiveai-angular 0.0.156 → 0.0.159
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 +100 -45
- 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/environments/environment.js +3 -3
- package/esm2015/hivegpt-hiveai-angular.js +4 -3
- package/esm2015/lib/components/NotificationSocket.js +25 -0
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +19 -14
- package/esm2015/lib/components/conversation.service.js +10 -1
- package/esm2015/lib/components/socket-service.service.js +45 -27
- package/fesm2015/hivegpt-hiveai-angular.js +95 -43
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.d.ts +3 -2
- package/hivegpt-hiveai-angular.d.ts.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/NotificationSocket.d.ts +5 -0
- package/lib/components/NotificationSocket.d.ts.map +1 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +4 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts +4 -0
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/lib/components/socket-service.service.d.ts +16 -8
- package/lib/components/socket-service.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@angular/platform-browser'), require('rxjs'), require('rxjs/operators'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@hivegpt/hiveai-angular', ['exports', '@angular/common/http', '@angular/core', '@angular/platform-browser', 'rxjs', 'rxjs/operators', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hivegpt = global.hivegpt || {}, global.hivegpt['hiveai-angular'] = {}), global.ng.common.http, global.ng.core, global.ng.platformBrowser, global.rxjs, global.rxjs.operators, global.
|
|
5
|
-
}(this, (function (exports, http, i0, platformBrowser, rxjs, operators,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@angular/platform-browser'), require('rxjs'), require('rxjs/operators'), require('ngx-socket-io'), require('@angular/common'), require('@angular/forms'), require('@angular/material/icon'), require('@angular/material/sidenav')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@hivegpt/hiveai-angular', ['exports', '@angular/common/http', '@angular/core', '@angular/platform-browser', 'rxjs', 'rxjs/operators', 'ngx-socket-io', '@angular/common', '@angular/forms', '@angular/material/icon', '@angular/material/sidenav'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hivegpt = global.hivegpt || {}, global.hivegpt['hiveai-angular'] = {}), global.ng.common.http, global.ng.core, global.ng.platformBrowser, global.rxjs, global.rxjs.operators, global.ngxSocketIo, global.ng.common, global.ng.forms, global.ng.material.icon, global.ng.material.sidenav));
|
|
5
|
+
}(this, (function (exports, http, i0, platformBrowser, rxjs, operators, ngxSocketIo, common, forms, icon, sidenav) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -508,19 +508,20 @@
|
|
|
508
508
|
BASE_URL: 'https://agent-api.hivegpt.ai',
|
|
509
509
|
AGENTS_API: 'https://hive-ai.social27.com/api',
|
|
510
510
|
API_KEY: 'b621eb3f-0bd2-41d5-a48c-a8f8ab7d38f8',
|
|
511
|
-
SocketUrl: 'notif-v2-api.social27.com/api/notifications'
|
|
511
|
+
SocketUrl: 'https://notif-v2-api.social27.com/api/notifications'
|
|
512
512
|
};
|
|
513
513
|
var dev_environment = {
|
|
514
514
|
USERS_API: 'https://pre-user.social27.com/api',
|
|
515
515
|
BASE_URL: 'https://agent-api.hivegpt.ai',
|
|
516
516
|
AGENTS_API: 'https://hive-ai.social27.com/api',
|
|
517
517
|
API_KEY: 'b621eb3f-0bd2-41d5-a48c-a8f8ab7d38f8',
|
|
518
|
-
SocketUrl: 'notif-v2-api.social27.com/api/notifications'
|
|
518
|
+
SocketUrl: 'https://notif-v2-api.social27.com/api/notifications'
|
|
519
519
|
};
|
|
520
520
|
|
|
521
521
|
var ConversationService = /** @class */ (function () {
|
|
522
522
|
function ConversationService() {
|
|
523
523
|
this.storageKey = 'conversationKey';
|
|
524
|
+
this.userSepecificNotification = new rxjs.Subject();
|
|
524
525
|
}
|
|
525
526
|
ConversationService.prototype.generateKey = function () {
|
|
526
527
|
var timestamp = Math.floor(new Date().getTime() / 1000).toString(16);
|
|
@@ -543,6 +544,13 @@
|
|
|
543
544
|
this.ensureKeyExists(storageKey, key);
|
|
544
545
|
return localStorage.getItem(storageKey);
|
|
545
546
|
};
|
|
547
|
+
ConversationService.prototype.sendValidatedUserData = function (message) {
|
|
548
|
+
//console.log('lgging messages', message, new Date());\
|
|
549
|
+
this.userSepecificNotification.next(message);
|
|
550
|
+
};
|
|
551
|
+
ConversationService.prototype.getUserSpecificNotification = function () {
|
|
552
|
+
return this.userSepecificNotification.asObservable();
|
|
553
|
+
};
|
|
546
554
|
return ConversationService;
|
|
547
555
|
}());
|
|
548
556
|
ConversationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ConversationService_Factory() { return new ConversationService(); }, token: ConversationService, providedIn: "root" });
|
|
@@ -553,45 +561,86 @@
|
|
|
553
561
|
];
|
|
554
562
|
ConversationService.ctorParameters = function () { return []; };
|
|
555
563
|
|
|
564
|
+
var NotificationSocket = /** @class */ (function (_super) {
|
|
565
|
+
__extends(NotificationSocket, _super);
|
|
566
|
+
function NotificationSocket() {
|
|
567
|
+
return _super.call(this, socketConfig) || this;
|
|
568
|
+
}
|
|
569
|
+
return NotificationSocket;
|
|
570
|
+
}(ngxSocketIo.Socket));
|
|
571
|
+
NotificationSocket.decorators = [
|
|
572
|
+
{ type: i0.Injectable }
|
|
573
|
+
];
|
|
574
|
+
NotificationSocket.ctorParameters = function () { return []; };
|
|
575
|
+
var socketConfig = {
|
|
576
|
+
url: prod_environment.SocketUrl,
|
|
577
|
+
options: {
|
|
578
|
+
transports: ['websocket', 'polling'],
|
|
579
|
+
reconnection: true,
|
|
580
|
+
autoConnect: true,
|
|
581
|
+
upgrade: true,
|
|
582
|
+
reconnectionDelay: 1000,
|
|
583
|
+
reconnectionDelayMax: 5000,
|
|
584
|
+
reconnectionAttempts: Infinity
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
556
588
|
var SocketService = /** @class */ (function () {
|
|
557
|
-
function SocketService() {
|
|
558
|
-
this.
|
|
589
|
+
function SocketService(conversationService, notificationSocket) {
|
|
590
|
+
this.conversationService = conversationService;
|
|
591
|
+
this.notificationSocket = notificationSocket;
|
|
592
|
+
this.isCommonSocketInitialized = false;
|
|
593
|
+
this.isUserSpecificSocketInitialized = false;
|
|
594
|
+
this.isUserSpecificEventReleased = true;
|
|
595
|
+
this.messageQueue = [];
|
|
596
|
+
this.releaseInterval = 1000;
|
|
597
|
+
this.intervalSetup = false;
|
|
598
|
+
this.startReleasingMessages();
|
|
559
599
|
}
|
|
560
|
-
SocketService.prototype.
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
};
|
|
566
|
-
SocketService.prototype.onMessage = function (message) {
|
|
567
|
-
console.log('Received message:', message);
|
|
568
|
-
// Handle incoming messages
|
|
600
|
+
SocketService.prototype.isSocketInitialized = function (isCommon) {
|
|
601
|
+
return isCommon
|
|
602
|
+
? this.isCommonSocketInitialized
|
|
603
|
+
: this.isUserSpecificSocketInitialized &&
|
|
604
|
+
!this.isUserSpecificEventReleased;
|
|
569
605
|
};
|
|
570
|
-
SocketService.prototype.
|
|
571
|
-
this.
|
|
606
|
+
SocketService.prototype.disconnectSocketConnection = function () {
|
|
607
|
+
this.notificationSocket.disconnect();
|
|
572
608
|
};
|
|
573
|
-
SocketService.prototype.
|
|
574
|
-
this
|
|
609
|
+
SocketService.prototype.registerUserSpecificHiveSocket = function (botId, conversation_id) {
|
|
610
|
+
var _this = this;
|
|
611
|
+
this.notificationSocket.emit('joinData', {
|
|
612
|
+
groupId: "Hive_AI_Notifs_" + botId + "_" + conversation_id,
|
|
613
|
+
});
|
|
614
|
+
this.notificationSocket
|
|
615
|
+
.fromEvent('commonNotification')
|
|
616
|
+
.subscribe(function (res) {
|
|
617
|
+
_this.conversationService.sendValidatedUserData(res);
|
|
618
|
+
});
|
|
575
619
|
};
|
|
576
|
-
SocketService.prototype.
|
|
620
|
+
SocketService.prototype.startReleasingMessages = function () {
|
|
577
621
|
var _this = this;
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (
|
|
581
|
-
|
|
622
|
+
if (!this.intervalSetup) {
|
|
623
|
+
setInterval(function () {
|
|
624
|
+
if (_this.messageQueue.length > 0) {
|
|
625
|
+
var message = _this.messageQueue.shift(); // Remove the first message from the queue
|
|
626
|
+
// this.campaignService.sendValidatedUserData(message);
|
|
582
627
|
}
|
|
583
|
-
});
|
|
584
|
-
|
|
628
|
+
}, this.releaseInterval);
|
|
629
|
+
this.intervalSetup = true; // Prevents multiple intervals
|
|
630
|
+
}
|
|
585
631
|
};
|
|
586
632
|
return SocketService;
|
|
587
633
|
}());
|
|
588
|
-
SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(); }, token: SocketService, providedIn: "root" });
|
|
634
|
+
SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(i0.ɵɵinject(ConversationService), i0.ɵɵinject(NotificationSocket)); }, token: SocketService, providedIn: "root" });
|
|
589
635
|
SocketService.decorators = [
|
|
590
636
|
{ type: i0.Injectable, args: [{
|
|
591
637
|
providedIn: 'root'
|
|
592
638
|
},] }
|
|
593
639
|
];
|
|
594
|
-
SocketService.ctorParameters = function () { return [
|
|
640
|
+
SocketService.ctorParameters = function () { return [
|
|
641
|
+
{ type: ConversationService },
|
|
642
|
+
{ type: NotificationSocket }
|
|
643
|
+
]; };
|
|
595
644
|
|
|
596
645
|
var ChatDrawerComponent = /** @class */ (function () {
|
|
597
646
|
function ChatDrawerComponent(cdr, http, sanitizer, elementRef, renderer, socketService, conversation
|
|
@@ -726,22 +775,27 @@
|
|
|
726
775
|
this.fetchAgents();
|
|
727
776
|
this.cdr.markForCheck();
|
|
728
777
|
this.initializeSocketAndListen();
|
|
778
|
+
setTimeout(function () {
|
|
779
|
+
_this.listenSockets();
|
|
780
|
+
}, 200);
|
|
729
781
|
};
|
|
730
|
-
ChatDrawerComponent.prototype.
|
|
782
|
+
ChatDrawerComponent.prototype.initializeSocket = function () {
|
|
783
|
+
this.socketService.registerUserSpecificHiveSocket(this.botId, this.conversationKey);
|
|
784
|
+
};
|
|
785
|
+
ChatDrawerComponent.prototype.listenSockets = function () {
|
|
731
786
|
var _this = this;
|
|
732
|
-
this.eventSubscription = this.
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
_this.
|
|
739
|
-
|
|
740
|
-
this.eventSubscription = this.socketService.onEvent('graph').subscribe(function (data) {
|
|
741
|
-
console.log('Event received graph:', data);
|
|
742
|
-
_this.handleEvent(data, 'graph');
|
|
787
|
+
this.eventSubscription = this.conversation
|
|
788
|
+
.getUserSpecificNotification()
|
|
789
|
+
.subscribe(function (res) {
|
|
790
|
+
console.log("Socket Data");
|
|
791
|
+
console.log(res);
|
|
792
|
+
}, function (err) {
|
|
793
|
+
_this.eventSubscription.unsubscribe();
|
|
794
|
+
console.error('Error in fetching data from socket');
|
|
743
795
|
});
|
|
744
796
|
};
|
|
797
|
+
ChatDrawerComponent.prototype.initializeSocketAndListen = function () {
|
|
798
|
+
};
|
|
745
799
|
ChatDrawerComponent.prototype.handleEvent = function (data, type) {
|
|
746
800
|
switch (type) {
|
|
747
801
|
case 'webresult':
|
|
@@ -758,7 +812,7 @@
|
|
|
758
812
|
if (this.eventSubscription) {
|
|
759
813
|
this.eventSubscription.unsubscribe();
|
|
760
814
|
}
|
|
761
|
-
this.socketService.close();
|
|
815
|
+
//this.socketService.close();
|
|
762
816
|
};
|
|
763
817
|
ChatDrawerComponent.prototype.changeTemperature = function (newTemperature) {
|
|
764
818
|
if (this.loading)
|
|
@@ -1882,8 +1936,9 @@
|
|
|
1882
1936
|
exports.HiveGptModule = HiveGptModule;
|
|
1883
1937
|
exports.ɵa = SocketService;
|
|
1884
1938
|
exports.ɵb = ConversationService;
|
|
1885
|
-
exports.ɵc =
|
|
1886
|
-
exports.ɵd =
|
|
1939
|
+
exports.ɵc = NotificationSocket;
|
|
1940
|
+
exports.ɵd = VideoPlayerComponent;
|
|
1941
|
+
exports.ɵe = SafeHtmlPipe;
|
|
1887
1942
|
|
|
1888
1943
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1889
1944
|
|