@microsoft/omnichannel-chat-widget 1.1.1-main.45472ff → 1.1.1-main.75135c5

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 (61) hide show
  1. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +20 -15
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -0
  3. package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -0
  4. package/lib/cjs/components/draggable/DraggableChatWidget.js +168 -0
  5. package/lib/cjs/components/draggable/DraggableEventEmitter.js +74 -0
  6. package/lib/cjs/components/draggable/DraggableEventNames.js +14 -0
  7. package/lib/cjs/components/draggable/DraggableEventReceiver.js +34 -0
  8. package/lib/cjs/components/draggable/IDraggableElementPosition.js +1 -0
  9. package/lib/cjs/components/draggable/IDraggableElementPositionDelta.js +1 -0
  10. package/lib/cjs/components/draggable/IDraggableEvent.js +1 -0
  11. package/lib/cjs/components/headerstateful/HeaderStateful.js +27 -0
  12. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -3
  13. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +4 -1
  14. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +15 -5
  15. package/lib/cjs/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
  16. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -8
  17. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +41 -14
  18. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  19. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
  20. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  21. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  22. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +18 -14
  23. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  24. package/lib/esm/common/telemetry/TelemetryHelper.js +9 -0
  25. package/lib/esm/components/draggable/DraggableChatWidget.js +158 -0
  26. package/lib/esm/components/draggable/DraggableEventEmitter.js +64 -0
  27. package/lib/esm/components/draggable/DraggableEventNames.js +7 -0
  28. package/lib/esm/components/draggable/DraggableEventReceiver.js +25 -0
  29. package/lib/esm/components/draggable/IDraggableElementPosition.js +1 -0
  30. package/lib/esm/components/draggable/IDraggableElementPositionDelta.js +1 -0
  31. package/lib/esm/components/draggable/IDraggableEvent.js +1 -0
  32. package/lib/esm/components/headerstateful/HeaderStateful.js +27 -0
  33. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  34. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +4 -1
  35. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +15 -5
  36. package/lib/esm/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
  37. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -8
  38. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +41 -14
  39. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  40. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
  41. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  42. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  43. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -0
  44. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  45. package/lib/types/components/draggable/DraggableChatWidget.d.ts +9 -0
  46. package/lib/types/components/draggable/DraggableEventEmitter.d.ts +27 -0
  47. package/lib/types/components/draggable/DraggableEventNames.d.ts +6 -0
  48. package/lib/types/components/draggable/DraggableEventReceiver.d.ts +27 -0
  49. package/lib/types/components/draggable/IDraggableElementPosition.d.ts +5 -0
  50. package/lib/types/components/draggable/IDraggableElementPositionDelta.d.ts +5 -0
  51. package/lib/types/components/draggable/IDraggableEvent.d.ts +12 -0
  52. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +12 -0
  53. package/lib/types/components/livechatwidget/interfaces/IDraggableChatWidgetProps.d.ts +10 -0
  54. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  55. package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +2 -2
  56. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +5 -0
  57. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
  58. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
  59. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +2 -1
  60. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +1 -0
  61. package/package.json +3 -3
@@ -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 {};
@@ -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,
@@ -1,7 +1,8 @@
1
+ import { Constants } from "../../../common/Constants";
1
2
  import MarkdownIt from "markdown-it";
2
3
  import MarkdownItForInline from "markdown-it-for-inline";
4
+ import MarkdownSlack from "slack-markdown-it";
3
5
  import { defaultMarkdownLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts";
4
- import { Constants } from "../../../common/Constants";
5
6
 
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineMarkdownSupport) => {
@@ -12,8 +13,7 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
12
13
  linkify: true,
13
14
  breaks: !disableNewLineMarkdownSupport
14
15
  });
