@microsoft/omnichannel-chat-widget 0.1.0-main.0c0fd47 → 0.1.0-main.0d8d3bf

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 (85) hide show
  1. package/README.md +7 -34
  2. package/lib/cjs/common/Constants.js +4 -2
  3. package/lib/cjs/common/storage/default/defaultCacheManager.js +2 -2
  4. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  5. package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -0
  6. package/lib/cjs/common/telemetry/TelemetryHelper.js +2 -1
  7. package/lib/cjs/common/utils.js +23 -2
  8. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  9. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  10. package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -2
  11. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  12. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  13. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  14. package/lib/cjs/components/livechatwidget/common/endChat.js +23 -17
  15. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +26 -13
  16. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +5 -5
  17. package/lib/cjs/components/livechatwidget/common/startChat.js +70 -59
  18. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +43 -37
  19. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  20. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -1
  21. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultPopOutgeneralPostChatSurveyPaneStyleProps.js +17 -0
  22. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  23. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  24. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  25. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  26. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  27. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  28. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  29. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  30. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +7 -4
  32. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  33. package/lib/cjs/hooks/useDebounce.js +28 -0
  34. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  35. package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
  36. package/lib/esm/common/Constants.js +4 -2
  37. package/lib/esm/common/storage/default/defaultCacheManager.js +2 -2
  38. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  39. package/lib/esm/common/telemetry/TelemetryConstants.js +13 -0
  40. package/lib/esm/common/telemetry/TelemetryHelper.js +2 -1
  41. package/lib/esm/common/utils.js +20 -0
  42. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  43. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  44. package/lib/esm/components/headerstateful/HeaderStateful.js +4 -2
  45. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  46. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  47. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  48. package/lib/esm/components/livechatwidget/common/endChat.js +23 -17
  49. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +26 -13
  50. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +6 -5
  51. package/lib/esm/components/livechatwidget/common/startChat.js +70 -59
  52. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +44 -38
  53. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  54. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -1
  55. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultPopOutgeneralPostChatSurveyPaneStyleProps.js +10 -0
  56. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  57. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  58. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  59. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  60. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  61. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  62. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  63. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  64. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  65. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +5 -5
  66. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  67. package/lib/esm/hooks/useDebounce.js +22 -0
  68. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  69. package/lib/esm/plugins/newMessageEventHandler.js +14 -0
  70. package/lib/types/common/Constants.d.ts +2 -0
  71. package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
  72. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
  73. package/lib/types/common/telemetry/TelemetryConstants.d.ts +14 -1
  74. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
  75. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  76. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  77. package/lib/types/common/utils.d.ts +1 -0
  78. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  79. package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
  80. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
  81. package/lib/types/components/postchatsurveypanestateful/common/defaultStyleProps/defaultPopOutgeneralPostChatSurveyPaneStyleProps.d.ts +2 -0
  82. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  83. package/lib/types/hooks/useDebounce.d.ts +3 -0
  84. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  85. package/package.json +3 -3
@@ -9,6 +9,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
9
9
  const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
10
10
  raiseMessageEvent(activity, isHistoryMessage);
11
11
  };
12
+ let isHistoryMessageReceivedEventRasied = false;
12
13
  const raiseMessageEvent = (activity, isHistoryMessage) => {
13
14
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
14
15
  var _text, _text2, _activity$channelData4, _activity$from;
@@ -39,6 +40,10 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
39
40
  if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.systemMessageTag)) {
40
41
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
42
  payload.messageType = Constants.systemMessageTag;
43
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
44
+ Event: TelemetryEvent.SystemMessageReceived,
45
+ Description: "System message received"
46
+ });
42
47
  } else {
43
48
  var _activity$channelData7, _activity$channelData8, _activity$channelData9;
44
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -63,6 +68,15 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
63
68
  Description: "New message received",
64
69
  Data: payload
65
70
  });
71
+ } else {
72
+ if (!isHistoryMessageReceivedEventRasied) {
73
+ isHistoryMessageReceivedEventRasied = true;
74
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
75
+ Event: TelemetryEvent.HistoryMessageReceived,
76
+ Description: "History message received",
77
+ Data: payload
78
+ });
79
+ }
66
80
  }
67
81
  }
68
82
  }
@@ -78,6 +78,7 @@ export declare class Constants {
78
78
  static readonly ChatWidgetStateChangedPrefix = "ChatWidgetStateChanged";
79
79
  static readonly PostChatLoadingDurationInMs = 2000;
80
80
  static readonly BrowserUnloadConfirmationMessage = "Do you want to leave chat?";
81
+ static readonly CacheTtlInMinutes = 15;
81
82
  }
