@hivegpt/hiveai-angular 0.0.372 → 0.0.374

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.
Files changed (87) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +10 -10
  4. package/src/environments/environment.ts +19 -0
  5. package/src/lib/components/NotificationSocket.ts +38 -0
  6. package/src/lib/components/bot-html-editor/bot-html-editor.component.css +10 -0
  7. package/src/lib/components/bot-html-editor/bot-html-editor.component.html +11 -0
  8. package/src/lib/components/bot-html-editor/bot-html-editor.component.spec.ts +25 -0
  9. package/src/lib/components/bot-html-editor/bot-html-editor.component.ts +152 -0
  10. package/src/lib/components/bot.service.ts +52 -0
  11. package/src/lib/components/chat-drawer/chat-drawer.component.html +1586 -0
  12. package/src/lib/components/chat-drawer/chat-drawer.component.scss +2907 -0
  13. package/src/lib/components/chat-drawer/chat-drawer.component.ts +2143 -0
  14. package/src/lib/components/chatbot/chatbot.component.html +37 -0
  15. package/src/lib/components/chatbot/chatbot.component.scss +97 -0
  16. package/src/lib/components/chatbot/chatbot.component.ts +44 -0
  17. package/src/lib/components/conversation.service.spec.ts +16 -0
  18. package/src/lib/components/conversation.service.ts +54 -0
  19. package/src/lib/components/socket-service.service.spec.ts +16 -0
  20. package/src/lib/components/socket-service.service.ts +77 -0
  21. package/src/lib/components/translations/translation.service.ts +254 -0
  22. package/src/lib/components/video-player/video-player.component.html +51 -0
  23. package/src/lib/components/video-player/video-player.component.scss +262 -0
  24. package/src/lib/components/video-player/video-player.component.ts +148 -0
  25. package/src/lib/hivegpt.module.ts +18 -0
  26. package/src/lib/models/video.ts +36 -0
  27. package/src/lib/pipes/safe-html.pipe.ts +16 -0
  28. package/src/lib/utils/utils.ts +37 -0
  29. package/{public-api.d.ts → src/public-api.ts} +4 -1
  30. package/tsconfig.lib.json +25 -0
  31. package/tsconfig.lib.prod.json +10 -0
  32. package/tsconfig.spec.json +17 -0
  33. package/tslint.json +17 -0
  34. package/bundles/hivegpt-hiveai-angular.umd.js +0 -3116
  35. package/bundles/hivegpt-hiveai-angular.umd.js.map +0 -1
  36. package/bundles/hivegpt-hiveai-angular.umd.min.js +0 -2
  37. package/bundles/hivegpt-hiveai-angular.umd.min.js.map +0 -1
  38. package/environments/environment.d.ts +0 -15
  39. package/environments/environment.d.ts.map +0 -1
  40. package/esm2015/environments/environment.js +0 -15
  41. package/esm2015/hivegpt-hiveai-angular.js +0 -13
  42. package/esm2015/lib/components/NotificationSocket.js +0 -39
  43. package/esm2015/lib/components/bot-html-editor/bot-html-editor.component.js +0 -112
  44. package/esm2015/lib/components/bot.service.js +0 -50
  45. package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +0 -1743
  46. package/esm2015/lib/components/chatbot/chatbot.component.js +0 -50
  47. package/esm2015/lib/components/conversation.service.js +0 -49
  48. package/esm2015/lib/components/socket-service.service.js +0 -72
  49. package/esm2015/lib/components/translations/translation.service.js +0 -215
  50. package/esm2015/lib/components/video-player/video-player.component.js +0 -123
  51. package/esm2015/lib/hivegpt.module.js +0 -21
  52. package/esm2015/lib/models/video.js +0 -2
  53. package/esm2015/lib/pipes/safe-html.pipe.js +0 -19
  54. package/esm2015/lib/utils/utils.js +0 -36
  55. package/esm2015/public-api.js +0 -7
  56. package/fesm2015/hivegpt-hiveai-angular.js +0 -2512
  57. package/fesm2015/hivegpt-hiveai-angular.js.map +0 -1
  58. package/hivegpt-hiveai-angular.d.ts +0 -13
  59. package/hivegpt-hiveai-angular.d.ts.map +0 -1
  60. package/hivegpt-hiveai-angular.metadata.json +0 -1
  61. package/lib/components/NotificationSocket.d.ts +0 -5
  62. package/lib/components/NotificationSocket.d.ts.map +0 -1
  63. package/lib/components/bot-html-editor/bot-html-editor.component.d.ts +0 -36
  64. package/lib/components/bot-html-editor/bot-html-editor.component.d.ts.map +0 -1
  65. package/lib/components/bot.service.d.ts +0 -12
  66. package/lib/components/bot.service.d.ts.map +0 -1
  67. package/lib/components/chat-drawer/chat-drawer.component.d.ts +0 -255
  68. package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +0 -1
  69. package/lib/components/chatbot/chatbot.component.d.ts +0 -36
  70. package/lib/components/chatbot/chatbot.component.d.ts.map +0 -1
  71. package/lib/components/conversation.service.d.ts +0 -13
  72. package/lib/components/conversation.service.d.ts.map +0 -1
  73. package/lib/components/socket-service.service.d.ts +0 -20
  74. package/lib/components/socket-service.service.d.ts.map +0 -1
  75. package/lib/components/translations/translation.service.d.ts +0 -8
  76. package/lib/components/translations/translation.service.d.ts.map +0 -1
  77. package/lib/components/video-player/video-player.component.d.ts +0 -36
  78. package/lib/components/video-player/video-player.component.d.ts.map +0 -1
  79. package/lib/hivegpt.module.d.ts +0 -3
  80. package/lib/hivegpt.module.d.ts.map +0 -1
  81. package/lib/models/video.d.ts +0 -35
  82. package/lib/models/video.d.ts.map +0 -1
  83. package/lib/pipes/safe-html.pipe.d.ts +0 -8
  84. package/lib/pipes/safe-html.pipe.d.ts.map +0 -1
  85. package/lib/utils/utils.d.ts +0 -3
  86. package/lib/utils/utils.d.ts.map +0 -1
  87. package/public-api.d.ts.map +0 -1
