@microsoft/omnichannel-chat-widget 1.1.1-main.d9ea24e → 1.2.0

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 (68) hide show
  1. package/README.md +9 -8
  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 +9 -0
  5. package/lib/cjs/components/draggable/DraggableChatWidget.js +168 -0
  6. package/lib/cjs/components/draggable/DraggableEventEmitter.js +74 -0
  7. package/lib/cjs/components/draggable/DraggableEventNames.js +14 -0
  8. package/lib/cjs/components/draggable/DraggableEventReceiver.js +34 -0
  9. package/lib/cjs/components/draggable/IDraggableElementPosition.js +1 -0
  10. package/lib/cjs/components/draggable/IDraggableElementPositionDelta.js +1 -0
  11. package/lib/cjs/components/draggable/IDraggableEvent.js +1 -0
  12. package/lib/cjs/components/headerstateful/HeaderStateful.js +27 -0
  13. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -3
  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 +34 -14
  18. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  19. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -2
  20. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/{defaultWebChatContainerStatefulStyles.js → defaultWebChatStyles.js} +3 -3
  21. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  23. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +2 -1
  24. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +18 -14
  25. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  26. package/lib/esm/common/telemetry/TelemetryHelper.js +9 -0
  27. package/lib/esm/components/draggable/DraggableChatWidget.js +158 -0
  28. package/lib/esm/components/draggable/DraggableEventEmitter.js +64 -0
  29. package/lib/esm/components/draggable/DraggableEventNames.js +7 -0
  30. package/lib/esm/components/draggable/DraggableEventReceiver.js +25 -0
  31. package/lib/esm/components/draggable/IDraggableElementPosition.js +1 -0
  32. package/lib/esm/components/draggable/IDraggableElementPositionDelta.js +1 -0
  33. package/lib/esm/components/draggable/IDraggableEvent.js +1 -0
  34. package/lib/esm/components/headerstateful/HeaderStateful.js +27 -0
  35. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  36. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +15 -5
  37. package/lib/esm/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
  38. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -8
  39. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +34 -14
  40. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  41. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -2
  42. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/{defaultWebChatContainerStatefulStyles.js → defaultWebChatStyles.js} +1 -1
  43. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +5 -0
  44. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
  45. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +2 -1
  46. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -0
  47. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  48. package/lib/types/components/draggable/DraggableChatWidget.d.ts +9 -0
  49. package/lib/types/components/draggable/DraggableEventEmitter.d.ts +27 -0
  50. package/lib/types/components/draggable/DraggableEventNames.d.ts +6 -0
  51. package/lib/types/components/draggable/DraggableEventReceiver.d.ts +27 -0
  52. package/lib/types/components/draggable/IDraggableElementPosition.d.ts +5 -0
  53. package/lib/types/components/draggable/IDraggableElementPositionDelta.d.ts +5 -0
  54. package/lib/types/components/draggable/IDraggableEvent.d.ts +12 -0
  55. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +12 -0
  56. package/lib/types/components/livechatwidget/interfaces/IDraggableChatWidgetProps.d.ts +10 -0
  57. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  58. package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +2 -2
  59. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.d.ts +2 -0
  60. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +5 -0
  61. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
  62. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +2 -1
  63. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +1 -0
  64. package/package.json +2 -2
  65. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +0 -1818
  66. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +0 -1811
  67. package/lib/types/components/livechatwidget/common/defaultProps/dummyDefaultProps.d.ts +0 -2
  68. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatContainerStatefulStyles.d.ts +0 -2
@@ -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
  }
@@ -0,0 +1,10 @@
1
+ export interface IDraggableChatWidgetProps {
2
+ /**
3
+ * Whether to enable Draggable Chat Widget.
4
+ */
5
+ disabled?: boolean;
6
+ /**
7
+ * To specify whether the iframe is used to drag. The IDraggableEvent would be posted to the parent window if set to true.
8
+ */
9
+ targetIframe?: boolean;
10
+ }
@@ -23,6 +23,7 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
23
23
  import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
