@sunbird-cb/itsm-chatbot 0.0.3-ang-17-20
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 +24 -0
- package/fesm2022/sunbird-cb-itsm-chatbot.mjs +1429 -0
- package/fesm2022/sunbird-cb-itsm-chatbot.mjs.map +1 -0
- package/index.d.ts +206 -0
- package/index.d.ts.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,1429 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, ViewChild, Output, Input, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i6 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i5 from '@angular/router';
|
|
6
|
+
import { NavigationEnd } from '@angular/router';
|
|
7
|
+
import * as i1$1 from '@sunbird-cb/utils-v2';
|
|
8
|
+
import { WsEvents, PipeDurationTransformModule } from '@sunbird-cb/utils-v2';
|
|
9
|
+
import { BehaviorSubject, throwError, Subject } from 'rxjs';
|
|
10
|
+
import * as i1 from '@angular/common/http';
|
|
11
|
+
import { HttpHeaders } from '@angular/common/http';
|
|
12
|
+
import { catchError, share } from 'rxjs/operators';
|
|
13
|
+
import * as i3 from '@angular/material/snack-bar';
|
|
14
|
+
import * as i7 from '@angular/forms';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import * as i8 from '@angular/material/icon';
|
|
17
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
18
|
+
import * as i9 from 'ngx-markdown';
|
|
19
|
+
import { MarkdownModule } from 'ngx-markdown';
|
|
20
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
21
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
22
|
+
|
|
23
|
+
const PROXY_CREATE_V8 = '/apis/proxies/v8';
|
|
24
|
+
const API_END_POINTS = {
|
|
25
|
+
CREATE_USER_API: `${PROXY_CREATE_V8}/discussion/user/v1/create`,
|
|
26
|
+
LANGUAGES: '/api/faq/v1/assistant/available/language',
|
|
27
|
+
CONFIG: '/api/faq/v1/assistant/configs/language',
|
|
28
|
+
AI_GLOBAL_SEARCH: `${PROXY_CREATE_V8}/chatbot/v3/search`,
|
|
29
|
+
AI_CHAT_FEEDBACK: `${PROXY_CREATE_V8}/chatbot/v3/feedbacks/save`,
|
|
30
|
+
AI_GLOBAL_INTERNET_SEARCH: `${PROXY_CREATE_V8}/chatbot/v3/global/search`,
|
|
31
|
+
SUPPORT_AI_START_CHAT: `${PROXY_CREATE_V8}/support/ai/chat/start`,
|
|
32
|
+
SUPPORT_AI_SEND_CHAT: `${PROXY_CREATE_V8}/support/ai/chat/send`,
|
|
33
|
+
};
|
|
34
|
+
class ChatbotService {
|
|
35
|
+
constructor(http) {
|
|
36
|
+
this.http = http;
|
|
37
|
+
this.LANGUAGES = '/api/faq/v1/assistant/available/language';
|
|
38
|
+
this.CONFIG = '/api/faq/v1/assistant/configs/language';
|
|
39
|
+
// getLangugages(): Observable<any> {
|
|
40
|
+
// return this.http.get<any>(`${this.LANGUAGES}`)
|
|
41
|
+
// }
|
|
42
|
+
// getChatData(tabType: any): any {
|
|
43
|
+
// return this.http.post<any>(`${this.CONFIG}`, tabType)
|
|
44
|
+
// }
|
|
45
|
+
this.openSupportAIChatbot = new BehaviorSubject(false);
|
|
46
|
+
this.showNavbarDisplay$ = new BehaviorSubject(true);
|
|
47
|
+
}
|
|
48
|
+
createUser(request) {
|
|
49
|
+
return this.http.post(API_END_POINTS.CREATE_USER_API, request);
|
|
50
|
+
}
|
|
51
|
+
setDiscussionConfig(config) {
|
|
52
|
+
this.discussionCnfig = config;
|
|
53
|
+
}
|
|
54
|
+
getCookie(name) {
|
|
55
|
+
const ca = document.cookie.split(';');
|
|
56
|
+
const caLen = ca.length;
|
|
57
|
+
const cookieName = `${name}=`;
|
|
58
|
+
let c;
|
|
59
|
+
for (let i = 0; i < caLen; i += 1) {
|
|
60
|
+
c = ca[i].replace(/^\s+/g, '');
|
|
61
|
+
if (c.indexOf(cookieName) === 0) {
|
|
62
|
+
return c.substring(cookieName.length, c.length);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
deleteCookie(name) {
|
|
68
|
+
this.setCookie(name, '', -1);
|
|
69
|
+
}
|
|
70
|
+
setCookie(name, value, expireDays, path = '') {
|
|
71
|
+
const d = new Date();
|
|
72
|
+
d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000);
|
|
73
|
+
const expires = `expires=${d.toUTCString()}`;
|
|
74
|
+
const cpath = path ? `; path=${path}` : '';
|
|
75
|
+
document.cookie = `${name}=${value}; ${expires}${cpath}`;
|
|
76
|
+
}
|
|
77
|
+
getChatData(tabType) {
|
|
78
|
+
return this.http.post(`${API_END_POINTS.CONFIG}`, tabType);
|
|
79
|
+
}
|
|
80
|
+
getLangugages() {
|
|
81
|
+
return this.http.get(`${API_END_POINTS.LANGUAGES}`);
|
|
82
|
+
}
|
|
83
|
+
aiGlobalSearch(requestBody, chatId, userID) {
|
|
84
|
+
return this.http.post(`${API_END_POINTS.AI_GLOBAL_SEARCH}?chatID=${chatId}&userID=${userID}`, requestBody).pipe(catchError(error => {
|
|
85
|
+
if (error.status === 502) {
|
|
86
|
+
console.error('502 Bad Gateway from aiGlobalSearch');
|
|
87
|
+
}
|
|
88
|
+
else if (error.status === 500) {
|
|
89
|
+
console.error('500 Internal Server Error from aiGlobalSearch');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.error(`Unhandled error (${error.status}):`, error.message);
|
|
93
|
+
}
|
|
94
|
+
return throwError(() => error);
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
saveAIChatPositiveContentRating(requestBody, chatId, userID) {
|
|
98
|
+
console.log('chatId=', chatId, 'userID=', userID);
|
|
99
|
+
return this.http.post(`${API_END_POINTS.AI_CHAT_FEEDBACK}?chatID=${chatId}&userID=${userID}`, requestBody);
|
|
100
|
+
}
|
|
101
|
+
shareAIFeedback(requestBody, chatId, userID) {
|
|
102
|
+
return this.http.post(`${API_END_POINTS.AI_CHAT_FEEDBACK}?chatID=${chatId}&userID=${userID}`, requestBody);
|
|
103
|
+
}
|
|
104
|
+
aiGlobalSearchFromInternet(requestBody, chatId, userID) {
|
|
105
|
+
return this.http.post(`${API_END_POINTS.AI_GLOBAL_INTERNET_SEARCH}?chatID=${chatId}&user_id=${userID}`, requestBody);
|
|
106
|
+
}
|
|
107
|
+
aiStartChathForSupport(requestBody, userID) {
|
|
108
|
+
const headers = new HttpHeaders()
|
|
109
|
+
.set('user-id', userID);
|
|
110
|
+
return this.http.post(`${API_END_POINTS.SUPPORT_AI_START_CHAT}`, requestBody, {
|
|
111
|
+
headers,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
aiSendChathForSupport(requestBody, userID) {
|
|
115
|
+
const headers = new HttpHeaders()
|
|
116
|
+
.set('user-id', userID);
|
|
117
|
+
return this.http.post(`${API_END_POINTS.SUPPORT_AI_SEND_CHAT}`, requestBody, {
|
|
118
|
+
headers,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChatbotService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
122
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChatbotService, providedIn: 'root' }); }
|
|
123
|
+
}
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChatbotService, decorators: [{
|
|
125
|
+
type: Injectable,
|
|
126
|
+
args: [{
|
|
127
|
+
providedIn: 'root',
|
|
128
|
+
}]
|
|
129
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
130
|
+
|
|
131
|
+
class SupportAiService {
|
|
132
|
+
// private baseUrl = 'apis/proxies/v8';
|
|
133
|
+
constructor(http) {
|
|
134
|
+
this.http = http;
|
|
135
|
+
this.SUPPORT_AI_API = {
|
|
136
|
+
LIST_SESSION: '/apis/proxies/v8/ai/chatbot/v1/sessions/list',
|
|
137
|
+
CREATE_SESSION: '/apis/proxies/v8/ai/chatbot/v1/sessions/create',
|
|
138
|
+
GET_HISTORY: (sessionId) => `/apis/proxies/v8/ai/chatbot/v1/sessions/history/${sessionId}`,
|
|
139
|
+
SEND_TURN: (sessionId) => `/apis/proxies/v8/ai/chatbot/v1/sessions/turn/${sessionId}`
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
listSessions() {
|
|
143
|
+
return this.http.get(this.SUPPORT_AI_API.LIST_SESSION);
|
|
144
|
+
}
|
|
145
|
+
createSession() {
|
|
146
|
+
return this.http.post(this.SUPPORT_AI_API.CREATE_SESSION, {
|
|
147
|
+
channel: 'web',
|
|
148
|
+
language: 'en'
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
getHistory(sessionId) {
|
|
152
|
+
return this.http.get(this.SUPPORT_AI_API.GET_HISTORY(sessionId));
|
|
153
|
+
}
|
|
154
|
+
sendTurn(sessionId, payload) {
|
|
155
|
+
return this.http.post(this.SUPPORT_AI_API.SEND_TURN(sessionId), payload);
|
|
156
|
+
}
|
|
157
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SupportAiService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
158
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SupportAiService, providedIn: 'root' }); }
|
|
159
|
+
}
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SupportAiService, decorators: [{
|
|
161
|
+
type: Injectable,
|
|
162
|
+
args: [{
|
|
163
|
+
providedIn: 'root'
|
|
164
|
+
}]
|
|
165
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
166
|
+
|
|
167
|
+
class SupportAIComponent {
|
|
168
|
+
constructor(configSvc, eventSvc, renderer, chatbotService,
|
|
169
|
+
// private dialog: MatDialog,
|
|
170
|
+
matSnackBarNew, supportAiService, router) {
|
|
171
|
+
this.configSvc = configSvc;
|
|
172
|
+
this.eventSvc = eventSvc;
|
|
173
|
+
this.renderer = renderer;
|
|
174
|
+
this.chatbotService = chatbotService;
|
|
175
|
+
this.matSnackBarNew = matSnackBarNew;
|
|
176
|
+
this.supportAiService = supportAiService;
|
|
177
|
+
this.router = router;
|
|
178
|
+
this.from = '';
|
|
179
|
+
this.userJourney = [];
|
|
180
|
+
this.chatId = '';
|
|
181
|
+
this.userId = '';
|
|
182
|
+
this.fullScreenChatFlag = false;
|
|
183
|
+
this.activeLaguage = 'en';
|
|
184
|
+
this.scrollToBottomEvent = new EventEmitter();
|
|
185
|
+
this.showIcon = true;
|
|
186
|
+
this.categories = [];
|
|
187
|
+
this.language = [];
|
|
188
|
+
this.currentFilter = 'information';
|
|
189
|
+
this.selectedLaguage = 'en';
|
|
190
|
+
this.recomendedQns = {};
|
|
191
|
+
this.questionsAndAns = {};
|
|
192
|
+
this.userIcon = '';
|
|
193
|
+
this.more = false;
|
|
194
|
+
this.chatInformation = [];
|
|
195
|
+
this.chatIssues = [];
|
|
196
|
+
this.displayLoader = false;
|
|
197
|
+
this.expanded = false;
|
|
198
|
+
this.callText = '';
|
|
199
|
+
this.emailText = '';
|
|
200
|
+
this.copiedIndex = -1;
|
|
201
|
+
this.random = Math.random().toString(36).slice(2);
|
|
202
|
+
this.iGOTAISearchResultArr = [];
|
|
203
|
+
// public initials!: string
|
|
204
|
+
this.resultFetch = false;
|
|
205
|
+
this.searchAPIResponseInProgress = false;
|
|
206
|
+
this.colors = [
|
|
207
|
+
'#EB7181', // red
|
|
208
|
+
'#306933', // green
|
|
209
|
+
'#000000', // black
|
|
210
|
+
'#3670B2', // blue
|
|
211
|
+
'#4E9E87',
|
|
212
|
+
'#7E4C8D',
|
|
213
|
+
];
|
|
214
|
+
this.randomcolors = [
|
|
215
|
+
'#EB7181', // red
|
|
216
|
+
'#006400', // green
|
|
217
|
+
'#000000', // black
|
|
218
|
+
'#3670B2', // blue
|
|
219
|
+
'#4E9E87',
|
|
220
|
+
'#7E4C8D',
|
|
221
|
+
];
|
|
222
|
+
// tslint:disable
|
|
223
|
+
this.localization = {
|
|
224
|
+
'en': {
|
|
225
|
+
'Hi': 'Namaste',
|
|
226
|
+
'information': 'Information',
|
|
227
|
+
'issue': 'Issues',
|
|
228
|
+
'categories': 'Show All Categories',
|
|
229
|
+
'showmore': 'Show More'
|
|
230
|
+
},
|
|
231
|
+
'hi': {
|
|
232
|
+
'Hi': 'नमस्ते',
|
|
233
|
+
'information': 'जानकारी',
|
|
234
|
+
'issue': 'समस्या',
|
|
235
|
+
'categories': 'सभी कैटगोरी दिखायें',
|
|
236
|
+
'showmore': 'और दिखाओ'
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
this.aiSearchResult = {};
|
|
240
|
+
this.aiSearchResultArr = [];
|
|
241
|
+
this.cloneSearchQuery = '';
|
|
242
|
+
this.displayedText = '';
|
|
243
|
+
this.startNewChat = false;
|
|
244
|
+
this.initiateSupportNewChat = false;
|
|
245
|
+
this.containerHeight = 36;
|
|
246
|
+
this.sessionId = '';
|
|
247
|
+
this.chatActivities = [];
|
|
248
|
+
this.loadingSupportAI = false;
|
|
249
|
+
this.conversationEnded = false;
|
|
250
|
+
this.isInputEnabled = false;
|
|
251
|
+
this.showRetry = false;
|
|
252
|
+
this.retryCallback = null;
|
|
253
|
+
// course picker var
|
|
254
|
+
this.currentPicker = null;
|
|
255
|
+
this.pickerSearch = '';
|
|
256
|
+
this.filteredPickerItems = [];
|
|
257
|
+
this.selectedPickerItem = null;
|
|
258
|
+
this.pickerOpened = false;
|
|
259
|
+
this.showAllPlans = false;
|
|
260
|
+
this.expandedCourseLists = {};
|
|
261
|
+
// nested picker state
|
|
262
|
+
this.expandedPlanIds = {};
|
|
263
|
+
}
|
|
264
|
+
ngOnInit() {
|
|
265
|
+
this.router.events.subscribe((event) => {
|
|
266
|
+
if (event instanceof NavigationEnd) {
|
|
267
|
+
//certificate link check
|
|
268
|
+
this.isHubEnable = (event.url.includes('/certs') || event.url.includes('/public/certs')) ? false : true;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
this.userInfo = this.configSvc && this.configSvc.userProfile;
|
|
272
|
+
// this.aiGlobalSearch()
|
|
273
|
+
// this.startNewSupportAISearch()
|
|
274
|
+
this.checkForApiCalls();
|
|
275
|
+
this.enableScroll();
|
|
276
|
+
// tslint:disable-next-line: max-line-length
|
|
277
|
+
this.userIcon = this.userInfo && this.userInfo.profileImageUrl ? this.userInfo.profileImageUrl : '';
|
|
278
|
+
if (!this.userInfo.profileImageUrl && this.userInfo && this.userInfo.firstName) {
|
|
279
|
+
this.createInititals(this.userInfo.firstName);
|
|
280
|
+
}
|
|
281
|
+
const email = 'mission.karmayogi@gov.in';
|
|
282
|
+
this.callText = `<a class='hint-text' target='_blank' href='https://bit.ly/44MJlo4'>Teams Call</a> `;
|
|
283
|
+
this.emailText = `<a class='hint-text' target='_blank' href='mailto:${email}'>${email}.</a>`;
|
|
284
|
+
this.initializeSupportAI();
|
|
285
|
+
}
|
|
286
|
+
initializeSupportAI() {
|
|
287
|
+
this.loadingSupportAI = true;
|
|
288
|
+
this.supportAiService.listSessions().subscribe({
|
|
289
|
+
next: (res) => {
|
|
290
|
+
this.initiateSupportNewChat = true;
|
|
291
|
+
if (res?.session_id) {
|
|
292
|
+
this.sessionId = res.session_id;
|
|
293
|
+
this.loadHistory();
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.createSession();
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
error: () => {
|
|
300
|
+
this.loadingSupportAI = false;
|
|
301
|
+
this.setRetry(() => this.initializeSupportAI());
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
setRetry(callback) {
|
|
306
|
+
this.showRetry = true;
|
|
307
|
+
this.retryCallback = callback;
|
|
308
|
+
}
|
|
309
|
+
retryApi() {
|
|
310
|
+
this.showRetry = false;
|
|
311
|
+
if (this.retryCallback) {
|
|
312
|
+
this.retryCallback();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
createSession() {
|
|
316
|
+
this.supportAiService.createSession().subscribe({
|
|
317
|
+
next: (res) => {
|
|
318
|
+
this.sessionId = res.session_id;
|
|
319
|
+
this.chatActivities = [];
|
|
320
|
+
this.renderActivities(res.activities);
|
|
321
|
+
this.loadingSupportAI = false;
|
|
322
|
+
this.showRetry = false;
|
|
323
|
+
},
|
|
324
|
+
error: () => {
|
|
325
|
+
this.loadingSupportAI = false;
|
|
326
|
+
this.setRetry(() => this.createSession());
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
renderActivities(activities) {
|
|
331
|
+
activities.forEach((activity, index) => {
|
|
332
|
+
const isLast = index === activities.length - 1;
|
|
333
|
+
this.chatActivities.push({
|
|
334
|
+
sender: 'bot',
|
|
335
|
+
activity,
|
|
336
|
+
showTimestamp: isLast,
|
|
337
|
+
timestamp: isLast ? new Date() : null,
|
|
338
|
+
showAllChoices: false
|
|
339
|
+
});
|
|
340
|
+
if (activity.disable_input !== undefined) {
|
|
341
|
+
this.isInputEnabled = !activity.disable_input;
|
|
342
|
+
}
|
|
343
|
+
if (activity.type === 'picker') {
|
|
344
|
+
this.currentPicker = activity;
|
|
345
|
+
this.filteredPickerItems = [...activity.items];
|
|
346
|
+
this.pickerSearch = '';
|
|
347
|
+
}
|
|
348
|
+
if (activity.type === 'nested_picker') {
|
|
349
|
+
this.currentPicker = activity;
|
|
350
|
+
this.expandedPlanIds = {};
|
|
351
|
+
activity.items?.forEach((plan) => {
|
|
352
|
+
plan.showAllCourses = false;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
setTimeout(() => {
|
|
357
|
+
this.scrollToBottomEvent.emit();
|
|
358
|
+
}, 100);
|
|
359
|
+
}
|
|
360
|
+
filterPickerItems() {
|
|
361
|
+
const search = this.pickerSearch.toLowerCase();
|
|
362
|
+
this.filteredPickerItems =
|
|
363
|
+
this.currentPicker.items.filter((item) => item.label.toLowerCase().includes(search));
|
|
364
|
+
}
|
|
365
|
+
selectPickerItem(item) {
|
|
366
|
+
this.selectedPickerItem = item;
|
|
367
|
+
this.pickerOpened = false;
|
|
368
|
+
this.chatActivities.push({
|
|
369
|
+
sender: 'user',
|
|
370
|
+
text: item.label,
|
|
371
|
+
timestamp: new Date()
|
|
372
|
+
});
|
|
373
|
+
this.sendTurn({
|
|
374
|
+
action: 'pick_item',
|
|
375
|
+
picker_id: this.currentPicker.picker_id,
|
|
376
|
+
item_id: item.id
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
sendTurn(payload) {
|
|
380
|
+
this.loadingSupportAI = true;
|
|
381
|
+
this.supportAiService.sendTurn(this.sessionId, payload)
|
|
382
|
+
.subscribe({
|
|
383
|
+
next: (res) => {
|
|
384
|
+
this.renderActivities(res.activities);
|
|
385
|
+
if (res.activities?.some((a) => a.type === 'end')) {
|
|
386
|
+
this.conversationEnded = true;
|
|
387
|
+
}
|
|
388
|
+
this.loadingSupportAI = false;
|
|
389
|
+
this.showRetry = false;
|
|
390
|
+
},
|
|
391
|
+
error: () => {
|
|
392
|
+
this.loadingSupportAI = false;
|
|
393
|
+
this.setRetry(() => this.sendTurn(payload));
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
selectChoice(choice) {
|
|
398
|
+
this.chatActivities.push({
|
|
399
|
+
sender: 'user',
|
|
400
|
+
text: choice.label,
|
|
401
|
+
icon: choice.icon,
|
|
402
|
+
timestamp: new Date()
|
|
403
|
+
});
|
|
404
|
+
this.sendTurn({
|
|
405
|
+
action: 'select_choice',
|
|
406
|
+
choice_id: choice.id
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
startNewConversation() {
|
|
410
|
+
this.chatActivities = [];
|
|
411
|
+
this.sessionId = '';
|
|
412
|
+
this.isInputEnabled = false;
|
|
413
|
+
this.createSession();
|
|
414
|
+
}
|
|
415
|
+
loadHistory() {
|
|
416
|
+
this.supportAiService
|
|
417
|
+
.getHistory(this.sessionId)
|
|
418
|
+
.subscribe({
|
|
419
|
+
next: (res) => {
|
|
420
|
+
this.showRetry = false; // hide retry after success
|
|
421
|
+
this.chatActivities = [];
|
|
422
|
+
console.log('res', res);
|
|
423
|
+
if (res?.messages?.length) {
|
|
424
|
+
res.messages.forEach((msg) => {
|
|
425
|
+
if (msg.role === 'bot') {
|
|
426
|
+
msg.activities.forEach((activity, idx) => {
|
|
427
|
+
const isLast = idx === msg.activities.length - 1;
|
|
428
|
+
this.chatActivities.push({
|
|
429
|
+
sender: 'bot',
|
|
430
|
+
activity,
|
|
431
|
+
showTimestamp: isLast,
|
|
432
|
+
timestamp: isLast ? new Date(msg.timestamp || Date.now()) : null
|
|
433
|
+
});
|
|
434
|
+
if (activity.disable_input !== undefined) {
|
|
435
|
+
this.isInputEnabled = !activity.disable_input;
|
|
436
|
+
}
|
|
437
|
+
if (activity.type === 'picker') {
|
|
438
|
+
this.currentPicker = activity;
|
|
439
|
+
this.filteredPickerItems = [...activity.items];
|
|
440
|
+
this.pickerSearch = '';
|
|
441
|
+
}
|
|
442
|
+
if (activity.type === 'nested_picker') {
|
|
443
|
+
this.currentPicker = activity;
|
|
444
|
+
this.expandedPlanIds = {};
|
|
445
|
+
activity.items?.forEach((plan) => {
|
|
446
|
+
plan.showAllCourses = false;
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
if (msg.role === 'user') {
|
|
452
|
+
this.chatActivities.push({
|
|
453
|
+
sender: 'user',
|
|
454
|
+
text: msg.text,
|
|
455
|
+
timestamp: new Date(msg.timestamp || Date.now())
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
this.loadingSupportAI = false;
|
|
461
|
+
},
|
|
462
|
+
error: () => {
|
|
463
|
+
this.loadingSupportAI = false;
|
|
464
|
+
this.setRetry(() => this.loadHistory());
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
setTimeout(() => {
|
|
468
|
+
this.scrollToBottomEvent.emit();
|
|
469
|
+
}, 200);
|
|
470
|
+
}
|
|
471
|
+
// APIS called till history Eighth change: Add sendTurn left
|
|
472
|
+
ngOnChanges(changes) {
|
|
473
|
+
if (changes['chatId']) {
|
|
474
|
+
const prev = changes['chatId'].previousValue;
|
|
475
|
+
const current = changes['chatId'].currentValue;
|
|
476
|
+
if (prev !== current) {
|
|
477
|
+
console.log(`'chatId' changed from '${prev}' to '${current}'`);
|
|
478
|
+
this.startNewChat = true;
|
|
479
|
+
// this.startNewSupportAISearch()
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
greetings() {
|
|
484
|
+
return this.localization[this.selectedLaguage]['Hi'] || 'Hi';
|
|
485
|
+
}
|
|
486
|
+
getInfoText(label) {
|
|
487
|
+
return this.localization[this.selectedLaguage][label] || label;
|
|
488
|
+
}
|
|
489
|
+
showMore() {
|
|
490
|
+
return this.localization[this.selectedLaguage]['showmore'] || 'Show More';
|
|
491
|
+
}
|
|
492
|
+
getData() {
|
|
493
|
+
const lang = {
|
|
494
|
+
information: 'IN',
|
|
495
|
+
issue: 'IS'
|
|
496
|
+
};
|
|
497
|
+
const tabType = {
|
|
498
|
+
lang: this.selectedLaguage,
|
|
499
|
+
config_type: lang[this.currentFilter]
|
|
500
|
+
};
|
|
501
|
+
this.displayLoader = true;
|
|
502
|
+
this.chatbotService.getChatData(tabType).subscribe((res) => {
|
|
503
|
+
if (res && res.payload && res.payload.config) {
|
|
504
|
+
this.setDataToLocalStorage(res.payload.config);
|
|
505
|
+
this.checkForApiCalls();
|
|
506
|
+
// this.initData(res.payload.config)
|
|
507
|
+
this.displayLoader = false;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
setDataToLocalStorage(data) {
|
|
512
|
+
let localObject = {};
|
|
513
|
+
localObject = JSON.parse(localStorage.getItem('faq') || '{}');
|
|
514
|
+
localObject[this.selectedLaguage] = { ...localObject[this.selectedLaguage], [this.currentFilter]: data };
|
|
515
|
+
localStorage.setItem('faq', JSON.stringify(localObject));
|
|
516
|
+
this.toggleFilter(this.currentFilter === 'information' ? 'information' : this.currentFilter);
|
|
517
|
+
}
|
|
518
|
+
initData(_getData) {
|
|
519
|
+
// tslint:disable-next-line
|
|
520
|
+
// console.log(getData)
|
|
521
|
+
this.userJourney = [];
|
|
522
|
+
let userDetails = {
|
|
523
|
+
type: 'incoming',
|
|
524
|
+
message: '', //` Hi ${this.userInfo && this.userInfo.firstName || ''}, I'm KarmaSahayogi - Digital Assistant, I'm here to help you.`,
|
|
525
|
+
recommendedQues: this.getPriorityQuestion(1),
|
|
526
|
+
selectedValue: '',
|
|
527
|
+
title: '', //'Here are the most frequently asked questions users have looked for',
|
|
528
|
+
tab: 'information',
|
|
529
|
+
};
|
|
530
|
+
this.pushData(userDetails);
|
|
531
|
+
// this.pushData(userDetailsForIssues)
|
|
532
|
+
this.getQns();
|
|
533
|
+
}
|
|
534
|
+
getQns() {
|
|
535
|
+
this.responseData.quesMap.map((q) => {
|
|
536
|
+
this.questionsAndAns[q.quesId] = q;
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
selectLaguage(event) {
|
|
540
|
+
this.selectedLaguage = event.target.value;
|
|
541
|
+
localStorage.setItem('selectedLanguage', event.target.value);
|
|
542
|
+
this.chatInformation = [];
|
|
543
|
+
this.chatIssues = [];
|
|
544
|
+
this.checkForApiCalls();
|
|
545
|
+
}
|
|
546
|
+
readFromLocalStorage() {
|
|
547
|
+
let localStg = localStorage.getItem('result');
|
|
548
|
+
if (localStg) {
|
|
549
|
+
if (this.currentFilter === 'information') {
|
|
550
|
+
this.responseData = JSON.parse(localStg)[this.selectedLaguage].information;
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
this.responseData = JSON.parse(localStg)[this.selectedLaguage].issue;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
goToBottom() {
|
|
558
|
+
window.scrollTo(0, document.body.scrollHeight);
|
|
559
|
+
}
|
|
560
|
+
iconClick(type) {
|
|
561
|
+
this.showIcon = !this.showIcon;
|
|
562
|
+
this.currentFilter = 'information';
|
|
563
|
+
this.expanded = false;
|
|
564
|
+
if (type === 'start') {
|
|
565
|
+
this.disableScroll();
|
|
566
|
+
this.raiseChatStartTelemetry();
|
|
567
|
+
// this.toggleFilter(this.currentFilter)
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
this.raiseChatEndTelemetry();
|
|
571
|
+
this.userJourney = [];
|
|
572
|
+
this.chatInformation = [];
|
|
573
|
+
this.chatIssues = [];
|
|
574
|
+
this.selectedLaguage = 'en';
|
|
575
|
+
this.currentFilter = 'information';
|
|
576
|
+
this.checkForApiCalls();
|
|
577
|
+
this.more = false;
|
|
578
|
+
this.enableScroll();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
toggleFilter(tab) {
|
|
582
|
+
this.currentFilter = tab;
|
|
583
|
+
this.checkForApiCalls();
|
|
584
|
+
this.more = false;
|
|
585
|
+
}
|
|
586
|
+
selectedQuestion(question, data) {
|
|
587
|
+
data.selectedValue = question.quesID;
|
|
588
|
+
const sendMsg = {
|
|
589
|
+
type: 'sendMsg',
|
|
590
|
+
question: this.questionsAndAns[question.quesID].quesValue,
|
|
591
|
+
tab: this.currentFilter,
|
|
592
|
+
};
|
|
593
|
+
const incomingMsg = {
|
|
594
|
+
type: 'incoming',
|
|
595
|
+
// tslint:disable-next-line:max-line-length
|
|
596
|
+
message: this.questionsAndAns[question.quesID].ansVal.replace('<teams_call_link>', this.callText).replace('<email_configuration>', this.emailText),
|
|
597
|
+
recommendedQues: question.recommendedQues || [],
|
|
598
|
+
title: '', // 'Questions related to',
|
|
599
|
+
relatedQes: 'above Question',
|
|
600
|
+
tab: this.currentFilter,
|
|
601
|
+
};
|
|
602
|
+
this.pushData(sendMsg);
|
|
603
|
+
this.pushData(incomingMsg);
|
|
604
|
+
this.raiseTemeletyInterat(question.quesID);
|
|
605
|
+
}
|
|
606
|
+
pushData(msg) {
|
|
607
|
+
this.userJourney = [];
|
|
608
|
+
if (this.currentFilter === 'information') {
|
|
609
|
+
this.chatInformation.push(msg);
|
|
610
|
+
this.userJourney = this.chatInformation;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
this.chatIssues.push(msg);
|
|
614
|
+
this.userJourney = this.chatIssues;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
getuserjourney(tab) {
|
|
618
|
+
return this.userJourney.filter((j) => j.tab === tab);
|
|
619
|
+
}
|
|
620
|
+
getPriorityQuestion(priority) {
|
|
621
|
+
const recommendedQues = [];
|
|
622
|
+
const isLogedIn = this.userInfo ? 'Logged-In' : 'Not Logged-In';
|
|
623
|
+
this.responseData.recommendationMap.map((question) => {
|
|
624
|
+
question.recommendedQues.map((ques) => {
|
|
625
|
+
if (ques.priority === priority && (question.categoryType === isLogedIn || question.categoryType === 'Both')) {
|
|
626
|
+
recommendedQues.push(ques);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
return recommendedQues;
|
|
631
|
+
}
|
|
632
|
+
showMoreQuestion() {
|
|
633
|
+
const showMoreQes = {
|
|
634
|
+
type: 'incoming',
|
|
635
|
+
message: '',
|
|
636
|
+
recommendedQues: this.getPriorityQuestion(1),
|
|
637
|
+
selectedValue: '',
|
|
638
|
+
title: '', //'Showing more questions',
|
|
639
|
+
};
|
|
640
|
+
this.pushData(showMoreQes);
|
|
641
|
+
}
|
|
642
|
+
showCategory(catItem) {
|
|
643
|
+
let incomingMsg = {
|
|
644
|
+
type: 'category',
|
|
645
|
+
message: '',
|
|
646
|
+
recommendedQues: [],
|
|
647
|
+
title: '', //' What do you want to know under',
|
|
648
|
+
relatedQes: `${catItem.catName}?`,
|
|
649
|
+
tab: this.currentFilter,
|
|
650
|
+
};
|
|
651
|
+
this.more = false;
|
|
652
|
+
if (catItem.catId === 'all') {
|
|
653
|
+
incomingMsg.title = '', // 'Here is the list of all the topics'
|
|
654
|
+
incomingMsg.relatedQes = '';
|
|
655
|
+
incomingMsg.recommendedQues = this.sortCategory();
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
this.responseData.recommendationMap.forEach((element) => {
|
|
659
|
+
if (catItem.catId === element.catId) {
|
|
660
|
+
incomingMsg.type = 'incoming',
|
|
661
|
+
incomingMsg.recommendedQues = element.recommendedQues;
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
this.raiseCategotyTelemetry(catItem.catId);
|
|
665
|
+
}
|
|
666
|
+
const sendMsg = {
|
|
667
|
+
type: 'sendMsg',
|
|
668
|
+
question: catItem.catName,
|
|
669
|
+
};
|
|
670
|
+
this.pushData(sendMsg);
|
|
671
|
+
this.pushData(incomingMsg);
|
|
672
|
+
}
|
|
673
|
+
raiseCategotyTelemetry(catItem) {
|
|
674
|
+
const event = {
|
|
675
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
676
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
677
|
+
data: {
|
|
678
|
+
edata: { type: 'click', id: catItem },
|
|
679
|
+
object: { id: catItem, type: 'Category' },
|
|
680
|
+
state: WsEvents.EnumTelemetrySubType.Interact,
|
|
681
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
682
|
+
mode: 'view',
|
|
683
|
+
},
|
|
684
|
+
pageContext: { pageId: '/chatbot', module: 'Assistant' },
|
|
685
|
+
from: '',
|
|
686
|
+
to: 'Telemetry',
|
|
687
|
+
};
|
|
688
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
689
|
+
}
|
|
690
|
+
raiseChatStartTelemetry() {
|
|
691
|
+
const event = {
|
|
692
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
693
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
694
|
+
data: {
|
|
695
|
+
edata: { type: '' },
|
|
696
|
+
object: { type: 'zse', id: 'asd' },
|
|
697
|
+
state: WsEvents.EnumTelemetrySubType.Loaded,
|
|
698
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
699
|
+
type: 'session',
|
|
700
|
+
mode: 'view',
|
|
701
|
+
},
|
|
702
|
+
pageContext: { pageId: '/chatbot', module: 'Assistant' },
|
|
703
|
+
from: '',
|
|
704
|
+
to: 'Telemetry',
|
|
705
|
+
};
|
|
706
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
707
|
+
}
|
|
708
|
+
raiseChatEndTelemetry() {
|
|
709
|
+
const event = {
|
|
710
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
711
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
712
|
+
data: {
|
|
713
|
+
edata: { type: '' },
|
|
714
|
+
object: {},
|
|
715
|
+
state: WsEvents.EnumTelemetrySubType.Unloaded,
|
|
716
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
717
|
+
type: 'session',
|
|
718
|
+
mode: 'view',
|
|
719
|
+
},
|
|
720
|
+
pageContext: { pageId: '/chatbot', module: 'Assistant' },
|
|
721
|
+
from: '',
|
|
722
|
+
to: 'Telemetry',
|
|
723
|
+
};
|
|
724
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
725
|
+
}
|
|
726
|
+
raiseTemeletyInterat(idn) {
|
|
727
|
+
const event = {
|
|
728
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
729
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
730
|
+
data: {
|
|
731
|
+
edata: { type: 'click', id: idn },
|
|
732
|
+
object: { id: idn, type: this.currentFilter.charAt(0).toUpperCase() + this.currentFilter.slice(1) },
|
|
733
|
+
state: WsEvents.EnumTelemetrySubType.Interact,
|
|
734
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
735
|
+
mode: 'view'
|
|
736
|
+
},
|
|
737
|
+
pageContext: { pageId: '/chatbot', module: 'Assistant' },
|
|
738
|
+
from: '',
|
|
739
|
+
to: 'Telemetry',
|
|
740
|
+
};
|
|
741
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
742
|
+
}
|
|
743
|
+
checkForAIQuestionResponse() {
|
|
744
|
+
}
|
|
745
|
+
checkForApiCalls() {
|
|
746
|
+
this.selectedLaguage = localStorage.getItem('selectedLanguage') || 'en';
|
|
747
|
+
let localStg = JSON.parse(localStorage.getItem('faq') || '{}');
|
|
748
|
+
let languageStg = JSON.parse(localStorage.getItem('faq-languages') || '{}');
|
|
749
|
+
if (languageStg.length > 0) {
|
|
750
|
+
this.language = languageStg;
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
this.getLanguages();
|
|
754
|
+
}
|
|
755
|
+
if (localStg && languageStg) {
|
|
756
|
+
if (localStg[this.selectedLaguage] && localStg[this.selectedLaguage][this.currentFilter]) {
|
|
757
|
+
const localStorageData = localStg[this.selectedLaguage][this.currentFilter];
|
|
758
|
+
this.userJourney = [];
|
|
759
|
+
if (this.currentFilter === 'information') {
|
|
760
|
+
if (this.chatInformation.length === 0) {
|
|
761
|
+
this.responseData = localStorageData;
|
|
762
|
+
this.initData(localStorageData);
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
this.responseData = localStorageData;
|
|
766
|
+
this.userJourney = this.chatInformation;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
if (this.chatIssues.length === 0) {
|
|
771
|
+
this.responseData = localStorageData;
|
|
772
|
+
this.initData(localStorageData);
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
this.responseData = localStorageData;
|
|
776
|
+
this.userJourney = this.chatIssues;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
this.getQns();
|
|
780
|
+
this.getCategories();
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
this.getLanguages();
|
|
784
|
+
// this.getData()
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
getCategories() {
|
|
789
|
+
this.categories = [{ catId: 'all', catName: this.localization[this.selectedLaguage]['categories'], priority: 0 }];
|
|
790
|
+
const categories = [];
|
|
791
|
+
const isLogedIn = this.userInfo ? 'Logged-In' : 'Not Logged-In';
|
|
792
|
+
this.responseData.recommendationMap.map((catandques) => {
|
|
793
|
+
this.responseData.categoryMap.map((cat) => {
|
|
794
|
+
if (catandques.catId === cat.catId && (catandques.categoryType === isLogedIn || catandques.categoryType === 'Both')) {
|
|
795
|
+
const category = {
|
|
796
|
+
catId: cat.catId,
|
|
797
|
+
catName: cat.catName,
|
|
798
|
+
priority: catandques.priority,
|
|
799
|
+
categoryType: catandques.categoryType,
|
|
800
|
+
};
|
|
801
|
+
categories.push(category);
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
if (categories.length < 6) {
|
|
806
|
+
this.categories = categories;
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
this.categories = [...this.categories, ...categories];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
sortCategory() {
|
|
813
|
+
// tslint:disable-next-line: max-line-length
|
|
814
|
+
return this.categories.sort((a, b) => a['priority'] > b['priority'] ? 1 : a['priority'] === b['priority'] ? 0 : -1);
|
|
815
|
+
}
|
|
816
|
+
getLanguages() {
|
|
817
|
+
this.displayLoader = true;
|
|
818
|
+
this.chatbotService.getLangugages().subscribe((resp) => {
|
|
819
|
+
if (resp && resp.status && resp.status.code === 200) {
|
|
820
|
+
this.language = resp.payload.languages;
|
|
821
|
+
localStorage.setItem('faq-languages', JSON.stringify(resp.payload.languages));
|
|
822
|
+
localStorage.setItem('selectedLanguage', this.selectedLaguage);
|
|
823
|
+
this.getData();
|
|
824
|
+
this.displayLoader = false;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
ngAfterViewChecked() {
|
|
829
|
+
//this.scrollToBottom()
|
|
830
|
+
}
|
|
831
|
+
ngAfterViewInit() {
|
|
832
|
+
this.resizeTextarea(this.textArea.nativeElement, '');
|
|
833
|
+
setTimeout(() => {
|
|
834
|
+
this.scrollToBottomEvent.emit();
|
|
835
|
+
}, 200);
|
|
836
|
+
}
|
|
837
|
+
scrollToBottom() {
|
|
838
|
+
try {
|
|
839
|
+
if (this.myScrollContainer) {
|
|
840
|
+
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
catch (err) { }
|
|
844
|
+
}
|
|
845
|
+
clickOutside() {
|
|
846
|
+
this.iconClick('end');
|
|
847
|
+
}
|
|
848
|
+
disableScroll() {
|
|
849
|
+
this.renderer.addClass(document.body, 'disable-scroll');
|
|
850
|
+
}
|
|
851
|
+
enableScroll() {
|
|
852
|
+
this.renderer.removeClass(document.body, 'disable-scroll');
|
|
853
|
+
}
|
|
854
|
+
submitSearchQuery(textArea, event) {
|
|
855
|
+
if (!this.isInputEnabled) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (!this.searchQuery?.trim()) {
|
|
859
|
+
event.preventDefault();
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
const message = this.searchQuery.trim();
|
|
863
|
+
// Show user message
|
|
864
|
+
this.chatActivities.push({
|
|
865
|
+
sender: 'user',
|
|
866
|
+
text: message,
|
|
867
|
+
timestamp: new Date(),
|
|
868
|
+
showAllChoices: false
|
|
869
|
+
});
|
|
870
|
+
setTimeout(() => {
|
|
871
|
+
this.scrollToBottomEvent.emit();
|
|
872
|
+
}, 100);
|
|
873
|
+
// Send to chatbot
|
|
874
|
+
this.sendTurn({
|
|
875
|
+
action: 'send_message', // Verify this with backend if needed
|
|
876
|
+
text: message
|
|
877
|
+
});
|
|
878
|
+
this.searchQuery = '';
|
|
879
|
+
this.resetTextAreaHeight(textArea);
|
|
880
|
+
}
|
|
881
|
+
// startNewSupportAISearch() {
|
|
882
|
+
// this.iGOTAISearchResultArr = []
|
|
883
|
+
// let requestBody: any = {
|
|
884
|
+
// "channel_id": "web",
|
|
885
|
+
// // "session_id": this.chatId,
|
|
886
|
+
// "text": this.cloneSearchQuery,
|
|
887
|
+
// "audio": "",
|
|
888
|
+
// "language": this.activeLaguage
|
|
889
|
+
// }
|
|
890
|
+
// console.log('requestBody--', requestBody)
|
|
891
|
+
// if (this.startNewChat) {
|
|
892
|
+
// this.chatbotService.aiStartChathForSupport(requestBody, this.userId).subscribe((data) => {
|
|
893
|
+
// console.log('data---', data)
|
|
894
|
+
// this.resultFetch = true
|
|
895
|
+
// if (data && data.message) {
|
|
896
|
+
// this.initiateSupportNewChat = true
|
|
897
|
+
// this.aiSearchResultArr.push(
|
|
898
|
+
// { type: 'incoming', tab: 'support-ai', answer: `Hi ${this.userInfo?.firstName}! 👋`, newMessage: 'Hi Manasvi! 👋', showBot: true },
|
|
899
|
+
// { type: 'incoming', tab: 'support-ai', answer: "I'm your iGOT Support Assistant 🤖 — here to guide you with anything related to the iGOT platform.", newMessage: "I'm your iGOT Support Assistant 🤖 — here to guide you with anything related to the iGOT platform.", showBot: false },
|
|
900
|
+
// { type: 'incoming', tab: 'support-ai', answer: "How can I assist you today?", newMessage: 'How can I assist you today?', showBot: false }
|
|
901
|
+
// )
|
|
902
|
+
// } else {
|
|
903
|
+
// this.initiateSupportNewChat = false
|
|
904
|
+
// }
|
|
905
|
+
// })
|
|
906
|
+
// const event = {
|
|
907
|
+
// eventType: WsEvents.WsEventType.Telemetry,
|
|
908
|
+
// eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
909
|
+
// data: {
|
|
910
|
+
// edata: { type: 'click', "id": "support-ai-global-search", "pageid": "/page/home" },
|
|
911
|
+
// object: {},
|
|
912
|
+
// state: WsEvents.EnumTelemetrySubType.Interact,
|
|
913
|
+
// eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
914
|
+
// mode: 'view',
|
|
915
|
+
// },
|
|
916
|
+
// pageContext: { pageId: '/page/home', module: 'Home' },
|
|
917
|
+
// from: '',
|
|
918
|
+
// to: 'Telemetry',
|
|
919
|
+
// }
|
|
920
|
+
// this.eventSvc.dispatchChatbotEvent<WsEvents.IWsEventTelemetryInteract>(event)
|
|
921
|
+
// }
|
|
922
|
+
// }
|
|
923
|
+
// supportAISearch() {
|
|
924
|
+
// console.log('this.initiateSupportNewChat--', this.initiateSupportNewChat)
|
|
925
|
+
// if (this.initiateSupportNewChat) {
|
|
926
|
+
// let requestBody: any = {
|
|
927
|
+
// "channel_id": "web",
|
|
928
|
+
// // "session_id": this.chatId,
|
|
929
|
+
// "text": this.cloneSearchQuery,
|
|
930
|
+
// "audio": "",
|
|
931
|
+
// "language": this.activeLaguage
|
|
932
|
+
// }
|
|
933
|
+
// this.chatbotService.aiSendChathForSupport(requestBody, this.userId).subscribe((data) => {
|
|
934
|
+
// this.resultFetch = true
|
|
935
|
+
// this.aiSearchResult = data
|
|
936
|
+
// //let arr:any = []
|
|
937
|
+
// // this.aiSearchResult.RetrievedChunks && this.aiSearchResult.RetrievedChunks.map((item:any)=>{
|
|
938
|
+
// // let startTime = 0
|
|
939
|
+
// // let endTime = 0
|
|
940
|
+
// // let pageNumber:any = 1
|
|
941
|
+
// // if(item && item?.contentStart) {
|
|
942
|
+
// // startTime = item?.contentStart
|
|
943
|
+
// // pageNumber= item?.contentStart
|
|
944
|
+
// // }
|
|
945
|
+
// // if(item && item?.ContentEnd) {
|
|
946
|
+
// // endTime = item?.ContentEnd
|
|
947
|
+
// // pageNumber= item?.ContentEnd
|
|
948
|
+
// // }
|
|
949
|
+
// // pageNumber = pageNumber !== " " ? pageNumber : 1
|
|
950
|
+
// // let resultObj = {
|
|
951
|
+
// // message: item.Name,
|
|
952
|
+
// // recommendedQues: '',
|
|
953
|
+
// // selectedValue: '',
|
|
954
|
+
// // title: item.Name,
|
|
955
|
+
// // content: item,
|
|
956
|
+
// // mimeType: item.mimeType,
|
|
957
|
+
// // contentType: item.ContentType,
|
|
958
|
+
// // artifactUrl: item.ArtifactURL,
|
|
959
|
+
// // description: item.Description,
|
|
960
|
+
// // identifier: item.Identifier,
|
|
961
|
+
// // contentStart: startTime,
|
|
962
|
+
// // contentEnd: endTime,
|
|
963
|
+
// // pageNumber: pageNumber,
|
|
964
|
+
// // query: this.aiSearchResult.query,
|
|
965
|
+
// // query_id: this.aiSearchResult.query_id,
|
|
966
|
+
// // feedback: '',
|
|
967
|
+
// // resourceLink : item.mimeType === 'application/pdf'? `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/pdf/${item.Identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&pn=${pageNumber}`: `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/video/${item.Identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&st=${startTime}&et=${endTime}`
|
|
968
|
+
// // }
|
|
969
|
+
// // // arr.push(resultObj)
|
|
970
|
+
// // this.iGOTAISearchResultArr.push(resultObj)
|
|
971
|
+
// // })
|
|
972
|
+
// let answer = this.aiSearchResult.text ? this.aiSearchResult.text.trim().replace(/\n/g, '<br>') : ""
|
|
973
|
+
// let shortAnswer = this.splitParagraphByWords(answer)
|
|
974
|
+
// this.aiSearchResultArr.push({ showBot: true, wordsCount: answer.trim().split(/\s+/).length, showLess: answer.trim().split(/\s+/).length > 30 ? true : false, answer: answer, shortAnswer: shortAnswer, result: this.iGOTAISearchResultArr, type: 'incoming', tab: 'support-ai', reterivedChunks: this.aiSearchResult.RetrievedChunks, showFromInternet: (!(this.aiSearchResult.answer) && !(this.aiSearchResult.RetrievedChunks)) ? true : false })
|
|
975
|
+
// this.aiSearchResultArr.map((item: any, index: any) => {
|
|
976
|
+
// if (item && (item.newMessage === '')) {
|
|
977
|
+
// // delete this.aiSearchResultArr[index]
|
|
978
|
+
// this.aiSearchResultArr.splice(index, 1)
|
|
979
|
+
// }
|
|
980
|
+
// })
|
|
981
|
+
// // setTimeout(()=>{
|
|
982
|
+
// // this.scrollToBottomEvent.emit()
|
|
983
|
+
// // },0)
|
|
984
|
+
// })
|
|
985
|
+
// const event = {
|
|
986
|
+
// eventType: WsEvents.WsEventType.Telemetry,
|
|
987
|
+
// eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
988
|
+
// data: {
|
|
989
|
+
// edata: { type: 'click', "id": "support-ai-global-search", "pageid": "/page/home" },
|
|
990
|
+
// object: {},
|
|
991
|
+
// state: WsEvents.EnumTelemetrySubType.Interact,
|
|
992
|
+
// eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
993
|
+
// mode: 'view',
|
|
994
|
+
// },
|
|
995
|
+
// pageContext: { pageId: '/page/home', module: 'Home' },
|
|
996
|
+
// from: '',
|
|
997
|
+
// to: 'Telemetry',
|
|
998
|
+
// }
|
|
999
|
+
// this.eventSvc.dispatchChatbotEvent<WsEvents.IWsEventTelemetryInteract>(event)
|
|
1000
|
+
// }
|
|
1001
|
+
// }
|
|
1002
|
+
sharePositiveContentRating(item, index, cindex) {
|
|
1003
|
+
let requestBody = {
|
|
1004
|
+
"query_id": item?.query_id,
|
|
1005
|
+
// "response": item?.description,
|
|
1006
|
+
"comments": "accurate",
|
|
1007
|
+
"is_liked": true,
|
|
1008
|
+
"rating": "5"
|
|
1009
|
+
};
|
|
1010
|
+
//this.matSnackBar.open('Unable to fetch content data, due to some error!')
|
|
1011
|
+
this.chatbotService.saveAIChatPositiveContentRating(requestBody, this.chatId, this.userId).subscribe((data) => {
|
|
1012
|
+
if (data && data.status === 'success') {
|
|
1013
|
+
// this.matSnackBar.openFromComponent(SnackbarComponent, {
|
|
1014
|
+
// data: {
|
|
1015
|
+
// message: 'Thank you for your feedback.', type: 'success',
|
|
1016
|
+
// }, duration: 5000, panelClass: 'course-success-snackbar',
|
|
1017
|
+
// })
|
|
1018
|
+
// console.log(this.aiSearchResultArr, index, this.aiSearchResultArr[index])
|
|
1019
|
+
if (this.aiSearchResultArr && this.aiSearchResultArr.length && this.aiSearchResultArr[index]) {
|
|
1020
|
+
if (this.aiSearchResultArr[index].result && this.aiSearchResultArr[index].result[cindex])
|
|
1021
|
+
this.aiSearchResultArr[index].result[cindex]['feedback'] = 'up';
|
|
1022
|
+
}
|
|
1023
|
+
this.matSnackBarNew.open('Thank you for your feedback.', 'X', { duration: 5000, panelClass: ['success'] });
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
this.matSnackBarNew.open('Something is wrong. Please try again later.', 'X', { duration: 5000, panelClass: ['error'] });
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
openAIFeedbackPopup(item, index, cindex) {
|
|
1031
|
+
console.log('item, cindex', item, cindex);
|
|
1032
|
+
if (this.aiSearchResultArr && this.aiSearchResultArr.length && this.aiSearchResultArr[index] && this.aiSearchResultArr[index]) {
|
|
1033
|
+
// if (this.aiSearchResultArr[index].result && this.aiSearchResultArr[index].result[cindex] && this.aiSearchResultArr[index].result[cindex]['feedback'] !== 'down') {
|
|
1034
|
+
// const dialogRef = this.dialog.open(NonReleventFeedbackDialogComponent, {
|
|
1035
|
+
// disableClose: true,
|
|
1036
|
+
// width: '502px',
|
|
1037
|
+
// panelClass: ['relevent-feedback-dialog'],
|
|
1038
|
+
// })
|
|
1039
|
+
// dialogRef.afterClosed().subscribe((result: any) => {
|
|
1040
|
+
// if (result) {
|
|
1041
|
+
// this.shareAIFeedback(item, result, index, cindex)
|
|
1042
|
+
// dialogRef.close()
|
|
1043
|
+
// } else {
|
|
1044
|
+
// dialogRef.close()
|
|
1045
|
+
// }
|
|
1046
|
+
// })
|
|
1047
|
+
// } else {
|
|
1048
|
+
// this.matSnackBarNew.open(
|
|
1049
|
+
// 'You have already submitted feedback', 'X',
|
|
1050
|
+
// { duration: 5000, panelClass: ['error'] }
|
|
1051
|
+
// )
|
|
1052
|
+
// }
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
shareAIFeedback(item, result, index, cindex) {
|
|
1056
|
+
let requestBody = {
|
|
1057
|
+
"query_id": item?.query_id,
|
|
1058
|
+
// "response": item?.description,
|
|
1059
|
+
"comments": result,
|
|
1060
|
+
"is_liked": false,
|
|
1061
|
+
"rating": "0"
|
|
1062
|
+
};
|
|
1063
|
+
this.chatbotService.shareAIFeedback(requestBody, this.chatId, this.userId).subscribe((data) => {
|
|
1064
|
+
if (data && data.status === 'success') {
|
|
1065
|
+
if (this.aiSearchResultArr && this.aiSearchResultArr.length && this.aiSearchResultArr[index]) {
|
|
1066
|
+
if (this.aiSearchResultArr[index].result && this.aiSearchResultArr[index].result[cindex])
|
|
1067
|
+
this.aiSearchResultArr[index].result[cindex]['feedback'] = 'down';
|
|
1068
|
+
}
|
|
1069
|
+
this.matSnackBarNew.open('Thank you for your feedback.', 'X', { duration: 5000, panelClass: ['success'] });
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
this.matSnackBarNew.open('Something is wrong. Please try again later.', 'X', { duration: 5000, panelClass: ['error'] });
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
callFromInternet(item, index) {
|
|
1077
|
+
this.resultFetch = false;
|
|
1078
|
+
this.aiSearchResultArr.push({ showBot: true, type: 'incoming', tab: 'support-ai', answer: '', newMessage: '' });
|
|
1079
|
+
if (this.aiSearchResultArr[index] && this.aiSearchResultArr[index]['showFromInternet']) {
|
|
1080
|
+
this.aiSearchResultArr[index]['showFromInternet'] = false;
|
|
1081
|
+
}
|
|
1082
|
+
if (item && !item.answer) {
|
|
1083
|
+
let internetGlobalSearchRequest = {
|
|
1084
|
+
"query": this.cloneSearchQuery,
|
|
1085
|
+
"designation": this.userInfo?.professionalDetails && this.userInfo?.professionalDetails.length ? this.userInfo?.professionalDetails[0].designation : '',
|
|
1086
|
+
"department": this.userInfo?.departmentName ? this.userInfo?.departmentName : '',
|
|
1087
|
+
};
|
|
1088
|
+
this.chatbotService.aiGlobalSearchFromInternet(internetGlobalSearchRequest, this.chatId, this.userId).subscribe((idata) => {
|
|
1089
|
+
this.resultFetch = true;
|
|
1090
|
+
this.aiSearchResultArr.map((item, index) => {
|
|
1091
|
+
if (item && (item.newMessage === '')) {
|
|
1092
|
+
// delete this.aiSearchResultArr[index]
|
|
1093
|
+
this.aiSearchResultArr.splice(index, 1);
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
let resultObj = {
|
|
1097
|
+
message: idata.answer,
|
|
1098
|
+
recommendedQues: '',
|
|
1099
|
+
selectedValue: '',
|
|
1100
|
+
title: idata.answer,
|
|
1101
|
+
content: idata,
|
|
1102
|
+
mimeType: idata,
|
|
1103
|
+
contentType: idata,
|
|
1104
|
+
artifactUrl: idata,
|
|
1105
|
+
description: idata.answer,
|
|
1106
|
+
identifier: idata,
|
|
1107
|
+
contentStart: idata,
|
|
1108
|
+
contentEnd: idata,
|
|
1109
|
+
pageNumber: idata,
|
|
1110
|
+
query: this.cloneSearchQuery,
|
|
1111
|
+
query_id: idata.query_id,
|
|
1112
|
+
resourceLink: '',
|
|
1113
|
+
fromInternet: true,
|
|
1114
|
+
feedback: ''
|
|
1115
|
+
};
|
|
1116
|
+
this.iGOTAISearchResultArr.push(resultObj);
|
|
1117
|
+
let answer = idata.answer ? idata.answer.trim().replace(/\n/g, '<br>') : "";
|
|
1118
|
+
let shortAnswer = this.splitParagraphByWords(answer);
|
|
1119
|
+
this.aiSearchResultArr.push({ showBot: true, wordsCount: answer.trim().split(/\s+/).length, showLess: answer.trim().split(/\s+/).length > 30 ? true : false, answer: answer, shortAnswer: shortAnswer, result: this.iGOTAISearchResultArr, type: 'incoming', tab: 'support-ai', reterivedChunks: this.aiSearchResult.RetrievedChunks, showFromInternet: false });
|
|
1120
|
+
this.aiSearchResultArr.map((item, index) => {
|
|
1121
|
+
if (item && (item.newMessage === '')) {
|
|
1122
|
+
// delete this.aiSearchResultArr[index]
|
|
1123
|
+
this.aiSearchResultArr.splice(index, 1);
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
// setTimeout(()=>{
|
|
1127
|
+
// this.scrollToBottomEvent.emit()
|
|
1128
|
+
// },0)
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
rejectFromInternet(index) {
|
|
1133
|
+
if (this.aiSearchResultArr[index] && this.aiSearchResultArr[index]['showFromInternet']) {
|
|
1134
|
+
this.aiSearchResultArr[index]['showFromInternet'] = false;
|
|
1135
|
+
}
|
|
1136
|
+
this.resultFetch = true;
|
|
1137
|
+
this.aiSearchResultArr.map((item, index) => {
|
|
1138
|
+
if (item && (item.newMessage === '')) {
|
|
1139
|
+
// delete this.aiSearchResultArr[index]
|
|
1140
|
+
this.aiSearchResultArr.splice(index, 1);
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
copyPath(item, cindex) {
|
|
1145
|
+
const selBox = document.createElement('textarea');
|
|
1146
|
+
selBox.style.position = 'fixed';
|
|
1147
|
+
selBox.style.left = '0';
|
|
1148
|
+
selBox.style.top = '0';
|
|
1149
|
+
selBox.style.opacity = '0';
|
|
1150
|
+
selBox.value = item.mimeType === 'application/pdf' ? `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/pdf/${item.identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&pn=${item.pageNumber}` : `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/video/${item.identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&st=${item?.contentStart}&et=${item?.contentEnd}`;
|
|
1151
|
+
document.body.appendChild(selBox);
|
|
1152
|
+
selBox.focus();
|
|
1153
|
+
selBox.select();
|
|
1154
|
+
document.execCommand('copy');
|
|
1155
|
+
document.body.removeChild(selBox);
|
|
1156
|
+
this.copiedIndex = cindex;
|
|
1157
|
+
setTimeout(() => {
|
|
1158
|
+
this.copiedIndex = -1;
|
|
1159
|
+
}, 1000);
|
|
1160
|
+
}
|
|
1161
|
+
redirectToResource(item) {
|
|
1162
|
+
let path = (item.mimeType) === 'application/pdf' ? `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/pdf/${item.identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&pn=${item.pageNumber}` : `https://portal.igotkarmayogi.gov.in/app/amrit-gyaan-kosh/player/video/${item.identifier}?primaryCategory=Learning Resource&from=globalSearch&playerPreview=true&st=${item?.contentStart}&et=${item?.contentEnd}`;
|
|
1163
|
+
window.open(path, '_blank');
|
|
1164
|
+
}
|
|
1165
|
+
redirectToToc(chat) {
|
|
1166
|
+
const event = {
|
|
1167
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
1168
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
1169
|
+
data: {
|
|
1170
|
+
edata: { type: 'click', "id": "card-content", "pageid": "/page/home" },
|
|
1171
|
+
object: { id: chat?.identifier, type: chat?.contentType },
|
|
1172
|
+
state: WsEvents.EnumTelemetrySubType.Interact,
|
|
1173
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
1174
|
+
mode: 'view',
|
|
1175
|
+
},
|
|
1176
|
+
pageContext: { pageId: '/page/home', module: 'Home' },
|
|
1177
|
+
from: '',
|
|
1178
|
+
to: 'Telemetry',
|
|
1179
|
+
};
|
|
1180
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
1181
|
+
let path = `https://portal.igotkarmayogi.gov.in/app/toc/${chat?.identifier}/overview`;
|
|
1182
|
+
window.open(path, '_blank');
|
|
1183
|
+
}
|
|
1184
|
+
splitParagraphByWords(paragraph, wordsPerChunk = 30) {
|
|
1185
|
+
const words = paragraph.trim().split(/\s+/);
|
|
1186
|
+
const chunks = [];
|
|
1187
|
+
for (let i = 0; i < wordsPerChunk; i++) {
|
|
1188
|
+
chunks.push(words[i]);
|
|
1189
|
+
}
|
|
1190
|
+
return chunks.join(' ');
|
|
1191
|
+
}
|
|
1192
|
+
toggleShow(index, showType) {
|
|
1193
|
+
if (showType === 'less') {
|
|
1194
|
+
this.aiSearchResultArr[index]['showLess'] = true;
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
this.aiSearchResultArr[index]['showLess'] = false;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
get userInitials() {
|
|
1201
|
+
return this.initials;
|
|
1202
|
+
}
|
|
1203
|
+
createInititals(name) {
|
|
1204
|
+
const randomIndex = Math.floor(Math.random() * Math.floor(this.colors.length));
|
|
1205
|
+
this.circleColor = this.colors[randomIndex];
|
|
1206
|
+
if (this.randomcolors) {
|
|
1207
|
+
const randomIndex1 = Math.floor(Math.random() * Math.floor(this.randomcolors.length));
|
|
1208
|
+
this.circleColor = this.randomcolors[randomIndex1];
|
|
1209
|
+
}
|
|
1210
|
+
let initials = '';
|
|
1211
|
+
const array = `${name} `.toString().split(' ');
|
|
1212
|
+
if (array[0] !== 'undefined' && typeof array[1] !== 'undefined') {
|
|
1213
|
+
initials += array[0].charAt(0);
|
|
1214
|
+
initials += array[1].charAt(0);
|
|
1215
|
+
}
|
|
1216
|
+
else {
|
|
1217
|
+
for (let i = 0; i < name.length; i += 1) {
|
|
1218
|
+
if (name.charAt(i) === ' ') {
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (name.charAt(i) === name.charAt(i)) {
|
|
1222
|
+
initials += name.charAt(i);
|
|
1223
|
+
if (initials.length === 2) {
|
|
1224
|
+
break;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
this.initials = initials.toUpperCase();
|
|
1230
|
+
}
|
|
1231
|
+
raiseTelemetryForResource(item) {
|
|
1232
|
+
const event = {
|
|
1233
|
+
eventType: WsEvents.WsEventType.Telemetry,
|
|
1234
|
+
eventLogLevel: WsEvents.WsEventLogLevel.Info,
|
|
1235
|
+
data: {
|
|
1236
|
+
edata: { type: 'click', "id": "card-content", "pageid": "/page/home" },
|
|
1237
|
+
object: { id: item?.identifier, type: item?.contentType },
|
|
1238
|
+
state: WsEvents.EnumTelemetrySubType.Interact,
|
|
1239
|
+
eventSubType: WsEvents.EnumTelemetrySubType.Chatbot,
|
|
1240
|
+
mode: 'view',
|
|
1241
|
+
},
|
|
1242
|
+
pageContext: { pageId: '/page/home', module: 'Home' },
|
|
1243
|
+
from: '',
|
|
1244
|
+
to: 'Telemetry',
|
|
1245
|
+
};
|
|
1246
|
+
this.eventSvc.dispatchChatbotEvent(event);
|
|
1247
|
+
}
|
|
1248
|
+
resizeTextarea(textArea, _fromInput) {
|
|
1249
|
+
if (textArea) {
|
|
1250
|
+
textArea.style.height = 'auto'; // Reset height first
|
|
1251
|
+
requestAnimationFrame(() => {
|
|
1252
|
+
textArea.style.height = textArea.scrollHeight + 'px';
|
|
1253
|
+
const computed = getComputedStyle(textArea);
|
|
1254
|
+
const paddingTop = parseFloat(computed.paddingTop) || 0;
|
|
1255
|
+
const paddingBottom = parseFloat(computed.paddingBottom) || 0;
|
|
1256
|
+
const marginExtra = 0;
|
|
1257
|
+
this.containerHeight = textArea.scrollHeight + paddingTop + paddingBottom + marginExtra;
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
resetTextAreaHeight(_textArea) {
|
|
1262
|
+
if (this.textArea.nativeElement && this.textArea.nativeElement.style && this.textArea.nativeElement.style.height) {
|
|
1263
|
+
setTimeout(() => {
|
|
1264
|
+
this.searchQuery = this.searchQuery.trim();
|
|
1265
|
+
this.textArea.nativeElement.style.height = 'auto';
|
|
1266
|
+
this.textArea.nativeElement.style.height = '30px';
|
|
1267
|
+
const computed = getComputedStyle(this.textArea.nativeElement);
|
|
1268
|
+
const paddingTop = parseFloat(computed.paddingTop) || 0;
|
|
1269
|
+
const paddingBottom = parseFloat(computed.paddingBottom) || 0;
|
|
1270
|
+
const marginExtra = 0;
|
|
1271
|
+
this.containerHeight = 30 + paddingTop + paddingBottom + marginExtra;
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
toggleNestedItem(planId) {
|
|
1276
|
+
this.expandedPlanIds[planId] = !this.expandedPlanIds[planId];
|
|
1277
|
+
}
|
|
1278
|
+
formatPlanMeta(meta) {
|
|
1279
|
+
if (!meta)
|
|
1280
|
+
return '';
|
|
1281
|
+
return meta.replace('Ends:', 'Due');
|
|
1282
|
+
}
|
|
1283
|
+
getCourseStatusClass(meta) {
|
|
1284
|
+
console.log('meta', meta);
|
|
1285
|
+
if (!meta)
|
|
1286
|
+
return 'status-not-started';
|
|
1287
|
+
const lower = meta.toLowerCase();
|
|
1288
|
+
if (lower.includes('completed'))
|
|
1289
|
+
return 'status-completed';
|
|
1290
|
+
if (lower.includes('in progress'))
|
|
1291
|
+
return 'status-in-progress';
|
|
1292
|
+
return 'status-not-started';
|
|
1293
|
+
}
|
|
1294
|
+
selectNestedPickerItem(activity, child) {
|
|
1295
|
+
this.chatActivities.push({
|
|
1296
|
+
sender: 'user',
|
|
1297
|
+
text: child.label,
|
|
1298
|
+
timestamp: new Date()
|
|
1299
|
+
});
|
|
1300
|
+
this.sendTurn({
|
|
1301
|
+
action: 'pick_item',
|
|
1302
|
+
picker_id: activity.picker_id,
|
|
1303
|
+
item_id: child.id
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
ngOnDestroy() {
|
|
1307
|
+
}
|
|
1308
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SupportAIComponent, deps: [{ token: i1$1.ConfigurationsService }, { token: i1$1.EventService }, { token: i0.Renderer2 }, { token: ChatbotService }, { token: i3.MatSnackBar }, { token: SupportAiService }, { token: i5.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1309
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: SupportAIComponent, isStandalone: false, selector: "ws-app-support-ai", inputs: { from: "from", userJourney: "userJourney", chatId: "chatId", userId: "userId", fullScreenChatFlag: "fullScreenChatFlag", activeLaguage: "activeLaguage" }, outputs: { scrollToBottomEvent: "scrollToBottomEvent" }, viewQueries: [{ propertyName: "myScrollContainer", first: true, predicate: ["scrollMe"], descendants: true }, { propertyName: "textArea", first: true, predicate: ["autoResizeTextarea"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"igot-ai-container\" id=\"igot-ai-container\">\r\n <div class=\"message-container\" id=\"message-container\">\r\n\r\n <div [ngClass]=\"fullScreenChatFlag ? 'message-container-full' : 'message-container'\" id=\"message-container\">\r\n <!-- <ng-container *ngIf=\"aiSearchResultArr?.length === 0\"> -->\r\n <!-- <div [ngClass]=\"fullScreenChatFlag ? 'start-chat-full':'start-chat'\"> -->\r\n <!-- <h2 class=\"hey\">Hey<span *ngIf=\"userInfo?.firstName\">, {{userInfo?.firstName}}</span> </h2>\r\n <p>Welcome to Support AI, Your dedicated support assistant for instant help, step-by-step guidance, and\r\n personalized support tailored to your needs.</p> -->\r\n <!-- </div> -->\r\n <!-- </ng-container> -->\r\n <ng-container>\r\n <div class=\"flex row-start incoming-msg margin-bottom-s text-center justify-around mt-2\">\r\n <div class=\"loading-bar-icon flex flex-row vertical-middle\">\r\n <!-- <div class=\"mt-2\"><span class=\"blue-color\">Initializing Support AI</span></div> -->\r\n <div>\r\n <!-- <div>\r\n <img alt=\"ai-icon\" class=\"blue-loader-animation\" height=\"18\" width=\"18\" src=\"/assets/ai-tutor/blue-loader.png\">\r\n </div> -->\r\n\r\n </div>\r\n <div class=\"support-ai-chat-container\">\r\n <div *ngFor=\"let item of chatActivities\">\r\n\r\n <!-- user message -->\r\n <div *ngIf=\"item.sender === 'user'\">\r\n <div class=\"flex width-1-1 row-end padding-top-l padding-bottom-m\">\r\n <div class=\"user-seleted-question padding-xs\">\r\n <mat-icon *ngIf=\"item.icon\" class=\"user-msg-icon\">{{item.icon}}</mat-icon>\r\n {{ item.text }}\r\n\r\n </div>\r\n\r\n <div class=\"user-icon\" *ngIf=\"userIcon\">\r\n <img [src]=\"userIcon\">\r\n </div>\r\n\r\n <div class=\"circle-s user-icon\" *ngIf=\"!userIcon\" [ngStyle]=\"{'background-color': circleColor}\">\r\n\r\n {{ userInitials }}\r\n\r\n </div>\r\n\r\n </div>\r\n <div *ngIf=\"item.timestamp\" class=\"user-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div>\r\n <div *ngIf=\"loadingSupportAI\">\r\n Please Wait...\r\n </div>\r\n </div>\r\n <!-- bot markdown message -->\r\n <div *ngIf=\"item.activity?.type === 'markdown'\">\r\n <div class=\"flex row-start\">\r\n <div class=\"system-icon\">\r\n <div class=\"bot-avatar-circle\">\r\n <!-- <mat-icon>smart_toy</mat-icon>\r\n -->\r\n <img src=\"/assets/ai-tutor/roboicon.svg\" alt=\"\" srcset=\"\">\r\n </div>\r\n </div>\r\n <div class=\"system-msg padding-xs\">\r\n <markdown [data]=\"item.activity.content\">\r\n </markdown>\r\n </div>\r\n </div>\r\n <div *ngIf=\"item.showTimestamp\" class=\"msg-timestamp bot-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"item.activity?.type === 'picker'\" class=\"picker-container\">\r\n\r\n <!-- Dropdown Header -->\r\n\r\n <div class=\"picker-header\" (click)=\"pickerOpened = !pickerOpened\">\r\n <img class=\"vectorIcon\" src=\"/assets/ai-tutor/Vector.svg\" alt=\"\"> <span\r\n class=\"selectcoursetext startconv\">Select the course</span>\r\n\r\n\r\n <mat-icon>\r\n {{ pickerOpened ? 'expand_less' : 'expand_more' }}\r\n </mat-icon>\r\n\r\n </div>\r\n\r\n <!-- Dropdown -->\r\n\r\n <div *ngIf=\"pickerOpened\" class=\"picker-dropdown\">\r\n <input type=\"text\" [(ngModel)]=\"pickerSearch\" (input)=\"filterPickerItems()\" placeholder=\"Search\" />\r\n\r\n <div *ngFor=\"let course of filteredPickerItems\" class=\"picker-item\"\r\n (click)=\"selectPickerItem(course)\">\r\n\r\n {{ course.label }}\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n <!-- nested picker (training plans with expandable courses) -->\r\n <div *ngIf=\"item.activity?.type === 'nested_picker'\" class=\"nested-picker-wrapper\">\r\n <div *ngFor=\"\r\n let plan of (\r\n showAllPlans\r\n ? item.activity.items\r\n : (item.activity.items | slice:0:3)\r\n )\r\n \" class=\"nested-plan-item\">\r\n\r\n\r\n <!-- Plan Row -->\r\n <div class=\"nested-plan-row\" (click)=\"toggleNestedItem(plan.id)\">\r\n <span class=\"nested-plan-name\">{{plan.label}}</span>\r\n <span class=\"nested-plan-meta\">{{formatPlanMeta(plan.meta)}}</span>\r\n <span class=\"nested-plan-toggle\">\r\n <mat-icon class=\"toggle-icon\">{{ expandedPlanIds[plan.id] ? 'remove' : 'add' }}</mat-icon>\r\n </span>\r\n </div>\r\n\r\n <!-- Expanded Courses -->\r\n <!-- <div *ngIf=\"expandedPlanIds[plan.id]\" class=\"nested-courses\">\r\n <div *ngFor=\"let course of plan.children\" class=\"nested-course-row\"\r\n (click)=\"selectNestedPickerItem(item.activity, course)\">\r\n <span class=\"nested-course-name\">{{course.label}}</span>\r\n <span class=\"nested-course-status\" [ngClass]=\"getCourseStatusClass(course.meta)\"></span>\r\n </div>\r\n </div> -->\r\n <div *ngIf=\"expandedPlanIds[plan.id]\" class=\"nested-courses\">\r\n\r\n <div *ngFor=\"\r\n let course of (\r\n plan.showAllCourses\r\n ? plan.children\r\n : (plan.children | slice:0:3)\r\n )\r\n \" class=\"nested-course-row\" (click)=\"selectNestedPickerItem(item.activity, course)\">\r\n\r\n <span class=\"nested-course-name\">{{ course.label }}</span>\r\n <span class=\"nested-course-status\" [ngClass]=\"getCourseStatusClass(course?.progress?.status)\">\r\n </span>\r\n\r\n </div>\r\n <button *ngIf=\"!plan.showAllCourses && plan.children?.length > 3\" class=\"view-more-btn\"\r\n (click)=\"plan.showAllCourses = true; $event.stopPropagation()\">\r\n\r\n View More ({{ plan.children.length - 3 }})\r\n\r\n </button>\r\n<div class=\"course-status-legend\">\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-completed\"></span>\r\n <span>Completed</span>\r\n </div>\r\n\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-in-progress\"></span>\r\n <span>In progress</span>\r\n </div>\r\n\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-not-started\"></span>\r\n <span>Not started</span>\r\n </div>\r\n</div>\r\n\r\n\r\n <!-- Optional -->\r\n <!--\r\n <button\r\n *ngIf=\"plan.showAllCourses && plan.children?.length > 3\"\r\n class=\"view-more-btn\"\r\n (click)=\"plan.showAllCourses = false; $event.stopPropagation()\">\r\n\r\n View Less\r\n\r\n </button>\r\n -->\r\n\r\n </div>\r\n </div>\r\n <button *ngIf=\"!showAllPlans && item.activity.items?.length > 3\" class=\"view-more-btn\"\r\n (click)=\"showAllPlans = true\">\r\n\r\n View More ({{ item.activity.items.length - 3 }})\r\n\r\n </button>\r\n </div>\r\n\r\n <!-- quick replies -->\r\n\r\n <div *ngIf=\"item.activity?.type === 'quick_replies'\">\r\n\r\n <div class=\"quick-replies-container\">\r\n\r\n <button *ngFor=\"\r\n let choice of (\r\n item.showAllChoices\r\n ? item.activity.choices\r\n : (item.activity.choices | slice:0:3)\r\n )\r\n \" (click)=\"selectChoice(choice)\" class=\"quick-reply-btn\">\r\n <mat-icon class=\"quick-reply-icon\">{{choice.icon || 'help_outline'}}</mat-icon>\r\n <span class=\"quick-reply-label\">{{choice.label}}</span>\r\n <mat-icon class=\"quick-reply-chevron\">navigate_next</mat-icon>\r\n </button>\r\n\r\n <button *ngIf=\"!item.showAllChoices && item.activity.choices?.length > 3\" class=\"view-more-btn flex\"\r\n (click)=\"item.showAllChoices = true\">\r\n\r\n View More ({{ item.activity.choices.length - 3 }})\r\n\r\n </button>\r\n\r\n <!-- <button\r\n *ngIf=\"item.showAllChoices && item.activity.choices?.length > 3\"\r\n class=\"view-more-btn\"\r\n (click)=\"item.showAllChoices = false\">\r\n\r\n View Less\r\n\r\n</button> -->\r\n\r\n </div>\r\n\r\n <!-- <div *ngIf=\"item.showTimestamp\" class=\"msg-timestamp bot-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div> -->\r\n\r\n </div>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"start-new-conv-container\">\r\n <button class=\"start-new-conv-btn\" (click)=\"startNewConversation()\">\r\n <mat-icon class=\"start-new-conv-icon\">chevron_left</mat-icon>\r\n <span class=\"startconv\">Start new conversation...</span>\r\n </button>\r\n </div>\r\n <div *ngIf=\"showRetry\" class=\"retry-container\">\r\n <button class=\"retry-btn start-new-conv-btn\" (click)=\"retryApi()\">\r\n Retry\r\n </button>\r\n </div>\r\n\r\n </ng-container>\r\n\r\n\r\n </div>\r\n <div [ngClass]=\"fullScreenChatFlag ? 'control-container-full':'control-container'\">\r\n <div [class]=\"isInputEnabled ? 'border-gradient-rounded' : 'disabledinputcl border-gradient-rounded'\"\r\n [style.height.px]=\"containerHeight\">\r\n <div class=\"flex flex-row ml-5 mr-1 justify-between\">\r\n\r\n <div class=\"query-box\">\r\n <!-- <input class=\"width-500\" type=\"text\" placeholder=\"Ask anything...\" [(ngModel)]=\"searchQuery\" (keydown.enter)=\"submitSearchQuery()\"/> -->\r\n <textarea #autoResizeTextarea class=\"width-500\" [disabled]=\"!isInputEnabled\" placeholder=\"Ask Anything...\"\r\n (input)=\"resizeTextarea(autoResizeTextarea, 'fromInput')\" [(ngModel)]=\"searchQuery\"\r\n (keydown.enter)=\"submitSearchQuery(autoResizeTextarea, $event)\" rows=\"1\">\r\n </textarea>\r\n </div>\r\n\r\n <div class=\"mt-1\">\r\n <button type=\"button\" class=\"flex-auto-display send-btn\"\r\n [disabled]=\"!isInputEnabled || !searchQuery?.trim()\"\r\n (click)=\"submitSearchQuery(autoResizeTextarea,$event)\"\r\n [disabled]=\"!searchQuery || !initiateSupportNewChat\">\r\n <mat-icon class=\"send-btn-icon\">send</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n\r\n </div>\r\n </div>", styles: [".hey{background:linear-gradient(90deg,#32b9dfde,#1b4ca1de);-webkit-background-clip:text;background-clip:text;color:transparent}.ai-generated-content{background:linear-gradient(90deg,#f3962f,#1b4ca1);-webkit-background-clip:text;background-clip:text;color:transparent}.ai-tutor-container .control-container{position:fixed;bottom:10px;width:24%;margin-left:1%;z-index:2}.ai-tutor-container-chatbot .control-container{position:fixed;bottom:100px;width:600px;margin:1%;z-index:2}.control-container{position:fixed;bottom:80px;width:415px;z-index:2}.start-chat{text-align:center;padding-top:50%}.start-chat-full{text-align:center;padding-top:10%;width:100vw}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff80}.query-box{min-height:36px;transition:height .2s;width:100%}.query-box input{border:0;outline:0}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:100%;min-height:36px}.send-btn{background-color:transparent!important;color:#1b4ca1!important;border:none!important}.message-container{height:100%;min-width:400px;width:100%;z-index:2;position:relative}.message-container-full{height:100%;min-width:96vw;width:100%;z-index:2;position:relative}.ai-tutor-container{background-image:url(/assets/ai-tutor/background.svg);height:90vh}.ai-tutor-container-chatbot{background-image:url(/assets/ai-tutor/background.svg);height:90vh;width:560px}.ai-tutor-container:before{content:\"\";position:absolute;inset:0;background-color:#ffffffe6;z-index:1;height:100vh}.chatbot-icon-container{position:fixed;bottom:120px;right:0;cursor:pointer;height:90px;align-items:flex-start;display:flex;justify-content:center;width:auto;z-index:999999999}.chatbot-icon{position:absolute;right:30px;-moz-animation-delay:1s;-webkit-animation-delay:1s;-o-animation-delay:1s;animation-delay:1s;transition:1s ease}.chatbot-icon-expanded{right:0}.expand-text{width:110px;display:flex;align-items:center;justify-content:center;background-color:#1b4ca1;color:#fff;font-size:18px;border-top:2px solid #fff;border-bottom:2px solid #fff;vertical-align:middle}.chatbot{width:610px;position:fixed;bottom:20px;right:50px;z-index:9999999999;border-radius:15px;background-color:#fff;box-shadow:0 6px 16px #0000003d;height:calc(100vh - 20%)}.cb-close{cursor:pointer}.cb-header{color:#fff!important;background-color:#1b4ca1;border-top-left-radius:15px;border-top-right-radius:15px;align-items:center;justify-content:space-between;position:absolute;width:100%;top:0}.cb-header .user-info-div{width:88%;justify-content:space-between}.cb-header .lang-select{height:32px;background-color:#fff;border-color:#00000029!important}.cb-header .user-name{padding-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:74%}.cb-content{background-color:#f0f3f4;overflow:auto}.cb-topics{padding:16px;background-color:#f5f5f5;overflow:auto}.cb-footer{border-bottom-left-radius:15px;border-bottom-right-radius:15px;background-color:#fff}.cb-footer .info{width:33%;padding:5px 0;align-items:center;display:flex;justify-content:center;flex-wrap:wrap;cursor:pointer}.cb-footer .info .info-text{font-size:10px;width:100%;text-align:center}.cb-footer .info .info-icon{height:24px}.br-br{border-bottom-right-radius:15px}.br-bl{border-bottom-left-radius:15px}.language{background-color:#0000000a}.active{background-color:#fbead1;border-top:3px solid rgb(239,149,30)}.active .mat-icon{color:#ef951e!important}.cat-list{margin:0;padding:0;width:100%;display:flex}.cat-item{padding:10px 16px;border-radius:21px;border:1px solid rgba(0,0,0,.16);background-color:#0000000a;opacity:1;color:#000000de;font-family:Lato-Regular,sans-serif;font-size:14px;font-weight:400;font-style:normal;letter-spacing:.25px;text-align:center;line-height:20px;width:fit-content;margin-right:12px;height:fit-content;cursor:pointer;white-space:nowrap}.lang-select{width:70px}.lang-select .mat-form-field-flex{background-color:#fff!important}.lang-select .mat-form-field-underline{background-color:transparent!important}.loader{position:absolute;left:50%;top:39%}.default-info .default-icon{width:60px;float:left;display:flex;flex-wrap:wrap}.default-info .default-msg{background-color:#0000000a;border:1px solid rgba(0,0,0,.16);border-radius:0 15px 15px;display:flex;flex-wrap:wrap}.chat-bot-icon{padding-top:8px}.row-start{justify-content:flex-start}.row-start .system-icon{padding-right:3px}.row-start .system-msg{background-color:#d1dbec;border:1px solid rgb(209,219,236);border-radius:0 15px 15px;display:flex;flex-wrap:wrap;min-width:auto;max-width:85%;height:100%;word-break:break-word}.row-start .system-msg ::ng-deep markdown p{margin:0}.word-break{word-break:break-all;white-space:unset}.margin-left-5{margin-left:5%}.question-hint{font-weight:700}.recommended-question{display:flex;flex-wrap:wrap;height:fit-content}.recommended-question .rec-item{height:fit-content}.recommended-question .my-5px{margin-top:5px;margin-bottom:5px}.recommended-question .mr-5px{margin-right:5px}.recommended-question .btn-default{background:#d5c7c70a;border:1px solid #1B4CA1;color:#1b4ca1;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.recommended-question .showmore-icon{align-items:flex-start}.recommended-question .btn-active{background:#000;border:1px solid rgba(0,0,0,.16);color:#fff}.recommended-question-for-resource{display:flex;flex-wrap:wrap;height:fit-content}.recommended-question-for-resource .rec-item{height:fit-content}.recommended-question-for-resource .my-5px{margin-top:5px;margin-bottom:5px}.recommended-question-for-resource .mr-5px{margin-right:5px}.recommended-question-for-resource .btn-default{background:#d5c7c70a;border:1px solid #F3962F;color:#1b4ca1;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.recommended-question-for-resource .showmore-icon{align-items:flex-start}.recommended-question-for-resource .btn-active{background:#000;border:1px solid rgba(0,0,0,.16);color:#fff}.btn-show-more,.btn-show-less{background:#1b4ca1;color:#fff;padding:10px 20px;font-size:14px;cursor:pointer;border-radius:40px}.row-end{justify-content:flex-end;height:100%}.row-end .user-seleted-question{background-color:#000;border-radius:15px 0 15px 15px;display:flex;flex-wrap:wrap;color:#fff;float:right;text-align:left;max-width:62%;word-break:break-word}.highlight-title{color:#1b4ca1}.incoming-msg{height:fit-content;width:100%}.hint-text{color:#1b4ca1}@media only screen and (max-width:600px){.chatbot{right:6px;bottom:67px}}@media only screen and (max-width:390px){.chatbot{right:6px;bottom:67px}}.chatbot-wrapper{position:relative}.cb-content-wrapper{position:absolute;width:100%;top:64px;bottom:130px;max-height:100%;overflow:auto;box-sizing:border-box;background-color:#f0f3f4}.cb-footer-wrapper{position:absolute;width:100%;bottom:0}.my-5px{margin-top:5px;margin-bottom:5px;margin-left:20px}.mr-5px{margin-right:5px}*,:after,:before{box-sizing:border-box}::ng-deep .disable-scroll{overflow-x:hidden!important;overflow:hidden}@media only screen and (max-width:600px){.chatbot{right:0;bottom:0;width:100%;height:100svh;z-index:999999999}.cb-footer-wrapper{bottom:0}.cb-content-wrapper{bottom:130px}.chatbot-icon-container{bottom:190px}.cb-header{border-top-left-radius:unset;border-top-right-radius:unset}.cb-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}.br-br{border-bottom-right-radius:unset}.br-bl{border-bottom-left-radius:unset}}.feefback-section{margin-left:10PX}.vertical-middle{vertical-align:middle}.resource-icon{margin-left:7%}.resource-link{margin-left:40px}.resource-icon img{height:65px;width:115.25px}.font-12{font-size:12px;margin-left:20px}.send-btn-icon{height:22px!important}.link{color:#1b4ca1;text-decoration:underline}.width-500{width:350px}.system-icon img{height:36px;width:36px}.circle-s{border-radius:50%;width:36px;height:36px;display:flex;justify-content:center;align-items:center;margin-left:4px}.circle-s img{border-radius:50%;width:100%;height:100%}.circle-s .initials{color:#fff;font-size:10px;line-height:12px;font-size:14px;letter-spacing:.2625px}.copied-tooltip{position:absolute;left:20%;transform:translate(-50%);background-color:#000;color:#fff;padding:4px 8px;border-radius:4px;font-size:12px;opacity:1;pointer-events:none;transition:opacity .3s ease;z-index:999}.loading-bar-icon{width:90%}.loading-bar-icon img{height:50px;width:50px}.content-duration{position:relative;background:#f3962f;color:#fff;width:100px;border-radius:8px;text-align:center;margin-top:1px;padding:0 5px;font-size:12px;display:flex;align-items:center;justify-content:center}.content-duration .mat-icon{vertical-align:middle;color:#fff!important;height:14px!important;width:14px!important;font-size:14px}.position-relative{position:relative}.user-icon{margin-left:5px}.user-icon img{height:36px;width:36px;border-radius:50%}.control-container-full{position:fixed;bottom:80px;width:97%;z-index:2}@media(min-width:768)and (max-width:1200px){.message-container{height:100%;min-width:300px;width:100%;z-index:2;position:relative}.control-container{position:fixed;bottom:100px;width:41%;z-index:2}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding-top:10%}}@media(max-width:767px){.message-container{height:100%;width:100%;z-index:2;position:relative;padding-right:35px}.control-container{position:fixed;bottom:100px;width:100%;z-index:2;padding-left:8px}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding:10% 15px;width:100%}.incoming-msg{height:fit-content;width:100%;margin-left:5px}}@media(min-width:768px)and (max-width:1023px){.igot-ai-container{width:100vw}.message-container{height:100%;width:100%;z-index:2;position:relative;padding-right:15px}.control-container{position:fixed;bottom:80px;width:100%;z-index:2;padding-left:8px}.incoming-msg{height:fit-content;width:100%;margin-left:5px}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding-top:10%}}.w-92{width:92%}::ng-deep .copy-icon .material-icons{font-size:18px!important}::ng-deep .copy-icon .mat-icon{vertical-align:middle}.internet-result-query{background:#add8e6;border:1px solid #1B4CA1;color:#000;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.blue-color{color:#1b4ca1;font-size:14px;font-weight:700}.web-button{background-color:#fff;color:#1b4ca1;border-radius:8px;padding:10px;border:1px solid #1B4CA1}.web-search-icon,.web-close-icon{color:#1b4ca1;vertical-align:middle}.rotate-180{rotate:180deg}.feedback-icon{height:18px;width:18px}.h-w-34{height:34px;width:34px}.timeout-error-block{background:#ffb6c185;border:1px solid lightpink;padding:0 10px;border-radius:16px;font-size:16px!important}.autorenew-icon .mat-icon{height:auto;width:auto}.autorenew-btn{background:red;border:1px solid lightpink;border-radius:8px;color:#fff;font-size:14px}.font-16{font-size:16px!important}.h-36{height:36px}.error-for-failed{background:red;font-weight:400}.error-for-failed-btn{background-color:#fff;color:red;border-radius:8px;padding:10px;border:1px solid red}.failed-error{font-size:12px;color:#d13924;font-weight:400}.error-retry-icon,.error-close-icon{color:red;vertical-align:middle}.border-gradient-rounded textarea{width:100%;border:none;resize:none;overflow:hidden;font-size:14px;font-family:Lato;box-sizing:border-box;min-height:32px;padding-top:5px}.border-gradient-rounded textarea:focus{outline:none;border:1px solid transparent}.igot-ai-container{margin-bottom:15px}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.text-center{text-align:center!important}.justify-around{justify-content:space-around!important}.blue-loader-animation{width:18px;height:18px;animation:spin 2s linear infinite;transform-origin:center center}.support-ai-chat-container{display:flex;flex-direction:column;width:100%}.quick-replies-container{display:flex;flex-direction:column;gap:10px;padding:8px 0 4px}.quick-replies-container .quick-reply-btn{display:flex;align-items:center;width:100%;background:#fff;border:1.5px solid #1B4CA1;border-radius:8px;padding:10px 14px;cursor:pointer;text-align:left}.quick-replies-container .quick-reply-btn:hover{background:#1b4ca10a}.quick-replies-container .quick-reply-btn .quick-reply-icon{color:#1b4ca1;font-size:18px;height:18px;width:18px;margin-right:10px;flex-shrink:0}.quick-replies-container .quick-reply-btn .quick-reply-label{flex:1;font-size:14px;color:#1b4ca1;font-weight:600;line-height:20px}.quick-replies-container .quick-reply-btn .quick-reply-chevron{color:#1b4ca1;font-size:18px;height:18px;width:18px;flex-shrink:0}.start-new-conv-container{display:flex;justify-content:flex-start;padding:4px 0 8px 2px}.start-new-conv-container .start-new-conv-btn{display:flex;align-items:center;background:transparent;border:none;color:#1b4ca1;font-size:13px;cursor:pointer;padding:2px 0;font-family:Lato,sans-serif}.start-new-conv-container .start-new-conv-btn:hover{text-decoration:underline}.start-new-conv-container .start-new-conv-btn .start-new-conv-icon{font-size:16px;height:16px;width:16px;line-height:16px}.row-start{align-items:flex-start;margin-bottom:10px}.row-start .system-msg{background:#d1dbec;border:none;border-radius:4px 16px 16px;padding:14px 16px;max-width:82%;color:#4a4a4a;font-size:14px;line-height:1.45;box-shadow:none;text-align:left}.row-start .system-icon,.row-start .chat-bot-icon{margin-right:10px;margin-top:2px}.row-end{align-items:flex-start;margin:10px 0}.row-end .user-seleted-question{background:#172b4d;color:#fff;border-radius:16px 4px 16px 16px;padding:10px 16px;max-width:70%;font-size:14px;line-height:20px;word-break:break-word;box-shadow:none}.user-icon,.circle-s{margin-left:8px;margin-top:2px}.system-icon img,.user-icon img,.circle-s{width:34px;height:34px}.support-ai-chat-container{display:flex;flex-direction:column;gap:10px}.system-msg markdown,.system-msg markdown p{margin:0;font-size:14px;color:#4a4a4a;line-height:22px}.quick-replies-container{margin:8px 0 0 44px;display:flex;flex-direction:column;gap:8px}.quick-reply-btn{display:flex;align-items:center;width:100%;background:#fff;border:1.5px solid #1B4CA1;border-radius:8px;padding:10px 14px;min-height:44px;transition:.2s}.quick-reply-btn:hover{background:#1b4ca10a}.quick-reply-icon{color:#1b4ca1;margin-right:10px}.quick-reply-label{flex:1;text-align:left;color:#1b4ca1;font-size:14px;font-weight:600}.quick-reply-chevron{color:#1b4ca1}.start-new-conv-container{padding-left:44px;margin-top:6px}.start-new-conv-btn{color:#1b4ca1;font-size:13px;font-weight:500}.start-new-conv-icon{font-size:16px}.bot-avatar-circle{width:36px;height:36px;min-width:36px;border-radius:50%;background-color:#1b4ca1;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bot-avatar-circle mat-icon{color:#fff;font-size:20px;height:20px;width:20px;line-height:20px}.msg-timestamp{font-size:11px;color:#00000073;margin-top:4px}.bot-msg-timestamp{padding-left:44px;margin-bottom:6px}.user-msg-timestamp{font-size:11px;color:#00000073;text-align:right;padding-right:44px;margin-top:-6px;margin-bottom:6px}.user-msg-icon{vertical-align:middle;font-size:18px!important;height:18px!important;width:18px!important;margin-right:6px;color:#fff}.startconv{color:var(--Primary-KB-Primary-Light, #1B4CA1);font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:normal}.picker-container{margin-top:12px}.picker-header{border:1px solid #2b66ff;border-radius:24px;padding:12px 16px;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.picker-dropdown{margin-top:8px;border:1px solid #ddd;border-radius:12px;background:#fff;max-height:320px;overflow:auto}.picker-dropdown input{width:89%;padding:12px;border:1.5px solid lightgray;outline:none;margin-top:10px;border-radius:20px}.picker-item{padding:12px 16px;cursor:pointer}.picker-item:hover{background:#f5f7ff}.picker-viewport{height:300px;width:100%}.picker-item{padding:10px 16px;cursor:pointer;text-align:left;white-space:normal;line-height:20px;word-break:break-word}.picker-item:hover{background:#f5f5f5}.vectorIcon{width:22px!important;height:22px!important}.view-more-btn{width:100%;margin-top:8px;background:transparent;border:none;color:#1f5cb8;font-weight:600;cursor:pointer;text-align:center}.view-more-btn:hover{text-decoration:underline}.nested-picker-wrapper{display:flex;flex-direction:column;gap:8px;margin-top:10px;width:100%}.nested-plan-item{border:1.5px solid #1B4CA1;border-radius:8px;overflow:hidden;background:#fff}.nested-plan-row{display:flex;align-items:center;padding:10px 12px;cursor:pointer;gap:8px;transition:background .15s}.nested-plan-row:hover{background:#1b4ca10a}.nested-plan-name{flex:1;font-size:14px;font-weight:600;color:#1b4ca1;font-family:Lato,sans-serif;text-align:left;margin-left:11px}.nested-plan-meta{font-size:12px;color:#6b7280;white-space:nowrap;margin-right:4px}.nested-plan-toggle{display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;flex-shrink:0;color:#1b4ca1}.nested-plan-toggle .toggle-icon{font-size:18px;height:18px;width:18px;line-height:18px;color:#1b4ca1}.nested-courses{border-top:1px solid rgba(27,76,161,.15);background:#f9fafe}.nested-course-row{display:flex;align-items:center;padding:10px 16px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,.06);gap:10px;transition:background .15s}.nested-course-row:last-child{border-bottom:none}.nested-course-row:hover{background:#1b4ca10f}.nested-course-name{flex:1;font-size:13px;color:#1b4ca1;font-family:Lato,sans-serif;line-height:1.45;text-align:left}.nested-course-status{width:10px;height:10px;border-radius:50%;flex-shrink:0}.nested-course-status.status-completed{background-color:#22c55e}.nested-course-status.status-in-progress{background-color:#f59e0b}.nested-course-status.status-not-started{background-color:#d1d5db}.disabledinputcl{pointer-events:none;cursor:not-allowed!important;background-color:#f5f5f5;opacity:.6}.course-status-legend{display:flex;align-items:center;gap:16px;margin:10px 12px 12px;font-size:12px;color:#666}.legend-item{display:flex;align-items:center;gap:6px}.nested-course-status{width:8px;height:8px;border-radius:50%;display:inline-block}.status-completed{background:#22c55e}.status-in-progress{background:#f59e0b}.status-not-started{background:#bdbdbd}.retry-btn{background:#fff;color:#fff;padding:10px 20px;font-size:14px;cursor:pointer;border:1px solid #1B4CA1;border-radius:40px;margin-left:45px;color:#1b4ca1}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i9.MarkdownComponent, selector: "markdown, [markdown]", inputs: ["data", "src", "disableSanitizer", "inline", "srcRelativeLink", "clipboard", "clipboardButtonComponent", "clipboardButtonTemplate", "emoji", "katex", "katexOptions", "mermaid", "mermaidOptions", "lineHighlight", "line", "lineOffset", "lineNumbers", "start", "commandLine", "filterOutput", "host", "prompt", "output", "user"], outputs: ["error", "load", "ready"] }, { kind: "pipe", type: i6.SlicePipe, name: "slice" }, { kind: "pipe", type: i6.DatePipe, name: "date" }] }); }
|
|
1310
|
+
}
|
|
1311
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SupportAIComponent, decorators: [{
|
|
1312
|
+
type: Component,
|
|
1313
|
+
args: [{ selector: 'ws-app-support-ai', standalone: false, template: "<div class=\"igot-ai-container\" id=\"igot-ai-container\">\r\n <div class=\"message-container\" id=\"message-container\">\r\n\r\n <div [ngClass]=\"fullScreenChatFlag ? 'message-container-full' : 'message-container'\" id=\"message-container\">\r\n <!-- <ng-container *ngIf=\"aiSearchResultArr?.length === 0\"> -->\r\n <!-- <div [ngClass]=\"fullScreenChatFlag ? 'start-chat-full':'start-chat'\"> -->\r\n <!-- <h2 class=\"hey\">Hey<span *ngIf=\"userInfo?.firstName\">, {{userInfo?.firstName}}</span> </h2>\r\n <p>Welcome to Support AI, Your dedicated support assistant for instant help, step-by-step guidance, and\r\n personalized support tailored to your needs.</p> -->\r\n <!-- </div> -->\r\n <!-- </ng-container> -->\r\n <ng-container>\r\n <div class=\"flex row-start incoming-msg margin-bottom-s text-center justify-around mt-2\">\r\n <div class=\"loading-bar-icon flex flex-row vertical-middle\">\r\n <!-- <div class=\"mt-2\"><span class=\"blue-color\">Initializing Support AI</span></div> -->\r\n <div>\r\n <!-- <div>\r\n <img alt=\"ai-icon\" class=\"blue-loader-animation\" height=\"18\" width=\"18\" src=\"/assets/ai-tutor/blue-loader.png\">\r\n </div> -->\r\n\r\n </div>\r\n <div class=\"support-ai-chat-container\">\r\n <div *ngFor=\"let item of chatActivities\">\r\n\r\n <!-- user message -->\r\n <div *ngIf=\"item.sender === 'user'\">\r\n <div class=\"flex width-1-1 row-end padding-top-l padding-bottom-m\">\r\n <div class=\"user-seleted-question padding-xs\">\r\n <mat-icon *ngIf=\"item.icon\" class=\"user-msg-icon\">{{item.icon}}</mat-icon>\r\n {{ item.text }}\r\n\r\n </div>\r\n\r\n <div class=\"user-icon\" *ngIf=\"userIcon\">\r\n <img [src]=\"userIcon\">\r\n </div>\r\n\r\n <div class=\"circle-s user-icon\" *ngIf=\"!userIcon\" [ngStyle]=\"{'background-color': circleColor}\">\r\n\r\n {{ userInitials }}\r\n\r\n </div>\r\n\r\n </div>\r\n <div *ngIf=\"item.timestamp\" class=\"user-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div>\r\n <div *ngIf=\"loadingSupportAI\">\r\n Please Wait...\r\n </div>\r\n </div>\r\n <!-- bot markdown message -->\r\n <div *ngIf=\"item.activity?.type === 'markdown'\">\r\n <div class=\"flex row-start\">\r\n <div class=\"system-icon\">\r\n <div class=\"bot-avatar-circle\">\r\n <!-- <mat-icon>smart_toy</mat-icon>\r\n -->\r\n <img src=\"/assets/ai-tutor/roboicon.svg\" alt=\"\" srcset=\"\">\r\n </div>\r\n </div>\r\n <div class=\"system-msg padding-xs\">\r\n <markdown [data]=\"item.activity.content\">\r\n </markdown>\r\n </div>\r\n </div>\r\n <div *ngIf=\"item.showTimestamp\" class=\"msg-timestamp bot-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"item.activity?.type === 'picker'\" class=\"picker-container\">\r\n\r\n <!-- Dropdown Header -->\r\n\r\n <div class=\"picker-header\" (click)=\"pickerOpened = !pickerOpened\">\r\n <img class=\"vectorIcon\" src=\"/assets/ai-tutor/Vector.svg\" alt=\"\"> <span\r\n class=\"selectcoursetext startconv\">Select the course</span>\r\n\r\n\r\n <mat-icon>\r\n {{ pickerOpened ? 'expand_less' : 'expand_more' }}\r\n </mat-icon>\r\n\r\n </div>\r\n\r\n <!-- Dropdown -->\r\n\r\n <div *ngIf=\"pickerOpened\" class=\"picker-dropdown\">\r\n <input type=\"text\" [(ngModel)]=\"pickerSearch\" (input)=\"filterPickerItems()\" placeholder=\"Search\" />\r\n\r\n <div *ngFor=\"let course of filteredPickerItems\" class=\"picker-item\"\r\n (click)=\"selectPickerItem(course)\">\r\n\r\n {{ course.label }}\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n <!-- nested picker (training plans with expandable courses) -->\r\n <div *ngIf=\"item.activity?.type === 'nested_picker'\" class=\"nested-picker-wrapper\">\r\n <div *ngFor=\"\r\n let plan of (\r\n showAllPlans\r\n ? item.activity.items\r\n : (item.activity.items | slice:0:3)\r\n )\r\n \" class=\"nested-plan-item\">\r\n\r\n\r\n <!-- Plan Row -->\r\n <div class=\"nested-plan-row\" (click)=\"toggleNestedItem(plan.id)\">\r\n <span class=\"nested-plan-name\">{{plan.label}}</span>\r\n <span class=\"nested-plan-meta\">{{formatPlanMeta(plan.meta)}}</span>\r\n <span class=\"nested-plan-toggle\">\r\n <mat-icon class=\"toggle-icon\">{{ expandedPlanIds[plan.id] ? 'remove' : 'add' }}</mat-icon>\r\n </span>\r\n </div>\r\n\r\n <!-- Expanded Courses -->\r\n <!-- <div *ngIf=\"expandedPlanIds[plan.id]\" class=\"nested-courses\">\r\n <div *ngFor=\"let course of plan.children\" class=\"nested-course-row\"\r\n (click)=\"selectNestedPickerItem(item.activity, course)\">\r\n <span class=\"nested-course-name\">{{course.label}}</span>\r\n <span class=\"nested-course-status\" [ngClass]=\"getCourseStatusClass(course.meta)\"></span>\r\n </div>\r\n </div> -->\r\n <div *ngIf=\"expandedPlanIds[plan.id]\" class=\"nested-courses\">\r\n\r\n <div *ngFor=\"\r\n let course of (\r\n plan.showAllCourses\r\n ? plan.children\r\n : (plan.children | slice:0:3)\r\n )\r\n \" class=\"nested-course-row\" (click)=\"selectNestedPickerItem(item.activity, course)\">\r\n\r\n <span class=\"nested-course-name\">{{ course.label }}</span>\r\n <span class=\"nested-course-status\" [ngClass]=\"getCourseStatusClass(course?.progress?.status)\">\r\n </span>\r\n\r\n </div>\r\n <button *ngIf=\"!plan.showAllCourses && plan.children?.length > 3\" class=\"view-more-btn\"\r\n (click)=\"plan.showAllCourses = true; $event.stopPropagation()\">\r\n\r\n View More ({{ plan.children.length - 3 }})\r\n\r\n </button>\r\n<div class=\"course-status-legend\">\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-completed\"></span>\r\n <span>Completed</span>\r\n </div>\r\n\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-in-progress\"></span>\r\n <span>In progress</span>\r\n </div>\r\n\r\n <div class=\"legend-item\">\r\n <span class=\"nested-course-status status-not-started\"></span>\r\n <span>Not started</span>\r\n </div>\r\n</div>\r\n\r\n\r\n <!-- Optional -->\r\n <!--\r\n <button\r\n *ngIf=\"plan.showAllCourses && plan.children?.length > 3\"\r\n class=\"view-more-btn\"\r\n (click)=\"plan.showAllCourses = false; $event.stopPropagation()\">\r\n\r\n View Less\r\n\r\n </button>\r\n -->\r\n\r\n </div>\r\n </div>\r\n <button *ngIf=\"!showAllPlans && item.activity.items?.length > 3\" class=\"view-more-btn\"\r\n (click)=\"showAllPlans = true\">\r\n\r\n View More ({{ item.activity.items.length - 3 }})\r\n\r\n </button>\r\n </div>\r\n\r\n <!-- quick replies -->\r\n\r\n <div *ngIf=\"item.activity?.type === 'quick_replies'\">\r\n\r\n <div class=\"quick-replies-container\">\r\n\r\n <button *ngFor=\"\r\n let choice of (\r\n item.showAllChoices\r\n ? item.activity.choices\r\n : (item.activity.choices | slice:0:3)\r\n )\r\n \" (click)=\"selectChoice(choice)\" class=\"quick-reply-btn\">\r\n <mat-icon class=\"quick-reply-icon\">{{choice.icon || 'help_outline'}}</mat-icon>\r\n <span class=\"quick-reply-label\">{{choice.label}}</span>\r\n <mat-icon class=\"quick-reply-chevron\">navigate_next</mat-icon>\r\n </button>\r\n\r\n <button *ngIf=\"!item.showAllChoices && item.activity.choices?.length > 3\" class=\"view-more-btn flex\"\r\n (click)=\"item.showAllChoices = true\">\r\n\r\n View More ({{ item.activity.choices.length - 3 }})\r\n\r\n </button>\r\n\r\n <!-- <button\r\n *ngIf=\"item.showAllChoices && item.activity.choices?.length > 3\"\r\n class=\"view-more-btn\"\r\n (click)=\"item.showAllChoices = false\">\r\n\r\n View Less\r\n\r\n</button> -->\r\n\r\n </div>\r\n\r\n <!-- <div *ngIf=\"item.showTimestamp\" class=\"msg-timestamp bot-msg-timestamp\">\r\n Sarthi {{item.timestamp | date:'h:mm a'}}\r\n </div> -->\r\n\r\n </div>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"start-new-conv-container\">\r\n <button class=\"start-new-conv-btn\" (click)=\"startNewConversation()\">\r\n <mat-icon class=\"start-new-conv-icon\">chevron_left</mat-icon>\r\n <span class=\"startconv\">Start new conversation...</span>\r\n </button>\r\n </div>\r\n <div *ngIf=\"showRetry\" class=\"retry-container\">\r\n <button class=\"retry-btn start-new-conv-btn\" (click)=\"retryApi()\">\r\n Retry\r\n </button>\r\n </div>\r\n\r\n </ng-container>\r\n\r\n\r\n </div>\r\n <div [ngClass]=\"fullScreenChatFlag ? 'control-container-full':'control-container'\">\r\n <div [class]=\"isInputEnabled ? 'border-gradient-rounded' : 'disabledinputcl border-gradient-rounded'\"\r\n [style.height.px]=\"containerHeight\">\r\n <div class=\"flex flex-row ml-5 mr-1 justify-between\">\r\n\r\n <div class=\"query-box\">\r\n <!-- <input class=\"width-500\" type=\"text\" placeholder=\"Ask anything...\" [(ngModel)]=\"searchQuery\" (keydown.enter)=\"submitSearchQuery()\"/> -->\r\n <textarea #autoResizeTextarea class=\"width-500\" [disabled]=\"!isInputEnabled\" placeholder=\"Ask Anything...\"\r\n (input)=\"resizeTextarea(autoResizeTextarea, 'fromInput')\" [(ngModel)]=\"searchQuery\"\r\n (keydown.enter)=\"submitSearchQuery(autoResizeTextarea, $event)\" rows=\"1\">\r\n </textarea>\r\n </div>\r\n\r\n <div class=\"mt-1\">\r\n <button type=\"button\" class=\"flex-auto-display send-btn\"\r\n [disabled]=\"!isInputEnabled || !searchQuery?.trim()\"\r\n (click)=\"submitSearchQuery(autoResizeTextarea,$event)\"\r\n [disabled]=\"!searchQuery || !initiateSupportNewChat\">\r\n <mat-icon class=\"send-btn-icon\">send</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n\r\n </div>\r\n </div>", styles: [".hey{background:linear-gradient(90deg,#32b9dfde,#1b4ca1de);-webkit-background-clip:text;background-clip:text;color:transparent}.ai-generated-content{background:linear-gradient(90deg,#f3962f,#1b4ca1);-webkit-background-clip:text;background-clip:text;color:transparent}.ai-tutor-container .control-container{position:fixed;bottom:10px;width:24%;margin-left:1%;z-index:2}.ai-tutor-container-chatbot .control-container{position:fixed;bottom:100px;width:600px;margin:1%;z-index:2}.control-container{position:fixed;bottom:80px;width:415px;z-index:2}.start-chat{text-align:center;padding-top:50%}.start-chat-full{text-align:center;padding-top:10%;width:100vw}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff80}.query-box{min-height:36px;transition:height .2s;width:100%}.query-box input{border:0;outline:0}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:100%;min-height:36px}.send-btn{background-color:transparent!important;color:#1b4ca1!important;border:none!important}.message-container{height:100%;min-width:400px;width:100%;z-index:2;position:relative}.message-container-full{height:100%;min-width:96vw;width:100%;z-index:2;position:relative}.ai-tutor-container{background-image:url(/assets/ai-tutor/background.svg);height:90vh}.ai-tutor-container-chatbot{background-image:url(/assets/ai-tutor/background.svg);height:90vh;width:560px}.ai-tutor-container:before{content:\"\";position:absolute;inset:0;background-color:#ffffffe6;z-index:1;height:100vh}.chatbot-icon-container{position:fixed;bottom:120px;right:0;cursor:pointer;height:90px;align-items:flex-start;display:flex;justify-content:center;width:auto;z-index:999999999}.chatbot-icon{position:absolute;right:30px;-moz-animation-delay:1s;-webkit-animation-delay:1s;-o-animation-delay:1s;animation-delay:1s;transition:1s ease}.chatbot-icon-expanded{right:0}.expand-text{width:110px;display:flex;align-items:center;justify-content:center;background-color:#1b4ca1;color:#fff;font-size:18px;border-top:2px solid #fff;border-bottom:2px solid #fff;vertical-align:middle}.chatbot{width:610px;position:fixed;bottom:20px;right:50px;z-index:9999999999;border-radius:15px;background-color:#fff;box-shadow:0 6px 16px #0000003d;height:calc(100vh - 20%)}.cb-close{cursor:pointer}.cb-header{color:#fff!important;background-color:#1b4ca1;border-top-left-radius:15px;border-top-right-radius:15px;align-items:center;justify-content:space-between;position:absolute;width:100%;top:0}.cb-header .user-info-div{width:88%;justify-content:space-between}.cb-header .lang-select{height:32px;background-color:#fff;border-color:#00000029!important}.cb-header .user-name{padding-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:74%}.cb-content{background-color:#f0f3f4;overflow:auto}.cb-topics{padding:16px;background-color:#f5f5f5;overflow:auto}.cb-footer{border-bottom-left-radius:15px;border-bottom-right-radius:15px;background-color:#fff}.cb-footer .info{width:33%;padding:5px 0;align-items:center;display:flex;justify-content:center;flex-wrap:wrap;cursor:pointer}.cb-footer .info .info-text{font-size:10px;width:100%;text-align:center}.cb-footer .info .info-icon{height:24px}.br-br{border-bottom-right-radius:15px}.br-bl{border-bottom-left-radius:15px}.language{background-color:#0000000a}.active{background-color:#fbead1;border-top:3px solid rgb(239,149,30)}.active .mat-icon{color:#ef951e!important}.cat-list{margin:0;padding:0;width:100%;display:flex}.cat-item{padding:10px 16px;border-radius:21px;border:1px solid rgba(0,0,0,.16);background-color:#0000000a;opacity:1;color:#000000de;font-family:Lato-Regular,sans-serif;font-size:14px;font-weight:400;font-style:normal;letter-spacing:.25px;text-align:center;line-height:20px;width:fit-content;margin-right:12px;height:fit-content;cursor:pointer;white-space:nowrap}.lang-select{width:70px}.lang-select .mat-form-field-flex{background-color:#fff!important}.lang-select .mat-form-field-underline{background-color:transparent!important}.loader{position:absolute;left:50%;top:39%}.default-info .default-icon{width:60px;float:left;display:flex;flex-wrap:wrap}.default-info .default-msg{background-color:#0000000a;border:1px solid rgba(0,0,0,.16);border-radius:0 15px 15px;display:flex;flex-wrap:wrap}.chat-bot-icon{padding-top:8px}.row-start{justify-content:flex-start}.row-start .system-icon{padding-right:3px}.row-start .system-msg{background-color:#d1dbec;border:1px solid rgb(209,219,236);border-radius:0 15px 15px;display:flex;flex-wrap:wrap;min-width:auto;max-width:85%;height:100%;word-break:break-word}.row-start .system-msg ::ng-deep markdown p{margin:0}.word-break{word-break:break-all;white-space:unset}.margin-left-5{margin-left:5%}.question-hint{font-weight:700}.recommended-question{display:flex;flex-wrap:wrap;height:fit-content}.recommended-question .rec-item{height:fit-content}.recommended-question .my-5px{margin-top:5px;margin-bottom:5px}.recommended-question .mr-5px{margin-right:5px}.recommended-question .btn-default{background:#d5c7c70a;border:1px solid #1B4CA1;color:#1b4ca1;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.recommended-question .showmore-icon{align-items:flex-start}.recommended-question .btn-active{background:#000;border:1px solid rgba(0,0,0,.16);color:#fff}.recommended-question-for-resource{display:flex;flex-wrap:wrap;height:fit-content}.recommended-question-for-resource .rec-item{height:fit-content}.recommended-question-for-resource .my-5px{margin-top:5px;margin-bottom:5px}.recommended-question-for-resource .mr-5px{margin-right:5px}.recommended-question-for-resource .btn-default{background:#d5c7c70a;border:1px solid #F3962F;color:#1b4ca1;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.recommended-question-for-resource .showmore-icon{align-items:flex-start}.recommended-question-for-resource .btn-active{background:#000;border:1px solid rgba(0,0,0,.16);color:#fff}.btn-show-more,.btn-show-less{background:#1b4ca1;color:#fff;padding:10px 20px;font-size:14px;cursor:pointer;border-radius:40px}.row-end{justify-content:flex-end;height:100%}.row-end .user-seleted-question{background-color:#000;border-radius:15px 0 15px 15px;display:flex;flex-wrap:wrap;color:#fff;float:right;text-align:left;max-width:62%;word-break:break-word}.highlight-title{color:#1b4ca1}.incoming-msg{height:fit-content;width:100%}.hint-text{color:#1b4ca1}@media only screen and (max-width:600px){.chatbot{right:6px;bottom:67px}}@media only screen and (max-width:390px){.chatbot{right:6px;bottom:67px}}.chatbot-wrapper{position:relative}.cb-content-wrapper{position:absolute;width:100%;top:64px;bottom:130px;max-height:100%;overflow:auto;box-sizing:border-box;background-color:#f0f3f4}.cb-footer-wrapper{position:absolute;width:100%;bottom:0}.my-5px{margin-top:5px;margin-bottom:5px;margin-left:20px}.mr-5px{margin-right:5px}*,:after,:before{box-sizing:border-box}::ng-deep .disable-scroll{overflow-x:hidden!important;overflow:hidden}@media only screen and (max-width:600px){.chatbot{right:0;bottom:0;width:100%;height:100svh;z-index:999999999}.cb-footer-wrapper{bottom:0}.cb-content-wrapper{bottom:130px}.chatbot-icon-container{bottom:190px}.cb-header{border-top-left-radius:unset;border-top-right-radius:unset}.cb-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}.br-br{border-bottom-right-radius:unset}.br-bl{border-bottom-left-radius:unset}}.feefback-section{margin-left:10PX}.vertical-middle{vertical-align:middle}.resource-icon{margin-left:7%}.resource-link{margin-left:40px}.resource-icon img{height:65px;width:115.25px}.font-12{font-size:12px;margin-left:20px}.send-btn-icon{height:22px!important}.link{color:#1b4ca1;text-decoration:underline}.width-500{width:350px}.system-icon img{height:36px;width:36px}.circle-s{border-radius:50%;width:36px;height:36px;display:flex;justify-content:center;align-items:center;margin-left:4px}.circle-s img{border-radius:50%;width:100%;height:100%}.circle-s .initials{color:#fff;font-size:10px;line-height:12px;font-size:14px;letter-spacing:.2625px}.copied-tooltip{position:absolute;left:20%;transform:translate(-50%);background-color:#000;color:#fff;padding:4px 8px;border-radius:4px;font-size:12px;opacity:1;pointer-events:none;transition:opacity .3s ease;z-index:999}.loading-bar-icon{width:90%}.loading-bar-icon img{height:50px;width:50px}.content-duration{position:relative;background:#f3962f;color:#fff;width:100px;border-radius:8px;text-align:center;margin-top:1px;padding:0 5px;font-size:12px;display:flex;align-items:center;justify-content:center}.content-duration .mat-icon{vertical-align:middle;color:#fff!important;height:14px!important;width:14px!important;font-size:14px}.position-relative{position:relative}.user-icon{margin-left:5px}.user-icon img{height:36px;width:36px;border-radius:50%}.control-container-full{position:fixed;bottom:80px;width:97%;z-index:2}@media(min-width:768)and (max-width:1200px){.message-container{height:100%;min-width:300px;width:100%;z-index:2;position:relative}.control-container{position:fixed;bottom:100px;width:41%;z-index:2}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding-top:10%}}@media(max-width:767px){.message-container{height:100%;width:100%;z-index:2;position:relative;padding-right:35px}.control-container{position:fixed;bottom:100px;width:100%;z-index:2;padding-left:8px}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding:10% 15px;width:100%}.incoming-msg{height:fit-content;width:100%;margin-left:5px}}@media(min-width:768px)and (max-width:1023px){.igot-ai-container{width:100vw}.message-container{height:100%;width:100%;z-index:2;position:relative;padding-right:15px}.control-container{position:fixed;bottom:80px;width:100%;z-index:2;padding-left:8px}.incoming-msg{height:fit-content;width:100%;margin-left:5px}.width-500{width:100%}.border-gradient-rounded{border:2px solid transparent;border-radius:20px;background:linear-gradient(to right,#fff,#fff),linear-gradient(to right,#efa34f,#4881e4);background-clip:padding-box,border-box;background-origin:padding-box,border-box;width:98%;height:36px}.start-chat{text-align:center;padding-top:10%}}.w-92{width:92%}::ng-deep .copy-icon .material-icons{font-size:18px!important}::ng-deep .copy-icon .mat-icon{vertical-align:middle}.internet-result-query{background:#add8e6;border:1px solid #1B4CA1;color:#000;padding:10px;font-size:14px;font-weight:700;cursor:pointer;border-radius:5px}.blue-color{color:#1b4ca1;font-size:14px;font-weight:700}.web-button{background-color:#fff;color:#1b4ca1;border-radius:8px;padding:10px;border:1px solid #1B4CA1}.web-search-icon,.web-close-icon{color:#1b4ca1;vertical-align:middle}.rotate-180{rotate:180deg}.feedback-icon{height:18px;width:18px}.h-w-34{height:34px;width:34px}.timeout-error-block{background:#ffb6c185;border:1px solid lightpink;padding:0 10px;border-radius:16px;font-size:16px!important}.autorenew-icon .mat-icon{height:auto;width:auto}.autorenew-btn{background:red;border:1px solid lightpink;border-radius:8px;color:#fff;font-size:14px}.font-16{font-size:16px!important}.h-36{height:36px}.error-for-failed{background:red;font-weight:400}.error-for-failed-btn{background-color:#fff;color:red;border-radius:8px;padding:10px;border:1px solid red}.failed-error{font-size:12px;color:#d13924;font-weight:400}.error-retry-icon,.error-close-icon{color:red;vertical-align:middle}.border-gradient-rounded textarea{width:100%;border:none;resize:none;overflow:hidden;font-size:14px;font-family:Lato;box-sizing:border-box;min-height:32px;padding-top:5px}.border-gradient-rounded textarea:focus{outline:none;border:1px solid transparent}.igot-ai-container{margin-bottom:15px}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.text-center{text-align:center!important}.justify-around{justify-content:space-around!important}.blue-loader-animation{width:18px;height:18px;animation:spin 2s linear infinite;transform-origin:center center}.support-ai-chat-container{display:flex;flex-direction:column;width:100%}.quick-replies-container{display:flex;flex-direction:column;gap:10px;padding:8px 0 4px}.quick-replies-container .quick-reply-btn{display:flex;align-items:center;width:100%;background:#fff;border:1.5px solid #1B4CA1;border-radius:8px;padding:10px 14px;cursor:pointer;text-align:left}.quick-replies-container .quick-reply-btn:hover{background:#1b4ca10a}.quick-replies-container .quick-reply-btn .quick-reply-icon{color:#1b4ca1;font-size:18px;height:18px;width:18px;margin-right:10px;flex-shrink:0}.quick-replies-container .quick-reply-btn .quick-reply-label{flex:1;font-size:14px;color:#1b4ca1;font-weight:600;line-height:20px}.quick-replies-container .quick-reply-btn .quick-reply-chevron{color:#1b4ca1;font-size:18px;height:18px;width:18px;flex-shrink:0}.start-new-conv-container{display:flex;justify-content:flex-start;padding:4px 0 8px 2px}.start-new-conv-container .start-new-conv-btn{display:flex;align-items:center;background:transparent;border:none;color:#1b4ca1;font-size:13px;cursor:pointer;padding:2px 0;font-family:Lato,sans-serif}.start-new-conv-container .start-new-conv-btn:hover{text-decoration:underline}.start-new-conv-container .start-new-conv-btn .start-new-conv-icon{font-size:16px;height:16px;width:16px;line-height:16px}.row-start{align-items:flex-start;margin-bottom:10px}.row-start .system-msg{background:#d1dbec;border:none;border-radius:4px 16px 16px;padding:14px 16px;max-width:82%;color:#4a4a4a;font-size:14px;line-height:1.45;box-shadow:none;text-align:left}.row-start .system-icon,.row-start .chat-bot-icon{margin-right:10px;margin-top:2px}.row-end{align-items:flex-start;margin:10px 0}.row-end .user-seleted-question{background:#172b4d;color:#fff;border-radius:16px 4px 16px 16px;padding:10px 16px;max-width:70%;font-size:14px;line-height:20px;word-break:break-word;box-shadow:none}.user-icon,.circle-s{margin-left:8px;margin-top:2px}.system-icon img,.user-icon img,.circle-s{width:34px;height:34px}.support-ai-chat-container{display:flex;flex-direction:column;gap:10px}.system-msg markdown,.system-msg markdown p{margin:0;font-size:14px;color:#4a4a4a;line-height:22px}.quick-replies-container{margin:8px 0 0 44px;display:flex;flex-direction:column;gap:8px}.quick-reply-btn{display:flex;align-items:center;width:100%;background:#fff;border:1.5px solid #1B4CA1;border-radius:8px;padding:10px 14px;min-height:44px;transition:.2s}.quick-reply-btn:hover{background:#1b4ca10a}.quick-reply-icon{color:#1b4ca1;margin-right:10px}.quick-reply-label{flex:1;text-align:left;color:#1b4ca1;font-size:14px;font-weight:600}.quick-reply-chevron{color:#1b4ca1}.start-new-conv-container{padding-left:44px;margin-top:6px}.start-new-conv-btn{color:#1b4ca1;font-size:13px;font-weight:500}.start-new-conv-icon{font-size:16px}.bot-avatar-circle{width:36px;height:36px;min-width:36px;border-radius:50%;background-color:#1b4ca1;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bot-avatar-circle mat-icon{color:#fff;font-size:20px;height:20px;width:20px;line-height:20px}.msg-timestamp{font-size:11px;color:#00000073;margin-top:4px}.bot-msg-timestamp{padding-left:44px;margin-bottom:6px}.user-msg-timestamp{font-size:11px;color:#00000073;text-align:right;padding-right:44px;margin-top:-6px;margin-bottom:6px}.user-msg-icon{vertical-align:middle;font-size:18px!important;height:18px!important;width:18px!important;margin-right:6px;color:#fff}.startconv{color:var(--Primary-KB-Primary-Light, #1B4CA1);font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:normal}.picker-container{margin-top:12px}.picker-header{border:1px solid #2b66ff;border-radius:24px;padding:12px 16px;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.picker-dropdown{margin-top:8px;border:1px solid #ddd;border-radius:12px;background:#fff;max-height:320px;overflow:auto}.picker-dropdown input{width:89%;padding:12px;border:1.5px solid lightgray;outline:none;margin-top:10px;border-radius:20px}.picker-item{padding:12px 16px;cursor:pointer}.picker-item:hover{background:#f5f7ff}.picker-viewport{height:300px;width:100%}.picker-item{padding:10px 16px;cursor:pointer;text-align:left;white-space:normal;line-height:20px;word-break:break-word}.picker-item:hover{background:#f5f5f5}.vectorIcon{width:22px!important;height:22px!important}.view-more-btn{width:100%;margin-top:8px;background:transparent;border:none;color:#1f5cb8;font-weight:600;cursor:pointer;text-align:center}.view-more-btn:hover{text-decoration:underline}.nested-picker-wrapper{display:flex;flex-direction:column;gap:8px;margin-top:10px;width:100%}.nested-plan-item{border:1.5px solid #1B4CA1;border-radius:8px;overflow:hidden;background:#fff}.nested-plan-row{display:flex;align-items:center;padding:10px 12px;cursor:pointer;gap:8px;transition:background .15s}.nested-plan-row:hover{background:#1b4ca10a}.nested-plan-name{flex:1;font-size:14px;font-weight:600;color:#1b4ca1;font-family:Lato,sans-serif;text-align:left;margin-left:11px}.nested-plan-meta{font-size:12px;color:#6b7280;white-space:nowrap;margin-right:4px}.nested-plan-toggle{display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;flex-shrink:0;color:#1b4ca1}.nested-plan-toggle .toggle-icon{font-size:18px;height:18px;width:18px;line-height:18px;color:#1b4ca1}.nested-courses{border-top:1px solid rgba(27,76,161,.15);background:#f9fafe}.nested-course-row{display:flex;align-items:center;padding:10px 16px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,.06);gap:10px;transition:background .15s}.nested-course-row:last-child{border-bottom:none}.nested-course-row:hover{background:#1b4ca10f}.nested-course-name{flex:1;font-size:13px;color:#1b4ca1;font-family:Lato,sans-serif;line-height:1.45;text-align:left}.nested-course-status{width:10px;height:10px;border-radius:50%;flex-shrink:0}.nested-course-status.status-completed{background-color:#22c55e}.nested-course-status.status-in-progress{background-color:#f59e0b}.nested-course-status.status-not-started{background-color:#d1d5db}.disabledinputcl{pointer-events:none;cursor:not-allowed!important;background-color:#f5f5f5;opacity:.6}.course-status-legend{display:flex;align-items:center;gap:16px;margin:10px 12px 12px;font-size:12px;color:#666}.legend-item{display:flex;align-items:center;gap:6px}.nested-course-status{width:8px;height:8px;border-radius:50%;display:inline-block}.status-completed{background:#22c55e}.status-in-progress{background:#f59e0b}.status-not-started{background:#bdbdbd}.retry-btn{background:#fff;color:#fff;padding:10px 20px;font-size:14px;cursor:pointer;border:1px solid #1B4CA1;border-radius:40px;margin-left:45px;color:#1b4ca1}\n"] }]
|
|
1314
|
+
}], ctorParameters: () => [{ type: i1$1.ConfigurationsService }, { type: i1$1.EventService }, { type: i0.Renderer2 }, { type: ChatbotService }, { type: i3.MatSnackBar }, { type: SupportAiService }, { type: i5.Router }], propDecorators: { from: [{
|
|
1315
|
+
type: Input
|
|
1316
|
+
}], userJourney: [{
|
|
1317
|
+
type: Input
|
|
1318
|
+
}], chatId: [{
|
|
1319
|
+
type: Input
|
|
1320
|
+
}], userId: [{
|
|
1321
|
+
type: Input
|
|
1322
|
+
}], fullScreenChatFlag: [{
|
|
1323
|
+
type: Input
|
|
1324
|
+
}], activeLaguage: [{
|
|
1325
|
+
type: Input
|
|
1326
|
+
}], scrollToBottomEvent: [{
|
|
1327
|
+
type: Output
|
|
1328
|
+
}], myScrollContainer: [{
|
|
1329
|
+
type: ViewChild,
|
|
1330
|
+
args: ['scrollMe']
|
|
1331
|
+
}], textArea: [{
|
|
1332
|
+
type: ViewChild,
|
|
1333
|
+
args: ['autoResizeTextarea']
|
|
1334
|
+
}] } });
|
|
1335
|
+
|
|
1336
|
+
class WebSocketService {
|
|
1337
|
+
constructor() {
|
|
1338
|
+
this.messageSubject = new Subject();
|
|
1339
|
+
}
|
|
1340
|
+
// Establish a connection to the WebSocket
|
|
1341
|
+
connect(url) {
|
|
1342
|
+
this.socket = new WebSocket(url);
|
|
1343
|
+
console.log('this.socket', this.socket);
|
|
1344
|
+
this.socket.onopen = () => {
|
|
1345
|
+
console.log('WebSocket connection established');
|
|
1346
|
+
};
|
|
1347
|
+
this.socket.onmessage = event => {
|
|
1348
|
+
console.log('event', event);
|
|
1349
|
+
this.messageSubject.next(event.data);
|
|
1350
|
+
};
|
|
1351
|
+
this.socket.onerror = error => {
|
|
1352
|
+
console.error('WebSocket error:', error);
|
|
1353
|
+
};
|
|
1354
|
+
this.socket.onclose = () => {
|
|
1355
|
+
console.log('WebSocket connection closed');
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
// Send message to the WebSocket server
|
|
1359
|
+
sendMessage(message) {
|
|
1360
|
+
// console.log(message)
|
|
1361
|
+
// console.log(this.socket)
|
|
1362
|
+
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
1363
|
+
this.socket.send(message);
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
console.error('WebSocket is not open');
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
// Observable for receiving messages from WebSocket
|
|
1370
|
+
getMessages() {
|
|
1371
|
+
return this.messageSubject.asObservable().pipe(share());
|
|
1372
|
+
}
|
|
1373
|
+
// Close the WebSocket connection
|
|
1374
|
+
closeConnection() {
|
|
1375
|
+
if (this.socket) {
|
|
1376
|
+
this.socket.close();
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: WebSocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1380
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: WebSocketService, providedIn: 'root' }); }
|
|
1381
|
+
}
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: WebSocketService, decorators: [{
|
|
1383
|
+
type: Injectable,
|
|
1384
|
+
args: [{
|
|
1385
|
+
providedIn: 'root',
|
|
1386
|
+
}]
|
|
1387
|
+
}], ctorParameters: () => [] });
|
|
1388
|
+
|
|
1389
|
+
class ItsmChatModule {
|
|
1390
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ItsmChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1391
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: ItsmChatModule, declarations: [SupportAIComponent], imports: [CommonModule,
|
|
1392
|
+
FormsModule,
|
|
1393
|
+
MatIconModule,
|
|
1394
|
+
MatTooltipModule,
|
|
1395
|
+
ScrollingModule,
|
|
1396
|
+
MarkdownModule,
|
|
1397
|
+
PipeDurationTransformModule], exports: [SupportAIComponent] }); }
|
|
1398
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ItsmChatModule, providers: [WebSocketService, SupportAiService], imports: [CommonModule,
|
|
1399
|
+
FormsModule,
|
|
1400
|
+
MatIconModule,
|
|
1401
|
+
MatTooltipModule,
|
|
1402
|
+
ScrollingModule,
|
|
1403
|
+
MarkdownModule,
|
|
1404
|
+
PipeDurationTransformModule] }); }
|
|
1405
|
+
}
|
|
1406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ItsmChatModule, decorators: [{
|
|
1407
|
+
type: NgModule,
|
|
1408
|
+
args: [{
|
|
1409
|
+
declarations: [
|
|
1410
|
+
SupportAIComponent
|
|
1411
|
+
],
|
|
1412
|
+
imports: [CommonModule,
|
|
1413
|
+
FormsModule,
|
|
1414
|
+
MatIconModule,
|
|
1415
|
+
MatTooltipModule,
|
|
1416
|
+
ScrollingModule,
|
|
1417
|
+
MarkdownModule,
|
|
1418
|
+
PipeDurationTransformModule],
|
|
1419
|
+
exports: [SupportAIComponent],
|
|
1420
|
+
providers: [WebSocketService, SupportAiService]
|
|
1421
|
+
}]
|
|
1422
|
+
}] });
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* Generated bundle index. Do not edit.
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
export { ItsmChatModule, SupportAIComponent };
|
|
1429
|
+
//# sourceMappingURL=sunbird-cb-itsm-chatbot.mjs.map
|