@microsoft/omnichannel-chat-sdk 1.11.9-main.c03be93 → 1.11.9-main.d767cc8

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.
Files changed (45) hide show
  1. package/README.md +26 -5
  2. package/lib/OmnichannelChatSDK.d.ts +20 -0
  3. package/lib/OmnichannelChatSDK.js +140 -36
  4. package/lib/OmnichannelChatSDK.js.map +1 -1
  5. package/lib/core/ChatSDKError.d.ts +5 -1
  6. package/lib/core/ChatSDKError.js +4 -0
  7. package/lib/core/ChatSDKError.js.map +1 -1
  8. package/lib/core/StartChatOptionalParams.d.ts +10 -0
  9. package/lib/core/messaging/ACSClient.d.ts +6 -0
  10. package/lib/core/messaging/ACSClient.js +184 -12
  11. package/lib/core/messaging/ACSClient.js.map +1 -1
  12. package/lib/core/messaging/OmnichannelStreamingMessage.d.ts +13 -0
  13. package/lib/core/messaging/OmnichannelStreamingMessage.js +3 -0
  14. package/lib/core/messaging/OmnichannelStreamingMessage.js.map +1 -0
  15. package/lib/core/messaging/OnStreamingMessageOptionalParams.d.ts +8 -0
  16. package/lib/core/messaging/OnStreamingMessageOptionalParams.js +3 -0
  17. package/lib/core/messaging/OnStreamingMessageOptionalParams.js.map +1 -0
  18. package/lib/core/messaging/PolicyViolation.d.ts +8 -0
  19. package/lib/core/messaging/PolicyViolation.js +3 -0
  20. package/lib/core/messaging/PolicyViolation.js.map +1 -0
  21. package/lib/core/messaging/StreamingMetadata.d.ts +11 -0
  22. package/lib/core/messaging/StreamingMetadata.js +3 -0
  23. package/lib/core/messaging/StreamingMetadata.js.map +1 -0
  24. package/lib/index.d.ts +5 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib/telemetry/MessageSource.d.ts +1 -0
  27. package/lib/telemetry/MessageSource.js +1 -0
  28. package/lib/telemetry/MessageSource.js.map +1 -1
  29. package/lib/telemetry/TelemetryEvent.d.ts +21 -1
  30. package/lib/telemetry/TelemetryEvent.js +21 -0
  31. package/lib/telemetry/TelemetryEvent.js.map +1 -1
  32. package/lib/tsconfig.tsbuildinfo +1 -1
  33. package/lib/utils/createOmnichannelMessage.js +9 -1
  34. package/lib/utils/createOmnichannelMessage.js.map +1 -1
  35. package/lib/utils/createOmnichannelStreamingMessage.d.ts +14 -0
  36. package/lib/utils/createOmnichannelStreamingMessage.js +106 -0
  37. package/lib/utils/createOmnichannelStreamingMessage.js.map +1 -0
  38. package/lib/utils/printers/MessagePrinterFactory.d.ts +3 -2
  39. package/lib/utils/printers/MessagePrinterFactory.js +6 -0
  40. package/lib/utils/printers/MessagePrinterFactory.js.map +1 -1
  41. package/lib/utils/printers/StreamingMessagePrinter.d.ts +5 -0
  42. package/lib/utils/printers/StreamingMessagePrinter.js +33 -0
  43. package/lib/utils/printers/StreamingMessagePrinter.js.map +1 -0
  44. package/lib/utils/printers/types/MessageType.d.ts +2 -1
  45. package/package.json +3 -3
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  ![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg)
6
6
  ![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk)
7
7
 