15
- // ToDo: Commenting below usage of plugin until deferred bug is resolved: https://github.com/mayashavin/markdown-it-slack/issues/1
16
- // markdown.use(MarkdownSlack);
16
+ markdown.use(MarkdownSlack);
17
17
  } else {
18
18
  markdown = new MarkdownIt(Constants.Zero, {
19
19
  html: true,
@@ -1798,7 +1798,10 @@ export const dummyDefaultProps = {
1798
1798
  },
1799
1799
  adaptiveCardStyles: {
1800
1800
  background: "white",
1801
- color: "black"
1801
+ color: "black",
1802
+ anchorColor: "blue",
1803
+ textWhiteSpace: "normal",
1804
+ buttonWhiteSpace: "normal"
1802
1805
  },
1803
1806
  hyperlinkTextOverride: false
1804
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,
@@ -7,6 +7,7 @@ import { Stack } from "@fluentui/react";
7
7
  import React, { useEffect, useRef, useState } from "react";
8
8
  import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
9
9
  import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty, newGuid } from "../../../common/utils";
10
+ import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
10
11
  import { endChat, prepareEndChat } from "../common/endChat";
11
12
  import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
12
13
  import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
@@ -15,8 +16,8 @@ import CallingContainerStateful from "../../callingcontainerstateful/CallingCont
15
16
  import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
16
17
  import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
17
18
  import { ConversationState } from "../../../contexts/common/ConversationState";
18
- import createDownloadTranscriptProps from "../common/createDownloadTranscriptProps";
19
19
  import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
20
+ import DraggableChatWidget from "../../draggable/DraggableChatWidget";
20
21
  import { ElementType } from "@microsoft/omnichannel-chat-components";
21
22
  import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
22
23
  import HeaderStateful from "../../headerstateful/HeaderStateful";
@@ -31,9 +32,9 @@ import ReconnectChatPaneStateful from "../../reconnectchatpanestateful/Reconnect
31
32
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
32
33
  import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
33
34
  import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
35
+ import createDownloadTranscriptProps from "../common/createDownloadTranscriptProps";
34
36
  import { createFooter } from "../common/createFooter";
35
37
  import { createInternetConnectionChangeHandler } from "../common/createInternetConnectionChangeHandler";
36
- import { defaultClientDataStoreProvider } from "../../../common/storage/default/defaultClientDataStoreProvider";
37
38
  import { defaultScrollBarProps } from "../common/defaultProps/defaultScrollBarProps";
38
39
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
39
40
  import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
@@ -50,7 +51,7 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
50
51
  import useChatContextStore from "../../../hooks/useChatContextStore";
51
52
  import useChatSDKStore from "../../../hooks/useChatSDKStore";
52
53
  export const LiveChatWidgetStateful = props => {
53
- var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
54
+ var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps11, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
54
55
  const [state, dispatch] = useChatContextStore();
55
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
57
  const [adapter, setAdapter] = useChatAdapterStore();
@@ -425,6 +426,9 @@ export const LiveChatWidgetStateful = props => {
425
426
  payload: undefined
426
427
  });
427
428
  });
429
+
430
+ // Check for TPC and log in telemetry if blocked
431
+ isCookieAllowed();
428
432
  return () => {
429
433
  disposeTelemetryLoggers();
430
434
  };
@@ -609,6 +613,22 @@ export const LiveChatWidgetStateful = props => {
609
613
  ...props,
610
614
  downloadTranscriptProps
611
615
  };
616
+ const chatWidgetDraggableConfig = {
617
+ elementId: widgetElementId,
618
+ channel: ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "lcw",
619
+ disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
620
+ };
621
+
622
+ // Disable receiving IDraggableEvent in current window
623
+ if (((_props$draggableChatW2 = props.draggableChatWidgetProps) === null || _props$draggableChatW2 === void 0 ? void 0 : _props$draggableChatW2.disabled) === false && (_props$draggableChatW3 = props.draggableChatWidgetProps) !== null && _props$draggableChatW3 !== void 0 && _props$draggableChatW3.targetIframe) {
624
+ chatWidgetDraggableConfig.disabled = true;
625
+ }
626
+ const headerDraggableConfig = {
627
+ draggableEventChannel: chatWidgetDraggableConfig.channel ?? "lcw",
628
+ draggableEventEmitterTargetWindow: (_props$draggableChatW4 = props.draggableChatWidgetProps) !== null && _props$draggableChatW4 !== void 0 && _props$draggableChatW4.targetIframe ? window.parent : window,
629
+ draggable: ((_props$draggableChatW5 = props.draggableChatWidgetProps) === null || _props$draggableChatW5 === void 0 ? void 0 : _props$draggableChatW5.disabled) !== true // Draggable by default, unless explicitly disabled
630
+ };
631
+
612
632
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
613
633
  ::-webkit-scrollbar {
614
634
  width: ${scrollbarProps.width};
@@ -626,7 +646,7 @@ export const LiveChatWidgetStateful = props => {
626
646
  ::-webkit-scrollbar-thumb:hover {
627
647
  background: ${scrollbarProps.thumbHoverColor};
628
648
  }
629
- `), /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
649
+ `), /*#__PURE__*/React.createElement(DraggableChatWidget, chatWidgetDraggableConfig, /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
630
650
  styleOptions: webChatStyles,
631
651
  directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
632
652
  }), /*#__PURE__*/React.createElement(Stack, {
@@ -640,11 +660,11 @@ export const LiveChatWidgetStateful = props => {
640
660
  })), !((_livechatProps$contro3 = livechatProps.controlProps) !== null && _livechatProps$contro3 !== void 0 && _livechatProps$contro3.hideProactiveChatPane) && shouldShowProactiveChatPane(state) && (decodeComponentString((_livechatProps$compon2 = livechatProps.componentOverrides) === null || _livechatProps$compon2 === void 0 ? void 0 : _livechatProps$compon2.proactiveChatPane) || /*#__PURE__*/React.createElement(ProactiveChatPaneStateful, {
641
661
  proactiveChatProps: livechatProps.proactiveChatPaneProps,
642
662
  startChat: prepareStartChatRelay
643
- })), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/React.createElement(HeaderStateful, {
663
+ })), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/React.createElement(HeaderStateful, _extends({
644
664
  headerProps: livechatProps.headerProps,
645
665
  outOfOfficeHeaderProps: livechatProps.outOfOfficeHeaderProps,
646
666
  endChat: endChatRelay
647
- })), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
667
+ }, headerDraggableConfig))), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
648
668
  loadingPaneProps: livechatProps.loadingPaneProps,
