@microsoft/omnichannel-chat-widget 0.1.0-main.8b6c0d8 → 0.1.0-main.cf54410

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 (64) hide show
  1. package/lib/cjs/common/Constants.js +2 -0
  2. package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
  3. package/lib/cjs/common/interfaces/IContextDataStore.js +1 -0
  4. package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
  5. package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -4
  6. package/lib/cjs/common/telemetry/TelemetryManager.js +12 -4
  7. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  8. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
  9. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +3 -0
  10. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +8 -1
  11. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +13 -26
  12. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +27 -26
  13. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
  14. package/lib/cjs/components/livechatwidget/common/endChat.js +8 -0
  15. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -9
  16. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +18 -3
  17. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
  18. package/lib/cjs/components/livechatwidget/common/startChat.js +64 -18
  19. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -13
  20. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +25 -8
  21. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +4 -0
  22. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +6 -3
  23. package/lib/cjs/contexts/createReducer.js +27 -0
  24. package/lib/esm/common/Constants.js +2 -0
  25. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  26. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  27. package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
  28. package/lib/esm/common/telemetry/TelemetryHelper.js +9 -4
  29. package/lib/esm/common/telemetry/TelemetryManager.js +8 -4
  30. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  31. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
  32. package/lib/esm/common/telemetry/loggers/consoleLogger.js +3 -0
  33. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +9 -1
  34. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +13 -26
  35. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +29 -28
  36. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  37. package/lib/esm/components/livechatwidget/common/endChat.js +8 -0
  38. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -9
  39. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +18 -2
  40. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -22
  41. package/lib/esm/components/livechatwidget/common/startChat.js +62 -17
  42. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +23 -12
  43. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
  44. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +4 -0
  45. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +6 -3
  46. package/lib/esm/contexts/createReducer.js +27 -0
  47. package/lib/types/common/Constants.d.ts +1 -0
  48. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  49. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  50. package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
  51. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  52. package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
  53. package/lib/types/common/telemetry/definitions/Payload.d.ts +3 -0
  54. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  55. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  56. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
  57. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  58. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  59. package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
  60. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  61. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  62. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
  63. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +5 -1
  64. package/package.json +3 -1
@@ -13,7 +13,8 @@ export const getLiveChatWidgetContextInitialState = props => {
13
13
  chatToken: undefined,
14
14
  postChatContext: undefined,
15
15
  telemetryInternalData: {},
16
- globalDir: "ltr"
16
+ globalDir: "ltr",
17
+ liveChatContext: undefined
17
18
  },
18
19
  appStates: {
19
20
  conversationState: ConversationState.Closed,
@@ -32,7 +33,8 @@ export const getLiveChatWidgetContextInitialState = props => {
32
33
  proactiveChatInNewWindow: false
33
34
  },
34
35
  e2vvEnabled: false,
35
- unreadMessageCount: 0
36
+ unreadMessageCount: 0,
37
+ conversationEndedByAgent: false
36
38
  },
37
39
  uiStates: {
38
40
  showConfirmationPane: false,
@@ -41,7 +43,8 @@ export const getLiveChatWidgetContextInitialState = props => {
41
43
  isIncomingCall: true,
42
44
  disableVideoCall: true,
43
45
  disableRemoteVideo: true,
44
- disableSelfVideo: true
46
+ disableSelfVideo: true,
47
+ focusChatButton: false
45
48
  }
46
49
  };
47
50
  return props.liveChatContextFromCache ?? LiveChatWidgetContextInitialState;
@@ -105,6 +105,13 @@ export const createReducer = () => {
105
105
  }
106
106
  };
107
107
 
108
+ case LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
109
+ return { ...state,
110
+ uiStates: { ...state.uiStates,
111
+ focusChatButton: action.payload
112
+ }
113
+ };
114
+
108
115
  case LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
