@microsoft/omnichannel-chat-widget 0.1.0-main.488d6f1 → 0.1.0-main.63cfb47

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 (72) hide show
  1. package/README.md +3 -11
  2. package/lib/cjs/common/Constants.js +4 -2
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +34 -5
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  5. package/lib/cjs/common/telemetry/TelemetryManager.js +11 -6
  6. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  7. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -41
  8. package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
  9. package/lib/cjs/components/headerstateful/HeaderStateful.js +1 -7
  10. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -2
  11. package/lib/cjs/components/livechatwidget/common/endChat.js +39 -3
  12. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  13. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +17 -5
  14. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
  15. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +7 -6
  16. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  17. package/lib/cjs/components/livechatwidget/common/startChat.js +43 -30
  18. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +68 -24
  19. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  20. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +2 -2
  21. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
  23. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  24. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  25. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +44 -0
  26. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +15 -16
  27. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +5 -1
  28. package/lib/cjs/contexts/createReducer.js +0 -10
  29. package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
  30. package/lib/esm/common/Constants.js +4 -2
  31. package/lib/esm/common/telemetry/TelemetryConstants.js +30 -4
  32. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  33. package/lib/esm/common/telemetry/TelemetryManager.js +10 -6
  34. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  35. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -36
  36. package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
  37. package/lib/esm/components/headerstateful/HeaderStateful.js +1 -7
  38. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -3
  39. package/lib/esm/components/livechatwidget/common/endChat.js +40 -6
  40. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  41. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -4
  42. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
  43. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -3
  44. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  45. package/lib/esm/components/livechatwidget/common/startChat.js +43 -31
  46. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +62 -22
  47. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  48. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +3 -3
  49. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  50. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
  51. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  52. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  53. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +31 -0
  54. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +15 -16
  55. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +5 -1
  56. package/lib/esm/contexts/createReducer.js +0 -9
  57. package/lib/esm/plugins/newMessageEventHandler.js +84 -0
  58. package/lib/types/common/Constants.d.ts +2 -1
  59. package/lib/types/common/telemetry/TelemetryConstants.d.ts +21 -3
  60. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
  61. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  62. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  63. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  64. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
  65. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  66. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
  67. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  68. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  69. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  70. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +15 -16
  71. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  72. package/package.json +6 -5
@@ -17,6 +17,21 @@ export declare enum LogLevel {
17
17
  WARN = "WARN",
18
18
  ERROR = "ERROR"
19
19
  }
