@microsoft/omnichannel-chat-sdk 1.0.1-main.eec1463 → 1.1.1-main.131f36d
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/CHANGELOG.md +12 -0
- package/README.md +67 -56
- package/lib/OmnichannelChatSDK.d.ts +1 -0
- package/lib/OmnichannelChatSDK.js +159 -101
- package/lib/OmnichannelChatSDK.js.map +1 -1
- package/lib/api/createVoiceVideoCalling.js +6 -2
- package/lib/api/createVoiceVideoCalling.js.map +1 -1
- package/lib/config/settings.d.ts +1 -1
- package/lib/config/settings.js +1 -1
- package/lib/core/ChatConfig.d.ts +1 -0
- package/lib/core/ChatSDKExceptionDetails.d.ts +5 -0
- package/lib/core/ChatSDKExceptionDetails.js +3 -0
- package/lib/core/ChatSDKExceptionDetails.js.map +1 -0
- package/lib/core/ChatTranscriptBody.d.ts +1 -1
- package/lib/core/LiveWorkItemDetails.d.ts +2 -0
- package/lib/core/OmnichannelErrorCodes.d.ts +4 -0
- package/lib/core/OmnichannelErrorCodes.js +8 -0
- package/lib/core/OmnichannelErrorCodes.js.map +1 -0
- package/lib/core/PostChatContext.d.ts +1 -0
- package/lib/core/messaging/MessageTags.d.ts +2 -0
- package/lib/core/messaging/MessageTags.js +4 -2
- package/lib/core/messaging/MessageTags.js.map +1 -1
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.d.ts +5 -0
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js +34 -0
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js.map +1 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.d.ts +7 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.js +3 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.js.map +1 -0
- package/lib/index.d.ts +7 -6
- package/lib/index.js +13 -8
- package/lib/index.js.map +1 -1
- package/lib/telemetry/AriaTelemetry.d.ts +1 -0
- package/lib/telemetry/AriaTelemetry.js +50 -0
- package/lib/telemetry/AriaTelemetry.js.map +1 -1
- package/lib/telemetry/ScenarioType.d.ts +1 -0
- package/lib/telemetry/ScenarioType.js +1 -0
- package/lib/telemetry/ScenarioType.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +119 -43
- package/lib/utils/locale.d.ts +2 -1
- package/lib/utils/locale.js +5 -4
- package/lib/utils/locale.js.map +1 -1
- package/lib/utils/loggers.d.ts +18 -1
- package/lib/utils/loggers.js +70 -2
- package/lib/utils/loggers.js.map +1 -1
- package/package.json +1 -1
@@ -58,6 +58,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
58
|
var loggers_1 = require("./utils/loggers");
|
59
59
|
var ACSClient_1 = require("./core/messaging/ACSClient");
|
60
60
|
var ocsdk_1 = require("@microsoft/ocsdk");
|
61
|
+
var locale_1 = require("./utils/locale");
|
62
|
+
var WebUtils_1 = require("./utils/WebUtils");
|
61
63
|
var platform_1 = require("./utils/platform");
|
62
64
|
var SDKConfigValidators_1 = require("./validators/SDKConfigValidators");
|
63
65
|
var ACSParticipantDisplayName_1 = require("./core/messaging/ACSParticipantDisplayName");
|
@@ -65,8 +67,6 @@ var AMSFileManager_1 = require("./external/ACSAdapter/AMSFileManager");
|
|
65
67
|
var CallingOptionsOptionSetNumber_1 = require("./core/CallingOptionsOptionSetNumber");
|
66
68
|
var ChatAdapterProtocols_1 = require("./core/messaging/ChatAdapterProtocols");
|
67
69
|
var ConversationMode_1 = require("./core/ConversationMode");
|
68
|
-
var createFormatEgressTagsMiddleware_1 = require("./external/ACSAdapter/createFormatEgressTagsMiddleware");
|
69
|
-
var createFormatIngressTagsMiddleware_1 = require("./external/ACSAdapter/createFormatIngressTagsMiddleware");
|
70
70
|
var DeliveryMode_1 = require("@microsoft/omnichannel-ic3core/lib/model/DeliveryMode");
|
71
71
|
var FileSharingProtocolType_1 = require("@microsoft/omnichannel-ic3core/lib/model/FileSharingProtocolType");
|
72
72
|
var HostType_1 = require("@microsoft/omnichannel-ic3core/lib/interfaces/HostType");
|
@@ -75,24 +75,26 @@ var LiveChatVersion_1 = require("./core/LiveChatVersion");
|
|
75
75
|
var LiveWorkItemState_1 = require("./core/LiveWorkItemState");
|
76
76
|
var MessageContentType_1 = require("@microsoft/omnichannel-ic3core/lib/model/MessageContentType");
|
77
77
|
var MessageType_1 = require("@microsoft/omnichannel-ic3core/lib/model/MessageType");
|
78
|
+
var OmnichannelErrorCodes_1 = require("./core/OmnichannelErrorCodes");
|
78
79
|
var PersonType_1 = require("@microsoft/omnichannel-ic3core/lib/model/PersonType");
|
79
80
|
var ProtocoleType_1 = require("@microsoft/omnichannel-ic3core/lib/interfaces/ProtocoleType");
|
80
81
|
var ScenarioMarker_1 = require("./telemetry/ScenarioMarker");
|
81
82
|
var TelemetryEvent_1 = require("./telemetry/TelemetryEvent");
|
82
83
|
var omnichannel_amsclient_1 = require("@microsoft/omnichannel-amsclient");
|
84
|
+
var createChannelDataEgressMiddleware_1 = require("./external/ACSAdapter/createChannelDataEgressMiddleware");
|
85
|
+
var createFormatEgressTagsMiddleware_1 = require("./external/ACSAdapter/createFormatEgressTagsMiddleware");
|
86
|
+
var createFormatIngressTagsMiddleware_1 = require("./external/ACSAdapter/createFormatIngressTagsMiddleware");
|
83
87
|
var createOmnichannelMessage_1 = require("./utils/createOmnichannelMessage");
|
84
88
|
var createTelemetry_1 = require("./utils/createTelemetry");
|
85
89
|
var createVoiceVideoCalling_1 = require("./api/createVoiceVideoCalling");
|
86
90
|
var MessageTags_1 = require("./core/messaging/MessageTags");
|
87
|
-
var locale_1 = require("./utils/locale");
|
88
91
|
var utilities_1 = require("./utils/utilities");
|
89
92
|
var libraries_1 = require("./utils/libraries");
|
90
|
-
var WebUtils_1 = require("./utils/WebUtils");
|
91
93
|
var OmnichannelConfigValidator_1 = require("./validators/OmnichannelConfigValidator");
|
92
94
|
var OmnichannelChatSDK = /** @class */ (function () {
|
93
95
|
function OmnichannelChatSDK(omnichannelConfig, chatSDKConfig) {
|
94
96
|
if (chatSDKConfig === void 0) { chatSDKConfig = SDKConfigValidators_1.defaultChatSDKConfig; }
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
97
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
96
98
|
this.ACSClient = null;
|
97
99
|
this.AMSClient = null;
|
98
100
|
this.authSettings = null;
|
@@ -104,6 +106,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
104
106
|
this.ocSdkLogger = null;
|
105
107
|
this.acsClientLogger = null;
|
106
108
|
this.acsAdapterLogger = null;
|
109
|
+
this.callingSdkLogger = null;
|
107
110
|
this.isPersistentChat = false;
|
108
111
|
this.isChatReconnect = false;
|
109
112
|
this.reconnectId = null;
|
@@ -128,16 +131,19 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
128
131
|
this.ocSdkLogger = loggers_1.createOCSDKLogger(this.omnichannelConfig);
|
129
132
|
this.acsClientLogger = loggers_1.createACSClientLogger(this.omnichannelConfig);
|
130
133
|
this.acsAdapterLogger = loggers_1.createACSAdapterLogger(this.omnichannelConfig);
|
134
|
+
this.callingSdkLogger = loggers_1.createCallingSDKLogger(this.omnichannelConfig);
|
131
135
|
this.scenarioMarker.useTelemetry(this.telemetry);
|
132
136
|
this.ic3ClientLogger.useTelemetry(this.telemetry);
|
133
137
|
this.ocSdkLogger.useTelemetry(this.telemetry);
|
134
138
|
this.acsClientLogger.useTelemetry(this.telemetry);
|
135
139
|
this.acsAdapterLogger.useTelemetry(this.telemetry);
|
140
|
+
this.callingSdkLogger.useTelemetry(this.telemetry);
|
136
141
|
this.scenarioMarker.setRuntimeId(this.runtimeId);
|
137
142
|
this.ic3ClientLogger.setRuntimeId(this.runtimeId);
|
138
143
|
this.ocSdkLogger.setRuntimeId(this.runtimeId);
|
139
144
|
this.acsClientLogger.setRuntimeId(this.runtimeId);
|
140
145
|
this.acsAdapterLogger.setRuntimeId(this.runtimeId);
|
146
|
+
this.callingSdkLogger.setRuntimeId(this.runtimeId);
|
141
147
|
OmnichannelConfigValidator_1.default(omnichannelConfig);
|
142
148
|
SDKConfigValidators_1.default(chatSDKConfig);
|
143
149
|
((_a = this.chatSDKConfig.telemetry) === null || _a === void 0 ? void 0 : _a.disable) && ((_b = this.telemetry) === null || _b === void 0 ? void 0 : _b.disable());
|
@@ -148,10 +154,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
148
154
|
(_e = this.ocSdkLogger) === null || _e === void 0 ? void 0 : _e.setRequestId(this.requestId);
|
149
155
|
(_f = this.acsClientLogger) === null || _f === void 0 ? void 0 : _f.setRequestId(this.requestId);
|
150
156
|
(_g = this.acsAdapterLogger) === null || _g === void 0 ? void 0 : _g.setRequestId(this.requestId);
|
157
|
+
(_h = this.callingSdkLogger) === null || _h === void 0 ? void 0 : _h.setRequestId(this.requestId);
|
151
158
|
}
|
152
159
|
/* istanbul ignore next */
|
153
160
|
OmnichannelChatSDK.prototype.setDebug = function (flag) {
|
154
|
-
var _a, _b, _c, _d, _e, _f;
|
161
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
155
162
|
this.debug = flag;
|
156
163
|
(_a = this.AMSClient) === null || _a === void 0 ? void 0 : _a.setDebug(flag);
|
157
164
|
(_b = this.telemetry) === null || _b === void 0 ? void 0 : _b.setDebug(flag);
|
@@ -160,6 +167,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
160
167
|
(_d = this.ocSdkLogger) === null || _d === void 0 ? void 0 : _d.setDebug(flag);
|
161
168
|
(_e = this.acsClientLogger) === null || _e === void 0 ? void 0 : _e.setDebug(flag);
|
162
169
|
(_f = this.acsAdapterLogger) === null || _f === void 0 ? void 0 : _f.setDebug(flag);
|
170
|
+
(_g = this.callingSdkLogger) === null || _g === void 0 ? void 0 : _g.setDebug(flag);
|
163
171
|
};
|
164
172
|
OmnichannelChatSDK.prototype.initialize = function () {
|
165
173
|
return __awaiter(this, void 0, void 0, function () {
|
@@ -298,44 +306,44 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
298
306
|
});
|
299
307
|
};
|
300
308
|
OmnichannelChatSDK.prototype.startChat = function (optionalParams) {
|
301
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
309
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
302
310
|
if (optionalParams === void 0) { optionalParams = {}; }
|
303
311
|
return __awaiter(this, void 0, void 0, function () {
|
304
|
-
var shouldReinitIC3Client,
|
312
|
+
var shouldReinitIC3Client, _t, reconnectableChatsParams, reconnectableChatsResponse, _u, exceptionDetails, conversationDetails, exceptionDetails, exceptionDetails, sessionInitOptionalParams, error_3, exceptionDetails, chatAdapterConfig, error_4, exceptionDetails, _v, error_5, exceptionDetails, error_6, exceptionDetails, error_7, exceptionDetails, _w, error_8, exceptionDetails;
|
305
313
|
var _this = this;
|
306
|
-
return __generator(this, function (
|
307
|
-
switch (
|
314
|
+
return __generator(this, function (_x) {
|
315
|
+
switch (_x.label) {
|
308
316
|
case 0:
|
309
317
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.StartChat, {
|
310
318
|
RequestId: this.requestId
|
311
319
|
});
|
312
320
|
shouldReinitIC3Client = !platform_1.default.isNode() && !platform_1.default.isReactNative() && !this.IC3Client && this.liveChatVersion === LiveChatVersion_1.default.V1;
|
313
321
|
if (!shouldReinitIC3Client) return [3 /*break*/, 2];
|
314
|
-
|
322
|
+
_t = this;
|
315
323
|
return [4 /*yield*/, this.getIC3Client()];
|
316
324
|
case 1:
|
317
|
-
|
318
|
-
|
325
|
+
_t.IC3Client = _x.sent();
|
326
|
+
_x.label = 2;
|
319
327
|
case 2:
|
320
328
|
if (this.isChatReconnect && !((_a = this.chatSDKConfig.chatReconnect) === null || _a === void 0 ? void 0 : _a.disable) && !this.isPersistentChat && optionalParams.reconnectId) {
|
321
329
|
this.reconnectId = optionalParams.reconnectId;
|
322
330
|
}
|
323
331
|
if (!(this.isPersistentChat && !((_b = this.chatSDKConfig.persistentChat) === null || _b === void 0 ? void 0 : _b.disable))) return [3 /*break*/, 6];
|
324
|
-
|
332
|
+
_x.label = 3;
|
325
333
|
case 3:
|
326
|
-
|
334
|
+
_x.trys.push([3, 5, , 6]);
|
327
335
|
reconnectableChatsParams = {
|
328
336
|
authenticatedUserToken: this.authenticatedUserToken
|
329
337
|
};
|
330
338
|
return [4 /*yield*/, this.OCClient.getReconnectableChats(reconnectableChatsParams)];
|
331
339
|
case 4:
|
332
|
-
reconnectableChatsResponse =
|
340
|
+
reconnectableChatsResponse = _x.sent();
|
333
341
|
if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
|
334
342
|
this.reconnectId = reconnectableChatsResponse.reconnectid;
|
335
343
|
}
|
336
344
|
return [3 /*break*/, 6];
|
337
345
|
case 5:
|
338
|
-
|
346
|
+
_u = _x.sent();
|
339
347
|
exceptionDetails = {
|
340
348
|
response: "OCClientGetReconnectableChatsFailed"
|
341
349
|
};
|
@@ -346,7 +354,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
346
354
|
this.requestId = optionalParams.liveChatContext.requestId || ocsdk_1.uuidv4();
|
347
355
|
return [4 /*yield*/, this.getConversationDetails()];
|
348
356
|
case 7:
|
349
|
-
conversationDetails =
|
357
|
+
conversationDetails = _x.sent();
|
350
358
|
if (Object.keys(conversationDetails).length === 0) {
|
351
359
|
exceptionDetails = {
|
352
360
|
response: "InvalidConversation"
|
@@ -371,26 +379,27 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
371
379
|
console.error("Unable to join conversation that's in '" + conversationDetails.state + "' state");
|
372
380
|
throw Error(exceptionDetails.response);
|
373
381
|
}
|
374
|
-
|
382
|
+
_x.label = 8;
|
375
383
|
case 8:
|
376
384
|
if (!(this.chatToken && Object.keys(this.chatToken).length === 0)) return [3 /*break*/, 10];
|
377
385
|
return [4 /*yield*/, this.getChatToken(false)];
|
378
386
|
case 9:
|
379
|
-
|
380
|
-
|
387
|
+
_x.sent();
|
388
|
+
_x.label = 10;
|
381
389
|
case 10:
|
382
390
|
(_c = this.ic3ClientLogger) === null || _c === void 0 ? void 0 : _c.setChatId(this.chatToken.chatId || '');
|
383
391
|
(_d = this.ocSdkLogger) === null || _d === void 0 ? void 0 : _d.setChatId(this.chatToken.chatId || '');
|
384
392
|
(_e = this.acsClientLogger) === null || _e === void 0 ? void 0 : _e.setChatId(this.chatToken.chatId || '');
|
385
393
|
(_f = this.acsAdapterLogger) === null || _f === void 0 ? void 0 : _f.setChatId(this.chatToken.chatId || '');
|
394
|
+
(_g = this.callingSdkLogger) === null || _g === void 0 ? void 0 : _g.setChatId(this.chatToken.chatId || '');
|
386
395
|
sessionInitOptionalParams = {
|
387
396
|
initContext: {}
|
388
397
|
};
|
389
398
|
sessionInitOptionalParams.initContext.locale = locale_1.getLocaleStringFromId(this.localeId);
|
390
|
-
if (this.isPersistentChat && !((
|
399
|
+
if (this.isPersistentChat && !((_h = this.chatSDKConfig.persistentChat) === null || _h === void 0 ? void 0 : _h.disable)) {
|
391
400
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
392
401
|
}
|
393
|
-
if (this.isChatReconnect && !((
|
402
|
+
if (this.isChatReconnect && !((_j = this.chatSDKConfig.chatReconnect) === null || _j === void 0 ? void 0 : _j.disable) && !this.isPersistentChat) {
|
394
403
|
sessionInitOptionalParams.reconnectId = this.reconnectId;
|
395
404
|
}
|
396
405
|
if (optionalParams.customContext) {
|
@@ -419,25 +428,30 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
419
428
|
sessionInitOptionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
420
429
|
}
|
421
430
|
if (!!optionalParams.liveChatContext) return [3 /*break*/, 14];
|
422
|
-
|
431
|
+
_x.label = 11;
|
423
432
|
case 11:
|
424
|
-
|
433
|
+
_x.trys.push([11, 13, , 14]);
|
425
434
|
return [4 /*yield*/, this.OCClient.sessionInit(this.requestId, sessionInitOptionalParams)];
|
426
435
|
case 12:
|
427
|
-
|
436
|
+
_x.sent();
|
428
437
|
return [3 /*break*/, 14];
|
429
438
|
case 13:
|
430
|
-
error_3 =
|
439
|
+
error_3 = _x.sent();
|
431
440
|
exceptionDetails = {
|
432
441
|
response: "OCClientSessionInitFailed"
|
433
442
|
};
|
443
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
444
|
+
if (((_k = error_3) === null || _k === void 0 ? void 0 : _k.isAxiosError) && ((_m = (_l = error_3.response) === null || _l === void 0 ? void 0 : _l.headers) === null || _m === void 0 ? void 0 : _m.errorcode.toString()) === OmnichannelErrorCodes_1.default.WidgetUseOutsideOperatingHour.toString()) {
|
445
|
+
exceptionDetails.response = OmnichannelErrorCodes_1.default[OmnichannelErrorCodes_1.default.WidgetUseOutsideOperatingHour].toString();
|
446
|
+
exceptionDetails.message = 'Widget used outside of operating hours';
|
447
|
+
console.error(exceptionDetails.message);
|
448
|
+
}
|
434
449
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.StartChat, {
|
435
450
|
RequestId: this.requestId,
|
436
451
|
ChatId: this.chatToken.chatId,
|
437
452
|
ExceptionDetails: JSON.stringify(exceptionDetails)
|
438
453
|
});
|
439
|
-
|
440
|
-
return [2 /*return*/, error_3];
|
454
|
+
throw new Error(exceptionDetails.response);
|
441
455
|
case 14:
|
442
456
|
if (!(this.liveChatVersion === LiveChatVersion_1.default.V2)) return [3 /*break*/, 25];
|
443
457
|
chatAdapterConfig = {
|
@@ -447,18 +461,18 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
447
461
|
environmentUrl: this.chatToken.acsEndpoint,
|
448
462
|
pollingInterval: 1000
|
449
463
|
};
|
450
|
-
|
464
|
+
_x.label = 15;
|
451
465
|
case 15:
|
452
|
-
|
453
|
-
return [4 /*yield*/, ((
|
466
|
+
_x.trys.push([15, 17, , 18]);
|
467
|
+
return [4 /*yield*/, ((_o = this.ACSClient) === null || _o === void 0 ? void 0 : _o.initialize({
|
454
468
|
token: chatAdapterConfig.token,
|
455
469
|
environmentUrl: chatAdapterConfig.environmentUrl
|
456
470
|
}))];
|
457
471
|
case 16:
|
458
|
-
|
472
|
+
_x.sent();
|
459
473
|
return [3 /*break*/, 18];
|
460
474
|
case 17:
|
461
|
-
error_4 =
|
475
|
+
error_4 = _x.sent();
|
462
476
|
exceptionDetails = {
|
463
477
|
response: "ACSClientInitializeFailed"
|
464
478
|
};
|
@@ -470,22 +484,22 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
470
484
|
console.error("OmnichannelChatSDK/startChat/initialize/error " + error_4);
|
471
485
|
return [2 /*return*/, error_4];
|
472
486
|
case 18:
|
473
|
-
|
474
|
-
|
475
|
-
return [4 /*yield*/, ((
|
487
|
+
_x.trys.push([18, 20, , 21]);
|
488
|
+
_v = this;
|
489
|
+
return [4 /*yield*/, ((_p = this.ACSClient) === null || _p === void 0 ? void 0 : _p.joinConversation({
|
476
490
|
id: chatAdapterConfig.id,
|
477
491
|
threadId: chatAdapterConfig.threadId,
|
478
492
|
pollingInterval: chatAdapterConfig.pollingInterval
|
479
493
|
}))];
|
480
494
|
case 19:
|
481
|
-
|
495
|
+
_v.conversation = (_x.sent());
|
482
496
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.StartChat, {
|
483
497
|
RequestId: this.requestId,
|
484
498
|
ChatId: this.chatToken.chatId
|
485
499
|
});
|
486
500
|
return [3 /*break*/, 21];
|
487
501
|
case 20:
|
488
|
-
error_5 =
|
502
|
+
error_5 = _x.sent();
|
489
503
|
exceptionDetails = {
|
490
504
|
response: "ACSClientJoinConversationFailed"
|
491
505
|
};
|
@@ -497,15 +511,15 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
497
511
|
console.error("OmnichannelChatSDK/startChat/joinConversation/error " + error_5);
|
498
512
|
throw Error(exceptionDetails.response);
|
499
513
|
case 21:
|
500
|
-
|
501
|
-
return [4 /*yield*/, ((
|
514
|
+
_x.trys.push([21, 23, , 24]);
|
515
|
+
return [4 /*yield*/, ((_q = this.AMSClient) === null || _q === void 0 ? void 0 : _q.initialize({
|
502
516
|
chatToken: this.chatToken
|
503
517
|
}))];
|
504
518
|
case 22:
|
505
|
-
|
519
|
+
_x.sent();
|
506
520
|
return [3 /*break*/, 24];
|
507
521
|
case 23:
|
508
|
-
error_6 =
|
522
|
+
error_6 = _x.sent();
|
509
523
|
exceptionDetails = {
|
510
524
|
response: "AMSClientInitializeFailed"
|
511
525
|
};
|
@@ -517,17 +531,17 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
517
531
|
throw Error(exceptionDetails.response);
|
518
532
|
case 24: return [3 /*break*/, 31];
|
519
533
|
case 25:
|
520
|
-
|
534
|
+
_x.trys.push([25, 27, , 28]);
|
521
535
|
return [4 /*yield*/, this.IC3Client.initialize({
|
522
536
|
token: this.chatToken.token,
|
523
537
|
regionGtms: this.chatToken.regionGTMS,
|
524
538
|
visitor: true
|
525
539
|
})];
|
526
540
|
case 26:
|
527
|
-
|
541
|
+
_x.sent();
|
528
542
|
return [3 /*break*/, 28];
|
529
543
|
case 27:
|
530
|
-
error_7 =
|
544
|
+
error_7 = _x.sent();
|
531
545
|
exceptionDetails = {
|
532
546
|
response: "IC3ClientInitializeFailed"
|
533
547
|
};
|
@@ -539,18 +553,18 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
539
553
|
console.error("OmnichannelChatSDK/startChat/initialize/error " + error_7);
|
540
554
|
return [2 /*return*/, error_7];
|
541
555
|
case 28:
|
542
|
-
|
543
|
-
|
556
|
+
_x.trys.push([28, 30, , 31]);
|
557
|
+
_w = this;
|
544
558
|
return [4 /*yield*/, this.IC3Client.joinConversation(this.chatToken.chatId)];
|
545
559
|
case 29:
|
546
|
-
|
560
|
+
_w.conversation = _x.sent();
|
547
561
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.StartChat, {
|
548
562
|
RequestId: this.requestId,
|
549
563
|
ChatId: this.chatToken.chatId
|
550
564
|
});
|
551
565
|
return [3 /*break*/, 31];
|
552
566
|
case 30:
|
553
|
-
error_8 =
|
567
|
+
error_8 = _x.sent();
|
554
568
|
exceptionDetails = {
|
555
569
|
response: "IC3ClientJoinConversationFailed"
|
556
570
|
};
|
@@ -562,7 +576,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
562
576
|
console.error("OmnichannelChatSDK/startChat/joinConversation/error " + error_8);
|
563
577
|
return [2 /*return*/, error_8];
|
564
578
|
case 31:
|
565
|
-
if (this.isPersistentChat && !((
|
579
|
+
if (this.isPersistentChat && !((_r = this.chatSDKConfig.persistentChat) === null || _r === void 0 ? void 0 : _r.disable)) {
|
566
580
|
this.refreshTokenTimer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
567
581
|
return __generator(this, function (_a) {
|
568
582
|
switch (_a.label) {
|
@@ -573,7 +587,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
573
587
|
return [2 /*return*/];
|
574
588
|
}
|
575
589
|
});
|
576
|
-
}); }, (
|
590
|
+
}); }, (_s = this.chatSDKConfig.persistentChat) === null || _s === void 0 ? void 0 : _s.tokenUpdateTime);
|
577
591
|
}
|
578
592
|
return [2 /*return*/];
|
579
593
|
}
|
@@ -581,11 +595,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
581
595
|
});
|
582
596
|
};
|
583
597
|
OmnichannelChatSDK.prototype.endChat = function () {
|
584
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
598
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
585
599
|
return __awaiter(this, void 0, void 0, function () {
|
586
600
|
var sessionCloseOptionalParams, isReconnectChat, isChatReconnect, error_9, exceptionDetails;
|
587
|
-
return __generator(this, function (
|
588
|
-
switch (
|
601
|
+
return __generator(this, function (_p) {
|
602
|
+
switch (_p.label) {
|
589
603
|
case 0:
|
590
604
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.EndChat, {
|
591
605
|
RequestId: this.requestId,
|
@@ -605,12 +619,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
605
619
|
if (this.authenticatedUserToken) {
|
606
620
|
sessionCloseOptionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
607
621
|
}
|
608
|
-
|
622
|
+
_p.label = 1;
|
609
623
|
case 1:
|
610
|
-
|
624
|
+
_p.trys.push([1, 3, , 4]);
|
611
625
|
return [4 /*yield*/, this.OCClient.sessionClose(this.requestId, sessionCloseOptionalParams)];
|
612
626
|
case 2:
|
613
|
-
|
627
|
+
_p.sent();
|
614
628
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.EndChat, {
|
615
629
|
RequestId: this.requestId,
|
616
630
|
ChatId: this.chatToken.chatId
|
@@ -620,9 +634,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
620
634
|
this.requestId = ocsdk_1.uuidv4();
|
621
635
|
this.chatToken = {};
|
622
636
|
this.reconnectId = null;
|
623
|
-
this.IC3Client
|
624
|
-
|
625
|
-
|
637
|
+
if (this.IC3Client) {
|
638
|
+
this.IC3Client.dispose();
|
639
|
+
!platform_1.default.isNode() && !platform_1.default.isReactNative() && WebUtils_1.removeElementById(this.IC3Client.id);
|
640
|
+
this.IC3Client = null;
|
641
|
+
}
|
626
642
|
(_d = this.ic3ClientLogger) === null || _d === void 0 ? void 0 : _d.setRequestId(this.requestId);
|
627
643
|
(_e = this.ic3ClientLogger) === null || _e === void 0 ? void 0 : _e.setChatId('');
|
628
644
|
(_f = this.ocSdkLogger) === null || _f === void 0 ? void 0 : _f.setRequestId(this.requestId);
|
@@ -631,9 +647,11 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
631
647
|
(_j = this.acsClientLogger) === null || _j === void 0 ? void 0 : _j.setChatId('');
|
632
648
|
(_k = this.acsAdapterLogger) === null || _k === void 0 ? void 0 : _k.setRequestId(this.requestId);
|
633
649
|
(_l = this.acsAdapterLogger) === null || _l === void 0 ? void 0 : _l.setChatId('');
|
650
|
+
(_m = this.callingSdkLogger) === null || _m === void 0 ? void 0 : _m.setRequestId(this.requestId);
|
651
|
+
(_o = this.callingSdkLogger) === null || _o === void 0 ? void 0 : _o.setChatId('');
|
634
652
|
return [3 /*break*/, 4];
|
635
653
|
case 3:
|
636
|
-
error_9 =
|
654
|
+
error_9 = _p.sent();
|
637
655
|
exceptionDetails = {
|
638
656
|
response: "OCClientSessionCloseFailed"
|
639
657
|
};
|
@@ -684,23 +702,33 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
684
702
|
});
|
685
703
|
};
|
686
704
|
OmnichannelChatSDK.prototype.getConversationDetails = function () {
|
687
|
-
var _a, _b;
|
705
|
+
var _a, _b, _c, _d;
|
688
706
|
return __awaiter(this, void 0, void 0, function () {
|
689
|
-
var lwiDetails, state, conversationId, agentAcceptedOn, liveWorkItemDetails, error_10;
|
690
|
-
return __generator(this, function (
|
691
|
-
switch (
|
707
|
+
var getLWIDetailsOptionalParams, lwiDetails, state, conversationId, agentAcceptedOn, canRenderPostChat, participantType, liveWorkItemDetails, error_10;
|
708
|
+
return __generator(this, function (_e) {
|
709
|
+
switch (_e.label) {
|
692
710
|
case 0:
|
693
711
|
this.scenarioMarker.startScenario(TelemetryEvent_1.default.GetConversationDetails, {
|
694
712
|
RequestId: this.requestId,
|
695
713
|
ChatId: ((_a = this.chatToken) === null || _a === void 0 ? void 0 : _a.chatId) || '',
|
696
714
|
});
|
697
|
-
|
715
|
+
getLWIDetailsOptionalParams = {};
|
716
|
+
if (this.isPersistentChat && !((_b = this.chatSDKConfig.persistentChat) === null || _b === void 0 ? void 0 : _b.disable) && this.reconnectId) {
|
717
|
+
getLWIDetailsOptionalParams.reconnectId = this.reconnectId;
|
718
|
+
}
|
719
|
+
if (this.isChatReconnect && !((_c = this.chatSDKConfig.chatReconnect) === null || _c === void 0 ? void 0 : _c.disable) && !this.isPersistentChat && this.reconnectId) {
|
720
|
+
getLWIDetailsOptionalParams.reconnectId = this.reconnectId;
|
721
|
+
}
|
722
|
+
if (this.authenticatedUserToken) {
|
723
|
+
getLWIDetailsOptionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
724
|
+
}
|
725
|
+
_e.label = 1;
|
698
726
|
case 1:
|
699
|
-
|
700
|
-
return [4 /*yield*/, this.OCClient.getLWIDetails(this.requestId)];
|
727
|
+
_e.trys.push([1, 3, , 4]);
|
728
|
+
return [4 /*yield*/, this.OCClient.getLWIDetails(this.requestId, getLWIDetailsOptionalParams)];
|
701
729
|
case 2:
|
702
|
-
lwiDetails =
|
703
|
-
state = lwiDetails.State, conversationId = lwiDetails.ConversationId, agentAcceptedOn = lwiDetails.AgentAcceptedOn;
|
730
|
+
lwiDetails = _e.sent();
|
731
|
+
state = lwiDetails.State, conversationId = lwiDetails.ConversationId, agentAcceptedOn = lwiDetails.AgentAcceptedOn, canRenderPostChat = lwiDetails.CanRenderPostChat, participantType = lwiDetails.ParticipantType;
|
704
732
|
liveWorkItemDetails = {
|
705
733
|
state: state,
|
706
734
|
conversationId: conversationId
|
@@ -708,13 +736,19 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
708
736
|
if (agentAcceptedOn) {
|
709
737
|
liveWorkItemDetails.agentAcceptedOn = agentAcceptedOn;
|
710
738
|
}
|
739
|
+
if (canRenderPostChat) {
|
740
|
+
liveWorkItemDetails.canRenderPostChat = canRenderPostChat;
|
741
|
+
}
|
742
|
+
if (participantType) {
|
743
|
+
liveWorkItemDetails.participantType = participantType;
|
744
|
+
}
|
711
745
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.GetConversationDetails, {
|
712
746
|
RequestId: this.requestId,
|
713
|
-
ChatId: ((
|
747
|
+
ChatId: ((_d = this.chatToken) === null || _d === void 0 ? void 0 : _d.chatId) || '',
|
714
748
|
});
|
715
749
|
return [2 /*return*/, liveWorkItemDetails];
|
716
750
|
case 3:
|
717
|
-
error_10 =
|
751
|
+
error_10 = _e.sent();
|
718
752
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetConversationDetails, {
|
719
753
|
RequestId: this.requestId,
|
720
754
|
ChatId: this.chatToken.chatId || '',
|
@@ -1536,17 +1570,20 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1536
1570
|
}
|
1537
1571
|
if (protocol === ChatAdapterProtocols_1.default.ACS || this.liveChatVersion === LiveChatVersion_1.default.V2) {
|
1538
1572
|
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
1539
|
-
var options,
|
1573
|
+
var options, defaultEgressMiddlewares, defaultIngressMiddlewares, egressMiddleware, ingressMiddleware, featuresOption, acsAdapterCDNUrl;
|
1540
1574
|
var _this = this;
|
1541
1575
|
var _a;
|
1542
1576
|
return __generator(this, function (_b) {
|
1543
1577
|
switch (_b.label) {
|
1544
1578
|
case 0:
|
1545
1579
|
options = optionalParams.ACSAdapter ? optionalParams.ACSAdapter.options : {};
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
);
|
1580
|
+
defaultEgressMiddlewares = [createChannelDataEgressMiddleware_1.default({ widgetId: this.omnichannelConfig.widgetId }), createFormatEgressTagsMiddleware_1.default()];
|
1581
|
+
defaultIngressMiddlewares = [createFormatIngressTagsMiddleware_1.default()];
|
1582
|
+
egressMiddleware = (options === null || options === void 0 ? void 0 : options.egressMiddleware) ? __spreadArrays(options.egressMiddleware, defaultEgressMiddlewares) : __spreadArrays(defaultEgressMiddlewares);
|
1583
|
+
ingressMiddleware = (options === null || options === void 0 ? void 0 : options.ingressMiddleware) ? __spreadArrays(options.egressMiddleware, defaultIngressMiddlewares) : __spreadArrays(defaultIngressMiddlewares);
|
1584
|
+
featuresOption = __assign(__assign({ enableAdaptiveCards: true, enableThreadMemberUpdateNotification: true, enableLeaveThreadOnWindowClosed: false }, options), { // overrides
|
1585
|
+
ingressMiddleware: ingressMiddleware,
|
1586
|
+
egressMiddleware: egressMiddleware });
|
1550
1587
|
acsAdapterCDNUrl = this.resolveChatAdapterUrl(protocol || ChatAdapterProtocols_1.default.ACS);
|
1551
1588
|
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.setCDNPackages({
|
1552
1589
|
ACSAdapter: acsAdapterCDNUrl
|
@@ -1557,8 +1594,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1557
1594
|
try {
|
1558
1595
|
var ChatAdapter = window.ChatAdapter; // eslint-disable-line @typescript-eslint/no-explicit-any
|
1559
1596
|
var fileManager = new AMSFileManager_1.default(_this.AMSClient, _this.acsAdapterLogger);
|
1560
|
-
var adapter = ChatAdapter.createACSAdapter(_this.chatToken.token, _this.chatToken.visitorId || 'teamsvisitor', _this.chatToken.chatId, _this.chatToken.acsEndpoint, fileManager,
|
1561
|
-
|
1597
|
+
var adapter = ChatAdapter.createACSAdapter(_this.chatToken.token, _this.chatToken.visitorId || 'teamsvisitor', _this.chatToken.chatId, _this.chatToken.acsEndpoint, fileManager, ACSParticipantDisplayName_1.default.Customer, undefined, // chatClient
|
1598
|
+
_this.acsAdapterLogger, // logger
|
1562
1599
|
featuresOption);
|
1563
1600
|
resolve(adapter);
|
1564
1601
|
}
|
@@ -1616,16 +1653,31 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1616
1653
|
OmnichannelChatSDK.prototype.getVoiceVideoCalling = function (params) {
|
1617
1654
|
if (params === void 0) { params = {}; }
|
1618
1655
|
return __awaiter(this, void 0, void 0, function () {
|
1619
|
-
var chatConfig, liveWSAndLiveChatEngJoin, msdyn_widgetsnippet, widgetSnippetSourceRegex, result;
|
1656
|
+
var exceptionDetails, exceptionDetails, chatConfig, liveWSAndLiveChatEngJoin, msdyn_widgetsnippet, widgetSnippetSourceRegex, result;
|
1620
1657
|
var _this = this;
|
1621
1658
|
return __generator(this, function (_a) {
|
1622
1659
|
switch (_a.label) {
|
1623
1660
|
case 0:
|
1661
|
+
this.scenarioMarker.startScenario(TelemetryEvent_1.default.GetVoiceVideoCalling);
|
1624
1662
|
if (platform_1.default.isNode() || platform_1.default.isReactNative()) {
|
1625
|
-
|
1663
|
+
exceptionDetails = {
|
1664
|
+
response: "UnsupportedPlatform",
|
1665
|
+
message: "VoiceVideoCalling is only supported on browser"
|
1666
|
+
};
|
1667
|
+
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetVoiceVideoCalling, {
|
1668
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
1669
|
+
});
|
1670
|
+
throw new Error(exceptionDetails.response);
|
1626
1671
|
}
|
1627
1672
|
if (this.callingOption.toString() === CallingOptionsOptionSetNumber_1.default.NoCalling.toString()) {
|
1628
|
-
|
1673
|
+
exceptionDetails = {
|
1674
|
+
response: "FeatureDisabled",
|
1675
|
+
message: "Voice and video call is not enabled"
|
1676
|
+
};
|
1677
|
+
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetVoiceVideoCalling, {
|
1678
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
1679
|
+
});
|
1680
|
+
throw new Error(exceptionDetails.response);
|
1629
1681
|
}
|
1630
1682
|
return [4 /*yield*/, this.getChatConfig()];
|
1631
1683
|
case 1:
|
@@ -1635,25 +1687,27 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1635
1687
|
widgetSnippetSourceRegex = new RegExp("src=\"(https:\\/\\/[\\w-.]+)[\\w-.\\/]+\"");
|
1636
1688
|
result = msdyn_widgetsnippet.match(widgetSnippetSourceRegex);
|
1637
1689
|
if (result && result.length) {
|
1638
|
-
return [2 /*return*/, new Promise(function (resolve
|
1639
|
-
var LiveChatWidgetLibCDNUrl;
|
1690
|
+
return [2 /*return*/, new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
1691
|
+
var LiveChatWidgetLibCDNUrl, defaultParams;
|
1640
1692
|
var _this = this;
|
1641
1693
|
var _a;
|
1642
1694
|
return __generator(this, function (_b) {
|
1643
1695
|
switch (_b.label) {
|
1644
1696
|
case 0:
|
1645
|
-
this.scenarioMarker.startScenario(TelemetryEvent_1.default.GetVoiceVideoCalling);
|
1646
1697
|
LiveChatWidgetLibCDNUrl = result[1] + "/livechatwidget/WebChatControl/lib/CallingBundle.js";
|
1647
1698
|
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.setCDNPackages({
|
1648
1699
|
VoiceVideoCalling: LiveChatWidgetLibCDNUrl
|
1649
1700
|
});
|
1701
|
+
defaultParams = {
|
1702
|
+
logger: this.callingSdkLogger
|
1703
|
+
};
|
1650
1704
|
return [4 /*yield*/, WebUtils_1.loadScript(LiveChatWidgetLibCDNUrl, function () { return __awaiter(_this, void 0, void 0, function () {
|
1651
1705
|
var VoiceVideoCalling;
|
1652
1706
|
return __generator(this, function (_a) {
|
1653
1707
|
switch (_a.label) {
|
1654
1708
|
case 0:
|
1655
1709
|
this.debug && console.debug(LiveChatWidgetLibCDNUrl + " loaded!");
|
1656
|
-
return [4 /*yield*/, createVoiceVideoCalling_1.default(params)];
|
1710
|
+
return [4 /*yield*/, createVoiceVideoCalling_1.default(__assign(__assign({}, params), defaultParams))];
|
1657
1711
|
case 1:
|
1658
1712
|
VoiceVideoCalling = _a.sent();
|
1659
1713
|
this.scenarioMarker.completeScenario(TelemetryEvent_1.default.GetVoiceVideoCalling);
|
@@ -1666,13 +1720,13 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1666
1720
|
var exceptionDetails;
|
1667
1721
|
return __generator(this, function (_a) {
|
1668
1722
|
exceptionDetails = {
|
1669
|
-
response: "VoiceVideoCallingLoadFailed"
|
1723
|
+
response: "VoiceVideoCallingLoadFailed",
|
1724
|
+
message: "Failed to load VoiceVideoCalling"
|
1670
1725
|
};
|
1671
1726
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetVoiceVideoCalling, {
|
1672
1727
|
ExceptionDetails: JSON.stringify(exceptionDetails)
|
1673
1728
|
});
|
1674
|
-
|
1675
|
-
return [2 /*return*/];
|
1729
|
+
throw new Error(exceptionDetails.response);
|
1676
1730
|
});
|
1677
1731
|
}); })];
|
1678
1732
|
case 1:
|
@@ -1689,7 +1743,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1689
1743
|
};
|
1690
1744
|
OmnichannelChatSDK.prototype.getPostChatSurveyContext = function () {
|
1691
1745
|
return __awaiter(this, void 0, void 0, function () {
|
1692
|
-
var conversationId, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, postConversationSurveyOwnerId, liveWorkItemDetails, participantJoined, surveyInviteLinkRequest, optionalParams, surveyInviteLinkResponse, surveyInviteLink, formsProLocale, postChatContext, ex_1;
|
1746
|
+
var conversationId, chatConfig, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId, postConversationBotSurveyOwnerId, liveWorkItemDetails, participantJoined, participantType, surveyInviteLinkRequest, optionalParams, ownerId, surveyInviteLinkResponse, surveyInviteLink, formsProLocale, postChatContext, ex_1;
|
1693
1747
|
return __generator(this, function (_a) {
|
1694
1748
|
switch (_a.label) {
|
1695
1749
|
case 0:
|
@@ -1699,18 +1753,20 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1699
1753
|
_a.label = 1;
|
1700
1754
|
case 1:
|
1701
1755
|
_a.trys.push([1, 6, , 7]);
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
return [
|
1756
|
+
chatConfig = this.liveChatConfig;
|
1757
|
+
liveWSAndLiveChatEngJoin = chatConfig.LiveWSAndLiveChatEngJoin;
|
1758
|
+
msdyn_postconversationsurveyenable = liveWSAndLiveChatEngJoin.msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier = liveWSAndLiveChatEngJoin.msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier = liveWSAndLiveChatEngJoin.msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId = liveWSAndLiveChatEngJoin.postConversationSurveyOwnerId, postConversationBotSurveyOwnerId = liveWSAndLiveChatEngJoin.postConversationBotSurveyOwnerId;
|
1759
|
+
if (!(msdyn_postconversationsurveyenable === "true")) return [3 /*break*/, 4];
|
1760
|
+
return [4 /*yield*/, this.getConversationDetails()];
|
1706
1761
|
case 2:
|
1707
1762
|
liveWorkItemDetails = _a.sent();
|
1708
|
-
participantJoined = (liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.
|
1709
|
-
|
1763
|
+
participantJoined = (liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.canRenderPostChat) === "True";
|
1764
|
+
participantType = liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.participantType;
|
1765
|
+
conversationId = liveWorkItemDetails === null || liveWorkItemDetails === void 0 ? void 0 : liveWorkItemDetails.conversationId;
|
1710
1766
|
surveyInviteLinkRequest = {
|
1711
|
-
"FormId": msfp_sourcesurveyidentifier,
|
1767
|
+
"FormId": participantType === "Bot" ? msfp_botsourcesurveyidentifier : msfp_sourcesurveyidentifier,
|
1712
1768
|
"ConversationId": conversationId,
|
1713
|
-
"OCLocaleCode": locale_1.getLocaleStringFromId(this.localeId)
|
1769
|
+
"OCLocaleCode": locale_1.getLocaleStringFromId(this.localeId)
|
1714
1770
|
};
|
1715
1771
|
optionalParams = {
|
1716
1772
|
"requestId": this.requestId
|
@@ -1718,7 +1774,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1718
1774
|
if (this.authenticatedUserToken) {
|
1719
1775
|
optionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
1720
1776
|
}
|
1721
|
-
|
1777
|
+
ownerId = participantType === "Bot" ? postConversationBotSurveyOwnerId : postConversationSurveyOwnerId;
|
1778
|
+
return [4 /*yield*/, this.OCClient.getSurveyInviteLink(ownerId, surveyInviteLinkRequest, optionalParams)];
|
1722
1779
|
case 3:
|
1723
1780
|
surveyInviteLinkResponse = _a.sent();
|
1724
1781
|
surveyInviteLink = void 0, formsProLocale = void 0;
|
@@ -1739,6 +1796,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1739
1796
|
}
|
1740
1797
|
postChatContext = {
|
1741
1798
|
participantJoined: participantJoined,
|
1799
|
+
participantType: participantType,
|
1742
1800
|
surveyInviteLink: surveyInviteLink,
|
1743
1801
|
formsProLocale: formsProLocale
|
1744
1802
|
};
|
@@ -1763,7 +1821,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
|
|
1763
1821
|
case 6:
|
1764
1822
|
ex_1 = _a.sent();
|
1765
1823
|
this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
|
1766
|
-
ConversationId: conversationId,
|
1824
|
+
ConversationId: conversationId !== null && conversationId !== void 0 ? conversationId : "",
|
1767
1825
|
RequestId: this.requestId,
|
1768
1826
|
ExceptionDetails: JSON.stringify(ex_1)
|
1769
1827
|
});
|