82
83
  export declare const Regex: {
83
84
  new (): {};
@@ -125,6 +126,7 @@ export declare class HtmlAttributeNames {
125
126
  static readonly adaptiveCardClassName = "ac-adaptiveCard";
126
127
  static readonly adaptiveCardTextBlockClassName = "ac-textBlock";
127
128
  static readonly adaptiveCardToggleInputClassName = "ac-toggleInput";
129
+ static readonly adaptiveCardActionSetClassName = "ac-actionSet";
128
130
  }
129
131
  export declare class WebChatMiddlewareConstants {
130
132
  static readonly nextVisibleActivity = "nextVisibleActivity";
@@ -1,4 +1,4 @@
1
1
  export declare class defaultCacheManager {
2
2
  static InternalCache: any;
3
3
  }
4
- export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string) => void;
4
+ export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string, ttlInMins: number) => void;
@@ -1,2 +1,2 @@
1
1
  import { IContextDataStore } from "../../interfaces/IContextDataStore";
2
- export declare const defaultClientDataStoreProvider: () => IContextDataStore;
2
+ export declare const defaultClientDataStoreProvider: (cacheTtlinMins?: number) => IContextDataStore;
@@ -42,7 +42,12 @@ export declare enum BroadcastEvent {
42
42
  CloseChat = "CloseChat",
43
43
  InitiateEndChatOnBrowserUnload = "InitiateEndChatOnBrowserUnload",
44
44
  ClosePopoutWindow = "ClosePopoutWindow",
45
- RaiseErrorEvent = "RaiseErrorEvent"
45
+ RaiseErrorEvent = "RaiseErrorEvent",
46
+ NetworkDisconnected = "NetworkDisconnected",
47
+ NetworkReconnected = "NetworkReconnected",
48
+ SigninCardReceived = "SignInCardReceived",
49
+ BotAuthConfigRequest = "BotAuthConfigRequest",
50
+ BotAuthConfigResponse = "BotAuthConfigResponse"
46
51
  }