649
669
  startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
650
670
  })), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
@@ -655,9 +675,9 @@ export const LiveChatWidgetStateful = props => {
655
675
  initStartChat: initStartChatRelay
656
676
  })), !((_livechatProps$contro9 = livechatProps.controlProps) !== null && _livechatProps$contro9 !== void 0 && _livechatProps$contro9.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
657
677
  voiceVideoCallingSdk: voiceVideoCallingSDK
658
- }, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps.webChatContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
678
+ }, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
659
679
  setPostChatContext: setPostChatContextRelay,
660
680
  prepareEndChat: prepareEndChatRelay
661
- }))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane)))));
681
+ }))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
662
682
  };
663
683
  export default LiveChatWidgetStateful;
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
1
3
  import { Stack } from "@fluentui/react";
2
4
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
3
5
  import React, { useEffect } from "react";
@@ -6,18 +8,20 @@ import { BroadcastChannel } from "broadcast-channel";
6
8
  import { Components } from "botframework-webchat";
7
9
  import { Constants } from "../../common/Constants";
8
10
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
11
+ import { NotificationHandler } from "./webchatcontroller/notification/NotificationHandler";
12
+ import { NotificationScenarios } from "./webchatcontroller/enums/NotificationScenarios";
9
13
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
10
14
  import { WebChatActionType } from "./webchatcontroller/enums/WebChatActionType";
11
15
  import { WebChatStoreLoader } from "./webchatcontroller/WebChatStoreLoader";
12
16
  import { defaultAdaptiveCardStyles } from "./common/defaultStyles/defaultAdaptiveCardStyles";
13
17
  import { defaultMiddlewareLocalizedTexts } from "./common/defaultProps/defaultMiddlewareLocalizedTexts";