24
24
  import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
25
25
  import { IScrollBarProps } from "./IScrollBarProps";
26
+ import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
26
27
  export interface ILiveChatWidgetProps {
27
28
  audioNotificationProps?: IAudioNotificationProps;
28
29
  callingContainerProps?: ICallingContainerProps;
@@ -57,4 +58,5 @@ export interface ILiveChatWidgetProps {
57
58
  useSessionStorage?: boolean;
58
59
  allowSdkChatSupport?: boolean;
59
60
  initialCustomContext?: any;
61
+ draggableChatWidgetProps?: IDraggableChatWidgetProps;
60
62
  }
@@ -1,3 +1,3 @@
1
- import { IWebChatContainerStatefulProps } from "./interfaces/IWebChatContainerStatefulProps";
2
- export declare const WebChatContainerStateful: (props: IWebChatContainerStatefulProps) => JSX.Element;
1
+ import { ILiveChatWidgetProps } from "../livechatwidget/interfaces/ILiveChatWidgetProps";
2
+ export declare const WebChatContainerStateful: (props: ILiveChatWidgetProps) => JSX.Element;
3
3
  export default WebChatContainerStateful;
@@ -0,0 +1,2 @@
1
+ import { StyleOptions } from "botframework-webchat-api";
2
+ export declare const defaultWebChatStyles: StyleOptions;
@@ -3,6 +3,11 @@ import MockAdapter from "./mockadapter";
3
3
  export declare class MockChatSDK {
4
4
  protected sleep: (ms: any) => Promise<unknown>;
5
5
  isMockModeOn: boolean;
6
+ omnichannelConfig: {
7
+ widgetId: string;
8
+ orgId: string;
9
+ orgUrl: string;
10
+ };
6
11
  startChat(): Promise<void>;
7
12
  endChat(): null;
8
13
  getChatToken(): null;
@@ -1,5 +1,5 @@
1
- import React from "react";
2
1
  import { IAttachmentProps } from "./IAttachmentProps";
2
+ import React from "react";
3
3
  export interface IRenderingMiddlewareProps {
4
4
  timestampDir?: "ltr" | "rtl" | "auto";
5
5
  disableActivityMiddleware?: boolean;
@@ -8,6 +8,7 @@ export interface IRenderingMiddlewareProps {
8
8
  disableAvatarMiddleware?: boolean;
9
9
  disableGroupActivitiesMiddleware?: boolean;
10
10
  disableTypingIndicatorMiddleware?: boolean;
11
+ disableThirdPartyCookiesAlert?: boolean;
11
12
  hideSendboxOnConversationEnd?: boolean;
12
13
  userMessageStyleProps?: React.CSSProperties;
13
14
  systemMessageStyleProps?: React.CSSProperties;
@@ -5,5 +5,6 @@ export declare enum NotificationScenarios {
5
5
  AttachmentError = "attachment",
6
6
  InternetConnection = "internet connection",
7
7
  MaxSizeError = "max size",
8
- ChatDisconnect = "chat disconnect"
8
+ ChatDisconnect = "chat disconnect",
9
+ TPC = "tpc blocked"
9
10
  }
@@ -20,4 +20,5 @@ export interface ILiveChatWidgetLocalizedTexts {
20
20
  PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE?: string;
21
21
  MARKDOWN_EXTERNAL_LINK_ALT?: string;
22
22
  MIDDLEWARE_BANNER_CHAT_DISCONNECT?: string;
23
+ THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE?: string;
23
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.1.1-main.d9ea24e",
3
+ "version": "1.2.0",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,7 +74,7 @@
74
74
  "webpack-cli": "^4.9.2"
75
75
  },
76
76
  "dependencies": {
77
- "@microsoft/omnichannel-chat-components": "^1.0.3",
77
+ "@microsoft/omnichannel-chat-components": "^1.0.5",
78
78
  "@microsoft/omnichannel-chat-sdk": "1.4.3",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",