8
- > ❗ We recommend using official release versions in production as listed [here](#releases). Support will be provided only on official versions.
9
-
10
- > 📢 Try out our new React component library [omnichannel-chat-widget](https://github.com/microsoft/omnichannel-chat-widget) with Chat SDK
8
+ > [!IMPORTANT]
9
+ > * We recommend using official release versions in production as listed [here](#releases). Support will be provided only on official versions.
10
+ > * Microsoft provides this SDK to ensure a scaleable and secure use of our platform. Do not directly access the APIs used in this repository — you may experience breaking changes, and we will not be able to provide support for any issues.
11
11
 
12
12
  Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel Services.
13
13
 
@@ -45,6 +45,8 @@ Please make sure you have a chat widget configured before using this package or
45
45
  - [Get Voice & Video Calling](#get-voice--video-calling)
46
46
  - [Get Post Chat Survey Context](#get-post-chat-survey-context)
47
47
  - [Get Persistent Chat History](#get-persistent-chat-history)
48
+ - [Send Read Receipt](#send-read-receipt)
49
+ - [Get Unread Message Count](#get-unread-message-count)
48
50
  - [Common Scenarios](#common-scenarios)
49
51
  - [Using BotFramework-WebChat](#using-botframework-webchat)
50
52
  - [Escalation to Voice & Video](#escalation-to-voice--video)
@@ -106,9 +108,9 @@ Omnichannel offers a live chat widget (LCW) by default. You can use the Chat SDK
106
108
 
107
109
  New releases are published on a regular basis to ensure the product quality.
108
110
 
109
- for a detailed tracking of the releases, please refer to the [Changelog document](https://github.com/microsoft/omnichannel-chat-sdk/blob/main/CHANGELOG.md)
111
+ For a detailed tracking of the releases, please refer to the [Changelog document](https://github.com/microsoft/omnichannel-chat-sdk/blob/main/CHANGELOG.md)
110
112
 
111
- _**Important Note:**_ Versions below 1.11.0 will not be supported after November 1st, 2025. Please update to recent versions to ensure you have the latest features and bug fixes.
113
+ _**Important Note:**_ Versions below 1.11.0 are no longer supported after November 1st, 2025. Please update to recent versions to ensure you have the latest features and bug fixes.
112
114
 
113
115
 
114
116
  | Version | Docs | Release Date | End of Support | Deprecated |
@@ -607,6 +609,25 @@ It gets information on whether a queue is available, and whether there are agent
607
609
  const agentAvailability = await chatSDK.getAgentAvailability();
608
610
  ```
609
611
 
612
+ ### Send Read Receipt
613
+
614
+ Logs a particular message (and all previous messages) as read by the user. Read indicators will appear for Contact Center Representatives and Admins in the Admin Center.
615
+
616
+ ```ts
617
+ await chatSDK.sendReadReceipt(messageId: string);
618
+ ```
619
+
620
+ ### Get Unread Message Count
621
+
622
+ Returns the number of unread messages in an authenticated persistent conversation. This call is **authenticated-only** — the user must be authenticated, otherwise an `UndefinedAuthToken` error is thrown.
623
+
624
+ ```ts
625
+ const response = await chatSDK.getUnreadMessageCount();
626
+
627
+ // response.unreadMessageCount: number — Number of unread messages in the conversation
628
+ // response.mostRecentUnreadMessage: object | null — The most recent unread message, or null if there are none
629
+ ```
630
+
610
631
  ## Common Scenarios
611
632
 
612
633
  ### Pre-Chat Survey
@@ -30,7 +30,9 @@ import InitializeOptionalParams from "./core/InitializeOptionalParams";
30
30
  import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
31
31
  import OmnichannelConfig from "./core/OmnichannelConfig";
32
32
  import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
33
+ import OmnichannelStreamingMessage from "./core/messaging/OmnichannelStreamingMessage";
33
34
  import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
35
+ import OnStreamingMessageOptionalParams from "./core/messaging/OnStreamingMessageOptionalParams";
34
36
  import PostChatContext from "./core/PostChatContext";
35
37
  import StartChatOptionalParams from "./core/StartChatOptionalParams";
36
38
  declare class OmnichannelChatSDK {
@@ -183,6 +185,24 @@ declare class OmnichannelChatSDK {
183
185
  */
184
186
  sendReadReceipt(messageId: string): Promise<void>;
185
187
  onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
188
+ /**
189
+ * Subscribes to ACS-driven streaming message chunks for progressive bot message rendering.
190
+ * Each chunk contains the full assembled text so far (not just the delta).
191
+ * Existing onNewMessage consumers continue receiving final messages without changes.
192
+ *
193
+ * Available only in LiveChatVersion.V2. Must call startChat() before registering.
194
+ *
195
+ * @param onStreamingMessageCallback - Called for each streaming chunk
196
+ * @param optionalParams - Reserved for future configuration
197
+ * @example
198
+ * chatSDK.onStreamingMessage((message) => {
199
+ * switch (message.streamingMetadata.streamingMessageType) {
200
+ * case "streaming": // Update bubble with message.content
201
+ * case "final": // Stream complete
202
+ * }
203
+ * });
204
+ */
205
+ onStreamingMessage(onStreamingMessageCallback: (message: OmnichannelStreamingMessage) => void, optionalParams?: OnStreamingMessageOptionalParams): Promise<void>;
186
206
  onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread | ParticipantsRemovedEvent) => void): Promise<void>;
187
207
  uploadFileAttachment(fileInfo: IFileInfo | File): Promise<UploadFileAttachmentResponse>;
188
208
  downloadFileAttachment(fileMetadata: FileMetadata | IFileMetadata): Promise<Blob>;
@@ -153,6 +153,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
153
153
  this.regexCompiledForDataMasking = [];
154
154
  this.isEndingChat = false;
155
155
  this.populateInitChatOptionalParam = function (requestOptionalParams, optionalParams, telemetryEvent) {
156
+ var _a;
156
157
  requestOptionalParams.initContext.locale = (0, locale_1.getLocaleStringFromId)(_this.localeId);
157
158
  if (optionalParams === null || optionalParams === void 0 ? void 0 : optionalParams.customContext) {
158
159
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -199,6 +200,23 @@ var OmnichannelChatSDK = /** @class */ (function () {
199
200
  if (optionalParams.initContext) {
200
201
  requestOptionalParams.initContext = optionalParams.initContext;
201
202
  }
203
+ // Forward the widget's streaming-capability signal to the server via customContextData
204
+ // pass-through. Only inject when the caller explicitly provided the flag — omitting it
205
+ // preserves the legacy contract (server sees no signal → non-streaming behavior).
206
+ // The {value, isDisplayable} wrapper is the customContextData variable contract;
207
+ // isDisplayable: false marks this as an internal capability signal, not for agent UI.
208
+ // NOTE: This runs AFTER the initContext override to ensure the flag survives even when
209
+ // the consumer provides their own initContext.
210
+ var supportsLcwStreaming = optionalParams === null || optionalParams === void 0 ? void 0 : optionalParams.supportsLcwStreaming;
211
+ if (supportsLcwStreaming !== undefined) {
212
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
213
+ var ctx = ((_a = requestOptionalParams.initContext.customContextData) !== null && _a !== void 0 ? _a : {});
214
+ ctx.supportsLcwStreaming = {
215
+ value: supportsLcwStreaming ? "true" : "false",
216
+ isDisplayable: false
217
+ };
218
+ requestOptionalParams.initContext.customContextData = ctx; // eslint-disable-line @typescript-eslint/no-explicit-any
219
+ }
202
220
  if (_this.authenticatedUserToken) {
203
221
  requestOptionalParams.authenticatedUserToken = _this.authenticatedUserToken;
204
222
  }
@@ -1990,10 +2008,32 @@ var OmnichannelChatSDK = /** @class */ (function () {
1990
2008
  var isChatMessageEditedEvent = Object.keys(event).includes("editedOn");
1991
2009
  console.log("[OmnichannelChatSDK][onNewMessage] New message received", event);
1992
2010
  console.log("[OmnichannelChatSDK][onNewMessage] isChatMessageEditedEvent=>", isChatMessageEditedEvent);
1993
- var omnichannelMessage = (0, createOmnichannelMessage_1.default)(event, {
1994
- liveChatVersion: _this.liveChatVersion,
1995
- debug: (_this.detailedDebugEnabled ? _this.debugACS : _this.debug),
1996
- });
2011
+ // Guard message transformation: createOmnichannelMessage() can throw
2012
+ // (e.g. unexpected event shape). Without this, the throw became an
2013
+ // unhandled rejection in the WebSocket callback, breaking the callback
2014
+ // chain so the customer's onNewMessage never fired. Record telemetry
2015
+ // and skip the bad message instead of letting it break reception.
2016
+ //
2017
+ // Use singleRecord (fire-and-forget) rather than failScenario: by the
2018
+ // time this callback fires for an incoming message, the OnNewMessage
2019
+ // scenario has already been completed (and removed from the telemetry
2020
+ // map) further below, so failScenario would short-circuit on its
2021
+ // "event has not started" guard and never emit.
2022
+ var omnichannelMessage;
2023
+ try {
2024
+ omnichannelMessage = (0, createOmnichannelMessage_1.default)(event, {
2025
+ liveChatVersion: _this.liveChatVersion,
2026
+ debug: (_this.detailedDebugEnabled ? _this.debugACS : _this.debug),
2027
+ });
2028
+ }
2029
+ catch (error) {
2030
+ _this.scenarioMarker.singleRecord(TelemetryEvent_1.default.OnNewMessage, {
2031
+ RequestId: _this.requestId,
2032
+ ChatId: _this.chatToken.chatId,
2033
+ ExceptionDetails: JSON.stringify({ errorObject: "".concat(error) })
2034
+ });
2035
+ return;
2036
+ }
1997
2037
  // send callback for new messages or edited existent messages
1998
2038
  if (!postedMessages_1.has(id) || isChatMessageEditedEvent) {
1999
2039
  onNewMessageCallback(omnichannelMessage);
@@ -2221,6 +2261,70 @@ var OmnichannelChatSDK = /** @class */ (function () {
2221
2261
  });
2222
2262
  });
2223
2263
  };
2264
+ /**
2265
+ * Subscribes to ACS-driven streaming message chunks for progressive bot message rendering.
2266
+ * Each chunk contains the full assembled text so far (not just the delta).
2267
+ * Existing onNewMessage consumers continue receiving final messages without changes.
2268
+ *
2269
+ * Available only in LiveChatVersion.V2. Must call startChat() before registering.
2270
+ *
2271
+ * @param onStreamingMessageCallback - Called for each streaming chunk
2272
+ * @param optionalParams - Reserved for future configuration
2273
+ * @example
2274
+ * chatSDK.onStreamingMessage((message) => {
2275
+ * switch (message.streamingMetadata.streamingMessageType) {
2276
+ * case "streaming": // Update bubble with message.content
2277
+ * case "final": // Stream complete
2278
+ * }
2279
+ * });
2280
+ */
2281
+ OmnichannelChatSDK.prototype.onStreamingMessage = function (onStreamingMessageCallback, optionalParams) {
2282
+ return __awaiter(this, void 0, void 0, function () {
2283
+ var error_23, wrappedError;
2284
+ var _a, _b, _c, _d, _e, _f, _g;
2285
+ return __generator(this, function (_h) {
2286
+ switch (_h.label) {
2287
+ case 0:
2288
+ this.scenarioMarker.startScenario(TelemetryEvent_1.default.OnStreamingMessage, {
2289
+ RequestId: this.requestId,
2290
+ ChatId: (_b = (_a = this.chatToken) === null || _a === void 0 ? void 0 : _a.chatId) !== null && _b !== void 0 ? _b : ""
2291
+ });
2292
+ if (!this.isInitialized) {
2293
+ exceptionThrowers_1.default.throwUninitializedChatSDK(this.scenarioMarker, TelemetryEvent_1.default.OnStreamingMessage);
2294
+ }
2295
+ _h.label = 1;
2296
+ case 1:
2297
+ _h.trys.push([1, 3, , 4]);
2298
+ if (this.liveChatVersion !== LiveChatVersion_1.default.V2) {
2299
+ throw new ChatSDKError_1.ChatSDKError(ChatSDKError_1.ChatSDKErrorName.UnsupportedLiveChatVersion);
2300
+ }
2301
+ if (!this.conversation) {
2302
+ throw new ChatSDKError_1.ChatSDKError(ChatSDKError_1.ChatSDKErrorName.UninitializedConversation);
2303
+ }
2304
+ return [4 /*yield*/, this.conversation.registerOnStreamingMessage(onStreamingMessageCallback, optionalParams)];
2305
+ case 2:
2306
+ _h.sent();
2307
+ this.scenarioMarker.completeScenario(TelemetryEvent_1.default.OnStreamingMessage, {
2308
+ RequestId: this.requestId,
2309
+ ChatId: (_d = (_c = this.chatToken) === null || _c === void 0 ? void 0 : _c.chatId) !== null && _d !== void 0 ? _d : ""
2310
+ });
2311
+ return [3 /*break*/, 4];
2312
+ case 3:
2313
+ error_23 = _h.sent();
2314
+ wrappedError = (error_23 instanceof ChatSDKError_1.ChatSDKError)
2315
+ ? error_23
2316
+ : new ChatSDKError_1.ChatSDKError(ChatSDKError_1.ChatSDKErrorName.StreamingSubscriptionFailure, undefined, { response: 'StreamingSubscriptionFailure', errorObject: "".concat(error_23) });
2317
+ this.scenarioMarker.failScenario(TelemetryEvent_1.default.OnStreamingMessage, {
2318
+ RequestId: this.requestId,
2319
+ ChatId: (_f = (_e = this.chatToken) === null || _e === void 0 ? void 0 : _e.chatId) !== null && _f !== void 0 ? _f : "",
2320
+ ExceptionDetails: JSON.stringify((_g = wrappedError.exceptionDetails) !== null && _g !== void 0 ? _g : wrappedError.message)
2321
+ });
2322
+ throw wrappedError;
2323
+ case 4: return [2 /*return*/];
2324
+ }
2325
+ });
2326
+ });
2327
+ };
2224
2328
  OmnichannelChatSDK.prototype.onAgentEndSession = function (onAgentEndSessionCallback) {
2225
2329
  return __awaiter(this, void 0, void 0, function () {
2226
2330
  var agentEndSessionFired_1;
@@ -2310,7 +2414,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2310
2414
  };
2311
2415
  OmnichannelChatSDK.prototype.uploadFileAttachment = function (fileInfo) {
2312
2416
  return __awaiter(this, void 0, void 0, function () {
2313
- var amsClient, createObjectResponse, documentId, uploadDocumentResponse, fileIdsProperty, fileMetaProperty, sendMessageRequest, messageToSend, error_23, fileMetadata, messageToSend, error_24;
2417
+ var amsClient, createObjectResponse, documentId, uploadDocumentResponse, fileIdsProperty, fileMetaProperty, sendMessageRequest, messageToSend, error_24, fileMetadata, messageToSend, error_25;
2314
2418
  var _a, _b;
2315
2419
  return __generator(this, function (_c) {
2316
2420
  switch (_c.label) {
@@ -2379,7 +2483,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2379
2483
  });
2380
2484
  return [2 /*return*/, messageToSend];
2381
2485
  case 6:
2382
- error_23 = _c.sent();
2486
+ error_24 = _c.sent();
2383
2487
  console.error("OmnichannelChatSDK/uploadFileAttachment/sendMessage/error");
2384
2488
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.UploadFileAttachment, {
2385
2489
  RequestId: this.requestId,
@@ -2425,8 +2529,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2425
2529
  });
2426
2530
  return [2 /*return*/, messageToSend];
2427
2531
  case 15:
2428
- error_24 = _c.sent();
2429
- console.error("OmnichannelChatSDK/uploadFileAttachment/error: ".concat(error_24));
2532
+ error_25 = _c.sent();
2533
+ console.error("OmnichannelChatSDK/uploadFileAttachment/error: ".concat(error_25));
2430
2534
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.UploadFileAttachment, {
2431
2535
  RequestId: this.requestId,
2432
2536
  ChatId: this.chatToken.chatId
@@ -2439,7 +2543,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2439
2543
  };
2440
2544
  OmnichannelChatSDK.prototype.downloadFileAttachment = function (fileMetadata) {
2441
2545
  return __awaiter(this, void 0, void 0, function () {
2442
- var amsClient, response, view_location, viewResponse, ex_1, downloadedFile, error_25;
2546
+ var amsClient, response, view_location, viewResponse, ex_1, downloadedFile, error_26;
2443
2547
  return __generator(this, function (_a) {
2444
2548
  switch (_a.label) {
2445
2549
  case 0:
@@ -2500,8 +2604,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2500
2604
  });
2501
2605
  return [2 /*return*/, downloadedFile];
2502
2606
  case 9:
2503
- error_25 = _a.sent();
2504
- console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(error_25));
2607
+ error_26 = _a.sent();
2608
+ console.error("OmnichannelChatSDK/downloadFileAttachment/error: ".concat(error_26));
2505
2609
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.DownloadFileAttachment, {
2506
2610
  RequestId: this.requestId,
2507
2611
  ChatId: this.chatToken.chatId
@@ -2514,7 +2618,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2514
2618
  };
2515
2619
  OmnichannelChatSDK.prototype.emailLiveChatTranscript = function (body_1) {
2516
2620
  return __awaiter(this, arguments, void 0, function (body, optionalParams) {
2517
- var emailTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, emailRequestBody, error_26;
2621
+ var emailTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, emailRequestBody, error_27;
2518
2622
  var _a;
2519
2623
  if (optionalParams === void 0) { optionalParams = {}; }
2520
2624
  return __generator(this, function (_b) {
@@ -2565,8 +2669,8 @@ var OmnichannelChatSDK = /** @class */ (function () {
2565
2669
  });
2566
2670
  return [3 /*break*/, 4];
2567
2671
  case 3:
2568
- error_26 = _b.sent();
2569
- console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: ".concat(error_26));
2672
+ error_27 = _b.sent();
2673
+ console.error("OmnichannelChatSDK/emailLiveChatTranscript/error: ".concat(error_27));
2570
2674
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.EmailLiveChatTranscript, {
2571
2675
  RequestId: requestId,
2572
2676
  ChatId: chatId
@@ -2579,7 +2683,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2579
2683
  };
2580
2684
  OmnichannelChatSDK.prototype.getLiveChatTranscript = function () {
2581
2685
  return __awaiter(this, arguments, void 0, function (optionalParams) {
2582
- var getChatTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, transcriptResponse, error_27, telemetryData;
2686
+ var getChatTranscriptOptionalParams, requestId, chatToken, chatId, sessionId, transcriptResponse, error_28, telemetryData;
2583
2687
  var _a, _b;
2584
2688
  if (optionalParams === void 0) { optionalParams = {}; }
2585
2689
  return __generator(this, function (_c) {
@@ -2636,12 +2740,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
2636
2740
  });
2637
2741
  return [2 /*return*/, transcriptResponse];
2638
2742
  case 3:
2639
- error_27 = _c.sent();
2743
+ error_28 = _c.sent();
2640
2744
  telemetryData = {
2641
2745
  RequestId: requestId,
2642
2746
  ChatId: chatId
2643
2747
  };
2644
- exceptionThrowers_1.default.throwLiveChatTranscriptRetrievalFailure(error_27, this.scenarioMarker, TelemetryEvent_1.default.GetLiveChatTranscript, telemetryData);
2748
+ exceptionThrowers_1.default.throwLiveChatTranscriptRetrievalFailure(error_28, this.scenarioMarker, TelemetryEvent_1.default.GetLiveChatTranscript, telemetryData);
2645
2749
  return [3 /*break*/, 4];
2646
2750
  case 4: return [2 /*return*/];
2647
2751
  }
@@ -2961,7 +3065,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
2961
3065
  };
2962
3066
  OmnichannelChatSDK.prototype.authenticateChat = function (tokenOrProvider_1) {
2963
3067
  return __awaiter(this, arguments, void 0, function (tokenOrProvider, optionalParams) {
2964
- var telemetryData, token, _a, e_9, exceptionDetails, exceptionDetails, error_28, exceptionDetails;
3068
+ var telemetryData, token, _a, e_9, exceptionDetails, exceptionDetails, error_29, exceptionDetails;
2965
3069
  var _b, _c, _d, _e, _f;
2966
3070
  if (optionalParams === void 0) { optionalParams = {}; }
2967
3071
  return __generator(this, function (_g) {
@@ -3032,10 +3136,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
3032
3136
  this.scenarioMarker.completeScenario(TelemetryEvent_1.default.MidConversationAuth, telemetryData);
3033
3137
  return [3 /*break*/, 12];
3034
3138
  case 11:
3035
- error_28 = _g.sent();
3139
+ error_29 = _g.sent();
3036
3140
  exceptionDetails = {
3037
3141
  response: ChatSDKError_1.ChatSDKErrorName.MidConversationAuthFailure,
3038
- errorObject: "".concat(error_28)
3142
+ errorObject: "".concat(error_29)
3039
3143
  };
3040
3144
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.MidConversationAuth, __assign(__assign({}, telemetryData), { ExceptionDetails: JSON.stringify(exceptionDetails) }));
3041
3145
  throw new ChatSDKError_1.ChatSDKError(ChatSDKError_1.ChatSDKErrorName.MidConversationAuthFailure, undefined, exceptionDetails);
@@ -3291,7 +3395,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3291
3395
  };
3292
3396
  OmnichannelChatSDK.prototype.getChatConfig = function () {
3293
3397
  return __awaiter(this, arguments, void 0, function (optionalParams) {
3294
- var sendCacheHeaders, bypassCache, liveChatConfig, startTime, error_29, clientElapsedMs, _a;
3398
+ var sendCacheHeaders, bypassCache, liveChatConfig, startTime, error_30, clientElapsedMs, _a;
3295
3399
  var _b, _c;
3296
3400
  if (optionalParams === void 0) { optionalParams = {}; }
3297
3401
  return __generator(this, function (_d) {
@@ -3313,14 +3417,14 @@ var OmnichannelChatSDK = /** @class */ (function () {
3313
3417
  this.debug && console.log("[OmnichannelChatSDK][getChatConfig][liveChatVersion] ".concat(this.liveChatVersion));
3314
3418
  return [2 /*return*/, this.liveChatConfig];
3315
3419
  case 3:
3316
- error_29 = _d.sent();
3420
+ error_30 = _d.sent();
3317
3421
  clientElapsedMs = startTime !== undefined
3318
3422
  ? Math.round(performance.now() - startTime)
3319
3423
  : undefined;
3320
3424
  // Attach timing info to error object for outer catch blocks to use
3321
3425
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3322
- error_29.__chatConfigElapsedMs = clientElapsedMs;
3323
- if (!(0, internalUtils_1.isCoreServicesOrgUrlDNSError)(error_29, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
3426
+ error_30.__chatConfigElapsedMs = clientElapsedMs;
3427
+ if (!(0, internalUtils_1.isCoreServicesOrgUrlDNSError)(error_30, this.coreServicesOrgUrl, this.dynamicsLocationCode)) return [3 /*break*/, 6];
3324
3428
  this.omnichannelConfig.orgUrl = this.unqServicesOrgUrl;
3325
3429
  _a = this;
3326
3430
  return [4 /*yield*/, ocsdk_1.SDKProvider.getSDK(this.omnichannelConfig, (0, createOcSDKConfiguration_1.default)(false), this.ocSdkLogger)];
@@ -3332,10 +3436,10 @@ var OmnichannelChatSDK = /** @class */ (function () {
3332
3436
  return [3 /*break*/, 7];
3333
3437
  case 6:
3334
3438
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3335
- if (((_c = (_b = error_29.response) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.errorcode) && parseInt(error_29.response.headers.errorcode) === OmnichannelErrorCodes_1.default.WidgetNotFound) {
3439
+ if (((_c = (_b = error_30.response) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.errorcode) && parseInt(error_30.response.headers.errorcode) === OmnichannelErrorCodes_1.default.WidgetNotFound) {
3336
3440
  console.warn("No widget with the given app id is present in the system.");
3337
3441
  }
3338
- throw error_29; // Bubble up error by default to throw ChatConfigRetrievalFailure
3442
+ throw error_30; // Bubble up error by default to throw ChatConfigRetrievalFailure
3339
3443
  case 7: return [3 /*break*/, 8];
3340
3444
  case 8: return [2 /*return*/, this.liveChatConfig];
3341
3445
  }
@@ -3370,7 +3474,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3370
3474
  };
3371
3475
  OmnichannelChatSDK.prototype.updateChatToken = function (newToken, newRegionGTMS) {
3372
3476
  return __awaiter(this, void 0, void 0, function () {
3373
- var sessionInfo, error_30, exceptionDetails;
3477
+ var sessionInfo, error_31, exceptionDetails;
3374
3478
  return __generator(this, function (_a) {
3375
3479
  switch (_a.label) {
3376
3480
  case 0:
@@ -3398,7 +3502,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3398
3502
  });
3399
3503
  return [3 /*break*/, 5];
3400
3504
  case 4:
3401
- error_30 = _a.sent();
3505
+ error_31 = _a.sent();
3402
3506
  exceptionDetails = {
3403
3507
  response: "UpdateChatTokenFailed"
3404
3508
  };
@@ -3415,7 +3519,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3415
3519
  };
3416
3520
  OmnichannelChatSDK.prototype.setAuthTokenProvider = function (provider_1) {
3417
3521
  return __awaiter(this, arguments, void 0, function (provider, optionalParams) {
3418
- var token, exceptionDetails, error_31, exceptionDetails, exceptionDetails;
3522
+ var token, exceptionDetails, error_32, exceptionDetails, exceptionDetails;
3419
3523
  if (optionalParams === void 0) { optionalParams = {}; }
3420
3524
  return __generator(this, function (_a) {
3421
3525
  switch (_a.label) {
@@ -3447,12 +3551,12 @@ var OmnichannelChatSDK = /** @class */ (function () {
3447
3551
  }
3448
3552
  return [3 /*break*/, 4];
3449
3553
  case 3:
3450
- error_31 = _a.sent();
3554
+ error_32 = _a.sent();
3451
3555
  exceptionDetails = {
3452
3556
  response: ChatSDKError_1.ChatSDKErrorName.GetAuthTokenFailed
3453
3557
  };
3454
- if (error_31.message == ChatSDKError_1.ChatSDKErrorName.UndefinedAuthToken) {
3455
- exceptionDetails.response = error_31.message;
3558
+ if (error_32.message == ChatSDKError_1.ChatSDKErrorName.UndefinedAuthToken) {
3559
+ exceptionDetails.response = error_32.message;
3456
3560
  }
3457
3561
  this.scenarioMarker.failScenario(TelemetryEvent_1.default.GetAuthToken, {
3458
3562
  ExceptionDetails: JSON.stringify(exceptionDetails)
@@ -3551,7 +3655,7 @@ var OmnichannelChatSDK = /** @class */ (function () {
3551
3655
  */
3552
3656
  OmnichannelChatSDK.prototype.getPersistentChatHistory = function () {
3553
3657
  return __awaiter(this, arguments, void 0, function (getPersistentChatHistoryOptionalParams) {
3554
- var params, result, error_32, telemetryData;
3658
+ var params, result, error_33, telemetryData;
3555
3659
  var _a, _b, _c, _d, _e;
3556
3660
  if (getPersistentChatHistoryOptionalParams === void 0) { getPersistentChatHistoryOptionalParams = {}; }
3557
3661
  return __generator(this, function (_f) {
@@ -3593,13 +3697,13 @@ var OmnichannelChatSDK = /** @class */ (function () {
3593
3697
  });
3594
3698
  return [2 /*return*/, result];
3595
3699
  case 3:
3596
- error_32 = _f.sent();
3700
+ error_33 = _f.sent();
3597
3701
  telemetryData = {
3598
3702
  RequestId: this.requestId,
3599
3703
  ChatId: (_e = this.chatToken) === null || _e === void 0 ? void 0 : _e.chatId,
3600
- ErrorMessage: (error_32 === null || error_32 === void 0 ? void 0 : error_32.message) || 'Unknown error' // Added error message for better debugging
3704
+ ErrorMessage: (error_33 === null || error_33 === void 0 ? void 0 : error_33.message) || 'Unknown error' // Added error message for better debugging
3601
3705
  };
3602
- exceptionThrowers_1.default.throwPersistentChatConversationRetrievalFailure(error_32, this.scenarioMarker, TelemetryEvent_1.default.GetPersistentChatHistory, telemetryData);
3706
+ exceptionThrowers_1.default.throwPersistentChatConversationRetrievalFailure(error_33, this.scenarioMarker, TelemetryEvent_1.default.GetPersistentChatHistory, telemetryData);
3603
3707
  return [3 /*break*/, 4];
3604
3708
  case 4: return [2 /*return*/];
3605
3709
  }