20
+ export declare enum BroadcastEvent {
21
+ LoadPostChatSurvey = "LoadPostChatSurvey",
22
+ EndChat = "ChatEnded",
23
+ NewMessageNotification = "NewMessageNotification",
24
+ UnreadMessageCount = "UnreadMessageCount",
25
+ ChatWidgetStateChanged = "ChatWidgetStateChanged",
26
+ ProactiveChatStartChat = "ProactiveChatStartChat",
27
+ ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
28
+ InvalidAdaptiveCardFormat = "InvalidAdaptiveCardFormat",
29
+ NewMessageSent = "NewMessageSent",
30
+ NewMessageReceived = "NewMessageReceived",
31
+ RedirectPageRequest = "RedirectPageRequest",
32
+ StartChatSkippingChatButtonRendering = "StartChatSkippingChatButtonRendering",
33
+ StartUnauthenticatedReconnectChat = "StartUnauthenticatedReconnectChat"
34
+ }
20
35
  export declare enum TelemetryEvent {
21
36
  CallAdded = "CallAdded",
22
37
  LocalVideoStreamAdded = "LocalVideoStreamAdded",
@@ -63,7 +78,9 @@ export declare enum TelemetryEvent {
63
78
  PrechatSurveyLoaded = "PrechatSurveyLoaded",
64
79
  PrechatSubmitted = "PrechatSubmitted",
65
80
  StartChatSDKCall = "StartChatCall",
81
+ StartChatEventRecevied = "StartChatEventReceived",
66
82
  EndChatSDKCall = "EndChatCall",
83
+ EndChatEventReceived = "EndChatEventReceived",
67
84
  OnNewMessageFailed = "OnNewMessageFailed",
68
85
  OnNewMessageAudioNotificationFailed = "OnNewMessageAudioNotificationFailed",
69
86
  DownloadTranscriptResponseNullOrUndefined = "DownloadTranscriptResponseNullOrUndefined",
@@ -77,6 +94,7 @@ export declare enum TelemetryEvent {
77
94
  LoadingPaneLoaded = "LoadingPaneLoaded",
78
95
  EmailTranscriptLoaded = "EmailTranscriptLoaded",
79
96
  OutOfOfficePaneLoaded = "OutOfOfficePaneLoaded",
97
+ PostChatSurveyLoadingPaneLoaded = "PostChatSurveyLoadingPaneLoaded",
80
98
  PostChatSurveyLoaded = "PostChatSurveyLoaded",
81
99
  ConfirmationPaneLoaded = "ConfirmationPaneLoaded",
82
100
  ProactiveChatPaneLoaded = "ProactiveChatPaneLoaded",
@@ -98,6 +116,7 @@ export declare enum TelemetryEvent {
98
116
  InvalidConfiguration = "InvalidConfiguration",
99
117
  SendTypingIndicatorSucceeded = "SendTypingIndicatorSucceeded",
100
118
  SendTypingIndicatorFailed = "SendTypingIndicatorFailed",
119
+ WebChatEvent = "WebChatEvent",
101
120
  PreChatSurveyStartChatMethodFailed = "PreChatSurveyStartChatMethodFailed",
102
121
  ChatAlreadyTriggered = "ChatAlreadyTriggered",
103
122
  StartProactiveChatEventReceived = "StartProactiveChatEventReceived",
@@ -106,12 +125,11 @@ export declare enum TelemetryEvent {
106
125
  ProactiveChatRejected = "ProactiveChatRejected",
107
126
  IncomingProactiveChatScreenLoaded = "IncomingProactiveChatScreenLoaded",
108
127
  ProactiveChatClosed = "ProactiveChatClosed",
109
- ProactiveChatStartChat = "ProactiveChatStartChat",
110
- ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
111
128
  ReconnectChatContinueConversation = "ReconnectChatContinueConversation",
112
129
  ReconnectChatStartNewConversation = "ReconnectChatStartNewConversation",
113
130
  ReconnectChatMinimize = "ReconnectChatMinimize",
114
- ChatWidgetStateChanged = "ChatWidgetStateChanged"
131
+ MessageSent = "MessageSent",
132
+ MessageReceived = "MessageReceived"
115
133
  }
116
134
  export interface TelemetryInput {
117
135
  scenarioType: ScenarioType;
@@ -35,4 +35,5 @@ export declare class TelemetryHelper {
35
35
  static logActionEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
36
36
  static logSDKEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
37
37
  static logConfigDataEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
38
+ static logWebChatEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
38
39
  }
@@ -1,3 +1,4 @@
1
+ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
1
2
  import { IConfirmationPaneStatefulProps } from "./IConfirmationPaneStatefulProps";
2
3
  export interface IConfirmationPaneStatefulParams extends IConfirmationPaneStatefulProps {
3
4
  /**
@@ -5,10 +6,9 @@ export interface IConfirmationPaneStatefulParams extends IConfirmationPaneStatef
5
6
  */
6
7
  setPostChatContext: () => Promise<void>;
7
8
  /**
8
- * endChat: Internal Prop injected for triggering end of a chat using chatSDK
9
+ * prepareEndChat: Internal Prop injected for checking PostChat contexts and trigerring end of chat
9
10
  * @param adapter : The chat adapter for the live chat session
10
- * @param skipEndChatSDK : If set to true endchat will skip chatSDK endChat call
11
- * @param skipCloseChat : If set to true endchat will skip closing the live chat instance
11
+ * @param state : The chat state where the conversation is currently in
12
12
  */
13
- endChat: (adapter: any, skipEndChatSDK?: boolean, skipCloseChat?: boolean) => Promise<void>;
13
+ prepareEndChat: (adapter: any, state: ILiveChatWidgetContext) => Promise<void>;
14
14
  }
@@ -1,5 +1,4 @@
1
1
  export interface IAudioNotificationStatefulParams {
2
2
  audioSrc?: string;
3
- hideAudioNotificationButton?: boolean;
4
3
  isAudioMuted?: boolean;
5
4
  }
@@ -1,4 +1,7 @@
1
1
  import { Dispatch } from "react";
2
2
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
3
3
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
4
- export declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined) => Promise<void>;
4
+ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
5
+ declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, state: ILiveChatWidgetContext) => Promise<void>;
6
+ declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined) => Promise<void>;
7
+ export { prepareEndChat, endChat };
@@ -2,6 +2,9 @@ import "regenerator-runtime/runtime";
2
2
  import { Dispatch } from "react";
3
3
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
4
4
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
5
+ declare const getChatReconnectContext: (chatSDK: any, reconnectId?: string | undefined) => Promise<any>;
5
6
  declare const getReconnectIdForAuthenticatedChat: (props: ILiveChatWidgetProps, chatSDK: any) => Promise<string | undefined>;
6
- declare const handleUnauthenticatedReconnectChat: (dispatch: Dispatch<ILiveChatWidgetAction>, reconnectId: string, initStartChat: any) => Promise<void>;
7
- export { getReconnectIdForAuthenticatedChat, handleUnauthenticatedReconnectChat };
7
+ declare const handleUnauthenticatedReconnectChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, reconnectId: string, initStartChat: any, redirectInSameWindow: boolean | undefined) => Promise<void>;
8
+ declare const startUnauthenticatedReconnectChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, reconnectId: string, initStartChat: any) => Promise<void>;
9
+ declare const handleRedirectUnauthenticatedReconnectChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, reconnectId: string, redirectInSameWindow: boolean | undefined) => Promise<void>;
10
+ export { getChatReconnectContext, getReconnectIdForAuthenticatedChat, handleUnauthenticatedReconnectChat, startUnauthenticatedReconnectChat, handleRedirectUnauthenticatedReconnectChat };
@@ -9,6 +9,7 @@ export interface ILiveChatWidgetComponentOverrides {
9
9
  outOfOfficeHoursPane?: ReactNode | string;
10
10
  postChatLoadingPane?: ReactNode | string;
11
11
  postChatSurveyPane?: ReactNode | string;
12
+ preChatSurveyPane?: ReactNode | string;
12
13
  proactiveChatPane?: ReactNode | string;
13
14
  reconnectChatPane?: ReactNode | string;
14
15
  webChatContainer?: ReactNode | string;
@@ -3,4 +3,5 @@ export interface IReconnectChatPaneStatefulProps extends IReconnectChatPaneProps
3
3
  authClientFunction?: string;
4
4
  isReconnectEnabled?: boolean;
5
5
  reconnectId?: string;
6
+ redirectInSameWindow?: boolean;
6
7
  }
