@microsoft/omnichannel-chat-sdk 1.9.7-main.b4583a2 → 1.9.8-main.605dd8a
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/lib/OmnichannelChatSDK.js +204 -201
- package/lib/OmnichannelChatSDK.js.map +1 -1
- package/lib/api/createVoiceVideoCalling.js +67 -54
- package/lib/api/createVoiceVideoCalling.js.map +1 -1
- package/lib/config/settings.d.ts +2 -1
- package/lib/config/settings.js +3 -1
- package/lib/config/settings.js.map +1 -1
- package/lib/core/ChatSDKError.js +1 -1
- package/lib/core/ChatSDKError.js.map +1 -1
- package/lib/core/messaging/ACSClient.js +38 -38
- package/lib/core/messaging/ACSClient.js.map +1 -1
- package/lib/core/messaging/OmnichannelMessage.js +2 -2
- package/lib/core/messaging/OmnichannelMessage.js.map +1 -1
- package/lib/external/ACSAdapter/AMSFileManager.d.ts +1 -1
- package/lib/external/ACSAdapter/AMSFileManager.js +19 -19
- package/lib/external/ACSAdapter/AMSFileManager.js.map +1 -1
- package/lib/external/ACSAdapter/AMSFileScanner.js +12 -13
- package/lib/external/ACSAdapter/AMSFileScanner.js.map +1 -1
- package/lib/external/ACSAdapter/activityUtils.d.ts +1 -1
- package/lib/external/ACSAdapter/activityUtils.js +10 -7
- package/lib/external/ACSAdapter/activityUtils.js.map +1 -1
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js.map +1 -1
- package/lib/external/ACSAdapter/createFileScanIngressMiddleware.js +3 -3
- package/lib/external/ACSAdapter/createFileScanIngressMiddleware.js.map +1 -1
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.js.map +1 -1
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.js.map +1 -1
- package/lib/external/IC3Adapter/Notification.d.ts +3 -3
- package/lib/telemetry/AriaTelemetry.js +16 -16
- package/lib/telemetry/AriaTelemetry.js.map +1 -1
- package/lib/telemetry/EUDomainNames.js +10 -10
- package/lib/telemetry/EUDomainNames.js.map +1 -1
- package/lib/telemetry/EventMarker.js +9 -6
- package/lib/telemetry/EventMarker.js.map +1 -1
- package/lib/telemetry/ScenarioMarker.js +5 -5
- package/lib/telemetry/ScenarioMarker.js.map +1 -1
- package/lib/telemetry/retrieveCollectorUri.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -7519
- package/lib/utils/AMSClientLoadStates.js +1 -1
- package/lib/utils/AMSClientLoadStates.js.map +1 -1
- package/lib/utils/CoreServicesUtils.js +27 -24
- package/lib/utils/CoreServicesUtils.js.map +1 -1
- package/lib/utils/WebUtils.js +23 -10
- package/lib/utils/WebUtils.js.map +1 -1
- package/lib/utils/chatAdapterCreators.js +17 -16
- package/lib/utils/chatAdapterCreators.js.map +1 -1
- package/lib/utils/createOcSDKConfiguration.js.map +1 -1
- package/lib/utils/createOmnichannelMessage.js.map +1 -1
- package/lib/utils/exceptionSuppressors.js +6 -4
- package/lib/utils/exceptionSuppressors.js.map +1 -1
- package/lib/utils/exceptionThrowers.js +68 -46
- package/lib/utils/exceptionThrowers.js.map +1 -1
- package/lib/utils/internalUtils.js +2 -1
- package/lib/utils/internalUtils.js.map +1 -1
- package/lib/utils/libraries.js +4 -4
- package/lib/utils/libraries.js.map +1 -1
- package/lib/utils/locale.js +4 -2
- package/lib/utils/locale.js.map +1 -1
- package/lib/utils/location.js +5 -4
- package/lib/utils/location.js.map +1 -1
- package/lib/utils/loggerUtils.d.ts +6 -6
- package/lib/utils/loggerUtils.js +10 -5
- package/lib/utils/loggerUtils.js.map +1 -1
- package/lib/utils/loggers.js +18 -12
- package/lib/utils/loggers.js.map +1 -1
- package/lib/utils/platform.js +6 -3
- package/lib/utils/platform.js.map +1 -1
- package/lib/utils/setOcUserAgent.d.ts +1 -1
- package/lib/utils/setOcUserAgent.js +11 -9
- package/lib/utils/setOcUserAgent.js.map +1 -1
- package/lib/utils/urlResolvers.js +1 -1
- package/lib/utils/urlResolvers.js.map +1 -1
- package/lib/utils/utilities.js +12 -7
- package/lib/utils/utilities.js.map +1 -1
- package/lib/validators/OmnichannelConfigValidator.js +2 -2
- package/lib/validators/OmnichannelConfigValidator.js.map +1 -1
- package/lib/validators/SDKConfigValidators.js.map +1 -1
- package/package.json +10 -8
@@ -21,12 +21,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
21
21
|
});
|
22
22
|
};
|
23
23
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
24
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
25
|
-
return g =
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
25
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
26
26
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
27
27
|
function step(op) {
|
28
28
|
if (f) throw new TypeError("Generator is already executing.");
|
29
|
-
while (_) try {
|
29
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
30
30
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
31
31
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
32
32
|
switch (op[0]) {
|
@@ -47,12 +47,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
47
47
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
48
48
|
}
|
49
49
|
};
|
50
|
-
var
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
51
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
52
|
+
if (ar || !(i in from)) {
|
53
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
54
|
+
ar[i] = from[i];
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
56
58
|
};
|
57
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
58
60
|
var loggers_1 = require("./utils/loggers");
|
@@ -101,10 +103,11 @@ var retrieveCollectorUri_1 = require("./telemetry/retrieveCollectorUri");
|
|
101
103
|
var setOcUserAgent_1 = require("./utils/setOcUserAgent");
|
102
104
|
var urlResolvers_1 = require("./utils/urlResolvers");
|
103
105
|
var OmnichannelConfigValidator_1 = require("./validators/OmnichannelConfigValidator");
|
106
|
+
var settings_1 = require("./config/settings");
|
104
107
|
var OmnichannelChatSDK = /** @class */ (function () {
|
105
108
|
function OmnichannelChatSDK(omnichannelConfig, chatSDKConfig) {
|
106
|
-
var _this = this;
|
107
109
|
if (chatSDKConfig === void 0) { chatSDKConfig = SDKConfigValidators_1.defaultChatSDKConfig; }
|
110
|
+
var _this = this;
|
108
111
|
var _a, _b, _c, _d, _e, _f, _g;
|
109
112
|
this.ACSClient = null;
|
110
113
|
this.AMSClient = null;
|
@@ -129,7 +132,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
129
132
|
this.refreshTokenTimer = null;
|
130
133
|
this.AMSClientLoadCurrentState = AMSClientLoadStates_1.AMSClientLoadStates.NOT_LOADED;
|
131
134
|
this.populateInitChatOptionalParam = function (requestOptionalParams, optionalParams, telemetryEvent) {
|
132
|
-
requestOptionalParams.initContext.locale = locale_1.getLocaleStringFromId(_this.localeId);
|
135
|
+
requestOptionalParams.initContext.locale = (0, locale_1.getLocaleStringFromId)(_this.localeId);
|
133
136
|
if (optionalParams === null || optionalParams === void 0 ? void 0 : optionalParams.customContext) {
|
134
137
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
135
138
|
var context = optionalParams === null || optionalParams === void 0 ? void 0 : optionalParams.customContext;
|
@@ -185,35 +188,35 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
185
188
|
return requestOptionalParams;
|
186
189
|
};
|
187
190
|
this.debug = false;
|
188
|
-
this.runtimeId = utilities_1.getRuntimeId((_b = (_a = chatSDKConfig === null || chatSDKConfig === void 0 ? void 0 : chatSDKConfig.telemetry) === null || _a === void 0 ? void 0 : _a.runtimeId) !== null && _b !== void 0 ? _b : null);
|
191
|
+
this.runtimeId = (0, utilities_1.getRuntimeId)((_b = (_a = chatSDKConfig === null || chatSDKConfig === void 0 ? void 0 : chatSDKConfig.telemetry) === null || _a === void 0 ? void 0 : _a.runtimeId) !== null && _b !== void 0 ? _b : null);
|
189
192
|
this.omnichannelConfig = omnichannelConfig;
|
190
193
|
this.chatSDKConfig = __assign(__assign({}, SDKConfigValidators_1.defaultChatSDKConfig), chatSDKConfig // overrides
|
191
194
|
);
|
192
195
|
this.isInitialized = false;
|
193
196
|
this.liveChatVersion = LiveChatVersion_1.default.V2;
|
194
197
|
this.localeId = locale_1.defaultLocaleId;
|
195
|
-
this.requestId = ocsdk_1.uuidv4();
|
198
|
+
this.requestId = (0, ocsdk_1.uuidv4)();
|
196
199
|
this.chatToken = {};
|
197
200
|
this.liveChatConfig = {};
|
198
201
|
this.dataMaskingRules = {};
|
199
202
|
this.authSettings = null;
|
200
203
|
this.preChatSurvey = null;
|
201
|
-
this.telemetry = createTelemetry_1.default(this.debug);
|
204
|
+
this.telemetry = (0, createTelemetry_1.default)(this.debug);
|
202
205
|
this.scenarioMarker = new ScenarioMarker_1.default(this.omnichannelConfig);
|
203
|
-
this.ic3ClientLogger = loggers_1.createIC3ClientLogger(this.omnichannelConfig);
|
204
|
-
this.ocSdkLogger = loggers_1.createOCSDKLogger(this.omnichannelConfig);
|
205
|
-
this.acsClientLogger = loggers_1.createACSClientLogger(this.omnichannelConfig);
|
206
|
-
this.acsAdapterLogger = loggers_1.createACSAdapterLogger(this.omnichannelConfig);
|
207
|
-
this.callingSdkLogger = loggers_1.createCallingSDKLogger(this.omnichannelConfig);
|
208
|
-
this.amsClientLogger = loggers_1.createAMSClientLogger(this.omnichannelConfig);
|
206
|
+
this.ic3ClientLogger = (0, loggers_1.createIC3ClientLogger)(this.omnichannelConfig);
|
207
|
+
this.ocSdkLogger = (0, loggers_1.createOCSDKLogger)(this.omnichannelConfig);
|
208
|
+
this.acsClientLogger = (0, loggers_1.createACSClientLogger)(this.omnichannelConfig);
|
209
|
+
this.acsAdapterLogger = (0, loggers_1.createACSAdapterLogger)(this.omnichannelConfig);
|
210
|
+
this.callingSdkLogger = (0, loggers_1.createCallingSDKLogger)(this.omnichannelConfig);
|
211
|
+
this.amsClientLogger = (0, loggers_1.createAMSClientLogger)(this.omnichannelConfig);
|
209
212
|
this.scenarioMarker.useTelemetry(this.telemetry);
|
210
213
|
loggerUtils_1.default.useTelemetry(this.telemetry, this.ocSdkLogger, this.acsClientLogger, this.acsAdapterLogger, this.callingSdkLogger, this.amsClientLogger, this.ic3ClientLogger);
|
211
214
|
this.scenarioMarker.setRuntimeId(this.runtimeId);
|
212
215
|
loggerUtils_1.default.setRuntimeId(this.runtimeId, this.ocSdkLogger, this.acsClientLogger, this.acsAdapterLogger, this.callingSdkLogger, this.amsClientLogger, this.ic3ClientLogger);
|
213
|
-
OmnichannelConfigValidator_1.default(omnichannelConfig);
|
214
|
-
SDKConfigValidators_1.default(chatSDKConfig);
|
216
|
+
(0, OmnichannelConfigValidator_1.default)(omnichannelConfig);
|
217
|
+
(0, SDKConfigValidators_1.default)(chatSDKConfig);
|
215
218
|
((_c = this.chatSDKConfig.telemetry) === null || _c === void 0 ? void 0 : _c.disable) && ((_d = this.telemetry) === null || _d === void 0 ? void 0 : _d.disable());
|
216
|
-
var collectorUri = retrieveCollectorUri_1.default(this.omnichannelConfig.orgUrl);
|
219
|
+
var collectorUri = (0, retrieveCollectorUri_1.default)(this.omnichannelConfig.orgUrl);
|
217
220
|
if ((_e = this.chatSDKConfig.telemetry) === null || _e === void 0 ? void 0 : _e.ariaCollectorUri) {
|
218
221
|
this.telemetry.setCollectorUri((_f = this.chatSDKConfig.telemetry) === null || _f === void 0 ? void 0 : _f.ariaCollectorUri);
|
219
222
|
}
|
@@ -249,7 +252,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
249
252
|
if (this.AMSClient) {
|
250
253
|
return [2 /*return*/, this.AMSClient];
|
251
254
|
}
|
252
|
-
return [4 /*yield*/, WebUtils_1.sleep(RETRY_DELAY_MS)];
|
255
|
+
return [4 /*yield*/, (0, WebUtils_1.sleep)(RETRY_DELAY_MS)];
|
253
256
|
case 2:
|
254
257
|
_a.sent();
|
255
258
|
retryCount++;
|
@@ -317,8 +320,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
317
320
|
this.ACSClient = new ACSClient_1.default(this.acsClientLogger);
|
318
321
|
this.AMSClientLoadCurrentState = AMSClientLoadStates_1.AMSClientLoadStates.LOADING;
|
319
322
|
_a = this;
|
320
|
-
return [4 /*yield*/, omnichannel_amsclient_1.default({
|
321
|
-
framedMode: platform_1.isBrowser(),
|
323
|
+
return [4 /*yield*/, (0, omnichannel_amsclient_1.default)({
|
324
|
+
framedMode: (0, platform_1.isBrowser)(),
|
322
325
|
multiClient: true,
|
323
326
|
debug: false,
|
324
327
|
logger: this.amsClientLogger
|
@@ -347,10 +350,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
347
350
|
});
|
348
351
|
});
|
349
352
|
};
|
350
|
-
OmnichannelChatSDK.prototype.parallelInitialization = function (
|
351
|
-
|
352
|
-
return __awaiter(this, void 0, void 0, function () {
|
353
|
+
OmnichannelChatSDK.prototype.parallelInitialization = function () {
|
354
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
353
355
|
var error_1;
|
356
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
354
357
|
return __generator(this, function (_a) {
|
355
358
|
switch (_a.label) {
|
356
359
|
case 0:
|
@@ -380,11 +383,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
380
383
|
});
|
381
384
|
};
|
382
385
|
// We will keep this logic for backward compatibility for customers with unknown implementation, so they can test before fully adoption
|
383
|
-
OmnichannelChatSDK.prototype.sequentialInitialization = function (
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
386
|
+
OmnichannelChatSDK.prototype.sequentialInitialization = function () {
|
387
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
388
|
+
var useCoreServices, _a, e_2, getLiveChatConfigOptionalParams, e_3, supportedLiveChatVersions, _b, _c, e_4;
|
389
|
+
var _d;
|
390
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
388
391
|
return __generator(this, function (_e) {
|
389
392
|
switch (_e.label) {
|
390
393
|
case 0:
|
@@ -394,16 +397,16 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
394
397
|
return [2 /*return*/, this.liveChatConfig];
|
395
398
|
}
|
396
399
|
this.useCoreServicesOrgUrlIfNotSet();
|
397
|
-
useCoreServices = CoreServicesUtils_1.isCoreServicesOrgUrl(this.omnichannelConfig.orgUrl);
|
400
|
+
useCoreServices = (0, CoreServicesUtils_1.isCoreServicesOrgUrl)(this.omnichannelConfig.orgUrl);
|
398
401
|
_e.label = 1;
|
399
402
|
case 1:
|
400
403
|
_e.trys.push([1, 3, , 4]);
|
401
404
|
this.OCSDKProvider = ocsdk_1.SDKProvider;
|
402
|
-
|
403
|
-
return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, createOcSDKConfiguration_1.default(useCoreServices), this.ocSdkLogger)];
|
405
|
+
_a = this;
|
406
|
+
return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, (0, createOcSDKConfiguration_1.default)(useCoreServices), this.ocSdkLogger)];
|
404
407
|
case 2:
|
405
|
-
|
406
|
-
setOcUserAgent_1.default(this.OCClient, (
|
408
|
+
_a.OCClient = _e.sent();
|
409
|
+
(0, setOcUserAgent_1.default)(this.OCClient, (_d = this.chatSDKConfig) === null || _d === void 0 ? void 0 : _d.ocUserAgent);
|
407
410
|
return [3 /*break*/, 4];
|
408
411
|
case 3:
|
409
412
|
e_2 = _e.sent();
|
@@ -430,23 +433,23 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
430
433
|
_e.trys.push([8, 13, , 14]);
|
431
434
|
if (!(this.liveChatVersion === LiveChatVersion_1.default.V2)) return [3 /*break*/, 10];
|
432
435
|
this.ACSClient = new ACSClient_1.default(this.acsClientLogger);
|
433
|
-
|
434
|
-
return [4 /*yield*/, omnichannel_amsclient_1.default({
|
435
|
-
framedMode: platform_1.isBrowser(),
|
436
|
+
_b = this;
|
437
|
+
return [4 /*yield*/, (0, omnichannel_amsclient_1.default)({
|
438
|
+
framedMode: (0, platform_1.isBrowser)(),
|
436
439
|
multiClient: true,
|
437
440
|
debug: false,
|
438
441
|
logger: this.amsClientLogger
|
439
442
|
})];
|
440
443
|
case 9:
|
441
|
-
|
444
|
+
_b.AMSClient = _e.sent();
|
442
445
|
this.AMSClientLoadCurrentState = AMSClientLoadStates_1.AMSClientLoadStates.LOADED;
|
443
446
|
return [3 /*break*/, 12];
|
444
447
|
case 10:
|
445
448
|
if (!(this.liveChatVersion === LiveChatVersion_1.default.V1)) return [3 /*break*/, 12];
|
446
|
-
|
449
|
+
_c = this;
|
447
450
|
return [4 /*yield*/, this.getIC3Client()];
|
448
451
|
case 11:
|
449
|
-
|
452
|
+
_c.IC3Client = _e.sent();
|
450
453
|
_e.label = 12;
|
451
454
|
case 12:
|
452
455
|
this.isInitialized = true;
|
@@ -468,10 +471,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
468
471
|
* @param parallel if true , it will run in parallel (fastest version) with components loaded in the background
|
469
472
|
* @returns livechatConfig
|
470
473
|
*/
|
471
|
-
OmnichannelChatSDK.prototype.initialize = function (
|
472
|
-
|
473
|
-
return __awaiter(this, void 0, void 0, function () {
|
474
|
+
OmnichannelChatSDK.prototype.initialize = function () {
|
475
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
474
476
|
var useParallelLoad;
|
477
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
475
478
|
return __generator(this, function (_a) {
|
476
479
|
switch (_a.label) {
|
477
480
|
case 0:
|
@@ -485,20 +488,20 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
485
488
|
});
|
486
489
|
});
|
487
490
|
};
|
488
|
-
OmnichannelChatSDK.prototype.loadChatConfig = function (
|
489
|
-
|
490
|
-
if (optionalParams === void 0) { optionalParams = {}; }
|
491
|
-
return __awaiter(this, void 0, void 0, function () {
|
491
|
+
OmnichannelChatSDK.prototype.loadChatConfig = function () {
|
492
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
492
493
|
var useCoreServices, getLiveChatConfigOptionalParams, e_5;
|
494
|
+
var _a;
|
495
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
493
496
|
return __generator(this, function (_b) {
|
494
497
|
switch (_b.label) {
|
495
498
|
case 0:
|
496
499
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.InitializeLoadChatConfig);
|
497
|
-
useCoreServices = CoreServicesUtils_1.isCoreServicesOrgUrl(this.omnichannelConfig.orgUrl);
|
500
|
+
useCoreServices = (0, CoreServicesUtils_1.isCoreServicesOrgUrl)(this.omnichannelConfig.orgUrl);
|
498
501
|
try {
|
499
502
|
this.OCSDKProvider = ocsdk_1.SDKProvider;
|
500
|
-
this.OCClient = ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, createOcSDKConfiguration_1.default(useCoreServices), this.ocSdkLogger);
|
501
|
-
setOcUserAgent_1.default(this.OCClient, (_a = this.chatSDKConfig) === null || _a === void 0 ? void 0 : _a.ocUserAgent);
|
503
|
+
this.OCClient = ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, (0, createOcSDKConfiguration_1.default)(useCoreServices), this.ocSdkLogger);
|
504
|
+
(0, setOcUserAgent_1.default)(this.OCClient, (_a = this.chatSDKConfig) === null || _a === void 0 ? void 0 : _a.ocUserAgent);
|
502
505
|
}
|
503
506
|
catch (e) {
|
504
507
|
exceptionThrowers_1.default.throwOmnichannelClientInitializationFailure(e, this.scenarioMarker, TelemetryEvent_1.default.InitializeLoadChatConfig);
|
@@ -563,21 +566,21 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
563
566
|
ChatId: this.chatToken.chatId,
|
564
567
|
ExceptionDetails: JSON.stringify(exceptionDetails)
|
565
568
|
};
|
566
|
-
if (utilities_1.isClientIdNotFoundErrorMessage(error_2)) {
|
569
|
+
if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_2)) {
|
567
570
|
exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_2, this.scenarioMarker, TelemetryEvent_1.default.GetChatReconnectContextWithAuthToken, telemetryData);
|
568
571
|
}
|
569
572
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetChatReconnectContextWithAuthToken, telemetryData);
|
570
|
-
console.error("OmnichannelChatSDK/GetChatReconnectContextWithAuthToken/error "
|
573
|
+
console.error("OmnichannelChatSDK/GetChatReconnectContextWithAuthToken/error ".concat(error_2));
|
571
574
|
return [3 /*break*/, 4];
|
572
575
|
case 4: return [2 /*return*/, context];
|
573
576
|
}
|
574
577
|
});
|
575
578
|
});
|
576
579
|
};
|
577
|
-
OmnichannelChatSDK.prototype.getChatReconnectContextWithReconnectId = function (
|
578
|
-
|
579
|
-
return __awaiter(this, void 0, void 0, function () {
|
580
|
+
OmnichannelChatSDK.prototype.getChatReconnectContextWithReconnectId = function () {
|
581
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
580
582
|
var context, reconnectAvailabilityResponse, error_3, exceptionDetails;
|
583
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
581
584
|
return __generator(this, function (_a) {
|
582
585
|
switch (_a.label) {
|
583
586
|
case 0:
|
@@ -620,7 +623,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
620
623
|
ChatId: this.chatToken.chatId,
|
621
624
|
ExceptionDetails: JSON.stringify(exceptionDetails)
|
622
625
|
});
|
623
|
-
console.error("OmnichannelChatSDK/GetChatReconnectContextWithReconnectId/error "
|
626
|
+
console.error("OmnichannelChatSDK/GetChatReconnectContextWithReconnectId/error ".concat(error_3));
|
624
627
|
return [3 /*break*/, 4];
|
625
628
|
case 4:
|
626
629
|
//here the context contains recconnectionId if valid, or redirectionURL if not valid
|
@@ -629,10 +632,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
629
632
|
});
|
630
633
|
});
|
631
634
|
};
|
632
|
-
OmnichannelChatSDK.prototype.getChatReconnectContext = function (
|
633
|
-
|
634
|
-
return __awaiter(this, void 0, void 0, function () {
|
635
|
+
OmnichannelChatSDK.prototype.getChatReconnectContext = function () {
|
636
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
635
637
|
var context;
|
638
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
636
639
|
return __generator(this, function (_a) {
|
637
640
|
switch (_a.label) {
|
638
641
|
case 0:
|
@@ -667,12 +670,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
667
670
|
});
|
668
671
|
});
|
669
672
|
};
|
670
|
-
OmnichannelChatSDK.prototype.startChat = function (
|
671
|
-
|
672
|
-
|
673
|
-
return __awaiter(this, void 0, void 0, function () {
|
674
|
-
var shouldReinitIC3Client, _j, reconnectableChatsParams, reconnectableChatsResponse, e_6, telemetryData, conversationDetails, telemetryData, telemetryData, e_7, telemetryData, sessionInitOptionalParams, location_2, sessionInitPromise, messagingClientPromise, attachmentClientPromise;
|
673
|
+
OmnichannelChatSDK.prototype.startChat = function () {
|
674
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
675
|
+
var shouldReinitIC3Client, _a, reconnectableChatsParams, reconnectableChatsResponse, e_6, telemetryData, conversationDetails, telemetryData, telemetryData, e_7, telemetryData, sessionInitOptionalParams, location_2, sessionInitPromise, messagingClientPromise, attachmentClientPromise;
|
675
676
|
var _this = this;
|
677
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
678
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
676
679
|
return __generator(this, function (_k) {
|
677
680
|
switch (_k.label) {
|
678
681
|
case 0:
|
@@ -684,16 +687,16 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
684
687
|
}
|
685
688
|
shouldReinitIC3Client = !platform_1.default.isNode() && !platform_1.default.isReactNative() && !this.IC3Client && this.liveChatVersion === LiveChatVersion_1.default.V1;
|
686
689
|
if (!shouldReinitIC3Client) return [3 /*break*/, 2];
|
687
|
-
|
690
|
+
_a = this;
|
688
691
|
return [4 /*yield*/, this.getIC3Client()];
|
689
692
|
case 1:
|
690
|
-
|
693
|
+
_a.IC3Client = _k.sent();
|
691
694
|
_k.label = 2;
|
692
695
|
case 2:
|
693
|
-
if (this.isChatReconnect && !((
|
696
|
+
if (this.isChatReconnect && !((_b = this.chatSDKConfig.chatReconnect) === null || _b === void 0 ? void 0 : _b.disable) && !this.isPersistentChat && optionalParams.reconnectId) {
|
694
697
|
this.reconnectId = optionalParams.reconnectId;
|
695
698
|
}
|
696
|
-
if (!(this.isPersistentChat && !((
|
699
|
+
if (!(this.isPersistentChat && !((_c = this.chatSDKConfig.persistentChat) === null || _c === void 0 ? void 0 : _c.disable))) return [3 /*break*/, 6];
|
697
700
|
_k.label = 3;
|
698
701
|
case 3:
|
699
702
|
_k.trys.push([3, 5, , 6]);
|
@@ -718,7 +721,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
718
721
|
case 6:
|
719
722
|
if (!(optionalParams.liveChatContext && Object.keys(optionalParams.liveChatContext).length > 0 && !this.reconnectId)) return [3 /*break*/, 8];
|
720
723
|
this.chatToken = optionalParams.liveChatContext.chatToken || {};
|
721
|
-
this.requestId = optionalParams.liveChatContext.requestId || ocsdk_1.uuidv4();
|
724
|
+
this.requestId = optionalParams.liveChatContext.requestId || (0, ocsdk_1.uuidv4)();
|
722
725
|
this.sessionId = optionalParams.liveChatContext.sessionId || null;
|
723
726
|
return [4 /*yield*/, this.getConversationDetails()];
|
724
727
|
case 7:
|
@@ -731,7 +734,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
731
734
|
exceptionThrowers_1.default.throwInvalidConversation(this.scenarioMarker, TelemetryEvent_1.default.StartChat, telemetryData);
|
732
735
|
}
|
733
736
|
if (conversationDetails.state === LiveWorkItemState_1.default.WrapUp || conversationDetails.state === LiveWorkItemState_1.default.Closed) {
|
734
|
-
console.error("Unable to join conversation that's in '"
|
737
|
+
console.error("Unable to join conversation that's in '".concat(conversationDetails.state, "' state"));
|
735
738
|
telemetryData = {
|
736
739
|
RequestId: this.requestId,
|
737
740
|
ChatId: this.chatToken.chatId,
|
@@ -749,7 +752,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
749
752
|
case 10:
|
750
753
|
if (!(optionalParams.liveChatContext && Object.keys(optionalParams.liveChatContext).length > 0)) return [3 /*break*/, 14];
|
751
754
|
this.chatToken = optionalParams.liveChatContext.chatToken || {};
|
752
|
-
this.requestId = optionalParams.liveChatContext.requestId || ocsdk_1.uuidv4();
|
755
|
+
this.requestId = optionalParams.liveChatContext.requestId || (0, ocsdk_1.uuidv4)();
|
753
756
|
_k.label = 11;
|
754
757
|
case 11:
|
755
758
|
_k.trys.push([11, 13, , 14]);
|
@@ -781,14 +784,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
781
784
|
};
|
782
785
|
sessionInitOptionalParams = this.populateInitChatOptionalParam(sessionInitOptionalParams, optionalParams, TelemetryEvent_1.default.StartChat);
|
783
786
|
sessionInitOptionalParams.initContext.isProactiveChat = !!optionalParams.isProactiveChat;
|
784
|
-
if (this.isPersistentChat && !((
|
787
|
+
if (this.isPersistentChat && !((_d = this.chatSDKConfig.persistentChat) === null || _d === void 0 ? void 0 : _d.disable)) {
|
785
788
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
786
789
|
}
|
787
|
-
else if (this.isChatReconnect && !((
|
790
|
+
else if (this.isChatReconnect && !((_e = this.chatSDKConfig.chatReconnect) === null || _e === void 0 ? void 0 : _e.disable) && !this.isPersistentChat) {
|
788
791
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
789
792
|
}
|
790
|
-
if (!(parsers_1.parseLowerCaseString((
|
791
|
-
return [4 /*yield*/, location_1.getLocationInfo(this.scenarioMarker, this.chatToken.chatId, this.requestId)];
|
793
|
+
if (!((0, parsers_1.parseLowerCaseString)((_g = (_f = this.liveChatConfig) === null || _f === void 0 ? void 0 : _f.LiveWSAndLiveChatEngJoin) === null || _g === void 0 ? void 0 : _g.msdyn_requestvisitorlocation) === "true")) return [3 /*break*/, 18];
|
794
|
+
return [4 /*yield*/, (0, location_1.getLocationInfo)(this.scenarioMarker, this.chatToken.chatId, this.requestId)];
|
792
795
|
case 17:
|
793
796
|
location_2 = _k.sent();
|
794
797
|
sessionInitOptionalParams.initContext.latitude = location_2.latitude;
|
@@ -797,26 +800,26 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
797
800
|
case 18:
|
798
801
|
sessionInitPromise = function () { return __awaiter(_this, void 0, void 0, function () {
|
799
802
|
var error_4, telemetryData;
|
800
|
-
var _a, _b, _c
|
801
|
-
return __generator(this, function (
|
802
|
-
switch (
|
803
|
+
var _a, _b, _c;
|
804
|
+
return __generator(this, function (_d) {
|
805
|
+
switch (_d.label) {
|
803
806
|
case 0:
|
804
807
|
if (!!optionalParams.liveChatContext) return [3 /*break*/, 4];
|
805
|
-
|
808
|
+
_d.label = 1;
|
806
809
|
case 1:
|
807
|
-
|
810
|
+
_d.trys.push([1, 3, , 4]);
|
808
811
|
return [4 /*yield*/, this.OCClient.sessionInit(this.requestId, sessionInitOptionalParams)];
|
809
812
|
case 2:
|
810
|
-
|
813
|
+
_d.sent();
|
811
814
|
return [3 /*break*/, 4];
|
812
815
|
case 3:
|
813
|
-
error_4 =
|
816
|
+
error_4 = _d.sent();
|
814
817
|
telemetryData = {
|
815
818
|
RequestId: this.requestId,
|
816
819
|
ChatId: this.chatToken.chatId,
|
817
820
|
};
|
818
821
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
819
|
-
if ((
|
822
|
+
if ((error_4 === null || error_4 === void 0 ? void 0 : error_4.isAxiosError) && ((_c = (_b = (_a = error_4.response) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.errorcode) === null || _c === void 0 ? void 0 : _c.toString()) === OmnichannelErrorCodes_1.default.WidgetUseOutsideOperatingHour.toString()) {
|
820
823
|
exceptionThrowers_1.default.throwWidgetUseOutsideOperatingHour(error_4, this.scenarioMarker, TelemetryEvent_1.default.StartChat, telemetryData);
|
821
824
|
}
|
822
825
|
exceptionThrowers_1.default.throwConversationInitializationFailure(error_4, this.scenarioMarker, TelemetryEvent_1.default.StartChat, telemetryData);
|
@@ -952,7 +955,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
952
955
|
return [4 /*yield*/, Promise.all([sessionInitPromise(), messagingClientPromise(), attachmentClientPromise()])];
|
953
956
|
case 19:
|
954
957
|
_k.sent();
|
955
|
-
if (this.isPersistentChat && !((
|
958
|
+
if (this.isPersistentChat && !((_h = this.chatSDKConfig.persistentChat) === null || _h === void 0 ? void 0 : _h.disable)) {
|
956
959
|
this.refreshTokenTimer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
957
960
|
return __generator(this, function (_a) {
|
958
961
|
switch (_a.label) {
|
@@ -963,7 +966,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
963
966
|
return [2 /*return*/];
|
964
967
|
}
|
965
968
|
});
|
966
|
-
}); }, (
|
969
|
+
}); }, (_j = this.chatSDKConfig.persistentChat) === null || _j === void 0 ? void 0 : _j.tokenUpdateTime);
|
967
970
|
}
|
968
971
|
return [2 /*return*/];
|
969
972
|
}
|
@@ -971,9 +974,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
971
974
|
});
|
972
975
|
};
|
973
976
|
OmnichannelChatSDK.prototype.endChat = function () {
|
974
|
-
var _a, _b, _c;
|
975
977
|
return __awaiter(this, void 0, void 0, function () {
|
976
978
|
var sessionCloseOptionalParams, isReconnectChat, isChatReconnect, error_10, telemetryData;
|
979
|
+
var _a, _b, _c;
|
977
980
|
return __generator(this, function (_d) {
|
978
981
|
switch (_d.label) {
|
979
982
|
case 0:
|
@@ -1007,12 +1010,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1007
1010
|
});
|
1008
1011
|
(_c = this.conversation) === null || _c === void 0 ? void 0 : _c.disconnect();
|
1009
1012
|
this.conversation = null;
|
1010
|
-
this.requestId = ocsdk_1.uuidv4();
|
1013
|
+
this.requestId = (0, ocsdk_1.uuidv4)();
|
1011
1014
|
this.chatToken = {};
|
1012
1015
|
this.reconnectId = null;
|
1013
1016
|
if (this.IC3Client) {
|
1014
1017
|
this.IC3Client.dispose();
|
1015
|
-
!platform_1.default.isNode() && !platform_1.default.isReactNative() && WebUtils_1.removeElementById(this.IC3Client.id);
|
1018
|
+
!platform_1.default.isNode() && !platform_1.default.isReactNative() && (0, WebUtils_1.removeElementById)(this.IC3Client.id);
|
1016
1019
|
this.IC3Client = null;
|
1017
1020
|
}
|
1018
1021
|
if (this.OCClient.sessionId) {
|
@@ -1075,11 +1078,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1075
1078
|
});
|
1076
1079
|
});
|
1077
1080
|
};
|
1078
|
-
OmnichannelChatSDK.prototype.getConversationDetails = function (
|
1079
|
-
|
1080
|
-
if (optionalParams === void 0) { optionalParams = {}; }
|
1081
|
-
return __awaiter(this, void 0, void 0, function () {
|
1081
|
+
OmnichannelChatSDK.prototype.getConversationDetails = function () {
|
1082
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
1082
1083
|
var requestId, chatToken, chatId, reconnectId, sessionId, getLWIDetailsOptionalParams, lwiDetails, state, conversationId, agentAcceptedOn, canRenderPostChat, participantType, liveWorkItemDetails, error_11, telemetryData;
|
1084
|
+
var _a, _b, _c, _d;
|
1085
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
1083
1086
|
return __generator(this, function (_e) {
|
1084
1087
|
switch (_e.label) {
|
1085
1088
|
case 0:
|
@@ -1148,7 +1151,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1148
1151
|
RequestId: requestId,
|
1149
1152
|
ChatId: chatId || ''
|
1150
1153
|
};
|
1151
|
-
if (utilities_1.isClientIdNotFoundErrorMessage(error_11)) {
|
1154
|
+
if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_11)) {
|
1152
1155
|
exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_11, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
|
1153
1156
|
}
|
1154
1157
|
exceptionSuppressors_1.default.suppressConversationDetailsRetrievalFailure(error_11, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
|
@@ -1162,10 +1165,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1162
1165
|
* Gets PreChat Survey.
|
1163
1166
|
* @param parse Whether to parse PreChatSurvey to JSON or not.
|
1164
1167
|
*/
|
1165
|
-
OmnichannelChatSDK.prototype.getPreChatSurvey = function (
|
1166
|
-
|
1167
|
-
return __awaiter(this, void 0, void 0, function () {
|
1168
|
+
OmnichannelChatSDK.prototype.getPreChatSurvey = function () {
|
1169
|
+
return __awaiter(this, arguments, void 0, function (parse) {
|
1168
1170
|
var result;
|
1171
|
+
if (parse === void 0) { parse = true; }
|
1169
1172
|
return __generator(this, function (_a) {
|
1170
1173
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.GetPreChatSurvey);
|
1171
1174
|
try {
|
@@ -1190,11 +1193,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1190
1193
|
});
|
1191
1194
|
});
|
1192
1195
|
};
|
1193
|
-
OmnichannelChatSDK.prototype.getChatToken = function (
|
1194
|
-
|
1195
|
-
if (cached === void 0) { cached = true; }
|
1196
|
-
return __awaiter(this, void 0, void 0, function () {
|
1196
|
+
OmnichannelChatSDK.prototype.getChatToken = function () {
|
1197
|
+
return __awaiter(this, arguments, void 0, function (cached, optionalParams) {
|
1197
1198
|
var getChatTokenOptionalParams, chatToken, chatId, token, regionGtms, expiresIn, visitorId, voiceVideoCallToken, acsEndpoint, attachmentConfiguration, error_12, telemetryData;
|
1199
|
+
var _a, _b, _c;
|
1200
|
+
if (cached === void 0) { cached = true; }
|
1198
1201
|
return __generator(this, function (_d) {
|
1199
1202
|
switch (_d.label) {
|
1200
1203
|
case 0:
|
@@ -1249,7 +1252,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1249
1252
|
RequestId: this.requestId,
|
1250
1253
|
ChatId: (_c = this.chatToken) === null || _c === void 0 ? void 0 : _c.chatId,
|
1251
1254
|
};
|
1252
|
-
if (utilities_1.isClientIdNotFoundErrorMessage(error_12)) {
|
1255
|
+
if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_12)) {
|
1253
1256
|
exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_12, this.scenarioMarker, TelemetryEvent_1.default.GetChatToken, telemetryData);
|
1254
1257
|
}
|
1255
1258
|
else {
|
@@ -1289,9 +1292,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1289
1292
|
});
|
1290
1293
|
};
|
1291
1294
|
OmnichannelChatSDK.prototype.getMessages = function () {
|
1292
|
-
var _a;
|
1293
1295
|
return __awaiter(this, void 0, void 0, function () {
|
1294
|
-
var messages,
|
1296
|
+
var messages, _a;
|
1297
|
+
var _b;
|
1295
1298
|
return __generator(this, function (_c) {
|
1296
1299
|
switch (_c.label) {
|
1297
1300
|
case 0:
|
@@ -1302,7 +1305,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1302
1305
|
_c.label = 1;
|
1303
1306
|
case 1:
|
1304
1307
|
_c.trys.push([1, 3, , 4]);
|
1305
|
-
return [4 /*yield*/, ((
|
1308
|
+
return [4 /*yield*/, ((_b = this.conversation) === null || _b === void 0 ? void 0 : _b.getMessages())];
|
1306
1309
|
case 2:
|
1307
1310
|
messages = _c.sent();
|
1308
1311
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.GetMessages, {
|
@@ -1311,7 +1314,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1311
1314
|
});
|
1312
1315
|
return [2 /*return*/, messages];
|
1313
1316
|
case 3:
|
1314
|
-
|
1317
|
+
_a = _c.sent();
|
1315
1318
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetMessages, {
|
1316
1319
|
RequestId: this.requestId,
|
1317
1320
|
ChatId: this.chatToken.chatId
|
@@ -1330,9 +1333,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1330
1333
|
});
|
1331
1334
|
};
|
1332
1335
|
OmnichannelChatSDK.prototype.sendMessage = function (message) {
|
1333
|
-
var _a;
|
1334
1336
|
return __awaiter(this, void 0, void 0, function () {
|
1335
|
-
var
|
1337
|
+
var _a, disable, maskingCharacter, content, _i, _b, maskingRule, regex, match, replaceStr, sendMessageRequest, error_13, messageToSend, _c;
|
1338
|
+
var _d;
|
1336
1339
|
return __generator(this, function (_e) {
|
1337
1340
|
switch (_e.label) {
|
1338
1341
|
case 0:
|
@@ -1340,11 +1343,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1340
1343
|
RequestId: this.requestId,
|
1341
1344
|
ChatId: this.chatToken.chatId
|
1342
1345
|
});
|
1343
|
-
|
1346
|
+
_a = this.chatSDKConfig.dataMasking, disable = _a.disable, maskingCharacter = _a.maskingCharacter;
|
1344
1347
|
content = message.content;
|
1345
1348
|
if (Object.keys(this.dataMaskingRules).length > 0 && !disable) {
|
1346
|
-
for (_i = 0,
|
1347
|
-
maskingRule =
|
1349
|
+
for (_i = 0, _b = Object.values(this.dataMaskingRules); _i < _b.length; _i++) {
|
1350
|
+
maskingRule = _b[_i];
|
1348
1351
|
regex = new RegExp(maskingRule, 'g');
|
1349
1352
|
match = void 0;
|
1350
1353
|
while (match = regex.exec(content)) { // eslint-disable-line no-cond-assign
|
@@ -1368,7 +1371,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1368
1371
|
_e.label = 1;
|
1369
1372
|
case 1:
|
1370
1373
|
_e.trys.push([1, 3, , 4]);
|
1371
|
-
return [4 /*yield*/, ((
|
1374
|
+
return [4 /*yield*/, ((_d = this.conversation) === null || _d === void 0 ? void 0 : _d.sendMessage(sendMessageRequest))];
|
1372
1375
|
case 2:
|
1373
1376
|
_e.sent();
|
1374
1377
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.SendMessages, {
|
@@ -1392,7 +1395,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1392
1395
|
deliveryMode: DeliveryMode_1.default.Bridged,
|
1393
1396
|
messageType: MessageType_1.default.UserMessage,
|
1394
1397
|
properties: undefined,
|
1395
|
-
tags:
|
1398
|
+
tags: __spreadArray([], MessageTags_1.defaultMessageTags, true),
|
1396
1399
|
sender: {
|
1397
1400
|
displayName: "Customer",
|
1398
1401
|
id: "customer",
|
@@ -1417,7 +1420,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1417
1420
|
});
|
1418
1421
|
return [3 /*break*/, 9];
|
1419
1422
|
case 8:
|
1420
|
-
|
1423
|
+
_c = _e.sent();
|
1421
1424
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.SendMessages, {
|
1422
1425
|
RequestId: this.requestId,
|
1423
1426
|
ChatId: this.chatToken.chatId
|
@@ -1428,12 +1431,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1428
1431
|
});
|
1429
1432
|
});
|
1430
1433
|
};
|
1431
|
-
OmnichannelChatSDK.prototype.onNewMessage = function (
|
1432
|
-
|
1433
|
-
|
1434
|
-
return __awaiter(this, void 0, void 0, function () {
|
1435
|
-
var postedMessages_1, messages, _i, _c, message, id, postedMessages_2, messages, _d, _e, message, clientmessageid, omnichannelMessage;
|
1434
|
+
OmnichannelChatSDK.prototype.onNewMessage = function (onNewMessageCallback_1) {
|
1435
|
+
return __awaiter(this, arguments, void 0, function (onNewMessageCallback, optionalParams) {
|
1436
|
+
var postedMessages_1, messages, _i, _a, message, id, postedMessages_2, messages, _b, _c, message, clientmessageid, omnichannelMessage;
|
1436
1437
|
var _this = this;
|
1438
|
+
var _d, _e;
|
1439
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
1437
1440
|
return __generator(this, function (_f) {
|
1438
1441
|
switch (_f.label) {
|
1439
1442
|
case 0:
|
@@ -1448,8 +1451,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1448
1451
|
return [4 /*yield*/, this.getMessages()];
|
1449
1452
|
case 1:
|
1450
1453
|
messages = _f.sent();
|
1451
|
-
for (_i = 0,
|
1452
|
-
message =
|
1454
|
+
for (_i = 0, _a = messages.reverse(); _i < _a.length; _i++) {
|
1455
|
+
message = _a[_i];
|
1453
1456
|
id = message.id;
|
1454
1457
|
if (postedMessages_1.has(id)) {
|
1455
1458
|
continue;
|
@@ -1460,9 +1463,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1460
1463
|
_f.label = 2;
|
1461
1464
|
case 2:
|
1462
1465
|
try {
|
1463
|
-
(
|
1466
|
+
(_d = this.conversation) === null || _d === void 0 ? void 0 : _d.registerOnNewMessage(function (event) {
|
1464
1467
|
var id = event.id;
|
1465
|
-
var omnichannelMessage = createOmnichannelMessage_1.default(event, {
|
1468
|
+
var omnichannelMessage = (0, createOmnichannelMessage_1.default)(event, {
|
1466
1469
|
liveChatVersion: _this.liveChatVersion,
|
1467
1470
|
debug: _this.debug
|
1468
1471
|
});
|
@@ -1491,14 +1494,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1491
1494
|
case 4:
|
1492
1495
|
messages = _f.sent();
|
1493
1496
|
if (messages) {
|
1494
|
-
for (
|
1495
|
-
message =
|
1497
|
+
for (_b = 0, _c = messages.reverse(); _b < _c.length; _b++) {
|
1498
|
+
message = _c[_b];
|
1496
1499
|
clientmessageid = message.clientmessageid;
|
1497
1500
|
if (postedMessages_2.has(clientmessageid)) {
|
1498
1501
|
continue;
|
1499
1502
|
}
|
1500
1503
|
postedMessages_2.add(clientmessageid);
|
1501
|
-
omnichannelMessage = createOmnichannelMessage_1.default(message, {
|
1504
|
+
omnichannelMessage = (0, createOmnichannelMessage_1.default)(message, {
|
1502
1505
|
liveChatVersion: this.liveChatVersion,
|
1503
1506
|
debug: this.debug
|
1504
1507
|
});
|
@@ -1508,10 +1511,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1508
1511
|
_f.label = 5;
|
1509
1512
|
case 5:
|
1510
1513
|
try {
|
1511
|
-
(
|
1514
|
+
(_e = this.conversation) === null || _e === void 0 ? void 0 : _e.registerOnNewMessage(function (message) {
|
1512
1515
|
var clientmessageid = message.clientmessageid, messageType = message.messageType;
|
1513
1516
|
// Filter out customer messages
|
1514
|
-
if (utilities_1.isCustomerMessage(message)) {
|
1517
|
+
if ((0, utilities_1.isCustomerMessage)(message)) {
|
1515
1518
|
return;
|
1516
1519
|
}
|
1517
1520
|
// Skip duplicates
|
@@ -1519,7 +1522,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1519
1522
|
return;
|
1520
1523
|
}
|
1521
1524
|
if (messageType !== MessageType_1.default.Typing) {
|
1522
|
-
var omnichannelMessage = createOmnichannelMessage_1.default(message, {
|
1525
|
+
var omnichannelMessage = (0, createOmnichannelMessage_1.default)(message, {
|
1523
1526
|
liveChatVersion: _this.liveChatVersion,
|
1524
1527
|
debug: _this.debug
|
1525
1528
|
});
|
@@ -1611,8 +1614,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1611
1614
|
});
|
1612
1615
|
};
|
1613
1616
|
OmnichannelChatSDK.prototype.onTypingEvent = function (onTypingEventCallback) {
|
1614
|
-
var _a;
|
1615
1617
|
return __awaiter(this, void 0, void 0, function () {
|
1618
|
+
var _a;
|
1616
1619
|
return __generator(this, function (_b) {
|
1617
1620
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.OnTypingEvent, {
|
1618
1621
|
RequestId: this.requestId,
|
@@ -1638,7 +1641,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1638
1641
|
(_a = this.conversation) === null || _a === void 0 ? void 0 : _a.registerOnNewMessage(function (message) {
|
1639
1642
|
var messageType = message.messageType;
|
1640
1643
|
// Filter out customer messages
|
1641
|
-
if (utilities_1.isCustomerMessage(message)) {
|
1644
|
+
if ((0, utilities_1.isCustomerMessage)(message)) {
|
1642
1645
|
return;
|
1643
1646
|
}
|
1644
1647
|
if (messageType === MessageType_1.default.Typing) {
|
@@ -1662,9 +1665,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1662
1665
|
});
|
1663
1666
|
};
|
1664
1667
|
OmnichannelChatSDK.prototype.onAgentEndSession = function (onAgentEndSessionCallback) {
|
1665
|
-
var _a;
|
1666
1668
|
return __awaiter(this, void 0, void 0, function () {
|
1667
1669
|
var _this = this;
|
1670
|
+
var _a;
|
1668
1671
|
return __generator(this, function (_b) {
|
1669
1672
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.OnAgentEndSession, {
|
1670
1673
|
RequestId: this.requestId,
|
@@ -1717,9 +1720,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1717
1720
|
});
|
1718
1721
|
};
|
1719
1722
|
OmnichannelChatSDK.prototype.uploadFileAttachment = function (fileInfo) {
|
1720
|
-
var _a, _b;
|
1721
1723
|
return __awaiter(this, void 0, void 0, function () {
|
1722
1724
|
var amsClient, createObjectResponse, documentId, uploadDocumentResponse, fileIdsProperty, fileMetaProperty, sendMessageRequest, messageToSend, error_16, fileMetadata, messageToSend, error_17;
|
1725
|
+
var _a, _b;
|
1723
1726
|
return __generator(this, function (_c) {
|
1724
1727
|
switch (_c.label) {
|
1725
1728
|
case 0: return [4 /*yield*/, this.getAMSClient()];
|
@@ -1757,7 +1760,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1757
1760
|
contentType: MessageContentType_1.default.Text,
|
1758
1761
|
deliveryMode: DeliveryMode_1.default.Bridged,
|
1759
1762
|
messageType: MessageType_1.default.UserMessage,
|
1760
|
-
tags:
|
1763
|
+
tags: __spreadArray([], MessageTags_1.defaultMessageTags, true),
|
1761
1764
|
sender: {
|
1762
1765
|
displayName: "Customer",
|
1763
1766
|
id: "customer",
|
@@ -1803,7 +1806,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1803
1806
|
contentType: MessageContentType_1.default.Text,
|
1804
1807
|
deliveryMode: DeliveryMode_1.default.Bridged,
|
1805
1808
|
messageType: MessageType_1.default.UserMessage,
|
1806
|
-
tags:
|
1809
|
+
tags: __spreadArray([], MessageTags_1.defaultMessageTags, true),
|
1807
1810
|
sender: {
|
1808
1811
|
displayName: "Customer",
|
1809
1812
|
id: "customer",
|
@@ -1824,7 +1827,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1824
1827
|
return [2 /*return*/, messageToSend];
|
1825
1828
|
case 15:
|
1826
1829
|
error_17 = _c.sent();
|
1827
|
-
console.error("OmnichannelChatSDK/uploadFileAttachment/error: "
|
1830
|
+
console.error("OmnichannelChatSDK/uploadFileAttachment/error: ".concat(error_17));
|
1828
1831
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.UploadFileAttachment, {
|
1829
1832
|
RequestId: this.requestId,
|
1830
1833
|
ChatId: this.chatToken.chatId
|
@@ -1883,7 +1886,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1883
1886
|
return [2 /*return*/, downloadedFile];
|
1884
1887
|
case 9:
|
1885
1888
|
error_18 = _b.sent();
|
1886
|
-
console.error("OmnichannelChatSDK/downloadFileAttachment/error: "
|
1889
|
+
console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(error_18));
|
1887
1890
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
|
1888
1891
|
RequestId: this.requestId,
|
1889
1892
|
ChatId: this.chatToken.chatId
|
@@ -1894,11 +1897,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1894
1897
|
});
|
1895
1898
|
});
|
1896
1899
|
};
|
1897
|
-
OmnichannelChatSDK.prototype.emailLiveChatTranscript = function (
|
1898
|
-
|
1899
|
-
if (optionalParams === void 0) { optionalParams = {}; }
|
1900
|
-
return __awaiter(this, void 0, void 0, function () {
|
1900
|
+
OmnichannelChatSDK.prototype.emailLiveChatTranscript = function (body_1) {
|
1901
|
+
return __awaiter(this, arguments, void 0, function (body, optionalParams) {
|
1901
1902
|
var emailTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, emailRequestBody, emailResponse, error_19;
|
1903
|
+
var _a;
|
1904
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
1902
1905
|
return __generator(this, function (_b) {
|
1903
1906
|
switch (_b.label) {
|
1904
1907
|
case 0:
|
@@ -1930,7 +1933,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1930
1933
|
ChatId: chatId,
|
1931
1934
|
EmailAddress: body.emailAddress,
|
1932
1935
|
DefaultAttachmentMessage: body.attachmentMessage,
|
1933
|
-
CustomerLocale: body.locale || locale_1.getLocaleStringFromId(this.localeId)
|
1936
|
+
CustomerLocale: body.locale || (0, locale_1.getLocaleStringFromId)(this.localeId)
|
1934
1937
|
};
|
1935
1938
|
return [4 /*yield*/, this.OCClient.emailTranscript(requestId, chatToken.token, emailRequestBody, emailTranscriptOptionalParams)];
|
1936
1939
|
case 2:
|
@@ -1945,7 +1948,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1945
1948
|
return [2 /*return*/, emailResponse];
|
1946
1949
|
case 3:
|
1947
1950
|
error_19 = _b.sent();
|
1948
|
-
console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: "
|
1951
|
+
console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: ".concat(error_19));
|
1949
1952
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.EmailLiveChatTranscript, {
|
1950
1953
|
RequestId: requestId,
|
1951
1954
|
ChatId: chatId
|
@@ -1956,11 +1959,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1956
1959
|
});
|
1957
1960
|
});
|
1958
1961
|
};
|
1959
|
-
OmnichannelChatSDK.prototype.getLiveChatTranscript = function (
|
1960
|
-
|
1961
|
-
if (optionalParams === void 0) { optionalParams = {}; }
|
1962
|
-
return __awaiter(this, void 0, void 0, function () {
|
1962
|
+
OmnichannelChatSDK.prototype.getLiveChatTranscript = function () {
|
1963
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
1963
1964
|
var getChatTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, transcriptResponse, error_20, telemetryData;
|
1965
|
+
var _a;
|
1966
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
1964
1967
|
return __generator(this, function (_b) {
|
1965
1968
|
switch (_b.label) {
|
1966
1969
|
case 0:
|
@@ -2012,11 +2015,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2012
2015
|
});
|
2013
2016
|
});
|
2014
2017
|
};
|
2015
|
-
OmnichannelChatSDK.prototype.createChatAdapter = function (
|
2016
|
-
|
2017
|
-
if (optionalParams === void 0) { optionalParams = {}; }
|
2018
|
-
return __awaiter(this, void 0, void 0, function () {
|
2018
|
+
OmnichannelChatSDK.prototype.createChatAdapter = function () {
|
2019
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
2019
2020
|
var protocol, supportedChatAdapterProtocols, options, fileManager;
|
2021
|
+
var _a, _b;
|
2022
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
2020
2023
|
return __generator(this, function (_c) {
|
2021
2024
|
if (platform_1.default.isNode() || platform_1.default.isReactNative()) {
|
2022
2025
|
return [2 /*return*/, Promise.reject('ChatAdapter is only supported on browser')];
|
@@ -2024,33 +2027,33 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2024
2027
|
protocol = optionalParams.protocol;
|
2025
2028
|
supportedChatAdapterProtocols = [ChatAdapterProtocols_1.default.ACS, ChatAdapterProtocols_1.default.IC3, ChatAdapterProtocols_1.default.DirectLine];
|
2026
2029
|
if (protocol && !supportedChatAdapterProtocols.includes(protocol)) {
|
2027
|
-
return [2 /*return*/, Promise.reject("ChatAdapter for protocol "
|
2030
|
+
return [2 /*return*/, Promise.reject("ChatAdapter for protocol ".concat(protocol, " currently not supported"))];
|
2028
2031
|
}
|
2029
2032
|
if (protocol === ChatAdapterProtocols_1.default.DirectLine) {
|
2030
|
-
return [2 /*return*/, chatAdapterCreators_1.createDirectLine(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.DirectLine, this.telemetry, this.scenarioMarker)];
|
2033
|
+
return [2 /*return*/, (0, chatAdapterCreators_1.createDirectLine)(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.DirectLine, this.telemetry, this.scenarioMarker)];
|
2031
2034
|
}
|
2032
2035
|
else if (protocol === ChatAdapterProtocols_1.default.ACS || this.liveChatVersion === LiveChatVersion_1.default.V2) {
|
2033
2036
|
options = {
|
2034
2037
|
fileScan: (_a = optionalParams.ACSAdapter) === null || _a === void 0 ? void 0 : _a.fileScan
|
2035
2038
|
};
|
2036
2039
|
fileManager = new AMSFileManager_1.default(this.AMSClient, this.acsAdapterLogger, options);
|
2037
|
-
return [2 /*return*/, chatAdapterCreators_1.createACSAdapter(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.ACS, this.telemetry, this.scenarioMarker, this.omnichannelConfig, this.chatToken, fileManager, (_b = this.ACSClient) === null || _b === void 0 ? void 0 : _b.getChatClient(), this.acsAdapterLogger)];
|
2040
|
+
return [2 /*return*/, (0, chatAdapterCreators_1.createACSAdapter)(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.ACS, this.telemetry, this.scenarioMarker, this.omnichannelConfig, this.chatToken, fileManager, (_b = this.ACSClient) === null || _b === void 0 ? void 0 : _b.getChatClient(), this.acsAdapterLogger)];
|
2038
2041
|
}
|
2039
2042
|
else if (protocol === ChatAdapterProtocols_1.default.IC3 || this.liveChatVersion === LiveChatVersion_1.default.V1) {
|
2040
|
-
return [2 /*return*/, chatAdapterCreators_1.createIC3Adapter(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.IC3, this.telemetry, this.scenarioMarker, this.chatToken, this.IC3Client, this.ic3ClientLogger)];
|
2043
|
+
return [2 /*return*/, (0, chatAdapterCreators_1.createIC3Adapter)(optionalParams, this.chatSDKConfig, this.liveChatVersion, ChatAdapterProtocols_1.default.IC3, this.telemetry, this.scenarioMarker, this.chatToken, this.IC3Client, this.ic3ClientLogger)];
|
2041
2044
|
}
|
2042
|
-
return [2 /*return*/, Promise.reject("ChatAdapter for protocol "
|
2045
|
+
return [2 /*return*/, Promise.reject("ChatAdapter for protocol ".concat(protocol, " currently not supported"))];
|
2043
2046
|
});
|
2044
2047
|
});
|
2045
2048
|
};
|
2046
2049
|
OmnichannelChatSDK.prototype.isVoiceVideoCallingEnabled = function () {
|
2047
2050
|
return this.callingOption.toString() !== CallingOptionsOptionSetNumber_1.default.NoCalling.toString();
|
2048
2051
|
};
|
2049
|
-
OmnichannelChatSDK.prototype.getVoiceVideoCalling = function (
|
2050
|
-
|
2051
|
-
return __awaiter(this, void 0, void 0, function () {
|
2052
|
+
OmnichannelChatSDK.prototype.getVoiceVideoCalling = function () {
|
2053
|
+
return __awaiter(this, arguments, void 0, function (params) {
|
2052
2054
|
var message, message, chatConfig, liveWSAndLiveChatEngJoin, msdyn_widgetsnippet, widgetSnippetSourceRegex, result;
|
2053
2055
|
var _this = this;
|
2056
|
+
if (params === void 0) { params = {}; }
|
2054
2057
|
return __generator(this, function (_a) {
|
2055
2058
|
switch (_a.label) {
|
2056
2059
|
case 0:
|
@@ -2078,20 +2081,20 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2078
2081
|
return __generator(this, function (_b) {
|
2079
2082
|
switch (_b.label) {
|
2080
2083
|
case 0:
|
2081
|
-
LiveChatWidgetLibCDNUrl = result[1]
|
2084
|
+
LiveChatWidgetLibCDNUrl = "".concat(result[1], "/livechatwidget/v2scripts/callingsdk/").concat(settings_1.callingBundleVersion, "/CallingBundle.js");
|
2082
2085
|
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.setCDNPackages({
|
2083
2086
|
VoiceVideoCalling: LiveChatWidgetLibCDNUrl
|
2084
2087
|
});
|
2085
2088
|
defaultParams = {
|
2086
2089
|
logger: this.callingSdkLogger
|
2087
2090
|
};
|
2088
|
-
return [4 /*yield*/, WebUtils_1.loadScript(LiveChatWidgetLibCDNUrl, function () { return __awaiter(_this, void 0, void 0, function () {
|
2091
|
+
return [4 /*yield*/, (0, WebUtils_1.loadScript)(LiveChatWidgetLibCDNUrl, function () { return __awaiter(_this, void 0, void 0, function () {
|
2089
2092
|
var VoiceVideoCalling;
|
2090
2093
|
return __generator(this, function (_a) {
|
2091
2094
|
switch (_a.label) {
|
2092
2095
|
case 0:
|
2093
|
-
this.debug && console.debug(LiveChatWidgetLibCDNUrl
|
2094
|
-
return [4 /*yield*/, createVoiceVideoCalling_1.default(__assign(__assign({}, params), defaultParams))];
|
2096
|
+
this.debug && console.debug("".concat(LiveChatWidgetLibCDNUrl, " loaded!"));
|
2097
|
+
return [4 /*yield*/, (0, createVoiceVideoCalling_1.default)(__assign(__assign({}, params), defaultParams))];
|
2095
2098
|
case 1:
|
2096
2099
|
VoiceVideoCalling = _a.sent();
|
2097
2100
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.GetVoiceVideoCalling);
|
@@ -2126,15 +2129,15 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2126
2129
|
});
|
2127
2130
|
};
|
2128
2131
|
OmnichannelChatSDK.prototype.getPostChatSurveyContext = function () {
|
2129
|
-
var _a, _b, _c, _d, _e, _f;
|
2130
2132
|
return __awaiter(this, void 0, void 0, function () {
|
2131
|
-
var conversationId, chatConfig, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId, postConversationBotSurveyOwnerId, msdyn_surveyprovider, liveWorkItemDetails, participantJoined, participantType, agentSurveyInviteLinkRequest, botSurveyInviteLinkRequest, optionalParams, agentSurveyInviteLinkResponse, botSurveyInviteLinkResponse,
|
2133
|
+
var conversationId, chatConfig, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId, postConversationBotSurveyOwnerId, msdyn_surveyprovider, liveWorkItemDetails, participantJoined, participantType, agentSurveyInviteLinkRequest, botSurveyInviteLinkRequest, optionalParams, agentSurveyInviteLinkResponse, botSurveyInviteLinkResponse, _a, agentSurveyInviteLink, agentFormsProLocale, botSurveyInviteLink, botFormsProLocale, postChatContext, ex_1;
|
2134
|
+
var _b, _c, _d, _e, _f, _g;
|
2132
2135
|
return __generator(this, function (_h) {
|
2133
2136
|
switch (_h.label) {
|
2134
2137
|
case 0:
|
2135
2138
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2136
2139
|
RequestId: this.requestId,
|
2137
|
-
ChatId: (
|
2140
|
+
ChatId: (_b = this.chatToken) === null || _b === void 0 ? void 0 : _b.chatId,
|
2138
2141
|
});
|
2139
2142
|
_h.label = 1;
|
2140
2143
|
case 1:
|
@@ -2142,19 +2145,19 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2142
2145
|
chatConfig = this.liveChatConfig;
|
2143
2146
|
liveWSAndLiveChatEngJoin = chatConfig.LiveWSAndLiveChatEngJoin;
|
2144
2147
|
msdyn_postconversationsurveyenable = liveWSAndLiveChatEngJoin.msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier = liveWSAndLiveChatEngJoin.msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier = liveWSAndLiveChatEngJoin.msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId = liveWSAndLiveChatEngJoin.postConversationSurveyOwnerId, postConversationBotSurveyOwnerId = liveWSAndLiveChatEngJoin.postConversationBotSurveyOwnerId, msdyn_surveyprovider = liveWSAndLiveChatEngJoin.msdyn_surveyprovider;
|
2145
|
-
if (!(parsers_1.parseLowerCaseString(msdyn_postconversationsurveyenable) === "true")) return [3 /*break*/, 6];
|
2148
|
+
if (!((0, parsers_1.parseLowerCaseString)(msdyn_postconversationsurveyenable) === "true")) return [3 /*break*/, 6];
|
2146
2149
|
return [4 /*yield*/, this.getConversationDetails()];
|
2147
2150
|
case 2:
|
2148
2151
|
liveWorkItemDetails = _h.sent();
|
2149
2152
|
if (Object.keys(liveWorkItemDetails).length === 0) {
|
2150
2153
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2151
2154
|
RequestId: this.requestId,
|
2152
|
-
ChatId: (
|
2155
|
+
ChatId: (_c = this.chatToken) === null || _c === void 0 ? void 0 : _c.chatId,
|
2153
2156
|
ExceptionDetails: "GetPostChatSurveyContext : LiveWorkItemDetails is null."
|
2154
2157
|
});
|
2155
2158
|
return [2 /*return*/, Promise.reject("GetPostChatSurveyContext : LiveWorkItemDetails is null.")];
|
2156
2159
|
}
|
2157
|
-
participantJoined = parsers_1.parseLowerCaseString(liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.canRenderPostChat) === "true";
|
2160
|
+
participantJoined = (0, parsers_1.parseLowerCaseString)(liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.canRenderPostChat) === "true";
|
2158
2161
|
participantType = liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.participantType;
|
2159
2162
|
conversationId = liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.conversationId;
|
2160
2163
|
agentSurveyInviteLinkRequest = {
|
@@ -2162,14 +2165,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2162
2165
|
"WidgetId": this.omnichannelConfig.widgetId,
|
2163
2166
|
"FormId": msfp_sourcesurveyidentifier,
|
2164
2167
|
"ConversationId": conversationId,
|
2165
|
-
"OCLocaleCode": locale_1.getLocaleStringFromId(this.localeId)
|
2168
|
+
"OCLocaleCode": (0, locale_1.getLocaleStringFromId)(this.localeId)
|
2166
2169
|
};
|
2167
2170
|
botSurveyInviteLinkRequest = {
|
2168
2171
|
"SurveyProvider": msdyn_surveyprovider,
|
2169
2172
|
"WidgetId": this.omnichannelConfig.widgetId,
|
2170
2173
|
"FormId": msfp_botsourcesurveyidentifier,
|
2171
2174
|
"ConversationId": conversationId,
|
2172
|
-
"OCLocaleCode": locale_1.getLocaleStringFromId(this.localeId)
|
2175
|
+
"OCLocaleCode": (0, locale_1.getLocaleStringFromId)(this.localeId)
|
2173
2176
|
};
|
2174
2177
|
optionalParams = {
|
2175
2178
|
"requestId": this.requestId
|
@@ -2180,14 +2183,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2180
2183
|
return [4 /*yield*/, this.OCClient.getSurveyInviteLink(postConversationSurveyOwnerId, agentSurveyInviteLinkRequest, optionalParams)];
|
2181
2184
|
case 3:
|
2182
2185
|
agentSurveyInviteLinkResponse = _h.sent();
|
2183
|
-
|
2184
|
-
if (!
|
2186
|
+
_a = postConversationBotSurveyOwnerId && msfp_botsourcesurveyidentifier;
|
2187
|
+
if (!_a) return [3 /*break*/, 5];
|
2185
2188
|
return [4 /*yield*/, this.OCClient.getSurveyInviteLink(postConversationBotSurveyOwnerId, botSurveyInviteLinkRequest, optionalParams)];
|
2186
2189
|
case 4:
|
2187
|
-
|
2190
|
+
_a = (_h.sent());
|
2188
2191
|
_h.label = 5;
|
2189
2192
|
case 5:
|
2190
|
-
botSurveyInviteLinkResponse =
|
2193
|
+
botSurveyInviteLinkResponse = _a;
|
2191
2194
|
agentSurveyInviteLink = void 0, agentFormsProLocale = void 0, botSurveyInviteLink = void 0, botFormsProLocale = void 0;
|
2192
2195
|
if (agentSurveyInviteLinkResponse != null) {
|
2193
2196
|
if (agentSurveyInviteLinkResponse.inviteList != null && agentSurveyInviteLinkResponse.inviteList.length == 1) {
|
@@ -2197,7 +2200,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2197
2200
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2198
2201
|
ConversationId: conversationId,
|
2199
2202
|
RequestId: this.requestId,
|
2200
|
-
ChatId: (
|
2203
|
+
ChatId: (_d = this.chatToken) === null || _d === void 0 ? void 0 : _d.chatId,
|
2201
2204
|
ExceptionDetails: "Survey Invite link failed to send response."
|
2202
2205
|
});
|
2203
2206
|
return [2 /*return*/, Promise.reject("Survey Invite link failed to send response.")];
|
@@ -2227,7 +2230,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2227
2230
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2228
2231
|
ConversationId: conversationId,
|
2229
2232
|
RequestId: this.requestId,
|
2230
|
-
ChatId: (
|
2233
|
+
ChatId: (_e = this.chatToken) === null || _e === void 0 ? void 0 : _e.chatId,
|
2231
2234
|
ExceptionDetails: "surveyInviteLinkResponse is null."
|
2232
2235
|
});
|
2233
2236
|
return [2 /*return*/, Promise.reject("surveyInviteLinkResponse is null.")];
|
@@ -2236,7 +2239,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2236
2239
|
case 6:
|
2237
2240
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2238
2241
|
RequestId: this.requestId,
|
2239
|
-
ChatId: (
|
2242
|
+
ChatId: (_f = this.chatToken) === null || _f === void 0 ? void 0 : _f.chatId,
|
2240
2243
|
ExceptionDetails: "Post Chat Survey is disabled. Please check the Omnichannel Administration Portal."
|
2241
2244
|
});
|
2242
2245
|
return [2 /*return*/, Promise.reject("Post Chat is disabled from admin side.")];
|
@@ -2246,7 +2249,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2246
2249
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
2247
2250
|
ConversationId: conversationId !== null && conversationId !== void 0 ? conversationId : "",
|
2248
2251
|
RequestId: this.requestId,
|
2249
|
-
ChatId: (
|
2252
|
+
ChatId: (_g = this.chatToken) === null || _g === void 0 ? void 0 : _g.chatId,
|
2250
2253
|
ExceptionDetails: JSON.stringify(ex_1)
|
2251
2254
|
});
|
2252
2255
|
return [2 /*return*/, Promise.reject("Retrieving post chat context failed " + JSON.stringify(ex_1))];
|
@@ -2255,11 +2258,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2255
2258
|
});
|
2256
2259
|
});
|
2257
2260
|
};
|
2258
|
-
OmnichannelChatSDK.prototype.getAgentAvailability = function (
|
2259
|
-
|
2260
|
-
return __awaiter(this, void 0, void 0, function () {
|
2261
|
+
OmnichannelChatSDK.prototype.getAgentAvailability = function () {
|
2262
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
2261
2263
|
var reportError, getAgentAvailabilityOptionalParams, response, e_8;
|
2262
2264
|
var _this = this;
|
2265
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
2263
2266
|
return __generator(this, function (_a) {
|
2264
2267
|
switch (_a.label) {
|
2265
2268
|
case 0:
|
@@ -2374,7 +2377,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2374
2377
|
}
|
2375
2378
|
});
|
2376
2379
|
}); });
|
2377
|
-
return [4 /*yield*/, WebUtils_1.loadScript(ic3ClientCDNUrl, function () {
|
2380
|
+
return [4 /*yield*/, (0, WebUtils_1.loadScript)(ic3ClientCDNUrl, function () {
|
2378
2381
|
/* istanbul ignore next */
|
2379
2382
|
_this.debug && console.debug('IC3Client loaded!');
|
2380
2383
|
}, function () {
|
@@ -2396,10 +2399,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2396
2399
|
});
|
2397
2400
|
});
|
2398
2401
|
};
|
2399
|
-
OmnichannelChatSDK.prototype.getChatConfig = function (
|
2400
|
-
|
2401
|
-
return __awaiter(this, void 0, void 0, function () {
|
2402
|
+
OmnichannelChatSDK.prototype.getChatConfig = function () {
|
2403
|
+
return __awaiter(this, arguments, void 0, function (optionalParams) {
|
2402
2404
|
var sendCacheHeaders, bypassCache, liveChatConfig, error_21, _a, dataMaskingConfig, authSettings, liveWSAndLiveChatEngJoin, liveChatVersion, chatWidgetLanguage, msdyn_localeid, setting, preChatSurvey, msdyn_prechatenabled, msdyn_callingoptions, msdyn_conversationmode, msdyn_enablechatreconnect, isPreChatEnabled, isChatReconnectEnabled;
|
2405
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
2403
2406
|
return __generator(this, function (_b) {
|
2404
2407
|
switch (_b.label) {
|
2405
2408
|
case 0:
|
@@ -2414,10 +2417,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2414
2417
|
return [3 /*break*/, 8];
|
2415
2418
|
case 3:
|
2416
2419
|
error_21 = _b.sent();
|
2417
|
-
if (!internalUtils_1.isCoreServicesOrgUrlDNSError(error_21, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
|
2420
|
+
if (!(0, internalUtils_1.isCoreServicesOrgUrlDNSError)(error_21, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
|
2418
2421
|
this.omnichannelConfig.orgUrl = this.unqServicesOrgUrl;
|
2419
2422
|
_a = this;
|
2420
|
-
return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, createOcSDKConfiguration_1.default(false), this.ocSdkLogger)];
|
2423
|
+
return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, (0, createOcSDKConfiguration_1.default)(false), this.ocSdkLogger)];
|
2421
2424
|
case 4:
|
2422
2425
|
_a.OCClient = _b.sent();
|
2423
2426
|
return [4 /*yield*/, this.OCClient.getChatConfig(this.requestId, bypassCache)];
|
@@ -2432,7 +2435,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2432
2435
|
this.localeId = msdyn_localeid || locale_1.defaultLocaleId;
|
2433
2436
|
this.liveChatVersion = liveChatVersion || LiveChatVersion_1.default.V2;
|
2434
2437
|
/* istanbul ignore next */
|
2435
|
-
this.debug && console.log("[OmnichannelChatSDK][getChatConfig][liveChatVersion] "
|
2438
|
+
this.debug && console.log("[OmnichannelChatSDK][getChatConfig][liveChatVersion] ".concat(this.liveChatVersion));
|
2436
2439
|
setting = dataMaskingConfig.setting;
|
2437
2440
|
if (setting.msdyn_maskforcustomer) {
|
2438
2441
|
this.dataMaskingRules = dataMaskingConfig.dataMaskingRules;
|
@@ -2441,8 +2444,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2441
2444
|
this.authSettings = authSettings;
|
2442
2445
|
}
|
2443
2446
|
preChatSurvey = liveWSAndLiveChatEngJoin.PreChatSurvey, msdyn_prechatenabled = liveWSAndLiveChatEngJoin.msdyn_prechatenabled, msdyn_callingoptions = liveWSAndLiveChatEngJoin.msdyn_callingoptions, msdyn_conversationmode = liveWSAndLiveChatEngJoin.msdyn_conversationmode, msdyn_enablechatreconnect = liveWSAndLiveChatEngJoin.msdyn_enablechatreconnect;
|
2444
|
-
isPreChatEnabled = parsers_1.parseLowerCaseString(msdyn_prechatenabled) === "true";
|
2445
|
-
isChatReconnectEnabled = parsers_1.parseLowerCaseString(msdyn_enablechatreconnect) === "true";
|
2447
|
+
isPreChatEnabled = (0, parsers_1.parseLowerCaseString)(msdyn_prechatenabled) === "true";
|
2448
|
+
isChatReconnectEnabled = (0, parsers_1.parseLowerCaseString)(msdyn_enablechatreconnect) === "true";
|
2446
2449
|
if ((msdyn_conversationmode === null || msdyn_conversationmode === void 0 ? void 0 : msdyn_conversationmode.toString()) === ConversationMode_1.default.PersistentChat.toString()) {
|
2447
2450
|
this.isPersistentChat = true;
|
2448
2451
|
}
|
@@ -2520,10 +2523,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2520
2523
|
});
|
2521
2524
|
});
|
2522
2525
|
};
|
2523
|
-
OmnichannelChatSDK.prototype.setAuthTokenProvider = function (
|
2524
|
-
|
2525
|
-
return __awaiter(this, void 0, void 0, function () {
|
2526
|
+
OmnichannelChatSDK.prototype.setAuthTokenProvider = function (provider_1) {
|
2527
|
+
return __awaiter(this, arguments, void 0, function (provider, optionalParams) {
|
2526
2528
|
var token, exceptionDetails, error_23, exceptionDetails, exceptionDetails;
|
2529
|
+
if (optionalParams === void 0) { optionalParams = {}; }
|
2527
2530
|
return __generator(this, function (_a) {
|
2528
2531
|
switch (_a.label) {
|
2529
2532
|
case 0:
|
@@ -2591,14 +2594,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
2591
2594
|
* Feature should be enabled by default. `createCoreServicesOrgUrlAtRuntime` set to `false`
|
2592
2595
|
* would disable the orgUrl conversion and should only be used as fallback only.
|
2593
2596
|
*/
|
2594
|
-
if (!CoreServicesUtils_1.isCoreServicesOrgUrl(this.omnichannelConfig.orgUrl) && !(((_a = this.chatSDKConfig.internalConfig) === null || _a === void 0 ? void 0 : _a.createCoreServicesOrgUrlAtRuntime) === false)) {
|
2597
|
+
if (!(0, CoreServicesUtils_1.isCoreServicesOrgUrl)(this.omnichannelConfig.orgUrl) && !(((_a = this.chatSDKConfig.internalConfig) === null || _a === void 0 ? void 0 : _a.createCoreServicesOrgUrlAtRuntime) === false)) {
|
2595
2598
|
var result = CoreServicesUtils_1.unqOrgUrlPattern.exec(this.omnichannelConfig.orgUrl);
|
2596
2599
|
if (result) {
|
2597
2600
|
this.dynamicsLocationCode = result[1];
|
2598
|
-
var geoName = CoreServicesUtils_1.getCoreServicesGeoName(this.dynamicsLocationCode);
|
2601
|
+
var geoName = (0, CoreServicesUtils_1.getCoreServicesGeoName)(this.dynamicsLocationCode);
|
2599
2602
|
if (geoName) {
|
2600
2603
|
this.unqServicesOrgUrl = this.omnichannelConfig.orgUrl;
|
2601
|
-
this.coreServicesOrgUrl = CoreServicesUtils_1.createCoreServicesOrgUrl(this.omnichannelConfig.orgId, geoName);
|
2604
|
+
this.coreServicesOrgUrl = (0, CoreServicesUtils_1.createCoreServicesOrgUrl)(this.omnichannelConfig.orgId, geoName);
|
2602
2605
|
this.omnichannelConfig.orgUrl = this.coreServicesOrgUrl;
|
2603
2606
|
}
|
2604
2607
|
}
|