package/karma.conf.js ADDED
@@ -0,0 +1,32 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ coverageIstanbulReporter: {
19
+ dir: require('path').join(__dirname, '../../../coverage/hivegpt/eventsgpt-angular'),
20
+ reports: ['html', 'lcovonly', 'text-summary'],
21
+ fixWebpackSourcePaths: true
22
+ },
23
+ reporters: ['progress', 'kjhtml'],
24
+ port: 9876,
25
+ colors: true,
26
+ logLevel: config.LOG_INFO,
27
+ autoWatch: true,
28
+ browsers: ['Chrome'],
29
+ singleRun: false,
30
+ restartOnFileChange: true
31
+ });
32
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/hivegpt/eventsgpt-angular",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@hivegpt/hiveai-angular",
3
- "version": "0.0.372",
3
+ "version": "0.0.374",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^10.2.5",
6
6
  "@angular/core": "^10.2.5",
7
7
  "microsoft-cognitiveservices-speech-sdk": "^1.17.0"
8
8
  },
9
+ "scripts": {
10
+ "ng": "ng",
11
+ "start": "ng serve",
12
+ "build": "ng build",
13
+ "test": "ng test",
14
+ "lint": "ng lint",
15
+ "e2e": "ng e2e"
16
+ },
9
17
  "dependencies": {
10
18
  "tslib": "^2.0.0"
11
- },
12
- "main": "bundles/hivegpt-hiveai-angular.umd.js",
13
- "module": "fesm2015/hivegpt-hiveai-angular.js",
14
- "es2015": "fesm2015/hivegpt-hiveai-angular.js",
15
- "esm2015": "esm2015/hivegpt-hiveai-angular.js",
16
- "fesm2015": "fesm2015/hivegpt-hiveai-angular.js",
17
- "typings": "hivegpt-hiveai-angular.d.ts",
18
- "metadata": "hivegpt-hiveai-angular.metadata.json",
19
- "sideEffects": false
19
+ }
20
20
  }