14
18
  import { defaultReceivedMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles";
19
+ import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles";
15
20
  import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
16
21
  import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
17
22
  import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
18
23
  import { setFocusOnSendBox } from "../../common/utils";
19
24
  import { useChatContextStore } from "../..";
20
- import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles";
21
25
  const broadcastChannelMessageEvent = "message";
22
26
  const postActivity = activity => {
23
27
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -44,28 +48,33 @@ const createMagicCodeSuccessResponse = signin => {
44
48
  };
45
49
  };
46
50
  export const WebChatContainerStateful = props => {
47
- var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
51
+ var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15;
48
52
  const {
49
53
  BasicWebChat
50
54
  } = Components;
51
55
  const [state, dispatch] = useChatContextStore();
52
56
  const magicCodeBroadcastChannel = new BroadcastChannel(Constants.magicCodeBroadcastChannel);
53
57
  const magicCodeResponseBroadcastChannel = new BroadcastChannel(Constants.magicCodeResponseBroadcastChannel);
58
+ const {
59
+ webChatContainerProps,
60
+ contextDataStore
61
+ } = props;
54
62
  const containerStyles = {
55
- root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, props === null || props === void 0 ? void 0 : props.containerStyles, {
63
+ root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
56
64
  display: state.appStates.isMinimized ? "none" : ""
57
65
  }) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
58
66
  };
59
67
 
60
68
  const localizedTexts = {
61
69
  ...defaultMiddlewareLocalizedTexts,
62
- ...(props === null || props === void 0 ? void 0 : props.localizedTexts)
70
+ ...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
63
71
  };
64
72
  useEffect(() => {
73
+ var _props$webChatContain, _props$webChatContain2;
65
74
  setFocusOnSendBox();
66
75
  dispatch({
67
76
  type: LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
68
- payload: props === null || props === void 0 ? void 0 : props.renderingMiddlewareProps
77
+ payload: webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.renderingMiddlewareProps
69
78
  });
70
79
  dispatch({
71
80
  type: LiveChatWidgetActionType.SET_MIDDLEWARE_LOCALIZED_TEXTS,
@@ -74,6 +83,17 @@ export const WebChatContainerStateful = props => {
74
83
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
75
84
  Event: TelemetryEvent.WebChatLoaded
76
85
  });
86
+ if (((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
87
+ try {
88
+ localStorage;
89
+ sessionStorage;
90
+ } catch (error) {
91
+ if (!window.TPCWarningShown) {
92
+ NotificationHandler.notifyWarning(NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
93
+ window.TPCWarningShown = true;
94
+ }
95
+ }
96
+ }
77
97
  }, []);
78
98
  useEffect(() => {
79
99
  const eventListener = event => {
@@ -114,26 +134,33 @@ export const WebChatContainerStateful = props => {
114
134
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
115
135
 
116
136
  .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card {
117
- background: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt = props.adaptiveCardStyles) === null || _props$adaptiveCardSt === void 0 ? void 0 : _props$adaptiveCardSt.background) ?? defaultAdaptiveCardStyles.background};
137
+ background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.background) ?? defaultAdaptiveCardStyles.background};
118
138
  }
119
139
 
120
140
  .webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
121
- max-width: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl = props.renderingMiddlewareProps) === null || _props$renderingMiddl === void 0 ? void 0 : (_props$renderingMiddl2 = _props$renderingMiddl.userMessageBoxStyles) === null || _props$renderingMiddl2 === void 0 ? void 0 : _props$renderingMiddl2.maxWidth) ?? (defaultUserMessageBoxStyles === null || defaultUserMessageBoxStyles === void 0 ? void 0 : defaultUserMessageBoxStyles.maxWidth)}
141
+ max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp2 === void 0 ? void 0 : (_webChatContainerProp3 = _webChatContainerProp2.userMessageBoxStyles) === null || _webChatContainerProp3 === void 0 ? void 0 : _webChatContainerProp3.maxWidth) ?? (defaultUserMessageBoxStyles === null || defaultUserMessageBoxStyles === void 0 ? void 0 : defaultUserMessageBoxStyles.maxWidth)}
122
142
  }
123
143
 
124
144
  .webchat__stacked-layout--show-avatar div.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__stacked-layout__message {
125
- max-width: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl3 = props.renderingMiddlewareProps) === null || _props$renderingMiddl3 === void 0 ? void 0 : (_props$renderingMiddl4 = _props$renderingMiddl3.systemMessageBoxStyles) === null || _props$renderingMiddl4 === void 0 ? void 0 : _props$renderingMiddl4.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
145
+ max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp4 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp4 === void 0 ? void 0 : (_webChatContainerProp5 = _webChatContainerProp4.systemMessageBoxStyles) === null || _webChatContainerProp5 === void 0 ? void 0 : _webChatContainerProp5.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
126
146
  }
127
147
 
128
- div[class="ac-textBlock"]>p{color:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt2 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt2 === void 0 ? void 0 : _props$adaptiveCardSt2.color) ?? defaultAdaptiveCardStyles.color}; white-space:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt3 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt3 === void 0 ? void 0 : _props$adaptiveCardSt3.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
129
-
130
- .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt4 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt4 === void 0 ? void 0 : _props$adaptiveCardSt4.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
148
+ div[class="ac-textBlock"] *,
149
+ div[class="ac-input-container"] * {color:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.color) ?? defaultAdaptiveCardStyles.color}; white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
150
+ div[class="ac-textBlock"] a:link,
151
+ div[class="ac-textBlock"] a:visited,
152
+ div[class="ac-textBlock"] a:hover,
153
+ div[class="ac-textBlock"] a:active {
154
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
155
+ }
156
+
157
+ .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp9 === void 0 ? void 0 : _webChatContainerProp9.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
131
158
 
132
159
  .ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
133
160
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
134
161
  height: '.75em';
135
162
  marginLeft: '.25em';