109
116
  return { ...state,
110
117
  uiStates: { ...state.uiStates,
@@ -129,6 +136,7 @@ export const createReducer = () => {
129
136
  case LiveChatWidgetActionType.SET_CHAT_TOKEN:
130
137
  return { ...state,
131
138
  domainStates: { ...state.domainStates,
139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
140
  chatToken: action.payload
133
141
  }
134
142
  };
@@ -201,6 +209,25 @@ export const createReducer = () => {
201
209
  }
202
210
  };
203
211
 
212
+ case LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
213
+ return { ...state,
214
+ domainStates: { ...state.domainStates,
215
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
+ liveChatContext: action.payload
217
+ }
218
+ };
219
+
220
+ case LiveChatWidgetActionType.SET_WIDGET_STATE:
221
+ return { ...action.payload
222
+ };
223
+
224
+ case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
225
+ return { ...state,
226
+ appStates: { ...state.appStates,
227
+ conversationEndedByAgent: action.payload
228
+ }
229
+ };
230
+
204
231
  default:
205
232
  return state;
206
233
  }
@@ -13,6 +13,7 @@ export declare class Constants {
13
13
  static readonly true = "true";
14
14
  static readonly false = "false";
15
15
  static readonly maximumUnreadMessageCount = 99;
16
+ static readonly widgetStateDataKey = "LcwChatWidgetState";
16
17
  static readonly channelIdKey = "ChannelId-";
17
18
  static readonly ChannelId = "lcw";
18
19
  static readonly CustomerTag = "FromCustomer";
@@ -0,0 +1,4 @@
1
+ import { IContextDataStore } from "../interfaces/IContextDataStore";
2
+ export declare class DataStoreManager {
3
+ static clientDataStore?: IContextDataStore;
4
+ }
@@ -0,0 +1,14 @@
1
+ export interface IContextDataStore {
2
+ /**
3
+ * getData: Get data from data store
4
+ */
5
+ getData: (key: string, type: string) => any;
6
+ /**
7
+ * setData: Set data to data store
8
+ */
9
+ setData: (key: string, value: string) => void;
10
+ /**
11
+ * removeData: Remove data from data store by key
12
+ */
13
+ removeData?: (key: string) => void;
14
+ }
@@ -106,7 +106,8 @@ export declare enum TelemetryEvent {
106
106
  ProactiveChatClosed = "ProactiveChatClosed",
107
107
  ReconnectChatContinueConversation = "ReconnectChatContinueConversation",
108
108
  ReconnectChatStartNewConversation = "ReconnectChatStartNewConversation",
109
- ReconnectChatMinimize = "ReconnectChatMinimize"
109
+ ReconnectChatMinimize = "ReconnectChatMinimize",
110
+ ChatWidgetStateChanged = "ChatWidgetStateChanged"
110
111
  }
111
112
  export interface TelemetryInput {
112
113
  scenarioType: ScenarioType;
@@ -8,4 +8,5 @@ export declare class TelemetryTimers {
8
8
  export declare class TelemetryManager {
9
9
  static InternalTelemetryData: IInternalTelemetryData;
10
10
  }
11
+ export declare const disposeLoggers: () => void;
11
12
  export declare const RegisterLoggers: () => void;
@@ -24,6 +24,9 @@ export interface LoadContract extends BaseContract {
24
24
  WidgetState?: string;
25
25
  ChatState?: string;
26
26
  ChatType?: string;
27
+ OCChatSDKVersion: string;
28
+ OCChatWidgetVersion: string;
29
+ OCChatComponentsVersion: string;
27
30
  }
28
31
  export interface ActionsContract extends BaseContract {
29
32
  Event?: string;
@@ -16,6 +16,9 @@ export interface LoadTelemetryData {
16
16
  ChatState?: string;
17
17
  ChatType?: string;
18
18
  ExceptionDetails?: object;
19
+ OCChatSDKVersion?: string;
20
+ OCChatWidgetVersion?: string;
21
+ OCChatComponentsVersion?: string;
19
22
  }
20
23
  export interface MessageProcessingErrorData {
21
24
  Event: string;
@@ -1,4 +1,5 @@
1
1
  import { LogLevel, TelemetryInput } from "../TelemetryConstants";
2
2
  export interface IChatSDKLogger {
3
3
  log: (logLevel: LogLevel, telemetryInput: TelemetryInput) => void;
4
+ dispose: () => void;
4
5
  }
@@ -16,4 +16,6 @@ export interface IInternalTelemetryData {
16
16
  orgUrl?: string;
17
17
  lcwRuntimeId?: string;
18
18
  channelId?: string;
19
+ chatWidgetVersion?: string;
20
+ chatComponentVersion?: string;
19
21
  }
@@ -29,4 +29,16 @@ export interface ITelemetryConfig {
29
29
  * custom loggers list
30
30
  */
31
31
  telemetryLoggers?: IChatSDKLogger[];
32
+ /**
33
+ * Omnichannel chat widget version
34
+ */
35
+ chatWidgetVersion?: string;
36
+ /**
37
+ * Omnichannel chat components version
38
+ */
39
+ chatComponentVersion?: string;
40
+ /**
41
+ * Omnichannel Chat SDK Version
42
+ */
43
+ OCChatSDKVersion?: string;
32
44
  }
@@ -0,0 +1 @@
1
+ export declare const disposeTelemetryLoggers: () => void;
@@ -1,3 +1,3 @@
1
1
  import { Dispatch } from "react";
2
2
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
3
- export declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, loadSurvey: boolean) => Promise<void>;
3
+ export declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean | undefined) => Promise<void>;
@@ -3,5 +3,5 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
3
3
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
4
4
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
5
5
  declare const prepareStartChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
6
- declare const initStartChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, params?: any) => Promise<void>;
6
+ declare const initStartChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, params?: any, persistedState?: any) => Promise<void>;
7
7
  export { prepareStartChat, initStartChat };
@@ -20,6 +20,7 @@ import { ITelemetryConfig } from "../../../common/telemetry/interfaces/ITelemetr
20
20
  import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
21
21
  import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
22
22
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
23
+ import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
23
24
  export interface ILiveChatWidgetProps {
24
25
  audioNotificationProps?: IAudioNotificationProps;
25
26
  callingContainerProps?: ICallingContainerProps;
@@ -47,4 +48,5 @@ export interface ILiveChatWidgetProps {
47
48
  telemetryConfig?: ITelemetryConfig;
48
49
  webChatContainerProps?: IWebChatContainerStatefulProps;
49
50
  liveChatContextFromCache?: ILiveChatWidgetContext;
51
+ contextDataStore?: IContextDataStore;
50
52
  }
@@ -1,5 +1,5 @@
1
1
  import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
2
2
  export interface IPreChatSurveyPaneStatefulParams {
3
3
  surveyProps?: IPreChatSurveyPaneProps;
4
- initStartChat: (params?: any) => Promise<void>;
4
+ initStartChat: (params?: any, persistedState?: any) => Promise<void>;
5
5
  }
@@ -14,6 +14,7 @@ export interface ILiveChatWidgetContext {
14
14
  middlewareLocalizedTexts: ILiveChatWidgetLocalizedTexts | undefined;
15
15
  telemetryInternalData: IInternalTelemetryData;
16
16
  globalDir: "rtl" | "ltr";
17
+ liveChatContext: any;
17
18
  };
18
19
  appStates: {
19
20
  conversationState: ConversationState;
@@ -33,6 +34,7 @@ export interface ILiveChatWidgetContext {
33
34
  };
34
35
  e2vvEnabled: boolean;
35
36
  unreadMessageCount: number;
37
+ conversationEndedByAgent: boolean;
36
38
  };
37
39
  uiStates: {
38
40
  showConfirmationPane: boolean;
@@ -42,5 +44,6 @@ export interface ILiveChatWidgetContext {
42
44
  disableRemoteVideo: boolean;
43
45
  disableSelfVideo: boolean;
44
46
  isIncomingCall: boolean;
47
+ focusChatButton: boolean;
45
48
  };
46
49
  }
@@ -25,5 +25,9 @@ export declare enum LiveChatWidgetActionType {
25
25
  SET_PROACTIVE_CHAT_PARAMS = 23,
26
26
  SET_TELEMETRY_DATA = 24,
27
27
  SET_RECONNECT_ID = 25,
28
- SET_UNREAD_MESSAGE_COUNT = 26
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
29
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "0.1.0-main.8b6c0d8",
3
+ "version": "0.1.0-main.cf54410",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -88,6 +88,8 @@
88
88
  },
89
89
  "scripts": {
90
90
  "storybook": "start-storybook -p 6006",
91
+ "compose-storybook": "start-storybook -c stories/.storybook -p 9009",
92
+ "build-composite-storybook": "build-storybook -c stories/.storybook -o storybook-build",
91
93
  "build-storybook": "build-storybook",
92
94
  "build": "yarn eslint . && yarn build:esm && yarn copy:esm && yarn build:cjs && yarn copy:cjs && tsc",
93
95
  "test:unit": "jest -c jest.config.unit.cjs --env=jsdom --runInBand --force-exit",