@microsoft/omnichannel-chat-widget 0.1.0-main.5854782 → 0.1.0-main.60c3e17

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 (70) hide show
  1. package/lib/cjs/common/storage/default/defaultCacheManager.js +34 -0
  2. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +114 -0
  3. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +86 -0
  4. package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -0
  5. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +31 -18
  6. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -4
  7. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -4
  8. package/lib/cjs/components/footerstateful/FooterStateful.js +5 -13
  9. package/lib/cjs/components/headerstateful/HeaderStateful.js +10 -4
  10. package/lib/cjs/components/livechatwidget/common/authHelper.js +16 -3
  11. package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
  12. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
  13. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +49 -17
  14. package/lib/cjs/components/livechatwidget/common/startChat.js +12 -3
  15. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +85 -48
  16. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
  17. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  18. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +20 -4
  19. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  20. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  21. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  23. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  24. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -1
  25. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +11 -4
  26. package/lib/cjs/contexts/createReducer.js +2 -2
  27. package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
  28. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  29. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
  30. package/lib/esm/common/telemetry/TelemetryConstants.js +13 -0
  31. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +29 -13
  32. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -4
  33. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -4
  34. package/lib/esm/components/footerstateful/FooterStateful.js +5 -13
  35. package/lib/esm/components/headerstateful/HeaderStateful.js +10 -4
  36. package/lib/esm/components/livechatwidget/common/authHelper.js +14 -3
  37. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
  38. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
  39. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +49 -17
  40. package/lib/esm/components/livechatwidget/common/startChat.js +13 -4
  41. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +85 -48
  42. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -4
  43. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  44. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +15 -2
  45. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  46. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  47. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  48. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  49. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  50. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -1
  51. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -4
  52. package/lib/esm/contexts/createReducer.js +2 -2
  53. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  54. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  55. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  56. package/lib/types/common/telemetry/TelemetryConstants.d.ts +5 -1
  57. package/lib/types/components/livechatwidget/common/authHelper.d.ts +3 -2
  58. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -2
  59. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  60. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  61. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  62. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  63. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
  64. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  65. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  66. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  67. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -1
  68. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +1 -1
  69. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  70. package/package.json +3 -3
@@ -1,10 +1,15 @@
1
1
  import { ConversationState } from "./ConversationState";
2
2
  import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
