@koredev/agentai-web-sdk 1.5.4-rc → 1.5.5-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 +9 -1
- package/dist/components/common/constants/events.cnst.d.ts +15 -4
- package/dist/components/common/constants/projConsts.d.ts +16 -0
- package/dist/components/common/services/rootService.d.ts +2 -0
- package/dist/components/common/services/web-socket-service.d.ts +4 -1
- package/dist/components/common/templatemanager/tabs/sentimentScore/sentimentScore.d.ts +4 -0
- package/dist/components/common/utils/interceptor.d.ts +1 -0
- package/dist/esm/agentai-web-sdk.min.js +1 -1
- package/dist/hooks/ActiveOrPassive.d.ts +7 -0
- package/dist/hooks/useTooltip.d.ts +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 +657 -2
- package/dist/umd/hot/hot-update.js.map +1 -1
- package/dist/umd/hot/hot-update.json +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,664 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
self["webpackHotUpdateaa_sdk"]("
|
|
2
|
+
self["webpackHotUpdateaa_sdk"]("KoreAASDK",{
|
|
3
|
+
|
|
4
|
+
/***/ "./src/components/aaWindow/aaWindow.ts":
|
|
5
|
+
/*!*********************************************!*\
|
|
6
|
+
!*** ./src/components/aaWindow/aaWindow.ts ***!
|
|
7
|
+
\*********************************************/
|
|
8
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
|
+
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var _aaWindow_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_aaWindow.scss */ "./src/components/aaWindow/_aaWindow.scss");
|
|
15
|
+
/* harmony import */ var _common_utils_EventEmiter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/utils/EventEmiter */ "./src/components/common/utils/EventEmiter.ts");
|
|
16
|
+
/* harmony import */ var _common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/templatemanager/base/domManager */ "./src/components/common/templatemanager/base/domManager.tsx");
|
|
17
|
+
/* harmony import */ var _common_templatemanager_base_aaContainer_aaContainer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/templatemanager/base/aaContainer/aaContainer */ "./src/components/common/templatemanager/base/aaContainer/aaContainer.tsx");
|
|
18
|
+
/* harmony import */ var _common_services_web_socket_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/services/web-socket-service */ "./src/components/common/services/web-socket-service.ts");
|
|
19
|
+
/* harmony import */ var _common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/constants/events.cnst */ "./src/components/common/constants/events.cnst.ts");
|
|
20
|
+
/* harmony import */ var _common_services_rootService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/services/rootService */ "./src/components/common/services/rootService.ts");
|
|
21
|
+
/* harmony import */ var _common_templatemanager_base_eventManager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/templatemanager/base/eventManager */ "./src/components/common/templatemanager/base/eventManager.tsx");
|
|
22
|
+
/* harmony import */ var _common_utils_interceptor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/utils/interceptor */ "./src/components/common/utils/interceptor.ts");
|
|
23
|
+
/* harmony import */ var _common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/constants/projConsts */ "./src/components/common/constants/projConsts.ts");
|
|
24
|
+
/* harmony import */ var _common_services_localstorage_service__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/services/localstorage.service */ "./src/components/common/services/localstorage.service.ts");
|
|
25
|
+
/* harmony import */ var kore_web_sdk__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! kore-web-sdk */ "./node_modules/kore-web-sdk/dist/esm/kore-web-sdk-chat.min.js");
|
|
26
|
+
/* harmony import */ var _common_services_template_render_service__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../common/services/template-render-service */ "./src/components/common/services/template-render-service.ts");
|
|
27
|
+
/* harmony import */ var _common_services_chunkFileUpload_service__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../common/services/chunkFileUpload.service */ "./src/components/common/services/chunkFileUpload.service.ts");
|
|
28
|
+
/* harmony import */ var _common_templatemanager_tabs_ErrorBoundary_ErrorHandler__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/templatemanager/tabs/ErrorBoundary/ErrorHandler */ "./src/components/common/templatemanager/tabs/ErrorBoundary/ErrorHandler.ts");
|
|
29
|
+
/* harmony import */ var _common_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../common/templatemanager/tabs/atom/actionButtons */ "./src/components/common/templatemanager/tabs/atom/actionButtons.tsx");
|
|
30
|
+
/* harmony import */ var _common_constants_errorcodes__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common/constants/errorcodes */ "./src/components/common/constants/errorcodes.ts");
|
|
31
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
32
|
+
var extendStatics = function (d, b) {
|
|
33
|
+
extendStatics = Object.setPrototypeOf ||
|
|
34
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
36
|
+
return extendStatics(d, b);
|
|
37
|
+
};
|
|
38
|
+
return function (d, b) {
|
|
39
|
+
if (typeof b !== "function" && b !== null)
|
|
40
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
41
|
+
extendStatics(d, b);
|
|
42
|
+
function __() { this.constructor = d; }
|
|
43
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var AAWindow = /** @class */ (function (_super) {
|
|
64
|
+
__extends(AAWindow, _super);
|
|
65
|
+
function AAWindow() {
|
|
66
|
+
var _this = _super.call(this) || this;
|
|
67
|
+
_this.handleOverrideMode = function (toggleOverride, dialogId) {
|
|
68
|
+
var _a;
|
|
69
|
+
var connectionDetails = _this.rootService.connectionDetails;
|
|
70
|
+
var overRideObj = {
|
|
71
|
+
"agentId": "",
|
|
72
|
+
"botId": connectionDetails.botId,
|
|
73
|
+
"conversationId": connectionDetails.conversationId,
|
|
74
|
+
"query": "",
|
|
75
|
+
"enable_override_userinput": toggleOverride,
|
|
76
|
+
'experience': (_a = _this.rootService.connectionDetails) === null || _a === void 0 ? void 0 : _a.channel,
|
|
77
|
+
"positionId": dialogId
|
|
78
|
+
};
|
|
79
|
+
// this.rootService.proactiveMode = !toggleOverride;
|
|
80
|
+
_this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.enable_override_userinput, overRideObj);
|
|
81
|
+
_this.rootService.OverRideMode = toggleOverride;
|
|
82
|
+
};
|
|
83
|
+
_common_templatemanager_tabs_ErrorBoundary_ErrorHandler__WEBPACK_IMPORTED_MODULE_13__.ErrorHandler.initialize(_this);
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
AAWindow.prototype.show = function (config) {
|
|
87
|
+
this.config = config;
|
|
88
|
+
this.dskSettings = config.dskSettings;
|
|
89
|
+
this.initShow(config);
|
|
90
|
+
this.eventManager = new _common_templatemanager_base_eventManager__WEBPACK_IMPORTED_MODULE_7__["default"](this);
|
|
91
|
+
window.addEventListener('message', this.receiveMessage.bind(this), false);
|
|
92
|
+
};
|
|
93
|
+
;
|
|
94
|
+
AAWindow.prototype.sendUserMessage = function (_data) {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
96
|
+
if (((_b = (_a = _data.author) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'user') {
|
|
97
|
+
var sanitizedValue = this.rootService.sanitizeHTML(_data.message);
|
|
98
|
+
_data.message = sanitizedValue;
|
|
99
|
+
if (_data.message) {
|
|
100
|
+
var conversationId = (_c = this.rootService.connectionDetails) === null || _c === void 0 ? void 0 : _c.conversationId;
|
|
101
|
+
var botId = (_d = this.rootService.connectionDetails) === null || _d === void 0 ? void 0 : _d.botId;
|
|
102
|
+
var data = {
|
|
103
|
+
author: _data.author,
|
|
104
|
+
type: (_f = (_e = _data.author) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.toUpperCase(),
|
|
105
|
+
conversationId: conversationId,
|
|
106
|
+
value: _data.message,
|
|
107
|
+
botId: botId,
|
|
108
|
+
message: _data.message
|
|
109
|
+
};
|
|
110
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.USER_TRANSCRIPT_MSG, data);
|
|
111
|
+
this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.user_sent_message, data);
|
|
112
|
+
if (this.rootService.proactiveMode && !this.rootService.OverRideMode && !this.rootService.manualAssistOverrideMode) {
|
|
113
|
+
var agent_assist_request = {
|
|
114
|
+
author: _data.author,
|
|
115
|
+
botId: botId,
|
|
116
|
+
conversationId: conversationId,
|
|
117
|
+
experience: (_g = this.rootService.connectionDetails) === null || _g === void 0 ? void 0 : _g.channel,
|
|
118
|
+
query: _data.message,
|
|
119
|
+
positionId: this.rootService.isAutomationOnGoing ? this.rootService.currentPositionId : null
|
|
120
|
+
};
|
|
121
|
+
if (_data === null || _data === void 0 ? void 0 : _data.customData) {
|
|
122
|
+
agent_assist_request['customData'] = JSON.parse(JSON.stringify(_data === null || _data === void 0 ? void 0 : _data.customData));
|
|
123
|
+
}
|
|
124
|
+
if (_data === null || _data === void 0 ? void 0 : _data.secureCustomData) {
|
|
125
|
+
agent_assist_request['secureCustomData'] = _data === null || _data === void 0 ? void 0 : _data.secureCustomData;
|
|
126
|
+
}
|
|
127
|
+
var assistSection = document.querySelector("".concat(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.ClassMapConstanst.ASSIST_SECTION));
|
|
128
|
+
var parentNode = (((_h = assistSection === null || assistSection === void 0 ? void 0 : assistSection.childNodes) === null || _h === void 0 ? void 0 : _h.length) > 0 ? assistSection === null || assistSection === void 0 ? void 0 : assistSection.childNodes[((_j = assistSection === null || assistSection === void 0 ? void 0 : assistSection.childNodes) === null || _j === void 0 ? void 0 : _j.length) - 1] : assistSection);
|
|
129
|
+
this.renderIndividualLoader(parentNode);
|
|
130
|
+
this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.agent_assist_request, agent_assist_request);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.ON_ERROR, _common_constants_errorcodes__WEBPACK_IMPORTED_MODULE_15__.ERROR_CODES['ERR_USER_MISSING_REQ_FIELDS']);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
AAWindow.prototype.sendAgentMessage = function (_data) {
|
|
139
|
+
var _a, _b, _c, _d, _e, _f;
|
|
140
|
+
if (((_b = (_a = _data.author) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'agent') {
|
|
141
|
+
var sanitizedValue = this.rootService.sanitizeHTML(_data.message);
|
|
142
|
+
_data.message = sanitizedValue;
|
|
143
|
+
if (_data.message) {
|
|
144
|
+
var conversationId = (_c = this.rootService.connectionDetails) === null || _c === void 0 ? void 0 : _c.conversationId;
|
|
145
|
+
var botId = (_d = this.rootService.connectionDetails) === null || _d === void 0 ? void 0 : _d.botId;
|
|
146
|
+
var data = {
|
|
147
|
+
author: _data.author,
|
|
148
|
+
type: (_f = (_e = _data.author) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.toUpperCase(),
|
|
149
|
+
conversationId: conversationId,
|
|
150
|
+
value: _data.message,
|
|
151
|
+
botId: botId
|
|
152
|
+
};
|
|
153
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.AGENT_TRANSCRIPT_MSG, data);
|
|
154
|
+
if (_data === null || _data === void 0 ? void 0 : _data.customData) {
|
|
155
|
+
data['customData'] = JSON.parse(JSON.stringify(_data === null || _data === void 0 ? void 0 : _data.customData));
|
|
156
|
+
}
|
|
157
|
+
if (_data === null || _data === void 0 ? void 0 : _data.secureCustomData) {
|
|
158
|
+
data['secureCustomData'] = _data === null || _data === void 0 ? void 0 : _data.secureCustomData;
|
|
159
|
+
}
|
|
160
|
+
this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.agent_sent_message, data);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.ON_ERROR, _common_constants_errorcodes__WEBPACK_IMPORTED_MODULE_15__.ERROR_CODES['ERR_AGENT_MISSING_REQ_FIELDS']);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
AAWindow.prototype.initShow = function (config) {
|
|
168
|
+
var _this = this;
|
|
169
|
+
var _a, _b, _c;
|
|
170
|
+
this.renderLoader();
|
|
171
|
+
this.socketConnection = new _common_services_web_socket_service__WEBPACK_IMPORTED_MODULE_4__["default"](this);
|
|
172
|
+
this.chatWindowInstance = new kore_web_sdk__WEBPACK_IMPORTED_MODULE_16__.chatWindow();
|
|
173
|
+
this.chatWindowInstance.sendMessage = function (messageText, options, serverMessageObject, clientMessageObject) {
|
|
174
|
+
console.log(messageText, options, serverMessageObject, clientMessageObject, "txt***8");
|
|
175
|
+
_this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.TEMPLATE_CLICK, { messageText: messageText, tab: _this.rootService.activeTab });
|
|
176
|
+
};
|
|
177
|
+
this.rootService = new _common_services_rootService__WEBPACK_IMPORTED_MODULE_6__["default"](this);
|
|
178
|
+
this.localStorageService = new _common_services_localstorage_service__WEBPACK_IMPORTED_MODULE_10__["default"](this);
|
|
179
|
+
this.chunkFileUploadService = new _common_services_chunkFileUpload_service__WEBPACK_IMPORTED_MODULE_12__.chunkFileUploadService(this);
|
|
180
|
+
this.rootService.connectionDetails = config.connectionDetails;
|
|
181
|
+
this.templateRenderService = new _common_services_template_render_service__WEBPACK_IMPORTED_MODULE_11__.templateRenderClassService(this);
|
|
182
|
+
//apply branding based on theme
|
|
183
|
+
var theme = (_a = this.localStorageService) === null || _a === void 0 ? void 0 : _a.getThemeLocal();
|
|
184
|
+
this.applyBranding(theme === _common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.storageConst.DARK ? _common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.DARKTHEME_COLORCODES : (_b = config.branding) === null || _b === void 0 ? void 0 : _b.colors, theme);
|
|
185
|
+
// this.chatWindowInstance.setBranding();
|
|
186
|
+
var _d = config.connectionDetails, botId = _d.botId, conversationId = _d.conversationId, token = _d.token, domainURL = _d.domainURL;
|
|
187
|
+
var isJWE = ((_c = token === null || token === void 0 ? void 0 : token.split('.')) === null || _c === void 0 ? void 0 : _c.length) === 5;
|
|
188
|
+
if (botId && conversationId && token && domainURL || isJWE) {
|
|
189
|
+
this.JWTSetup(config, isJWE)
|
|
190
|
+
.then(function (data) {
|
|
191
|
+
if (data === null || data === void 0 ? void 0 : data.cId) {
|
|
192
|
+
config.connectionDetails.conversationId = data.cId;
|
|
193
|
+
_this.rootService.connectionDetails.conversationId = data.cId;
|
|
194
|
+
}
|
|
195
|
+
_this.rootService.grantResponseObj = data;
|
|
196
|
+
config['JWT_RESP'] = data;
|
|
197
|
+
_this.socketConnection.configOptions = config;
|
|
198
|
+
var _a = config.connectionDetails, botId = _a.botId, channel = _a.channel;
|
|
199
|
+
_this.getAASettings(botId)
|
|
200
|
+
.then(function (res) {
|
|
201
|
+
var widgetSettings = {};
|
|
202
|
+
if (res && res.agentAssistSettings && res.agentAssistSettings[channel]) {
|
|
203
|
+
_this.rootService.accountId = res.accountId;
|
|
204
|
+
res.agentAssistSettings = _this.addBackWardCompatibility(res.agentAssistSettings);
|
|
205
|
+
widgetSettings = Object.assign(res.agentAssistSettings, res.agentAssistSettings[channel]);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
widgetSettings = _this.rootService.defaultwidgetSettings;
|
|
209
|
+
}
|
|
210
|
+
_this.rootService.aaSettings = JSON.parse(JSON.stringify(widgetSettings));
|
|
211
|
+
var hasEnabledTabs = _this.localStorageService.initializeLocalStorageData(widgetSettings);
|
|
212
|
+
if (!hasEnabledTabs) {
|
|
213
|
+
var noTabsScreenHtml = (0,_common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_common_templatemanager_tabs_atom_actionButtons__WEBPACK_IMPORTED_MODULE_14__.NoTabsScreen, {}, _this);
|
|
214
|
+
_this.render(noTabsScreenHtml);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
_this.socketConnection.socketConnection(config);
|
|
218
|
+
var chatWindowHtml = void 0;
|
|
219
|
+
chatWindowHtml = (0,_common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_common_templatemanager_base_aaContainer_aaContainer__WEBPACK_IMPORTED_MODULE_3__.AAContainer, {}, _this);
|
|
220
|
+
_this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.BEFORE_VIEW_INIT, chatWindowHtml, { event: _common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.MAIN_CONTAINER, data: {} });
|
|
221
|
+
_this.chatEle = chatWindowHtml;
|
|
222
|
+
_this.render(chatWindowHtml);
|
|
223
|
+
_this.bindEvents();
|
|
224
|
+
_this.hideSendAndCopy();
|
|
225
|
+
_this.chatWindowInstance.chatEle = _this.chatEle;
|
|
226
|
+
}
|
|
227
|
+
}).catch(function (err) {
|
|
228
|
+
_this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.ON_ERROR, _common_constants_errorcodes__WEBPACK_IMPORTED_MODULE_15__.ERROR_CODES['ERR_SETTINGS_API_FAILURE']);
|
|
229
|
+
});
|
|
230
|
+
}).catch(function (err) {
|
|
231
|
+
_this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.ON_ERROR, _common_constants_errorcodes__WEBPACK_IMPORTED_MODULE_15__.ERROR_CODES['ERR_TOKEN_INVALID']);
|
|
232
|
+
_this.handleNetworkError();
|
|
233
|
+
});
|
|
234
|
+
this.chatWindowInstance.on('beforeWSSendMessage', function (event) {
|
|
235
|
+
console.log('before ws send message: ', event);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
;
|
|
240
|
+
AAWindow.prototype.addBackWardCompatibility = function (agentassistSettings) {
|
|
241
|
+
var _a;
|
|
242
|
+
if (agentassistSettings && (!agentassistSettings.feedback || !((_a = Object.keys(agentassistSettings.feedback)) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
243
|
+
agentassistSettings.feedback = this.rootService.defaultFeedbackSettings;
|
|
244
|
+
}
|
|
245
|
+
return agentassistSettings;
|
|
246
|
+
};
|
|
247
|
+
AAWindow.prototype.hideSendAndCopy = function () {
|
|
248
|
+
var _a, _b, _c, _d;
|
|
249
|
+
this.rootService.hideActionButtons = (this.rootService.connectionDetails.channel === _common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.ProjConstants.VOICE) ? true : false;
|
|
250
|
+
if (((_b = (_a = this.rootService) === null || _a === void 0 ? void 0 : _a.aaSettings) === null || _b === void 0 ? void 0 : _b.isAgentResponseEnabled) === false) {
|
|
251
|
+
this.rootService.hideSendButton = true;
|
|
252
|
+
}
|
|
253
|
+
if (((_d = (_c = this.rootService) === null || _c === void 0 ? void 0 : _c.aaSettings) === null || _d === void 0 ? void 0 : _d.isAgentResponseCopyEnabled) === false) {
|
|
254
|
+
this.rootService.hideCopyButton = true;
|
|
255
|
+
}
|
|
256
|
+
if (this.rootService.hideSendButton && this.rootService.hideCopyButton) {
|
|
257
|
+
this.rootService.hideActionButtons = true;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
AAWindow.prototype.getAASettings = function (botId) {
|
|
261
|
+
var channel = this.rootService.connectionDetails.channel;
|
|
262
|
+
return (0,_common_utils_interceptor__WEBPACK_IMPORTED_MODULE_8__["default"])('get_aa_settings', {
|
|
263
|
+
method: 'GET',
|
|
264
|
+
headers: {
|
|
265
|
+
'Content-Type': 'application/json',
|
|
266
|
+
},
|
|
267
|
+
}, this, { botId: botId, channel: channel });
|
|
268
|
+
};
|
|
269
|
+
AAWindow.prototype.JWTSetup = function (options, isJWE) {
|
|
270
|
+
var _a, _b;
|
|
271
|
+
var _c = options.connectionDetails || {}, token = _c.token, botId = _c.botId;
|
|
272
|
+
var payload = {
|
|
273
|
+
"assertion": token,
|
|
274
|
+
"botInfo": {
|
|
275
|
+
taskBotId: botId,
|
|
276
|
+
chatBot: 'Sample Bot'
|
|
277
|
+
},
|
|
278
|
+
"token": {}
|
|
279
|
+
};
|
|
280
|
+
// const endPoint = isJWE ? 'jwt_load' : 'jwt_grant';
|
|
281
|
+
var endPoint = ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.connectionDetails) === null || _b === void 0 ? void 0 : _b.isSecure) ? 'jwt_load' : 'jwt_grant';
|
|
282
|
+
return (0,_common_utils_interceptor__WEBPACK_IMPORTED_MODULE_8__["default"])(endPoint, {
|
|
283
|
+
method: 'POST',
|
|
284
|
+
body: JSON.stringify(payload),
|
|
285
|
+
}, this);
|
|
286
|
+
};
|
|
287
|
+
AAWindow.prototype.render = function (chatWindowHtml) {
|
|
288
|
+
this.clearContainer();
|
|
289
|
+
var container = document.getElementsByClassName(this.config.container)[0];
|
|
290
|
+
if (chatWindowHtml) {
|
|
291
|
+
container.append(chatWindowHtml);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
;
|
|
295
|
+
AAWindow.prototype.clearContainer = function () {
|
|
296
|
+
var elements = document.getElementsByClassName(this.config.container);
|
|
297
|
+
// Loop through each element and clear its children
|
|
298
|
+
for (var i = 0; i < elements.length; i++) {
|
|
299
|
+
while (elements[i].firstChild) {
|
|
300
|
+
elements[i].removeChild(elements[i].firstChild);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
AAWindow.prototype.renderLoader = function () {
|
|
305
|
+
var loaderHtml = (0,_common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_common_templatemanager_base_aaContainer_aaContainer__WEBPACK_IMPORTED_MODULE_3__.AALoder, {}, this);
|
|
306
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.BEFORE_VIEW_INIT, loaderHtml, { event: _common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.MAIN_LOADER, data: {} });
|
|
307
|
+
var container = document.getElementsByClassName(this.config.container)[0];
|
|
308
|
+
container.append(loaderHtml);
|
|
309
|
+
};
|
|
310
|
+
AAWindow.prototype.removeLoader = function () {
|
|
311
|
+
var loaderHtml = document.getElementById(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.IdMapConstant.LOADER_BLOCK_MAIN);
|
|
312
|
+
loaderHtml === null || loaderHtml === void 0 ? void 0 : loaderHtml.remove();
|
|
313
|
+
};
|
|
314
|
+
AAWindow.prototype.renderIndividualLoader = function (container) {
|
|
315
|
+
var _this = this;
|
|
316
|
+
var loaderHtml = (0,_common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_common_templatemanager_base_aaContainer_aaContainer__WEBPACK_IMPORTED_MODULE_3__.IndividualLoader, {}, this);
|
|
317
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.BEFORE_VIEW_INIT, loaderHtml, { event: _common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.INDIVIDUAL_LOADER, data: {} });
|
|
318
|
+
container === null || container === void 0 ? void 0 : container.append(loaderHtml);
|
|
319
|
+
setTimeout(function () {
|
|
320
|
+
_this.removeIndividualLoader(container);
|
|
321
|
+
}, 5000);
|
|
322
|
+
};
|
|
323
|
+
AAWindow.prototype.removeIndividualLoader = function (parentNode) {
|
|
324
|
+
var loaderHtml = parentNode.querySelector("#".concat(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.IdMapConstant.LOADER_BLOCK_INDIVIDUAL));
|
|
325
|
+
loaderHtml === null || loaderHtml === void 0 ? void 0 : loaderHtml.remove();
|
|
326
|
+
};
|
|
327
|
+
AAWindow.prototype.bindEvents = function () {
|
|
328
|
+
var _this = this;
|
|
329
|
+
this.on('ON_SOCKET_CONNECTION', function (config) {
|
|
330
|
+
_this.commonEmitEvents(config);
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
AAWindow.prototype.commonEmitEvents = function (config) {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
var _c = config === null || config === void 0 ? void 0 : config.connectionDetails, botId = _c.botId, conversationId = _c.conversationId, autoBotId = _c.autoBotId, interactiveLanguage = _c.interactiveLanguage, userName = _c.userName, customData = _c.customData, token = _c.token, channel = _c.channel;
|
|
336
|
+
var sendCustomData = '';
|
|
337
|
+
var sendInteractiveLanguage = '';
|
|
338
|
+
var sendAutoBotId = '';
|
|
339
|
+
if (customData && ((_a = Object.keys(customData)) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = config === null || config === void 0 ? void 0 : config.connectionDetails) === null || _b === void 0 ? void 0 : _b.source) !== 'smartassist-color-scheme') {
|
|
340
|
+
sendCustomData = customData;
|
|
341
|
+
}
|
|
342
|
+
;
|
|
343
|
+
if (interactiveLanguage !== null && typeof interactiveLanguage !== 'undefined' && interactiveLanguage !== "''") {
|
|
344
|
+
sendInteractiveLanguage = interactiveLanguage; // Return the default value for null, undefined, or "''"
|
|
345
|
+
}
|
|
346
|
+
;
|
|
347
|
+
if (autoBotId && autoBotId !== 'undefined') {
|
|
348
|
+
sendAutoBotId = autoBotId;
|
|
349
|
+
}
|
|
350
|
+
;
|
|
351
|
+
var welComeMsgReqParam = {
|
|
352
|
+
"waitTime": 2000,
|
|
353
|
+
"userName": userName,
|
|
354
|
+
"id": conversationId,
|
|
355
|
+
"isSendWelcomeMessage": true,
|
|
356
|
+
"agentassistInfo": {},
|
|
357
|
+
"botId": botId,
|
|
358
|
+
"sendMenuRequest": true,
|
|
359
|
+
"uId": "",
|
|
360
|
+
"sId": "",
|
|
361
|
+
"experience": channel,
|
|
362
|
+
"jToken": token,
|
|
363
|
+
"conversationId": conversationId,
|
|
364
|
+
"autoBotId": sendAutoBotId,
|
|
365
|
+
"language": sendInteractiveLanguage,
|
|
366
|
+
"allQueryParams": config === null || config === void 0 ? void 0 : config.connectionDetails,
|
|
367
|
+
"customData": sendCustomData,
|
|
368
|
+
};
|
|
369
|
+
this.welComeMsgReq(welComeMsgReqParam);
|
|
370
|
+
var overrideMode = this.rootService.proactiveMode ? false : true;
|
|
371
|
+
this.handleOverrideMode(overrideMode, null);
|
|
372
|
+
var menuReqParam = {
|
|
373
|
+
"botId": botId,
|
|
374
|
+
"conversationId": conversationId,
|
|
375
|
+
"experience": channel,
|
|
376
|
+
"autoBotId": sendAutoBotId,
|
|
377
|
+
"language": sendInteractiveLanguage
|
|
378
|
+
};
|
|
379
|
+
this.menuReq(menuReqParam);
|
|
380
|
+
};
|
|
381
|
+
AAWindow.prototype.prepareAgentAssistRequestParams = function (data) {
|
|
382
|
+
var _a, _b, _c, _d, _e, _f;
|
|
383
|
+
var agent_assist_request = {
|
|
384
|
+
'conversationId': data.conversationId,
|
|
385
|
+
'query': data.value,
|
|
386
|
+
'botId': data.botId,
|
|
387
|
+
'agentId': '',
|
|
388
|
+
'experience': data === null || data === void 0 ? void 0 : data.channel,
|
|
389
|
+
'positionId': data.positionId,
|
|
390
|
+
'intType': 'assist'
|
|
391
|
+
};
|
|
392
|
+
if (data.intentName) {
|
|
393
|
+
agent_assist_request['intentName'] = data.value;
|
|
394
|
+
}
|
|
395
|
+
if (data.entities) {
|
|
396
|
+
agent_assist_request['entities'] = data.entities;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
agent_assist_request['entities'] = [];
|
|
400
|
+
}
|
|
401
|
+
if (data.childBotId) {
|
|
402
|
+
agent_assist_request['childBotId'] = data.childBotId;
|
|
403
|
+
}
|
|
404
|
+
if (data.childBotName) {
|
|
405
|
+
agent_assist_request['childBotName'] = data.childBotName;
|
|
406
|
+
}
|
|
407
|
+
if ((data === null || data === void 0 ? void 0 : data.autoBotId) && (data === null || data === void 0 ? void 0 : data.autoBotId) !== 'undefined') {
|
|
408
|
+
agent_assist_request['autoBotId'] = data.autoBotId;
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
agent_assist_request['autoBotId'] = '';
|
|
412
|
+
}
|
|
413
|
+
if (data.intentName && data.userInput) {
|
|
414
|
+
agent_assist_request['query'] = data.userInput;
|
|
415
|
+
}
|
|
416
|
+
if (this.rootService.isAutomationOnGoing) {
|
|
417
|
+
agent_assist_request['positionId'] = this.rootService.currentPositionId;
|
|
418
|
+
}
|
|
419
|
+
if (Array.isArray(data.traits) && ((_a = data === null || data === void 0 ? void 0 : data.traits) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
420
|
+
agent_assist_request['traits'] = data.traits;
|
|
421
|
+
}
|
|
422
|
+
if (data.taskRefId) {
|
|
423
|
+
agent_assist_request['taskRefId'] = data.taskRefId;
|
|
424
|
+
}
|
|
425
|
+
if (data.dialogId) {
|
|
426
|
+
agent_assist_request['dialogId'] = data.dialogId;
|
|
427
|
+
}
|
|
428
|
+
if (data.isDiscard) {
|
|
429
|
+
agent_assist_request['terminateTask'] = data.isDiscard;
|
|
430
|
+
}
|
|
431
|
+
if (data === null || data === void 0 ? void 0 : data.attachments) {
|
|
432
|
+
agent_assist_request['query'] = ((_c = (_b = data === null || data === void 0 ? void 0 : data.attachments[0]) === null || _b === void 0 ? void 0 : _b.url) === null || _c === void 0 ? void 0 : _c.fileUrl) || '';
|
|
433
|
+
agent_assist_request['attachments'] = data === null || data === void 0 ? void 0 : data.attachments;
|
|
434
|
+
}
|
|
435
|
+
if (data === null || data === void 0 ? void 0 : data.author) {
|
|
436
|
+
agent_assist_request['firstName'] = ((_d = data === null || data === void 0 ? void 0 : data.author) === null || _d === void 0 ? void 0 : _d.firstName) || '';
|
|
437
|
+
agent_assist_request['lastName'] = ((_e = data === null || data === void 0 ? void 0 : data.author) === null || _e === void 0 ? void 0 : _e.lastName) || '';
|
|
438
|
+
agent_assist_request['type'] = ((_f = data === null || data === void 0 ? void 0 : data.author) === null || _f === void 0 ? void 0 : _f.type) || '';
|
|
439
|
+
}
|
|
440
|
+
agent_assist_request = this.addSourceMsgIdToRequestParams(data, agent_assist_request);
|
|
441
|
+
return agent_assist_request;
|
|
442
|
+
};
|
|
443
|
+
AAWindow.prototype.prepareAgentAssistAgentRequestParams = function (data) {
|
|
444
|
+
var _a, _b, _c;
|
|
445
|
+
var agent_assist_agent_request_params = {
|
|
446
|
+
'isSearch': data.isSearch,
|
|
447
|
+
'conversationId': data.conversationId,
|
|
448
|
+
'query': data.value,
|
|
449
|
+
'botId': data.botId,
|
|
450
|
+
'experience': data === null || data === void 0 ? void 0 : data.channel,
|
|
451
|
+
'positionId': data === null || data === void 0 ? void 0 : data.positionId,
|
|
452
|
+
'childBotId': (data === null || data === void 0 ? void 0 : data.childBotId) || '',
|
|
453
|
+
'childBotName': (data === null || data === void 0 ? void 0 : data.childBotName) || '',
|
|
454
|
+
'intType': 'myBot'
|
|
455
|
+
};
|
|
456
|
+
if (data.intentName) {
|
|
457
|
+
agent_assist_agent_request_params.intentName = data.intentName;
|
|
458
|
+
}
|
|
459
|
+
// if(data.childBotId) {
|
|
460
|
+
// agent_assist_agent_request_params['childBotId'] = data.childBotId;
|
|
461
|
+
// agent_assist_agent_request_params['childBotName'] = data.childBotName;
|
|
462
|
+
// }
|
|
463
|
+
if ((data === null || data === void 0 ? void 0 : data.autoBotId) && (data === null || data === void 0 ? void 0 : data.autoBotId) !== 'undefined') {
|
|
464
|
+
agent_assist_agent_request_params['autoBotId'] = data.autoBotId;
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
agent_assist_agent_request_params['autoBotId'] = '';
|
|
468
|
+
}
|
|
469
|
+
if (data.intentName && data.userInput) {
|
|
470
|
+
agent_assist_agent_request_params['query'] = data.userInput;
|
|
471
|
+
}
|
|
472
|
+
// if (this.isMyBotAutomationOnGoing) {
|
|
473
|
+
// agent_assist_agent_request_params['positionId'] = this.currentPositionIdOfMyBot;
|
|
474
|
+
// }
|
|
475
|
+
if (Array.isArray(data.traits) && ((_a = data === null || data === void 0 ? void 0 : data.traits) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
476
|
+
agent_assist_agent_request_params['traits'] = data.traits;
|
|
477
|
+
}
|
|
478
|
+
if (data.taskRefId) {
|
|
479
|
+
agent_assist_agent_request_params['taskRefId'] = data.taskRefId;
|
|
480
|
+
}
|
|
481
|
+
if (data.dialogId) {
|
|
482
|
+
agent_assist_agent_request_params['dialogId'] = data.dialogId;
|
|
483
|
+
}
|
|
484
|
+
if (data.isDiscard) {
|
|
485
|
+
agent_assist_agent_request_params['terminateTask'] = data.isDiscard;
|
|
486
|
+
}
|
|
487
|
+
if (data === null || data === void 0 ? void 0 : data.attachments) {
|
|
488
|
+
agent_assist_agent_request_params['query'] = ((_c = (_b = data === null || data === void 0 ? void 0 : data.attachments[0]) === null || _b === void 0 ? void 0 : _b.url) === null || _c === void 0 ? void 0 : _c.fileUrl) || '';
|
|
489
|
+
agent_assist_agent_request_params['attachments'] = data === null || data === void 0 ? void 0 : data.attachments;
|
|
490
|
+
}
|
|
491
|
+
agent_assist_agent_request_params = this.addSourceMsgIdToRequestParams(data, agent_assist_agent_request_params);
|
|
492
|
+
return agent_assist_agent_request_params;
|
|
493
|
+
};
|
|
494
|
+
AAWindow.prototype.addSourceMsgIdToRequestParams = function (data, requestParams) {
|
|
495
|
+
if (data.sourceMsgId) {
|
|
496
|
+
if (data.sourceMsgId == 'fromLibrary') {
|
|
497
|
+
requestParams['fromLibrary'] = true;
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
requestParams['sourceMsgId'] = data.sourceMsgId;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return requestParams;
|
|
504
|
+
};
|
|
505
|
+
AAWindow.prototype.welComeMsgReq = function (welComeMsgReqParam) {
|
|
506
|
+
this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.welcome_message_request, welComeMsgReqParam);
|
|
507
|
+
};
|
|
508
|
+
AAWindow.prototype.menuReq = function (menuReqParam) {
|
|
509
|
+
this.socketConnection.emitEvents(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS.agent_menu_request, menuReqParam);
|
|
510
|
+
};
|
|
511
|
+
//events to handle from client
|
|
512
|
+
// selectAAFooterTab(data : any){
|
|
513
|
+
// this.emit('selectTab', data , {});
|
|
514
|
+
// }
|
|
515
|
+
AAWindow.prototype.openAssistTab = function (footerTag) {
|
|
516
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.UPDATE_ACTIVE_TAB, { activeTab: 'ast', footerTag: footerTag });
|
|
517
|
+
};
|
|
518
|
+
AAWindow.prototype.openTranscriptTab = function (footerTag) {
|
|
519
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.UPDATE_ACTIVE_TAB, { activeTab: 'trnspt', footerTag: footerTag });
|
|
520
|
+
};
|
|
521
|
+
AAWindow.prototype.openSearchTab = function (footerTag) {
|
|
522
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.UPDATE_ACTIVE_TAB, { activeTab: 'srch', footerTag: footerTag });
|
|
523
|
+
};
|
|
524
|
+
AAWindow.prototype.openMybotTab = function (footerTag) {
|
|
525
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.UPDATE_ACTIVE_TAB, { activeTab: 'mB', footerTag: footerTag });
|
|
526
|
+
};
|
|
527
|
+
AAWindow.prototype.openPlaybookTab = function (footerTag) {
|
|
528
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.UPDATE_ACTIVE_TAB, { activeTab: 'playbook', footerTag: footerTag });
|
|
529
|
+
};
|
|
530
|
+
AAWindow.prototype.sendChecklistOpenedEvent = function (checklistParams) {
|
|
531
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.CHECKLIST_OPEN, checklistParams);
|
|
532
|
+
};
|
|
533
|
+
AAWindow.prototype.sendChecklistResumeEvent = function (checklistParams) {
|
|
534
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.CHECLIST_RESUME, checklistParams);
|
|
535
|
+
};
|
|
536
|
+
AAWindow.prototype.sendChecklistStepCloseEvent = function (checklistParams) {
|
|
537
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.CHECKLIST_STEP_CLOSE, checklistParams);
|
|
538
|
+
};
|
|
539
|
+
AAWindow.prototype.sendChecklistProceedToCloseEvent = function (checklistParams) {
|
|
540
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.EVENTS_TO_SDK.CHECKLIST_PROCEED_TO_CLOSE, checklistParams);
|
|
541
|
+
};
|
|
542
|
+
AAWindow.prototype.endOfConversation = function () {
|
|
543
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.END_OF_CONVERSATION);
|
|
544
|
+
};
|
|
545
|
+
AAWindow.prototype.responseResolutionCommentsFromParent = function (resolutionComments) {
|
|
546
|
+
resolutionComments.openOnResponse = true;
|
|
547
|
+
this.setSummaryPopup(resolutionComments);
|
|
548
|
+
};
|
|
549
|
+
AAWindow.prototype.setSummaryPopup = function (summaryPopup) {
|
|
550
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.SET_SUMMARY_POPUP, summaryPopup);
|
|
551
|
+
};
|
|
552
|
+
AAWindow.prototype.internalTransfer = function (data) {
|
|
553
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.INTERNAL_TRANSFER, data);
|
|
554
|
+
};
|
|
555
|
+
AAWindow.prototype.disableWidget = function (isActive) {
|
|
556
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.DISABLE_WIDGET, isActive);
|
|
557
|
+
};
|
|
558
|
+
AAWindow.prototype.applyBranding = function (colors, theme) {
|
|
559
|
+
var _a, _b, _c;
|
|
560
|
+
if (theme === _common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.storageConst.DARK) {
|
|
561
|
+
colors = JSON.parse(JSON.stringify(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.DARKTHEME_COLORCODES));
|
|
562
|
+
colors.primay = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.branding) === null || _b === void 0 ? void 0 : _b.colors) === null || _c === void 0 ? void 0 : _c.primay;
|
|
563
|
+
}
|
|
564
|
+
var colorObj = {
|
|
565
|
+
primay: '--AA-primary-color',
|
|
566
|
+
secondary: '--AA-secondary-color',
|
|
567
|
+
primaryText: '--AA-primary-text',
|
|
568
|
+
secondaryText: '--AA-secondary-text',
|
|
569
|
+
bodyBackground: '--AA-body-background',
|
|
570
|
+
warningColor: '--AA-warning-color',
|
|
571
|
+
};
|
|
572
|
+
if (colorObj) {
|
|
573
|
+
for (var key in colorObj) {
|
|
574
|
+
if (Object.prototype.hasOwnProperty.call(colorObj, key)) {
|
|
575
|
+
var element = colorObj[key];
|
|
576
|
+
document.documentElement.style.setProperty(element, colors[key]);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
AAWindow.prototype.destroy = function () {
|
|
582
|
+
this.socketConnection.disconnect();
|
|
583
|
+
this.emit('DESTROY_WIDGET', {});
|
|
584
|
+
this.localStorageService.deleteLocalStorageState(this.rootService.connectionDetails.conversationId);
|
|
585
|
+
};
|
|
586
|
+
AAWindow.prototype.handleNetworkError = function () {
|
|
587
|
+
var _this = this;
|
|
588
|
+
var toastElement = this.addNetworkErrorToastrTemplate();
|
|
589
|
+
try {
|
|
590
|
+
requestAnimationFrame(function () {
|
|
591
|
+
_this.rootService.showNetworkToastr(_this);
|
|
592
|
+
if (_this.timeoutId !== undefined) {
|
|
593
|
+
clearTimeout(_this.timeoutId);
|
|
594
|
+
}
|
|
595
|
+
// this.timeoutId = window.setTimeout(() => {
|
|
596
|
+
// // this.rootService.hideNetworkToastr(this);
|
|
597
|
+
// }, 5000);
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
console.error('Error handling network toast:', error);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
AAWindow.prototype.addNetworkErrorToastrTemplate = function () {
|
|
605
|
+
var _this = this;
|
|
606
|
+
var _a, _b;
|
|
607
|
+
try {
|
|
608
|
+
var container = document.querySelector(".".concat(this.config.container));
|
|
609
|
+
var toastContainer = container === null || container === void 0 ? void 0 : container.querySelector(".".concat(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.ClassMapConstanst.NETWORK_ERROR_TOASTR));
|
|
610
|
+
if (!toastContainer) {
|
|
611
|
+
(_a = container === null || container === void 0 ? void 0 : container.classList) === null || _a === void 0 ? void 0 : _a.add('container-border');
|
|
612
|
+
var networkErrorToastTemplate = (0,_common_templatemanager_base_domManager__WEBPACK_IMPORTED_MODULE_2__.getHTML)(_common_templatemanager_base_aaContainer_aaContainer__WEBPACK_IMPORTED_MODULE_3__.NetworkErrorToast, {}, this);
|
|
613
|
+
// Add event listener for close button
|
|
614
|
+
(_b = this.eventManager) === null || _b === void 0 ? void 0 : _b.addEventListener(".".concat(_common_constants_projConsts__WEBPACK_IMPORTED_MODULE_9__.ClassMapConstanst.NETWORK_ERROR_CLOSE_BTN), 'click', function () {
|
|
615
|
+
_this.rootService.hideNetworkToastr(_this);
|
|
616
|
+
if (_this.timeoutId) {
|
|
617
|
+
clearTimeout(_this.timeoutId);
|
|
618
|
+
}
|
|
619
|
+
}, networkErrorToastTemplate);
|
|
620
|
+
// Emit event before adding to DOM
|
|
621
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.BEFORE_VIEW_INIT, networkErrorToastTemplate, {
|
|
622
|
+
event: _common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.SDK_EVENTS.NETWORK_ERROR_TOASTR,
|
|
623
|
+
data: {}
|
|
624
|
+
});
|
|
625
|
+
// Add to DOM
|
|
626
|
+
if (!container) {
|
|
627
|
+
throw new Error('Container not found');
|
|
628
|
+
}
|
|
629
|
+
container.appendChild(networkErrorToastTemplate);
|
|
630
|
+
return networkErrorToastTemplate;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
console.error('Error adding network error toast template:', error);
|
|
635
|
+
throw error;
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
AAWindow.prototype.receiveMessage = function (e) {
|
|
639
|
+
var _a;
|
|
640
|
+
if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.name) === 'agentAssist.internalTransfer') {
|
|
641
|
+
this.internalTransfer(e.data);
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
AAWindow.prototype.pauseTranscript = function () {
|
|
645
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.PAUSE_TRANSCRIPT, 'pause');
|
|
646
|
+
};
|
|
647
|
+
AAWindow.prototype.resumeTranscript = function () {
|
|
648
|
+
this.emit(_common_constants_events_cnst__WEBPACK_IMPORTED_MODULE_5__.INTERNAL_EVENTS.RESUME_TRANSCRIPT, 'resume');
|
|
649
|
+
};
|
|
650
|
+
return AAWindow;
|
|
651
|
+
}(_common_utils_EventEmiter__WEBPACK_IMPORTED_MODULE_1__.EventEmitter));
|
|
652
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AAWindow);
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
/***/ })
|
|
656
|
+
|
|
657
|
+
},
|
|
3
658
|
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
4
659
|
/******/ /* webpack/runtime/getFullHash */
|
|
5
660
|
/******/ (() => {
|
|
6
|
-
/******/ __webpack_require__.h = () => ("
|
|
661
|
+
/******/ __webpack_require__.h = () => ("a456ff1cd84a558f74e3")
|
|
7
662
|
/******/ })();
|
|
8
663
|
/******/
|
|
9
664
|
/******/ }
|