@@ -0,0 +1,19 @@
1
+
2
+
3
+ export const prod_environment = {
4
+ USERS_API: 'https://es-user.social27.com/api',
5
+ BASE_URL: 'https://agent-api.hivegpt.ai',
6
+ AGENTS_API: 'https://hive-ai.social27.com/api',
7
+ API_KEY: '82595783-dc9c-4513-8204-709818d51be3',
8
+ SocketUrl: 'https://notif-v2-ws.social27.com/'
9
+ }
10
+
11
+
12
+ export const dev_environment = {
13
+ USERS_API: 'https://pre-user.social27.com/api',
14
+ BASE_URL: 'https://pre-agent-api.hivegpt.ai',
15
+ AGENTS_API: 'https://hive-pre-ai.social27.com/api',
16
+ API_KEY: '66d59244c50b8fb597a101t1',
17
+ SocketUrl: 'https://notif-ws-staging.social27.com/',
18
+ };
19
+
@@ -0,0 +1,38 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Socket, SocketIoConfig } from 'ngx-socket-io';
3
+ import { prod_environment } from '../../environments/environment';
4
+
5
+ @Injectable({
6
+ providedIn: 'root' // This ensures the service is available across the application
7
+ })
8
+ export class NotificationSocket extends Socket {
9
+ constructor() {
10
+ super(socketConfig);
11
+
12
+ // Log connection status
13
+ this.on('connect', () => {
14
+ console.log('Socket connected');
15
+ });
16
+
17
+ this.on('disconnect', () => {
18
+ console.warn('Socket disconnected');
19
+ });
20
+
21
+ this.on('connect_error', (err) => {
22
+ console.error('Socket connection error:', err);
23
+ });
24
+ }
25
+ }
26
+
27
+ const socketConfig: SocketIoConfig = {
28
+ url: prod_environment.SocketUrl,
29
+ options: {
30
+ transports: ['websocket', 'polling'],
31
+ reconnection: true,
32
+ autoConnect: true,
33
+ upgrade: true,
34
+ reconnectionDelay: 1000,
35
+ reconnectionDelayMax: 5000,
36
+ reconnectionAttempts: Infinity
37
+ }
38
+ };
@@ -0,0 +1,10 @@
1
+ .save-btn
2
+ {
3
+ background-color: #f0f0f0;
4
+ border: none;
5
+ color: #333;
6
+ width: 56px;
7
+ position: absolute;
8
+ right: 16px;
9
+ margin-top: 22px;
10
+ }
@@ -0,0 +1,11 @@
1
+ <div style="padding: 12px">
2
+ <div style="margin-top: 42px" class="form-group">
3
+ <input [(ngModel)]="documentName" class="form-control" type="text" />
4
+ <button (click)="saveContent()" class="save-btn">Save</button>
5
+ </div>
6
+
7
+ <quill-editor
8
+ [(ngModel)]="editorContent"
9
+ [modules]="quillConfig"
10
+ ></quill-editor>
11
+ </div>
@@ -0,0 +1,25 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { BotHtmlEditorComponent } from './bot-html-editor.component';
4
+
5
+ describe('BotHtmlEditorComponent', () => {
6
+ let component: BotHtmlEditorComponent;
7
+ let fixture: ComponentFixture<BotHtmlEditorComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ BotHtmlEditorComponent ]
12
+ })
13
+ .compileComponents();
14
+ });
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(BotHtmlEditorComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,152 @@
1
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ ChangeDetectorRef,
5
+ Component,
6
+ ElementRef,
7
+ EventEmitter,
8
+ Input,
9
+ OnChanges,
10
+ OnInit,
11
+ Output,
12
+ QueryList,
13
+ Renderer2,
14
+ SimpleChanges,
15
+ ViewChild,
16
+ ViewChildren,
17
+ } from '@angular/core';
18
+ import { MatDrawer } from '@angular/material/sidenav';
19
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
20
+ import { of, Subscription } from 'rxjs';
21
+ import { catchError, switchMap } from 'rxjs/operators';
22
+ import { formatNow, formatTimeStamps } from '../../utils/utils';
23
+ import {
24
+ dev_environment,
25
+ prod_environment,
26
+ } from '../../../environments/environment';
27
+ import { ConversationService } from '../conversation.service';
28
+ import { Observable } from 'rxjs';
29
+ import { SocketService } from '../socket-service.service';
30
+
31
+ @Component({
32
+ selector: 'lib-bot-html-editor',
33
+ templateUrl: './bot-html-editor.component.html',
34
+ styleUrls: ['./bot-html-editor.component.css'],
35
+ })
36
+ export class BotHtmlEditorComponent implements OnInit {
37
+ @Input() editorContent: Observable<string>;
38
+ @Input() isDocInEditMode: any;
39
+ @Input() documentContent: any;
40
+ @Input() conversationId: any;
41
+ @Input() botId: any;
42
+
43
+ documentName: any = 'doc name';
44
+
45
+ environment: {
46
+ USERS_API;
47
+ BASE_URL;
48
+ AGENTS_API;
49
+ };
50
+
51
+ quillConfig = {
52
+ toolbar: [
53
+ [{ header: '1' }, { header: '2' }, { font: [] }],
54
+ [{ list: 'ordered' }, { list: 'bullet' }],
55
+ ['bold', 'italic', 'underline'],
56
+ ['link'],
57
+ ['clean'],
58
+ ],
59
+ };
60
+ constructor(private cdr: ChangeDetectorRef, private http: HttpClient) {}
61
+
62
+ ngOnInit(): void {
63
+ this.environment = prod_environment;
64
+
65
+ setTimeout(() => {
66
+ if (this.isDocInEditMode) {
67
+ console.log('In Edit mode');
68
+ this.filldataInForm();
69
+ } else {
70
+ console.log('In save mode');
71
+ }
72
+ }, 2500);
73
+ }
74
+
75
+ filldataInForm() {
76
+ if (this.documentContent) {
77
+ this.documentName = this.documentContent?.name;
78
+ this.editorContent = this.documentContent?.content;
79
+ this.cdr.detectChanges();
80
+ }
81
+ }
82
+
83
+ saveContent() {
84
+ if (!this.isDocInEditMode) {
85
+ this.saveContent_http().subscribe();
86
+ } else {
87
+ this.saveContent_http().subscribe();
88
+ }
89
+ }
90
+
91
+ saveContent_http() {
92
+ console.log('API call function');
93
+
94
+ const url = `${this.environment.AGENTS_API}/ConversationDocuments?conversationId=${this.conversationId}&botId=${this.botId}`;
95
+ const headers = new HttpHeaders({
96
+ 'Content-Type': 'application/json',
97
+ apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
98
+ });
99
+
100
+ let data = {
101
+ name: this.documentName,
102
+ content: this.editorContent,
103
+ };
104
+
105
+ return this.http.post(url, data, { headers }).pipe(
106
+ switchMap((res: any) => {
107
+ if (res) {
108
+ // alert('Saved Successfully');
109
+ }
110
+ this.cdr.markForCheck();
111
+
112
+ return of(res);
113
+ }),
114
+ catchError((error) => {
115
+ console.error('Error fetching chatbot config: ', error);
116
+
117
+ return of(null);
118
+ })
119
+ );
120
+ }
121
+
122
+ updateContent_http() {
123
+ console.log('API call function');
124
+
125
+ const url = `${this.environment.AGENTS_API}/ConversationDocuments/rename?conversationId=${this.conversationId}&botId=${this.botId}`;
126
+ const headers = new HttpHeaders({
127
+ 'Content-Type': 'application/json',
128
+ apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
129
+ });
130
+
131
+ let data = {
132
+ name: this.documentName,
133
+ content: this.editorContent,
134
+ };
135
+
136
+ return this.http.put(url, data, { headers }).pipe(
137
+ switchMap((res: any) => {
138
+ if (res) {
139
+ // alert('Updated Successfully');
140
+ }
141
+ this.cdr.markForCheck();
142
+
143
+ return of(res);
144
+ }),
145
+ catchError((error) => {
146
+ console.error('Error fetching chatbot config: ', error);
147
+
148
+ return of(null);
149
+ })
150
+ );
151
+ }
152
+ }
@@ -0,0 +1,52 @@
1
+ import { HttpClient, HttpParams } from '@angular/common/http';
2
+ import { Injectable } from '@angular/core';
3
+ import { catchError, map } from 'rxjs/operators';
4
+
5
+ import { HttpHeaders } from '@angular/common/http';
6
+ import { Observable, Subject, throwError } from 'rxjs';
7
+ import { AnyRecord } from 'dns';
8
+
9
+ @Injectable({
10
+ providedIn: 'root',
11
+ })
12
+ export class BotsService {
13
+ eventDescription = new Subject();
14
+ bot_api = 'https://agent-api.hivegpt.ai/';
15
+ constructor(private http: HttpClient) { }
16
+
17
+ fetchSpeechAuthorizationToken(botId, apiKey, domain) {
18
+ const headers = new HttpHeaders({
19
+ 'Content-Type': 'application/json',
20
+ 'x-api-key': apiKey,
21
+ 'hive-bot-id': botId,
22
+ 'domain-authority': domain
23
+ });
24
+
25
+ const apiUrl = `${this.bot_api}speech/issue_token`;
26
+ const url = `${apiUrl}`;
27
+ return this.http.get(url, { headers }).pipe(
28
+ map((resp: any) => {
29
+ return resp.token;
30
+ })
31
+ );
32
+ }
33
+
34
+ getWorkflowsByOrgId(orgId: string): Observable<any> {
35
+ const apiUrl = `${this.bot_api}workflows`;
36
+ const url = `${apiUrl}?org_id=${orgId}`;
37
+ return this.http.get(url).pipe(
38
+ map((resp: any) => {
39
+ return resp;
40
+ })
41
+ );
42
+ }
43
+
44
+ getWorkflowExecutionById(executionId: string): Observable<any> {
45
+ const apiUrl = `${this.bot_api}workflows/execution/${executionId}`;
46
+ return this.http.get(apiUrl).pipe(
47
+ map((resp: any) => {
48
+ return resp;
49
+ })
50
+ );
51
+ }
52
+ }