136
- filter:${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl5 = props.renderingMiddlewareProps) === null || _props$renderingMiddl5 === void 0 ? void 0 : (_props$renderingMiddl6 = _props$renderingMiddl5.receivedMessageAnchorStyles) === null || _props$renderingMiddl6 === void 0 ? void 0 : _props$renderingMiddl6.filter) ?? "none"};
163
+ filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp10 === void 0 ? void 0 : (_webChatContainerProp11 = _webChatContainerProp10.receivedMessageAnchorStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.filter) ?? "none"};
137
164
  }
138
165
  pre {
139
166
  white-space: pre-wrap;
@@ -146,13 +173,13 @@ export const WebChatContainerStateful = props => {
146
173
  .ms_lcw_webchat_received_message a:visited,
147
174
  .ms_lcw_webchat_received_message a:hover,
148
175
  .ms_lcw_webchat_received_message a:active {
149
- color: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl7 = props.renderingMiddlewareProps) === null || _props$renderingMiddl7 === void 0 ? void 0 : (_props$renderingMiddl8 = _props$renderingMiddl7.receivedMessageAnchorStyles) === null || _props$renderingMiddl8 === void 0 ? void 0 : _props$renderingMiddl8.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
176
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
150
177
  }
151
178
  .ms_lcw_webchat_sent_message a:link,
152
179
  .ms_lcw_webchat_sent_message a:visited,
153
180
  .ms_lcw_webchat_sent_message a:hover,
154
181
  .ms_lcw_webchat_sent_message a:active {
155
- color: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl9 = props.renderingMiddlewareProps) === null || _props$renderingMiddl9 === void 0 ? void 0 : (_props$renderingMiddl10 = _props$renderingMiddl9.sentMessageAnchorStyles) === null || _props$renderingMiddl10 === void 0 ? void 0 : _props$renderingMiddl10.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
182
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
156
183
  }
