@microsoft/omnichannel-chat-sdk 1.11.7-main.e13c432 → 1.11.7-main.f31f9b6

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.
@@ -1202,13 +1202,24 @@ var OmnichannelChatSDK = /** @class */ (function () {
1202
1202
  case 26:
1203
1203
  if (this.isPersistentChat && !((_l = this.chatSDKConfig.persistentChat) === null || _l === void 0 ? void 0 : _l.disable)) {
1204
1204
  this.refreshTokenTimer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
1205
+ var error_13;
1205
1206
  return __generator(this, function (_a) {
1206
1207
  switch (_a.label) {
1207
- case 0: return [4 /*yield*/, this.getChatToken(false)];
1208
+ case 0:
1209
+ _a.trys.push([0, 2, , 3]);
1210
+ return [4 /*yield*/, this.getChatToken(false)];
1208
1211
  case 1:
1209
1212
  _a.sent();
1210
1213
  this.updateChatToken(this.chatToken.token, this.chatToken.regionGTMS);
1211
- return [2 /*return*/];
1214
+ return [3 /*break*/, 3];
1215
+ case 2:
1216
+ error_13 = _a.sent();
1217
+ if (this.refreshTokenTimer !== null) {
1218
+ clearInterval(this.refreshTokenTimer);
1219
+ this.refreshTokenTimer = null;
1220
+ }
1221
+ return [3 /*break*/, 3];
1222
+ case 3: return [2 /*return*/];
1212
1223
  }
1213
1224
  });
1214
1225
  }); }, (_m = this.chatSDKConfig.persistentChat) === null || _m === void 0 ? void 0 : _m.tokenUpdateTime);
@@ -1220,7 +1231,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1220
1231
  };
