@koredev/agentai-web-sdk 1.3.5-rc → 1.3.6-rc
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/dist/components/aaWindow/aaWindow.d.ts +1 -0
- package/dist/components/common/services/rootService.d.ts +9 -6
- package/dist/components/common/templatemanager/tabs/atom/actionButtons.d.ts +4 -0
- package/dist/components/common/templatemanager/tabs/suggestions/article/article.d.ts +0 -3
- package/dist/components/common/templatemanager/tabs/suggestions/faq/faq.d.ts +0 -2
- package/dist/components/common/templatemanager/tabs/suggestions/file/file.d.ts +0 -3
- package/dist/components/common/templatemanager/tabs/suggestions/snippet/snippet.d.ts +0 -2
- package/dist/esm/agentai-web-sdk.min.js +1 -1
- package/dist/umd/agentai-web-sdk-umd.min.js +1 -1
- package/dist/umd/agentai-web-sdk-umd.min.js.map +1 -1
- package/dist/umd/hot/hot-update.js +1294 -51
- package/dist/umd/hot/hot-update.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,65 +1,1308 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
self["webpackHotUpdateaa_sdk"]("KoreAASDK",{
|
|
3
3
|
|
|
4
|
-
/***/ "./src/components/common/
|
|
5
|
-
|
|
6
|
-
!*** ./src/components/common/
|
|
7
|
-
|
|
4
|
+
/***/ "./src/components/common/services/rootService.ts":
|
|
5
|
+
/*!*******************************************************!*\
|
|
6
|
+
!*** ./src/components/common/services/rootService.ts ***!
|
|
7
|
+
\*******************************************************/
|
|
8
8
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9
9
|
|
|
10
10
|
__webpack_require__.r(__webpack_exports__);
|
|
11
11
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
/* harmony export */
|
|
12
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
13
|
+
/* harmony export */ rootService: () => (/* binding */ rootService)
|
|
13
14
|
/* harmony export */ });
|
|
14
|
-
/* harmony import */ var
|
|
15
|
-
/* harmony import */ var
|
|
16
|
-
/* harmony import */ var
|
|
17
|
-
/* harmony import */ var
|
|
15
|
+
/* harmony import */ var _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/events.cnst */ "./src/components/common/constants/events.cnst.ts");
|
|
16
|
+
/* harmony import */ var _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/projConsts */ "./src/components/common/constants/projConsts.ts");
|
|
17
|
+
/* harmony import */ var _templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../templatemanager/base/domManager */ "./src/components/common/templatemanager/base/domManager.tsx");
|
|
18
|
+
/* harmony import */ var _templatemanager_tabs_suggestions_faq_faq__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../templatemanager/tabs/suggestions/faq/faq */ "./src/components/common/templatemanager/tabs/suggestions/faq/faq.tsx");
|
|
19
|
+
/* harmony import */ var _templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../templatemanager/tabs/atom/actionButtons */ "./src/components/common/templatemanager/tabs/atom/actionButtons.tsx");
|
|
20
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
21
|
+
__assign = Object.assign || function(t) {
|
|
22
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
+
s = arguments[i];
|
|
24
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
25
|
+
t[p] = s[p];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
return __assign.apply(this, arguments);
|
|
30
|
+
};
|
|
18
31
|
|
|
19
32
|
|
|
20
33
|
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
|
|
36
|
+
var rootService = /** @class */ (function () {
|
|
37
|
+
function rootService() {
|
|
38
|
+
this.isAutomationOnGoing = false;
|
|
39
|
+
this.grantResponseObj = {};
|
|
40
|
+
this.prefsAccessObj = {
|
|
41
|
+
tabsNTitles: [],
|
|
42
|
+
prefs: {},
|
|
43
|
+
};
|
|
44
|
+
this.connectionDetails = {};
|
|
45
|
+
this.settingsData = {};
|
|
46
|
+
this.numOfLines = 4;
|
|
47
|
+
this.maxHeight = 'max-content';
|
|
48
|
+
this.scrollHeight = Number.MAX_VALUE;
|
|
49
|
+
this.classConstants = _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst;
|
|
50
|
+
this.idConstants = _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.IdMapConstant;
|
|
51
|
+
this.faqambiguityResponse = false;
|
|
52
|
+
this.activeTab = '';
|
|
53
|
+
this.myBotTabSessionId = '';
|
|
54
|
+
this.assistTabSessionId = '';
|
|
55
|
+
this.sentSearchResponse = false;
|
|
56
|
+
this.searchedResultData = {};
|
|
57
|
+
this.proactiveMode = false;
|
|
58
|
+
this.socketConnect = false;
|
|
59
|
+
this.isProceedToClose = false;
|
|
60
|
+
this.dynClObjs = {};
|
|
61
|
+
this.hideActionButtons = false;
|
|
62
|
+
this.hideSendButton = false;
|
|
63
|
+
this.hideCopyButton = false;
|
|
64
|
+
}
|
|
65
|
+
rootService.prototype.formatWelcomeMessageResponse = function (data) {
|
|
66
|
+
var renderResponse = {
|
|
67
|
+
data: data,
|
|
68
|
+
type: _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.RenderResponseType.WELCOME_MSG,
|
|
69
|
+
connectionDetails: this.connectionDetails,
|
|
70
|
+
responseType: _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.RenderResponseType.ASSISTRESPONSE
|
|
71
|
+
};
|
|
72
|
+
return renderResponse;
|
|
73
|
+
};
|
|
74
|
+
rootService.prototype.formatSearchResponse = function (response, isSearch, suggestionIndex) {
|
|
75
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
76
|
+
if (isSearch === void 0) { isSearch = false; }
|
|
77
|
+
var suggestions = response.suggestions;
|
|
78
|
+
var dialoguesArray = suggestions.dialogs || [];
|
|
79
|
+
var faqArray = suggestions.faqs || [];
|
|
80
|
+
var snippersArray = this.formatSnippetResponse(((_a = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) === null || _a === void 0 ? void 0 : _a.snippets) || [], response, suggestionIndex);
|
|
81
|
+
var filesArray = ((_b = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) === null || _b === void 0 ? void 0 : _b.files) || [];
|
|
82
|
+
var searchResponse = {};
|
|
83
|
+
if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) && ((_c = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) === null || _c === void 0 ? void 0 : _c.snippets) && ((_e = (_d = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) === null || _d === void 0 ? void 0 : _d.snippets) === null || _e === void 0 ? void 0 : _e.length) == 0) {
|
|
84
|
+
delete suggestions.searchassist.snippets;
|
|
85
|
+
}
|
|
86
|
+
var searchassistKeys = Object.keys((suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) || {});
|
|
87
|
+
if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) && (searchassistKeys === null || searchassistKeys === void 0 ? void 0 : searchassistKeys.length) == 1 && searchassistKeys[0] === 'searchRequestId') {
|
|
88
|
+
suggestions.searchassist = {};
|
|
89
|
+
}
|
|
90
|
+
if (dialoguesArray.length || faqArray.length || snippersArray.length || filesArray.length || ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) && ((_f = Object.keys(suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist)) === null || _f === void 0 ? void 0 : _f.length))) {
|
|
91
|
+
searchResponse.dialogs = [];
|
|
92
|
+
searchResponse.faqs = [];
|
|
93
|
+
searchResponse.articles = [];
|
|
94
|
+
searchResponse.snippets = [];
|
|
95
|
+
searchResponse.files = [];
|
|
96
|
+
if (suggestions.searchassist && ((_g = Object.keys(suggestions.searchassist)) === null || _g === void 0 ? void 0 : _g.length) > 0) {
|
|
97
|
+
var _loop_1 = function (source) {
|
|
98
|
+
if (source != "snippets" && source != "file" && source != 'searchRequestId') {
|
|
99
|
+
suggestions.searchassist[source] = this_1.checkEmptyObjectsInArray(suggestions.searchassist[source]);
|
|
100
|
+
if (suggestions.searchassist[source] && ((_h = Object.keys(suggestions.searchassist[source])) === null || _h === void 0 ? void 0 : _h.length) > 0) {
|
|
101
|
+
searchResponse.articles.push.apply(searchResponse.articles, suggestions.searchassist[source]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (source == "file") {
|
|
105
|
+
suggestions.searchassist[source] = this_1.checkEmptyObjectsInArray(suggestions.searchassist[source]);
|
|
106
|
+
if (suggestions.searchassist[source] && ((_j = Object.keys(suggestions.searchassist[source])) === null || _j === void 0 ? void 0 : _j.length) > 0) {
|
|
107
|
+
searchResponse.files.push.apply(searchResponse.files, suggestions.searchassist[source]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (source && source != 'searchRequestId') {
|
|
111
|
+
(_k = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist[source]) === null || _k === void 0 ? void 0 : _k.forEach(function (item) {
|
|
112
|
+
item.subType = source;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var this_1 = this;
|
|
117
|
+
for (var source in suggestions.searchassist) {
|
|
118
|
+
_loop_1(source);
|
|
119
|
+
}
|
|
120
|
+
for (var _i = 0, _p = searchResponse.articles; _i < _p.length; _i++) {
|
|
121
|
+
var article = _p[_i];
|
|
122
|
+
article.showMoreButton = true;
|
|
123
|
+
article.showLessButton = false;
|
|
124
|
+
article.content = article.content ? article.content : '';
|
|
125
|
+
article.contentId = article.contentId;
|
|
126
|
+
article.userInput = response.userInput;
|
|
127
|
+
article.sourceMsgId = response.sourceMsgId || '';
|
|
128
|
+
article.subType = article.subType;
|
|
129
|
+
article.intType = isSearch ? 'mybot' : 'assist';
|
|
130
|
+
article.feedbackData = this.prepareFeedbackForSuggestions('article', article, {});
|
|
131
|
+
}
|
|
132
|
+
for (var _q = 0, _r = searchResponse.files; _q < _r.length; _q++) {
|
|
133
|
+
var file = _r[_q];
|
|
134
|
+
file.showMoreButton = true;
|
|
135
|
+
file.showLessButton = false;
|
|
136
|
+
file.content = file.content ? file.content : '';
|
|
137
|
+
file.contentId = file.contentId;
|
|
138
|
+
file.userInput = response.userInput;
|
|
139
|
+
file.sourceMsgId = response.sourceMsgId || '';
|
|
140
|
+
file.subType = file.subType;
|
|
141
|
+
file.intType = isSearch ? 'mybot' : 'assist';
|
|
142
|
+
file.feedbackData = this.prepareFeedbackForSuggestions('file', file, {});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (var _s = 0, faqArray_1 = faqArray; _s < faqArray_1.length; _s++) {
|
|
146
|
+
var faq = faqArray_1[_s];
|
|
147
|
+
var faqObject = {
|
|
148
|
+
question: faq.question,
|
|
149
|
+
displayName: faq.displayName,
|
|
150
|
+
taskRefId: faq === null || faq === void 0 ? void 0 : faq.taskRefId,
|
|
151
|
+
answer: (faq.answer && faq.answer.length > 0) ? [] : false,
|
|
152
|
+
showMoreButton: true,
|
|
153
|
+
showLessButton: false,
|
|
154
|
+
answerRender: faq.answer || false,
|
|
155
|
+
childBotId: faq.childBotId,
|
|
156
|
+
childBotName: faq.childBotName,
|
|
157
|
+
answerCount: 1,
|
|
158
|
+
sourceMsgId: response.sourceMsgId || '',
|
|
159
|
+
positionId: faq.positionId,
|
|
160
|
+
userInput: response.userInput,
|
|
161
|
+
intType: response.intType
|
|
162
|
+
};
|
|
163
|
+
if (faq.answer && faq.answer.length > 0) {
|
|
164
|
+
for (var _t = 0, _u = faq.answer; _t < _u.length; _t++) {
|
|
165
|
+
var ans = _u[_t];
|
|
166
|
+
var object = {
|
|
167
|
+
ans: ans,
|
|
168
|
+
taskRefId: faq.taskRefId,
|
|
169
|
+
showMoreButton: true,
|
|
170
|
+
showLessButton: false,
|
|
171
|
+
displayName: faq.displayName,
|
|
172
|
+
sourceMsgId: response.sourceMsgId || '',
|
|
173
|
+
positionId: faq.positionId
|
|
174
|
+
};
|
|
175
|
+
faqObject.answer.push(object);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
var feedbackData = faq.historyFeedback ? faq.historyFeedback : {};
|
|
179
|
+
faqObject.feedbackData = this.prepareFeedbackForSuggestions('faqs', faqObject, feedbackData);
|
|
180
|
+
faqObject.feedbackData.interactionType = isSearch ? 'mybot' : 'assist';
|
|
181
|
+
searchResponse.faqs.push(faqObject);
|
|
182
|
+
}
|
|
183
|
+
if (((_m = (_l = suggestions === null || suggestions === void 0 ? void 0 : suggestions.searchassist) === null || _l === void 0 ? void 0 : _l.snippets) === null || _m === void 0 ? void 0 : _m.length) > 0) {
|
|
184
|
+
if ((snippersArray === null || snippersArray === void 0 ? void 0 : snippersArray.length) > 0) {
|
|
185
|
+
searchResponse.snippets = Object.assign([], snippersArray);
|
|
186
|
+
}
|
|
187
|
+
for (var _v = 0, _w = searchResponse.snippets; _v < _w.length; _v++) {
|
|
188
|
+
var snippet = _w[_v];
|
|
189
|
+
snippet.showMoreButton = true;
|
|
190
|
+
snippet.showLessButton = false;
|
|
191
|
+
snippet.subType = 'snippets';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
for (var _x = 0, dialoguesArray_1 = dialoguesArray; _x < dialoguesArray_1.length; _x++) {
|
|
195
|
+
var dialog = dialoguesArray_1[_x];
|
|
196
|
+
if (dialog.entities && ((_o = dialog.entities) === null || _o === void 0 ? void 0 : _o.length) > 0) {
|
|
197
|
+
dialog.entities.forEach(function (entity) {
|
|
198
|
+
entity.editMode = false;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
searchResponse.dialogs.push({
|
|
202
|
+
name: dialog.name, agentRunButton: false, childBotId: dialog.childBotId,
|
|
203
|
+
childBotName: dialog.childBotName, entities: dialog.entities, userInput: response.userInput,
|
|
204
|
+
sourceMsgId: response.sourceMsgId || ''
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return searchResponse;
|
|
209
|
+
};
|
|
210
|
+
rootService.prototype.formatSnippetResponse = function (snippetsArray, response, suggestionIndex) {
|
|
211
|
+
var _a;
|
|
212
|
+
var snipObje = {};
|
|
213
|
+
snipObje['contentArray'] = [];
|
|
214
|
+
snipObje['sources'] = [];
|
|
215
|
+
snipObje['internalInfo'] = [];
|
|
216
|
+
snipObje['sendCopyText'] = '';
|
|
217
|
+
var snippetResponeArray = [];
|
|
218
|
+
if ((snippetsArray === null || snippetsArray === void 0 ? void 0 : snippetsArray.length) > 0) {
|
|
219
|
+
snippetsArray.forEach(function (snippet) {
|
|
220
|
+
var _a;
|
|
221
|
+
if (snippet === null || snippet === void 0 ? void 0 : snippet.templateType) {
|
|
222
|
+
if (snippet.templateType == 'active_citation_snippet' || snippet.templateType == 'citation_snippet') {
|
|
223
|
+
if ((snippet === null || snippet === void 0 ? void 0 : snippet.content) &&
|
|
224
|
+
Array.isArray(snippet === null || snippet === void 0 ? void 0 : snippet.content) &&
|
|
225
|
+
((_a = snippet === null || snippet === void 0 ? void 0 : snippet.content) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
226
|
+
snippet.content.forEach(function (ansSnippet) {
|
|
227
|
+
var ansObj = {
|
|
228
|
+
ans: ansSnippet.answer_fragment,
|
|
229
|
+
sources: (ansSnippet === null || ansSnippet === void 0 ? void 0 : ansSnippet.sources) || [],
|
|
230
|
+
internalFlag: snippet.internalFlag
|
|
231
|
+
};
|
|
232
|
+
snipObje['contentArray'].push(ansObj);
|
|
233
|
+
snipObje.internalFlag = snippet.internalFlag || false;
|
|
234
|
+
snipObje.isActCit = true;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
if (snippet === null || snippet === void 0 ? void 0 : snippet.content) {
|
|
240
|
+
if (Array.isArray(snippet === null || snippet === void 0 ? void 0 : snippet.content)) {
|
|
241
|
+
snippet.content = snippet === null || snippet === void 0 ? void 0 : snippet.content.join('\n');
|
|
242
|
+
}
|
|
243
|
+
snipObje.internalFlag = snippet.internalFlag || false;
|
|
244
|
+
var otherType = {
|
|
245
|
+
ans: snippet.content,
|
|
246
|
+
internalFlag: snippet.internalFlag
|
|
247
|
+
};
|
|
248
|
+
if (snippet.url) {
|
|
249
|
+
otherType['sources'] = [{ title: snippet.source, url: snippet.url }];
|
|
250
|
+
}
|
|
251
|
+
snipObje.contentArray.push(otherType);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
snipObje.templateType = snippet.templateType;
|
|
255
|
+
snipObje.positionId = snippet.positionId;
|
|
256
|
+
snipObje.sourceMsgId = response.sourceMsgId || '';
|
|
257
|
+
snipObje.intType = response.intType;
|
|
258
|
+
snipObje.isFromGeneratedSummary = response.isFromGeneratedSummary;
|
|
259
|
+
snipObje.userInput = response.userInput || '';
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
var extInfo_1 = '';
|
|
263
|
+
var interlInfo_1 = '';
|
|
264
|
+
var uniqueSource_1 = [];
|
|
265
|
+
(_a = snipObje['contentArray']) === null || _a === void 0 ? void 0 : _a.forEach(function (entry) {
|
|
266
|
+
var _a;
|
|
267
|
+
var _b;
|
|
268
|
+
var className = '';
|
|
269
|
+
(_a = snipObje.sources).push.apply(_a, ((entry === null || entry === void 0 ? void 0 : entry.sources) || []).filter(function (item) {
|
|
270
|
+
var returnValue = item.url && uniqueSource_1.indexOf(item.title) == -1;
|
|
271
|
+
if (returnValue) {
|
|
272
|
+
uniqueSource_1.push(item.title);
|
|
273
|
+
}
|
|
274
|
+
if (uniqueSource_1.indexOf(item.title) != -1) {
|
|
275
|
+
className += "fragment-ext-".concat(uniqueSource_1.indexOf(item.title) + 1, "-").concat(suggestionIndex);
|
|
276
|
+
}
|
|
277
|
+
return returnValue;
|
|
278
|
+
}));
|
|
279
|
+
if (!entry.internalFlag) {
|
|
280
|
+
snipObje['sendCopyText'] += entry.ans;
|
|
281
|
+
}
|
|
282
|
+
var temp = "<span class=\"".concat(className, "\">").concat(entry.ans, " ");
|
|
283
|
+
if (Array.isArray(entry === null || entry === void 0 ? void 0 : entry.sources) && ((_b = entry === null || entry === void 0 ? void 0 : entry.sources) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
284
|
+
for (var _i = 0, _c = entry === null || entry === void 0 ? void 0 : entry.sources; _i < _c.length; _i++) {
|
|
285
|
+
var source = _c[_i];
|
|
286
|
+
if ((source === null || source === void 0 ? void 0 : source.title) && uniqueSource_1.indexOf(source === null || source === void 0 ? void 0 : source.title) != -1) {
|
|
287
|
+
var srcCount = uniqueSource_1.indexOf(source.title);
|
|
288
|
+
temp += "<span class=\"source-count-num\">".concat(srcCount + 1, "</span>");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
temp += '</span>';
|
|
293
|
+
if (entry.internalFlag) {
|
|
294
|
+
interlInfo_1 += temp;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
extInfo_1 += temp;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
snipObje['contentArray'] = [];
|
|
301
|
+
snipObje['internalInfo'] = [];
|
|
302
|
+
if (interlInfo_1 === null || interlInfo_1 === void 0 ? void 0 : interlInfo_1.trim()) {
|
|
303
|
+
snipObje['internalInfo'].push(interlInfo_1 === null || interlInfo_1 === void 0 ? void 0 : interlInfo_1.trim());
|
|
304
|
+
}
|
|
305
|
+
if (extInfo_1 === null || extInfo_1 === void 0 ? void 0 : extInfo_1.trim()) {
|
|
306
|
+
snipObje['contentArray'].push(extInfo_1 === null || extInfo_1 === void 0 ? void 0 : extInfo_1.trim());
|
|
307
|
+
}
|
|
308
|
+
snipObje.feedbackData = this.prepareFeedbackForSuggestions('answer', snipObje, {});
|
|
309
|
+
snippetResponeArray.push(snipObje);
|
|
310
|
+
}
|
|
311
|
+
return snippetResponeArray;
|
|
312
|
+
};
|
|
313
|
+
rootService.prototype.updateSearchResponse = function (assistResponseArray, response, ambiguityTokenExt) {
|
|
314
|
+
var _a, _b, _c, _d;
|
|
315
|
+
response.suggestions.faqs = this.formatFAQResponse(response.suggestions.faqs);
|
|
316
|
+
var faqWithoutAnswerIndex = (_b = (_a = response === null || response === void 0 ? void 0 : response.suggestions) === null || _a === void 0 ? void 0 : _a.faqs) === null || _b === void 0 ? void 0 : _b.findIndex(function (faq, index) {
|
|
317
|
+
if (faq.question === ambiguityTokenExt.question) {
|
|
318
|
+
return faq;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
var faqWithoutAnswer = {};
|
|
322
|
+
if (faqWithoutAnswerIndex >= 0) {
|
|
323
|
+
faqWithoutAnswer = (_c = response === null || response === void 0 ? void 0 : response.suggestions) === null || _c === void 0 ? void 0 : _c.faqs[faqWithoutAnswerIndex];
|
|
324
|
+
}
|
|
325
|
+
if (faqWithoutAnswer && ((_d = Object.keys(faqWithoutAnswer)) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
326
|
+
var updatedArray = assistResponseArray.map(function (item, idx) {
|
|
327
|
+
var _a;
|
|
328
|
+
if (idx === ambiguityTokenExt.assistSuggestion) {
|
|
329
|
+
var updatedItem = __assign({}, item);
|
|
330
|
+
var existingFaq = (_a = updatedItem.searchResponse) === null || _a === void 0 ? void 0 : _a.faqs[ambiguityTokenExt.index];
|
|
331
|
+
if (existingFaq && faqWithoutAnswer && (faqWithoutAnswer === null || faqWithoutAnswer === void 0 ? void 0 : faqWithoutAnswer.answer)) {
|
|
332
|
+
existingFaq.answer = faqWithoutAnswer === null || faqWithoutAnswer === void 0 ? void 0 : faqWithoutAnswer.answer;
|
|
333
|
+
existingFaq.toggle = true;
|
|
334
|
+
existingFaq.showMoreButton = false;
|
|
335
|
+
existingFaq.showLessButton = false;
|
|
336
|
+
existingFaq.showSpinner = false;
|
|
337
|
+
}
|
|
338
|
+
updatedItem.faqArrowClickResponse = true;
|
|
339
|
+
return updatedItem;
|
|
340
|
+
}
|
|
341
|
+
return item;
|
|
342
|
+
});
|
|
343
|
+
return updatedArray;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
rootService.prototype.prepareFeedbackForSuggestions = function (suggestionType, suggestion, feedbackData) {
|
|
347
|
+
var _a, _b, _c;
|
|
348
|
+
if (feedbackData === void 0) { feedbackData = {}; }
|
|
349
|
+
var renderResponse = {
|
|
350
|
+
type: _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.RenderResponseType.FEEDBACK,
|
|
351
|
+
connectionDetails: this.connectionDetails,
|
|
352
|
+
positionId: suggestion.positionId,
|
|
353
|
+
submitForm: (feedbackData === null || feedbackData === void 0 ? void 0 : feedbackData.feedback) ? true : false,
|
|
354
|
+
feedback: (feedbackData === null || feedbackData === void 0 ? void 0 : feedbackData.feedback) ? feedbackData.feedback : '',
|
|
355
|
+
feedbackDetails: ((_a = feedbackData === null || feedbackData === void 0 ? void 0 : feedbackData.feedbackDetails) === null || _a === void 0 ? void 0 : _a.length) ? feedbackData.feedbackDetails : [],
|
|
356
|
+
comment: (feedbackData === null || feedbackData === void 0 ? void 0 : feedbackData.comment) ? feedbackData === null || feedbackData === void 0 ? void 0 : feedbackData.comment : '',
|
|
357
|
+
sourceMsgId: suggestion.sourceMsgId || '',
|
|
358
|
+
query: suggestion.userInput,
|
|
359
|
+
suggestionType: suggestionType,
|
|
360
|
+
dialogPositionId: suggestion.positionId,
|
|
361
|
+
subType: suggestion.subType || ''
|
|
362
|
+
};
|
|
363
|
+
if (suggestionType == 'answer') {
|
|
364
|
+
renderResponse.isFromGeneratedSummary = suggestion.isFromGeneratedSummary;
|
|
365
|
+
renderResponse.answerType = suggestion.templateType;
|
|
366
|
+
renderResponse.title = suggestion.title;
|
|
367
|
+
renderResponse.answer = suggestion.sendCopyText || '';
|
|
368
|
+
renderResponse.interactionType = suggestion.intType;
|
|
369
|
+
renderResponse.sources = suggestion.sources;
|
|
370
|
+
if (((_b = suggestion.internalInfo) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
371
|
+
renderResponse.answer += suggestion.internalInfo.join(' ');
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else if (suggestionType == 'article' || suggestionType == 'file') {
|
|
375
|
+
renderResponse.title = suggestion.title;
|
|
376
|
+
renderResponse.answer = suggestion.content || '';
|
|
377
|
+
renderResponse.interactionType = suggestion.intType;
|
|
378
|
+
}
|
|
379
|
+
else if (suggestionType == 'faqs') {
|
|
380
|
+
var answer_1 = '';
|
|
381
|
+
if (Array.isArray(suggestion === null || suggestion === void 0 ? void 0 : suggestion.answer)) {
|
|
382
|
+
(_c = suggestion === null || suggestion === void 0 ? void 0 : suggestion.answer) === null || _c === void 0 ? void 0 : _c.forEach(function (element) {
|
|
383
|
+
answer_1 += element.ans;
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
renderResponse.title = suggestion.question;
|
|
387
|
+
renderResponse.answer = answer_1;
|
|
388
|
+
}
|
|
389
|
+
return renderResponse;
|
|
390
|
+
};
|
|
391
|
+
rootService.prototype.checkEmptyObjectsInArray = function (arr) {
|
|
392
|
+
arr = arr.filter(function (obj) { var _a; return (obj && ((_a = Object.keys(obj)) === null || _a === void 0 ? void 0 : _a.length) > 0) && (obj.title || obj.content); });
|
|
393
|
+
return arr;
|
|
394
|
+
};
|
|
395
|
+
rootService.prototype.formatFAQResponse = function (faqArray) {
|
|
396
|
+
var _a, _b;
|
|
397
|
+
var searchResponse = [];
|
|
398
|
+
if (faqArray && (faqArray === null || faqArray === void 0 ? void 0 : faqArray.length) > 0) {
|
|
399
|
+
for (var _i = 0, faqArray_2 = faqArray; _i < faqArray_2.length; _i++) {
|
|
400
|
+
var faq = faqArray_2[_i];
|
|
401
|
+
var faqObject = {
|
|
402
|
+
question: faq.question,
|
|
403
|
+
taskRefId: faq === null || faq === void 0 ? void 0 : faq.taskRefId,
|
|
404
|
+
answer: ((faq === null || faq === void 0 ? void 0 : faq.answer) && ((_a = faq === null || faq === void 0 ? void 0 : faq.answer) === null || _a === void 0 ? void 0 : _a.length) > 0) ? [] : false
|
|
405
|
+
};
|
|
406
|
+
if (faq.answer && faq.answer.length > 0) {
|
|
407
|
+
for (var _c = 0, _d = faq.answer; _c < _d.length; _c++) {
|
|
408
|
+
var ans = _d[_c];
|
|
409
|
+
var object = {
|
|
410
|
+
taskRefId: faq.taskRefId,
|
|
411
|
+
ans: ans,
|
|
412
|
+
showMoreButton: true,
|
|
413
|
+
showLessButton: false,
|
|
414
|
+
};
|
|
415
|
+
(_b = faqObject === null || faqObject === void 0 ? void 0 : faqObject.answer) === null || _b === void 0 ? void 0 : _b.push(object);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
searchResponse.push(faqObject);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return searchResponse;
|
|
422
|
+
};
|
|
423
|
+
rootService.prototype.openurlInBrowser = function (url) {
|
|
424
|
+
window.open(url, '_blank');
|
|
425
|
+
// if (this.settingsData?.urlOpenBehaviour && this.settingsData?.urlOpenBehaviour?.sendPostEvent) {
|
|
426
|
+
// let message = {
|
|
427
|
+
// method: 'AgentAssist.UrlClickedMessage',
|
|
428
|
+
// from: 'agent_assist',
|
|
429
|
+
// url: url
|
|
430
|
+
// };
|
|
431
|
+
// window.parent.postMessage(message, '*');
|
|
432
|
+
// } else {
|
|
433
|
+
// window.open(url, '_blank');
|
|
434
|
+
// }
|
|
435
|
+
};
|
|
436
|
+
rootService.prototype.extractTextFromElement = function (element) {
|
|
437
|
+
var text = '';
|
|
438
|
+
if (element) {
|
|
439
|
+
var extractText_1 = function (node) {
|
|
440
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
441
|
+
text += node.textContent;
|
|
442
|
+
}
|
|
443
|
+
else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
444
|
+
var childNodes = node.childNodes;
|
|
445
|
+
for (var i = 0; i < childNodes.length; i++) {
|
|
446
|
+
extractText_1(childNodes[i]);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
extractText_1(element);
|
|
451
|
+
}
|
|
452
|
+
return text.trim();
|
|
453
|
+
};
|
|
454
|
+
rootService.prototype.handleSendCopyButton = function (actionType, faq_or_article_obj, selectType) {
|
|
455
|
+
var message = {};
|
|
456
|
+
if (actionType == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND) {
|
|
457
|
+
message = {
|
|
458
|
+
method: 'send',
|
|
459
|
+
name: _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SENDMSG,
|
|
460
|
+
conversationId: this.connectionDetails.conversationId,
|
|
461
|
+
// payload: selectType == ProjConstants.FAQ ? (faq_or_article_obj.answer || faq_or_article_obj.ans) : faq_or_article_obj.content
|
|
462
|
+
payload: faq_or_article_obj.sendContent
|
|
463
|
+
};
|
|
464
|
+
if (selectType === _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE) {
|
|
465
|
+
message['title'] = faq_or_article_obj.title;
|
|
466
|
+
message['contentId'] = faq_or_article_obj.contentId;
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
message['title'] = faq_or_article_obj.displayName;
|
|
470
|
+
message['contentId'] = faq_or_article_obj.taskRefId;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
message = {
|
|
475
|
+
method: 'copy',
|
|
476
|
+
name: _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPYMSG,
|
|
477
|
+
conversationId: this.connectionDetails.conversationId,
|
|
478
|
+
// payload: selectType == ProjConstants.FAQ ? (faq_or_article_obj.answer || faq_or_article_obj.ans) : faq_or_article_obj.content
|
|
479
|
+
payload: faq_or_article_obj.sendContent
|
|
480
|
+
};
|
|
481
|
+
if (selectType === _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE) {
|
|
482
|
+
message['title'] = faq_or_article_obj.title;
|
|
483
|
+
message['contentId'] = faq_or_article_obj.contentId;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
message['title'] = faq_or_article_obj.displayName;
|
|
487
|
+
message['contentId'] = faq_or_article_obj.taskRefId;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
message['type'] = (selectType == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.FAQ) ? 'faq' : 'article';
|
|
491
|
+
// window.parent.postMessage(message, '*');
|
|
492
|
+
return (this.faqArticleSendorCopyEvent(selectType, message, faq_or_article_obj));
|
|
493
|
+
};
|
|
494
|
+
rootService.prototype.faqArticleSendorCopyEvent = function (selectType, message, faq_or_article_obj) {
|
|
495
|
+
var _a, _b;
|
|
496
|
+
var data = {
|
|
497
|
+
botId: this.connectionDetails.botId,
|
|
498
|
+
conversationId: this.connectionDetails.conversationId,
|
|
499
|
+
experience: (_a = this.connectionDetails) === null || _a === void 0 ? void 0 : _a.channel,
|
|
500
|
+
source: this.connectionDetails.source,
|
|
501
|
+
usedType: message.method,
|
|
502
|
+
type: message.type,
|
|
503
|
+
name: message.name,
|
|
504
|
+
payload: message.payload,
|
|
505
|
+
title: message.title,
|
|
506
|
+
contentId: message.contentId,
|
|
507
|
+
positionId: faq_or_article_obj.positionId ? faq_or_article_obj.positionId : '',
|
|
508
|
+
sessionId: (this.activeTab == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.Tabs.MYBOT || this.activeTab == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.Tabs.SEARCH) ? this.myBotTabSessionId : this.assistTabSessionId,
|
|
509
|
+
};
|
|
510
|
+
data = this.addSourceMsgIdToRequestParams(faq_or_article_obj, data);
|
|
511
|
+
if (this.activeTab == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.Tabs.SEARCH) {
|
|
512
|
+
data.skipMsg = this.sentSearchResponse;
|
|
513
|
+
data.input = ((_b = this.searchedResultData) === null || _b === void 0 ? void 0 : _b.userInput) || '';
|
|
514
|
+
this.sentSearchResponse = true;
|
|
515
|
+
}
|
|
516
|
+
if (faq_or_article_obj.subType) {
|
|
517
|
+
data.subType = faq_or_article_obj.subType;
|
|
518
|
+
}
|
|
519
|
+
return data;
|
|
520
|
+
};
|
|
521
|
+
rootService.prototype.addSourceMsgIdToRequestParams = function (data, requestParams) {
|
|
522
|
+
if (data.sourceMsgId) {
|
|
523
|
+
if (data.sourceMsgId == 'fromLibrary') {
|
|
524
|
+
requestParams['fromLibrary'] = true;
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
requestParams['sourceMsgId'] = data.sourceMsgId;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return requestParams;
|
|
531
|
+
};
|
|
532
|
+
rootService.prototype.addSentOrCopiedTextForFaqs = function (ansObj, ele, sendText, hostInstance) {
|
|
533
|
+
var titleInfoSec = ele.querySelector(this.classConstants.SUGGESTION_EACH_TITLE);
|
|
534
|
+
var titleSendText = ele.querySelector("".concat(this.classConstants.SUGGESTION_EACH_TITLE, " ").concat(this.classConstants.SUGGESTION_SENT_TEXT));
|
|
535
|
+
if (!ansObj.send && !titleSendText) {
|
|
536
|
+
ansObj.send = sendText;
|
|
537
|
+
var eachFAQSentText = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.ActionButtonsSentText, { ansObj: ansObj }, hostInstance);
|
|
538
|
+
titleInfoSec.append(eachFAQSentText);
|
|
539
|
+
}
|
|
540
|
+
var sendTextele = ele.querySelector(this.classConstants.SEND_TEXT);
|
|
541
|
+
sendTextele.textContent = sendText;
|
|
542
|
+
};
|
|
543
|
+
rootService.prototype.addSentOrCopiedTextForFiles = function (file, ele, sendText, hostInstance) {
|
|
544
|
+
if (!file.send) {
|
|
545
|
+
file.send = sendText;
|
|
546
|
+
var eachFileSentText = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.ActionButtonsSentText, { file: file }, hostInstance);
|
|
547
|
+
ele.querySelector(this.classConstants.SUGGESTION_EACH_TITLE).append(eachFileSentText);
|
|
548
|
+
}
|
|
549
|
+
var sendTextele = ele.querySelector(this.classConstants.SEND_TEXT);
|
|
550
|
+
sendTextele.textContent = sendText;
|
|
551
|
+
};
|
|
552
|
+
rootService.prototype.addSentOrCopiedTextForArticle = function (article, ele, sendText, hostInstance) {
|
|
553
|
+
if (!article.send) {
|
|
554
|
+
article.send = sendText;
|
|
555
|
+
var eachArticleSentText = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.ActionButtonsSentText, { article: article }, hostInstance);
|
|
556
|
+
ele.querySelector(this.classConstants.SUGGESTION_EACH_TITLE).append(eachArticleSentText);
|
|
557
|
+
}
|
|
558
|
+
var sendTextele = ele.querySelector(this.classConstants.SEND_TEXT);
|
|
559
|
+
sendTextele.textContent = sendText;
|
|
560
|
+
};
|
|
561
|
+
rootService.prototype.addSentOrCopiedTextForSnippets = function (snippet, ele, sendText, hostInstance) {
|
|
562
|
+
if (!snippet.send) {
|
|
563
|
+
snippet.send = sendText;
|
|
564
|
+
var eachSnippetSentText = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.ActionButtonsSentText, { snippet: snippet }, hostInstance);
|
|
565
|
+
ele.querySelector(this.classConstants.SUGGESTION_EACH_TITLE).append(eachSnippetSentText);
|
|
566
|
+
}
|
|
567
|
+
var sendTextele = ele.querySelector(this.classConstants.SEND_TEXT);
|
|
568
|
+
sendTextele.textContent = sendText;
|
|
569
|
+
};
|
|
570
|
+
rootService.prototype.handleSendCopyButtonForFaq = function (actionType, ansObj, selectType, sourceMsgId, hostInstance) {
|
|
571
|
+
// let faqTemplate = this.faqcontent.find((element : any, index : any) => index === inx);
|
|
572
|
+
// let faqTemplate = faqList[inx];
|
|
573
|
+
ansObj.sourceMsgId = sourceMsgId;
|
|
574
|
+
ansObj.sendContent = ansObj.answer || ansObj.ans;
|
|
575
|
+
var copyEventData = this.handleSendCopyButton(actionType, ansObj, selectType);
|
|
576
|
+
this.emitSendOrCopyEvent(copyEventData, hostInstance);
|
|
577
|
+
};
|
|
578
|
+
rootService.prototype.handleSendCopyButtonForSnippet = function (actionType, snippetObj, selectType, hostInstance) {
|
|
579
|
+
snippetObj.sendContent = (snippetObj.sendCopyText);
|
|
580
|
+
var copyEventData = this.handleSendCopyButton(actionType, snippetObj, selectType);
|
|
581
|
+
this.emitSendOrCopyEvent(copyEventData, hostInstance);
|
|
582
|
+
};
|
|
583
|
+
rootService.prototype.handleSendCopyButtonArticleOrFile = function (actionType, articleObj, selectType, hostInstance) {
|
|
584
|
+
articleObj.sendContent = articleObj.content;
|
|
585
|
+
var copyEventData = this.handleSendCopyButton(actionType, articleObj, selectType);
|
|
586
|
+
this.emitSendOrCopyEvent(copyEventData, hostInstance);
|
|
587
|
+
};
|
|
588
|
+
;
|
|
589
|
+
rootService.prototype.handleActionTemplateClickEventsForFAQ = function (eachActionTemplate, faq, ansObj, faqListHTMLEle, hostInstance) {
|
|
590
|
+
var _this = this;
|
|
591
|
+
var _a, _b;
|
|
592
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_SEND_BTN, 'click', function () {
|
|
593
|
+
_this.handleSendCopyButtonForFaq(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND, ansObj, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.FAQ, faq.sourceMsgId, hostInstance);
|
|
594
|
+
_this.addSentOrCopiedTextForFaqs(ansObj, faqListHTMLEle, 'Sent', hostInstance);
|
|
595
|
+
}, eachActionTemplate);
|
|
596
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(this.classConstants.SUGGESTION_COPY_BTN, 'click', function () {
|
|
597
|
+
_this.handleSendCopyButtonForFaq(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY, ansObj, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.FAQ, faq.sourceMsgId, hostInstance);
|
|
598
|
+
_this.addSentOrCopiedTextForFaqs(ansObj, faqListHTMLEle, 'Copied', hostInstance);
|
|
599
|
+
}, eachActionTemplate);
|
|
600
|
+
};
|
|
601
|
+
rootService.prototype.emitSendOrCopyEvent = function (copyEventData, hostInstance) {
|
|
602
|
+
if ((copyEventData === null || copyEventData === void 0 ? void 0 : copyEventData.usedType) === 'send') {
|
|
603
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.AGENT_SEND_MESSAGE, copyEventData);
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.AGENT_COPY_MESSAGE, copyEventData);
|
|
607
|
+
}
|
|
608
|
+
hostInstance.socketConnection.emitEvents(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.EVENTS.agent_send_or_copy, copyEventData);
|
|
609
|
+
};
|
|
610
|
+
rootService.prototype.handleFaqExpandCloseBtnClickEvents = function (expandClostBtnTemplate, faqSuggestionBodyList, suggestionHeaderActionTemplate, faqListHTMLIndex, hostInstance) {
|
|
611
|
+
var _this = this;
|
|
612
|
+
var _a, _b;
|
|
613
|
+
var expandElement = expandClostBtnTemplate.querySelector(this.classConstants.SUGGESTION_FAQ_EXPAND);
|
|
614
|
+
var closeElement = expandClostBtnTemplate.querySelector(this.classConstants.SUGGESTION_FAQ_CLOSE);
|
|
615
|
+
var faqAnsLenghtElement = faqListHTMLIndex === null || faqListHTMLIndex === void 0 ? void 0 : faqListHTMLIndex.querySelector("".concat(this.classConstants.SUGGESTION_EACH_HEADER, " ").concat(this.classConstants.SUGGESTION_EACH_TITLE, " ").concat(this.classConstants.SUGGESTION_FAQ_ANS_LENGTH));
|
|
616
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_FAQ_EXPAND, 'click', function () {
|
|
617
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
618
|
+
if ((_a = closeElement === null || closeElement === void 0 ? void 0 : closeElement.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
619
|
+
(_b = closeElement === null || closeElement === void 0 ? void 0 : closeElement.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
620
|
+
}
|
|
621
|
+
(_c = expandElement === null || expandElement === void 0 ? void 0 : expandElement.classList) === null || _c === void 0 ? void 0 : _c.add(_this.classConstants.HIDE_ELEMENT);
|
|
622
|
+
faqSuggestionBodyList.forEach(function (ansTemplate, index) {
|
|
623
|
+
var _a, _b;
|
|
624
|
+
if ((_a = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
625
|
+
(_b = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
(_d = faqAnsLenghtElement === null || faqAnsLenghtElement === void 0 ? void 0 : faqAnsLenghtElement.classList) === null || _d === void 0 ? void 0 : _d.add(_this.classConstants.HIDE_ELEMENT);
|
|
629
|
+
//hide header send copy btns
|
|
630
|
+
(_e = suggestionHeaderActionTemplate === null || suggestionHeaderActionTemplate === void 0 ? void 0 : suggestionHeaderActionTemplate.classList) === null || _e === void 0 ? void 0 : _e.add(_this.classConstants.HIDE_ELEMENT);
|
|
631
|
+
//add send copy btns for first answer
|
|
632
|
+
var firstAnswerActionBtn = (_f = faqSuggestionBodyList[0]) === null || _f === void 0 ? void 0 : _f.querySelector(_this.classConstants.SUGGESTION_SENDCPY_ACTION);
|
|
633
|
+
if ((_g = firstAnswerActionBtn === null || firstAnswerActionBtn === void 0 ? void 0 : firstAnswerActionBtn.classList) === null || _g === void 0 ? void 0 : _g.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
634
|
+
(_h = firstAnswerActionBtn === null || firstAnswerActionBtn === void 0 ? void 0 : firstAnswerActionBtn.classList) === null || _h === void 0 ? void 0 : _h.remove(_this.classConstants.HIDE_ELEMENT);
|
|
635
|
+
}
|
|
636
|
+
}, expandClostBtnTemplate);
|
|
637
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(this.classConstants.SUGGESTION_FAQ_CLOSE, 'click', function () {
|
|
638
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
639
|
+
if ((_a = expandElement === null || expandElement === void 0 ? void 0 : expandElement.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
640
|
+
(_b = expandElement === null || expandElement === void 0 ? void 0 : expandElement.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
641
|
+
}
|
|
642
|
+
(_c = closeElement === null || closeElement === void 0 ? void 0 : closeElement.classList) === null || _c === void 0 ? void 0 : _c.add(_this.classConstants.HIDE_ELEMENT);
|
|
643
|
+
faqSuggestionBodyList.forEach(function (ansTemplate, index) {
|
|
644
|
+
var _a;
|
|
645
|
+
if (index != 0) {
|
|
646
|
+
(_a = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _a === void 0 ? void 0 : _a.add(_this.classConstants.HIDE_ELEMENT);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
if ((_d = faqAnsLenghtElement === null || faqAnsLenghtElement === void 0 ? void 0 : faqAnsLenghtElement.classList) === null || _d === void 0 ? void 0 : _d.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
650
|
+
(_e = faqAnsLenghtElement === null || faqAnsLenghtElement === void 0 ? void 0 : faqAnsLenghtElement.classList) === null || _e === void 0 ? void 0 : _e.remove(_this.classConstants.HIDE_ELEMENT);
|
|
651
|
+
}
|
|
652
|
+
//show header send copy btns
|
|
653
|
+
if ((_f = suggestionHeaderActionTemplate === null || suggestionHeaderActionTemplate === void 0 ? void 0 : suggestionHeaderActionTemplate.classList) === null || _f === void 0 ? void 0 : _f.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
654
|
+
(_g = suggestionHeaderActionTemplate === null || suggestionHeaderActionTemplate === void 0 ? void 0 : suggestionHeaderActionTemplate.classList) === null || _g === void 0 ? void 0 : _g.remove(_this.classConstants.HIDE_ELEMENT);
|
|
655
|
+
}
|
|
656
|
+
//remove send copy btns for first answer
|
|
657
|
+
var firstAnswerActionBtn = (_h = faqSuggestionBodyList[0]) === null || _h === void 0 ? void 0 : _h.querySelector(_this.classConstants.SUGGESTION_SENDCPY_ACTION);
|
|
658
|
+
(_j = firstAnswerActionBtn === null || firstAnswerActionBtn === void 0 ? void 0 : firstAnswerActionBtn.classList) === null || _j === void 0 ? void 0 : _j.add(_this.classConstants.HIDE_ELEMENT);
|
|
659
|
+
}, expandClostBtnTemplate);
|
|
660
|
+
};
|
|
661
|
+
rootService.prototype.handleActionTemplateClickEventsForSnippet = function (eachActionTemplate, snippet, snippetListHtmlEle, hostInstance) {
|
|
662
|
+
var _this = this;
|
|
663
|
+
var _a, _b;
|
|
664
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_SEND_BTN, 'click', function () {
|
|
665
|
+
_this.handleSendCopyButtonForSnippet(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND, snippet, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
666
|
+
_this.addSentOrCopiedTextForSnippets(snippet, snippetListHtmlEle, 'Sent', hostInstance);
|
|
667
|
+
}, eachActionTemplate);
|
|
668
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(this.classConstants.SUGGESTION_COPY_BTN, 'click', function () {
|
|
669
|
+
_this.handleSendCopyButtonForSnippet(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY, snippet, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
670
|
+
_this.addSentOrCopiedTextForSnippets(snippet, snippetListHtmlEle, 'Copied', hostInstance);
|
|
671
|
+
}, eachActionTemplate);
|
|
672
|
+
};
|
|
673
|
+
rootService.prototype.handleActionTemplateClickEventsForArticle = function (eachActionTemplate, article, articleListHtmlEle, hostInstance) {
|
|
674
|
+
var _this = this;
|
|
675
|
+
var _a, _b;
|
|
676
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_SEND_BTN, 'click', function () {
|
|
677
|
+
_this.handleSendCopyButtonArticleOrFile(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND, article, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
678
|
+
_this.addSentOrCopiedTextForArticle(article, articleListHtmlEle, 'Sent', hostInstance);
|
|
679
|
+
}, eachActionTemplate);
|
|
680
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(this.classConstants.SUGGESTION_COPY_BTN, 'click', function () {
|
|
681
|
+
_this.handleSendCopyButtonArticleOrFile(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY, article, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
682
|
+
_this.addSentOrCopiedTextForArticle(article, articleListHtmlEle, 'Copied', hostInstance);
|
|
683
|
+
}, eachActionTemplate);
|
|
684
|
+
};
|
|
685
|
+
rootService.prototype.handleActionTemplateClickEventsForFile = function (eachActionTemplate, file, fileListHtmlEle, hostInstance) {
|
|
686
|
+
var _this = this;
|
|
687
|
+
var _a, _b;
|
|
688
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_SEND_BTN, 'click', function () {
|
|
689
|
+
_this.handleSendCopyButtonArticleOrFile(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND, file, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
690
|
+
_this.addSentOrCopiedTextForFiles(file, fileListHtmlEle, 'Sent', hostInstance);
|
|
691
|
+
}, eachActionTemplate);
|
|
692
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(this.classConstants.SUGGESTION_COPY_BTN, 'click', function () {
|
|
693
|
+
_this.handleSendCopyButtonArticleOrFile(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY, file, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.ARTICLE, hostInstance);
|
|
694
|
+
_this.addSentOrCopiedTextForFiles(file, fileListHtmlEle, 'Copied', hostInstance);
|
|
695
|
+
}, eachActionTemplate);
|
|
696
|
+
};
|
|
697
|
+
rootService.prototype.handleSuggestionLessClickEvent = function (actionHtml, suggestionElement, listHtml, hostInstance) {
|
|
698
|
+
var _this = this;
|
|
699
|
+
var _a;
|
|
700
|
+
var moreElement = actionHtml.querySelector(this.classConstants.SUGGESTION_MORE_LINK);
|
|
701
|
+
var lessElement = actionHtml.querySelector(this.classConstants.SUGGESTION_LESS_LINK);
|
|
702
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_MORE_LINK, 'click', function () {
|
|
703
|
+
var _a, _b, _c;
|
|
704
|
+
if ((_a = lessElement === null || lessElement === void 0 ? void 0 : lessElement.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
705
|
+
(_b = lessElement === null || lessElement === void 0 ? void 0 : lessElement.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
706
|
+
}
|
|
707
|
+
(_c = moreElement === null || moreElement === void 0 ? void 0 : moreElement.classList) === null || _c === void 0 ? void 0 : _c.add(_this.classConstants.HIDE_ELEMENT);
|
|
708
|
+
listHtml.forEach(function (item) {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
711
|
+
(_b = item === null || item === void 0 ? void 0 : item.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
}, suggestionElement);
|
|
715
|
+
};
|
|
716
|
+
rootService.prototype.handleSuggestionMoreClickEvent = function (actionHtml, suggestionElement, listHtml, hostInstance) {
|
|
717
|
+
var _this = this;
|
|
718
|
+
var _a;
|
|
719
|
+
var moreElement = actionHtml.querySelector(this.classConstants.SUGGESTION_MORE_LINK);
|
|
720
|
+
var lessElement = actionHtml.querySelector(this.classConstants.SUGGESTION_LESS_LINK);
|
|
721
|
+
(_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(this.classConstants.SUGGESTION_LESS_LINK, 'click', function () {
|
|
722
|
+
var _a, _b, _c;
|
|
723
|
+
if ((_a = moreElement === null || moreElement === void 0 ? void 0 : moreElement.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
724
|
+
(_b = moreElement === null || moreElement === void 0 ? void 0 : moreElement.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
725
|
+
}
|
|
726
|
+
(_c = lessElement === null || lessElement === void 0 ? void 0 : lessElement.classList) === null || _c === void 0 ? void 0 : _c.add(_this.classConstants.HIDE_ELEMENT);
|
|
727
|
+
listHtml.forEach(function (item, inx) {
|
|
728
|
+
var _a;
|
|
729
|
+
if (inx >= 2 && item) {
|
|
730
|
+
(_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.add(_this.classConstants.HIDE_ELEMENT);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
}, suggestionElement);
|
|
734
|
+
};
|
|
735
|
+
rootService.prototype.setFaqIndividualLoader = function (inx, hide, id) {
|
|
736
|
+
var _this = this;
|
|
737
|
+
var _a, _b, _c, _d;
|
|
738
|
+
if (hide === void 0) { hide = false; }
|
|
739
|
+
var faqSuggestionEle = document.getElementById(id);
|
|
740
|
+
var faqListHTML = faqSuggestionEle === null || faqSuggestionEle === void 0 ? void 0 : faqSuggestionEle.querySelectorAll(this.classConstants.SUGGESTION_EACH);
|
|
741
|
+
var faqLoaderEle = (_a = faqListHTML[inx]) === null || _a === void 0 ? void 0 : _a.querySelector("".concat(this.classConstants.SUGGESTION_EACH_HEADER, " ").concat(this.classConstants.SUGGESTION_EACH_TITLE, " ").concat(this.classConstants.SUGGESTION_FAQ_ANS_LOADER));
|
|
742
|
+
if (hide && faqLoaderEle) {
|
|
743
|
+
(_b = faqLoaderEle === null || faqLoaderEle === void 0 ? void 0 : faqLoaderEle.classList) === null || _b === void 0 ? void 0 : _b.add(this.classConstants.HIDE_ELEMENT);
|
|
744
|
+
}
|
|
745
|
+
else if (faqLoaderEle) {
|
|
746
|
+
if ((_c = faqLoaderEle === null || faqLoaderEle === void 0 ? void 0 : faqLoaderEle.classList) === null || _c === void 0 ? void 0 : _c.contains(this.classConstants.HIDE_ELEMENT)) {
|
|
747
|
+
(_d = faqLoaderEle === null || faqLoaderEle === void 0 ? void 0 : faqLoaderEle.classList) === null || _d === void 0 ? void 0 : _d.remove(this.classConstants.HIDE_ELEMENT);
|
|
748
|
+
}
|
|
749
|
+
setTimeout(function () {
|
|
750
|
+
var _a;
|
|
751
|
+
(_a = faqLoaderEle === null || faqLoaderEle === void 0 ? void 0 : faqLoaderEle.classList) === null || _a === void 0 ? void 0 : _a.add(_this.classConstants.HIDE_ELEMENT);
|
|
752
|
+
}, 10000);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
rootService.prototype.addOrHideFAQArrows = function (faqUpArrowTemplate, faqDownArrowTemplate, type) {
|
|
756
|
+
var _a, _b, _c, _d, _e, _f;
|
|
757
|
+
if (type === 'up') {
|
|
758
|
+
if ((_a = faqDownArrowTemplate === null || faqDownArrowTemplate === void 0 ? void 0 : faqDownArrowTemplate.classList) === null || _a === void 0 ? void 0 : _a.contains(this.classConstants.HIDE_ELEMENT)) {
|
|
759
|
+
(_b = faqDownArrowTemplate === null || faqDownArrowTemplate === void 0 ? void 0 : faqDownArrowTemplate.classList) === null || _b === void 0 ? void 0 : _b.remove(this.classConstants.HIDE_ELEMENT);
|
|
760
|
+
}
|
|
761
|
+
(_c = faqUpArrowTemplate === null || faqUpArrowTemplate === void 0 ? void 0 : faqUpArrowTemplate.classList) === null || _c === void 0 ? void 0 : _c.add(this.classConstants.HIDE_ELEMENT);
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
if ((_d = faqUpArrowTemplate === null || faqUpArrowTemplate === void 0 ? void 0 : faqUpArrowTemplate.classList) === null || _d === void 0 ? void 0 : _d.contains(this.classConstants.HIDE_ELEMENT)) {
|
|
765
|
+
(_e = faqUpArrowTemplate === null || faqUpArrowTemplate === void 0 ? void 0 : faqUpArrowTemplate.classList) === null || _e === void 0 ? void 0 : _e.remove(this.classConstants.HIDE_ELEMENT);
|
|
766
|
+
}
|
|
767
|
+
(_f = faqDownArrowTemplate === null || faqDownArrowTemplate === void 0 ? void 0 : faqDownArrowTemplate.classList) === null || _f === void 0 ? void 0 : _f.add(this.classConstants.HIDE_ELEMENT);
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
rootService.prototype.toggleArrows = function (index, faqId) {
|
|
771
|
+
var _a;
|
|
772
|
+
var faqSuggestionEle = document.getElementById(faqId);
|
|
773
|
+
var faqListHTML = faqSuggestionEle === null || faqSuggestionEle === void 0 ? void 0 : faqSuggestionEle.querySelectorAll(this.classConstants.SUGGESTION_EACH);
|
|
774
|
+
var suggestionHeaderTemplate = (_a = faqListHTML[index]) === null || _a === void 0 ? void 0 : _a.querySelector(this.classConstants.SUGGESTION_EACH_HEADER);
|
|
775
|
+
var faqUpArrowTemplate = suggestionHeaderTemplate === null || suggestionHeaderTemplate === void 0 ? void 0 : suggestionHeaderTemplate.querySelector(this.classConstants.SUGGESTION_FAQ_UP_ARROW);
|
|
776
|
+
var faqDownArrowTemplate = suggestionHeaderTemplate === null || suggestionHeaderTemplate === void 0 ? void 0 : suggestionHeaderTemplate.querySelector(this.classConstants.SUGGESTION_FAQ_DOWN_ARROW);
|
|
777
|
+
this.addOrHideFAQArrows(faqUpArrowTemplate, faqDownArrowTemplate, 'down');
|
|
778
|
+
};
|
|
779
|
+
rootService.prototype.openLinksInBrowser = function (url) {
|
|
780
|
+
this.openurlInBrowser(url);
|
|
781
|
+
};
|
|
782
|
+
;
|
|
783
|
+
rootService.prototype.openurlInBrowserForSnippet = function (url, snippet, hostInstance) {
|
|
784
|
+
this.openurlInBrowser(url);
|
|
785
|
+
this.handleUrlClickEvent(url, snippet, hostInstance);
|
|
786
|
+
};
|
|
787
|
+
rootService.prototype.handleUrlClickEvent = function (url, snippet, hostInstance) {
|
|
788
|
+
var socketRequestParams = this.commonRequestParamsForActivity(snippet);
|
|
789
|
+
socketRequestParams.eventType = "url_clicked";
|
|
790
|
+
socketRequestParams.url = url;
|
|
791
|
+
hostInstance.socketConnection.emitEvents(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.EVENTS.agent_activity_request, socketRequestParams);
|
|
792
|
+
};
|
|
793
|
+
rootService.prototype.commonRequestParamsForActivity = function (snippet) {
|
|
794
|
+
var _a = this.connectionDetails, botId = _a.botId, conversationId = _a.conversationId, channel = _a.channel;
|
|
795
|
+
var socketRequestParams = {
|
|
796
|
+
botId: botId,
|
|
797
|
+
conversationId: conversationId,
|
|
798
|
+
event: "clicked",
|
|
799
|
+
sourceMsgId: snippet.sourceMsgId,
|
|
800
|
+
dataSource: "snippet",
|
|
801
|
+
positionId: snippet.positionId,
|
|
802
|
+
// participant : rootServiceInstance?.internalTransferData?.participant || {}
|
|
803
|
+
};
|
|
804
|
+
return socketRequestParams;
|
|
805
|
+
};
|
|
806
|
+
rootService.prototype.emitSearchRequestForAssistSuggestions = function (value, isSearch, faq, hostInstance) {
|
|
807
|
+
var connectionDetails = Object.assign({}, this.connectionDetails);
|
|
808
|
+
connectionDetails.value = value;
|
|
809
|
+
connectionDetails.isSearch = isSearch;
|
|
810
|
+
// connectionDetails.positionId = searchObj?.positionId;
|
|
811
|
+
if (connectionDetails.interactiveLanguage && typeof connectionDetails.interactiveLanguage == 'string' && connectionDetails.interactiveLanguage != "''") {
|
|
812
|
+
connectionDetails['language'] = connectionDetails.interactiveLanguage; // Return the default value for null, undefined, or "''"
|
|
813
|
+
}
|
|
814
|
+
if (faq.sourceMsgId) {
|
|
815
|
+
connectionDetails['sourceMsgId'] = faq.sourceMsgId;
|
|
816
|
+
}
|
|
817
|
+
var agent_assist_request_params = hostInstance.prepareAgentAssistRequestParams(connectionDetails);
|
|
818
|
+
if (faq.ambiguityToken) {
|
|
819
|
+
agent_assist_request_params.uiunqref = faq.ambiguityToken;
|
|
820
|
+
}
|
|
821
|
+
hostInstance.socketConnection.emitEvents(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.EVENTS.agent_assist_request, agent_assist_request_params);
|
|
822
|
+
};
|
|
823
|
+
rootService.prototype.emitSearchRequestForSearch = function (searchTextObj, isSearch, faq, hostInstance) {
|
|
824
|
+
var _a, _b;
|
|
825
|
+
if (faq === void 0) { faq = {}; }
|
|
826
|
+
var searchTextValue = searchTextObj === null || searchTextObj === void 0 ? void 0 : searchTextObj.value;
|
|
827
|
+
var connectionDetails = __assign(__assign({}, (_b = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.socketConnection) === null || _a === void 0 ? void 0 : _a.configOptions) === null || _b === void 0 ? void 0 : _b.connectionDetails), { value: searchTextValue, isSearch: isSearch });
|
|
828
|
+
if (connectionDetails.interactiveLanguage && typeof connectionDetails.interactiveLanguage === 'string' && connectionDetails.interactiveLanguage !== "''") {
|
|
829
|
+
connectionDetails.language = connectionDetails.interactiveLanguage;
|
|
830
|
+
}
|
|
831
|
+
if (faq && faq.sourceMsgId) {
|
|
832
|
+
connectionDetails.sourceMsgId = faq.sourceMsgId;
|
|
833
|
+
}
|
|
834
|
+
var agentAssistAgentRequestParams = hostInstance.prepareAgentAssistAgentRequestParams(connectionDetails);
|
|
835
|
+
if (isSearch) {
|
|
836
|
+
agentAssistAgentRequestParams.startTime = searchTextObj === null || searchTextObj === void 0 ? void 0 : searchTextObj.stTime;
|
|
837
|
+
agentAssistAgentRequestParams.endTime = searchTextObj === null || searchTextObj === void 0 ? void 0 : searchTextObj.edTime;
|
|
838
|
+
}
|
|
839
|
+
if (faq.ambiguityToken) {
|
|
840
|
+
agentAssistAgentRequestParams.uiunqref = faq.ambiguityToken;
|
|
841
|
+
}
|
|
842
|
+
// agentAssistAgentRequestParams.participant = rootService?.internalTransferData?.participant || {};
|
|
843
|
+
hostInstance.socketConnection.emitEvents(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.EVENTS.agent_assist_agent_request, agentAssistAgentRequestParams);
|
|
844
|
+
};
|
|
845
|
+
;
|
|
846
|
+
rootService.prototype.handleFaqAmbiguityDescElement = function (faqId, ambiguityToken, faqs, hostInstance) {
|
|
847
|
+
var _a, _b;
|
|
848
|
+
var faqSuggestionEle = document.getElementById(faqId);
|
|
849
|
+
var faqListHTML = faqSuggestionEle === null || faqSuggestionEle === void 0 ? void 0 : faqSuggestionEle.querySelectorAll(this.classConstants.SUGGESTION_EACH);
|
|
850
|
+
var faqinx = ambiguityToken === null || ambiguityToken === void 0 ? void 0 : ambiguityToken.index;
|
|
851
|
+
var descEle;
|
|
852
|
+
var faqwithAns = faqs[faqinx];
|
|
853
|
+
this.setFaqIndividualLoader(faqinx, true, faqId);
|
|
854
|
+
if (faqwithAns && ((_a = faqwithAns === null || faqwithAns === void 0 ? void 0 : faqwithAns.answer) === null || _a === void 0 ? void 0 : _a.length) > 0 && faqListHTML[faqinx]) {
|
|
855
|
+
descEle = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_suggestions_faq_faq__WEBPACK_IMPORTED_MODULE_3__.FaqAnswerPlacement, { faq: faqwithAns }, hostInstance);
|
|
856
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.BEFORE_VIEW_INIT, descEle, { event: _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.FAQ_ANSWER_AFTER_TOGGLE, data: faqs });
|
|
857
|
+
if (descEle) {
|
|
858
|
+
faqListHTML[faqinx].append(descEle);
|
|
859
|
+
this.handleSeeMoreButtonsForFaq(faqSuggestionEle, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.DESC_TEXT_SUGGESTION, _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.MORE_BTN_CONTAINER, hostInstance, faqinx);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
var suggestionHeaderTemplate = (_b = faqListHTML[faqinx]) === null || _b === void 0 ? void 0 : _b.querySelector(this.classConstants.SUGGESTION_EACH_HEADER);
|
|
863
|
+
this.addOrHideFAQActionExpandCloseElements(faqwithAns, suggestionHeaderTemplate, faqListHTML, faqinx, hostInstance);
|
|
864
|
+
};
|
|
865
|
+
rootService.prototype.handleFaqToggle = function (faq, index, type, faqListHTML, hostInstance, isAssistSuggestion, props) {
|
|
866
|
+
var _this = this;
|
|
867
|
+
var _a;
|
|
868
|
+
faq.toggle = !faq.toggle;
|
|
869
|
+
faq.seeMoreWrapper = false;
|
|
870
|
+
var faqSuggestionBodyList = (_a = faqListHTML[index]) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.classConstants.SUGGESTION_EACH_BODY);
|
|
871
|
+
if (type == 'down' && !faq.answer) {
|
|
872
|
+
if (isAssistSuggestion) {
|
|
873
|
+
this.checkAnswerAndToggleForAssist(faq, index, hostInstance, props);
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
this.checkAnswerAndToggleForSearch(faq, index, hostInstance);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else if (type == 'down' && faq.answer) {
|
|
880
|
+
faqSuggestionBodyList.forEach(function (ansTemplate, index) {
|
|
881
|
+
var _a, _b;
|
|
882
|
+
if ((_a = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _a === void 0 ? void 0 : _a.contains(_this.classConstants.HIDE_ELEMENT)) {
|
|
883
|
+
(_b = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _b === void 0 ? void 0 : _b.remove(_this.classConstants.HIDE_ELEMENT);
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
else if (type == 'up') {
|
|
888
|
+
faqSuggestionBodyList.forEach(function (ansTemplate, index) {
|
|
889
|
+
var _a;
|
|
890
|
+
(_a = ansTemplate === null || ansTemplate === void 0 ? void 0 : ansTemplate.classList) === null || _a === void 0 ? void 0 : _a.add(_this.classConstants.HIDE_ELEMENT);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
rootService.prototype.checkAnswerAndToggleForAssist = function (faq, index, hostInstance, props) {
|
|
895
|
+
if (!faq.answer && faq.toggle) {
|
|
896
|
+
faq.ambiguityToken = btoa(JSON.stringify({ question: faq.question, index: index, assistSuggestion: props.suggestionIndex }));
|
|
897
|
+
this.emitSearchRequestForAssistSuggestions(faq.displayName, false, faq, hostInstance);
|
|
898
|
+
var faqId = this.idConstants.ASSIST_FAQ_SUGGESTION + props.suggestionIndex;
|
|
899
|
+
this.setFaqIndividualLoader(index, false, faqId);
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
;
|
|
903
|
+
rootService.prototype.checkAnswerAndToggleForSearch = function (faq, index, hostInstance) {
|
|
904
|
+
if (!faq.answer && faq.toggle) {
|
|
905
|
+
faq.ambiguityToken = btoa(JSON.stringify({ question: faq.question, index: index }));
|
|
906
|
+
this.emitSearchRequestForSearch({ value: faq.displayName }, false, faq, hostInstance);
|
|
907
|
+
this.setFaqIndividualLoader(index, false, this.idConstants.SEARCH_FAQ_SUGGESTION);
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
rootService.prototype.renderEachFaqInSuggestionList = function (searchResponse, faqListHTML, hostInstance, isAssistSuggestion, props) {
|
|
911
|
+
var _this = this;
|
|
912
|
+
var _a;
|
|
913
|
+
(_a = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.faqs) === null || _a === void 0 ? void 0 : _a.forEach(function (faq, index) {
|
|
914
|
+
var _a, _b, _c, _d;
|
|
915
|
+
var suggestionHeaderTemplate = (_a = faqListHTML[index]) === null || _a === void 0 ? void 0 : _a.querySelector(_this.classConstants.SUGGESTION_EACH_HEADER);
|
|
916
|
+
var faqUpArrowTemplate = suggestionHeaderTemplate === null || suggestionHeaderTemplate === void 0 ? void 0 : suggestionHeaderTemplate.querySelector(_this.classConstants.SUGGESTION_FAQ_UP_ARROW);
|
|
917
|
+
var faqDownArrowTemplate = suggestionHeaderTemplate === null || suggestionHeaderTemplate === void 0 ? void 0 : suggestionHeaderTemplate.querySelector(_this.classConstants.SUGGESTION_FAQ_DOWN_ARROW);
|
|
918
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(_this.classConstants.SUGGESTION_FAQ_UP_ARROW, 'click', function () {
|
|
919
|
+
_this.addOrHideFAQArrows(faqUpArrowTemplate, faqDownArrowTemplate, 'up');
|
|
920
|
+
_this.handleFaqToggle(faq, index, 'up', faqListHTML, hostInstance, isAssistSuggestion, props);
|
|
921
|
+
}, suggestionHeaderTemplate);
|
|
922
|
+
(_c = hostInstance.eventManager) === null || _c === void 0 ? void 0 : _c.addEventListener(_this.classConstants.SUGGESTION_FAQ_DOWN_ARROW, 'click', function () {
|
|
923
|
+
_this.addOrHideFAQArrows(faqUpArrowTemplate, faqDownArrowTemplate, 'down');
|
|
924
|
+
_this.handleFaqToggle(faq, index, 'down', faqListHTML, hostInstance, isAssistSuggestion, props);
|
|
925
|
+
}, suggestionHeaderTemplate);
|
|
926
|
+
if (faq.answer && ((_d = faq === null || faq === void 0 ? void 0 : faq.answer) === null || _d === void 0 ? void 0 : _d.length) > 0 && !_this.hideActionButtons) {
|
|
927
|
+
_this.addOrHideFAQActionExpandCloseElements(faq, suggestionHeaderTemplate, faqListHTML, index, hostInstance);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
};
|
|
931
|
+
rootService.prototype.renderEachSnippetInSuggestionList = function (searchResponse, snippetListHtml, hostInstance) {
|
|
932
|
+
var _this = this;
|
|
933
|
+
var _a;
|
|
934
|
+
(_a = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.snippets) === null || _a === void 0 ? void 0 : _a.forEach(function (snippet, index) {
|
|
935
|
+
var _a, _b;
|
|
936
|
+
if (snippet.contentArray.length > 0) {
|
|
937
|
+
var eachActionTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.handleSendCopyButtons, { snippet: snippet, hostInstance: hostInstance, rootServiceInstance: hostInstance.rootService }, hostInstance);
|
|
938
|
+
if (eachActionTemplate && (eachActionTemplate === null || eachActionTemplate === void 0 ? void 0 : eachActionTemplate.nodeName) != '#text') {
|
|
939
|
+
(_a = snippetListHtml[index]) === null || _a === void 0 ? void 0 : _a.querySelector(_this.classConstants.SUGGESTION_EACH_HEADER).append(eachActionTemplate);
|
|
940
|
+
_this.handleActionTemplateClickEventsForSnippet(eachActionTemplate, snippet, snippetListHtml[index], hostInstance);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
var sourceListHtml = snippetListHtml[index].querySelectorAll(_this.classConstants.SUGGESTION_SNIPPET_SOURCE_TAG);
|
|
944
|
+
(_b = snippet.sources) === null || _b === void 0 ? void 0 : _b.forEach(function (source, inx) {
|
|
945
|
+
var _a;
|
|
946
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(_this.classConstants.SUGGESTION_SNIPPET_LINK, 'click', function () {
|
|
947
|
+
_this.openurlInBrowserForSnippet(source.url, snippet, hostInstance);
|
|
948
|
+
}, sourceListHtml[inx]);
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
};
|
|
952
|
+
rootService.prototype.renderEachArticleInSuggestionList = function (searchResponse, articlesListHTML, hostInstance) {
|
|
953
|
+
var _this = this;
|
|
954
|
+
var _a;
|
|
955
|
+
(_a = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.articles) === null || _a === void 0 ? void 0 : _a.forEach(function (article, index) {
|
|
956
|
+
var _a, _b;
|
|
957
|
+
if ((article === null || article === void 0 ? void 0 : article.content) && !(article === null || article === void 0 ? void 0 : article.internalFlag)) {
|
|
958
|
+
var eachActionTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.handleSendCopyButtons, { article: article, hostInstance: hostInstance, rootServiceInstance: hostInstance.rootService }, hostInstance);
|
|
959
|
+
if (eachActionTemplate && (eachActionTemplate === null || eachActionTemplate === void 0 ? void 0 : eachActionTemplate.nodeName) != '#text') {
|
|
960
|
+
(_a = articlesListHTML[index]) === null || _a === void 0 ? void 0 : _a.querySelector(_this.classConstants.SUGGESTION_EACH_HEADER).append(eachActionTemplate);
|
|
961
|
+
_this.handleActionTemplateClickEventsForArticle(eachActionTemplate, article, articlesListHTML[index], hostInstance);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(_this.classConstants.SUGGESTION_ARTICLE_LINK, 'click', function () {
|
|
965
|
+
_this.openLinksInBrowser(article.link);
|
|
966
|
+
}, articlesListHTML[index]);
|
|
967
|
+
});
|
|
968
|
+
};
|
|
969
|
+
rootService.prototype.renderEachFileInSuggestionList = function (searchResponse, filesListHtml, hostInstance) {
|
|
970
|
+
var _this = this;
|
|
971
|
+
var _a;
|
|
972
|
+
(_a = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.files) === null || _a === void 0 ? void 0 : _a.forEach(function (file, index) {
|
|
973
|
+
var _a, _b;
|
|
974
|
+
if ((file === null || file === void 0 ? void 0 : file.content) && !(file === null || file === void 0 ? void 0 : file.internalFlag)) {
|
|
975
|
+
var eachActionTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.handleSendCopyButtons, { file: file, hostInstance: hostInstance, rootServiceInstance: hostInstance.rootService }, hostInstance);
|
|
976
|
+
if (eachActionTemplate && (eachActionTemplate === null || eachActionTemplate === void 0 ? void 0 : eachActionTemplate.nodeName) != '#text') {
|
|
977
|
+
(_a = filesListHtml[index]) === null || _a === void 0 ? void 0 : _a.querySelector(_this.classConstants.SUGGESTION_EACH_HEADER).append(eachActionTemplate);
|
|
978
|
+
_this.handleActionTemplateClickEventsForFile(eachActionTemplate, file, filesListHtml[index], hostInstance);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
(_b = hostInstance.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(_this.classConstants.SUGGESTION_FILE_LINK, 'click', function () {
|
|
982
|
+
_this.openLinksInBrowser(file.link);
|
|
983
|
+
}, filesListHtml[index]);
|
|
984
|
+
});
|
|
985
|
+
};
|
|
986
|
+
// search
|
|
987
|
+
rootService.prototype.handleSearchText = function (searchText, hostInstance) {
|
|
988
|
+
var _a, _b;
|
|
989
|
+
if (searchText.isEntered) {
|
|
990
|
+
this.emitSearchRequestForSearch(searchText, true, {}, hostInstance);
|
|
991
|
+
}
|
|
992
|
+
var inputBlock = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _a === void 0 ? void 0 : _a.querySelector(this.classConstants.SEARCH_INPUT_BLOCK);
|
|
993
|
+
var inputEle = (_b = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _b === void 0 ? void 0 : _b.querySelector("#".concat(this.idConstants.SEARCH_INPUT));
|
|
994
|
+
if (inputBlock) {
|
|
995
|
+
var inputSearchIcon = inputBlock === null || inputBlock === void 0 ? void 0 : inputBlock.querySelector(this.classConstants.SEARCH_INPUT_ICON);
|
|
996
|
+
var inputCloseIcon = inputBlock === null || inputBlock === void 0 ? void 0 : inputBlock.querySelector(this.classConstants.SEARCH_INPUT_CLOSE);
|
|
997
|
+
if (searchText.value) {
|
|
998
|
+
inputSearchIcon.classList.add(this.classConstants.HIDE_ELEMENT);
|
|
999
|
+
inputCloseIcon.classList.remove(this.classConstants.HIDE_ELEMENT);
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
inputCloseIcon.classList.add(this.classConstants.HIDE_ELEMENT);
|
|
1003
|
+
inputSearchIcon.classList.remove(this.classConstants.HIDE_ELEMENT);
|
|
1004
|
+
}
|
|
1005
|
+
inputEle.value = searchText.value;
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
rootService.prototype.addOrHideFAQActionExpandCloseElements = function (faq, suggestionHeaderTemplate, faqListHTML, index, hostInstance) {
|
|
1009
|
+
var _this = this;
|
|
1010
|
+
var _a, _b, _c, _d, _e;
|
|
1011
|
+
var eachActionTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.handleSendCopyButtons, { ansObj: faq.answer[0], hostInstance: hostInstance, addHideClass: false, rootServiceInstance: hostInstance.rootService }, hostInstance);
|
|
1012
|
+
if (suggestionHeaderTemplate && eachActionTemplate && (eachActionTemplate === null || eachActionTemplate === void 0 ? void 0 : eachActionTemplate.nodeName) != '#text') {
|
|
1013
|
+
suggestionHeaderTemplate.append(eachActionTemplate);
|
|
1014
|
+
this.handleActionTemplateClickEventsForFAQ(eachActionTemplate, faq, faq.answer[0], faqListHTML[index], hostInstance);
|
|
1015
|
+
}
|
|
1016
|
+
if (((_a = faq.answer) === null || _a === void 0 ? void 0 : _a.length) > 1) {
|
|
1017
|
+
var faqSuggestionBodyList_1 = (_b = faqListHTML[index]) === null || _b === void 0 ? void 0 : _b.querySelectorAll(this.classConstants.SUGGESTION_EACH_BODY);
|
|
1018
|
+
(_c = faq.answer) === null || _c === void 0 ? void 0 : _c.forEach(function (ansObj, inx) {
|
|
1019
|
+
var eachAnsActionTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_4__.handleSendCopyButtons, { ansObj: ansObj, hostInstance: hostInstance, addHideClass: (inx == 0 ? true : false), rootServiceInstance: hostInstance.rootService }, hostInstance);
|
|
1020
|
+
if (eachAnsActionTemplate && (eachAnsActionTemplate === null || eachAnsActionTemplate === void 0 ? void 0 : eachAnsActionTemplate.nodeName) != '#text') {
|
|
1021
|
+
if (faqSuggestionBodyList_1 && (faqSuggestionBodyList_1 === null || faqSuggestionBodyList_1 === void 0 ? void 0 : faqSuggestionBodyList_1.length) > 0) {
|
|
1022
|
+
faqSuggestionBodyList_1[inx].prepend(eachAnsActionTemplate);
|
|
1023
|
+
_this.handleActionTemplateClickEventsForFAQ(eachAnsActionTemplate, faq, ansObj, faqListHTML[index], hostInstance);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
var expandClostBtnTemplate = (0,_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_templatemanager_tabs_suggestions_faq_faq__WEBPACK_IMPORTED_MODULE_3__.FaqExpandCloseBtn, {}, hostInstance);
|
|
1028
|
+
(_d = faqListHTML[index]) === null || _d === void 0 ? void 0 : _d.append(expandClostBtnTemplate);
|
|
1029
|
+
var suggestionHeaderActionTemplate = (_e = faqListHTML[index]) === null || _e === void 0 ? void 0 : _e.querySelector("".concat(this.classConstants.SUGGESTION_EACH_HEADER, " ").concat(this.classConstants.SUGGESTION_SENDCPY_ACTION));
|
|
1030
|
+
this.handleFaqExpandCloseBtnClickEvents(expandClostBtnTemplate, faqSuggestionBodyList_1, suggestionHeaderActionTemplate, faqListHTML[index], hostInstance);
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
rootService.prototype.handleSeeMoreButtonsForSearchAssist = function (suggestionElement, descClassName, moreContainer, hostInstance) {
|
|
1034
|
+
var _this = this;
|
|
1035
|
+
var suggestionBodyFaq = suggestionElement === null || suggestionElement === void 0 ? void 0 : suggestionElement.querySelectorAll('.suggestion-item-card .suggestion-body-faq');
|
|
1036
|
+
suggestionBodyFaq === null || suggestionBodyFaq === void 0 ? void 0 : suggestionBodyFaq.forEach(function (bodyele, i) {
|
|
1037
|
+
var _a;
|
|
1038
|
+
var desc = bodyele.querySelector(descClassName);
|
|
1039
|
+
if (desc) {
|
|
1040
|
+
var overlimitContainer = bodyele === null || bodyele === void 0 ? void 0 : bodyele.querySelector(moreContainer);
|
|
1041
|
+
var moreButton_1 = overlimitContainer === null || overlimitContainer === void 0 ? void 0 : overlimitContainer.querySelector(_this.classConstants.MORE_BUTTON);
|
|
1042
|
+
var isOverLimit = desc.scrollHeight > desc.clientHeight;
|
|
1043
|
+
if (isOverLimit) {
|
|
1044
|
+
overlimitContainer.classList.remove(_this.classConstants.HIDE_ELEMENT);
|
|
1045
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(_this.classConstants.MORE_BUTTON, 'click', function (e) {
|
|
1046
|
+
desc.classList.toggle(_this.classConstants.SUGGESTION_EXPANDED);
|
|
1047
|
+
moreButton_1.textContent = desc.classList.contains(_this.classConstants.SUGGESTION_EXPANDED) ? _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.READ_LESS : _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.READ_MORE;
|
|
1048
|
+
}, overlimitContainer);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
};
|
|
1053
|
+
rootService.prototype.handleSeeMoreButtonsForFaq = function (suggestionElement, descClassName, moreContainer, hostInstance, faqinx) {
|
|
1054
|
+
var _this = this;
|
|
1055
|
+
if (faqinx === void 0) { faqinx = -1; }
|
|
1056
|
+
var suggestionEachFaq = suggestionElement === null || suggestionElement === void 0 ? void 0 : suggestionElement.querySelectorAll(this.classConstants.SUGGESTION_EACH);
|
|
1057
|
+
suggestionEachFaq === null || suggestionEachFaq === void 0 ? void 0 : suggestionEachFaq.forEach(function (eachFaq, i) {
|
|
1058
|
+
var _a;
|
|
1059
|
+
if (faqinx == -1 || faqinx === i) {
|
|
1060
|
+
(_a = eachFaq.querySelectorAll(_this.classConstants.SUGGESTION_EACH_BODY)) === null || _a === void 0 ? void 0 : _a.forEach(function (bodyele, ii) {
|
|
1061
|
+
var _a;
|
|
1062
|
+
var desc = bodyele.querySelector(descClassName);
|
|
1063
|
+
if (desc) {
|
|
1064
|
+
var overlimitContainer = bodyele === null || bodyele === void 0 ? void 0 : bodyele.querySelector(moreContainer);
|
|
1065
|
+
var moreButton_2 = overlimitContainer === null || overlimitContainer === void 0 ? void 0 : overlimitContainer.querySelector(_this.classConstants.MORE_BUTTON);
|
|
1066
|
+
var isOverLimit = desc.scrollHeight > desc.clientHeight;
|
|
1067
|
+
if (isOverLimit) {
|
|
1068
|
+
overlimitContainer.classList.remove(_this.classConstants.HIDE_ELEMENT);
|
|
1069
|
+
(_a = hostInstance.eventManager) === null || _a === void 0 ? void 0 : _a.addEventListener(_this.classConstants.MORE_BUTTON, 'click', function (e) {
|
|
1070
|
+
desc.classList.toggle(_this.classConstants.SUGGESTION_EXPANDED);
|
|
1071
|
+
moreButton_2.textContent = desc.classList.contains(_this.classConstants.SUGGESTION_EXPANDED) ? _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.READ_LESS : _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.READ_MORE;
|
|
1072
|
+
}, overlimitContainer);
|
|
1073
|
+
}
|
|
1074
|
+
if (ii > 0) {
|
|
1075
|
+
bodyele.classList.add(_this.classConstants.HIDE_ELEMENT);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
};
|
|
1082
|
+
// playbook related logic.
|
|
1083
|
+
rootService.prototype.prepareChecklistPayload = function (event, checkListData, checklistObj, step) {
|
|
1084
|
+
var _a, _b, _c;
|
|
1085
|
+
if (step === void 0) { step = false; }
|
|
1086
|
+
var payload = {
|
|
1087
|
+
"payload": {
|
|
1088
|
+
"event": event,
|
|
1089
|
+
"conversationId": this.connectionDetails.conversationId,
|
|
1090
|
+
"ccVersion": checkListData === null || checkListData === void 0 ? void 0 : checkListData.ccVersion,
|
|
1091
|
+
"accountId": checkListData === null || checkListData === void 0 ? void 0 : checkListData.accountId,
|
|
1092
|
+
"botId": ((_a = this.connectionDetails) === null || _a === void 0 ? void 0 : _a.fromSAT) ? (_b = this.connectionDetails) === null || _b === void 0 ? void 0 : _b.instanceBotId : (_c = this.connectionDetails) === null || _c === void 0 ? void 0 : _c.botId,
|
|
1093
|
+
"agentInfo": {
|
|
1094
|
+
"agentId": "", // mendatory field
|
|
1095
|
+
//any other fields
|
|
1096
|
+
},
|
|
1097
|
+
"timestamp": 0,
|
|
1098
|
+
"context": {}
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
if (step) {
|
|
1102
|
+
payload.payload.checklistStep = checklistObj;
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
payload.payload.checklist = checklistObj;
|
|
1106
|
+
}
|
|
1107
|
+
return payload;
|
|
1108
|
+
};
|
|
1109
|
+
rootService.prototype.sendAndCopyForPlaybook = function (eventName, payload, eachPlaybookStep, hostInstance) {
|
|
1110
|
+
var message = {
|
|
1111
|
+
method: (eventName == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND_METHOD) ? _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND_METHOD : _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY_METHOD,
|
|
1112
|
+
name: (eventName == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND_METHOD) ? _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SENDMSG : _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPYMSG,
|
|
1113
|
+
conversationId: this.connectionDetails.conversationId,
|
|
1114
|
+
payload: payload,
|
|
1115
|
+
};
|
|
1116
|
+
if (eventName == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.SEND_METHOD) {
|
|
1117
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.BEFORE_VIEW_INIT, eachPlaybookStep, { event: _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.PLAYBOOK_SEND_EVENT, data: { message: message } });
|
|
1118
|
+
}
|
|
1119
|
+
else if (eventName == _constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ProjConstants.COPY_METHOD) {
|
|
1120
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.BEFORE_VIEW_INIT, eachPlaybookStep, { event: _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.PLAYBOOK_COPY_EVENT, data: { message: message } });
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
rootService.prototype.sendCheckListCompleteEvent = function (prevCheckListsData, id, hostInstance) {
|
|
1124
|
+
var checklistParams = this.prepareChecklistPayload('checklist_closed', prevCheckListsData, { "id": id });
|
|
1125
|
+
hostInstance.socketConnection.emitEvents(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.EVENTS.checklist_closed, checklistParams);
|
|
1126
|
+
};
|
|
1127
|
+
rootService.prototype.checkAllStagesCompleted = function (prevCheckListsData, id, hostInstance) {
|
|
1128
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1129
|
+
var checklists = prevCheckListsData.checklists;
|
|
1130
|
+
var completed = false;
|
|
1131
|
+
var i = (checklists || []).findIndex(function (item) { return item._id === id; });
|
|
1132
|
+
if (((_a = checklists[i]) === null || _a === void 0 ? void 0 : _a.type) !== 'primary') {
|
|
1133
|
+
completed = (((_b = checklists[i].stages[0]) === null || _b === void 0 ? void 0 : _b.steps) || [])
|
|
1134
|
+
.every(function (item) { return item.complete; });
|
|
1135
|
+
if (completed) {
|
|
1136
|
+
checklists[i].completed = true;
|
|
1137
|
+
this.sendCheckListCompleteEvent(prevCheckListsData, id, hostInstance);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1141
|
+
var open_1 = (((_c = checklists[i].stages[0]) === null || _c === void 0 ? void 0 : _c.steps) || [])
|
|
1142
|
+
.every(function (item) { return item.complete; });
|
|
1143
|
+
if (open_1) {
|
|
1144
|
+
}
|
|
1145
|
+
var close_1 = (((_d = checklists[i].stages[1]) === null || _d === void 0 ? void 0 : _d.steps) || [])
|
|
1146
|
+
.every(function (item) { return item.complete; });
|
|
1147
|
+
if (close_1) {
|
|
1148
|
+
(_g = (_f = (_e = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _e === void 0 ? void 0 : _e.querySelector(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.PROCEEDTOCLOSE_BTN)) === null || _f === void 0 ? void 0 : _f.classList) === null || _g === void 0 ? void 0 : _g.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_DISABLE_MSG);
|
|
1149
|
+
}
|
|
1150
|
+
// if (close) {
|
|
1151
|
+
// if (!this.openAck) {
|
|
1152
|
+
// this.isCloseCompleted = true;
|
|
1153
|
+
// setTimeout(() => {
|
|
1154
|
+
// this.isCloseCompleted = false;
|
|
1155
|
+
// this.openAck = true;
|
|
1156
|
+
// }, 3000);
|
|
1157
|
+
// }
|
|
1158
|
+
// }
|
|
1159
|
+
if (open_1 && close_1) {
|
|
1160
|
+
checklists[i].completed = true;
|
|
1161
|
+
completed = true;
|
|
1162
|
+
}
|
|
1163
|
+
if (completed) {
|
|
1164
|
+
this.sendCheckListCompleteEvent(prevCheckListsData, id, hostInstance);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
rootService.prototype.updateStepTemplate = function (prevCheckListsData, hostInstance) {
|
|
1169
|
+
var _a, _b;
|
|
1170
|
+
(_b = (_a = prevCheckListsData.checklists[this.selCLInx]) === null || _a === void 0 ? void 0 : _a.stages) === null || _b === void 0 ? void 0 : _b.map(function (stage, stInx) {
|
|
1171
|
+
var _a;
|
|
1172
|
+
(_a = stage === null || stage === void 0 ? void 0 : stage.steps) === null || _a === void 0 ? void 0 : _a.map(function (step, stepInx) {
|
|
1173
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1174
|
+
var stepEle = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _a === void 0 ? void 0 : _a.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_EACH_STEP).concat(stInx, "-").concat(stepInx));
|
|
1175
|
+
var stepCloseEle = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STEP_COMPLETE_BTN).concat(stInx, "-").concat(stepInx));
|
|
1176
|
+
if (stepEle) {
|
|
1177
|
+
if (step.ongoing === false) {
|
|
1178
|
+
(_b = stepEle === null || stepEle === void 0 ? void 0 : stepEle.classList) === null || _b === void 0 ? void 0 : _b.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STEP_ONGOING);
|
|
1179
|
+
(_d = (_c = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_HEADER_STEP))) === null || _c === void 0 ? void 0 : _c.classList) === null || _d === void 0 ? void 0 : _d.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_DISABLE_MSG);
|
|
1180
|
+
(_e = stepCloseEle === null || stepCloseEle === void 0 ? void 0 : stepCloseEle.classList) === null || _e === void 0 ? void 0 : _e.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1181
|
+
(_g = (_f = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STEP_SEND_BLOCK))) === null || _f === void 0 ? void 0 : _f.classList) === null || _g === void 0 ? void 0 : _g.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1182
|
+
}
|
|
1183
|
+
if (step.complete === true) {
|
|
1184
|
+
(_j = (_h = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_HEADER_STEP_NAME))) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STRIKE);
|
|
1185
|
+
}
|
|
1186
|
+
if (step.ongoing === true) {
|
|
1187
|
+
(_k = stepEle === null || stepEle === void 0 ? void 0 : stepEle.classList) === null || _k === void 0 ? void 0 : _k.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STEP_ONGOING);
|
|
1188
|
+
(_m = (_l = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_HEADER_STEP))) === null || _l === void 0 ? void 0 : _l.classList) === null || _m === void 0 ? void 0 : _m.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_DISABLE_MSG);
|
|
1189
|
+
(_o = stepCloseEle === null || stepCloseEle === void 0 ? void 0 : stepCloseEle.classList) === null || _o === void 0 ? void 0 : _o.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1190
|
+
(_q = (_p = stepEle === null || stepEle === void 0 ? void 0 : stepEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_STEP_SEND_BLOCK))) === null || _p === void 0 ? void 0 : _p.classList) === null || _q === void 0 ? void 0 : _q.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
rootService.prototype.selectNextStep = function (prevCheckListsData, clIndex, stInx, hostInstance) {
|
|
1197
|
+
var _a, _b;
|
|
1198
|
+
var allStepsComplete = true;
|
|
1199
|
+
var index = 0;
|
|
1200
|
+
this.closeAllStepsInStage(prevCheckListsData, clIndex, stInx);
|
|
1201
|
+
for (var _i = 0, _c = (_b = (_a = prevCheckListsData.checklists[clIndex]) === null || _a === void 0 ? void 0 : _a.stages[stInx]) === null || _b === void 0 ? void 0 : _b.steps; _i < _c.length; _i++) {
|
|
1202
|
+
var step = _c[_i];
|
|
1203
|
+
if (!step.complete) {
|
|
1204
|
+
step.ongoing = true;
|
|
1205
|
+
allStepsComplete = false;
|
|
1206
|
+
this.selSpInx = index;
|
|
1207
|
+
this.scrollView(step._id, hostInstance);
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
index++;
|
|
1211
|
+
}
|
|
1212
|
+
return allStepsComplete;
|
|
1213
|
+
};
|
|
1214
|
+
rootService.prototype.closeAllStepsInStage = function (prevCheckListsData, clIndex, stInx) {
|
|
1215
|
+
var _a;
|
|
1216
|
+
(_a = prevCheckListsData.checklists[clIndex]) === null || _a === void 0 ? void 0 : _a.stages.forEach(function (stage) {
|
|
1217
|
+
stage === null || stage === void 0 ? void 0 : stage.steps.forEach(function (step) {
|
|
1218
|
+
step.ongoing = false;
|
|
1219
|
+
});
|
|
1220
|
+
});
|
|
1221
|
+
};
|
|
1222
|
+
rootService.prototype.selectStepForRandom = function (stInx, step, stepInx, hostInstance) {
|
|
1223
|
+
this.selStInx = stInx;
|
|
1224
|
+
this.selSpInx = stepInx;
|
|
1225
|
+
step.ongoing = true;
|
|
1226
|
+
var stepId = step._id;
|
|
1227
|
+
this.scrollView(stepId, hostInstance);
|
|
1228
|
+
};
|
|
1229
|
+
rootService.prototype.selectStage = function (prevCheckListsData, clIndex, stInx, hostInstance) {
|
|
1230
|
+
this.selStInx = stInx;
|
|
1231
|
+
this.selectNextStep(prevCheckListsData, clIndex, stInx, hostInstance);
|
|
1232
|
+
this.updateStepTemplate(prevCheckListsData, hostInstance);
|
|
1233
|
+
};
|
|
1234
|
+
rootService.prototype.scrollView = function (stepId, hostInstance) {
|
|
1235
|
+
if (hostInstance.chatEle.querySelector("#".concat(stepId))) {
|
|
1236
|
+
hostInstance.chatEle.querySelector("#".concat(stepId)).scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
// update proceed to close button based on primary checklists
|
|
1240
|
+
rootService.prototype.showProceedToCloseBtn = function (hostInstance) {
|
|
1241
|
+
var _a;
|
|
1242
|
+
var proceedToClostBtn = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _a === void 0 ? void 0 : _a.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.PROCEEDTOCLOSE_BTN));
|
|
1243
|
+
proceedToClostBtn.classList.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1244
|
+
};
|
|
1245
|
+
rootService.prototype.clickStep = function (prevCheckListsData, stInx, step, stepInx, hostInstance) {
|
|
1246
|
+
var selCLInx = this.selCLInx;
|
|
1247
|
+
var selStInx = this.selStInx;
|
|
1248
|
+
var selSpInx = this.selSpInx;
|
|
1249
|
+
var checklists = prevCheckListsData.checklists;
|
|
1250
|
+
var cl = checklists[selCLInx];
|
|
1251
|
+
if ((step === null || step === void 0 ? void 0 : step.complete) || (step === null || step === void 0 ? void 0 : step.ongoing)) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
else if ((cl === null || cl === void 0 ? void 0 : cl.order) === "random") {
|
|
1255
|
+
checklists[selCLInx].stages[selStInx].steps[selSpInx].ongoing = false;
|
|
1256
|
+
this.selectStepForRandom(stInx, step, stepInx, hostInstance);
|
|
1257
|
+
this.updateStepTemplate(prevCheckListsData, hostInstance);
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
rootService.prototype.getNumberstepCompInStage = function (prevCheckListsData) {
|
|
1264
|
+
var _a, _b;
|
|
1265
|
+
var stepNum = 0;
|
|
1266
|
+
for (var _i = 0, _c = (_b = (_a = prevCheckListsData.checklists[this.selCLInx]) === null || _a === void 0 ? void 0 : _a.stages[this.selStInx]) === null || _b === void 0 ? void 0 : _b.steps; _i < _c.length; _i++) {
|
|
1267
|
+
var step = _c[_i];
|
|
1268
|
+
if (step.complete) {
|
|
1269
|
+
stepNum += 1;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
return stepNum;
|
|
1273
|
+
};
|
|
1274
|
+
rootService.prototype.handleStageCheck = function (parentEle, stInx, stageList, hostInstance) {
|
|
1275
|
+
var _a, _b;
|
|
1276
|
+
var selectedStageSpan = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _a === void 0 ? void 0 : _a.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.SELECTED_STAGE));
|
|
1277
|
+
if (selectedStageSpan) {
|
|
1278
|
+
selectedStageSpan.innerText = (_b = stageList[stInx]) === null || _b === void 0 ? void 0 : _b.name;
|
|
1279
|
+
}
|
|
1280
|
+
stageList === null || stageList === void 0 ? void 0 : stageList.map(function (stage, inx) {
|
|
1281
|
+
var _a, _b;
|
|
1282
|
+
var ele = parentEle === null || parentEle === void 0 ? void 0 : parentEle.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.CHECKLIST_SELECTED_STAGE_CHECK).concat(inx));
|
|
1283
|
+
inx === stInx ? (_a = ele === null || ele === void 0 ? void 0 : ele.classList) === null || _a === void 0 ? void 0 : _a.remove(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT) : (_b = ele === null || ele === void 0 ? void 0 : ele.classList) === null || _b === void 0 ? void 0 : _b.add(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.HIDE_ELEMENT);
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
rootService.prototype.selectNextStage = function (prevCheckListsData, clIndex, stInx, hostInstance) {
|
|
1287
|
+
var _a, _b, _c, _d;
|
|
1288
|
+
var allStepsCompleteInStage = this.selectNextStep(prevCheckListsData, clIndex, stInx, hostInstance);
|
|
1289
|
+
if (allStepsCompleteInStage && ((_a = prevCheckListsData.checklists[clIndex]) === null || _a === void 0 ? void 0 : _a.stages[stInx + 1])) {
|
|
1290
|
+
if (((_b = prevCheckListsData.checklists[clIndex]) === null || _b === void 0 ? void 0 : _b.stages[stInx + 1].name) != 'Close' || this.isProceedToClose) {
|
|
1291
|
+
var stageDropdown = (_c = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.chatEle) === null || _c === void 0 ? void 0 : _c.querySelector("".concat(_constants_projConsts__WEBPACK_IMPORTED_MODULE_1__.ClassMapConstanst.STAGE_DROPDOWN));
|
|
1292
|
+
this.handleStageCheck(stageDropdown, stInx + 1, (_d = prevCheckListsData.checklists[clIndex]) === null || _d === void 0 ? void 0 : _d.stages, hostInstance);
|
|
1293
|
+
this.selectStage(prevCheckListsData, clIndex, stInx + 1, hostInstance);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
this.updateStepTemplate(prevCheckListsData, hostInstance);
|
|
1297
|
+
};
|
|
1298
|
+
rootService.prototype.confirmationBtnForPlaybook = function (btn, eachPlaybookStep, hostInstance) {
|
|
1299
|
+
var eventName = btn.title === 'yes' ? _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.PLAYBOOK_CONFIRMATION_YES : _constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.PLAYBOOK_CONFIRMATION_NO;
|
|
1300
|
+
hostInstance.emit(_constants_events_cnst__WEBPACK_IMPORTED_MODULE_0__.SDK_EVENTS.BEFORE_VIEW_INIT, eachPlaybookStep, { event: eventName, data: { btn: btn } });
|
|
1301
|
+
};
|
|
1302
|
+
return rootService;
|
|
1303
|
+
}());
|
|
1304
|
+
|
|
1305
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rootService);
|
|
63
1306
|
|
|
64
1307
|
|
|
65
1308
|
/***/ })
|
|
@@ -68,7 +1311,7 @@ function AllTabs(props) {
|
|
|
68
1311
|
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
69
1312
|
/******/ /* webpack/runtime/getFullHash */
|
|
70
1313
|
/******/ (() => {
|
|
71
|
-
/******/ __webpack_require__.h = () => ("
|
|
1314
|
+
/******/ __webpack_require__.h = () => ("7b7a3f1e70ac97c951a0")
|
|
72
1315
|
/******/ })();
|
|
73
1316
|
/******/
|
|
74
1317
|
/******/ }
|