47
52
  export declare enum TelemetryEvent {
48
53
  CallAdded = "CallAdded",
@@ -102,6 +107,7 @@ export declare enum TelemetryEvent {
102
107
  DownloadTranscriptResponseNullOrUndefined = "DownloadTranscriptResponseNullOrUndefined",
103
108
  EmailTranscriptSent = "EmailTranscriptSent",
104
109
  EmailTranscriptFailed = "EmailTranscriptFailed",
110
+ ErrorUIPaneLoaded = "ErrorUIPaneLoaded",
105
111
  DownloadTranscriptFailed = "DownloadTranscriptFailed",
106
112
  StartChatFailed = "StartChatFailed",
107
113
  IC3ThreadUpdateEventReceived = "IC3ThreadUpdateEventReceived",
@@ -131,6 +137,11 @@ export declare enum TelemetryEvent {
131
137
  CustomerVoiceResponsePageLoaded = "CustomerVoiceResponsePageLoaded",
132
138
  CustomerVoiceFormResponseSubmitted = "CustomerVoiceFormResponseSubmitted",
133
139
  CustomerVoiceFormResponseError = "CustomerVoiceFormResponseError",
140
+ BotAuthActivityEmptySasUrl = "BotAuthActivityEmptySasUrl",
141
+ SetBotAuthProviderFetchConfig = "SetBotAuthProviderFetchConfig",
142
+ SetBotAuthProviderHideCard = "SetBotAuthProviderHideCard",
143
+ SetBotAuthProviderDisplayCard = "SetBotAuthProviderDisplayCard",
144
+ SetBotAuthProviderNotFound = "SetBotAuthProviderNotFound",
134
145
  ProcessingHTMLTextMiddlewareFailed = "ProcessingHTMLTextMiddlewareFailed",
135
146
  ProcessingSanitizationMiddlewareFailed = "ProcessingSanitizationMiddlewareFailed",
136
147
  FormatTagsMiddlewareJSONStringifyFailed = "FormatTagsMiddlewareJSONStringifyFailed",
@@ -157,6 +168,8 @@ export declare enum TelemetryEvent {
157
168
  ReconnectChatMinimize = "ReconnectChatMinimize",
158
169
  MessageSent = "MessageSent",
159
170
  MessageReceived = "MessageReceived",
171
+ SystemMessageReceived = "SystemMessageReceived",
172
+ HistoryMessageReceived = "HistoryMessageReceived",
160
173
  CustomContextReceived = "CustomContextReceived",
161
174
  NetworkDisconnected = "NetworkDisconnected",
162
175
  NetworkReconnected = "NetworkReconnected"
@@ -32,6 +32,8 @@ export interface LoadContract extends BaseContract {
32
32
  export interface ActionsContract extends BaseContract {
33
33
  Event?: string;
34
34
  ActionType?: string;
35
+ Description?: string;
36
+ CustomProperties?: any;
35
37
  }
36
38
  export interface IC3ClientContract extends BaseContract {
37
39
  Event?: string;
@@ -72,6 +72,7 @@ export interface ActionTelemetryData extends BaseTelemetryData {
72
72
  ActionType?: string;
73
73
  ExceptionDetails?: object;
74
74
  Description?: string;
75
+ CustomProperties?: any;
75
76
  }
76
77
  export interface CallingTelemetryData extends BaseTelemetryData {
77
78
  CallId?: string;
@@ -41,4 +41,8 @@ export interface ITelemetryConfig {
41
41
  * Omnichannel Chat SDK Version
42
42
  */
43
43
  OCChatSDKVersion: string;
44
+ /**
45
+ * LCW Runtime Id
46
+ */
47
+ LCWRuntimeId?: string;
44
48
  }
@@ -28,3 +28,4 @@ export declare const getStateFromCache: (orgId: string, widgetId: string, widget
28
28
  export declare const isUndefinedOrEmpty: (object: any) => boolean;
29
29
  export declare const addDelayInMs: (ms: number) => Promise<void>;
30
30
  export declare const getBroadcastChannelName: (widgetId: string, widgetInstanceId: string) => string;
31
+ export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[]) => void;
@@ -0,0 +1,9 @@
1
+ import { IActivitySubscriber } from "./IActivitySubscriber";
2
+ export declare class BotAuthActivitySubscriber implements IActivitySubscriber {
3
+ observer: any;
4
+ private signInCardSeen;
5
+ constructor();
6
+ applicable(activity: any): boolean;
7
+ apply(activity: any): Promise<any>;
8
+ next(activity: any): Promise<any>;
9
+ }
@@ -1,10 +1,10 @@
1
- import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
2
1
  import { Dispatch } from "react";
3
2
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
4
3
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
5
4
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
5
+ import StartChatOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/StartChatOptionalParams";
6
6
  declare const prepareStartChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
7
7
  declare const setPreChatAndInitiateChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | undefined, proactiveChatEnablePrechatState?: boolean | undefined, state?: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps | undefined) => Promise<void>;
8
- declare const initStartChat: (chatSDK: any, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string | undefined) => Promise<string | null>) | undefined, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, params?: any, persistedState?: any) => Promise<void>;
9
- declare const checkIfConversationStillValid: (chatSDK: any, props: any, requestId: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<boolean>;
8
+ declare const initStartChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, props?: ILiveChatWidgetProps | undefined, params?: StartChatOptionalParams | undefined, persistedState?: any) => Promise<void>;
9
+ declare const checkIfConversationStillValid: (chatSDK: any, props: ILiveChatWidgetProps, requestId: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<boolean>;
10
10
  export { prepareStartChat, initStartChat, setPreChatAndInitiateChat, checkIfConversationStillValid };
@@ -4,6 +4,7 @@ export interface ILiveChatWidgetControlProps {
4
4
  hideCallingContainer?: boolean;
5
5
  hideChatButton?: boolean;
6
6
  hideConfirmationPane?: boolean;
7
+ hideErrorUIPane?: boolean;
7
8
  hideFooter?: boolean;
8
9
  hideHeader?: boolean;
9
10
  hideLoadingPane?: boolean;
@@ -15,4 +16,5 @@ export interface ILiveChatWidgetControlProps {
15
16
  hideWebChatContainer?: boolean;
16
17
  hideStartChatButton?: boolean;
17
18
  widgetInstanceId?: string | undefined;
19
+ cacheTtlInMins?: number;
18
20
  }
@@ -0,0 +1,2 @@
1
+ import { IStyle } from "@fluentui/react";
2
+ export declare const defaultPopOutGeneralPostChatSurveyPaneStyleProps: IStyle;
@@ -1 +1 @@
1
- export declare const SendingTimestamp: ({ args }: any) => JSX.Element;
1
+ export declare const SendingTimestamp: () => JSX.Element;
@@ -0,0 +1,3 @@
1
+ declare type FunctionType = (...args: unknown[]) => void;
2
+ export default function useDebounce<Fn extends FunctionType>(func: Fn, delay?: number): Fn;
3
+ export {};
@@ -0,0 +1,4 @@
1
+ export default function useWindowDimensions(delay?: number): {
2
+ width: number;
3
+ height: number;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "0.1.0-main.0c0fd47",
3
+ "version": "0.1.0-main.0d8d3bf",
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.bff9c0d",
78
- "@microsoft/omnichannel-chat-sdk": "1.1.1-main.b88f92d",
77
+ "@microsoft/omnichannel-chat-components": "0.1.0-main.f4c21f0",
78
+ "@microsoft/omnichannel-chat-sdk": "1.2.1-main.171bfbe",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",
81
81
  "markdown-it": "^12.3.2",