3
+ import { getWidgetCacheId, isNullOrUndefined } from "../../common/utils";
4
+ import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
3
5
  export const getLiveChatWidgetContextInitialState = props => {
4
- var _props$webChatContain;
6
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$webChatContain;
5
7
 
6
- if (props !== null && props !== void 0 && props.liveChatContextFromCache) {
7
- return props === null || props === void 0 ? void 0 : props.liveChatContextFromCache;
8
+ const widgetCacheId = getWidgetCacheId(props === null || props === void 0 ? void 0 : (_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, props === null || props === void 0 ? void 0 : (_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, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
9
+ const initialState = defaultClientDataStoreProvider().getData(widgetCacheId, "localStorage");
10
+
11
+ if (!isNullOrUndefined(initialState)) {
12
+ return JSON.parse(initialState);
8
13
  }
9
14
 
10
15
  const LiveChatWidgetContextInitialState = {
@@ -26,7 +31,7 @@ export const getLiveChatWidgetContextInitialState = props => {
26
31
  appStates: {
27
32
  conversationState: ConversationState.Closed,
28
33
  isMinimized: false,
29
- previousElementOnFocusBeforeModalOpen: null,
34
+ previousElementIdOnFocusBeforeModalOpen: null,
30
35
  outsideOperatingHours: false,
31
36
  preChatResponseEmail: "",
32
37
  isAudioMuted: null,
@@ -69,10 +69,10 @@ export const createReducer = () => {
69
69
  }
70
70
  };
71
71
 
72
- case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
72
+ case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
73
73
  return { ...state,
74
74
  appStates: { ...state.appStates,
75
- previousElementOnFocusBeforeModalOpen: action.payload
75
+ previousElementIdOnFocusBeforeModalOpen: action.payload
76
76
  }
77
77
  };
78
78
 
@@ -0,0 +1,4 @@
1
+ export declare class defaultCacheManager {
2
+ static InternalCache: any;
3
+ }
4
+ export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string) => void;
@@ -0,0 +1,2 @@
1
+ import { IContextDataStore } from "../../interfaces/IContextDataStore";
2
+ export declare const defaultClientDataStoreProvider: () => IContextDataStore;
@@ -0,0 +1,6 @@
1
+ export declare const defaultInitializeInMemoryDataStore: (widgetId: string) => void;
2
+ export declare const inMemoryDataStore: () => {
3
+ getData: (key: string) => any;
4
+ setData: (key: any, data: any) => void;
5
+ removeData: (key: string) => void;
6
+ };
@@ -79,6 +79,8 @@ export declare enum TelemetryEvent {
79
79
  PostChatContextCallSucceed = "PostChatContextCallSucceed",
80
80
  PostChatContextCallFailed = "PostChatContextCallFailed",
81
81
  ParseAdaptiveCardFailed = "ParseAdaptiveCardFailed",
82
+ ClientDataStoreProviderFailed = "ClientDataStoreProviderFailed",
83
+ InMemoryDataStoreFailed = "InMemoryDataStoreFailed",
82
84
  WebChatLoaded = "WebChatLoaded",
83
85
  LCWChatButtonClicked = "LCWChatButtonClicked",
84
86
  LCWChatButtonShow = "LCWChatButtonShow",
@@ -148,7 +150,9 @@ export declare enum TelemetryEvent {
148
150
  ReconnectChatMinimize = "ReconnectChatMinimize",
149
151
  MessageSent = "MessageSent",
150
152
  MessageReceived = "MessageReceived",
151
- CustomContextReceived = "CustomContextReceived"
153
+ CustomContextReceived = "CustomContextReceived",
154
+ NetworkDisconnected = "NetworkDisconnected",
155
+ NetworkReconnected = "NetworkReconnected"
152
156
  }
153
157
  export interface TelemetryInput {
154
158
  scenarioType: ScenarioType;
@@ -1,4 +1,5 @@
1
1
  import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
2
- declare const handleAuthentication: (chatSDK: any, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string | undefined) => Promise<string | null>) | undefined) => Promise<void>;
2
+ declare const getAuthClientFunction: (chatConfig: ChatConfig | undefined) => string | undefined;
3
+ declare const handleAuthentication: (chatSDK: any, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string | undefined) => Promise<string | null>) | undefined) => Promise<boolean>;
3
4
  declare const removeAuthTokenProvider: (chatSDK: any) => void;
4
- export { handleAuthentication, removeAuthTokenProvider };
5
+ export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider };
@@ -12,7 +12,6 @@ import { ILiveChatWidgetControlProps } from "./ILiveChatWidgetControlProps";
12
12
  import { ILiveChatWidgetStyleProps } from "./ILiveChatWidgetStyleProps";
13
13
  import { ILoadingPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/loadingpane/interfaces/ILoadingPaneProps";
14
14
  import { IOOOHPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/outofofficehourspane/interfaces/IOOOHPaneProps";
15
- import { IPostChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/postchatsurveypane/interfaces/IPostChatSurveyPaneProps";
16
15
  import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
17
16
  import { IProactiveChatPaneStatefulProps } from "../../proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps";
18
17
  import { IReconnectChatPaneStatefulProps } from "../../reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps";
@@ -21,6 +20,7 @@ import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/i
21
20
  import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
22
21
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
23
22
  import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
23
+ import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
24
24
  export interface ILiveChatWidgetProps {
25
25
  audioNotificationProps?: IAudioNotificationProps;
26
26
  callingContainerProps?: ICallingContainerProps;
@@ -40,7 +40,7 @@ export interface ILiveChatWidgetProps {
40
40
  outOfOfficeHeaderProps?: IHeaderProps;
41
41
  outOfOfficeHoursPaneProps?: IOOOHPaneProps;
42
42
  postChatLoadingPaneProps?: ILoadingPaneProps;
43
- postChatSurveyPaneProps?: IPostChatSurveyPaneProps;
43
+ postChatSurveyPaneProps?: IPostChatSurveyPaneStatefulProps;
44
44
  preChatSurveyPaneProps?: IPreChatSurveyPaneProps;
45
45
  proactiveChatPaneProps?: IProactiveChatPaneStatefulProps;
46
46
  reconnectChatPaneProps?: IReconnectChatPaneStatefulProps;
@@ -1,3 +1,3 @@
1
- import { IPostChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/postchatsurveypane/interfaces/IPostChatSurveyPaneProps";
2
- export declare const PostChatSurveyPaneStateful: (props: IPostChatSurveyPaneProps) => JSX.Element;
1
+ import { IPostChatSurveyPaneStatefulProps } from "./interfaces/IPostChatSurveyPaneStatefulProps";
2
+ export declare const PostChatSurveyPaneStateful: (props: IPostChatSurveyPaneStatefulProps) => JSX.Element;
3
3
  export default PostChatSurveyPaneStateful;
@@ -0,0 +1,4 @@
1
+ import { IPostChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/postchatsurveypane/interfaces/IPostChatSurveyPaneProps";
2
+ export interface IPostChatSurveyPaneStatefulProps extends IPostChatSurveyPaneProps {
3
+ isCustomerVoiceSurveyCompact?: boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ import { IAdaptiveCardStyles } from "../../interfaces/IAdaptiveCardStyles";
2
+ export declare const defaultAdaptiveCardStyles: IAdaptiveCardStyles;
@@ -0,0 +1,4 @@
1
+ export interface IAdaptiveCardStyles {
2
+ background?: string;
3
+ color?: string;
4
+ }
@@ -1,5 +1,5 @@
1
- import { IAttachmentProps } from "./IAttachmentProps";
2
1
  import React from "react";
2
+ import { IAttachmentProps } from "./IAttachmentProps";
3
3
  export interface IRenderingMiddlewareProps {
4
4
  timestampDir?: "ltr" | "rtl" | "auto";
5
5
  disableActivityMiddleware?: boolean;
@@ -28,4 +28,5 @@ export interface IRenderingMiddlewareProps {
28
28
  attachmentDownloadIconStyles?: React.CSSProperties;
29
29
  attachmentContentStyles?: React.CSSProperties;
30
30
  attachmentSizeStyles?: React.CSSProperties;
31
+ receivedMessageAnchorStyles?: React.CSSProperties;
31
32
  }
@@ -4,6 +4,7 @@ import { IRenderingMiddlewareProps } from "./IRenderingMiddlewareProps";
4
4
  import { IStyle } from "@fluentui/react";
5
5
  import { IWebChatProps } from "./IWebChatProps";
6
6
  import { StyleOptions } from "botframework-webchat-api";
7
+ import { IAdaptiveCardStyles } from "./IAdaptiveCardStyles";
7
8
  export interface IWebChatContainerStatefulProps {
8
9
  containerStyles?: IStyle;
9
10
  disableNewLineMarkdownSupport?: boolean;
@@ -15,4 +16,5 @@ export interface IWebChatContainerStatefulProps {
15
16
  renderingMiddlewareProps?: IRenderingMiddlewareProps;
16
17
  localizedTexts?: ILiveChatWidgetLocalizedTexts;
17
18
  botMagicCode?: IBotMagicCodeConfig;
19
+ adaptiveCardStyles?: IAdaptiveCardStyles;
18
20
  }
@@ -1 +1 @@
1
- export declare const activityStatusMiddleware: () => (next: any) => (args: any) => JSX.Element | undefined;
1
+ export declare const activityStatusMiddleware: () => (next: any) => (args: any) => any;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultReceivedMessageAnchorStyles: React.CSSProperties;
@@ -22,7 +22,7 @@ export interface ILiveChatWidgetContext {
22
22
  appStates: {
23
23
  conversationState: ConversationState;
24
24
  isMinimized: boolean;
25
- previousElementOnFocusBeforeModalOpen: HTMLElement | null;
25
+ previousElementIdOnFocusBeforeModalOpen: string | null;
26
26
  outsideOperatingHours: boolean;
27
27
  preChatResponseEmail: string;
28
28
  isAudioMuted: boolean | null;
@@ -5,7 +5,7 @@ export declare enum LiveChatWidgetActionType {
5
5
  SET_GLOBAL_DIR = 3,
6
6
  SET_MINIMIZED = 4,
7
7
  SET_CONVERSATION_STATE = 5,
8
- SET_PREVIOUS_FOCUSED_ELEMENT = 6,
8
+ SET_PREVIOUS_FOCUSED_ELEMENT_ID = 6,
9
9
  SET_OUTSIDE_OPERATING_HOURS = 7,
10
10
  SET_PRE_CHAT_SURVEY_RESPONSE = 8,
11
11
  SET_CUSTOM_CONTEXT = 9,
@@ -1,3 +1,2 @@
1
- import { ILiveChatWidgetContext } from "./ILiveChatWidgetContext";
2
1
  import { ILiveChatWidgetProps } from "../../components/livechatwidget/interfaces/ILiveChatWidgetProps";
3
- export declare const getLiveChatWidgetContextInitialState: (props: ILiveChatWidgetProps) => ILiveChatWidgetContext;
2
+ export declare const getLiveChatWidgetContextInitialState: (props: ILiveChatWidgetProps) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "0.1.0-main.5854782",
3
+ "version": "0.1.0-main.60c3e17",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,8 +74,8 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@fluentui/react": "^8.49.1",
77
- "@microsoft/omnichannel-chat-components": "0.1.0-main.a306d8c",
78
- "@microsoft/omnichannel-chat-sdk": "1.0.1-main.077d17c",
77
+ "@microsoft/omnichannel-chat-components": "0.1.0-main.c74643c",
78
+ "@microsoft/omnichannel-chat-sdk": "1.1.1-main.4e1bf63",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",
81
81
  "markdown-it": "^12.3.2",