@microsoft/omnichannel-chat-widget 1.0.6-main.ffb4e2a → 1.1.1-main.1f4a6a7

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 (88) hide show
  1. package/lib/cjs/common/Constants.js +2 -0
  2. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +20 -15
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -0
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +25 -15
  5. package/lib/cjs/common/utils.js +17 -2
  6. package/lib/cjs/components/draggable/DraggableChatWidget.js +168 -0
  7. package/lib/cjs/components/draggable/DraggableEventEmitter.js +74 -0
  8. package/lib/cjs/components/draggable/DraggableEventNames.js +14 -0
  9. package/lib/cjs/components/draggable/DraggableEventReceiver.js +34 -0
  10. package/lib/cjs/components/draggable/IDraggableElementPosition.js +1 -0
  11. package/lib/cjs/components/draggable/IDraggableElementPositionDelta.js +1 -0
  12. package/lib/cjs/components/draggable/IDraggableEvent.js +1 -0
  13. package/lib/cjs/components/footerstateful/FooterStateful.js +2 -2
  14. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +21 -12
  15. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
  16. package/lib/cjs/components/headerstateful/HeaderStateful.js +27 -0
  17. package/lib/cjs/components/livechatwidget/common/createDownloadTranscriptProps.js +27 -0
  18. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +13 -2
  19. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +15 -5
  20. package/lib/cjs/components/livechatwidget/common/startChat.js +1 -1
  21. package/lib/cjs/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
  22. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +58 -30
  23. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
  24. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +48 -13
  25. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  26. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
  27. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  28. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  29. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.js +10 -0
  30. package/lib/cjs/plugins/createChatTranscript.js +548 -0
  31. package/lib/esm/common/Constants.js +2 -0
  32. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +18 -14
  33. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  34. package/lib/esm/common/telemetry/TelemetryHelper.js +25 -15
  35. package/lib/esm/common/utils.js +15 -1
  36. package/lib/esm/components/draggable/DraggableChatWidget.js +158 -0
  37. package/lib/esm/components/draggable/DraggableEventEmitter.js +64 -0
  38. package/lib/esm/components/draggable/DraggableEventNames.js +7 -0
  39. package/lib/esm/components/draggable/DraggableEventReceiver.js +25 -0
  40. package/lib/esm/components/draggable/IDraggableElementPosition.js +1 -0
  41. package/lib/esm/components/draggable/IDraggableElementPositionDelta.js +1 -0
  42. package/lib/esm/components/draggable/IDraggableEvent.js +1 -0
  43. package/lib/esm/components/footerstateful/FooterStateful.js +2 -2
  44. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +22 -13
  45. package/lib/esm/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
  46. package/lib/esm/components/headerstateful/HeaderStateful.js +27 -0
  47. package/lib/esm/components/livechatwidget/common/createDownloadTranscriptProps.js +20 -0
  48. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +13 -2
  49. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +15 -5
  50. package/lib/esm/components/livechatwidget/common/startChat.js +1 -1
  51. package/lib/esm/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
  52. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +58 -30
  53. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
  54. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +48 -13
  55. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  56. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
  57. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  58. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  59. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.js +3 -0
  60. package/lib/esm/plugins/createChatTranscript.js +543 -0
  61. package/lib/types/common/Constants.d.ts +2 -0
  62. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -0
  63. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  64. package/lib/types/common/telemetry/definitions/Contracts.d.ts +1 -0
  65. package/lib/types/common/utils.d.ts +1 -0
  66. package/lib/types/components/draggable/DraggableChatWidget.d.ts +9 -0
  67. package/lib/types/components/draggable/DraggableEventEmitter.d.ts +27 -0
  68. package/lib/types/components/draggable/DraggableEventNames.d.ts +6 -0
  69. package/lib/types/components/draggable/DraggableEventReceiver.d.ts +27 -0
  70. package/lib/types/components/draggable/IDraggableElementPosition.d.ts +5 -0
  71. package/lib/types/components/draggable/IDraggableElementPositionDelta.d.ts +5 -0
  72. package/lib/types/components/draggable/IDraggableEvent.d.ts +12 -0
  73. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
  74. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps.d.ts +5 -0
  75. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +13 -0
  76. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +12 -0
  77. package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +24 -0
  78. package/lib/types/components/livechatwidget/interfaces/IDraggableChatWidgetProps.d.ts +10 -0
  79. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  80. package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +2 -2
  81. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +5 -0
  82. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
  83. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +3 -1
  84. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +2 -1
  85. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.d.ts +2 -0
  86. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +1 -0
  87. package/lib/types/plugins/createChatTranscript.d.ts +2 -0
  88. package/package.json +4 -4