157
184
  `), /*#__PURE__*/React.createElement(Stack, {
158
185
  styles: containerStyles
@@ -24,5 +24,6 @@ export const defaultMiddlewareLocalizedTexts = {
24
24
  MIDDLEWARE_MESSAGE_DELIVERED: "Sent",
25
25
  MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
26
26
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
27
- MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat."
27
+ MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
28
+ THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation."
28
29
  };
@@ -1,6 +1,7 @@
1
1
  export const defaultAdaptiveCardStyles = {
2
2
  background: "white",
3
3
  color: "black",
4
+ anchorColor: "blue",
4
5
  textWhiteSpace: "normal",
5
6
  buttonWhiteSpace: "normal"
6
7
  };
@@ -8,6 +8,11 @@ export class MockChatSDK {
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  _defineProperty(this, "sleep", ms => new Promise(r => setTimeout(r, ms)));
10
10
  _defineProperty(this, "isMockModeOn", true);
11
+ _defineProperty(this, "omnichannelConfig", {
12
+ widgetId: "00000000-0000-0000-0000-000000000000",
13
+ orgId: "00000000-0000-0000-0000-000000000000",
14
+ orgUrl: "https://contoso.crm.dynamics.com"
15
+ });
11
16
  }
12
17
  async startChat() {
13
18
  await this.sleep(1000);
@@ -7,4 +7,5 @@ export let NotificationScenarios;
7
7
  NotificationScenarios["InternetConnection"] = "internet connection";
8
8
  NotificationScenarios["MaxSizeError"] = "max size";
9
9
  NotificationScenarios["ChatDisconnect"] = "chat disconnect";
10
+ NotificationScenarios["TPC"] = "tpc blocked";
10
11
  })(NotificationScenarios || (NotificationScenarios = {}));
@@ -1,3 +1,4 @@
1
1
  import { IContextDataStore } from "../../interfaces/IContextDataStore";
2
2
  import { StorageType } from "../../Constants";
3
+ export declare const isCookieAllowed: () => boolean;
3
4
  export declare const defaultClientDataStoreProvider: (cacheTtlinMins?: number, storageType?: StorageType) => IContextDataStore;
@@ -151,6 +151,7 @@ export declare enum TelemetryEvent {
151
151
  SetBotAuthProviderHideCard = "SetBotAuthProviderHideCard",
152
152
  SetBotAuthProviderDisplayCard = "SetBotAuthProviderDisplayCard",
153
153
  SetBotAuthProviderNotFound = "SetBotAuthProviderNotFound",
154
+ ThirdPartyCookiesBlocked = "ThirdPartyCookiesBlocked",
154
155
  ProcessingHTMLTextMiddlewareFailed = "ProcessingHTMLTextMiddlewareFailed",
155
156
  ProcessingSanitizationMiddlewareFailed = "ProcessingSanitizationMiddlewareFailed",
156
157
  FormatTagsMiddlewareJSONStringifyFailed = "FormatTagsMiddlewareJSONStringifyFailed",
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ interface IDraggableChatWidgetInternalProps {
3
+ disabled?: boolean;
4
+ channel?: string;
5
+ elementId: string;
6
+ children: ReactNode;
7
+ }
8
+ declare const DraggableChatWidget: (props: IDraggableChatWidgetInternalProps) => JSX.Element;
9
+ export default DraggableChatWidget;
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+ interface IDraggableEventEmitterProps {
3
+ /**
4
+ * Unique channel name to send/receive draggable events to prevent event collisions
5
+ */
6
+ channel: string;
7
+ /**
8
+ * React nodes children
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * HTML element ID of the trigger element to send IDraggableEvent to update the draggable element position
13
+ */
14
+ elementId: string;
15
+ /**
16
+ * Target window to post IDraggableEvent messages
17
+ */
18
+ targetWindow?: Window;
19
+ }
20
+ /**
21
+ * Trigger component which would send IDraggableEvent to the receiver to update the draggable component position
22
+ *
23
+ * @param props IDraggableEventEmitterProps
24
+ * @returns
25
+ */
26
+ declare const DraggableEventEmitter: (props: IDraggableEventEmitterProps) => JSX.Element;
27
+ export default DraggableEventEmitter;
@@ -0,0 +1,6 @@
1
+ declare enum DraggableEventNames {
2
+ DragStart = "DragStart",
3
+ Dragging = "Dragging",
4
+ DragEnd = "DragEnd"
5
+ }
6
+ export default DraggableEventNames;
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+ import IDraggableEvent from "./IDraggableEvent";
3
+ interface IDraggableEventReceiverProps {
4
+ /**
5
+ * Unique channel name to send/receive draggable events to prevent event collisions
6
+ */
7
+ channel: string;
8
+ /**
9
+ * React nodes children
10
+ */
11
+ children: ReactNode;
12
+ /**
13
+ * Event handler on receiving draggable events
14
+ *
15
+ * @param event Draggable events
16
+ * @returns
17
+ */
18
+ onEvent: (event: IDraggableEvent) => void;
19
+ }
20
+ /**
21
+ * Component which would listen to DraggableEvent, update the component position or react accordingly.
22
+ *
23
+ * @param props IDraggableEventReceiverProps
24
+ * @returns
25
+ */
26
+ declare const DraggableEventReceiver: (props: IDraggableEventReceiverProps) => JSX.Element;
27
+ export default DraggableEventReceiver;
@@ -0,0 +1,5 @@
1
+ interface IDraggableElementPosition {
2
+ offsetLeft: number;
3
+ offsetTop: number;
4
+ }
5
+ export default IDraggableElementPosition;
@@ -0,0 +1,5 @@
1
+ interface IDraggableElementPositionDelta {
2
+ left: number;
3
+ top: number;
4
+ }
5
+ export default IDraggableElementPositionDelta;
@@ -0,0 +1,12 @@
1
+ import DraggableEventNames from "./DraggableEventNames";
2
+ import IDraggableElementPosition from "./IDraggableElementPosition";
3
+ interface IDraggableEvent {
4
+ channel: string;
5
+ eventName: DraggableEventNames | string;
6
+ offset?: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ position?: IDraggableElementPosition;
11
+ }
12
+ export default IDraggableEvent;
@@ -18,4 +18,16 @@ export interface IHeaderStatefulParams {
18
18
  * @param postMessageToOtherTab : If set to true endchat will send a message to other tabs(multi-tabs)
19
19
  */
20
20
  endChat: (adapter: any, skipEndChatSDK?: boolean, skipCloseChat?: boolean, postMessageToOtherTab?: boolean) => Promise<void>;
21
+ /**
22
+ * draggableEventChannel: Channel to send/receive draggable events
23
+ */
24
+ draggableEventChannel?: string;
25
+ /**
26
+ * draggableEventEmitterTargetWindow: Target window to post IDraggableEvent messages
27
+ */
28
+ draggableEventEmitterTargetWindow?: Window;
29
+ /**
30
+ * draggable: Whether the header is draggable
31
+ */
32
+ draggable?: boolean;
21
33
  }