@@ -3,6 +3,7 @@ export declare class MockChatSDK {
3
3
  protected sleep: (ms: any) => Promise<unknown>;
4
4
  startChat(): Promise<void>;
5
5
  endChat(): null;
6
+ getChatToken(): null;
6
7
  createChatAdapter(): MockAdapter;
7
8
  getPreChatSurvey(parseToJson: boolean): string;
8
9
  getConversationDetails(): {};
@@ -5,7 +5,6 @@
5
5
  * 1. Renders system messages differently, according to Microsoft LiveChatWidget styles
6
6
  * 2. Changes the font size of user messages
7
7
  * 3. Decodes certain html characters that came through from chat services
8
- * 4. Triggers end conversation sequence when the chat thread is deleted
9
8
  ******/
10
9
  import React from "react";
11
10
  export declare const createActivityMiddleware: (systemMessageStyleProps?: React.CSSProperties | undefined, userMessageStyleProps?: React.CSSProperties | undefined) => () => (next: any) => (...args: any) => any;
@@ -0,0 +1 @@
1
+ export declare function createWebChatTelemetry(): (event: any) => void;
@@ -14,20 +14,19 @@ export declare enum LiveChatWidgetActionType {
14
14
  SET_AUDIO_NOTIFICATION = 12,
15
15
  SET_E2VV_ENABLED = 13,
16
16
  SET_POST_CHAT_CONTEXT = 14,
17
- SET_SHOULD_SHOW_POST_CHAT = 15,
18
- SHOW_CALLING_CONTAINER = 16,
19
- SET_INCOMING_CALL = 17,
20
- DISABLE_VIDEO_CALL = 18,
21
- DISABLE_LOCAL_VIDEO = 19,
22
- DISABLE_REMOTE_VIDEO = 20,
23
- SET_CHAT_TOKEN = 21,
24
- SET_SKIP_CHAT_BUTTON_RENDERING = 22,
25
- SET_PROACTIVE_CHAT_PARAMS = 23,
26
- SET_TELEMETRY_DATA = 24,
27
- SET_RECONNECT_ID = 25,
28
- SET_UNREAD_MESSAGE_COUNT = 26,
29
- SET_FOCUS_CHAT_BUTTON = 27,
30
- SET_CONVERSATION_ENDED_BY_AGENT = 28,
31
- SET_WIDGET_STATE = 29,
32
- SET_LIVE_CHAT_CONTEXT = 30
17
+ SHOW_CALLING_CONTAINER = 15,
18
+ SET_INCOMING_CALL = 16,
19
+ DISABLE_VIDEO_CALL = 17,
20
+ DISABLE_LOCAL_VIDEO = 18,
21
+ DISABLE_REMOTE_VIDEO = 19,
22
+ SET_CHAT_TOKEN = 20,
23
+ SET_SKIP_CHAT_BUTTON_RENDERING = 21,
24
+ SET_PROACTIVE_CHAT_PARAMS = 22,
25
+ SET_TELEMETRY_DATA = 23,
26
+ SET_RECONNECT_ID = 24,
27
+ SET_UNREAD_MESSAGE_COUNT = 25,
28
+ SET_FOCUS_CHAT_BUTTON = 26,
29
+ SET_CONVERSATION_ENDED_BY_AGENT = 27,
30
+ SET_WIDGET_STATE = 28,
31
+ SET_LIVE_CHAT_CONTEXT = 29
33
32
  }
@@ -0,0 +1,2 @@
1
+ import { IActivity } from "botframework-directlinejs";
2
+ export declare const createOnNewAdapterActivityHandler: (chatId: string, userId: string) => (activity: IActivity) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "0.1.0-main.488d6f1",
3
+ "version": "0.1.0-main.63cfb47",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -91,19 +91,20 @@
91
91
  "compose-storybook": "start-storybook -c stories/.storybook -p 9009",
92
92
  "build-composite-storybook": "build-storybook -c stories/.storybook -o storybook-build",
93
93
  "build-storybook": "build-storybook",
94
- "build": "yarn eslint . && yarn build:esm && yarn copy:esm && yarn build:cjs && yarn copy:cjs && tsc",
94
+ "build": "yarn lint && yarn build:esm && yarn build:cjs && tsc",
95
95
  "test:unit": "jest -c jest.config.unit.cjs --env=jsdom --runInBand --force-exit",
96
+ "test:e2e": "cd automation_tests && yarn test",
97
+ "test:e2e:build": "yarn build-sample && cd automation_tests && yarn test",
96
98
  "test:visual": "jest -c jest.config.visual.cjs",
97
99
  "test:all": "yarn test:unit && yarn test:visual",
98
100
  "build:esm": "babel ./src --config-file ./babel.esm.config.json --out-dir lib/esm --extensions .ts,.js,.tsx --ignore **/*.test.ts,**/*.stories.tsx,**/*.test.tsx",
99
101
  "build:cjs": "babel ./src --config-file ./babel.config.json --out-dir lib/cjs --extensions .ts,.js,.tsx --ignore **/*.test.ts,**/*.stories.tsx,**/*.test.tsx",
100
- "copy:cjs": "copyfiles -u 2 src/assets/audios/* lib/cjs/assets && copyfiles -u 2 src/assets/icons/* lib/cjs/assets",
101
- "copy:esm": "copyfiles -u 2 src/assets/audios/* lib/esm/assets && copyfiles -u 2 src/assets/icons/* lib/esm/assets",
102
102
  "verify": "yarn install && yarn build-storybook && yarn test:all && yarn build && yarn storybook",
103
103
  "testpack": "yarn build && yarn pack",
104
104
  "build-sample": "yarn build && webpack --config ./webpack.config.cjs",
105
105
  "build-sample:dev": "yarn build && webpack --config ./webpack.dev.config.cjs",
106
- "test:visual:build": "yarn build-storybook && yarn test:visual"
106
+ "test:visual:build": "yarn build-storybook && yarn test:visual",
107
+ "lint": "yarn eslint ."
107
108
  },
108
109
  "resolutions": {
109
110
  "**/url-parse": "1.5.9",