@@ -30,15 +30,16 @@ export class TelemetryHelper {
30
30
  static populateBasicProperties(level,
31
31
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
32
  telemetryData) {
33
- var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7;
33
+ var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
34
34
  return {
35
35
  WidgetId: ((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.widgetId) ?? "",
36
36
  ChatId: ((_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.chatId) ?? "",
37
37
  ChannelId: ((_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : _TelemetryManager$Int3.channelId) ?? "lcw2.0",
38
38
  ConversationId: ((_TelemetryManager$Int4 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int4 === void 0 ? void 0 : _TelemetryManager$Int4.conversationId) ?? "",
39
39
  OrganizationId: ((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int5 === void 0 ? void 0 : _TelemetryManager$Int5.orgId) ?? "",
40
- LCWRuntimeId: ((_TelemetryManager$Int6 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.lcwRuntimeId) ?? "",
41
- CurrentRequestId: ((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : _TelemetryManager$Int7.currentRequestId) ?? "",
40
+ OrganizationUrl: ((_TelemetryManager$Int6 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.orgUrl) ?? "",
41
+ LCWRuntimeId: ((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : _TelemetryManager$Int7.lcwRuntimeId) ?? "",
42
+ CurrentRequestId: ((_TelemetryManager$Int8 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.currentRequestId) ?? "",
42
43
  LogLevel: level
43
44
  };
44
45
  }
@@ -73,22 +74,22 @@ export class TelemetryHelper {
73
74
  static conformToConfigValidationContract(level, input) {
74
75
  const payload = input.payload;
75
76
  return TelemetryHelper.populate(level, payload, event => {
76
- var _TelemetryManager$Int8, _TelemetryManager$Int9, _TelemetryManager$Int10;
77
+ var _TelemetryManager$Int9, _TelemetryManager$Int10, _TelemetryManager$Int11;
77
78
  event.Event = payload.Event;
78
79
  event.RequestId = payload.RequestId;
79
- event.LCWVersion = (_TelemetryManager$Int8 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.environmentVersion;
80
+ event.LCWVersion = (_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : _TelemetryManager$Int9.environmentVersion;
80
81
  event.CloudType = payload.CloudType;
81
- event.Domain = (_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : _TelemetryManager$Int9.hostName;
82
+ event.Domain = (_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.hostName;
82
83
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
83
84
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
84
- event.Language = ((_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.chatWidgetLocaleLCID) || "";
85
+ event.Language = ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.chatWidgetLocaleLCID) || "";
85
86
  event.Description = payload.Data;
86
87
  });
87
88
  }
88
89
  static conformToLoadContract(level, input) {
89
90
  const payload = input.payload;
90
91
  return TelemetryHelper.populate(level, payload, event => {
91
- var _TelemetryManager$Int11, _TelemetryManager$Int12, _TelemetryManager$Int13;
92
+ var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14;
92
93
  event.Event = payload.Event;
93
94
  event.Description = payload.Description;
94
95
  event.ResourcePath = payload.ResourcePath;
@@ -97,17 +98,17 @@ export class TelemetryHelper {
97
98
  event.ChatType = payload.ChatType;
98
99
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
99
100
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
100
- event.OCChatSDKVersion = ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.OCChatSDKVersion) ?? "";
101
- event.OCChatWidgetVersion = ((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : _TelemetryManager$Int12.chatWidgetVersion) ?? "";
102
- event.OCChatComponentsVersion = ((_TelemetryManager$Int13 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.chatComponentVersion) ?? "";
101
+ event.OCChatSDKVersion = ((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : _TelemetryManager$Int12.OCChatSDKVersion) ?? "";
102
+ event.OCChatWidgetVersion = ((_TelemetryManager$Int13 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.chatWidgetVersion) ?? "";
103
+ event.OCChatComponentsVersion = ((_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : _TelemetryManager$Int14.chatComponentVersion) ?? "";
103
104
  });
104
105
  }
105
106
  static conformToIC3ClientContract(level, input) {
106
107
  const payload = input.payload;
107
108
  return TelemetryHelper.populate(level, payload, event => {
108
- var _TelemetryManager$Int14;
109
+ var _TelemetryManager$Int15;
109
110
  event.Event = payload.Event;
110
- event.IC3ClientVersion = (_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : _TelemetryManager$Int14.IC3ClientVersion;
111
+ event.IC3ClientVersion = (_TelemetryManager$Int15 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.IC3ClientVersion;
111
112
  event.SubscriptionId = payload.SubscriptionId;
112
113
  event.EndpointUrl = payload.EndpointUrl;
113
114
  event.EndpointId = payload.EndpointId;
@@ -160,6 +161,15 @@ export class TelemetryHelper {
160
161
  }
161
162
  static addWidgetDataToTelemetry(telemetryConfig, telemetryInternalData) {
162
163
  const telemetryDataLocal = telemetryInternalData;
164
+ if (!(telemetryConfig !== null && telemetryConfig !== void 0 && telemetryConfig.appId) || (telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.appId.trim()) === "") {
165
+ throw new Error("TelemetryConfig.appId is not set");
166
+ }
167
+ if (!(telemetryConfig !== null && telemetryConfig !== void 0 && telemetryConfig.orgId) || (telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgId.trim()) === "") {
168
+ throw new Error("TelemetryConfig.orgId is not set");
169
+ }
170
+ if (!(telemetryConfig !== null && telemetryConfig !== void 0 && telemetryConfig.orgUrl) || (telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgUrl.trim()) === "") {
171
+ throw new Error("TelemetryConfig.orgUrl is not set");
172
+ }
163
173
  telemetryDataLocal.widgetId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.appId;
164
174
  telemetryDataLocal.orgId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgId;
165
175
  telemetryDataLocal.orgUrl = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgUrl;
@@ -213,14 +223,14 @@ _defineProperty(TelemetryHelper, "logActionEvent", (logLevel, payload) => {
213
223
  BroadcastService.postMessage(telemetryEvent);
214
224
  });
215
225
  _defineProperty(TelemetryHelper, "logSDKEvent", (logLevel, payload) => {
216
- var _TelemetryManager$Int15;
226
+ var _TelemetryManager$Int16;
217
227
  const telemetryEvent = {
218
228
  eventName: (payload === null || payload === void 0 ? void 0 : payload.Event) ?? "",
219
229
  logLevel: logLevel,
220
230
  payload: {
221
231
  ...payload,
222
232
  TransactionId: newGuid(),
223
- RequestId: (_TelemetryManager$Int15 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.currentRequestId
233
+ RequestId: (_TelemetryManager$Int16 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : _TelemetryManager$Int16.currentRequestId
224
234
  }
225
235
  };
226
236
  BroadcastService.postMessage(telemetryEvent);
@@ -1,5 +1,5 @@
1
1
  var _this = this;
2
- import { AriaTelemetryConstants, ChatSDKError, Constants, LocaleConstants } from "./Constants";
2
+ import { AriaTelemetryConstants, ChatSDKError, Constants, HtmlAttributeNames, LocaleConstants } from "./Constants";
3
3
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "./telemetry/TelemetryConstants";
4
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
5
  import { DataStoreManager } from "./contextDataStore/DataStoreManager";
@@ -382,4 +382,18 @@ export const checkContactIdError = e => {
382
382
  };
383
383
  BroadcastService.postMessage(contactIdNotFoundErrorEvent);
384
384
  }
385
+ };
386
+ export const createFileAndDownload = (fileName, blobData, mimeType) => {
387
+ const aElement = document.createElement("a");
388
+ const blob = new Blob([blobData], {
389
+ type: mimeType
390
+ });
391
+ const objectUrl = URL.createObjectURL(blob);
392
+ aElement.setAttribute(HtmlAttributeNames.href, objectUrl);
393
+ aElement.setAttribute(HtmlAttributeNames.download, fileName);
394
+ aElement.setAttribute(HtmlAttributeNames.ariaHidden, "true");
395
+ aElement.style.display = "none";
396
+ document.body.appendChild(aElement);
397
+ aElement.click();
398
+ document.body.removeChild(aElement);
385
399
  };
@@ -0,0 +1,158 @@
1
+ import React, { useCallback, useEffect, useState } from "react";
2
+ import DraggableEventReceiver from "./DraggableEventReceiver";
3
+ import DraggableEventNames from "./DraggableEventNames";
4
+ import useChatContextStore from "../../hooks/useChatContextStore";
5
+ import { ConversationState } from "../../contexts/common/ConversationState";
6
+ import { isNullOrUndefined } from "../../common/utils";
7
+ const DraggableChatWidget = props => {
8
+ const [state] = useChatContextStore();
9
+ const [initialPosition, setInitialPosition] = useState({
10
+ offsetLeft: 0,
11
+ offsetTop: 0
12
+ });
13
+ const [cachedPosition, setCachedPosition] = useState(undefined);
14
+ const [position, setPosition] = useState({
15
+ offsetLeft: 0,
16
+ offsetTop: 0
17
+ });
18
+ const [delta, setDelta] = useState({
19
+ left: 0,
20
+ top: 0
21
+ });
22
+ const repositionElement = (draggableElement, offsetLeft, offsetTop) => {
23
+ draggableElement.style.left = `${offsetLeft}px`;
24
+ draggableElement.style.top = `${offsetTop}px`;
25
+ };
26
+ const calculateOffsetsWithinViewport = useCallback((id, offset, delta) => {
27
+ const draggableElement = document.getElementById(id);
28
+ const positionRelativeToViewport = draggableElement.getBoundingClientRect();
29
+ if (isNullOrUndefined(draggableElement) || isNullOrUndefined(positionRelativeToViewport) || isNullOrUndefined(offset.offsetLeft) || isNullOrUndefined(offset.offsetTop)) {
30
+ return;
31
+ }
32
+ let offsetLeft = offset.offsetLeft;
33
+ let offsetTop = offset.offsetTop;
34
+
35
+ // Widget size larger than viewport would not have any restriction
36
+ if (positionRelativeToViewport.width > window.innerWidth) {
37
+ return;
38
+ }
39
+ if (positionRelativeToViewport.height > window.innerHeight) {
40
+ return;
41
+ }
42
+
43
+ // Ensures widget is within viewport
44
+ if (positionRelativeToViewport.x < 0) {
45
+ offsetLeft = 0 - delta.left;
46
+ }
47
+ if (positionRelativeToViewport.y < 0) {
48
+ offsetTop = 0 - delta.top;
49
+ }
50
+ if (positionRelativeToViewport.x + positionRelativeToViewport.width > window.innerWidth) {
51
+ offsetLeft = window.innerWidth - positionRelativeToViewport.width - delta.left;
52
+ }
53
+ if (positionRelativeToViewport.y + positionRelativeToViewport.height > window.innerHeight) {
54
+ offsetTop = window.innerHeight - positionRelativeToViewport.height - delta.top;
55
+ }
56
+ repositionElement(draggableElement, offsetLeft, offsetTop);
57
+ setPosition({
58
+ offsetLeft,
59
+ offsetTop
60
+ });
61
+ }, []);
62
+ const resetPosition = useCallback(targetPosition => {
63
+ calculateOffsetsWithinViewport(props.elementId, targetPosition, delta); // Ensure viewport restriction
64
+ }, [delta]);
65
+ useEffect(() => {
66
+ if (props.disabled === true) {
67
+ return;
68
+ }
69
+ const cacheInitialPosition = () => {
70
+ const draggableElement = document.getElementById(props.elementId);
71
+ const offsetLeft = draggableElement.offsetLeft;
72
+ const offsetTop = draggableElement.offsetTop;
73
+ setInitialPosition({
74
+ offsetLeft,
75
+ offsetTop
76
+ });
77
+ };
78
+ const calculateOffsets = () => {
79
+ const draggableElement = document.getElementById(props.elementId);
80
+ const offsetLeft = draggableElement.offsetLeft;
81
+ const offsetTop = draggableElement.offsetTop;
82
+
83
+ // Calculates the delta between the position of the widget and the position of the widget relative to the viewport which will be used for repositioning
84
+ const positionRelativeToViewport = draggableElement.getBoundingClientRect();
85
+ const left = positionRelativeToViewport.left - offsetLeft;
86
+ const top = positionRelativeToViewport.top - offsetTop;
87
+ setDelta({
88
+ left,
89
+ top
90
+ });
91
+ calculateOffsetsWithinViewport(props.elementId, {
92
+ offsetLeft,
93
+ offsetTop
94
+ }, {
95
+ left,
96
+ top
97
+ });
98
+ };
99
+ calculateOffsets();
100
+ cacheInitialPosition();
101
+ window.addEventListener("resize", calculateOffsets);
102
+ return () => {
103
+ window.removeEventListener("resize", calculateOffsets);
104
+ };
105
+ }, [props.disabled]);
106
+ useEffect(() => {
107
+ if (props.disabled === true) {
108
+ return;
109
+ }
110
+ if (state.appStates.conversationState == ConversationState.Closed) {
111
+ resetPosition(initialPosition);
112
+ } else if (state.appStates.isMinimized) {
113
+ const draggableElement = document.getElementById(props.elementId);
114
+ const offsetLeft = draggableElement.offsetLeft;
115
+ const offsetTop = draggableElement.offsetTop;
116
+ if (!cachedPosition) {
117
+ setCachedPosition({
118
+ offsetLeft,
119
+ offsetTop
120
+ });
121
+ }
122
+ resetPosition(initialPosition);
123
+ } else if (!isNullOrUndefined(state.appStates.isMinimized) && !state.appStates.isMinimized) {
124
+ if (cachedPosition) {
125
+ resetPosition(cachedPosition);
126
+ setCachedPosition(undefined);
127
+ }
128
+ }
129
+ }, [props.disabled, state.appStates.isMinimized, state.appStates.conversationState, initialPosition, cachedPosition]);
130
+ const onEvent = useCallback(event => {
131
+ if (event.eventName === DraggableEventNames.Dragging) {
132
+ if (event.offset) {
133
+ const offsetLeft = position.offsetLeft + event.offset.x;
134
+ const offsetTop = position.offsetTop + event.offset.y;
135
+
136
+ // Update position via DOM manipulation to prevent <Stack/> continuously rendering on style change causing high CPU spike
137
+ const draggableElement = document.getElementById(props.elementId);
138
+ repositionElement(draggableElement, offsetLeft, offsetTop);
139
+ setPosition({
140
+ offsetLeft,
141
+ offsetTop
142
+ });
143
+ calculateOffsetsWithinViewport(props.elementId, {
144
+ offsetLeft,
145
+ offsetTop
146
+ }, delta);
147
+ }
148
+ }
149
+ }, [position, delta]);
150
+ if (props.disabled === true) {
151
+ return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
152
+ }
153
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableEventReceiver, {
154
+ channel: props.channel ?? "lcw",
155
+ onEvent: onEvent
156
+ }, props.children));
157
+ };
158
+ export default DraggableChatWidget;
@@ -0,0 +1,64 @@
1
+ import React, { useCallback, useEffect, useState } from "react";
2
+ import DraggableEventNames from "./DraggableEventNames";
3
+ /**
4
+ * Trigger component which would send IDraggableEvent to the receiver to update the draggable component position
5
+ *
6
+ * @param props IDraggableEventEmitterProps
7
+ * @returns
8
+ */
9
+ const DraggableEventEmitter = props => {
10
+ const [initialized, setInitialized] = useState(false);
11
+ const postMessage = useCallback(data => {
12
+ const targetWindow = props.targetWindow ?? window;
13
+ targetWindow.postMessage(data, "*");
14
+ }, [props.targetWindow]);
15
+ const dragStart = useCallback(event => {
16
+ postMessage({
17
+ channel: props.channel,
18
+ eventName: DraggableEventNames.DragStart
19
+ });
20
+ let cursor = {
21
+ x: event.screenX,
22
+ y: event.screenY
23
+ }; // Cursor init position
24
+ const dragging = event => {
25
+ event.preventDefault();
26
+ const newX = event.screenX;
27
+ const newY = event.screenY;
28
+ const offset = {
29
+ x: newX - cursor.x,
30
+ y: newY - cursor.y
31
+ }; // Calculate cursor position diff
32
+ cursor = {
33
+ ...cursor,
34
+ x: newX,
35
+ y: newY
36
+ }; // Update cursor new position
37
+
38
+ postMessage({
39
+ channel: props.channel,
40
+ eventName: DraggableEventNames.Dragging,
41
+ offset
42
+ });
43
+ };
44
+ const dragEnd = () => {
45
+ postMessage({
46
+ channel: props.channel,
47
+ eventName: DraggableEventNames.DragEnd
48
+ });
49
+ document.removeEventListener("mousemove", dragging);
50
+ document.removeEventListener("mouseup", dragEnd);
51
+ };
52
+ document.addEventListener("mousemove", dragging);
53
+ document.addEventListener("mouseup", dragEnd);
54
+ }, [props.channel]);
55
+ useEffect(() => {
56
+ if (!initialized && props.elementId) {
57
+ const element = document.getElementById(props.elementId);
58
+ element === null || element === void 0 ? void 0 : element.addEventListener("mousedown", dragStart);
59
+ setInitialized(true);
60
+ }
61
+ }, [dragStart, props.elementId, initialized]);
62
+ return /*#__PURE__*/React.createElement(React.Fragment, null, " ", props.children, " ");
63
+ };
64
+ export default DraggableEventEmitter;
@@ -0,0 +1,7 @@
1
+ var DraggableEventNames;
2
+ (function (DraggableEventNames) {
3
+ DraggableEventNames["DragStart"] = "DragStart";
4
+ DraggableEventNames["Dragging"] = "Dragging";
5
+ DraggableEventNames["DragEnd"] = "DragEnd";
6
+ })(DraggableEventNames || (DraggableEventNames = {}));
7
+ export default DraggableEventNames;
@@ -0,0 +1,25 @@
1
+ import React, { useEffect } from "react";
2
+ /**
3
+ * Component which would listen to DraggableEvent, update the component position or react accordingly.
4
+ *
5
+ * @param props IDraggableEventReceiverProps
6
+ * @returns
7
+ */
8
+ const DraggableEventReceiver = props => {
9
+ useEffect(() => {
10
+ const listener = event => {
11
+ const {
12
+ data
13
+ } = event;
14
+ if (data.channel && props.channel && data.channel === props.channel) {
15
+ props.onEvent(data);
16
+ }
17
+ };
18
+ window.addEventListener("message", listener);
19
+ return () => {
20
+ window.removeEventListener("message", listener);
21
+ };
22
+ }, [props]);
23
+ return /*#__PURE__*/React.createElement(React.Fragment, null, " ", props.children, " ");
24
+ };
25
+ export default DraggableEventReceiver;
@@ -0,0 +1 @@
1
+ export {};
@@ -16,7 +16,7 @@ import useChatSDKStore from "../../hooks/useChatSDKStore";
16
16
  export const FooterStateful = props => {
17
17
  var _footerProps$controlP3, _footerProps$controlP4;
18
18
  const [state, dispatch] = useChatContextStore();
19
- // hideFooterDisplay - the purpose of this is to keep the footer always "active",
19
+ // hideFooterDisplay - the purpose of this is to keep the footer always "active",
20
20
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
21
21
  // The reason for this approach is to make sure that state variables for audio notification work correctly after minimizing
22
22
  const {
@@ -36,7 +36,7 @@ export const FooterStateful = props => {
36
36
  Event: TelemetryEvent.DownloadTranscriptButtonClicked,
37
37
  Description: "Download Transcript button clicked."
38
38
  });
39
- await downloadTranscript(chatSDK, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.renderMarkDown, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.bannerMessageOnError, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.attachmentMessage, state);
39
+ await downloadTranscript(chatSDK, downloadTranscriptProps, state);
40
40
  } catch (ex) {
41
41
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
42
42
  Event: TelemetryEvent.DownloadTranscriptFailed,
@@ -1,9 +1,11 @@
1
- import { Constants, HtmlAttributeNames, TranscriptConstants } from "../../../common/Constants";
1
+ import { Constants, TranscriptConstants } from "../../../common/Constants";
2
2
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
3
3
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
4
4
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
5
5
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
6
+ import createChatTranscript from "../../../plugins/createChatTranscript";
6
7
  import DOMPurify from "dompurify";
8
+ import { createFileAndDownload, isNullOrUndefined } from "../../../common/utils";
7
9
  const processDisplayName = displayName => {
8
10
  // if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
9
11
  const displayNameRegex = ".+:.+";
@@ -154,7 +156,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
154
156
  };
155
157
 
156
158
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
- export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageOnError, attachmentMessage, state) => {
159
+ export const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
158
160
  var _state$domainStates, _state$domainStates2, _state$domainStates2$;
159
161
  // Need to keep existing request id for scenarios when trnascript is downloaded after endchat
160
162
  const liveChatContext = {
@@ -167,18 +169,25 @@ export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageO
167
169
  if (typeof data === Constants.String) {
168
170
  data = JSON.parse(data);
169
171
  }
172
+ const {
173
+ bannerMessageOnError,
174
+ renderMarkDown,
175
+ attachmentMessage,
176
+ webChatTranscript
177
+ } = downloadTranscriptProps;
170
178
  if (data[Constants.ChatMessagesJson] !== null && data[Constants.ChatMessagesJson] !== undefined) {
171
- const chatTranscripts = window.btoa(encodeURIComponent(beautifyChatTranscripts(data[Constants.ChatMessagesJson], renderMarkDown, attachmentMessage)));
172
- const byteCharacters = decodeURIComponent(window.atob(chatTranscripts));
173
- const blob = new Blob([byteCharacters], {
174
- "type": "text/html;charset=utf-8"
175
- });
176
- const link = document.createElement("a");
177
- document.body.appendChild(link);
178
- link.setAttribute(HtmlAttributeNames.download, TranscriptConstants.ChatTranscriptDownloadFile);
179
- link.setAttribute(HtmlAttributeNames.href, URL.createObjectURL(blob));
180
- link.setAttribute(HtmlAttributeNames.ariaHidden, "true");
181
- link.click();
179
+ const useWebChatTranscript = isNullOrUndefined(webChatTranscript === null || webChatTranscript === void 0 ? void 0 : webChatTranscript.disabled) || (webChatTranscript === null || webChatTranscript === void 0 ? void 0 : webChatTranscript.disabled) === false;
180
+ if (useWebChatTranscript) {
181
+ const transcriptOptions = {
182
+ ...webChatTranscript
183
+ };
184
+ await createChatTranscript(data[Constants.ChatMessagesJson], chatSDK, false, transcriptOptions);
185
+ } else {
186
+ // Legacy Transcript
187
+ const chatTranscripts = window.btoa(encodeURIComponent(beautifyChatTranscripts(data[Constants.ChatMessagesJson], renderMarkDown, attachmentMessage)));
188
+ const byteCharacters = decodeURIComponent(window.atob(chatTranscripts));
189
+ createFileAndDownload(TranscriptConstants.ChatTranscriptDownloadFile, byteCharacters, "text/html;charset=utf-8");
190
+ }
182
191
  } else {
183
192
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
184
193
  Event: TelemetryEvent.DownloadTranscriptResponseNullOrUndefined,
@@ -8,6 +8,7 @@ import { defaultOutOfOfficeHeaderStyleProps } from "./common/styleProps/defaultO
8
8
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
9
9
  import useChatContextStore from "../../hooks/useChatContextStore";
10
10
  import { ConfirmationState } from "../../common/Constants";
11
+ import DraggableEventEmitter from "../draggable/DraggableEventEmitter";
11
12
  export const HeaderStateful = props => {
12
13
  var _state$domainStates$l, _state$domainStates$l2, _state$domainStates, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro, _state$domainStates3;
13
14
  const [state, dispatch] = useChatContextStore();
@@ -91,6 +92,32 @@ export const HeaderStateful = props => {
91
92
  var _state$domainStates2;
92
93
  localConfirmationPaneState.current = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.confirmationState;
93
94
  }, [state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.confirmationState]);
95
+ const draggableEventEmitterProps = {
96
+ channel: props.draggableEventChannel ?? "lcw",
97
+ elementId: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps.id : controlProps.id,
98
+ targetWindow: props.draggableEventEmitterTargetWindow ?? window
99
+ };
100
+ if (props.draggable === true) {
101
+ var _generalStyleProps;
102
+ const styleProps = outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeStyleProps : headerProps === null || headerProps === void 0 ? void 0 : headerProps.styleProps;
103
+ const draggableSelectors = {
104
+ "&:hover": {
105
+ cursor: "move"
106
+ }
107
+ };
108
+ const selectors = Object.assign({}, (styleProps === null || styleProps === void 0 ? void 0 : (_generalStyleProps = styleProps.generalStyleProps) === null || _generalStyleProps === void 0 ? void 0 : _generalStyleProps.selectors) || {}, draggableSelectors); // eslint-disable-line @typescript-eslint/no-explicit-any
109
+ const generalStyleProps = Object.assign({}, styleProps === null || styleProps === void 0 ? void 0 : styleProps.generalStyleProps, {
110
+ selectors
111
+ });
112
+ const draggableStyleProps = Object.assign({}, styleProps, {
113
+ generalStyleProps
114
+ });
115
+ return /*#__PURE__*/React.createElement(DraggableEventEmitter, draggableEventEmitterProps, /*#__PURE__*/React.createElement(Header, {
116
+ componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
117
+ controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
118
+ styleProps: draggableStyleProps
119
+ }));
120
+ }
94
121
  return /*#__PURE__*/React.createElement(Header, {
95
122
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
96
123
  controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
@@ -0,0 +1,20 @@
1
+ import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
2
+ const createDownloadTranscriptProps = (downloadTranscriptProps, webChatStyles, webChatContainerProps) => {
3
+ const disableNewLineMarkdownSupport = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.disableNewLineMarkdownSupport) ?? defaultWebChatContainerStatefulProps.disableNewLineMarkdownSupport;
4
+ const disableMarkdownMessageFormatting = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.disableMarkdownMessageFormatting) ?? defaultWebChatContainerStatefulProps.disableMarkdownMessageFormatting;
5
+ const props = {
6
+ ...downloadTranscriptProps,
7
+ webChatTranscript: {
8
+ ...(downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.webChatTranscript),
9
+ disableNewLineMarkdownSupport,
10
+ disableMarkdownMessageFormatting,
11
+ transcriptBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.backgroundColor,
12
+ agentAvatarBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleBackground,
13
+ agentAvatarFontColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleTextColor,
14
+ customerAvatarBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleFromUserBackground,
15
+ customerAvatarFontColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleFromUserTextColor
16
+ }
17
+ };
18
+ return props;
19
+ };
20
+ export default createDownloadTranscriptProps;
@@ -595,7 +595,15 @@ export const dummyDefaultProps = {
595
595
  downloadTranscriptProps: {
596
596
  bannerMessageOnError: "Download transcript failed.",
597
597
  renderMarkDown: undefined,
598
- attachmentMessage: "The following attachment was uploaded during the conversation:"
598
+ attachmentMessage: "The following attachment was uploaded during the conversation:",
599
+ webChatTranscript: {
600
+ disabled: false,
601
+ fileName: "transcript",
602
+ pageTitle: "Customer Transcript",
603
+ attachmentMessage: "The following attachment was uploaded during the conversation: ",
604
+ networkOnlineMessage: "Connection restored. Please refresh the page",
605
+ networkOfflineMessage: "Network Error. Please make sure you are connected to the internet."
606
+ }
599
607
  },
600
608
  emailTranscriptPane: {
601
609
  componentOverrides: {
@@ -1790,7 +1798,10 @@ export const dummyDefaultProps = {
1790
1798
  },
1791
1799
  adaptiveCardStyles: {
1792
1800
  background: "white",
1793
- color: "black"
1801
+ color: "black",
1802
+ anchorColor: "blue",
1803
+ textWhiteSpace: "normal",
1804
+ buttonWhiteSpace: "normal"
1794
1805
  },
1795
1806
  hyperlinkTextOverride: false
1796
1807
  },
@@ -4,6 +4,7 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
4
  import { defaultAriaConfig } from "../../../common/telemetry/defaultConfigs/defaultAriaConfig";
5
5
  import { defaultInternalTelemetryData } from "../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData";
6
6
  import { defaultTelemetryConfiguration } from "../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration";
7
+ import { newGuid } from "../../../common/utils";
7
8
  export const registerTelemetryLoggers = (props, dispatch) => {
8
9
  var _props$liveChatContex, _props$liveChatContex2;
9
10
  const telemetryConfig = {
@@ -14,7 +15,7 @@ export const registerTelemetryLoggers = (props, dispatch) => {
14
15
  var _props$liveChatContex3, _props$liveChatContex4;
15
16
  TelemetryManager.InternalTelemetryData = (_props$liveChatContex3 = props.liveChatContextFromCache) === null || _props$liveChatContex3 === void 0 ? void 0 : (_props$liveChatContex4 = _props$liveChatContex3.domainStates) === null || _props$liveChatContex4 === void 0 ? void 0 : _props$liveChatContex4.telemetryInternalData;
16
17
  } else {
17
- var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$chatSDK3, _props$chatSDK3$omnic;
18
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$chatSDK3, _props$chatSDK3$omnic, _props$chatSDK4, _props$chatSDK4$omnic, _props$chatSDK5, _props$chatSDK5$omnic, _props$chatSDK6, _props$chatSDK6$omnic, _props$chatSDK7, _props$chatSDK7$omnic, _props$chatSDK8, _props$chatSDK8$omnic, _props$chatSDK9, _props$chatSDK9$omnic;
18
19
  let telemetryData = {
19
20
  ...defaultInternalTelemetryData,
20
21
  telemetryConfig: Object.assign({}, defaultTelemetryConfiguration, telemetryConfig),
@@ -23,13 +24,22 @@ export const registerTelemetryLoggers = (props, dispatch) => {
23
24
  if (props.chatConfig) {
24
25
  telemetryData = TelemetryHelper.addChatConfigDataToTelemetry(props === null || props === void 0 ? void 0 : props.chatConfig, telemetryData);
25
26
  }
26
- telemetryData = TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
27
+ if (!((_props$chatSDK = props.chatSDK) !== null && _props$chatSDK !== void 0 && (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) !== null && _props$chatSDK$omnich !== void 0 && _props$chatSDK$omnich.orgId) || ((_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.orgId.trim().length) === 0) {
28
+ throw new Error("orgId is undefined in ChatSDK");
29
+ }
30
+ if (!((_props$chatSDK3 = props.chatSDK) !== null && _props$chatSDK3 !== void 0 && (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) !== null && _props$chatSDK3$omnic !== void 0 && _props$chatSDK3$omnic.widgetId) || ((_props$chatSDK4 = props.chatSDK) === null || _props$chatSDK4 === void 0 ? void 0 : (_props$chatSDK4$omnic = _props$chatSDK4.omnichannelConfig) === null || _props$chatSDK4$omnic === void 0 ? void 0 : _props$chatSDK4$omnic.widgetId.trim().length) === 0) {
31
+ throw new Error("widgetId is undefined in ChatSDK");
32
+ }
33
+ if (!((_props$chatSDK5 = props.chatSDK) !== null && _props$chatSDK5 !== void 0 && (_props$chatSDK5$omnic = _props$chatSDK5.omnichannelConfig) !== null && _props$chatSDK5$omnic !== void 0 && _props$chatSDK5$omnic.orgUrl) || ((_props$chatSDK6 = props.chatSDK) === null || _props$chatSDK6 === void 0 ? void 0 : (_props$chatSDK6$omnic = _props$chatSDK6.omnichannelConfig) === null || _props$chatSDK6$omnic === void 0 ? void 0 : _props$chatSDK6$omnic.orgUrl.trim().length) === 0) {
34
+ throw new Error("orgUrl is undefined in ChatSDK");
35
+ }
27
36
  telemetryData.OCChatSDKVersion = telemetryConfig.OCChatSDKVersion ?? "0.0.0-0";
28
37
  telemetryData.chatComponentVersion = telemetryConfig.chatComponentVersion ?? "0.0.0-0";
29
38
  telemetryData.chatWidgetVersion = telemetryConfig.chatWidgetVersion ?? "0.0.0-0";
30
- telemetryData.orgId = (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId;
31
- telemetryData.widgetId = (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId;
32
- telemetryData.orgUrl = (_props$chatSDK3 = props.chatSDK) === null || _props$chatSDK3 === void 0 ? void 0 : (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) === null || _props$chatSDK3$omnic === void 0 ? void 0 : _props$chatSDK3$omnic.orgUrl;
39
+ telemetryData.orgId = (_props$chatSDK7 = props.chatSDK) === null || _props$chatSDK7 === void 0 ? void 0 : (_props$chatSDK7$omnic = _props$chatSDK7.omnichannelConfig) === null || _props$chatSDK7$omnic === void 0 ? void 0 : _props$chatSDK7$omnic.orgId;
40
+ telemetryData.widgetId = (_props$chatSDK8 = props.chatSDK) === null || _props$chatSDK8 === void 0 ? void 0 : (_props$chatSDK8$omnic = _props$chatSDK8.omnichannelConfig) === null || _props$chatSDK8$omnic === void 0 ? void 0 : _props$chatSDK8$omnic.widgetId;
41
+ telemetryData.orgUrl = (_props$chatSDK9 = props.chatSDK) === null || _props$chatSDK9 === void 0 ? void 0 : (_props$chatSDK9$omnic = _props$chatSDK9.omnichannelConfig) === null || _props$chatSDK9$omnic === void 0 ? void 0 : _props$chatSDK9$omnic.orgUrl;
42
+ telemetryData.lcwRuntimeId = telemetryConfig.LCWRuntimeId ?? newGuid();
33
43
  TelemetryManager.InternalTelemetryData = telemetryData;
34
44
  dispatch({
35
45
  type: LiveChatWidgetActionType.SET_TELEMETRY_DATA,
@@ -408,7 +408,7 @@ const getInitContextParamForPopoutFromOuterScope = async scope => {
408
408
  };
409
409
  window.addEventListener("message", getInitContextParamsFromParent, false);
410
410
  scope.postMessage({
411
- messageName: Constants.InitContextParamsResponse
411
+ messageName: Constants.InitContextParamsRequest
412
412
  }, "*");
413
413
  await waitPromise;
414
414
  window.removeEventListener("message", getInitContextParamsFromParent, false);