1221
1232
  OmnichannelChatSDK.prototype.closeChat = function (endChatOptionalParams) {
1222
1233
  return __awaiter(this, void 0, void 0, function () {
1223
- var cleanupMetadata, sessionCloseOptionalParams, isReconnectChat, isChatReconnect, error_13;
1234
+ var cleanupMetadata, sessionCloseOptionalParams, isReconnectChat, isChatReconnect, error_14;
1224
1235
  var _a, _b;
1225
1236
  return __generator(this, function (_c) {
1226
1237
  switch (_c.label) {
@@ -1255,8 +1266,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
1255
1266
  _c.sent();
1256
1267
  return [3 /*break*/, 4];
1257
1268
  case 3:
1258
- error_13 = _c.sent();
1259
- exceptionThrowers_1.default.throwConversationClosureFailure(error_13, this.scenarioMarker, TelemetryEvent_1.default.CloseChatSession, __assign(__assign({}, cleanupMetadata), { isSessionEnded: String(!(endChatOptionalParams === null || endChatOptionalParams === void 0 ? void 0 : endChatOptionalParams.isSessionEnded)) }));
1269
+ error_14 = _c.sent();
1270
+ exceptionThrowers_1.default.throwConversationClosureFailure(error_14, this.scenarioMarker, TelemetryEvent_1.default.CloseChatSession, __assign(__assign({}, cleanupMetadata), { isSessionEnded: String(!(endChatOptionalParams === null || endChatOptionalParams === void 0 ? void 0 : endChatOptionalParams.isSessionEnded)) }));
1260
1271
  return [3 /*break*/, 4];
1261
1272
  case 4:
1262
1273
  this.scenarioMarker.completeScenario(TelemetryEvent_1.default.CloseChatSession, cleanupMetadata);
@@ -1277,7 +1288,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1277
1288
  };
1278
1289
  OmnichannelChatSDK.prototype.internalEndChat = function () {
1279
1290
  return __awaiter(this, arguments, void 0, function (endChatOptionalParams) {
1280
- var cleanupMetadata, error_14, telemetryData;
1291
+ var cleanupMetadata, error_15, telemetryData;
1281
1292
  var _a;
1282
1293
  if (endChatOptionalParams === void 0) { endChatOptionalParams = {}; }
1283
1294
  return __generator(this, function (_b) {
@@ -1327,15 +1338,15 @@ var OmnichannelChatSDK = /** @class */ (function () {
1327
1338
  this.scenarioMarker.completeScenario(TelemetryEvent_1.default.EndChat, cleanupMetadata);
1328
1339
  return [3 /*break*/, 7];
1329
1340
  case 6:
1330
- error_14 = _b.sent();
1341
+ error_15 = _b.sent();
1331
1342
  telemetryData = {
1332
1343
  RequestId: this.requestId,
1333
1344
  ChatId: this.chatToken.chatId
1334
1345
  };
1335
- if (error_14 instanceof ChatSDKError_1.ChatSDKError) {
1336
- exceptionThrowers_1.default.throwConversationClosureFailure(new Error(JSON.stringify(error_14.exceptionDetails)), this.scenarioMarker, TelemetryEvent_1.default.EndChat, telemetryData);
1346
+ if (error_15 instanceof ChatSDKError_1.ChatSDKError) {
1347
+ exceptionThrowers_1.default.throwConversationClosureFailure(new Error(JSON.stringify(error_15.exceptionDetails)), this.scenarioMarker, TelemetryEvent_1.default.EndChat, telemetryData);
1337
1348
  }
1338
- exceptionThrowers_1.default.throwConversationClosureFailure(error_14, this.scenarioMarker, TelemetryEvent_1.default.EndChat, telemetryData);
1349
+ exceptionThrowers_1.default.throwConversationClosureFailure(error_15, this.scenarioMarker, TelemetryEvent_1.default.EndChat, telemetryData);
1339
1350
  return [3 /*break*/, 7];
1340
1351
  case 7: return [2 /*return*/];
1341
1352
  }
@@ -1382,7 +1393,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1382
1393
  };
1383
1394
  OmnichannelChatSDK.prototype.getConversationDetails = function () {
1384
1395
  return __awaiter(this, arguments, void 0, function (optionalParams) {
1385
- var requestId, chatToken, chatId, reconnectId, sessionId, getLWIDetailsOptionalParams, lwiDetails, state, conversationId, agentAcceptedOn, canRenderPostChat, participantType, liveWorkItemDetails, error_15, telemetryData;
1396
+ var requestId, chatToken, chatId, reconnectId, sessionId, getLWIDetailsOptionalParams, lwiDetails, state, conversationId, agentAcceptedOn, canRenderPostChat, participantType, liveWorkItemDetails, error_16, telemetryData;
1386
1397
  var _a, _b, _c, _d;
1387
1398
  if (optionalParams === void 0) { optionalParams = {}; }
1388
1399
  return __generator(this, function (_e) {
@@ -1455,15 +1466,15 @@ var OmnichannelChatSDK = /** @class */ (function () {
1455
1466
  });
1456
1467
  return [2 /*return*/, liveWorkItemDetails];
1457
1468
  case 3:
1458
- error_15 = _e.sent();
1469
+ error_16 = _e.sent();
1459
1470
  telemetryData = {
1460
1471
  RequestId: requestId,
1461
1472
  ChatId: chatId
1462
1473
  };
1463
- if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_15)) {
1464
- exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_15, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
1474
+ if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_16)) {
1475
+ exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_16, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
1465
1476
  }
1466
- exceptionSuppressors_1.default.suppressConversationDetailsRetrievalFailure(error_15, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
1477
+ exceptionSuppressors_1.default.suppressConversationDetailsRetrievalFailure(error_16, this.scenarioMarker, TelemetryEvent_1.default.GetConversationDetails, telemetryData);
1467
1478
  return [3 /*break*/, 4];
1468
1479
  case 4: return [2 /*return*/, {}];
1469
1480
  }
@@ -1504,7 +1515,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1504
1515
  };
1505
1516
  OmnichannelChatSDK.prototype.getChatToken = function () {
1506
1517
  return __awaiter(this, arguments, void 0, function (cached, optionalParams) {
1507
- var getChatTokenOptionalParams, chatToken, error_16, telemetryData;
1518
+ var getChatTokenOptionalParams, chatToken, error_17, telemetryData;
1508
1519
  var _a, _b, _c;
1509
1520
  if (cached === void 0) { cached = true; }
1510
1521
  return __generator(this, function (_d) {
@@ -1546,16 +1557,16 @@ var OmnichannelChatSDK = /** @class */ (function () {
1546
1557
  });
1547
1558
  return [3 /*break*/, 4];
1548
1559
  case 3:
1549
- error_16 = _d.sent();
1560
+ error_17 = _d.sent();
1550
1561
  telemetryData = {
1551
1562
  RequestId: this.requestId,
1552
1563
  ChatId: (_c = this.chatToken) === null || _c === void 0 ? void 0 : _c.chatId,
1553
1564
  };
1554
- if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_16)) {
1555
- exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_16, this.scenarioMarker, TelemetryEvent_1.default.GetChatToken, telemetryData);
1565
+ if ((0, utilities_1.isClientIdNotFoundErrorMessage)(error_17)) {
1566
+ exceptionThrowers_1.default.throwAuthContactIdNotFoundFailure(error_17, this.scenarioMarker, TelemetryEvent_1.default.GetChatToken, telemetryData);
1556
1567
  }
1557
1568
  else {
1558
- exceptionThrowers_1.default.throwChatTokenRetrievalFailure(error_16, this.scenarioMarker, TelemetryEvent_1.default.GetChatToken, telemetryData);
1569
+ exceptionThrowers_1.default.throwChatTokenRetrievalFailure(error_17, this.scenarioMarker, TelemetryEvent_1.default.GetChatToken, telemetryData);
1559
1570
  }
1560
1571
  return [3 /*break*/, 4];
1561
1572
  case 4: return [3 /*break*/, 6];
@@ -1714,7 +1725,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1714
1725
  };
1715
1726
  OmnichannelChatSDK.prototype.sendMessage = function (message) {
1716
1727
  return __awaiter(this, void 0, void 0, function () {
1717
- var sendMessageRequest, chatMessage, error_17, exceptionDetails;
1728
+ var sendMessageRequest, chatMessage, error_18, exceptionDetails;
1718
1729
  var _a;
1719
1730
  return __generator(this, function (_b) {
1720
1731
  switch (_b.label) {
@@ -1749,10 +1760,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
1749
1760
  });
1750
1761
  return [2 /*return*/, chatMessage];
1751
1762
  case 3:
1752
- error_17 = _b.sent();
1763
+ error_18 = _b.sent();
1753
1764
  exceptionDetails = {
1754
1765
  response: ChatSDKError_1.ChatSDKErrorName.ChatSDKSendMessageFailed,
1755
- errorObject: "".concat(error_17)
1766
+ errorObject: "".concat(error_18)
1756
1767
  };
1757
1768
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.SendMessages, {
1758
1769
  RequestId: this.requestId,
@@ -1761,7 +1772,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1761
1772
  });
1762
1773
  throw new ChatSDKError_1.ChatSDKError(ChatSDKError_1.ChatSDKErrorName.ChatSDKSendMessageFailed, undefined, {
1763
1774
  response: ChatSDKError_1.ChatSDKErrorName.ChatSDKSendMessageFailed,
1764
- errorObject: "".concat(error_17)
1775
+ errorObject: "".concat(error_18)
1765
1776
  });
1766
1777
  case 4: return [2 /*return*/];
1767
1778
  }
@@ -1847,7 +1858,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1847
1858
  };
1848
1859
  OmnichannelChatSDK.prototype.sendTypingEvent = function () {
1849
1860
  return __awaiter(this, void 0, void 0, function () {
1850
- var error_18;
1861
+ var error_19;
1851
1862
  return __generator(this, function (_a) {
1852
1863
  switch (_a.label) {
1853
1864
  case 0:
@@ -1876,7 +1887,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1876
1887
  });
1877
1888
  return [3 /*break*/, 5];
1878
1889
  case 4:
1879
- error_18 = _a.sent();
1890
+ error_19 = _a.sent();
1880
1891
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.SendTypingEvent, {
1881
1892
  RequestId: this.requestId,
1882
1893
  ChatId: this.chatToken.chatId
@@ -1985,7 +1996,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
1985
1996
  };
1986
1997
  OmnichannelChatSDK.prototype.uploadFileAttachment = function (fileInfo) {
1987
1998
  return __awaiter(this, void 0, void 0, function () {
1988
- var amsClient, createObjectResponse, documentId, uploadDocumentResponse, fileIdsProperty, fileMetaProperty, sendMessageRequest, messageToSend, error_19, fileMetadata, messageToSend, error_20;
1999
+ var amsClient, createObjectResponse, documentId, uploadDocumentResponse, fileIdsProperty, fileMetaProperty, sendMessageRequest, messageToSend, error_20, fileMetadata, messageToSend, error_21;
1989
2000
  var _a, _b;
1990
2001
  return __generator(this, function (_c) {
1991
2002
  switch (_c.label) {
@@ -2054,7 +2065,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2054
2065
  });
2055
2066
  return [2 /*return*/, messageToSend];
2056
2067
  case 6:
2057
- error_19 = _c.sent();
2068
+ error_20 = _c.sent();
2058
2069
  console.error("OmnichannelChatSDK/uploadFileAttachment/sendMessage/error");
2059
2070
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.UploadFileAttachment, {
2060
2071
  RequestId: this.requestId,
@@ -2100,8 +2111,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2100
2111
  });
2101
2112
  return [2 /*return*/, messageToSend];
2102
2113
  case 15:
2103
- error_20 = _c.sent();
2104
- console.error("OmnichannelChatSDK/uploadFileAttachment/error: ".concat(error_20));
2114
+ error_21 = _c.sent();
2115
+ console.error("OmnichannelChatSDK/uploadFileAttachment/error: ".concat(error_21));
2105
2116
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.UploadFileAttachment, {
2106
2117
  RequestId: this.requestId,
2107
2118
  ChatId: this.chatToken.chatId
@@ -2114,9 +2125,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
2114
2125
  };
2115
2126
  OmnichannelChatSDK.prototype.downloadFileAttachment = function (fileMetadata) {
2116
2127
  return __awaiter(this, void 0, void 0, function () {
2117
- var amsClient, response, view_location, viewResponse, _a, downloadedFile, error_21;
2118
- return __generator(this, function (_b) {
2119
- switch (_b.label) {
2128
+ var amsClient, response, view_location, viewResponse, ex_1, downloadedFile, error_22;
2129
+ return __generator(this, function (_a) {
2130
+ switch (_a.label) {
2120
2131
  case 0:
2121
2132
  this.scenarioMarker.startScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2122
2133
  RequestId: this.requestId,
@@ -2126,9 +2137,9 @@ var OmnichannelChatSDK = /** @class */ (function () {
2126
2137
  exceptionThrowers_1.default.throwUninitializedChatSDK(this.scenarioMarker, TelemetryEvent_1.default.DownloadFileAttachment);
2127
2138
  }
2128
2139
  if (!(this.liveChatVersion === LiveChatVersion_1.default.V2)) return [3 /*break*/, 7];
2129
- _b.label = 1;
2140
+ _a.label = 1;
2130
2141
  case 1:
2131
- _b.trys.push([1, 5, , 6]);
2142
+ _a.trys.push([1, 5, , 6]);
2132
2143
  if (this.isAMSClientAllowed === false) {
2133
2144
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2134
2145
  RequestId: this.requestId,
@@ -2139,24 +2150,25 @@ var OmnichannelChatSDK = /** @class */ (function () {
2139
2150
  }
2140
2151
  return [4 /*yield*/, this.getAMSClient()];
2141
2152
  case 2:
2142
- amsClient = _b.sent();
2153
+ amsClient = _a.sent();
2143
2154
  if (amsClient === null || amsClient === undefined) {
2144
2155
  (0, exceptionThrowers_1.throwAMSLoadFailure)(this.scenarioMarker, TelemetryEvent_1.default.DownloadFileAttachment, "Attachment handler is null, no action can be performed");
2145
2156
  }
2146
2157
  return [4 /*yield*/, (amsClient === null || amsClient === void 0 ? void 0 : amsClient.getViewStatus(fileMetadata))];
2147
2158
  case 3:
2148
- response = _b.sent();
2159
+ response = _a.sent();
2149
2160
  view_location = response.view_location;
2150
2161
  return [4 /*yield*/, (amsClient === null || amsClient === void 0 ? void 0 : amsClient.getView(fileMetadata, view_location))];
2151
2162
  case 4:
2152
- viewResponse = _b.sent();
2163
+ viewResponse = _a.sent();
2153
2164
  this.scenarioMarker.completeScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2154
2165
  RequestId: this.requestId,
2155
2166
  ChatId: this.chatToken.chatId
2156
2167
  });
2157
2168
  return [2 /*return*/, viewResponse];
2158
2169
  case 5:
2159
- _a = _b.sent();
2170
+ ex_1 = _a.sent();
2171
+ console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(ex_1));
2160
2172
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2161
2173
  RequestId: this.requestId,
2162
2174
  ChatId: this.chatToken.chatId
@@ -2164,18 +2176,18 @@ var OmnichannelChatSDK = /** @class */ (function () {
2164
2176
  throw new Error('DownloadFileAttachmentFailed');
2165
2177
  case 6: return [3 /*break*/, 10];
2166
2178
  case 7:
2167
- _b.trys.push([7, 9, , 10]);
2179
+ _a.trys.push([7, 9, , 10]);
2168
2180
  return [4 /*yield*/, this.conversation.downloadFile(fileMetadata)];
2169
2181
  case 8:
2170
- downloadedFile = _b.sent();
2182
+ downloadedFile = _a.sent();
2171
2183
  this.scenarioMarker.completeScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2172
2184
  RequestId: this.requestId,
2173
2185
  ChatId: this.chatToken.chatId
2174
2186
  });
2175
2187
  return [2 /*return*/, downloadedFile];
2176
2188
  case 9:
2177
- error_21 = _b.sent();
2178
- console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(error_21));
2189
+ error_22 = _a.sent();
2190
+ console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(error_22));
2179
2191
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2180
2192
  RequestId: this.requestId,
2181
2193
  ChatId: this.chatToken.chatId
@@ -2188,7 +2200,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2188
2200
  };
2189
2201
  OmnichannelChatSDK.prototype.emailLiveChatTranscript = function (body_1) {
2190
2202
  return __awaiter(this, arguments, void 0, function (body, optionalParams) {
2191
- var emailTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, emailRequestBody, error_22;
2203
+ var emailTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, emailRequestBody, error_23;
2192
2204
  var _a;
2193
2205
  if (optionalParams === void 0) { optionalParams = {}; }
2194
2206
  return __generator(this, function (_b) {
@@ -2239,8 +2251,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2239
2251
  });
2240
2252
  return [3 /*break*/, 4];
2241
2253
  case 3:
2242
- error_22 = _b.sent();
2243
- console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: ".concat(error_22));
2254
+ error_23 = _b.sent();
2255
+ console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: ".concat(error_23));
2244
2256
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.EmailLiveChatTranscript, {
2245
2257
  RequestId: requestId,
2246
2258
  ChatId: chatId
@@ -2253,7 +2265,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2253
2265
  };
2254
2266
  OmnichannelChatSDK.prototype.getLiveChatTranscript = function () {
2255
2267
  return __awaiter(this, arguments, void 0, function (optionalParams) {
2256
- var getChatTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, transcriptResponse, error_23, telemetryData;
2268
+ var getChatTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, transcriptResponse, error_24, telemetryData;
2257
2269
  var _a, _b;
2258
2270
  if (optionalParams === void 0) { optionalParams = {}; }
2259
2271
  return __generator(this, function (_c) {
@@ -2310,12 +2322,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
2310
2322
  });
2311
2323
  return [2 /*return*/, transcriptResponse];
2312
2324
  case 3:
2313
- error_23 = _c.sent();
2325
+ error_24 = _c.sent();
2314
2326
  telemetryData = {
2315
2327
  RequestId: requestId,
2316
2328
  ChatId: chatId
2317
2329
  };
2318
- exceptionThrowers_1.default.throwLiveChatTranscriptRetrievalFailure(error_23, this.scenarioMarker, TelemetryEvent_1.default.GetLiveChatTranscript, telemetryData);
2330
+ exceptionThrowers_1.default.throwLiveChatTranscriptRetrievalFailure(error_24, this.scenarioMarker, TelemetryEvent_1.default.GetLiveChatTranscript, telemetryData);
2319
2331
  return [3 /*break*/, 4];
2320
2332
  case 4: return [2 /*return*/];
2321
2333
  }
@@ -2430,7 +2442,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2430
2442
  };
2431
2443
  OmnichannelChatSDK.prototype.getPostChatSurveyContext = function () {
2432
2444
  return __awaiter(this, void 0, void 0, function () {
2433
- var conversationId, chatConfig, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId, postConversationBotSurveyOwnerId, msdyn_surveyprovider, surveyProvider, liveWorkItemDetails, participantJoined, participantType, agentSurveyInviteLinkRequest, botSurveyInviteLinkRequest, optionalParams, _a, agentSurveyInviteLinkResponse, botSurveyInviteLinkResponse, agentSurveyInviteLink, agentFormsProLocale, botSurveyInviteLink, botFormsProLocale, postChatContext, ex_1;
2445
+ var conversationId, chatConfig, liveWSAndLiveChatEngJoin, msdyn_postconversationsurveyenable, msfp_sourcesurveyidentifier, msfp_botsourcesurveyidentifier, postConversationSurveyOwnerId, postConversationBotSurveyOwnerId, msdyn_surveyprovider, surveyProvider, liveWorkItemDetails, participantJoined, participantType, agentSurveyInviteLinkRequest, botSurveyInviteLinkRequest, optionalParams, _a, agentSurveyInviteLinkResponse, botSurveyInviteLinkResponse, agentSurveyInviteLink, agentFormsProLocale, botSurveyInviteLink, botFormsProLocale, postChatContext, ex_2;
2434
2446
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2435
2447
  return __generator(this, function (_o) {
2436
2448
  switch (_o.label) {
@@ -2566,14 +2578,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
2566
2578
  return [2 /*return*/, Promise.reject("Post Chat is disabled from admin side, or chat doesnt have a survey as part of their configuration.")];
2567
2579
  case 5: return [3 /*break*/, 7];
2568
2580
  case 6:
2569
- ex_1 = _o.sent();
2581
+ ex_2 = _o.sent();
2570
2582
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetPostChatSurveyContext, {
2571
2583
  ConversationId: conversationId !== null && conversationId !== void 0 ? conversationId : "",
2572
2584
  RequestId: this.requestId,
2573
2585
  ChatId: (_m = this.chatToken) === null || _m === void 0 ? void 0 : _m.chatId,
2574
- ExceptionDetails: JSON.stringify(ex_1)
2586
+ ExceptionDetails: JSON.stringify(ex_2)
2575
2587
  });
2576
- return [2 /*return*/, Promise.reject("Retrieving post chat context failed " + JSON.stringify(ex_1))];
2588
+ return [2 /*return*/, Promise.reject("Retrieving post chat context failed " + JSON.stringify(ex_2))];
2577
2589
  case 7: return [2 /*return*/];
2578
2590
  }
2579
2591
  });
@@ -2865,7 +2877,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2865
2877
  };
2866
2878
  OmnichannelChatSDK.prototype.getChatConfig = function () {
2867
2879
  return __awaiter(this, arguments, void 0, function (optionalParams) {
2868
- var sendCacheHeaders, bypassCache, liveChatConfig, error_24, _a;
2880
+ var sendCacheHeaders, bypassCache, liveChatConfig, error_25, _a;
2869
2881
  var _b, _c;
2870
2882
  if (optionalParams === void 0) { optionalParams = {}; }
2871
2883
  return __generator(this, function (_d) {
@@ -2886,8 +2898,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2886
2898
  this.debug && console.log("[OmnichannelChatSDK][getChatConfig][liveChatVersion] ".concat(this.liveChatVersion));
2887
2899
  return [2 /*return*/, this.liveChatConfig];
2888
2900
  case 3:
2889
- error_24 = _d.sent();
2890
- if (!(0, internalUtils_1.isCoreServicesOrgUrlDNSError)(error_24, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
2901
+ error_25 = _d.sent();
2902
+ if (!(0, internalUtils_1.isCoreServicesOrgUrlDNSError)(error_25, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
2891
2903
  this.omnichannelConfig.orgUrl = this.unqServicesOrgUrl;
2892
2904
  _a = this;
2893
2905
  return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, (0, createOcSDKConfiguration_1.default)(false), this.ocSdkLogger)];
@@ -2899,10 +2911,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
2899
2911
  return [3 /*break*/, 7];
2900
2912
  case 6:
2901
2913
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2902
- if (((_c = (_b = error_24.response) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.errorcode) && parseInt(error_24.response.headers.errorcode) === OmnichannelErrorCodes_1.default.WidgetNotFound) {
2914
+ if (((_c = (_b = error_25.response) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.errorcode) && parseInt(error_25.response.headers.errorcode) === OmnichannelErrorCodes_1.default.WidgetNotFound) {
2903
2915
  console.warn("No widget with the given app id is present in the system.");
2904
2916
  }
2905
- throw error_24; // Bubble up error by default to throw ChatConfigRetrievalFailure
2917
+ throw error_25; // Bubble up error by default to throw ChatConfigRetrievalFailure
2906
2918
  case 7: return [3 /*break*/, 8];
2907
2919
  case 8: return [2 /*return*/, this.liveChatConfig];
2908
2920
  }
@@ -2937,7 +2949,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2937
2949
  };
2938
2950
  OmnichannelChatSDK.prototype.updateChatToken = function (newToken, newRegionGTMS) {
2939
2951
  return __awaiter(this, void 0, void 0, function () {
2940
- var sessionInfo, error_25, exceptionDetails;
2952
+ var sessionInfo, error_26, exceptionDetails;
2941
2953
  return __generator(this, function (_a) {
2942
2954
  switch (_a.label) {
2943
2955
  case 0:
@@ -2965,7 +2977,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2965
2977
  });
2966
2978
  return [3 /*break*/, 5];
2967
2979
  case 4:
2968
- error_25 = _a.sent();
2980
+ error_26 = _a.sent();
2969
2981
  exceptionDetails = {
2970
2982
  response: "UpdateChatTokenFailed"
2971
2983
  };
@@ -2982,7 +2994,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2982
2994
  };
2983
2995
  OmnichannelChatSDK.prototype.setAuthTokenProvider = function (provider_1) {
2984
2996
  return __awaiter(this, arguments, void 0, function (provider, optionalParams) {
2985
- var token, exceptionDetails, error_26, exceptionDetails, exceptionDetails;
2997
+ var token, exceptionDetails, error_27, exceptionDetails, exceptionDetails;
2986
2998
  if (optionalParams === void 0) { optionalParams = {}; }
2987
2999
  return __generator(this, function (_a) {
2988
3000
  switch (_a.label) {
@@ -3014,12 +3026,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
3014
3026
  }
3015
3027
  return [3 /*break*/, 4];
3016
3028
  case 3:
3017
- error_26 = _a.sent();
3029
+ error_27 = _a.sent();
3018
3030
  exceptionDetails = {
3019
3031
  response: ChatSDKError_1.ChatSDKErrorName.GetAuthTokenFailed
3020
3032
  };
3021
- if (error_26.message == ChatSDKError_1.ChatSDKErrorName.UndefinedAuthToken) {
3022
- exceptionDetails.response = error_26.message;
3033
+ if (error_27.message == ChatSDKError_1.ChatSDKErrorName.UndefinedAuthToken) {
3034
+ exceptionDetails.response = error_27.message;
3023
3035
  }
3024
3036
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetAuthToken, {
3025
3037
  ExceptionDetails: JSON.stringify(exceptionDetails)
@@ -3118,7 +3130,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3118
3130
  */
3119
3131
  OmnichannelChatSDK.prototype.getPersistentChatHistory = function () {
3120
3132
  return __awaiter(this, arguments, void 0, function (getPersistentChatHistoryOptionalParams) {
3121
- var params, result, error_27, telemetryData;
3133
+ var params, result, error_28, telemetryData;
3122
3134
  var _a, _b, _c, _d, _e;
3123
3135
  if (getPersistentChatHistoryOptionalParams === void 0) { getPersistentChatHistoryOptionalParams = {}; }
3124
3136
  return __generator(this, function (_f) {
@@ -3160,13 +3172,13 @@ var OmnichannelChatSDK = /** @class */ (function () {
3160
3172
  });
3161
3173
  return [2 /*return*/, result];
3162
3174
  case 3:
3163
- error_27 = _f.sent();
3175
+ error_28 = _f.sent();
3164
3176
  telemetryData = {
3165
3177
  RequestId: this.requestId,
3166
3178
  ChatId: (_e = this.chatToken) === null || _e === void 0 ? void 0 : _e.chatId,
3167
- ErrorMessage: (error_27 === null || error_27 === void 0 ? void 0 : error_27.message) || 'Unknown error' // Added error message for better debugging
3179
+ ErrorMessage: (error_28 === null || error_28 === void 0 ? void 0 : error_28.message) || 'Unknown error' // Added error message for better debugging
3168
3180
  };
3169
- exceptionThrowers_1.default.throwPersistentChatConversationRetrievalFailure(error_27, this.scenarioMarker, TelemetryEvent_1.default.GetPersistentChatHistory, telemetryData);
3181
+ exceptionThrowers_1.default.throwPersistentChatConversationRetrievalFailure(error_28, this.scenarioMarker, TelemetryEvent_1.default.GetPersistentChatHistory, telemetryData);
3170
3182
  return [3 /*break*/, 4];
3171
3183
  case 4: return [2 /*return*/];
3172
3184
  }